md.external.field

Overview

Field

Constructs the external field potential.

Electric

Electric field.

Periodic

One-dimension periodic potential.

Details

External field potentials.

class hoomd.md.external.field.Electric

Electric field.

Electric specifies that an external force should be added to every particle in the simulation that results from an electric field.

The external potential \(V(\vec{r})\) is implemented using the following formula:

\[V(\vec{r}) = - q_i \vec{E} \cdot \vec{r}\]

where \(q_i\) is the particle charge and \(\vec{E}\) is the field vector. The field vector \(\vec{E}\) must be set per unique particle types.

E

The electric field vector \(\vec{E}\) as a tuple \((E_x, E_y, E_z)\) \([\mathrm{energy} \cdot \mathrm{charge}^{-1} \cdot \mathrm{length^{-1}}]\).

Type: TypeParameter [particle_type, tuple [float, float, float]]

Example:

# Apply an electric field in the x-direction
e_field = external.field.Electric()
e_field.E['A'] = (1, 0, 0)
class hoomd.md.external.field.Field

Constructs the external field potential.

External potentials represent forces which are applied to all particles in the simulation by an external agent.

Note

Field is the base class for all external field potentials. Users should not instantiate this class directly.

class hoomd.md.external.field.Periodic

One-dimension periodic potential.

Periodic specifies that an external force should be added to every particle in the simulation to induce a periodic modulation in the particle concentration. The modulation is one-dimensional and extends along the lattice vector \(\mathbf{a}_i\) of the simulation cell. The force parameters can be set on a per particle type basis. This potential can, for example, be used to induce an ordered phase in a block-copolymer melt.

The external potential \(V(\vec{r})\) is implemented using the following formula:

\[V(\vec{r}) = A \tanh\left[\frac{1}{2 \pi p w} \cos\left( p \vec{b}_i\cdot\vec{r}\right)\right]\]

The coefficients above must be set per unique particle type.

params

The Periodic external potential parameters. The dictionary has the following keys:

  • A (float, required) - Ordering parameter \(A\) \([\mathrm{energy}]\).

  • i (int, required) - \(\vec{b}_i\), \(i=0, 1, 2\), is the simulation box’s reciprocal lattice vector in the \(i\) direction \([\mathrm{dimensionless}]\).

  • w (float, required) - The interface width \(w\) relative to the distance \(2\pi/|\mathbf{b_i}|\) between planes in the \(i\)-direction \([\mathrm{dimensionless}]\).

  • p (int, required) - The periodicity \(p\) of the modulation \([\mathrm{dimensionless}]\).

Type: TypeParameter [particle_type, dict]

Example:

# Apply a periodic composition modulation along the first lattice vector
periodic = external.field.Periodic()
periodic.params['A'] = dict(A=1.0, i=0, w=0.02, p=3)
periodic.params['B'] = dict(A=-1.0, i=0, w=0.02, p=3)