md.update
Overview
Updater to introduce rotational diffusion with an active force. 

Reverse Perturbation (MüllerPlathe) method to establish shear flow. 

Zeroes system momentum. 
Details
Update particle properties.
When an updater is specified, it acts on the particle system each time step it is triggered to change its state.
 class hoomd.md.update.ActiveRotationalDiffusion(trigger, active_force, rotational_diffusion)
Updater to introduce rotational diffusion with an active force.
 Parameters
trigger (hoomd.trigger.Trigger) – Select the timesteps to update rotational diffusion.
active_force (hoomd.md.force.Active) – The active force associated with the updater can be any subclass of the class
hoomd.md.force.Active
.rotational_diffusion (hoomd.variant.Variant) – The rotational diffusion as a function of time.
This updater works directly with an
hoomd.md.force.Active
orhoomd.md.force.ActiveOnManifold
instance to update rotational diffusion for simulations with active forces.The diffusion of the updater follows \(\delta \theta / \delta t = \sqrt{2 D_r / \delta t} \Gamma\), where \(D_r\) is the rotational diffusion constant, and the gamma function is a unitvariance random variable, whose components are uncorrelated in time, space, and between particles. In 3D, \(\hat{p}_i\) is a unit vector in 3D space, and diffusion follows \(\delta \hat{p}_i / \delta t = \sqrt{2 D_r / \delta t} \Gamma (\hat{p}_i (\cos \theta  1) + \hat{p}_r \sin \theta)\), where \(\hat{p}_r\) is an uncorrelated random unit vector. The persistence length of an active particle’s path is \(v_0 / D_r\). The rotational diffusion is applied to the orientation quaternion of each particle. When used with
hoomd.md.force.ActiveOnManifold
, rotational diffusion is performed in the tangent plane of the manifold.Tip
Use
hoomd.md.force.Active.create_diffusion_updater
to construct aActiveRotationalDiffusion
instance. trigger
Select the timesteps to update rotational diffusion.
 active_force
The active force associated with the updater. This is not settable after construction.
 rotational_diffusion
The rotational diffusion as a function of time.
 class hoomd.md.update.ReversePerturbationFlow(filter, flow_target, slab_direction, flow_direction, n_slabs, max_slab= 1, min_slab= 1)
Reverse Perturbation (MüllerPlathe) method to establish shear flow.
“Florian MuellerPlathe. Reversing the perturbation in nonequilibrium molecular dynamics: An easy way to calculate the shear viscosity of fluids. Phys. Rev. E, 59:48944898, May 1999.”
The simulation box is divided in a number of slabs. Two distinct slabs of those are chosen. The “max” slab searches for the maximum velocity component in flow direction while the “min” slab searches for the minimum velocity component. Afterward, both velocity components are swapped.
This introduces a momentum flow, which drives the flow. The strength of this flow is set through the
flow_target
argument, which defines a target value for the timeintegrated momentum flux. The searching and swapping is repeated until the target is reached. Depending on the target sign, the “max” and “min” slab might be swapped. Parameters
filter (
hoomd.filter.ParticleFilter
) – Subset of particles on which to apply this updater.flow_target (
hoomd.variant.Variant
) – Target value of the timeintegrated momentum flux. \([\delta t \cdot \mathrm{mass} \cdot \mathrm{length} \cdot \mathrm{time}^{1}]\)  where \(\delta t\) is the integrator step size.slab_direction (str) – Direction perpendicular to the slabs. Can be “x”, “y”, or “z”
flow_direction (str) – Direction of the flow. Can be “x”, “y”, or “z”
n_slabs (int) – Number of slabs used to divide the simulation box along the shear gradient. Using too few slabs will lead to a larger volume being disturbed by the momentum exchange, while using too many slabs may mean that there are not enough particles to exchange the target momentum.
max_slab (int) – Id < n_slabs where the max velocity component is search for. If set < 0 the value is set to its default n_slabs/2.
min_slab (int) – Id < n_slabs where the min velocity component is search for. If set < 0 the value is set to its default 0.
Attention
This updater uses
hoomd.trigger.Periodic(1)
as a trigger, meaning it is applied every timestep.This updater works currently only with orthorhombic boxes.
Note
The attributes of this updater are immutable once the updater is attached to a simulation.
Examples:
# const integrated flow with 0.1 slope for max 1e8 timesteps ramp = hoomd.variant.Ramp(0.0, 0.1e8, 0, int(1e8)) # velocity gradient in z direction and shear flow in x direction. mpf = hoomd.md.update.ReversePerturbationFlow(filter=hoomd.filter.All(), flow_target=ramp, slab_direction="Z", flow_direction="X", n_slabs=20)
 filter
Subset of particles on which to apply this updater.
 flow_target
Target value of the timeintegrated momentum flux.
 class hoomd.md.update.ZeroMomentum(trigger)
Zeroes system momentum.
 Parameters
trigger (hoomd.trigger.Trigger) – Select the timesteps to zero momentum.
During the time steps specified by trigger, particle velocities are modified such that the total linear momentum of the system is set to zero.
Examples:
zeroer = hoomd.md.update.ZeroMomentum(hoomd.trigger.Periodic(100))