OpenMM
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
AmoebaTorsionTorsionForce.h
1 #ifndef OPENMM_AMOEBA_TORSION_TORSION_FORCE_H_
2 #define OPENMM_AMOEBA_TORSION_TORSION_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 
38 #include <vector>
39 #include <cmath>
40 
41 namespace OpenMM {
42 
43 typedef std::vector< std::vector< std::vector<double> > > TorsionTorsionGrid;
44 typedef std::vector< std::vector< std::vector<float> > > TorsionTorsionGridFloat;
45 
53 class OPENMM_EXPORT_AMOEBA AmoebaTorsionTorsionForce : public Force {
54 
55 public:
60 
64  int getNumTorsionTorsions(void) const {
65  return torsionTorsions.size();
66  }
67 
71  int getNumTorsionTorsionGrids(void) const {
72  return torsionTorsionGrids.size();
73  }
74 
87  int addTorsionTorsion(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex);
88 
101  void getTorsionTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& particle5, int& chiralCheckAtomIndex, int& gridIndex) const;
102 
115  void setTorsionTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex);
116 
123  const std::vector<std::vector<std::vector<double> > >& getTorsionTorsionGrid(int index) const;
124 
139  void setTorsionTorsionGrid(int index, const std::vector<std::vector<std::vector<double> > >& grid);
147  return false;
148  }
149 protected:
150  ForceImpl* createImpl() const;
151 private:
152  class TorsionTorsionInfo;
153  class TorsionTorsionGridInfo;
154  std::vector<TorsionTorsionInfo> torsionTorsions;
155  std::vector<TorsionTorsionGridInfo> torsionTorsionGrids;
156 };
157 
162 class AmoebaTorsionTorsionForce::TorsionTorsionInfo {
163 
164 public:
165 
166  int particle1, particle2, particle3, particle4, particle5;
167  int chiralCheckAtomIndex;
168  int gridIndex;
169  TorsionTorsionInfo() {
170  particle1 = particle2 = particle3 = particle4 = particle5 = chiralCheckAtomIndex = -1;
171  gridIndex = 0;
172  }
173  TorsionTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex) :
174  particle1(particle1), particle2(particle2), particle3(particle3),
175  particle4(particle4), particle5(particle5), gridIndex(gridIndex), chiralCheckAtomIndex(chiralCheckAtomIndex) {
176 
177  }
178 };
179 
184 class AmoebaTorsionTorsionForce::TorsionTorsionGridInfo {
185 
186 public:
187 
188  TorsionTorsionGridInfo() {
189  _size[0] = _size[1] = 0;
190  _startValues[0] = _startValues[1] = 0.0;
191  _spacing[0] = _spacing[1] = 1.0;
192  }
193 
194  TorsionTorsionGridInfo(const TorsionTorsionGrid& grid);
195 
196  const TorsionTorsionGrid& getTorsionTorsionGrid(void) const {
197  return _grid;
198  }
199  int getDimensionSize(int index) const {
200  return _size[index];
201  }
202  double getStartValue(int index) const {
203  return _startValues[index];
204  }
205  double getSpacing(int index) const {
206  return _spacing[index];
207  }
208 
209 private:
210 
211  TorsionTorsionGrid _grid;
212  int _size[2];
213  double _startValues[2];
214  double _spacing[2];
215 };
216 
217 } // namespace OpenMM
218 
219 #endif /*OPENMM_AMOEBA_TORSION_TORSION_FORCE_H_*/
std::vector< std::vector< std::vector< double > > > TorsionTorsionGrid
Definition: AmoebaTorsionTorsionForce.h:43
std::vector< std::vector< std::vector< float > > > TorsionTorsionGridFloat
Definition: AmoebaTorsionTorsionForce.h:44
const std::vector< std::vector< std::vector< double > > > & getTorsionTorsionGrid(int index) const
Get the torsion-torsion grid at the specified index.
This class implements the Amoeba torsion-torsion interaction.
Definition: AmoebaTorsionTorsionForce.h:53
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: AmoebaTorsionTorsionForce.h:146
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
Definition: AndersenThermostat.h:40
int getNumTorsionTorsions(void) const
Get the number of torsion-torsion terms in the potential function.
Definition: AmoebaTorsionTorsionForce.h:64
int getNumTorsionTorsionGrids(void) const
Get the number of torsion-torsion grids.
Definition: AmoebaTorsionTorsionForce.h:71