Class DrudeForce
To use this class, create a DrudeForce object, then call addParticle() once for each Drude particle in the System to define its parameters. After a particle has been added, you can modify its force field parameters by calling setParticleParameters(). This will have no effect on Contexts that already exist unless you call updateParametersInContext(). Likewise, call addScreenedPair() for each pair of dipoles (each dipole consisting of a Drude particle and its parent) that should be computed.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addParticle
(int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34) Add a Drude particle to which forces should be applied.int
addScreenedPair
(int particle1, int particle2, double thole) Add an interaction to the list of screened pairs.void
destroy()
Destroy the force.int
Get the number of particles for which force field parameters have been defined.int
Get the number of special interactions that should be calculated differently from other interactions.void
getParticleParameters
(int index, com.sun.jna.ptr.IntByReference particle, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.IntByReference particle3, com.sun.jna.ptr.IntByReference particle4, com.sun.jna.ptr.DoubleByReference charge, com.sun.jna.ptr.DoubleByReference polarizability, com.sun.jna.ptr.DoubleByReference aniso12, com.sun.jna.ptr.DoubleByReference aniso34) Get the parameters for a Drude particle.void
getScreenedPairParameters
(int index, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.DoubleByReference thole) Get the force field parameters for a screened pair.void
getScreenedPairParameters
(int index, IntBuffer particle1, IntBuffer particle2, DoubleBuffer thole) Get the force field parameters for a screened pair.void
setParticleParameters
(int index, int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34) Set the parameters for a Drude particle.void
setScreenedPairParameters
(int index, int particle1, int particle2, double thole) Set the force field parameters for a screened pair.void
setUsesPeriodicBoundaryConditions
(boolean periodic) Set whether this force should apply periodic boundary conditions when calculating displacements.void
updateParametersInContext
(Context context) Update the particle and screened pair parameters in a Context to match those stored in this Force object.boolean
Returns whether or not this force makes use of periodic boundary conditions.Methods inherited from class ffx.openmm.Force
getForceGroup, getForceIndex, getName, getPointer, setForceGroup, setForceIndex, setName
-
Constructor Details
-
DrudeForce
public DrudeForce()Create a DrudeForce.
-
-
Method Details
-
addParticle
public int addParticle(int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34) Add a Drude particle to which forces should be applied.- Parameters:
particle
- the index within the System of the Drude particleparticle1
- the index within the System of the particle to which the Drude particle is attachedparticle2
- the index within the System of the second particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso12 will be ignored.particle3
- the index within the System of the third particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.particle4
- the index within the System of the fourth particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.charge
- The charge on the Drude particlepolarizability
- The isotropic polarizabilityaniso12
- The scale factor for the polarizability along the direction defined by particle1 and particle2aniso34
- The scale factor for the polarizability along the direction defined by particle3 and particle4- Returns:
- the index of the particle that was added
-
addScreenedPair
public int addScreenedPair(int particle1, int particle2, double thole) Add an interaction to the list of screened pairs.- Parameters:
particle1
- the index within this Force of the first particle involved in the interactionparticle2
- the index within this Force of the second particle involved in the interactionthole
- the Thole screening factor- Returns:
- the index of the screenedPair that was added
-
destroy
public void destroy()Destroy the force.This method releases the memory associated with the DrudeForce object. After calling this method, the force should not be used.
-
getNumParticles
public int getNumParticles()Get the number of particles for which force field parameters have been defined. -
getNumScreenedPairs
public int getNumScreenedPairs()Get the number of special interactions that should be calculated differently from other interactions. -
getParticleParameters
public void getParticleParameters(int index, com.sun.jna.ptr.IntByReference particle, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.IntByReference particle3, com.sun.jna.ptr.IntByReference particle4, com.sun.jna.ptr.DoubleByReference charge, com.sun.jna.ptr.DoubleByReference polarizability, com.sun.jna.ptr.DoubleByReference aniso12, com.sun.jna.ptr.DoubleByReference aniso34) Get the parameters for a Drude particle.- Parameters:
index
- the index of the Drude particle for which to get parametersparticle
- the index within the System of the Drude particleparticle1
- the index within the System of the particle to which the Drude particle is attachedparticle2
- the index within the System of the second particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso12 will be ignored.particle3
- the index within the System of the third particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.particle4
- the index within the System of the fourth particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.charge
- The charge on the Drude particlepolarizability
- The isotropic polarizabilityaniso12
- The scale factor for the polarizability along the direction defined by particle1 and particle2aniso34
- The scale factor for the polarizability along the direction defined by particle3 and particle4
-
getScreenedPairParameters
public void getScreenedPairParameters(int index, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.DoubleByReference thole) Get the force field parameters for a screened pair.- Parameters:
index
- the index of the pair for which to get parametersparticle1
- the index within this Force of the first particle involved in the interactionparticle2
- the index within this Force of the second particle involved in the interactionthole
- the Thole screening factor
-
getScreenedPairParameters
public void getScreenedPairParameters(int index, IntBuffer particle1, IntBuffer particle2, DoubleBuffer thole) Get the force field parameters for a screened pair.- Parameters:
index
- the index of the pair for which to get parametersparticle1
- the index within this Force of the first particle involved in the interactionparticle2
- the index within this Force of the second particle involved in the interactionthole
- the Thole screening factor
-
setParticleParameters
public void setParticleParameters(int index, int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34) Set the parameters for a Drude particle.- Parameters:
index
- the index of the Drude particle for which to set parametersparticle
- the index within the System of the Drude particleparticle1
- the index within the System of the particle to which the Drude particle is attachedparticle2
- the index within the System of the second particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso12 will be ignored.particle3
- the index within the System of the third particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.particle4
- the index within the System of the fourth particle used for defining anisotropic polarizability. This may be set to -1, in which case aniso34 will be ignored.charge
- The charge on the Drude particlepolarizability
- The isotropic polarizabilityaniso12
- The scale factor for the polarizability along the direction defined by particle1 and particle2aniso34
- The scale factor for the polarizability along the direction defined by particle3 and particle4
-
setScreenedPairParameters
public void setScreenedPairParameters(int index, int particle1, int particle2, double thole) Set the force field parameters for a screened pair.- Parameters:
index
- the index of the pair for which to get parametersparticle1
- the index within this Force of the first particle involved in the interactionparticle2
- the index within this Force of the second particle involved in the interactionthole
- the Thole screening factor
-
setUsesPeriodicBoundaryConditions
public void setUsesPeriodicBoundaryConditions(boolean periodic) Set whether this force should apply periodic boundary conditions when calculating displacements. Usually this is not appropriate for bonded forces, but there are situations when it can be useful.Periodic boundary conditions are only applied to screened pairs. They are never used for the force between a Drude particle and its parent particle, regardless of this setting.
-
updateParametersInContext
Update the particle and screened pair parameters in a Context to match those stored in this Force object. This method provides an efficient method to update certain parameters in an existing Context without needing to reinitialize it. Simply call setParticleParameters() and setScreenedPairParameters() to modify this object's parameters, then call updateParametersInContext() to copy them over to the Context.This method has several limitations. It can be used to modify the numeric parameters associated with a particle or screened pair (polarizability, thole, etc.), but not the identities of the particles they involve. It also cannot be used to add new particles or screenedPairs, only to change the parameters of existing ones.
-
usesPeriodicBoundaryConditions
public boolean usesPeriodicBoundaryConditions()Returns whether or not this force makes use of periodic boundary conditions.- Overrides:
usesPeriodicBoundaryConditions
in classForce
- Returns:
- True if the force uses periodic boundary conditions.
-