OpenMM
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
DrudeForce.h
1 #ifndef OPENMM_DRUDEFORCE_H_
2 #define OPENMM_DRUDEFORCE_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * OpenMM *
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) 2013 Stanford University and the Authors. *
13  * Authors: 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/Context.h"
36 #include "openmm/Force.h"
37 #include <vector>
38 #include "internal/windowsExportDrude.h"
39 
40 namespace OpenMM {
41 
55 class OPENMM_EXPORT_DRUDE DrudeForce : public Force {
56 public:
60  DrudeForce();
64  int getNumParticles() const {
65  return particles.size();
66  }
70  int getNumScreenedPairs() const {
71  return screenedPairs.size();
72  }
90  int addParticle(int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34);
108  void getParticleParameters(int index, int& particle, int& particle1, int& particle2, int& particle3, int& particle4, double& charge, double& polarizability, double& aniso12, double& aniso34) const;
126  void setParticleParameters(int index, int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34);
135  int addScreenedPair(int particle1, int particle2, double thole);
144  void getScreenedPairParameters(int index, int& particle1, int& particle2, double& thole) const;
153  void setScreenedPairParameters(int index, int particle1, int particle2, double thole);
164  void updateParametersInContext(Context& context);
172  return false;
173  }
174 protected:
175  ForceImpl* createImpl() const;
176 private:
177  class ParticleInfo;
178  class ScreenedPairInfo;
179  std::vector<ParticleInfo> particles;
180  std::vector<ScreenedPairInfo> screenedPairs;
181 };
182 
187 class DrudeForce::ParticleInfo {
188 public:
189  int particle, particle1, particle2, particle3, particle4;
190  double charge, polarizability, aniso12, aniso34;
191  ParticleInfo() {
192  particle = particle1 = particle2 = particle3 = particle4 = -1;
193  charge = polarizability = aniso12 = aniso34 = 0.0;
194  }
195  ParticleInfo(int particle, int particle1, int particle2, int particle3, int particle4, double charge, double polarizability, double aniso12, double aniso34) :
196  particle(particle), particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), charge(charge), polarizability(polarizability), aniso12(aniso12), aniso34(aniso34) {
197  }
198 };
199 
204 class DrudeForce::ScreenedPairInfo {
205 public:
206  int particle1, particle2;
207  double thole;
208  ScreenedPairInfo() {
209  particle1 = particle2 = -1;
210  thole = 0.0;
211  }
212  ScreenedPairInfo(int particle1, int particle2, double thole) :
213  particle1(particle1), particle2(particle2), thole(thole) {
214  }
215 };
216 
217 } // namespace OpenMM
218 
219 #endif /*OPENMM_DRUDEFORCE_H_*/
int getNumScreenedPairs() const
Get the number of special interactions that should be calculated differently from other interactions...
Definition: DrudeForce.h:70
A Context stores the complete state of a simulation.
Definition: Context.h:67
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: DrudeForce.h:171
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
int getNumParticles() const
Get the number of particles for which force field parameters have been defined.
Definition: DrudeForce.h:64
This class implements forces that are specific to Drude oscillators.
Definition: DrudeForce.h:55
Definition: AndersenThermostat.h:40