# 5.4: Temperature and pressure estimators

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$

( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\id}{\mathrm{id}}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\kernel}{\mathrm{null}\,}$$

$$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$

$$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$

$$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$

$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$

$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vectorC}[1]{\textbf{#1}}$$

$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$

$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$

$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$

From the classical virial theorem

$\langle x_i\frac {\partial H}{\partial x_j}\rangle = kT\delta_{ij} \nonumber$

we arrived at the equipartition theorem:

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

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} \nonumber$

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> \nonumber$

$$K( \textbf {p}_1,\cdots ,\textbf {p}_N)$$ ﻿\\) is known as an 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} \nonumber$

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})} \nonumber$

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 $$s$$ integration will be from 0 to 1. The coordinates $$s_i$$ $$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 \nonumber$

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 \nonumber$

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} \nonumber$

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}) \nonumber$

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 \} \nonumber$

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 ] \nonumber$

and the pressure is given by

$P = \langle \Pi(x)\rangle \nonumber$

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.

This page titled 5.4: Temperature and pressure estimators is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Mark Tuckerman.