hoomd.hpmc.external

Overview

External

External potential base class (HPMC).

Linear

Linear external potential (HPMC).

Details

External fields for Monte Carlo.

Define \(U_{\mathrm{external},i}\) for use with hoomd.hpmc.integrate.HPMCIntegrator. Add external potential instances to your integrator’s external_potentials list to apply it during the simulation.

Note

The following class types can not be added to the external_potentials list. You may set one of these in the external_potential attribute.

In HOOMD-blue 5.0.0, field.Harmonic and wall.WallPotential will be replaced by similar classes that do support external_potentials.

class hoomd.hpmc.external.External

Bases:

External potential base class (HPMC).

External potentials define energetic interaction between particles and external fields in hoomd.hpmc.integrate.HPMCIntegrator.

Note

The base class External implements common attributes (energy, for example) and may be used in for isinstance or issubclass checks. External should not be instantiated directly by users.

property energy

Potential energy contributed by this potential \([\mathrm{energy}]\).

Typically:

\[U = \sum_{i=0}^\mathrm{N_particles-1} U_{\mathrm{external},i}\]

See hoomd.hpmc.integrate for the full expression which includes the evaluation over multiple images when the simulation box is small.

Example

logger.add(obj=external, quantities=['energy'])

(Loggable: category=”scalar”)

Type:

float

class hoomd.hpmc.external.Linear(default_alpha=None, plane_origin=(0, 0, 0), plane_normal=(0, 1, 0))

Bases: External

Linear external potential (HPMC).

Parameters:
  • default_alpha (float) – Default value for alpha \([\mathrm{energy}] [\mathrm{length}]^{-1}\)

  • plane_origin ([float, float, float]) – A point on the plane of 0 energy.

  • plane_normal ([float, float, float]) – A vector perpendicular to the plane of 0 energy.

Linear computes a linear external potential on all particles in the simulation state:

\[U_{\mathrm{external},i} = \alpha_i \cdot \vec{n} \cdot ( \vec{r}_i - \vec{p} )\]

where \(\alpha_i\) (alpha) is the linear energy coefficient , \(\vec{n}\) is the normal vector to the plane (plane_normal), and \(\vec{p}\) is the plane origin (plane_origin):

Example

linear = hoomd.hpmc.external.Linear()
linear.alpha['A'] = 0.2
simulation.operations.integrator.external_potentials = [linear]
alpha

The linear energy coefficient \(\alpha\) by particle type.

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

plane_origin

A point on the plane where the energy is zero.

Type: (float, float, float)

plane_normal

A unit length vector perpendicular to the plane where the energy is zero.

Type: (float, float, float)

Modules