# hpmc.external.field

Overview

 Harmonic Restrain particle positions and orientations with harmonic springs.

Details

Apply external fields to HPMC simulations.

class hoomd.hpmc.external.field.Harmonic(reference_positions, reference_orientations, k_translational, k_rotational, symmetries)

Restrain particle positions and orientations with harmonic springs.

Parameters

Harmonic specifies that harmonic springs are used to restrain the position and orientation of every particle:

\begin{align}\begin{aligned}\begin{split}V_\mathrm{translational} = \sum_i^{N_\mathrm{particles}} \frac{1}{2} k_{translational} \cdot (\vec{r}_i-\vec{r}_{0,i})^2 \\\end{split}\\V_\mathrm{rotational} = \sum_i^{N_\mathrm{particles}} \frac{1}{2} k_{rotational} \cdot \min_j \left[ (\mathbf{q}_i-\mathbf{q}_{0,i} \cdot \mathbf{q}_{\mathrm{symmetry},j})^2 \right]\end{aligned}\end{align}

where $$k_{translational}$$ and $$k_{rotational}$$ correspond to the parameters k_translational and k_rotational, respectively, $$\vec{r}_i$$ and $$\mathbf{q}_i$$ are the position and orientation of particle $$i$$, the $$0$$ subscripts denote the given reference quantities, and $$\mathbf{q}_{\mathrm{symmetry}}$$ is the given set of symmetric orientations from the symmetries parameter.

Note

Harmonic does not support execution on GPUs.

k_translational

The translational spring constant $$[\mathrm{energy} \cdot \mathrm{length}^{-2}]$$.

Type

hoomd.variant.Variant

k_rotational

The rotational spring constant $$[\mathrm{energy}]$$.

Type

hoomd.variant.Variant

reference_positions

The reference positions to which particles are restrained $$[\mathrm{length}]$$.

Type

(N_particles, 3) numpy.ndarray of float

reference_orientations

The reference orientations to which particles are restrained $$[\mathrm{dimensionless}]$$.

Type

(N_particles, 4) numpy.ndarray of float

symmetries

The orientations that are equivalent through symmetry, i.e., the rotation quaternions that leave the particles unchanged $$[\mathrm{dimensionless}]$$.

Type

(N_symmetries, 4) numpy.ndarray of float

property energy

The total energy of the harmonic field [mathrm{energy}].

$$V_\mathrm{translational} + V_\mathrm{rotational}$$

(Loggable: category=”scalar”)

Type

float

property energy_rotational

The energy associated with rotational fluctuations $$[\mathrm{energy}]$$.

$$V_\mathrm{rotational}$$

(Loggable: category=”scalar”)

Type

float

property energy_translational

The energy associated with positional fluctuations $$[\mathrm{energy}]$$.

$$V_\mathrm{translational}$$

(Loggable`: category=”scalar”)

Type

float