md.external.field#

Overview

Field

Base class external field force.

Electric

Electric field force.

Magnetic

Magnetic field torque on a magnetic dipole.

Periodic

One-dimension periodic force.

Details

External field forces.

class hoomd.md.external.field.Electric#

Electric field force.

Electric computes forces, virials, and energies on all particles in the simulation state which are consistent with:

\[U_i = - q_i \vec{E} \cdot \vec{r}_i\]

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 type.

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:

electric = hoomd.md.external.field.Electric()
electric.E['A'] = (1, 0, 0)
simulation.operations.integrator.forces = [electric]
class hoomd.md.external.field.Field#

Base class external field force.

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

Warning

This class should not be instantiated by users. The class can be used for isinstance or issubclass checks.

class hoomd.md.external.field.Magnetic#

Magnetic field torque on a magnetic dipole.

Magnetic computes torques and energies on all particles in the simulation state which are consistent with:

\[U_i = -\vec{\mu}_i \cdot \vec{B}\]

where \(\vec{\mu}_i\) is the magnetic dipole moment of particle \(i\) and \(\vec{B}\) is the field vector.

params#

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

  • B (tuple [float, float, float], required) - The magnetic field vector in the global reference frame \([\mathrm{energy} \cdot \mathrm{time} \cdot \mathrm{charge}^{-1} \cdot \mathrm{length}^{-2} ]\).

  • mu (tuple [float, float, float], required) - The magnetic dipole moment of the particles type in the particle reference frame \([\mathrm{charge} \cdot \mathrm{length}^2 \cdot \mathrm{time}^{-1}]\).

Type: TypeParameter [particle_type, dict]

Example:

magnetic = hoomd.md.external.field.Magnetic()
magnetic.params['A'] = dict(B=(1.0,0.0,0.0), mu=(1.0,0.0,0.0))
simulation.operations.integrator.forces = [magnetic]
class hoomd.md.external.field.Periodic#

One-dimension periodic force.

Periodic computes forces and energies that 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. This force can, for example, be used to induce an ordered phase in a block-copolymer melt.

The force is computed commensurate with the potential energy:

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

Periodic results in no virial stress due functional dependence on box scaled coordinates.

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:

periodic = hoomd.md.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)
simulation.operations.integrator.forces = [periodic]