NonbondedForce¶

class
OpenMM::
NonbondedForce
¶ This class implements nonbonded interactions between particles, including a Coulomb force to represent electrostatics and a LennardJones force to represent van der Waals interactions. It optionally supports periodic boundary conditions and cutoffs for long range interactions. LennardJones interactions are calculated with the LorentzBerthelot combining rule: it uses the arithmetic mean of the sigmas and the geometric mean of the epsilons for the two interacting particles.
To use this class, create a
NonbondedForce
object, then calladdParticle()
once for each particle in theSystem
to define its parameters. The number of particles for which you define nonbonded parameters must be exactly equal to the number of particles in theSystem
, or else an exception will be thrown when you try to create aContext
. After a particle has been added, you can modify its force field parameters by callingsetParticleParameters()
. This will have no effect on Contexts that already exist unless you callupdateParametersInContext()
.NonbondedForce
also lets you specify “exceptions”, particular pairs of particles whose interactions should be computed based on different parameters than those defined for the individual particles. This can be used to completely exclude certain interactions from the force calculation, or to alter how they interact with each other.Many molecular force fields omit Coulomb and LennardJones interactions between particles separated by one or two bonds, while using modified parameters for those separated by three bonds (known as “14 interactions”). This class provides a convenience method for this case called
createExceptionsFromBonds()
. You pass to it a list of bonds and the scale factors to use for 14 interactions. It identifies all pairs of particles which are separated by 1, 2, or 3 bonds, then automatically creates exceptions for them.When using a cutoff, by default LennardJones interactions are sharply truncated at the cutoff distance. Optionally you can instead use a switching function to make the interaction smoothly go to zero over a finite distance range. To enable this, call
setUseSwitchingFunction()
. You must also callsetSwitchingDistance()
to specify the distance at which the interaction should begin to decrease. The switching distance must be less than the cutoff distance.Another optional feature of this class (enabled by default) is to add a contribution to the energy which approximates the effect of all LennardJones interactions beyond the cutoff in a periodic system. When running a simulation at constant pressure, this can improve the quality of the result. Call
setUseDispersionCorrection()
to set whether this should be used.In some applications, it is useful to be able to inexpensively change the parameters of small groups of particles. Usually this is done to interpolate between two sets of parameters. For example, a titratable group might have two states it can exist in, each described by a different set of parameters for the atoms that make up the group. You might then want to smoothly interpolate between the two states. This is done by first calling
addGlobalParameter()
to define aContext
parameter, thenaddParticleParameterOffset()
to create a “parameter offset” that depends on theContext
parameter. Each offset defines the following:The “effective” parameters for a particle (those used to compute forces) are given by
charge = baseCharge + param*chargeScale sigma = baseSigma + param*sigmaScale epsilon = baseEpsilon + param*epsilonScale
where the “base” values are the ones specified by
addParticle()
and “oaram” is the current value of theContext
parameter. A singleContext
parameter can apply offsets to multiple particles, and multiple parameters can be used to apply offsets to the same particle. Parameters can also be used to modify exceptions in exactly the same way by callingaddExceptionParameterOffset()
.Methods
NonbondedForce
Create a NonbondedForce
.getNumParticles
Get the number of particles for which force field parameters have been defined. getNumExceptions
Get the number of special interactions that should be calculated differently from other interactions. getNumGlobalParameters
Get the number of global parameters that have been added. getNumParticleParameterOffsets
Get the number of particles parameter offsets that have been added. getNumExceptionParameterOffsets
Get the number of exception parameter offsets that have been added. getNonbondedMethod
Get the method used for handling long range nonbonded interactions. setNonbondedMethod
Set the method used for handling long range nonbonded interactions. getCutoffDistance
Get the cutoff distance (in nm) being used for nonbonded interactions. setCutoffDistance
Set the cutoff distance (in nm) being used for nonbonded interactions. getUseSwitchingFunction
Get whether a switching function is applied to the LennardJones interaction. setUseSwitchingFunction
Set whether a switching function is applied to the LennardJones interaction. getSwitchingDistance
Get the distance at which the switching function begins to reduce the LennardJones interaction. setSwitchingDistance
Set the distance at which the switching function begins to reduce the LennardJones interaction. getReactionFieldDielectric
Get the dielectric constant to use for the solvent in the reaction field approximation. setReactionFieldDielectric
Set the dielectric constant to use for the solvent in the reaction field approximation. getEwaldErrorTolerance
Get the error tolerance for Ewald summation. setEwaldErrorTolerance
Set the error tolerance for Ewald summation. getPMEParameters
Get the parameters to use for PME calculations. getLJPMEParameters
Get the parameters to use for dispersion term in LJPME calculations. setPMEParameters
Set the parameters to use for PME calculations. setLJPMEParameters
Set the parameters to use for the dispersion term in LJPME calculations. getPMEParametersInContext
Get the parameters being used for PME in a particular Context
.getLJPMEParametersInContext
Get the PME parameters being used for the dispersion term for LJPME in a particular Context
.addParticle
Add the nonbonded force parameters for a particle. getParticleParameters
Get the nonbonded force parameters for a particle. setParticleParameters
Set the nonbonded force parameters for a particle. addException
Add an interaction to the list of exceptions that should be calculated differently from other interactions. getExceptionParameters
Get the force field parameters for an interaction that should be calculated differently from others. setExceptionParameters
Set the force field parameters for an interaction that should be calculated differently from others. createExceptionsFromBonds
Identify exceptions based on the molecular topology. addGlobalParameter
Add a new global parameter that parameter offsets may depend on. getGlobalParameterName
Get the name of a global parameter. setGlobalParameterName
Set the name of a global parameter. getGlobalParameterDefaultValue
Get the default value of a global parameter. setGlobalParameterDefaultValue
Set the default value of a global parameter. addParticleParameterOffset
Add an offset to the perparticle parameters of a particular particle, based on a global parameter. getParticleParameterOffset
Get the offset added to the perparticle parameters of a particular particle, based on a global parameter. setParticleParameterOffset
Set the offset added to the perparticle parameters of a particular particle, based on a global parameter. addExceptionParameterOffset
Add an offset to the parameters of a particular exception, based on a global parameter. getExceptionParameterOffset
Get the offset added to the parameters of a particular exception, based on a global parameter. setExceptionParameterOffset
Set the offset added to the parameters of a particular exception, based on a global parameter. getUseDispersionCorrection
Get whether to add a contribution to the energy that approximately represents the effect of LennardJones interactions beyond the cutoff distance. setUseDispersionCorrection
Set whether to add a contribution to the energy that approximately represents the effect of LennardJones interactions beyond the cutoff distance. getReciprocalSpaceForceGroup
Get the force group that reciprocal space interactions for Ewald or PME are included in. setReciprocalSpaceForceGroup
Set the force group that reciprocal space interactions for Ewald or PME are included in. updateParametersInContext
Update the particle and exception parameters in a Context
to match those stored in thisForce
object.usesPeriodicBoundaryConditions
Returns whether or not this force makes use of periodic boundary conditions. Enum: NonbondedMethod
NoCutoff No cutoff is applied to nonbonded interactions. The full set of N^2 interactions is computed exactly. This necessarily means that periodic boundary conditions cannot be used. This is the default. CutoffNonPeriodic Interactions beyond the cutoff distance are ignored. Coulomb interactions closer than the cutoff distance are modified using the reaction field method. CutoffPeriodic Periodic boundary conditions are used, so that each particle interacts only with the nearest periodic copy of each other particle. Interactions beyond the cutoff distance are ignored. Coulomb interactions closer than the cutoff distance are modified using the reaction field method. Ewald Periodic boundary conditions are used, and Ewald summation is used to compute the Coulomb interaction of each particle with all periodic copies of every other particle. PME Periodic boundary conditions are used, and ParticleMesh Ewald (PME) summation is used to compute the Coulomb interaction of each particle with all periodic copies of every other particle. LJPME Periodic boundary conditions are used, and ParticleMesh Ewald (PME) summation is used to compute the interaction of each particle with all periodic copies of every other particle for both Coulomb and LennardJones. No switching is used for either interaction. 
NonbondedForce
()¶ Create a
NonbondedForce()
.

