# Problem on difference in total potential energy and summation of per-atom potential energy

Hi. lammps users

I’m trying to simulate the behaviors of graphene sheets when one sheet of graphene is opening.

So, i want calculate the surface energy.

But, in this process, i hava a problem.

The total potential energy and summation of per-atom potential energy are not same in my result.

How can it be?? I’m very confused.

This is my code.

---------------------------------------------------------------------------------------------------

log grap1.log

# ---------- Initialize Simulation ---------------------

clear

units metal

dimension 3

boundary p p p

newton on

# ---------- Atoms definition ---------------------

# ---------- Define Interatomic Potential ---------------------

pair_style airebo 3.0

pair_coeff * * CH.airebo C C

neighbor 0.2 bin

neigh_modify delay 0 every 1 check yes

#--------------Setting-------------------------------

compute eng all pe/atom

compute eatoms all reduce sum c_eng

thermo 10

thermo_style custom step lx ly lz press pxx pyy pzz pe temp

#-------------Dynamic------------------------

# variables

reset_timestep 0

#variable natoms equal count(out)

variable Epot equal pe

#variable Epot0 equal {Epot}<br><br><br><br>variable NF equal fcm(out,z)<br><br><br><br>variable zo equal xcm(out,z)<br><br><br><br>variable zb equal xcm(bottom,z)<br><br><br><br>variable nf0 equal {NF}

variable zo0 equal {zo}<br><br><br><br>variable teng equal "c_eatoms"<br><br><br><br><br><br><br><br><br><br><br><br><br><br>fix 2 all nvt temp 300 300 0.01<br><br><br><br>fix 3 bottom momentum 1 linear 1 1 1 angular<br><br><br><br>fix_modify 2 energy yes # extended Hamiltonian for NVT<br><br><br><br>fix extra out print 10 "{NF}" file nf.txt

fix disp out print 10 “{zo}" file dis.txt<br><br><br><br>#fix disp1 bottom print 10 "Displacement = {zb}” file dis1.txt

fix disp2 all print 10 “\${Epot}” file pe.txt

velocity out set 0.0 0.0 20.0 sum no units box

dump 1 all atom 10 dump.gra

thermo 10

thermo_style custom step temp pe lx ly lz press c_eatoms

run 400

quit

-----------------------------------------------------------------------------------

And, the result shows different value between total pot and summation of per-atom energy.

Step Temp PotEng Lx Ly Lz Press eatoms

0 378.36359 -15392.957 31.461894 33.534282 100 1214.9496 -15392.957

10 341.0589 -15382.87 31.461894 33.534282 100 718.54157 -15392.349

---------------------------------------------------------------------------------------

I’m waiting your helps.

Thanks.

|

Please post a simple small example where the
difference occurs. E.g. a data file that
is read in for a single snapshot and a run 0, where the two
energies disagree. For as small a problem
as possible. Then we can look into what
is causing the difference.

Steve