Dear all,
I’ve spent some time trying to calculate the virial pressure for a Lennard-Jones system in LAMMPS, and realised that there are some subtle issues in the literature. If I understand things correctly, for pairwise forces LAMMPS calculates the virial pressure as the sum
\sum_{i = 1}^{N} f_i \cdot r_i (1)
where f_i is the force acting on particle i, and r_i its position. For a finite system with pairwise additive forces, this is known to reduce to
\sum_{i = 1}^{N-1} \sum_{j > i}^{N} f_{ij} \cdot r_{ij} (2)
where f_{ij} and r_{ij} are now the force and separation vectors between particles i and j. In systems with periodic boundary conditions, however, these two formulations are equivalent. If I’ve understood the literature correctly, Eq. (1) does not hold anymore when using PBCs, although Eq. (2) still remains valid through a lucky coincidence (see Louwerse and Baerens, Chem. Phys. Lett. 421, 138-141 (2006)). The difference between the two formulas is far from negligible: for a test configuration, I got a more than 10-fold difference between the pressures computed using the two approaches. Have I misunderstood the code, or is it actually the case that Eq. (1) is used per default even when using periodic boundary conditions? In that case, this ought to yield significant errors in the pressure calculations. Kind regards, Joakim Stenhammar