ReferenceStochasticDynamics.h 5.74 KB
Newer Older
1

2
/* Portions copyright (c) 2006-2016 Stanford University and Simbios.
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
28
 * 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 __ReferenceStochasticDynamics_H__
#define __ReferenceStochasticDynamics_H__

#include "ReferenceDynamics.h"
29
#include "openmm/internal/windowsExport.h"
30

31
namespace OpenMM {
32

33
class OPENMM_EXPORT ReferenceStochasticDynamics : public ReferenceDynamics {
34

35
   protected:
36

peastman's avatar
peastman committed
37
38
39
      std::vector<OpenMM::Vec3> xPrime;
      std::vector<double> inverseMasses;
      double friction;
40
41
42
43
44
45
46
47
48
      
   public:

      /**---------------------------------------------------------------------------------------
      
         Constructor

         @param numberOfAtoms  number of atoms
         @param deltaT         delta t for dynamics
49
         @param friction       friction coefficient
50
51
52
53
         @param temperature    temperature
      
         --------------------------------------------------------------------------------------- */

peastman's avatar
peastman committed
54
       ReferenceStochasticDynamics(int numberOfAtoms, double deltaT, double friction, double temperature);
55
56
57
58
59
60
61

      /**---------------------------------------------------------------------------------------
      
         Destructor
      
         --------------------------------------------------------------------------------------- */

62
       ~ReferenceStochasticDynamics();
63
64
65

      /**---------------------------------------------------------------------------------------
      
66
         Get friction coefficient
67
68
69
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
70
      double getFriction() const;
71
72
73
74
75
      
      /**---------------------------------------------------------------------------------------
      
         Update
      
76
         @param system              the System to be integrated
77
78
79
80
         @param atomCoordinates     atom coordinates
         @param velocities          velocities
         @param forces              forces
         @param masses              atom masses
81
         @param tolerance           the constraint tolerance
82
83
84
      
         --------------------------------------------------------------------------------------- */
     
peastman's avatar
peastman committed
85
86
      void update(const OpenMM::System& system, std::vector<OpenMM::Vec3>& atomCoordinates,
                  std::vector<OpenMM::Vec3>& velocities, std::vector<OpenMM::Vec3>& forces, std::vector<double>& masses, double tolerance);
87
88
89
90
91
92
93
94
95
96
97
98
99
100
     
      /**---------------------------------------------------------------------------------------
      
         First update; based on code in update.c do_update_sd() Gromacs 3.1.4
      
         @param numberOfAtoms       number of atoms
         @param atomCoordinates     atom coordinates
         @param velocities          velocities
         @param forces              forces
         @param inverseMasses       inverse atom masses
         @param xPrime              xPrime
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
101
102
      virtual void updatePart1(int numberOfAtoms, std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& velocities,
                       std::vector<OpenMM::Vec3>& forces, std::vector<double>& inverseMasses, std::vector<OpenMM::Vec3>& xPrime);
103
104
105
106
107
108
109
110
111
      
      /**---------------------------------------------------------------------------------------
      
         Second update
      
         @param numberOfAtoms       number of atoms
         @param atomCoordinates     atom coordinates
         @param velocities          velocities
         @param forces              forces
peastman's avatar
peastman committed
112
         @param inverseMasses       inverse atom masses
113
114
115
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
116
117
      virtual void updatePart2(int numberOfAtoms, std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& velocities,
                       std::vector<OpenMM::Vec3>& forces, std::vector<double>& inverseMasses, std::vector<OpenMM::Vec3>& xPrime);
118
      
peastman's avatar
peastman committed
119
120
121
122
123
124
125
126
127
128
129
      /**---------------------------------------------------------------------------------------
      
         Third update
      
         @param numberOfAtoms       number of atoms
         @param atomCoordinates     atom coordinates
         @param velocities          velocities
         @param inverseMasses       inverse atom masses
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
130
131
      virtual void updatePart3(int numberOfAtoms, std::vector<OpenMM::Vec3>& atomCoordinates, std::vector<OpenMM::Vec3>& velocities,
                       std::vector<double>& inverseMasses, std::vector<OpenMM::Vec3>& xPrime);
132
133
};

134
} // namespace OpenMM
135
136

#endif // __ReferenceStochasticDynamics_H__