# Calculation if pe/atom using LAMMPS

LAMMPS : Potential energy of entire system is coming almost two time as the sum of potential energy of individual atoms in the system calculated by

compute 3 all pe/atom

compute 4 all reduce sum c_3

commands.

But both should be equal in magnitude.

Here I am writing the input commands file.

there is not enough information to provide a meaningful answer.
please see the mailing list guidelines for details http://lammps.sandia.gov/guidelines.html

axel.

Dear lammps community,

I was trying to calculate the pe/atom for a system but the Potential energy of entire system is coming almost two time as the sum of potential energy of individual atoms in the system calculated by

compute 3 all pe/atom

compute 4 all reduce sum c_3

commands.

But both should be equal in magnitude.

Here I am writing the input file.

Dear lammps community,

I was trying to calculate the pe/atom for a system but the Potential
energy of entire system is coming almost two time as the sum of potential
energy of individual atoms in the system calculated by

compute 3 all pe/atom

compute 4 all reduce sum c_3

commands.

But both should be equal in magnitude.

Here I am writing the input file.

​[...]​

_______________________________________________

pair_coeff 1 4

pair_coeff 2 4

pair_coeff 3 4

pair_coeff 4 4

​these lines are very obviously incorrect. this input cannot work. an input
that cannot be used to reproduce a problem is useless.

​[...]​

Step Temp PotEng TotEng 4
1000 1996.2558 -1459674.8 -1445209.2 -748980.04
1001 1997.0884 -1459680.7 -1445209.1 -748987.39
_________________________________________________________

Now just see the 3rd and the last column of the output. The 3rd column is
the PE of entire system and the last column is the sum of the PE of
individual atoms. These two quantity should be equal but they differs by a
multiplicative factor of approximately two. I don't understand why ? Help
me to resolve the issue. I am using lammps-24apr13 version.

​please verify the results with the latest​ version of LAMMPS. a lot has
changed in LAMMPS in the last three years. lots of bugs were removed. lots
of useful features added. many other things improved.

axel.

FYI, i’ve modified the file in.qeq.buck in examples/qeq as follows in order to reproduce what you are doing:

units metal
atom_style charge

pair_style buck/coul/long 12.0
pair_coeff 2 2 1388.77 .3623188 175.0
pair_coeff 1 2 18003 .2052124 133.5381
pair_coeff 1 1 0 .1 0
kspace_style ewald 1e-6

neighbor 1.0 bin
neigh_modify delay 0 every 1 check yes

compute 3 all pe/atom
compute 4 all reduce sum c_3

thermo_style custom step pe epair evdwl ecoul elong c_4
thermo 10
timestep 0.0001

velocity all create 300.0 1281937
fix 1 all nve
run 100

as you can see from the output quoted below, compute pe/atom and compute reduce are working fine in the current version of LAMMPS:

lmp_serial -in in.qeq.buck
LAMMPS (22 Mar 2016-ICMS)
orthogonal box = (0 0 0) to (25.1583 25.1583 28.0203)
1 by 1 by 1 MPI processor grid
1200 atoms
Ewald initialization …
G vector (1/distance) = 0.305064
estimated absolute RMS force accuracy = 2.07629e-05
estimated relative force accuracy = 1.44191e-06
KSpace vectors: actual max1d max3d = 1696 10 4630
kxmax kymax kzmax = 9 9 10
Neighbor list info …
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 13
ghost atom cutoff = 13
binsize = 6.5, bins = 4 4 5
Setting up Verlet run …
Unit style : metal
Current step : 0
Time step : 0.0001
Memory usage per processor = 4.25658 Mbytes
Step PotEng E_pair E_vdwl E_coul E_long 4
0 -35199.278 -35199.278 -574.18851 -21542.651 -13082.438 -35199.278
10 -35202.591 -35202.591 -568.25779 -21551.908 -13082.426 -35202.591
20 -35211.834 -35211.834 -551.41032 -21578.034 -13082.389 -35211.834
30 -35226.636 -35226.636 -524.05216 -21620.244 -13082.34 -35226.636
40 -35246.408 -35246.408 -486.83389 -21677.281 -13082.293 -35246.408
50 -35270.384 -35270.384 -440.65608 -21747.461 -13082.267 -35270.384
60 -35297.642 -35297.642 -386.61482 -21828.746 -13082.282 -35297.642
70 -35327.145 -35327.145 -325.96477 -21918.831 -13082.349 -35327.145
80 -35357.785 -35357.785 -260.05762 -22015.249 -13082.478 -35357.785
90 -35388.422 -35388.422 -190.25847 -22115.497 -13082.667 -35388.422
100 -35417.91 -35417.91 -117.85295 -22217.151 -13082.906 -35417.91
Loop time of 3.3533 on 1 procs for 100 steps with 1200 atoms

Performance: 0.258 ns/day, 93.147 hours/ns, 29.821 timesteps/s