# Temperature and pressure estimators

- Page ID
- 5232

From the classical virial theorem

\[\langle x_i\frac {\partial H}{\partial x_j}\rangle = kT\delta_{ij}\]

we arrived at the equipartition theorem:

\[ \left<\sum_{i=1}^{N}\frac {p_i^2}{2m_i}\right > = \frac {3}{2} NkT\]

where \(\textbf {p}_1, \cdots , \textbf {p}_N \) are the \(N \) Cartesian momenta of the \(N\) particles in a system. This says that the microscopic function of the \(N\) momenta that corresponds to the temperature, a macroscopic observable of the system, is given by

\[ K( \textbf {p}_1,\cdots ,\textbf {p}_N) = \sum_{i=1}^{N} \frac {\textbf {p}_i^2}{2m_i}\]

The ensemble average of \(K\) can be related directly to the temperature

\[ T = \frac {2}{3Nk} \left< K({\textbf p}_1,\cdots,{\textbf p}_{N})\right > =\frac {2}{3nR} \left < K({\textbf p}_1,\cdots,{\textbf p}_{3})\right>\]

\( K( \textbf {p}_1,\cdots ,\textbf {p}_N) \) *estimator* (a term taken over from the Monte Carlo literature) for the temperature. An estimator is some function of the phase space coordinates, i.e., a function of microscopic states, whose ensemble average gives rise to a physical observable.

An estimator for the pressure can be derived as well, starting from the basic thermodynamic relation:

\[ P = -\left(\frac {\partial A}{\partial V} \right)_{N,T} = kT\left(\frac {\partial \ln Q(N,V,T)}{\partial V}\right)_{N,T}\]

with

\[ Q(N,V,T) = C_N\int dx\;e^{-\beta H(x)} =C_N \int d^{N}{\textbf p}\int_{V}d^{N}{\textbf r}\;e^{-\beta H({\textbf p},{\textbf r})}\]

The volume dependence of the partition function is contained in the limits of integration, since the range of integration for the coordinates is determined by the size of the physical container. For example, if the system is confined within a cubic box of volume \(V = L^3 \), with \(L\) the length of a side, then the range of each \(q\) integration will be from 0 to \(L\). If a change of variables is made to \(s_i = \frac {q_i}{L} \) , then the range of each integration will be from 0 to 1. The coordinates \(s_i\) are known as scaled coordinates. For containers of a more general shape, a more general transformation is

\[ {\textbf s}_i = V^{-1/3}{\textbf r}_i\]

To preserve the phase space volume element, however, we need to ensure that the transformation is a canonical one. Thus, the corresponding momentum transformation is

\[ \pi_i = V^{1/3}{\textbf p}_i\]

With this coordinate/momentum transformation, the phase space volume element transforms as

\[d^{N}{\textbf p}\;d^{N}{\textbf r}= d^{N}\pi d^{N}{\textbf s}\]

Thus, the volume element remains the same as required. With this transformation, the Hamiltonian becomes

\[ H = \sum_{i=1}^{N} \frac {{\textbf p}_i^2}{2m_i} + U({\textbf r}_1,\cdots , {\textbf r} _N) = \sum _{i=1}^N \frac {V^{-2/3} \pi _i^2}{2m_i} U( {V}^{\textbf s}_1,...,V^{1/3}{\textbf s}_{N})\]

and the canonical partition function becomes

\[ Q(N,V,T) = C_N \int \;d^{N}\pi\int\;d^{N}{\textbf s}\;\exp\left \{- \beta \left [ \sum _{i=1}^N \frac {V^{-2/3} \pi ^2_i}{2m_i} +U (V^{1/3}{\textbf s} _1,\cdots,V^{1/3}{\textbf s}_N)\right ]\right \}\]

Thus, the pressure can now be calculated by explicit differentiation with respect to the volume, \(V\):

\(P\) | \( kT \frac {1}{Q} \frac {\partial Q}{\partial V}\) | ||

\( \frac{kT}{Q} C_N\int\;d^{N}\pi\int\;d^{N}{\textbf s}\;\left [ \frac {2}{3} \beta V^{-5/3} \sum _{i=1}^N \frac {\pi ^2_i}{2m_i} - \frac {\beta}{3} V^{-2/3} \sum _{i=1}^N {\textbf s}_i\cdot\frac {\partial U}{\partial (V^{1/3}{\textbf s}_i)}\right ]e^{-\beta H}\) | |||

\( \frac {kT}{Q}C_N\int\;d^{N}{\textbf p}\int\;d^{N}{\textbf r}\left[\frac {\beta}{3V} \sum _{i=1}^N \frac {{\textbf P}^2_i}{m_i} - \frac {\beta}{3V} \sum _{i=1}^N {\textbf r}_i\cdot \frac {\partial U}{\partial {\textbf r}_i}\right ]e^{-\beta H({\textbf p},{\textbf r})}\) | |||

\( \frac{1}{3V} \left<\sum_{i=1}^{N}\left( \frac {{\textbf p}_i^2}{m_i} + {\textbf r}_i\cdot {\textbf F}_i\right )\right >\) | |||

\( \langle-\frac {\partial H}{\partial V}\rangle\) |

Thus, the pressure estimator is

\[ \Pi({\textbf p}_1,...,{\textbf p}_N,{\textbf r}_1,...,{\textbf r}_N) = \Pi (x) = \frac {1}{3V} \sum _{i=1}^N \left [ \frac {{\textbf p}_i^2}{2m_i} + {\textbf r}_i\cdot{\textbf F}_i({\textbf r})\right ]\]

\[ P = \langle \Pi(x)\rangle\]

For periodic systems, such as solids and currently used models of liquids, an absolute Cartesian coordinate \(q_i\) is ill-defined. Thus, the virial part of the pressure estimator \(\sum _i q_i F_i \) must be rewritten in a form appropriate for periodic systems. This can be done by recognizing that the force \(F_i\) is obtained as a sum of contributions \(F_{ij}\), which is the force on particle \(i\) due to particle \(j\). Then, the classical virial becomes

\( \sum_{i=1}^{N}{\textbf r}_i\cdot {\textbf F}_i\) | \( \sum_{i=1}^{N}{\textbf r}_i \cdot \sum_{j\neq i} {\textbf F}_{ij}\) | ||

\( \frac {1}{2}\left[\sum_i {\textbf r}_i\sum_{j\neq i}\cdot F_{ij} +\sum_j {\textbf r}_j\cdot\sum_{i\neq j}{\textbf F}_{ji}\right]\) | |||

\( \frac {1}{2}\left [ \sum_i{\textbf r}_i\cdot\sum_{j\neq i}{\textbf F}_{ij} - \sum_j{\textbf r}_j\cdot\sum_{i\neq j}{\textbf F}_{ij}\right ]\) | |||

\( \frac{1}{2}\sum_{i,j,i\neq j}({\textbf r}_i-{\textbf r}_j)\cdot{\textbf F}_{ij} = \frac {1}{2} \sum_{i,j,i\neq j} {\textbf r}_{ij} \cdot {\textbf F}_{ij}\) |

where \(\textbf {r}_{ij}\) is now a relative coordinate. \(\textbf {r} _{ij}\) must be computed consistent with periodic boundary conditions, i.e., the relative coordinate is defined with respect to the closest periodic image of particle \(j\) with respect to particle \(i\). This gives rise to surface contributions, which lead to a nonzero pressure, as expected.