1 #ifndef OPENMM_CUSTOMNONBONDEDFORCE_H_
2 #define OPENMM_CUSTOMNONBONDEDFORCE_H_
35 #include "TabulatedFunction.h"
42 #include "internal/windowsExport.h"
146 CutoffNonPeriodic = 1,
166 return particles.size();
172 return exclusions.size();
178 return parameters.size();
184 return globalParameters.size();
190 return functions.size();
198 return functions.size();
204 return interactionGroups.size();
209 const std::string& getEnergyFunction()
const;
213 void setEnergyFunction(
const std::string& energy);
217 NonbondedMethod getNonbondedMethod()
const;
221 void setNonbondedMethod(NonbondedMethod method);
228 double getCutoffDistance()
const;
235 void setCutoffDistance(
double distance);
240 bool getUseSwitchingFunction()
const;
245 void setUseSwitchingFunction(
bool use);
250 double getSwitchingDistance()
const;
255 void setSwitchingDistance(
double distance);
260 bool getUseLongRangeCorrection()
const;
265 void setUseLongRangeCorrection(
bool use);
272 int addPerParticleParameter(
const std::string& name);
279 const std::string& getPerParticleParameterName(
int index)
const;
286 void setPerParticleParameterName(
int index,
const std::string& name);
294 int addGlobalParameter(
const std::string& name,
double defaultValue);
301 const std::string& getGlobalParameterName(
int index)
const;
308 void setGlobalParameterName(
int index,
const std::string& name);
315 double getGlobalParameterDefaultValue(
int index)
const;
322 void setGlobalParameterDefaultValue(
int index,
double defaultValue);
330 int addParticle(
const std::vector<double>& parameters);
337 void getParticleParameters(
int index, std::vector<double>& parameters)
const;
344 void setParticleParameters(
int index,
const std::vector<double>& parameters);
354 int addExclusion(
int particle1,
int particle2);
362 void getExclusionParticles(
int index,
int& particle1,
int& particle2)
const;
370 void setExclusionParticles(
int index,
int particle1,
int particle2);
379 void createExclusionsFromBonds(
const std::vector<std::pair<int, int> >& bonds,
int bondCutoff);
410 const std::string& getTabulatedFunctionName(
int index)
const;
416 int addFunction(
const std::string& name,
const std::vector<double>& values,
double min,
double max);
423 void getFunctionParameters(
int index, std::string& name, std::vector<double>& values,
double& min,
double& max)
const;
430 void setFunctionParameters(
int index,
const std::string& name,
const std::vector<double>& values,
double min,
double max);
438 int addInteractionGroup(
const std::set<int>& set1,
const std::set<int>& set2);
446 void getInteractionGroupParameters(
int index, std::set<int>& set1, std::set<int>& set2)
const;
454 void setInteractionGroupParameters(
int index,
const std::set<int>& set1,
const std::set<int>& set2);
466 void updateParametersInContext(
Context& context);
472 class PerParticleParameterInfo;
473 class GlobalParameterInfo;
476 class InteractionGroupInfo;
477 NonbondedMethod nonbondedMethod;
478 double cutoffDistance, switchingDistance;
479 bool useSwitchingFunction, useLongRangeCorrection;
480 std::string energyExpression;
481 std::vector<PerParticleParameterInfo> parameters;
482 std::vector<GlobalParameterInfo> globalParameters;
483 std::vector<ParticleInfo> particles;
484 std::vector<ExclusionInfo> exclusions;
485 std::vector<FunctionInfo> functions;
486 std::vector<InteractionGroupInfo> interactionGroups;
493 class CustomNonbondedForce::ParticleInfo {
495 std::vector<double> parameters;
498 ParticleInfo(
const std::vector<double>& parameters) : parameters(parameters) {
506 class CustomNonbondedForce::PerParticleParameterInfo {
509 PerParticleParameterInfo() {
511 PerParticleParameterInfo(
const std::string& name) : name(name) {
519 class CustomNonbondedForce::GlobalParameterInfo {
523 GlobalParameterInfo() {
525 GlobalParameterInfo(
const std::string& name,
double defaultValue) : name(name), defaultValue(defaultValue) {
533 class CustomNonbondedForce::ExclusionInfo {
535 int particle1, particle2;
537 particle1 = particle2 = -1;
539 ExclusionInfo(
int particle1,
int particle2) :
540 particle1(particle1), particle2(particle2) {
548 class CustomNonbondedForce::FunctionInfo {
551 TabulatedFunction*
function;
554 FunctionInfo(
const std::string& name, TabulatedFunction*
function) : name(name), function(function) {
562 class CustomNonbondedForce::InteractionGroupInfo {
564 std::set<int> set1, set2;
565 InteractionGroupInfo() {
567 InteractionGroupInfo(
const std::set<int>& set1,
const std::set<int>& set2) :
568 set1(set1), set2(set2) {
int getNumGlobalParameters() const
Get the number of global parameters that the interaction depends on.
Definition: CustomNonbondedForce.h:183
A TabulatedFunction uses a set of tabulated values to define a mathematical function.
Definition: TabulatedFunction.h:58
int getNumFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomNonbondedForce.h:197
A Context stores the complete state of a simulation.
Definition: Context.h:67
int getNumExclusions() const
Get the number of particle pairs whose interactions should be excluded.
Definition: CustomNonbondedForce.h:171
int getNumPerParticleParameters() const
Get the number of per-particle parameters that the interaction depends on.
Definition: CustomNonbondedForce.h:177
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
int getNumTabulatedFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomNonbondedForce.h:189
int getNumInteractionGroups() const
Get the number of interaction groups that have been defined.
Definition: CustomNonbondedForce.h:203
int getNumParticles() const
Get the number of particles for which force field parameters have been defined.
Definition: CustomNonbondedForce.h:165
NonbondedMethod
This is an enumeration of the different methods that may be used for handling long range nonbonded fo...
Definition: CustomNonbondedForce.h:137
A ForceImpl provides the internal implementation of a Force.
Definition: ForceImpl.h:57
This class implements nonbonded interactions between particles.
Definition: CustomNonbondedForce.h:132