Journal of Chemical Physics, Vol.116, No.16, 6880-6897, 2002
Calculation of the group-based pressure in molecular simulations. I. A general formulation including Ewald and particle-particle-particle-mesh electrostatics
A general formulation is given for the calculation of the isotropic or anisotropic group-based instantaneous pressure in molecular simulations under periodic boundary conditions. The equations, derived from the statistical mechanical definition of the pressure, apply to groups defined as single atoms (atomic pressure) or whole molecules (molecular pressure), but also to any other arbitrary atom grouping. Different definitions lead to different pressure fluctuations, but to the same average pressure. Two sets of equations are derived for the calculation of the group-based virial. The "traditional" set, which is the one commonly used to compute molecular pressures in simulations, has two main drawbacks: (i) it requires bookkeeping of group definitions in the inner loop of the nonbonded interaction calculation, (ii) it cannot be applied when electrostatic interactions are computed through lattice-sum methods. The "alternative" set is based on the remarkable result that any group-based virial can be computed from the atomic virial by adding a computationally inexpensive correction term to account for atom grouping. This new formalism presents the following advantages: (i) it requires no bookkeeping of group definitions in the inner loop of the nonbonded interaction calculation, (ii) the isotropic virial corresponding to each homogeneous pairwise interaction term can be computed directly from the corresponding interaction energy contribution without knowledge of the pairwise forces, (iii) application to lattice-sum electrostatics is straightforward. Traditional and alternative virial expressions are derived for all terms typical of interaction functions used in molecular simulations, namely covalent, Lennard-Jones (and long-range correction), truncated electrostatic (and reaction-field correction), and lattice-sum electrostatic (Ewald and particle-particle-particle-mesh including self-energy) terms.