Summing compute pe/atom pair vs epair

All,

I think that summing per-atom pair energy (keyword pair) using two commands
below would be the same as epair. However, the results are different. I do
not use tail correction term.

   compute peratom all pe/atom pair
   compute pairE all reduce sum c_peratom

   thermo_style custom step epair c_pairE

c_pairE has a large positive value instead of a negative value obtained
from epair.

I think that c_pairE has something different than epair.

Would you please let me know what is the difference between "epair" and
"summing pe/atom pair energy"?

Sincerely,
James

All,

I think that summing per-atom pair energy (keyword pair) using two commands below would be the same as epair. However, the results are different. I do not use tail correction term.

compute peratom all pe/atom pair
compute pairE all reduce sum c_peratom

thermo_style custom step epair c_pairE

c_pairE has a large positive value instead of a negative value obtained from epair.

I think that c_pairE has something different than epair.

Would you please let me know what is the difference between “epair” and “summing pe/atom pair energy”?

there should be none. however, epair may be normalized, i.e. divided by the number of atoms.

axel.

Dr. Axel.

Thanks.

Despite normalization, the different sign (epair has negative but summing per-atom values has positive) does not make sense.

Not only are the energies for ebond and pe/atom bond exactly the same, but the results for eangle & pe/atom angle and for edihedral & pe/atom dihedral are also matched perfectly.

The only results for epair & pe/atom pair are different.

I could not believe the Dec/2019 lammps version caused the problem.

James.

please provide a minimal/small input example with the associated data file that demonstrates the discrepancy.

axel.

The data file contains about 50,000 atoms in it. But the basic simple input script is as follows.

units realneigh_modify delay 5 every 1
atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style harmonic
pair_style lj/cut/coul/long 9.0
boundary p p p
kspace_style pppm 1e-4

read_data sample.data # containing 50,000 atoms which are crosslinked as a whole molecule

timestep 1.0

group cluster molecule 0 # single molecule as a whole system

compute 1 cluster pe/atom pair
compute clusterpair cluster reduce sum c_1

this compute below is to verify group-ID is the same as the whole molecule in the system

compute 2 all pe/atom pair
compute wholepair all reduce sum c_2

thermo_style custom etoal pe ke epair c_wholepair c_clusterpair

fix 1 all npt temp 300 300 100 y 1.0 1.0 1000 z 1.0 1.0 1000 couple none
fix 2 all deform 1 x erate 1e-6 units box remap x

run 100000

The data file contains about 50,000 atoms in it. But the basic simple input script is as follows.

that is sufficient info. as shown in the thermo_style documentation epair is evdwl + ecoul + elong
however pe/atom pair only contains “evdwl + ecoul”. you would have to use “pe/atom pair kspace”
to get the value of epair after the reduction.

axel.

Got it.

Thank you.

James