Does compute pressure include forces from fix wall constraints?

Hello,

I am using lamps-14May16.

In the manual for this version, under the command “compute pressure”, it is stated that “Fixes that impose constraints […] also contribute to the virial term.” So, in a system of non-interacting particles (pair_style zero), with LJ 10-4-3 wall interactions (fix wall/lj1043), I would expect the virial, in general, to be non-zero, given that the wall fix imposes a constraint on the system. Specifically, in such a system wherein the walls are at the upper and lower Z surfaces, and the separation between the walls is equal to two sigma, I would expect the virial to be much greater than zero.

However, when I run such a system (using the attached script), the virial is always zero. Is this a bug, or am I misinterpreting the manual? And is there a straightforward way to include the wall forces?

Thanks!

Kind regards,

in.NVEwallCheck2 (1.31 KB)

Hello,

I am using lamps-14May16.

In the manual for this version, under the command "compute pressure", it
is stated that "Fixes that impose constraints [...] also contribute to the
virial term." So, in a system of non-interacting particles (pair_style
zero), with LJ 10-4-3 wall interactions (fix wall/lj1043), I would expect
the virial, in general, to be non-zero, given that the wall fix imposes a
constraint on the system. Specifically, in such a system wherein the walls
are at the upper and lower Z surfaces, and the separation between the walls
is equal to two sigma, I would expect the virial to be much greater than
zero.

However, when I run such a system (using the attached script), the virial
is always zero. Is this a bug, or am I misinterpreting the manual? And is
there a straightforward way to include the wall forces?

​​a wall fix is not a constraint. constraint fixes are fix shake, fix
rattle, fix rigid etc. (or technically any fix that sets the virial_flag
variable to 1 in its constructor). i don't think it is a good idea to argue
science with semantics, so let us try physics instead.
here is my reasoning:

for non-interacting particles, pressure should follow the ideal gas law,
right? i.e. it would be proportional to the temperature, the number of
particles, and inverse proportional to the volume. if you look at the
compute pressure doc page, you will recognize the ideal gas law as the
first part of the pressure term. this translates in LAMMPS by the computing
the kinetic term of the virial and pressure is then obtained from the
virial through division by the volume. i don't see how including wall fixes
here should be correct.

in fact, shouldn't the total force per area affected by the wall be a
*measure* of the pressure, by the nature of newton's third law?

axel.

Another way to think about it is, external

forces (wall, fix efield, fix setforce) act on

individual atoms and do not contribute to the virial.

The virial is from forces between atoms (pairwise,

shake, rigid body constraints).

A wall may squish the particles and raise the

pressure, but that comes from stronger pairwise

interactions between particles that are now
closer together, not b/c of the wall

force acting on individual particles.

Steve

Ah, thank you both. If I understand you correctly, LAMMPS defines the wall to be outside the system, and therefore, the forces associated with the wall are not included in the virial, nor are any other external forces. The crux of the matter is whether the wall is considered part of the system or not. And if I put explicit atoms into the model to represent a wall, then they would be part of the system and would contribute to the virial.

So, if I want to include the smooth wall’s contribution to the pressure, I imagine I need to define a compute to calculate the “wall pressure”?