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”?

I greatly appreciate your help.

  • Matt

The question is why is the wall interaction not accounted for in the virial? There are a variety of answers: It’s extra work to code it up and maintain, the global pressure is not relevant in a non-uniform system, etc. Another important one is consistency, because the potential energy, on which the virial is based, also does not include the wall interaction (by default).

The consistency argument could be refuted. In the absence of an external field, the consistency relation Pxx = -1/A*dU/dLx is satisfied exactly by LAMMPS. This relation is also true in the presence of a wall, because the wall interaction is not included anywhere. Of course, it is possible to add the wall interaction to the potential energy using the fix_modify energy command, in which case the consistency relation is no longer satisfied. Perhaps the solution then is to provide a similar fix_modify option for the virial, so as to satisfy the consistency relation when the wall interaction is included in both U and Pxx.

The other arguments (work, relevance, etc.) still hold.

Aidan