Greetings! We are calculating the pressure of a group of water by using the commands “compute pressure” and “compute stress/atom”. Ideally, the two results should be identical. Yet they constantly differ by a factor ~ 340 atm…(the one predicted by compute stress/atom is higher). We also tried to add the compute temp in order to remove the bias, but the temperature output is zero (why?) hence no help to remove the bias. I wonder if we miss anything in the setting? Do we need to care for the DOF calculation (since we are calculating rigid water)? Thank you for the help.

LC Liu

Piece of input script is as follows:

compute allperatom all stress/atom NULL compute allp all reduce sum c_allperatom[1] c_allperatom[2] c_allperatom[3] variable allpress equal -(c_allp[1]+c_allp[2]+c_allp[3])/(3*vol)

thermo 10
thermo_style custom v_phytime temp density press v_allpress

Greetings! We are calculating the pressure of a group of water by using the
commands "compute pressure" and "compute stress/atom". Ideally, the two
results should be identical. Yet they constantly differ by a factor ~ 340
atm....(the one predicted by compute stress/atom is higher). We also tried
to add the compute temp in order to remove the bias, but the temperature
output is zero (why?) hence no help to remove the bias. I wonder if we miss
anything in the setting? Do we need to care for the DOF calculation (since
we are calculating rigid water)? Thank you for the help.

impossible to say with so little information.

it works fine for me. i just ran three different test cases for rigid
water with fix shake and fix rigid/nvt, respectively, and in all cases
the pressure computation via compute reduce matches the regular global
pressure.

this is with the very latest LAMMPS-ICMS git repository code (last
updated dec 23rd) and the spce and tip4p test cases in the
test-user-omp folder (of LAMMPS-ICMS).

Sorry that I did not phrase the question with enough information. I used the ICMS version as mentioned in your previous email, but the difference persists.

I am attaching the input script and the partial output for your reference…

Sorry that I did not phrase the question with enough information. I used the
ICMS version as mentioned in your previous email, but the difference
persists.

well, the difference you see is to be expected, since you are using
pair_modify tail yes. that LJ tail correction contribution to the
pressure is not present when you compute the pressure from the per
atom stress, only when you compute the global (virial) stress (since
this is only computed globally). turn it off and the two numbers agree
as they should.

in short, you get what you are asking for. no bug in LAMMPS as far as
i can tell.

also, i don't see the "zero temperature" that you mentioned in your
initial e-mail. neither in my not your log. file.