Dear LAMMPS users,

I am trying to calculate the system pressure based on the virial theorem as ** compute_presssure** does.

By comparing the virial part (

**), my calculation deviate much from the result in**

*force f dot location x***, which is from the function of**

*compute_pressure.cpp***in**

*virial_fdotr_compute()***.**

*pair.cpp*I used the same mathod in virial_fdotr_compute(), which sums f[i][0-2] dot x[i][0-2] for owned and ghost atoms.

I checked the differences by decoupling force and location, and found the location x[i][0-2] are the same, but the forces are not.

I read through the developer guide from LAMMPS, and found that after the force calculation by

**, there is**

*pair->compute()***, which maps forces on ghost atoms back to owned atoms.**

*comm->reverse_comm()*Because the virial from LAMMPS is calculated during

**, before comm->reverse_comm(), and I am trying to calculate virial during fix->post_force(), after comm->reverse_comm().**

*pair->compute()*I suppose the comm->reverse_comm() process makes the differences in calculating virial. But I donâ€™t know how it works and how I should solve that if this process results in the differences.

Thanks in advance for any advice and comments regarding this issue.

Best,

Xiao Jia