# hpmcΒΆ

Details

Hard particle Monte Carlo

HPMC performs hard particle Monte Carlo simulations of a variety of classes of shapes.

Overview

HPMC implements hard particle Monte Carlo in HOOMD-blue. It supports:

- Dimensions: 2D and 3D
- Box shape: triclinic
- Ensembles:
- NVT
- NPT (
`update.boxmc`

) - Implicit depletants
- Grand canonical ensemble (
`update.muvt`

) - Gibbs ensemble (
`update.muvt`

)

- Shapes:
- Spheres / disks (
`integrate.sphere`

) - Union of spheres (
`integrate.sphere_union`

) - Convex polygons (
`integrate.convex_polygon`

) - Convex spheropolygons (
`integrate.convex_spheropolygon`

) - Simple polygons (
`integrate.simple_polygon`

) - Ellipsoids / ellipses (
`integrate.ellipsoid`

) - Convex polyhedra (
`integrate.convex_polyhedron`

) - Convex spheropolyhedra (
`integrate.convex_spheropolyhedron`

) - Faceted spheres (
`integrate.faceted_sphere`

) - General polyhedra (
`integrate.polyhedron`

)

- Spheres / disks (

- Execution:
- Canonical hard particle MC on a single CPU core
- Parallel update scheme on a single GPU
- Parallel updates on many CPU cores / GPUs using MPI
- Frenkel-Ladd free energy determination

- Analysis:
- Scale distribution function for pressure determination in NVT (
`analyze.sdf`

) - Free volume (
`compute.free_volume`

)

- Scale distribution function for pressure determination in NVT (

- File I/O:
- Loose integration with pos_writer

Logging

The following quantities are provided by the integrator for use in HOOMD-blue’s `hoomd.analyze.log`

.

`hpmc_sweep`

- Number of sweeps completed since the start of the MC integrator`hpmc_translate_acceptance`

- Fraction of translation moves accepted (averaged only over the last time step)`hpmc_rotate_acceptance`

- Fraction of rotation moves accepted (averaged only over the last time step)`hpmc_d`

- Maximum move displacement`hpmc_a`

- Maximum rotation move`hpmc_move_ratio`

- Probability of making a translation move (1- P(rotate move))`hpmc_overlap_count`

- Count of the number of particle-particle overlaps in the current system configuration

With non-interacting depletant (**implicit=True**), the following log quantities are available:

`hpmc_fugacity`

- The current value of the depletant fugacity (in units of density, volume^-1)`hpmc_ntrial`

- The current number of configurational bias attempts per overlapping depletant`hpmc_insert_count`

- Number of depletants inserted per colloid`hpmc_reinsert_count`

- Number of overlapping depletants reinserted per colloid by configurational bias MC`hpmc_free_volume_fraction`

- Fraction of free volume to total sphere volume after a trial move has been proposed (sampled inside a sphere around the new particle position)`hpmc_overlap_fraction`

- Fraction of deplatants in excluded volume after trial move to depletants in free volume before move`hpmc_configurational_bias_ratio`

- Ratio of configurational bias attempts to depletant insertions

`compute.free_volume`

provides the following loggable quantities:
- `hpmc_free_volume`

- The free volume estimate in the simulation box obtained by MC sampling (in volume units)

`update.boxmc`

provides the following loggable quantities:

`hpmc_boxmc_trial_count`

- Number of box changes attempted since the start of the boxmc updater`hpmc_boxmc_volume_acceptance`

- Fraction of volume/length change trials accepted (averaged from the start of the last run)`hpmc_boxmc_shear_acceptance`

- Fraction of shear trials accepted (averaged from the start of the last run)`hpmc_boxmc_aspect_acceptance`

- Fraction of aspect trials accepted (averaged from the start of the last run)`hpmc_boxmc_betaP`

Current value of the \(\beta p\) value of the boxmc updater

`update.muvt`

provides the following loggable quantities.

`hpmc_muvt_insert_acceptance`

- Fraction of particle insertions accepted (averaged from start of run)`hpmc_muvt_remove_acceptance`

- Fraction of particle removals accepted (averaged from start of run)`hpmc_muvt_volume_acceptance`

- Fraction of particle removals accepted (averaged from start of run)

Timestep definition

HOOMD-blue started as an MD code where **timestep** has a clear meaning. MC simulations are run
for timesteps. In exact terms, this means different things on the CPU and GPU and something slightly different when
using MPI. The behavior is approximately normalized so that user scripts do not need to drastically change
run() lengths when switching from one execution resource to another.

In the GPU implementation, one trial move is applied to a number of randomly chosen particles in each cell during one
timestep. The number of selected particles is `nselect*ceil(avg particles per cell)`

where *nselect* is a user-chosen
parameter. The default value of *nselect* is 4, which achieves optimal performance for a wide variety of benchmarks.
Detailed balance is obeyed at the level of a timestep. In short: One timestep **is NOT equal** to one sweep,
but is approximately *nselect* sweeps, which is an overestimation.

In the single-threaded CPU implementation, one trial move is applied *nselect* times to each of the *N* particles
during one timestep. In parallel MPI runs, one trial moves is applied *nselect* times to each particle in the active
region. There is a small strip of inactive region near the boundaries between MPI ranks in the domain decomposition.
The trial moves are performed in a shuffled order so detailed balance is obeyed at the level of a timestep.
In short: One timestep **is approximately** *nselect* sweeps (*N* trial moves). In single-threaded runs, the
approximation is exact, but it is slightly underestimated in MPI parallel runs.

To approximate a fair comparison of dynamics between CPU and GPU timesteps, log the `hpmc_sweep`

quantity to get the number sweeps completed so far at each logged timestep.

See J. A. Anderson et. al. 2016 for design and implementation details.

Stability

`hoomd.hpmc`

is **stable**. When upgrading from version 2.x to 2.y (y > x),
existing job scripts that follow *documented* interfaces for functions and classes
will not require any modifications. **Maintainer:** Joshua A. Anderson

Modules