mpcd.force¶
Overview
Block force. 

Constant force. 

Sine force. 
Details
MPCD external force fields.
An external field specifies the force to be applied per MPCD particle in
the equations of motion (see mpcd.stream
). The external force should
be compatible with the chosen streaming geometry. Global momentum conservation is
typically broken by adding an external force field; care should be chosen that
the force field does not cause the system to net accelerate (i.e., it must maintain
average momentum conservation). Additionally, a thermostat will likely be
required to maintain temperature control in the driven system (see
mpcd.collide
).
Note
The external force must be attached to a streaming method
(see mpcd.stream
) using set_force to take effect.
On its own, the force object will not affect the system.

class
hoomd.mpcd.force.
block
(F, H=None, w=None)¶ Block force.
 Parameters
Imposes a constant force in x as a function of position in z:
\begin{equation} \mathbf{F} = \begin{cases} +F \mathbf{e}_x & r_z  H < w \\ F \mathbf{e}_x & r_z + H < w \\ \mathbf{0} & \mathrm{otherwise} \end{cases} \end{equation}The force is applied in blocks defined by H and w so that the force in x is \(+F\) in the upper block, \(F\) in the lower block, and zero otherwise. The blocks must lie fully within the simulation box or an error will be raised. The blocks also should not overlap (the force will be zero in any overlapping regions), and a warning will be issued if the blocks overlap.
This force field can be used to implement the doubleparabola method for measuring viscosity by setting \(H = L_z/4\) and \(w = L_z/4\), where \(L_z\) is the size of the simulation box in z. If H or w is None, it will default to this value based on the current simulation box.
Examples:
# fully specified blocks force.block(F=1.0, H=5.0, w=5.0) # default blocks to full box force.block(F=0.5)
Note
The external force must be attached to a streaming method (see
mpcd.stream
) using set_force to take effect. On its own, the force object will not affect the system.New in version 2.6.

class
hoomd.mpcd.force.
constant
(F)¶ Constant force.
 Parameters
F (tuple) – 3d vector specifying the force per particle.
The same constantforce is applied to all particles, independently of time and their positions. This force is useful for simulating pressuredriven flow in conjunction with a confined geometry (e.g.,
slit
) having noslip boundary conditions.Examples:
# tuple force.constant((1.,0.,0.)) # list force.constant([1.,2.,3.]) # NumPy array g = np.array([0.,0.,1.]) force.constant(g)
Note
The external force must be attached to a streaming method (see
mpcd.stream
) using set_force to take effect. On its own, the force object will not affect the system.New in version 2.6.

class
hoomd.mpcd.force.
sine
(F, k)¶ Sine force.
 Parameters
Applies a force in x that is sinusoidally varying in z.
\[\mathbf{F}(\mathbf{r}) = F \sin (k r_z) \mathbf{e}_x\]Typically, the wavenumber should be something that is commensurate with the simulation box. For example, \(k = 2\pi/L_z\) will generate one period of the sine in
bulk
geometry.Examples:
# one period k0 = 2.*np.pi/box.Lz force.sine(F=1.0, k=k0) # two periods force.sine(F=0.5, k=2*k0)
The user will need to determine what value of k makes sense for their problem, as it is too difficult to validate all values of k for all streaming geometries.
Note
The external force must be attached to a streaming method (see
mpcd.stream
) using set_force to take effect. On its own, the force object will not affect the system.New in version 2.6.