int
getNumParticles
() const¶ Get the number of particles for which force field parameters have been defined.

int
getNumExceptions
() const¶ Get the number of special interactions that should be calculated differently from other interactions.

int
getNumGlobalParameters
() const¶ Get the number of global parameters that have been added.

int
getNumParticleParameterOffsets
() const¶ Get the number of particles parameter offsets that have been added.

int
getNumExceptionParameterOffsets
() const¶ Get the number of exception parameter offsets that have been added.

NonbondedMethod
getNonbondedMethod
() const¶ Get the method used for handling long range nonbonded interactions.

void
setNonbondedMethod
(NonbondedMethod method)¶ Set the method used for handling long range nonbonded interactions.

double
getCutoffDistance
() const¶ Get the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use is NoCutoff, this value will have no effect.
Returns: the cutoff distance, measured in nm

void
setCutoffDistance
(double distance)¶ Set the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use is NoCutoff, this value will have no effect.
Parameters:  distance – the cutoff distance, measured in nm

bool
getUseSwitchingFunction
() const¶ Get whether a switching function is applied to the LennardJones interaction. If the nonbonded method is set to NoCutoff, this option is ignored.

void
setUseSwitchingFunction
(bool use)¶ Set whether a switching function is applied to the LennardJones interaction. If the nonbonded method is set to NoCutoff, this option is ignored.

