BrookIntegrateVerletStepKernel.h 4.78 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1
2
#ifndef OPENMM_BROOK_INTEGRATE_VERLET_STEP_KERNEL_H_
#define OPENMM_BROOK_INTEGRATE_VERLET_STEP_KERNEL_H_
Mark Friedrichs's avatar
Mark Friedrichs committed
3
4
5
6
7
8
9
10
11

/* -------------------------------------------------------------------------- *
 *                                   OpenMM                                   *
 * -------------------------------------------------------------------------- *
 * This is part of the OpenMM molecular simulation toolkit originating from   *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org.               *
 *                                                                            *
12
 * Portions copyright ( c ) 2008 Stanford University and the Authors.           *
Mark Friedrichs's avatar
Mark Friedrichs committed
13
14
15
16
 * Authors: Peter Eastman, Mark Friedrichs                                    *
 * Contributors:                                                              *
 *                                                                            *
 * Permission is hereby granted, free of charge, to any person obtaining a    *
17
 * copy of this software and associated documentation files ( the "Software" ), *
Mark Friedrichs's avatar
Mark Friedrichs committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 * 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.                                     *
 * -------------------------------------------------------------------------- */

Mark Friedrichs's avatar
Mark Friedrichs committed
35
#include "kernels.h"
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
36
#include "OpenMMBrookInterface.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
37
38
#include "BrookVerletDynamics.h"
#include "BrookShakeAlgorithm.h"
Mark Friedrichs's avatar
Mark Friedrichs committed
39
40
41
42

namespace OpenMM {

/**
Mark Friedrichs's avatar
Mark Friedrichs committed
43
 * This is the base class of Float and Double streams in the Brook Platform.
Mark Friedrichs's avatar
Mark Friedrichs committed
44
45
 */

Mark Friedrichs's avatar
Mark Friedrichs committed
46
class BrookIntegrateVerletStepKernel : public IntegrateVerletStepKernel {
Mark Friedrichs's avatar
Mark Friedrichs committed
47

48
   public:
Mark Friedrichs's avatar
Mark Friedrichs committed
49

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
50
51
52
53
54
      // return values

      static const int DefaultReturnValue = 0;
      static const int ErrorReturnValue   = -1; 

Mark Friedrichs's avatar
Mark Friedrichs committed
55
56
57
58
59
60
61
62
      /**
       * BrookIntegrateVerletStepKernel constructor
       * 
       * @param name        name of the stream to create
       * @param platform    platform
       *
       */
  
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
63
      BrookIntegrateVerletStepKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system  );
64

Mark Friedrichs's avatar
Mark Friedrichs committed
65
66
67
68
69
70
      /**
       * BrookIntegrateVerletStepKernel destructor
       * 
       */
  
      ~BrookIntegrateVerletStepKernel();
71
72

      /** 
Mark Friedrichs's avatar
Mark Friedrichs committed
73
       * Initialize the kernel, setting up all parameters related to integrator.
74
       * 
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
75
76
       * @param system             System reference
       * @param integrator         VerletIntegrator reference
Mark Friedrichs's avatar
Mark Friedrichs committed
77
       */
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
78
79
80

      void initialize( const System& system, const VerletIntegrator& integrator );

Mark Friedrichs's avatar
Mark Friedrichs committed
81
      /** 
Mark Friedrichs's avatar
Mark Friedrichs committed
82
       * Execute kernel
Mark Friedrichs's avatar
Mark Friedrichs committed
83
       * 
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
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
       * @param context            OpenMMContextImpl reference
       * @param integrator         VerletIntegrator reference
       *
       */

      void execute( OpenMMContextImpl& context, const VerletIntegrator& integrator );

      /** 
       * Set log file reference
       * 
       * @param  log file reference
       *
       * @return DefaultReturnValue
       *
       */
    
      int setLog( FILE* log );

      /*  
       * Get contents of object
       *
       * @param level of dump
       *
       * @return string containing contents
       *
       * */
    
      std::string getContents( int level ) const;

      /** 
       * Get log file reference
       * 
       * @return  log file reference
Mark Friedrichs's avatar
Mark Friedrichs committed
117
       *
118
       */
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
119
120
121
122
    
      FILE* getLog( void ) const;

   private:
123

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
124
      FILE* _log;
125

Mark Friedrichs's avatar
Mark Friedrichs committed
126
127
128
      BrookVerletDynamics*      _brookVerletDynamics;
      BrookShakeAlgorithm*      _brookShakeAlgorithm;
 
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
129
130
131
132
133
134
135
136
      // interface

      OpenMMBrookInterface& _openMMBrookInterface;

      // System reference

      System& _system;

Mark Friedrichs's avatar
Mark Friedrichs committed
137
138
139
140
};

} // namespace OpenMM

Mark Friedrichs's avatar
Mark Friedrichs committed
141
#endif /* OPENMM_BROOK_INTEGRATE_VERLET_STEP_KERNEL_H_ */