DPDIntegrator¶
- class openmm.openmm.DPDIntegrator(*args)¶
This integrator implements dissipative particle dynamics (DPD). It is similar to a LangevinIntegrator, but instead off applying the friction and noise forces to the Cartesian coordinates of particles, they are applied to inter-particle distances.
Only particles within a cutoff distance apply friction to each other. Most often a single cutoff distance and friction coefficient are used for all particle pairs. In some cases you may want to use different values for the interactions between different types of particles. In that case you can call setParticleType() to set the types of particles and addTypePair() to set the parameters to use for their interactions.
Particle types, type pairs, and default parameters must be set before you create a Context. Changing them will have no effect on an existing Context unless you reinitialize it.
This integrator can be applied either to periodic or non-periodic systems. It applies periodic boundary conditions if system.usesPeriodicBoundaryConditions() returns true, which happens if any force in the system uses periodic boundary conditions.
- __init__(self, temperature, defaultFriction, defaultCutoff, stepSize) → DPDIntegrator¶
- __init__(self, other) → DPDIntegrator
Create a DPDIntegrator. All particles default to having type 0.
- Parameters
temperature (double) – the temperature of the heat bath (in Kelvin)
defaultFriction (double) – the default friction coefficient (in inverse picoseconds). This value is used for interactions whose parameters have not been set with addTypePair().
defaultCutoff (double) – the default cutoff distance (in nanometers). This value is used for interactions whose parameters have not been set with addTypePair().
stepSize (double) – the step size with which to integrate the system (in picoseconds)
Methods
__init__
(-> DPDIntegrator)Create a DPDIntegrator.
addTypePair
(self, type1, type2, friction, cutoff)Add a type pair.
getConstraintTolerance
(self)Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
getDefaultCutoff
(self)Get the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
getDefaultFriction
(self)Get the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
Get which force groups to use for integration.
getNumTypePairs
(self)Get the number of type pairs that have been added to the integrator.
getParticleType
(self, index)Get the type of a particle.
getParticleTypes
(self)Get a map whose keys are particle indices and whose values are particle types.
getRandomNumberSeed
(self)Get the random number seed.
getStepSize
(self)Get the size of each time step, in picoseconds.
getTemperature
(self)Get the temperature of the heat bath (in Kelvin).
getTypePairParameters
(self, pairIndex)Get the parameters of a type pair.
setConstraintTolerance
(self, tol)Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
setDefaultCutoff
(self, cutoff)Set the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
setDefaultFriction
(self, friction)Set the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
setIntegrationForceGroups
(groups)Set which force groups to use for integration.
setParticleType
(self, index, type)Set the type of a particle.
setRandomNumberSeed
(self, seed)Set the random number seed.
setStepSize
(self, size)Set the size of each time step, in picoseconds.
setTemperature
(self, temp)Set the temperature of the heat bath (in Kelvin).
setTypePairParameters
(self, pairIndex, …)Set the parameters of a type pair.
step
(self, steps)Advance a simulation through time by taking a series of time steps.
Attributes
The membership flag
- property thisown¶
The membership flag
- getTemperature(self) → double¶
Get the temperature of the heat bath (in Kelvin).
- Returns
the temperature of the heat bath, measured in Kelvin
- Return type
double
- setTemperature(self, temp)¶
Set the temperature of the heat bath (in Kelvin).
- Parameters
temp (double) – the temperature of the heat bath, measured in Kelvin
- getDefaultFriction(self) → double¶
Get the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
- setDefaultFriction(self, friction)¶
Set the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
- getDefaultCutoff(self) → double¶
Get the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
- setDefaultCutoff(self, cutoff)¶
Set the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
- getParticleType(self, index) → int¶
Get the type of a particle. This is an arbitrary integer. All particles initially default to type 0.
- setParticleType(self, index, type)¶
Set the type of a particle. This is an arbitrary integer. All particles initially default to type 0.
- getParticleTypes(self) → mapii¶
Get a map whose keys are particle indices and whose values are particle types. This contains only the particles that have been specifically set with setParticleType(). All others have a default type of 0.
- getNumTypePairs(self) → int¶
Get the number of type pairs that have been added to the integrator.
- addTypePair(self, type1, type2, friction, cutoff) → int¶
Add a type pair. This overrides the default friction and cutoff distance for interactions between particles of two particular types.
- Parameters
type1 (int) – the first particle type
type2 (int) – the second particle type
friction (double) – the friction for interactions between particles of these two types
cutoff (double) – the cutoff distance for interactions between particles of these two types
- Returns
the index of the type pair that was just added.
- Return type
int
- getTypePairParameters(self, pairIndex)¶
Get the parameters of a type pair. This overrides the default friction and cutoff distance for interactions between particles of two particular types.
- Parameters
pairIndex (int) – the index of the type pair
- Returns
type1 (int) – the index of the first particle type
type2 (int) – the index of the second particle type
friction (double) – the friction for interactions between particles of these two types
cutoff (double) – the cutoff distance for interactions between particles of these two types
- setTypePairParameters(self, pairIndex, type1, type2, friction, cutoff)¶
Set the parameters of a type pair. This overrides the default friction and cutoff distance for interactions between particles of two particular types.
- Parameters
pairIndex (int) – the index of the type pair
type1 (int) – the index of the first particle type
type2 (int) – the index of the second particle type
friction (double) – the friction for interactions between particles of these two types
cutoff (double) – the cutoff distance for interactions between particles of these two types
- getRandomNumberSeed(self) → int¶
Get the random number seed. See setRandomNumberSeed() for details.
- setRandomNumberSeed(self, seed)¶
Set the random number seed. The precise meaning of this parameter is undefined, and is left up to each Platform to interpret in an appropriate way. It is guaranteed that if two simulations are run with different random number seeds, the sequence of random forces will be different. On the other hand, no guarantees are made about the behavior of simulations that use the same seed. In particular, Platforms are permitted to use non-deterministic algorithms which produce different results on successive runs, even if those runs were initialized identically.
If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context is created from this Integrator. This is done to ensure that each Context receives unique random seeds without you needing to set them explicitly.
- step(self, steps)¶
Advance a simulation through time by taking a series of time steps.
- Parameters
steps (int) – the number of time steps to take
- getConstraintTolerance(self) → double¶
Get the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
- getIntegrationForceGroups(self) → int¶
Get which force groups to use for integration. By default, all force groups are included. This is interpreted as a set of bit flags: the forces from group i will be included if (groups&(1<<i)) != 0.
- getStepSize(self) → double¶
Get the size of each time step, in picoseconds. If this integrator uses variable time steps, the size of the most recent step is returned.
- Returns
the step size, measured in ps
- Return type
double
- setConstraintTolerance(self, tol)¶
Set the distance tolerance within which constraints are maintained, as a fraction of the constrained distance.
- setIntegrationForceGroups(groups)¶
Set which force groups to use for integration. By default, all force groups are included.
- Parameters
groups (set or int) – a set of indices for which force groups to include when integrating the equations of motion. Alternatively, the groups can be passed as a single unsigned integer interpreted as a bitmask, in which case group i will be included if (groups&(1<<i)) != 0.
- setStepSize(self, size)¶
Set the size of each time step, in picoseconds. If this integrator uses variable time steps, the effect of calling this method is undefined, and it may simply be ignored.
- Parameters
size (double) – the step size, measured in ps