External Virial Contribution in Fixes

Hi all,

I’m wondering why fixes that apply potential such as fix spring and fix wall don’t contribute to the virial. I know that it can be difficult to decide the per-atom contribution of external forces, but it doesn’t seem to me that the external virial contributes to total pressure at all. If there is a place for this contribution, can you point me to it?

Chatipat

Hi all,

I'm wondering why fixes that apply potential such as fix spring and fix wall
don't contribute to the virial.

because it hasn't been programmed.

I know that it can be difficult to decide
the per-atom contribution of external forces, but it doesn't seem to me that
the external virial contributes to total pressure at all. If there is a
place for this contribution, can you point me to it?

what do you mean by this? that you want to do the programming to
implement these contributions?

axel.

These are the fixes that currently calculate a contribution to the virial:

fix_cmap.cpp: virial_flag = 1;
fix_rigid.cpp: virial_flag = 1;
fix_rigid_small.cpp: virial_flag = 1;
fix_shake.cpp: virial_flag = 1;

These all have the characteristic of applying a force to a local group of atoms to constrain there relative positions. Presumably these contributions are consistent with the relation: Pxx*V/Lx = -dU/dLx. It would not be hard to extend this to other fixes that calculate a force (although this would not make sense for something like fix langevin). The real obstacle is knowing exactly what is the correct formulation and providing a test of correctness. Note also that the formulation will depend on whether the user wants to take the derivative du/dLx with constant wall position or with wall position scaled with the box. Finally, most wall fixes provide the total force vector and the user can extract the virial contribution from that, user the formulation they like the best.

Aidan

I thought external forces, like walls, do not contribute

to the virial. All the fixes that Aidan listed are “internal” forces,

that are applied within a molecule as a constraint force, as if

they were generated by the molecule itself.

Fixes like wall, langevin, efield, and spring, are “external” in

the sense their force is coming from something external to

the atoms. Hence no contribution to the virial, at least in the

sense it is used by compute pressure to calculate the

virial contribution, as an extra correction term on the ideal

gas law.

Steve