# compute group/group build neighbor list

Hello All,

I use compute group/group command to extract LJ energy/force for a required group of atoms. In the manual it is mentioned that

“The energy and force are calculated by looping over a neighbor list of pairwise interactions. Thus it can be inefficient to compute this quantity too frequently.”

Does this mean that the neighbor list is built for the group of atoms in compute group/group command every time i use? If so is it possible to delay the neighbor list built?

Thanks,
Rohit.

Hello All,

I use compute group/group command to extract LJ energy/force for a required
group of atoms. In the manual it is mentioned that

"The energy and force are calculated by looping over a neighbor list of
pairwise interactions. Thus it can be inefficient to compute this quantity
too frequently."

Does this mean that the neighbor list is built for the group of atoms in
compute group/group command every time i use? If so is it possible to delay
the neighbor list built?

no. it has nothing to do with that. compute group/group does

for each atom i do:
for each atom j in neighborlist[i] do:
call pair->single(i,j)
done
done

with pair->single(i,j)
doing some set up computation and
then compute the force and energy.

whereas for the regular force
(and energy) computation you do:

call pair->compute()
which does the setup as well,
but outside of the loop:

for each atom i do:
for each atom j in neighborlist[i] do:
compute forces (and energy, if needed)
done
done

this loop construct alone (which a compiler can
optimize and unroll) and the avoided overhead of
having to call a function makes pair->compute()
much more efficient than pair->single().

axel.

Hello Axel,

Thanks for the reply. If i understand correctly, by " pair->compute() " you mean the internal compute function used to calculate the force and energy values of LJ interaction which will be used in the
MD run.

Is it possible to extract the required values directly from the “pair->compute()” rather than using the function compute group/group?

One way i see is to write the force and energy values into an array as soon as they are calculated by “pair->compute()” , Will this give me a better speed than using compute group/group?

Regards,
Rohit.

Hello Axel,

Thanks for the reply. If i understand correctly, by " pair->compute() " you
mean the internal compute function used to calculate the force and energy
values of LJ interaction which will be used in the
MD run.

Is it possible to extract the required values directly from the
"pair->compute()" rather than using the function compute group/group?

no. the difference is what makes pair->compute() faster and more efficient.

One way i see is to write the force and energy values into an array as soon
as they are calculated by "pair->compute()" , Will this give me a better
speed than using compute group/group?

if you worry about speed for this that much, you should not
use compute group/group in the first place. but write your
own pair style or fix. intercepting individual pair force information
would be an extremely wasteful procedure.

axel.

All of Axel's advice/explanation is good.

Have you tried just using the compute group/group
command to see if is CPU costly for the
system you are running and the frequency
you want to invoke it?

Steve

Thanks Axel and Steve.

Steve, yes i have estimated the CPU cost for using compute group/group command and it is significant for my system. For now i am able to
get through my simulation with required data by decreasing the frequency of invoking the group/group command. I will look into the possibility
of writing a fix command as Axel suggested, if it becomes inevitable.

Regards,
Rohit.