Calculation of fix wall contribution to virial

Hello all,

I am interested in knowing the calculation that is performed to compute the contribution from a fix wall (of the fix wall/lj93 family) to the virial. To be clear, I am referring the mathematical expression that it is based on, not the code itself.
I already have an idea on what that should be and I would like to cross check it, but the documentation only mentions how to add this contribution, without any more details.

Maybe I am missing something obvious here. Does anybody know something extra and care to elaborate?

Thanks in advance,
Christos

Sorry, but if you are asking for these kinds of details about a software, the obvious response it to ask you to look it up in the source code. From that you should be able to reverse engineer the details.

If you want the theory behind that, you need to look up the virial theorem, but you are probably familiar with that already. For simple pairwise interactions, the virial is the sum of some form of F_{n,i} \cdot r_{m,j} with n,m being the dimensions, x, y, z and i,j atom indices and F being the force in that cartesian direction and r the distance between the two points. For a wall, one of the points is then the location of the wall surface or something equivalent.

The source code is pretty transparent:

      if (evflag) {
        if (side < 0)
          vn = -fwall * delta;
        else
          vn = fwall * delta;
        v_tally(dim, i, vn);
      }

The virtual contribution is just the wall force times the distance to the wall (sign changed according to whether the wall is positively or negatively displaced relative to the particle). fwall and delta are computed earlier in the same function. v_tally is inherited from fix.cpp and simply tallies the virial by particle i and diagonal component dim (since the wall force is always parallel with the wall-particle vector, there is no torque component to tally).