hoomd.compute

Overview

hoomd.compute.thermo 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). User-specified 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 default hoomd.compute.thermo is created that operates on the group of all particles. Integration methods such as hoomd.md.integrate.nvt automatically create an internal hoomd.compute.thermo for the group that they operate on. If thermodynamic properties are needed on additional groups, a user can specify additional hoomd.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 default hoomd.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

hoomd.analyze.log.

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 with hoomd.analyze.log.

A disabled thermo compute can be re-enabled with enable().

enable()

Enables the thermo compute.

Examples:

my_thermo.enable()

See disable().

restore_state()

Restore the state information from the file used to initialize the simulations