calculated energy from group/group and pe/atom pair commands

Dear Lammps experts,

I have questions regarding the energy values calculated from compute group/group and compute pe/atom pair.
According to descriptions, both commands only calculate pair energy of a certain group.
So, my question is if I have only A group and apply following commands:

compute 1 A group/group A
compute 2 A pe/atom pair
compute pair A reduce sum c_2

thermo_style custom step c_1 c_pair

Should the last two colums provide same values?
The output somewhat shows slightly different values.

Thank you in advance for your valuable comments.

Joon

Not knowing what pair potential you’re using, perhaps this note is useful from the group/group manual entry:

EAM potentials only include the pair potential portion of the EAM interaction when used by this compute, not the embedding term.

If they’re only slightly different, maybe just floating point errors since different functions are at work.

-Brad

Dear Lammps experts,

I have questions regarding the energy values calculated from compute
group/group and compute pe/atom pair.
According to descriptions, both commands only calculate pair energy of a
certain group.
So, my question is if I have only A group and apply following commands:

compute 1 A group/group A
compute 2 A pe/atom pair
compute pair A reduce sum c_2

thermo_style custom step c_1 c_pair

Should the last two colums provide same values?

no. at least not under all conditions.
the first compute computes the interactions
between all pairs of atoms within the group,
the second sums the total potential energy
over all atoms in the group. the latter may
include many more interactions.

axel.

Thank you Dr.Axel and Brad.

However, I’m still little confused.
Let’s say the total system contains 2000 atoms and group A contains 1500 atoms.
Then, [compute 1 A group/group A] calculates all pair interaction energy within the group A (1500 atoms).
Likewise, [compute 2 A pe/atom pair] calculates the per-atom potential energy due to only the pair interaction in the group A (1500 atoms).
Therefore, those commands are supposed to calculate same number of pair interactions.

Am I wrong?

Fyi, I’m using lj/cut/coul/cut pairwise even though all atoms are 0 chaged.

Regards,

Joon

Thank you Dr.Axel and Brad.

However, I'm still little confused.
Let's say the total system contains 2000 atoms and group A contains 1500
atoms.
Then, [compute 1 A group/group A] calculates all pair interaction energy
within the group A (1500 atoms).
Likewise, [compute 2 A pe/atom pair] calculates the per-atom potential
energy due to only the pair interaction in the group A (1500 atoms).
Therefore, those commands are supposed to calculate same number of pair
interactions.

Am I wrong?

yes.

the first computes all pairs inside group A
the second computes all pairs for all atoms
and then you sum up over the atoms in group A.

that is not quite the same.

axel.