double
getSwitchingDistance
() const¶ Get the distance at which the switching function begins to reduce the LennardJones interaction. This must be less than the cutoff distance.

void
setSwitchingDistance
(double distance)¶ Set the distance at which the switching function begins to reduce the LennardJones interaction. This must be less than the cutoff distance.

double
getReactionFieldDielectric
() const¶ Get the dielectric constant to use for the solvent in the reaction field approximation.

void
setReactionFieldDielectric
(double dielectric)¶ Set the dielectric constant to use for the solvent in the reaction field approximation.

double
getEwaldErrorTolerance
() const¶ Get the error tolerance for Ewald summation. This corresponds to the fractional error in the forces which is acceptable. This value is used to select the reciprocal space cutoff and separation parameter so that the average error level will be less than the tolerance. There is not a rigorous guarantee that all forces on all atoms will be less than the tolerance, however.
For PME calculations, if
setPMEParameters()
is used to set alpha to something other than 0, this value is ignored.

void
setEwaldErrorTolerance
(double tol)¶ Set the error tolerance for Ewald summation. This corresponds to the fractional error in the forces which is acceptable. This value is used to select the reciprocal space cutoff and separation parameter so that the average error level will be less than the tolerance. There is not a rigorous guarantee that all forces on all atoms will be less than the tolerance, however.
For PME calculations, if
setPMEParameters()
is used to set alpha to something other than 0, this value is ignored.

void
getPMEParameters
(double &alpha, int &nx, int &ny, int &nz) const¶ Get the parameters to use for PME calculations. If alpha is 0 (the default), these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
Parameters:  alpha – [out] the separation parameter
 nx – [out] the number of grid points along the X axis
 ny – [out] the number of grid points along the Y axis
 nz – [out] the number of grid points along the Z axis

void
getLJPMEParameters
(double &alpha, int &nx, int &ny, int &nz) const¶ Get the parameters to use for dispersion term in LJPME calculations. If alpha is 0 (the default), these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
Parameters:  alpha – [out] the separation parameter
 nx – [out] the number of dispersion grid points along the X axis
 ny – [out] the number of dispersion grid points along the Y axis
 nz – [out] the number of dispersion grid points along the Z axis

void
setPMEParameters
(double alpha, int nx, int ny, int nz)¶ Set the parameters to use for PME calculations. If alpha is 0 (the default), these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
Parameters:  alpha – the separation parameter
 nx – the number of grid points along the X axis
 ny – the number of grid points along the Y axis
 nz – the number of grid points along the Z axis

void
setLJPMEParameters
(double alpha, int nx, int ny, int nz)¶ Set the parameters to use for the dispersion term in LJPME calculations. If alpha is 0 (the default), these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
Parameters:  alpha – the separation parameter
 nx – the number of grid points along the X axis
 ny – the number of grid points along the Y axis
 nz – the number of grid points along the Z axis

void
getPMEParametersInContext
(const Context &context, double &alpha, int &nx, int &ny, int &nz) const¶ Get the parameters being used for PME in a particular
Context
. Because some platforms have restrictions on the allowed grid sizes, the values that are actually used may be slightly different from those specified withsetPMEParameters()
, or the standard values calculated based on the Ewald error tolerance. See the manual for details.Parameters:  context – the
Context
for which to get the parameters  alpha – [out] the separation parameter
 nx – [out] the number of grid points along the X axis
 ny – [out] the number of grid points along the Y axis
 nz – [out] the number of grid points along the Z axis
 context – the

