How to Calculate Pressure and Properties of a group of atoms?

Dear LAMMPS users,

I want to model a lubricant between two solid surfaces. Therefore, I used 3 different regions and assigned 3 different groups to each region.
My question is that how should I calculate the Pressure, Stress, Volume, Density, and y-length of the lubricant group of atoms separately?


This is a surprisingly non-trivial problem. There are numerous previous discussion on this and closely related subject in the archives.

Bottom line: the volume of the groups of atoms is not well defined on the atomic scale since the volume of an atom is not a well defined property. If you consider the entire box and have periodic boundary conditions, the volume of the simulation cell is well defined, since it is an input parameter. If you have non-periodic boundaries, your volume is essentially infinite (it is only finite in so far as LAMMPS only considers atoms within a finite volume, the rest is assumed to be empty).

So you have to come up with some way to approximate the volume of each subsystem in a meaningful way. That is very system dependent and it is thus difficult to provide general advice. Once you have a consistent volume/length you can derive most of the other properties.

For stress/pressure you can compute the stress/atom and then take the sum over the group and multiply it by the approximated volume of that group and you have the pressure. Please see the example in the compute stress/atom showing how to compute the global pressure from stress/atom.

Thank you for your comprehensive answer.

I use periodic boundary conditions in the x and y direction and non-periodic in the z-direction (top and bottom solid surface). Therefore, for calculating the approximate volume of the lubricant group, is it appropriate to compute voronoi/atom and then take the sum over the group as the group’s volume?

Also, for the calculation of a group density, is it correct to compute 1 layer in chunk/atom (which means the total of the group) and then use fix ave/chunk density/mass?

Difficult to say in this generality. You have to make a test and see for yourself.

Please see the documentation of fix ave/chunk about which reference volume it uses. I suspect this command would only have meaning if your chunks are spatial chunks, i.e. you do binning in 1d, 2d, or 3d.

Thanks a lot for your answer.