compute pressure

Hi all,

I am trying to calculate the virial pressure by using the commands “compute pressure”.

First I thought sum of pressure of kinetic energy and of virial is equal to total pressure.

compute 1 all temp
compute 2 all pressure 1 ke
compute 3 all pressure 1 virial
compute 4 all pressure 1

variable pke equal c_2[1]
variable pvi equal c_3[1]
variable pxx equal c4_[1]

However pxx is not equal to pke+pvi. On the other hand, without tail correction pxx is equal to pke+pvi.

Is there anyway to include tail correction for separate virial contributions?

Thank you for the help.

It works fine for me. Please include the kspace contributions


Scalar pressure is pxx + pyy + pzz / 3
In compute pressure, the LJ tail correction is
added as a final correction to each diagonal
component of the pressure tensor. You can subtract
it out yourself if you wish. It’s just a scalar quantity.
We could add a hook for it in thermo output so
you could use ptail in a variable.