Skip to main content

Crate hoomd_mc

Crate hoomd_mc 

Source
Expand description

Apply the Metropolis Monte Carlo simulation method to systems of bodies.

hoomd-mc provides building blocks that you can use to create a Monte Carlo simulation model. Start with a hoomd_microstate::Microstate to represent the properties of all the bodies and sites. Form a Hamiltonian using types from hoomd_interaction that implement TotalEnergy, DeltaEnergyOne, DeltaEnergyInsert, and/or DeltaEnergyRemove and set the macrostate using one of the types from hoomd_simulation.

§Trial moves

The Trial trait describes a type that performs trial moves on a microstate. Trial::apply takes a mutable microstate, the Hamiltonian, and the macrostate. It attempts one or more trial moves, modifies the microstate with those that are accepted, and returns a Count of the accepted and rejected moves.

§Local trial moves

The LocalTrial trait describes a type that proposes trial moves as small perturbations of the body properties. hoomd-mc implements Translate and Rotate which propose moves that translate the body’s position and rotate the body’s orientation, respectively. You can implement a custom LocalTrial as needed in your simulation model.

Sweep implements Trial by applying the given LocalTrial to every body in the microstate. ParallelSweep does the same, but it executes many trial moves in parallel to increase performance. Sweep is very general will work with any boundary condition and local trial move, even when the move is not actually confined to a small region in space and when all bodies interact with all other bodies. ParallelSweep works only with boundaries that can be covered (Cover) with a Checkerboard and when there is a hard cutoff distance beyond which any two bodies cannot interact.

§Global trial moves

A future release of hoomd-rs will implement moves that apply to the simulation boundary.

§Body insertion/removal

A future release of hoomd-rs will implement moves that insert and remove bodies.

§Tuning trial moves

Most trial moves have tunable parameters. Typical simulation protocols adjust these parameters to achieve a 20% acceptance rate. Trial moves that implement the Tune trait can automatically Adjust the move sizes to achieve the target.

§Algorithms

hoomd-mc also implements a number of MC-adjacent algorithms. They are not trial moves (and therefore do not implement Trial) because they describe non-reversible processes or otherwise do not obey detailed balance. These algorithms are useful because they can achieve certain goals much faster than an equilibrium simulation can.

QuickInsert inserts bodies randomly drawn from the given distribution. The UniformIn distribution randomly places a template body anywhere in the simulation boundary. You could write your own distribution for custom behavior. QuickCompress compresses the simulation boundary until it reaches a target volume.

§Complete documentation

hoomd-mc is is a part of hoomd-rs. Read the complete documentation for more information.

Structs§

Count
Accepted and rejected trial moves.
HypercuboidCheckerboard
2^N color checkerboard with axis-aligned hypercuboidal cells.
ParallelSweep
In parallel, apply local trial moves to bodies in the microstate.
QuickCompress
Quickly compress a microstate to a target volume.
QuickInsert
Quickly add bodies to the microstate with random configurations.
Rotate
Change the orientation of a body by a small amount.
Sweep
Apply a local trial move to every body in the microstate.
Translate
Move the position of a body by a small distance.
UniformIn
Generate bodies uniformly in the given boundary condition.

Traits§

Adjust
Change the maximum size of a local trial move.
BodyDistribution
Sample random bodies.
Checkerboard
Partition space into sets of spaces where trial moves can safely be applied in parallel.
Cover
Construct a Checkerboard that covers all points in this boundary.
LocalTrial
Propose a new configuration for given body properties.
Trial
Propose trial moves in the microstate, evaluate the changes in energy and accept or reject accordingly.
Tune
Tune trial move maximum sizes toward a target acceptance ratio.

Functions§

tune_by_scaling
Tune adjustable move sizes toward a target acceptance ratio.