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);
140 
141 protected:
142  ForceImpl* createImpl() const;
143 private:
144  class TorsionTorsionInfo;
145  class TorsionTorsionGridInfo;
146  std::vector<TorsionTorsionInfo> torsionTorsions;
147  std::vector<TorsionTorsionGridInfo> torsionTorsionGrids;
148 };
149 
154 class AmoebaTorsionTorsionForce::TorsionTorsionInfo {
155 
156 public:
157 
158  int particle1, particle2, particle3, particle4, particle5;
159  int chiralCheckAtomIndex;
160  int gridIndex;
161  TorsionTorsionInfo() {
162  particle1 = particle2 = particle3 = particle4 = particle5 = chiralCheckAtomIndex = -1;
163  gridIndex = 0;
164  }
165  TorsionTorsionInfo(int particle1, int particle2, int particle3, int particle4, int particle5, int chiralCheckAtomIndex, int gridIndex) :
166  particle1(particle1), particle2(particle2), particle3(particle3),
167  particle4(particle4), particle5(particle5), gridIndex(gridIndex), chiralCheckAtomIndex(chiralCheckAtomIndex) {
168 
169  }
170 };
171 
176 class AmoebaTorsionTorsionForce::TorsionTorsionGridInfo {
177 
178 public:
179 
180  TorsionTorsionGridInfo() {
181  _size[0] = _size[1] = 0;
182  _startValues[0] = _startValues[1] = 0.0;
183  _spacing[0] = _spacing[1] = 1.0;
184  }
185 
186  TorsionTorsionGridInfo(const TorsionTorsionGrid& grid);
187 
188  const TorsionTorsionGrid& getTorsionTorsionGrid(void) const {
189  return _grid;
190  }
191  int getDimensionSize(int index) const {
192  return _size[index];
193  }
194  double getStartValue(int index) const {
195  return _startValues[index];
196  }
197  double getSpacing(int index) const {
198  return _spacing[index];
199  }
200 
201 private:
202 
203  TorsionTorsionGrid _grid;
204  int _size[2];
205  double _startValues[2];
206  double _spacing[2];
207 };
208 
209 } // namespace OpenMM
210 
211 #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
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
A ForceImpl provides the internal implementation of a Force.
Definition: ForceImpl.h:57
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