# difficality for using compute pair/local for group.

Hello All,

I am simulating a system that includes two groups.
I have a question about the interaction energy.
I was used compute pair/local for total system and subsystems as follow;

# ---------- define atoms in a small region---------------------
group HNT id < 307
group PU id > 306

# ---------- Define Settings --------------------------------------------
compute pai all pair lj/class2/coul/long ecoul
compute paihnt HNT pair lj/class2/coul/long ecoul
compute paipu PU pair lj/class2/coul/long ecoul

unfortunately at the result, all energy is the same value, The compute
pair does not seem to have good functionality for groups.i am grateful
if you suggest any method for calculating the energy pair for each
group.

total pair energy = -1605.18349976695
pair energy of hnt = -1605.18349976695
pair energy of pu = -1605.18349976695

I have attached the data file and the input file.

Reza,

hntpu.data (304 KB)

in_Step9.in (4.79 KB)

Hello All,

I am simulating a system that includes two groups.
I have a question about the interaction energy.
I was used compute pair/local for total system and subsystems as follow;

below you are using compute pair, not compute pair/local.

# ---------- define atoms in a small region---------------------

group HNT id < 307
group PU id > 306

# ---------- Define Settings --------------------------------------------

compute pai all pair lj/class2/coul/long ecoul
compute paihnt HNT pair lj/class2/coul/long ecoul
compute paipu PU pair lj/class2/coul/long ecoul

unfortunately at the result, all energy is the same value, The compute
pair does not seem to have good functionality for groups.i am grateful

this is documented behavior. the documentation for compute pair says explicitly that the group is ignored.

if you suggest any method for calculating the energy pair for each
group.

it is not clear from your description and your attempted commands what energy exactly you are looking for.

you can compute the explicit (total) energy between two groups with compute group/group (but please read the documentation carefully).
you can extract the total tallied energy for each group with compute pe/atom followed by a compute reduce with the sum keyword.
you can record a trajectory and then use the “rerun” command on it where you only define the interactions that you want to monitor.

you also have to factor in, that for long-range electrostatics, the pair style only includes the real-space contribution (which depends significantly on the cutoff) while the full coulomb is only through adding the kspace contributions (this is one of the benefits of using rerun, you can use coul/long and kspace to compute the trajectories, but then get the coulomb contribution with reasonable accuracy by switching to a cutoff coulomb with a sufficiently large cutoff.

all of these issues have been discussed many times on this list, and thus you should find more insight by smartly searching through the mailing list archives.

…and don’t forget to always carefully read the documentation!

axel.