void
getLJPMEParametersInContext
(const Context &context, double &alpha, int &nx, int &ny, int &nz) const¶ Get the PME parameters being used for the dispersion term for LJPME in a particular
Context
. Because some platforms have restrictions on the allowed grid sizes, the values that are actually used may be slightly different from those specified withsetPMEParameters()
, or the standard values calculated based on the Ewald error tolerance. See the manual for details.Parameters:  context – the
Context
for which to get the parameters  alpha – [out] the separation parameter
 nx – [out] the number of grid points along the X axis
 ny – [out] the number of grid points along the Y axis
 nz – [out] the number of grid points along the Z axis
 context – the

int
addParticle
(double charge, double sigma, double epsilon)¶ Add the nonbonded force parameters for a particle. This should be called once for each particle in the
System
. When it is called for the i’th time, it specifies the parameters for the i’th particle. For calculating the LennardJones interaction between two particles, the arithmetic mean of the sigmas and the geometric mean of the epsilons for the two interacting particles is used (the LorentzBerthelot combining rule).Parameters:  charge – the charge of the particle, measured in units of the proton charge
 sigma – the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol
Returns: the index of the particle that was added

void
getParticleParameters
(int index, double &charge, double &sigma, double &epsilon) const¶ Get the nonbonded force parameters for a particle.
Parameters:  index – the index of the particle for which to get parameters
 charge – [out] the charge of the particle, measured in units of the proton charge
 sigma – [out] the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – [out] the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol

void
setParticleParameters
(int index, double charge, double sigma, double epsilon)¶ Set the nonbonded force parameters for a particle. When calculating the LennardJones interaction between two particles, it uses the arithmetic mean of the sigmas and the geometric mean of the epsilons for the two interacting particles (the LorentzBerthelot combining rule).
Parameters:  index – the index of the particle for which to set parameters
 charge – the charge of the particle, measured in units of the proton charge
 sigma – the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol

int
addException
(int particle1, int particle2, double chargeProd, double sigma, double epsilon, bool replace = false)¶ Add an interaction to the list of exceptions that should be calculated differently from other interactions. If chargeProd and epsilon are both equal to 0, this will cause the interaction to be completely omitted from force and energy calculations.
In many cases, you can use
createExceptionsFromBonds()
rather than adding each exception explicitly.Parameters:  particle1 – the index of the first particle involved in the interaction
 particle2 – the index of the second particle involved in the interaction
 chargeProd – the scaled product of the atomic charges (i.e. the strength of the Coulomb interaction), measured in units of the proton charge squared
 sigma – the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol
 replace – determines the behavior if there is already an exception for the same two particles. If true, the existing one is replaced. If false, an exception is thrown.
Returns: the index of the exception that was added

void
getExceptionParameters
(int index, int &particle1, int &particle2, double &chargeProd, double &sigma, double &epsilon) const¶ Get the force field parameters for an interaction that should be calculated differently from others.
Parameters:  index – the index of the interaction for which to get parameters
 particle1 – [out] the index of the first particle involved in the interaction
 particle2 – [out] the index of the second particle involved in the interaction
 chargeProd – [out] the scaled product of the atomic charges (i.e. the strength of the Coulomb interaction), measured in units of the proton charge squared
 sigma – [out] the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – [out] the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol

void
setExceptionParameters
(int index, int particle1, int particle2, double chargeProd, double sigma, double epsilon)¶ Set the force field parameters for an interaction that should be calculated differently from others. If chargeProd and epsilon are both equal to 0, this will cause the interaction to be completely omitted from force and energy calculations.
Parameters:  index – the index of the interaction for which to get parameters
 particle1 – the index of the first particle involved in the interaction
 particle2 – the index of the second particle involved in the interaction
 chargeProd – the scaled product of the atomic charges (i.e. the strength of the Coulomb interaction), measured in units of the proton charge squared
 sigma – the sigma parameter of the LennardJones potential (corresponding to the van der Waals radius of the particle), measured in nm
 epsilon – the epsilon parameter of the LennardJones potential (corresponding to the well depth of the van der Waals interaction), measured in kJ/mol

