Virial stress

Virial stress is a measure of mechanical stress on an atomic scale for homogeneous systems. The name is derived from the Latin word vis, meaning force: "Virial is then derived from Latin as well, stemming from the word virias (plural of vis) meaning forces." The expression of the (local) virial stress can be derived as the functional derivative of the free energy of a molecular system with respect to the deformation tensor.

Volume averaged Definition
The instantaneous volume averaged virial stress is given by


 * $$\tau_{ij} = \frac{1}{\Omega} \sum_{k \in \Omega} \left(-m^{(k)} (u_i^{(k)}- \bar{u}_i) (u_j^{(k)}- \bar{u}_j) + \frac{1}{2} \sum_{\ell \in \Omega} ( x_i^{(\ell)} - x_i^{(k)}) f_j^{(k\ell)}\right)$$

where
 * $$k$$ and $$\ell$$ are atoms in the domain,
 * $$\Omega$$ is the volume of the domain,
 * $$m^{(k)}$$ is the mass of atom k,
 * $$u_i^{(k)}$$ is the ith component of the velocity of atom k,
 * $$\bar{u}_j$$ is the jth component of the average velocity of atoms in the volume,
 * $$x_i^{(k)}$$ is the ith component of the position of atom k, and
 * $$f_i^{(k\ell)}$$ is the ith component of the force applied on atom $$k$$ by atom $$\ell$$.

At zero kelvin, all velocities are zero so we have
 * $$\tau_{ij} = \frac{1}{2\Omega} \sum_{k,\ell \in \Omega} ( x_i^{(\ell)} - x_i^{(k)}) f_j^{(k\ell)}$$.

This can be thought of as follows. The τ11 component of stress is the force in the x1-direction divided by the area of a plane perpendicular to that direction. Consider two adjacent volumes separated by such a plane. The 11-component of stress on that interface is the sum of all pairwise forces between atoms on the two sides.

The volume averaged virial stress is then the ensemble average of the instantaneous volume averaged virial stress.

In a three dimensional, isotropic system, at equilibrium the "instantaneous" atomic pressure is usually defined as the average over the diagonals of the negative stress tensor:


 * $$\mathcal{P}_{at} = -\frac{1}{3}Tr(\tau).$$

The pressure then is the ensemble average of the instantaneous pressure
 * $$P_{at} =\langle \mathcal{P}_{at} \rangle.$$

This pressure is the average pressure in the volume $$\Omega$$.

Equivalent Definition
It's worth noting that some articles and textbook use a slightly different but equivalent version of the equation


 * $$\tau_{ij} = \frac{1}{\Omega} \sum_{k \in \Omega} \left(-m^{(k)} (u_i^{(k)}- \bar{u}_i) (u_j^{(k)}- \bar{u}_j) - \frac{1}{2} \sum_{\ell \in \Omega} x_i^{(k\ell)} f_j^{(k\ell)}\right)$$

where $$ x_i^{(k\ell)} $$ is the ith component of the vector oriented from the $$\ell$$th atoms to the kth calculated via the difference

$$ x_i^{k\ell} = x_i^{(k)} - x_i^{(\ell)} $$

Both equation being strictly equivalent, the definition of the vector can still lead to confusion.

Derivation
The virial pressure can be derived, using the virial theorem and splitting forces between particles and the container or, alternatively, via direct application of the defining equation $$P=-\frac{\partial F(N,V,T)}{\partial V}$$ and using scaled coordinates in the calculation.

Inhomogeneous Systems
If the system is not homogeneous in a given volume the above (volume averaged) pressure is not a good measure for the pressure. In inhomogeneous systems the pressure depends on the position and orientation of the surface on which the pressure acts. Therefore, in inhomogeneous systems a definition of a local pressure is needed. As a general example for a system with inhomogeneous pressure you can think of the pressure in the atmosphere of the earth which varies with height.

Instantaneous local virial stress
The (local) instantaneous virial stress is given by:

$$\tau_{ab}(\vec{r})=- \sum_{i=1}^N \delta(\vec{r}-\vec{r}^{(i)}) \left(m^{(i)} u^{(i)}_a u^{(i)}_b + \frac{1}{2} \sum_{j=1, j \neq i}^{N} (\vec{r}^{(i)}-\vec{r}^{(j)})_a \vec{f}^{(ij)}_b \right),$$

Measuring the virial pressure in molecular simulations
The virial pressure can be measured via the formulas above or using volume rescaling trial moves.