pressure profile

Hello Lammps User

Recently I’ve been trying to compute pressure profiles on inhomogeneous systems. For example on slabs of liquid argon or liquids inside nanopores.

After reading some literature i found that pressure on inhomogeneous systems is not uniquely defined and that there are different ways of computing it. Let say for example the Virial route or the irving kirkwood method.

I know that the pressure profiles with the virial route can be computed with some post processing of the stress/atom output without limitations in the potential used. The irving kirkwood as i understand is not available in lammps, at least not in a simple way and not for all the potentials.

Here is my question.
If I have an inhomogeneous system lets say a slab of liquid argon facing the Z direction, by mechanical stability the component zz of the pressures tensor must be constant throughout the simulation box and the other components xx and yy will change at the interface. For what I have seen this is true for the irving kirkwood pressure but not for the virial computation, see for example figure 2 of the paper “Pressure Analyses at the Planar Surface of Liquid-Vapor Argon by a Test-AreaMolecular Dynamics Simulation”. Does this means a limitation on the virial route? I know that macroscopic properties as surface tension are not affect by this difference because is an integral, but if i am concern on pressure changes due to the inhomogeneity, Does this means that i cannot use the virial way of computing pressure?

I would appreciate some thoughts on this matters

Thank you

Even for an inhomogeneous system, the pressure tensor is a continuum or thermodynamic concept. In order to extract something meaningful from MD, you need to integrate local forces over an area or volume, and time averaging is recommended, since we do not have access to sufficient area or volume in most cases to get a good ensemble average from a single snapshot. Given that, you have a lot of options. The literature is vast, and filled with confusing claims of correctness and incorrectness. In many cases, practitioners are attempting to achieve spatial resolution that exceeds what is physically meaningful. If you want to avoid disappearing down a rabbithole, I suggest you start with what LAMMPS calls the global stress tensor labelled pxx, pyy…in thermo output. Beyond that, you can do your own post processing of compute stress/atom dump output to can spatial profiles of stress. You can even do this inline with the simulation by using the fix ave/chunk command ( If for some reason, that is not good enough, you can adopt more sophisticated, more expensive, more difficult to get right, and more restrictive methods based on Hardy and/or Irving/Kirkwood e.g. see