hoomd.compute¶
Overview
Compute thermodynamic properties of a group of particles. 
Details
Compute system properties
A compute calculates properties of the system on demand. Most computes are automatically generated by the command that needs them (e.g. integrate.nvt creates a compute.thermo for temperature calculations). Userspecified computes can be used when more flexibility is needed. Properties calculated by specified computes (automatically, or by the user) can be logged with analyze.log.

class
hoomd.compute.
thermo
(group)¶ Compute thermodynamic properties of a group of particles.
 Parameters
group (
hoomd.group
) – Group to compute thermodynamic properties for.
hoomd.compute.thermo
acts on a given group of particles and calculates thermodynamic properties of those particles when requested. A defaulthoomd.compute.thermo
is created that operates on the group of all particles. Integration methods such ashoomd.md.integrate.nvt
automatically create an internalhoomd.compute.thermo
for the group that they operate on. If thermodynamic properties are needed on additional groups, a user can specify additionalhoomd.compute.thermo
commands.Whether they are automatically created or created by a user, all specified thermos are available for logging via the
hoomd.analyze.log
command. Each one provides a set of quantities for logging, suffixed with _groupname, so that values for different groups are differentiated in the log file. The defaulthoomd.compute.thermo
specified on the group of all particles has no suffix placed on its quantity names.The quantities provided are (where groupname is replaced with the name of the group):
num_particles_groupname  \(N\) number of particles in the group
ndof_groupname  \(N_{\mathrm{dof}}\) number of degrees of freedom given to the group by integrate commands
translational_ndof_groupname  \(N_{\mathrm{dof}}\) number of translational degrees of freedom given to the group by integrate commands
rotational_ndof_groupname  \(N_{\mathrm{dof}}\) number of rotational degrees of freedom given to the group by integrate commands
potential_energy_groupname  \(U\) potential energy that the group contributes to the entire system (in energy units)
kinetic_energy_groupname  \(K\) total kinetic energy of all particles in the group (in energy units)
translational_kinetic_energy_groupname  \(K\) translational kinetic energy of all particles in the group (in energy units)
rotational_kinetic_energy_groupname  \(K\) rotational kinetic energy of all particles in the group (in energy units)
temperature_groupname  \(kT\) instantaneous thermal energy of the group (in energy units). Calculated as
\[kT = 2 \cdot \frac{K}{N_{\mathrm{dof}}}\]pressure_groupname  \(P\) instantaneous pressure of the group (in pressure units). Calculated as
\[W = \frac{1}{2} \sum_{i}\sum_{j \ne i} \vec{F}_{ij} \cdot \vec{r_{ij}} + \sum_{k} \vec{F}_{k} \cdot \vec{r_{k}}\]where \(\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. In 2D simulations, \(P = (K + \frac{1}{2}\cdot W)/A\) where \(A\) is the area of the simulation box. of the simulation box.
pressure_xx_groupname, pressure_xy_groupname, pressure_xz_groupname, pressure_yy_groupname, pressure_yz_groupname, pressure_zz_groupname  instantaneous pressure tensor of the group (in pressure units).
\[P_{ij} = \left[ \sum_{k\in[0..N)} m_k v_{k,i} v_{k,j} + \sum_{k\in[0..N)} \sum_{l > k} \frac{1}{2} \left(\vec{r}_{kl,i} \vec{F}_{kl,j} + \vec{r}_{kl,j} \vec{F}_{kl, i} \right) \right]/V\]
See also
Examples:
g = group.type(name='typeA', type='A') compute.thermo(group=g)

disable
()¶ Disables the thermo.
Examples:
my_thermo.disable()
Executing the disable command will remove the thermo compute from the system. Any
hoomd.run()
command executed after disabling a thermo compute will not be able to log computed values withhoomd.analyze.log
.A disabled thermo compute can be reenabled with
enable()
.

restore_state
()¶ Restore the state information from the file used to initialize the simulations

class
hoomd.compute.
thermoHMA
(group, temperature, harmonicPressure=0)¶ Compute HMA thermodynamic properties of a group of particles.
 Parameters
group (
hoomd.group
) – Group to compute thermodynamic properties for.temperature (float) – Temperature
harmonicPressure (float) – Harmonic contribution to the pressure. If ommitted, the HMA pressure can still be computed, but will be similar in precision to the conventional pressure.
hoomd.compute.thermoHMA
acts on a given group of particles and calculates HMA (harmonically mapped averaging) properties of those particles when requested. HMA computes properties more precisely (with less variance) for atomic crystals in NVT simulations. The presence of diffusion (vanacy hopping, etc.) will prevent HMA from providing improvement. HMA tracks displacements from the lattice positions, which are saved when thehoomd.compute.thermoHMA
is instantiated.The specified properties are available for logging via the
hoomd.analyze.log
command. Each one provides a set of quantities for logging, suffixed with _groupname, so that values for different groups are differentiated in the log file. The defaulthoomd.compute.thermoHMA
specified on the group of all particles has no suffix placed on its quantity names.The quantities provided are (where groupname is replaced with the name of the group):
potential_energyHMA_groupname  \(U\) HMA potential energy that the group contributes to the entire system (in energy units)
pressureHMA_groupname  \(P\) HMA pressure that the group contributes to the entire system (in pressure units)
See also
Examples:
g = group.all() compute.thermoHMA(group=g, temperature=1.0)

disable
()¶ Disables the thermoHMA.
Examples:
my_thermo.disable()
Executing the disable command will remove the thermoHMA compute from the system. Any
hoomd.run()
command executed after disabling a thermoHMA compute will not be able to log computed values withhoomd.analyze.log
.A disabled thermoHMA compute can be reenabled with
enable()
.

restore_state
()¶ Restore the state information from the file used to initialize the simulations