# Forces and stresses¶

In classical molecular dynamics, the total potential energy \(U\) of a system can be written as the sum of site potentials \(U_i\):

Here, \(\boldsymbol{r}_{ij} \equiv \boldsymbol{r}_j - \boldsymbol{r}_i\) is the position difference vector used throughout this manual.

## Interatomic forces¶

A well-defined force expression for general many-body potentials that explicitly respects (the weak version of) Newton’s third law has been derived in [Fan2015]:

where

Here, \(\partial U_{i}/\partial \boldsymbol{r}_{ij}\) is a shorthand notation for a vector with Cartesian components \(\partial U_{i}/\partial x_{ij}\), \(\partial U_{i}/\partial y_{ij}\), and \(\partial U_{i}/\partial z_{ij}\).

Starting from the above force expression, one can derive expressions for the stress tensor and the heat current.

## Stress tensor¶

The stress tensor is an important quantity in MD simulations. It consists of two parts: a virial part which is related to the force and an ideal gas part which is related to the temperature. The virial part must be calculated along with force evaluation.

The validity of Newton’s third law is crucial to derive the following expression of the virial tensor [Fan2015]:

where

where only relative positions \(\boldsymbol{r}_{ij}\) are involved.

After some algebra, we can also express the virial as [Gabourie2021]

where

The ideal gas part of the stress is isotropic and given by the ideal-gas pressure:

where \(N\) is the number of particles, \(k_\mathrm{B}\) is Boltzmann’s constant, \(T\) is the absolute temperature, and \(V\) is the volume of the system.

The total stress tensor is thus