Skip to main content

Crate hoomd_md

Crate hoomd_md 

Source
Expand description

Apply the molecular dynamics simulation method to systems of bodies.

hoomd-md provides building blocks that you can use to create a molecular dynamics simulation model. Start with a Microstate to represent the properties of all the bodies and sites. Form an interaction model using types from hoomd_interaction that implement NetBodyForceAndVirial or NetBodyForceVirialAndTorque and set the macrostate using one of the types from hoomd_simulation.

§Integration methods

The TranslationalMotion and RotationalMotion traits describe types that can integrate the translational and/or rotational degrees of freedom in the microstate, respectively. Most users will call integrate_translation or integrate_translation_and_rotation to advance all bodies in the microstate forward one time step. See the trait documentation for details on how to pin some bodies in place and/or apply different integration methods to different bodies.

The ConstantVolume method integrates the equations of motion for the model while keeping the volume of the simulation boundary fixed. ConstantVolume can sample the microcanonical (NVE) or canonical (NVT) ensembles based on the choice of thermostat (see below).

§Body and site properties

Currently, hoomd-rs implements TranslationalMotion for any InnerProduct vector space for bodies with Mass, Momentum, and NetForce properties in the same vector space as Position. For systems with only translational degrees of freedom, most users will choose DynamicPoint<Cartesian<N>> body properties and Point<Cartesian<N>> site properties.

Due to the mathematical nature of rotational degrees of freedom, hoomd-rs implements RotationalMotion specifically for DynamicOrientedPoint<Cartesian<2>, Angle> for 2D simulations and DynamicOrientedPoint<Cartesian<3>, Versor> for 3D. You must use one of these two types for body properties to integrate rotational degrees of freedom. There are fewer restrictions on the site properties type. Most users will choose Point<Cartesian<N>> or OrientedPoint<Cartesian<N>> site properties for models with rotational degrees of freedom, while some will need custom types. The choice for site properties is driven by the interaction model, not the integration method.

§Thermostats

Some of the integration methods sample constant temperature ensembles using velocity rescaling thermostats. There are many algorithms to choose from. Find them in the thermostat module. Use NoThermostat to sample constant energy (or enthalpy) ensembles.

§The Rigid interaction model

All integration methods in hoomd-rs model bodies as rigid bodies. The net force and torque on each body results from the forces and torques applied to its sites. The Rigid type implements NetBodyForceAndVirial and NetBodyForceVirialAndTorque when it wraps a type that computes forces (NetSiteForceAndVirial) and torques (NetSiteForceVirialAndTorque) on sites. For example: Rigid<PairwiseCutoff<Isotropic<LennardJones>>> is a valid interaction model for use with molecular dynamics integration methods.

Most differentiable interaction models implement both NetSiteForceAndVirial and all the Hamiltonian traits needed for Monte Carlo simulations in hoomd-mc. With these interaction models, you can freely swap between MD and MC simulation steps. Non-differentiable energies, such as Boxcar implement energy traits, but not forces and can therefore only be used with MC. Others, like active forces, might implement the force traits but not energy and can only be used with MD. Rust will validate the trait bounds and issue a compile error for invalid combinations.

§Microstate modifiers

Use ThermalizeMomentum and ThermalizeAngularMomentum to sample random momenta from a thermal distribution. Use ZeroCenterMomentum and ZeroCenterAngularMomentum to remove motion of the center of mass.

All of these modifier traits are implemented for Microstate itself: e.g. microstate.zero_center_momentum().

§Compute properties of the microstate

Use TranslationalKineticEnergy to compute the translational kinetic energy and count the corresponding translational degrees of freedom in the microstate. RotationalKineticEnergy does the same for rotational degrees of freedom.

As with the modifies, the compute traits are implemented for Microstate.

Modules§

method
Integration methods.
thermostat
Thermostats.

Traits§

RotationalKineticEnergy
Compute the rotational kinetic energy of bodies in a microstate.
RotationalMotion
Integrate rotational degrees of freedom.
ThermalizeAngularMomentum
Draw random angular momenta from a thermal distribution.
ThermalizeMomentum
Draw random momenta from a thermal distribution.
Thermostat
Scale momenta to hold the system at constant temperature.
TranslationalKineticEnergy
Compute the translational kinetic energy of bodies in a microstate.
TranslationalMotion
Integrate translational degrees of freedom.
UpdateNetForceAndVirial
Compute the net force and virial given by an interaction model and apply it to each body in the microstate.
UpdateNetForceVirialAndTorque
Compute the net force, virial, and torque given by an interaction model and apply them to each body in the microstate.
ZeroCenterAngularMomentum
Remove angular motion about the system’s center of mass.
ZeroCenterMomentum
Remove translational motion from the system’s center of mass.