Inconsistent pressure gotten by compute pressure and stress/atom

Dear all,

According to the manual:

compute peratom all stress/atom NULL
compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
thermo_style custom step temp etotal press v_press

press and v_press should be the same. However, I didn’t get the same result.I noticed in a previous thread, the inconsistent results of compute pressure and stress/atom have been fixed. The thread address is http://lammps.sandia.gov/threads/msg53439.html. But I encountered again with August stable version.

Minimal input file:

units real
atom_style full

pair_style lj/cut/tip4p/long 1 2 1 1 0.215 9.5 9
pair_modify tail yes

bond_style harmonic
angle_style harmonic
kspace_style pppm/tip4p 1.0e-5

read_data “water.equil.data”

O-H bonded interactions

bond_coeff 1 0.0 0.9572
angle_coeff 1 0.0 104.52

O-O nonbonded interactions

pair_coeff 1 1 0.1825 3.234

O-H and H-H interactions

pair_coeff 2 2 0.00 0.00
pair_coeff 1 2 0.00 0.00

group tip4p_def type 1 2

variable Tstep equal 1

Initialize molecule

velocity all create 298 1234

neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes
fix fShakeTIP4P tip4p_def shake 1e-4 100 0 b 1 a 1
compute peratomv all stress/atom NULL
compute p all reduce sum c_peratomv[1] c_peratomv[2] c_peratomv[3]
variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3vol)
fix fxnpt all npt temp 298 298 (100.0*v_Tstep) iso 1 1 (1000.0
v_Tstep)

timestep ${Tstep}
thermo 1
thermo_style custom press v_press
thermo_modify flush yes
run 10

Data file and sample log file are attached.
If I comment “pair_modify tail yes”, press=v_press.

log.lammps.withcomment (3.35 KB)

water.equil.data (45.7 KB)

log.lammps (3.35 KB)

Dear all,

According to the manual:

compute peratom all stress/atom NULL
compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
thermo_style custom step temp etotal press v_press

press and v_press should be the same. However, I didn't get the same
result.I noticed in a previous thread, the inconsistent results of compute
pressure and stress/atom have been fixed. The thread address is
http://lammps.sandia.gov/threads/msg53439.html. But I encountered again with
August stable version.

the thread you are referring to was in reference to an inconsistency
in the compute pressure command.
it has no relation to the fact that compute stress/atom does not
include the tail correction. this will need to be added to your
expression in the equal style variable to compute the pressure (same
as it is added in compute pressure as an additional term).

axel.