"...reference/src/SimTKReference/ReferenceCCMAAlgorithm.h" did not exist on "72872e97a150320617696c62270925be3a62aa23"
ReferenceDynamics.cpp 5.74 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

/* Portions copyright (c) 2006 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.
 */

25
#include <cstring>
26
27
#include <sstream>

28
#include "SimTKOpenMMUtilities.h"
29
30
#include "ReferenceDynamics.h"

31
32
#include <cstdio>

33
using std::vector;
34
using namespace OpenMM;
35

36

37
38
39
40
41
42
43
44
45
46
/**---------------------------------------------------------------------------------------

   ReferenceDynamics constructor

   @param numberOfAtoms  number of atoms
   @param deltaT         delta t for dynamics
   @param temperature    temperature

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

peastman's avatar
peastman committed
47
ReferenceDynamics::ReferenceDynamics(int numberOfAtoms,  double deltaT, double temperature) : 
48
49
                  _numberOfAtoms(numberOfAtoms), _deltaT(deltaT), _temperature(temperature) {

peastman's avatar
peastman committed
50
   _timeStep = 0;
51
52
   _ownReferenceConstraint = false;
   _referenceConstraint    = NULL;
53
54
55
56
57
58
59
60
}

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

   ReferenceDynamics destructor

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

61
62
ReferenceDynamics::~ReferenceDynamics() {
   if (_ownReferenceConstraint) {
63
      delete _referenceConstraint;
64
65
66
67
68
69
70
71
72
73
74
   }
}

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

   Get number of atoms

   @return number of atoms

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

75
int ReferenceDynamics::getNumberOfAtoms() const {
76
77
78
79
80
81
82
83
84
85
86
   return _numberOfAtoms;
}

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

   Get time step

   @return time step

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

87
int ReferenceDynamics::getTimeStep() const {
88
89
90
91
92
93
94
95
96
97
98
   return _timeStep;
}

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

   Increment time step

   @return incremented time step

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

99
int ReferenceDynamics::incrementTimeStep() {
100
101
102
103
104
105
106
107
108
109
110
   return (++_timeStep);
}

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

   Get delta t

   @return deltaT

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

peastman's avatar
peastman committed
111
double ReferenceDynamics::getDeltaT() const {
112
113
114
   return _deltaT;
}

115
116
117
118
119
120
/**---------------------------------------------------------------------------------------

   Set delta t

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

peastman's avatar
peastman committed
121
void ReferenceDynamics::setDeltaT(double deltaT) {
122
123
124
   _deltaT = deltaT;
}

125
126
127
128
129
130
131
132
/**---------------------------------------------------------------------------------------

   Get temperature

   @return temperature

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

peastman's avatar
peastman committed
133
double ReferenceDynamics::getTemperature() const {
134
135
136
137
138
   return _temperature;
}

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

139
   Get ReferenceConstraint
140

141
   @return ReferenceConstraint  object
142
143
144

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

145
ReferenceConstraintAlgorithm* ReferenceDynamics::getReferenceConstraintAlgorithm() const {
146
   return _referenceConstraint;
147
148
149
150
}

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

151
   Set ReferenceConstraint
152

153
   @param referenceConstraint  ReferenceConstraint object
154
155
156

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

157
void ReferenceDynamics::setReferenceConstraintAlgorithm(ReferenceConstraintAlgorithm* referenceConstraint) {
158
159
   // delete if own

160
   if (_referenceConstraint && _ownReferenceConstraint) {
161
      delete _referenceConstraint;
162
163
   }

164
165
   _referenceConstraint = referenceConstraint;
   _ownReferenceConstraint = 0;
166
167
168
169
}

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

170
   Update -- driver routine for performing dynamics update of coordinates
171
172
   and velocities

173
   @param system              the System to be integrated
174
175
176
177
   @param atomCoordinates     atom coordinates
   @param velocities          velocities
   @param forces              forces
   @param masses              atom masses
178
   @param tolerance           the constraint tolerance
179
180
181

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

peastman's avatar
peastman committed
182
183
void ReferenceDynamics::update(const OpenMM::System& system, vector<Vec3>& atomCoordinates,
                               vector<Vec3>& velocities, vector<Vec3>& forces, vector<double>& masses, double tolerance) {
184
}