OpenMM
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
AmoebaVdwForce.h
1 #ifndef OPENMM_AMOEBA_VDW_FORCE_H_
2 #define OPENMM_AMOEBA_VDW_FORCE_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * OpenMMAmoeba *
6  * -------------------------------------------------------------------------- *
7  * This is part of the OpenMM molecular simulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org. *
11  * *
12  * Portions copyright (c) 2008-2012 Stanford University and the Authors. *
13  * Authors: Mark Friedrichs, Peter Eastman *
14  * Contributors: *
15  * *
16  * Permission is hereby granted, free of charge, to any person obtaining a *
17  * copy of this software and associated documentation files (the "Software"), *
18  * to deal in the Software without restriction, including without limitation *
19  * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
20  * and/or sell copies of the Software, and to permit persons to whom the *
21  * Software is furnished to do so, subject to the following conditions: *
22  * *
23  * The above copyright notice and this permission notice shall be included in *
24  * all copies or substantial portions of the Software. *
25  * *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
27  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
28  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
29  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
30  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
31  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
32  * USE OR OTHER DEALINGS IN THE SOFTWARE. *
33  * -------------------------------------------------------------------------- */
34 
35 #include "openmm/Force.h"
36 #include "internal/windowsExportAmoeba.h"
37 #include <vector>
38 
39 namespace OpenMM {
40 
55 class OPENMM_EXPORT_AMOEBA AmoebaVdwForce : public Force {
56 public:
65  NoCutoff = 0,
70  CutoffPeriodic = 1,
71  };
72 
77 
81  int getNumParticles() const {
82  return parameters.size();
83  }
84 
95  void setParticleParameters(int particleIndex, int parentIndex, double sigma, double epsilon, double reductionFactor);
96 
107  void getParticleParameters(int particleIndex, int& parentIndex, double& sigma, double& epsilon, double& reductionFactor) const;
108 
109 
120  int addParticle(int parentIndex, double sigma, double epsilon, double reductionFactor);
121 
127  void setSigmaCombiningRule(const std::string& sigmaCombiningRule);
128 
134  const std::string& getSigmaCombiningRule(void) const;
135 
141  void setEpsilonCombiningRule(const std::string& epsilonCombiningRule);
142 
148  const std::string& getEpsilonCombiningRule(void) const;
149 
157  return useDispersionCorrection;
158  }
159 
166  void setUseDispersionCorrection(bool useCorrection) {
167  useDispersionCorrection = useCorrection;
168  }
169 
176  void setParticleExclusions(int particleIndex, const std::vector<int>& exclusions);
177 
184  void getParticleExclusions(int particleIndex, std::vector<int>& exclusions) const;
185 
189  void setCutoff(double cutoff);
190 
194  double getCutoff() const;
195 
199  NonbondedMethod getNonbondedMethod() const;
200 
204  void setNonbondedMethod(NonbondedMethod method);
214  void updateParametersInContext(Context& context);
222  return nonbondedMethod == AmoebaVdwForce::CutoffPeriodic;
223  }
224 protected:
225  ForceImpl* createImpl() const;
226 private:
227 
228  class VdwInfo;
229  NonbondedMethod nonbondedMethod;
230  double cutoff;
231  bool useDispersionCorrection;
232 
233  std::string sigmaCombiningRule;
234  std::string epsilonCombiningRule;
235 
236  std::vector< std::vector<int> > exclusions;
237  std::vector<VdwInfo> parameters;
238  std::vector< std::vector< std::vector<double> > > sigEpsTable;
239 };
240 
245 class AmoebaVdwForce::VdwInfo {
246 public:
247  int parentIndex;
248  double reductionFactor, sigma, epsilon, cutoff;
249  VdwInfo() {
250  parentIndex = -1;
251  reductionFactor = 0.0;
252  sigma = 1.0;
253  epsilon = 0.0;
254  }
255  VdwInfo(int parentIndex, double sigma, double epsilon, double reductionFactor) :
256  parentIndex(parentIndex), sigma(sigma), epsilon(epsilon), reductionFactor(reductionFactor) {
257  }
258 };
259 
260 } // namespace OpenMM
261 
262 #endif /*OPENMM_AMOEBA_VDW_FORCE_H_*/
263 
bool getUseDispersionCorrection() const
Get whether to add a contribution to the energy that approximately represents the effect of VdW inter...
Definition: AmoebaVdwForce.h:156
This class implements a buffered 14-7 potential used to model van der Waals forces.
Definition: AmoebaVdwForce.h:55
A Context stores the complete state of a simulation.
Definition: Context.h:67
Periodic boundary conditions are used, so that each particle interacts only with the nearest periodic...
Definition: AmoebaVdwForce.h:70
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: AmoebaVdwForce.h:221
int getNumParticles() const
Get the number of particles.
Definition: AmoebaVdwForce.h:81
void setUseDispersionCorrection(bool useCorrection)
Set whether to add a contribution to the energy that approximately represents the effect of VdW inter...
Definition: AmoebaVdwForce.h:166
Definition: AndersenThermostat.h:40
NonbondedMethod
This is an enumeration of the different methods that may be used for handling long range nonbonded fo...
Definition: AmoebaVdwForce.h:60