mpcd.collide

Overview

AndersenThermostat

Andersen thermostat collision method.

CellList

Collision cell list.

CollisionMethod

Base collision method.

StochasticRotationDynamics

Stochastic rotation dynamics collision method.

Details

MPCD collision methods.

An MPCD collision method is required to update the particle velocities over time. Particles are binned into cells based on their positions, and all particles in a cell undergo a stochastic collision that updates their velocities while conserving linear momentum. Collision rules can optionally be extended to also conserve angular momentum The stochastic collisions lead to a build up of hydrodynamic interactions, and the choice of collision rule determines the transport coefficients.

class hoomd.mpcd.collide.AndersenThermostat(period, kT, embedded_particles=None)

Bases: CollisionMethod

Andersen thermostat collision method.

Parameters:

This class implements the Andersen thermostat collision rule for MPCD, as described by Allahyarov and Gompper. Every period steps, the particles are binned into cells. New particle velocities are then randomly drawn from a Gaussian distribution relative to the center-of-mass velocity for the cell. The random velocities are given zero mean so that the cell linear momentum is conserved. This collision rule naturally imparts the constant-temperature ensemble consistent with kT.

Examples:

Collision for only MPCD particles.

andersen_thermostat = hoomd.mpcd.collide.AndersenThermostat(
    period=1,
    kT=1.0)
simulation.operations.integrator.collision_method = andersen_thermostat

Collision including embedded particles.

andersen_thermostat = hoomd.mpcd.collide.AndersenThermostat(
    period=20,
    kT=1.0,
    embedded_particles=hoomd.filter.All())
simulation.operations.integrator.collision_method = andersen_thermostat
kT

Temperature of the thermostat \([\mathrm{energy}]\).

This temperature determines the distribution used to generate the random numbers.

Examples:

Constant temperature.

andersen_thermostat.kT = 1.0

Variable temperature.

andersen_thermostat.kT = hoomd.variant.Ramp(1.0, 2.0, 0, 100)
Type:

hoomd.variant.variant_like

class hoomd.mpcd.collide.CellList(shift=True)

Bases: Compute

Collision cell list.

Parameters:

shift (bool) – When True, randomly shift underlying collision cells.

The MPCD CellList bins particles into cubic cells of edge length 1.0. The simulation box must be orthorhombic, and its edges must be an integer.

When the total mean-free path of the MPCD particles is small, the cells should be randomly shifted in order to ensure Galilean invariance of the algorithm. This random shift is drawn from a uniform distribution, and it can shift the grid by up to half a cell in each direction. The performance penalty from grid shifting is small, so it is recommended to enable it in all simulations.

Example:

Access default cell list from integrator.

cell_list = simulation.operations.integrator.cell_list
shift

When True, randomly shift underlying collision cells.

Example:

cell_list.shift = True
Type:

bool

class hoomd.mpcd.collide.CollisionMethod(period, embedded_particles=None)

Bases: Operation

Base collision method.

Parameters:
  • period (int) – Number of integration steps between collisions.

  • embedded_particles (hoomd.filter.filter_like) – HOOMD particles to include in collision.

embedded_particles

HOOMD particles to include in collision (read only).

These particles are included in per-cell quantities and have their velocities updated along with the MPCD particles.

You will need to create an appropriate method to integrate the positions of these particles. The recommended integrator is ConstantVolume with no thermostat (NVE). It is generally not a good idea to use a thermostat because the MPCD particles themselves already act as a heat bath for the embedded particles.

Warning

Do not embed particles that are part of a rigid body. Momentum will not be correctly transferred to the body. Support for this is planned in future.

Type:

hoomd.filter.filter_like

period

Number of integration steps between collisions (read only).

A collision is executed each time the timestep is a multiple of period. It must be a multiple of period for the StreamingMethod if one is attached to the Integrator.

Type:

int

class hoomd.mpcd.collide.StochasticRotationDynamics(period, angle, kT=None, embedded_particles=None)

Bases: CollisionMethod

Stochastic rotation dynamics collision method.

Parameters:
  • period (int) – Number of integration steps between collisions.

  • angle (float) – Rotation angle (in degrees).

  • kT (hoomd.variant.variant_like) – Temperature for the collision thermostat \([\mathrm{energy}]\). If None, no thermostat is used.

  • embedded_particles (hoomd.filter.ParticleFilter) – HOOMD particles to include in collision.

This class implements the stochastic rotation dynamics (SRD) collision rule for MPCD proposed by Malevanets and Kapral. Every period steps, the particles are binned into cells. The particle velocities are then rotated by angle around an axis randomly drawn from the unit sphere. The rotation is done relative to the average velocity, so this rotation rule conserves linear momentum and kinetic energy within each cell.

The SRD method naturally imparts the NVE ensemble to the system comprising the MPCD particles and the embedded_particles. Accordingly, the system must be properly initialized to the correct temperature. A thermostat can be applied in conjunction with the SRD method through the kT parameter. SRD employs a Maxwell-Boltzmann thermostat on the cell level, which generates a constant-temperature ensemble. The temperature is defined relative to the cell-average velocity, and so can be used to dissipate heat in nonequilibrium simulations. Under this thermostat, the SRD algorithm still conserves linear momentum, but kinetic energy is no longer conserved.

Examples:

Collision of MPCD particles.

srd = hoomd.mpcd.collide.StochasticRotationDynamics(period=1, angle=130)
simulation.operations.integrator.collision_method = srd

Collision of MPCD particles with thermostat.

srd = hoomd.mpcd.collide.StochasticRotationDynamics(
    period=1,
    angle=130,
    kT=1.0)
simulation.operations.integrator.collision_method = srd

Collision including embedded particles.

srd = hoomd.mpcd.collide.StochasticRotationDynamics(
    period=20,
    angle=130,
    kT=1.0,
    embedded_particles=hoomd.filter.All())
simulation.operations.integrator.collision_method = srd
angle

Rotation angle (in degrees)

Example:

srd.angle = 130
Type:

float

kT

Temperature for the collision thermostat \([\mathrm{energy}]\).

Examples:

Constant temperature.

srd.kT = 1.0

Variable temperature.

srd.kT = hoomd.variant.Ramp(1.0, 2.0, 0, 100)
Type:

hoomd.variant.variant_like