DPDIntegrator
¶
-
class DPDIntegrator : public OpenMM::Integrator¶
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.
Public Functions
-
DPDIntegrator(double temperature, double defaultFriction, double defaultCutoff, double stepSize)¶
Create a DPDIntegrator. All particles default to having type 0.
- Parameters
temperature – the temperature of the heat bath (in Kelvin)
defaultFriction – the default friction coefficient (in inverse picoseconds). This value is used for interactions whose parameters have not been set with addTypePair().
defaultCutoff – the default cutoff distance (in nanometers). This value is used for interactions whose parameters have not been set with addTypePair().
stepSize – the step size with which to integrate the system (in picoseconds)
-
inline double getTemperature() const¶
Get the temperature of the heat bath (in Kelvin).
- Returns
the temperature of the heat bath, measured in Kelvin
-
void setTemperature(double temp)¶
Set the temperature of the heat bath (in Kelvin).
- Parameters
temp – the temperature of the heat bath, measured in Kelvin
-
inline double getDefaultFriction() const¶
Get the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
-
void setDefaultFriction(double friction)¶
Set the default friction coefficient for interactions that have not been specified with addTypePair (in inverse ps).
-
inline double getDefaultCutoff() const¶
Get the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
-
void setDefaultCutoff(double cutoff)¶
Set the default cutoff distance for interactions that have not been specified with addTypePair (in nm).
-
int getParticleType(int index) const¶
Get the type of a particle. This is an arbitrary integer. All particles initially default to type 0.
-
void setParticleType(int index, int type)¶
Set the type of a particle. This is an arbitrary integer. All particles initially default to type 0.
-
const std::map<int, int> &getParticleTypes() const¶
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.
-
inline int getNumTypePairs() const¶
Get the number of type pairs that have been added to the integrator.
-
int addTypePair(int type1, int type2, double friction, double cutoff)¶
Add a type pair. This overrides the default friction and cutoff distance for interactions between particles of two particular types.
- Parameters
type1 – the first particle type
type2 – the second particle type
friction – the friction for interactions between particles of these two types
cutoff – the cutoff distance for interactions between particles of these two types
- Returns
the index of the type pair that was just added.
-
void getTypePairParameters(int pairIndex, int &type1, int &type2, double &friction, double &cutoff) const¶
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 – the index of the type pair
type1 – [out] the index of the first particle type
type2 – [out] the index of the second particle type
friction – [out] the friction for interactions between particles of these two types
cutoff – [out] the cutoff distance for interactions between particles of these two types
-
void setTypePairParameters(int pairIndex, int type1, int type2, double friction, double 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 – the index of the type pair
type1 – the index of the first particle type
type2 – the index of the second particle type
friction – the friction for interactions between particles of these two types
cutoff – the cutoff distance for interactions between particles of these two types
-
inline int getRandomNumberSeed() const¶
Get the random number seed. See setRandomNumberSeed() for details.
-
inline void setRandomNumberSeed(int 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.
-
virtual void step(int steps)¶
Advance a simulation through time by taking a series of time steps.
- Parameters
steps – the number of time steps to take
-
DPDIntegrator(double temperature, double defaultFriction, double defaultCutoff, double stepSize)¶