"openmmapi/src/RMSDForceImpl.cpp" did not exist on "a63645c0913af551f99b77f7d82982e654a0274d"
ReferenceLincsAlgorithm.h 5.54 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Portions copyright (c) 2006-2009 Stanford University and Simbios.
 * Contributors: Pande Group
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef __ReferenceLincsAlgorithm_H__
#define __ReferenceLincsAlgorithm_H__

#include "ReferenceConstraintAlgorithm.h"
28
#include "../SimTKUtilities/SimTKOpenMMRealType.h"
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <vector>

// ---------------------------------------------------------------------------------------

class ReferenceLincsAlgorithm : public ReferenceConstraintAlgorithm {

   protected:

      int _numTerms;
      int _numberOfConstraints;
      int** _atomIndices;
      RealOpenMM* _distance;

      bool _hasInitialized;
      std::vector<std::vector<int> > _linkedConstraints;
      std::vector<RealOpenMM> _sMatrix;
      std::vector<RealOpenMM> _rhs1;
      std::vector<RealOpenMM> _rhs2;
      std::vector<RealOpenMM> _solution;
      std::vector<std::vector<RealOpenMM> > _couplingMatrix;
49
      std::vector<OpenMM::RealVec> _constraintDir;
50
51
52
53
54
55
56
57
58
59
60


      /**---------------------------------------------------------------------------------------

         Set the number of terms to use in the series expansion

         @param numberOfAtoms    number of atoms
         @param inverseMasses    1/mass

         --------------------------------------------------------------------------------------- */

61
      void initialize(int numberOfAtoms, std::vector<RealOpenMM>& inverseMasses);
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

      /**---------------------------------------------------------------------------------------

         Solve the matrix equation

         --------------------------------------------------------------------------------------- */

      void solveMatrix();

      /**---------------------------------------------------------------------------------------

         Update the atom position based on the solution to the matrix equation.

         @param numberOfAtoms    number of atoms
         @param atomCoordinates  atom coordinates
         @param inverseMasses    1/mass

         --------------------------------------------------------------------------------------- */

81
      void updateAtomPositions(int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<RealOpenMM>& inverseMasses);
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

   public:

      /**---------------------------------------------------------------------------------------

         ReferenceLincsAlgorithm constructor

         @param numberOfConstraints      number of constraints
         @param atomIndices              atom indices for contraints
         @param distance                 distances for constraints

         --------------------------------------------------------------------------------------- */

      ReferenceLincsAlgorithm( int numberOfConstraints, int** atomIndices, RealOpenMM* distance );

      /**---------------------------------------------------------------------------------------

         Get number of constraints

         @return number of constraints

         --------------------------------------------------------------------------------------- */

      int getNumberOfConstraints( void ) const;

      /**---------------------------------------------------------------------------------------

         Get the number of terms to use in the series expansion

         @return terms

         --------------------------------------------------------------------------------------- */

      int getNumTerms( void ) const;

      /**---------------------------------------------------------------------------------------

         Set the number of terms to use in the series expansion

         --------------------------------------------------------------------------------------- */

      void setNumTerms( int terms );

      /**---------------------------------------------------------------------------------------

         Apply Lincs algorithm

         @param numberOfAtoms    number of atoms
         @param atomCoordinates  atom coordinates
         @param atomCoordinatesP atom coordinates prime
         @param inverseMasses    1/mass

         @return ReferenceDynamics::DefaultReturn if converge; else
          return ReferenceDynamics::ErrorReturn

         --------------------------------------------------------------------------------------- */

139
140
      int apply( int numberOfAtoms, std::vector<OpenMM::RealVec>& atomCoordinates,
                       std::vector<OpenMM::RealVec>& atomCoordinatesP, std::vector<RealOpenMM>& inverseMasses );
141
142
143
144
145
};

// ---------------------------------------------------------------------------------------

#endif // __ReferenceLincsAlgorithm_H__