void
createExceptionsFromBonds
(const std::vector<std::pair<int, int>> &bonds, double coulomb14Scale, double lj14Scale)¶ Identify exceptions based on the molecular topology. Particles which are separated by one or two bonds are set to not interact at all, while pairs of particles separated by three bonds (known as “14 interactions”) have their Coulomb and LennardJones interactions reduced by a fixed factor.
Parameters:  bonds – the set of bonds based on which to construct exceptions. Each element specifies the indices of two particles that are bonded to each other.
 coulomb14Scale – pairs of particles separated by three bonds will have the strength of their Coulomb interaction multiplied by this factor
 lj14Scale – pairs of particles separated by three bonds will have the strength of their LennardJones interaction multiplied by this factor

int
addGlobalParameter
(const std::string &name, double defaultValue)¶ Add a new global parameter that parameter offsets may depend on. The default value provided to this method is the initial value of the parameter in newly created Contexts. You can change the value at any time by calling setParameter() on the
Context
.Parameters:  name – the name of the parameter
 defaultValue – the default value of the parameter
Returns: the index of the parameter that was added

const std::string &
getGlobalParameterName
(int index) const¶ Get the name of a global parameter.
Parameters:  index – the index of the parameter for which to get the name
Returns: the parameter name

void
setGlobalParameterName
(int index, const std::string &name)¶ Set the name of a global parameter.
Parameters:  index – the index of the parameter for which to set the name
 name – the name of the parameter

double
getGlobalParameterDefaultValue
(int index) const¶ Get the default value of a global parameter.
Parameters:  index – the index of the parameter for which to get the default value
Returns: the parameter default value

void
setGlobalParameterDefaultValue
(int index, double defaultValue)¶ Set the default value of a global parameter.
Parameters:  index – the index of the parameter for which to set the default value
 defaultValue – the default value of the parameter

int
addParticleParameterOffset
(const std::string ¶meter, int particleIndex, double chargeScale, double sigmaScale, double epsilonScale)¶ Add an offset to the perparticle parameters of a particular particle, based on a global parameter.
Parameters:  parameter – the name of the global parameter. It must have already been added with
addGlobalParameter()
. Its value can be modified at any time by callingContext::setParameter()
.  particleIndex – the index of the particle whose parameters are affected
 chargeScale – this value multiplied by the parameter value is added to the particle’s charge
 sigmaScale – this value multiplied by the parameter value is added to the particle’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the particle’s epsilon
Returns: the index of the offset that was added  parameter – the name of the global parameter. It must have already been added with

void
getParticleParameterOffset
(int index, std::string ¶meter, int &particleIndex, double &chargeScale, double &sigmaScale, double &epsilonScale) const¶ Get the offset added to the perparticle parameters of a particular particle, based on a global parameter.
Parameters:  index – the index of the offset to query, as returned by
addParticleParameterOffset()
 parameter – the name of the global parameter
 particleIndex – the index of the particle whose parameters are affected
 chargeScale – this value multiplied by the parameter value is added to the particle’s charge
 sigmaScale – this value multiplied by the parameter value is added to the particle’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the particle’s epsilon
 index – the index of the offset to query, as returned by

void
setParticleParameterOffset
(int index, const std::string ¶meter, int particleIndex, double chargeScale, double sigmaScale, double epsilonScale)¶ Set the offset added to the perparticle parameters of a particular particle, based on a global parameter.
Parameters:  index – the index of the offset to modify, as returned by
addParticleParameterOffset()
 parameter – the name of the global parameter. It must have already been added with
addGlobalParameter()
. Its value can be modified at any time by callingContext::setParameter()
.  particleIndex – the index of the particle whose parameters are affected
 chargeScale – this value multiplied by the parameter value is added to the particle’s charge
 sigmaScale – this value multiplied by the parameter value is added to the particle’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the particle’s epsilon
 index – the index of the offset to modify, as returned by

int
addExceptionParameterOffset
(const std::string ¶meter, int exceptionIndex, double chargeProdScale, double sigmaScale, double epsilonScale)¶ Add an offset to the parameters of a particular exception, based on a global parameter.
Parameters:  parameter – the name of the global parameter. It must have already been added with
addGlobalParameter()
. Its value can be modified at any time by callingContext::setParameter()
.  exceptionIndex – the index of the exception whose parameters are affected
 chargeProdScale – this value multiplied by the parameter value is added to the exception’s charge product
 sigmaScale – this value multiplied by the parameter value is added to the exception’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the exception’s epsilon
