Pressure in non-periodic system with wall/reflect

Hello,

I have a fluid above a surface. The fluid is kept in the simulation box using wall/reflect set to some distance above the surface in the z direction. The boundaries of the system are p p s because I don’t want the fluid interacting with both sides of the surface. I am using the wall as a piston to compress the fluid. I output the pxx, pyy, and pzz components of the pressure tensor and I think that the pressure in the z-direction is wrong for reasons outlined here:

The values of pxx and pyy are positive, as I would expect for a fluid under compression. Pxx and pyy are about the same value, as I would expect (should have hydrostatic pressure). Pzz however is negative (but close in magnitude to pxx and pyy).

The question is: Is there a better way calculate the pressure of the fluid in this non-periodic, but definite volume system?

Thanks,

Dave

LAMMPS computes (global) pressure from the virial and the box volume according to what is written in the documentation for the compute pressure command. This is well defined for fully periodic bulk systems, but less so for non-periodic systems, closed or open.

For your system you could, for instance, divide it into several sections with the region command, determine the virial with compute stress/atom and then use compute reduce region to get the total and convert it to pressure using the volume of the region as shown (for the total box) in the documentation for compute stress/atom. There are also other definitions and derivations for “local” pressure. Keep in mind that specifically at the site where you define your surface, you have some incorrect representation, because you leave out the bulk but rather truncate the material and just leave some of it immobile, which will lead to incomplete/incorrect forces and thus incomplete/incorrect contributions to the virial.

What is adequate for your system is something that only you can determine.

That just means that the system would “like” to shrink.

For your system you could, for instance, divide it into several sections with the region command, determine the virial with compute stress/atom and then use compute reduce region to get the total and convert it to pressure using the volume of the region as shown (for the total box) in the documentation for compute stress/atom.

This makes sense and should be easy to implement. I really only want the fluid pressure, so I’ll just do the per atom stress, sum it for only the fluid atoms, and divide by the fluid volume.

That just means that the system would “like” to shrink.

And that is puzzling to me since I am compressing the box, it should want to expand. Or is pzz just completely wrong because the system is not periodic in the z direction (shrink wrapped + wall/reflect)? The stress/atom should sort that out.

I don’t want to speculate about this, since I don’t know what your system is and how it is set up. The virial is computed from the force contributions, so if you have strong(er) attractive forces outside the fluid area, they can dominate the total pressure contribution.