azplugins.external

Overview

HarmonicBarrier

Repulsive barrier implemented as a harmonic potential.

PlanarHarmonicBarrier

Planar harmonic barrier normal to y.

SphericalHarmonicBarrier

Spherical harmonic barrier.

Details

External potentials.

class hoomd.azplugins.external.HarmonicBarrier(location)

Bases: Force

Repulsive barrier implemented as a harmonic potential.

This class should not be instantiated directly. Use a derived type.

Parameters:

location (hoomd.variant.variant_like) – Location of the barrier.

location

Location of the barrier. The meaning of this location is interpreted by derived types.

Type: hoomd.variant.variant_like

params

The parameters of the harmonic barrier for each particle type. The dictionary has the following keys:

  • k (float, required) - Spring constant \([\mathrm{energy} \cdot \mathrm{length}^{-2}]\)

  • offset (float, required) - Amount added to location \([\mathrm{length}]\)

Type: TypeParameter [tuple [particle_type], dict]

Warning

The contribution to the virial is not calculated!

class hoomd.azplugins.external.PlanarHarmonicBarrier(location)

Bases: HarmonicBarrier

Planar harmonic barrier normal to y.

Parameters:

location (hoomd.variant.variant_like) – y position of the barrier.

PlanarHarmonicBarrier applies a purely repulsive harmonic potential in a planar geometry with a normal in the \(y\) direction. Particles are pushed in the \(-y\) direction when they are above the location:

\[\begin{split}U(y) = \begin{cases} 0, & y \le H \\ \dfrac{\kappa}{2} (y-H)^2, & y > H \end{cases}\end{split}\]

Here, the barrier is positioned at \(y=H\), specified by location, which may then be modified per-particle-type by adding an offset. \(\kappa\) is a spring constant setting the strength of the barrier.

Example:

# moving barrier from H = 50. to H = 25.
barrier = hoomd.variant.Ramp(A=50.0, B=25.0, t_start=100, t_ramp=1e6)
evap = hoomd.azplugins.external.PlanarHarmonicBarrier(location=barrier)

# small particle has diameter 1.0, offset by -0.5 to keep fully inside
evap.params['S'] = dict(k=50.0, offset=-0.5)

# big particle is twice as large (diameter 2.0)
# spring constant scales with diameter squared, offset with diameter
evap.params['B'] = dict(k=200.0, offset=-1.0)
class hoomd.azplugins.external.SphericalHarmonicBarrier(location)

Bases: HarmonicBarrier

Spherical harmonic barrier.

Parameters:

location (hoomd.variant.variant_like) – Radius of sphere.

SphericalHarmonicBarrier applies a purely repulsive harmonic potential to particles outside the radius of a sphere, acting to push them inward:

\[\begin{split}U(r) = \begin{cases} 0, & r \le R \\ \dfrac{\kappa}{2} (r-R)^2, & r > R \end{cases}\end{split}\]

Here, the barrier is positioned at radius R, specified by location, which may then be modified per-particle-type by adding an offset. \(\kappa\) is a spring constant setting the strength of the barrier.

Example:

# moving barrier from R = 50 to R = 25
barrier = hoomd.variant.Ramp(A=50.0, B=25.0, t_start=100, t_ramp=1e6)
evap = hoomd.azplugins.external.SphericalHarmonicBarrier(location=barrier)

# small particle has diameter 1.0, offset by -0.5 to keep fully inside
evap.params['S'] = dict(k=50.0, offset=-0.5)

# big particle is twice as large (diameter 2.0)
# spring constant scales with diameter squared, offset with diameter
evap.params['B'] = dict(k=200.0, offset=-1.0)