Returns: the index of the offset that was added  parameter – the name of the global parameter. It must have already been added with

void
getExceptionParameterOffset
(int index, std::string ¶meter, int &exceptionIndex, double &chargeProdScale, double &sigmaScale, double &epsilonScale) const¶ Get the offset added to the parameters of a particular exception, based on a global parameter.
Parameters:  index – the index of the offset to query, as returned by
addExceptionParameterOffset()
 parameter – the name of the global parameter
 exceptionIndex – the index of the exception whose parameters are affected
 chargeProdScale – this value multiplied by the parameter value is added to the exception’s charge product
 sigmaScale – this value multiplied by the parameter value is added to the exception’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the exception’s epsilon
 index – the index of the offset to query, as returned by

void
setExceptionParameterOffset
(int index, const std::string ¶meter, int exceptionIndex, double chargeProdScale, double sigmaScale, double epsilonScale)¶ Set the offset added to the parameters of a particular exception, based on a global parameter.
Parameters:  index – the index of the offset to modify, as returned by
addExceptionParameterOffset()
 parameter – the name of the global parameter. It must have already been added with
addGlobalParameter()
. Its value can be modified at any time by callingContext::setParameter()
.  exceptionIndex – the index of the exception whose parameters are affected
 chargeProdScale – this value multiplied by the parameter value is added to the exception’s charge product
 sigmaScale – this value multiplied by the parameter value is added to the exception’s sigma
 epsilonScale – this value multiplied by the parameter value is added to the exception’s epsilon
 index – the index of the offset to modify, as returned by

bool
getUseDispersionCorrection
() const¶ Get whether to add a contribution to the energy that approximately represents the effect of LennardJones interactions beyond the cutoff distance. The energy depends on the volume of the periodic box, and is only applicable when periodic boundary conditions are used. When running simulations at constant pressure, adding this contribution can improve the quality of results.

void
setUseDispersionCorrection
(bool useCorrection)¶ Set whether to add a contribution to the energy that approximately represents the effect of LennardJones interactions beyond the cutoff distance. The energy depends on the volume of the periodic box, and is only applicable when periodic boundary conditions are used. When running simulations at constant pressure, adding this contribution can improve the quality of results.

int
getReciprocalSpaceForceGroup
() const¶ Get the force group that reciprocal space interactions for Ewald or PME are included in. This allows multiple time step integrators to evaluate direct and reciprocal space interactions at different intervals:
getForceGroup()
specifies the group for direct space, andgetReciprocalSpaceForceGroup()
specifies the group for reciprocal space. If this is 1 (the default value), the same force group is used for reciprocal space as for direct space.

void
setReciprocalSpaceForceGroup
(int group)¶ Set the force group that reciprocal space interactions for Ewald or PME are included in. This allows multiple time step integrators to evaluate direct and reciprocal space interactions at different intervals:
setForceGroup()
specifies the group for direct space, andsetReciprocalSpaceForceGroup()
specifies the group for reciprocal space. If this is 1 (the default value), the same force group is used for reciprocal space as for direct space.Parameters:  group – the group index. Legal values are between 0 and 31 (inclusive), or 1 to use the same force group that is specified for direct space.

void
updateParametersInContext
(Context &context)¶ Update the particle and exception parameters in a
Context
to match those stored in thisForce
object. This method provides an efficient method to update certain parameters in an existingContext
without needing to reinitialize it. Simply callsetParticleParameters()
andsetExceptionParameters()
to modify this object’s parameters, then callupdateParametersInContext()
to copy them over to theContext
.This method has several limitations. The only information it updates is the parameters of particles and exceptions. All other aspects of the
Force
(the nonbonded method, the cutoff distance, etc.) are unaffected and can only be changed by reinitializing theContext
. Furthermore, only the chargeProd, sigma, and epsilon values of an exception can be changed; the pair of particles involved in the exception cannot change. Finally, this method cannot be used to add new particles or exceptions, only to change the parameters of existing ones.

bool
usesPeriodicBoundaryConditions
() const¶ Returns whether or not this force makes use of periodic boundary conditions.
Returns: true if force uses PBC and false otherwise
