# md.compute¶

Overview

 ThermodynamicQuantities Compute thermodynamic properties of a group of particles.

Details

Compute system properties.

class hoomd.md.compute.ThermodynamicQuantities(filter)

Compute thermodynamic properties of a group of particles.

Parameters

filter (hoomd.filter) – Particle filter to compute thermodynamic properties for.

ThermodynamicQuantities acts on a given group of particles and calculates thermodynamic properties of those particles when requested. All specified ThermodynamicQuantities objects can be added to a logger for logging during a simulation, see hoomd.logging.Logger for more details.

Examples:

f = filter.Type('A')
compute.ThermodynamicQuantities(filter=f)

property degrees_of_freedom

$$N_{\mathrm{dof}}$$, number of degrees of freedom given to the group by its integration method.

Calculated as:

$N_{\mathrm{dof}} = N_{\mathrm{dof, trans}} + N_{\mathrm{dof, rot}}$

(Loggable: category=”scalar”)

property kinetic_energy

$$K$$, total kinetic energy of all particles in the group (in energy units).

$K = K_{\mathrm{rot}} + K_{\mathrm{trans}}$

(Loggable: category=”scalar”)

property kinetic_temperature

$$kT_k$$, instantaneous thermal energy of the group (in energy units).

Calculated as:

$kT_k = 2 \cdot \frac{K}{N_{\mathrm{dof}}}$

(Loggable: category=”scalar”)

property num_particles

$$N$$, number of particles in the group.

(Loggable: category=”scalar”)

property potential_energy

$$U$$, potential energy that the group contributes to the entire system (in energy units).

The potential energy is calculated as a sum of per-particle energy contributions:

$U = \sum_{i \in \mathrm{filter}} U_i,$

where $$U_i$$ is defined as:

$U_i = U_{\mathrm{pair}, i} + U_{\mathrm{bond}, i} + U_{\mathrm{angle}, i} + U_{\mathrm{dihedral}, i} + U_{\mathrm{improper}, i} + U_{\mathrm{external}, i} + U_{\mathrm{other}, i}$

and each term on the RHS is calculated as:

\begin{align}\begin{aligned}U_{\mathrm{pair}, i} &= \frac{1}{2} \sum_j V_{\mathrm{pair}, ij}\\U_{\mathrm{bond}, i} &= \frac{1}{2} \sum_{(j, k) \in \mathrm{bonds}} V_{\mathrm{bond}, jk}\\U_{\mathrm{angle}, i} &= \frac{1}{3} \sum_{(j, k, l) \in \mathrm{angles}} V_{\mathrm{angle}, jkl}\\U_{\mathrm{dihedral}, i} &= \frac{1}{4} \sum_{(j, k, l, m) \in \mathrm{dihedrals}} V_{\mathrm{dihedral}, jklm}\\U_{\mathrm{improper}, i} &= \frac{1}{4} \sum_{(j, k, l, m) \in \mathrm{impropers}} V_{\mathrm{improper}, jklm}\end{aligned}\end{align}

In each summation above, the indices go over all particles and we only use terms where one of the summation indices ($$j$$, $$k$$, $$l$$, or $$m$$) is equal to $$i$$. External and other potentials are summed similar to the other terms using per-particle contributions.

(Loggable: category=”scalar”)

property pressure

$$P$$, instantaneous pressure of the group (in pressure units).

Calculated as:

$P = \frac{ 2 \cdot K_{\mathrm{trans}} + W }{D \cdot V},$

where $$D$$ is the dimensionality of the system, $$V$$ is the total volume of the simulation box (or area in 2D), and $$W$$ is calculated as:

$W = \frac{1}{2} \sum_{i \in \mathrm{filter}} \sum_{j} \vec{F}_{ij} \cdot \vec{r_{ij}} + \sum_{k} \vec{F}_{k} \cdot \vec{r_{k}},$

where $$i$$ and $$j$$ are particle tags, $$\vec{F}_{ij}$$ are pairwise forces between particles and $$\vec{F}_k$$ are forces due to explicit constraints, implicit rigid body constraints, external walls, and fields.

(Loggable: category=”scalar”)

property pressure_tensor

($$P_{xx}$$, $$P_{xy}$$, $$P_{xz}$$, $$P_{yy}$$, $$P_{yz}$$, $$P_{zz}$$).

Instantaneous pressure tensor of the group (in pressure units), calculated as:

$P_{ij} = \left[ \sum_{k \in \mathrm{filter}} m_k v_{k,i} v_{k,j} + \sum_{k \in \mathrm{filter}} \sum_{l} \frac{1}{2} \left(\vec{r}_{kl,i} \vec{F}_{kl,j} + \vec{r}_{kl,j} \vec{F}_{kl, i} \right) \right]/V$

where $$V$$ is the total simulation box volume (or area in 2D).

(Loggable: category=”sequence”)

property rotational_degrees_of_freedom
$$N_{\mathrm{dof, rot}}$$, number of rotational degrees of

freedom given to the group by its integration method.

(Loggable: category=”scalar”)

property rotational_kinetic_energy

$$K_{\mathrm{rot}}$$, rotational kinetic energy of all particles in the group (in energy units).

Calculated as:

$K_{\mathrm{rot}} = \frac{1}{2} \sum_{i \in \mathrm{filter}} \frac{L_{x,i}^2}{I_{x,i}} + \frac{L_{y,i}^2}{I_{y,i}} + \frac{L_{z,i}^2}{I_{z,i}},$

where $$I$$ is the moment of inertia and $$L$$ is the angular momentum in the (diagonal) reference frame of the particle.

(Loggable: category=”scalar”)

property translational_degrees_of_freedom

$$N_{\mathrm{dof, trans}}$$, number of translational degrees of freedom given to the group by its integration method.

When using a single integration method that is momentum conserving and operates on all particles, $$N_{\mathrm{dof, trans}} = DN - D - N_{constraints}$$, where $$D$$ is the dimensionality of the system.

Note

The removal of $$D$$ degrees of freedom accounts for the fixed center of mass in using periodic boundary conditions. When the filter in ThermodynamicQuantities selects a subset of all particles, the removed degrees of freedom are spread proportionately.

(Loggable: category=”scalar”)

property translational_kinetic_energy

$$K_{\mathrm{trans}}$$, translational kinetic energy of all particles in the group (in energy units).

$K_{\mathrm{trans}} = \frac{1}{2}\sum_{i \in \mathrm{filter}} m_i|\vec{v}_i|^2$

(Loggable: category=”scalar”)