Expand description
Particle interactions and physical models that apply to microstates.
hoomd-interaction defines traits that describe site and body interactions
needed to perform Monte Carlo and molecular dynamics simulations.
§Hamiltonian
A type that describes a Hamiltonian (or a single term in a multi-part Hamiltonian)
implements one or more of the following traits: TotalEnergy, DeltaEnergyOne,
DeltaEnergyInsert, and DeltaEnergyRemove. Given a microstate, the
total_energy method computes the total energy of the Hamiltonian. The various
delta_energy_* methods compute the change in total energy when updating, inserting,
or removing a body (often needed for Monte Carlo simulation). Total energy
computations typically cost $O(N)$ while delta_energy methods typically cost
$O(1)$. These costs may vary based on the specific interaction type and/or the
microstate’s spatial data structure.
As a convenience, most Hamiltonian types also implement MaximumInteractionRange,
so that callers can easily determine the maximum site-site interaction range in a
given model.
All the Hamiltonian traits can be automatically derived using a #[derive()] macro
of the same name. The derived implementation sums over all the fields in the struct.
§Force interaction models
Molecular dynamics simulations are driven by the forces and torques that act
on the bodies in the simulation (NetBodyForceAndVirial, NetBodyForceVirialAndTorque).
The body forces and torques result from forces and torques on the sites
NetSiteForceAndVirial, NetSiteForceVirialAndTorque). When an MD model is Hamiltonian,
the same types that implement DeltaEnergyOne (and related traits) also
implement NetSiteForceAndVirial and/or NetSiteForceVirialAndTorque.
Virials are always calculated alongside forces.
Given a microstate and the index of a site in that microstate,
NetSiteForceAndVirial and/or NetSiteForceVirialAndTorque compute the net force and virial
(and torque) acting on that site. Thus, you can use your hamiltonian
variable to compute both energy and force properties on the system.
Use Rigid(hamiltonian) with MD integration methods. The Rigid
type implements NetBodyForceAndVirial and/or NetBodyForceVirialAndTorque for types
that implement NetSiteForceAndVirial or NetSiteForceVirialAndTorque respectively.
Not all MD models are Hamiltonian, so types may implement NetSiteForceAndVirial
but but not TotalEnergy. Similarly, not all Hamiltonian types are
differentiable and may implement DeltaEnergyOne but not NetSiteForceAndVirial.
All the force interaction model traits can be automatically derived using a
#[derive()] macro of the same name. The derived implementation sums over
all the fields in the struct.
§Univariate interactions
Many interaction potentials are a function of one variable, typically the
distance between two sites but sometimes the distance between a site and
surface, or an angle. hoomd-interaction implements the most commonly
used univariate potentials, such as LennardJones in univariate.
These types are not Hamiltonian terms on their own, but can be combined
with other types to create interaction models.
To implement your own univariate interactions, implement the
UnivariateEnergy and/or UnivariateForce traits.
§Interactions between sites and external objects
The SiteEnergy trait describes a type that computes the contribution
of a single site to the total energy as a function only of that site’s
properties along with fixed external parameters. SiteForceAndVirial and
SiteForceVirialAndTorque describe the force (and torque) on the site commensurate
with that energy. The External type implements all the Hamiltonian and force
interaction model traits. It applies the wrapped type’s SiteEnergy, SiteForceAndVirial,
and/or SiteForceVirialAndTorque implementations to all the sites in the microstate.
See external for a list of built-in SiteEnergy, SiteForceAndVirial and
SiteForceVirialAndTorque implementations.
§Interactions between all pairs of sites
The SitePairEnergy trait describes a type that computes the energy
that a pair of sites contributes to the Hamiltonian as a function of
the properties of the two sites. Similarly, SitePairForceAndVirial and
SitePairForceVirialAndTorque describe the force (and torque) between
the pair commensurate with that energy. The PairwiseCutoff type implements
all the Hamiltonian and force interaction model traits. It applies the wrapped
type’s SitePairEnergy, SitePairForceAndVirial, and/or SitePairForceVirialAndTorque
to all pairs of sites that are within the maximum interaction range.
The pairwise module provides numerous types that implement
SitePairEnergy, SitePairForceAndVirial, and SitePairForceVirialAndTorque
including Isotropic (which wraps any univariate potential), HardShape
(which wraps a shape from hoomd_geometry, and many others.
§Zero
Zero implements all Hamiltonian and force interaction traits. It
represents $H=0$.
§Complete documentation
hoomd-interaction is is a part of hoomd-rs. Read the complete documentation
for more information.
Modules§
- external
- External interactions.
- pairwise
- Pairwise interactions.
- univariate
- Interactions as a function of one variable.
Structs§
- External
- Interactions between sites and external fields.
- Pairwise
Cutoff - Short-ranged pairwise interactions between sites.
- Rigid
- Rigid body interactions.
- Zero
- Hamiltonian with H = 0.
Traits§
- Delta
Energy Insert - Compute the change in energy when a single body is inserted.
- Delta
Energy One - Compute the change in energy as a function of a single modified body.
- Delta
Energy Remove - Compute the change in energy when a single body is removed.
- Maximum
Interaction Range - Largest distance between two sites where the pairwise interaction may be non-zero.
- NetBody
Force AndVirial - Sum all the forces and virials that act on a given body in a microstate.
- NetBody
Force Virial AndTorque - Sum all the forces, virials, and torques that act on a given body in a microstate.
- NetSite
Force AndVirial - Sum all the forces and virials that act on a given site in a microstate.
- NetSite
Force Virial AndTorque - Sum all the forces, virials, and torques that act on a given site in a microstate.
- Site
Energy - Compute the energy contribution of a single site.
- Site
Force AndVirial - Compute the force and virial on a single site as a function of its properties.
- Site
Force Virial AndTorque - Compute the force, virial, and torque on a single site as a function of its properties.
- Site
Pair Energy - Compute the energy contribution from a pair of sites.
- Site
Pair Force AndVirial - Compute the pairwise force and virial on one site from another site.
- Site
Pair Force Virial AndTorque - Compute the pairwise force, virial, and torque on one site from another site.
- Total
Energy - Compute the total energy of a potential applied to the microstate.
Derive Macros§
- Delta
Energy Insert - Automatically implement the
hoomd_interaction::DeltaEnergyInserttrait. - Delta
Energy One - Automatically implement the
hoomd_interaction::DeltaEnergyOnetrait. - Delta
Energy Remove - Automatically implement the
hoomd_interaction::DeltaEnergyRemovetrait. - Maximum
Interaction Range - Automatically implement the
hoomd_interaction::MaximumInteractionRangetrait. - NetSite
Force AndVirial - Automatically implement the
hoomd_interaction::NetSiteForceAndVirialtrait. - NetSite
Force Virial AndTorque - Automatically implement the
hoomd_interaction::NetSiteForceVirialAndTorquetrait. - Site
Pair Energy - Automatically implement the
hoomd_interaction::SitePairEnergytrait. - Total
Energy - Automatically implement the
hoomd_interaction::TotalEnergytrait.