ReferenceObc.h 7.12 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
26
#ifndef __ReferenceObc_H__
#define __ReferenceObc_H__
27
28
29

#include "ObcParameters.h"

30
namespace OpenMM {
31

32
class ReferenceObc {
33
34
35
36
37
38
39
40
41

   private:

      // GBSA/OBC parameters

      ObcParameters* _obcParameters;

      // arrays containing OBC chain derivative 

42
      std::vector<RealOpenMM> _obcChain;
43

Mark Friedrichs's avatar
Mark Friedrichs committed
44
45
46
47
      // flag to signal whether ACE approximation
      // is to be included

      int _includeAceApproximation;
48
49
50
51
52
53
54
55
56
57
58
59
60
61


   public:

      /**---------------------------------------------------------------------------------------
      
         Constructor
      
         @param implicitSolventParameters    ImplicitSolventParameters reference
      
         @return CpuImplicitSolvent object
      
         --------------------------------------------------------------------------------------- */

62
       ReferenceObc(ObcParameters* obcParameters);
63
64
65
66
67
68
69

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

70
       ~ReferenceObc();
71
72
73
74
75
76
77
78
79

      /**---------------------------------------------------------------------------------------
      
         Return ObcParameters
      
         @return ObcParameters
      
         --------------------------------------------------------------------------------------- */

80
      ObcParameters* getObcParameters() const;
81
82
83
84
85
86
87
88
89

      /**---------------------------------------------------------------------------------------
      
         Set ImplicitSolventParameters
      
         @param ImplicitSolventParameters
      
         --------------------------------------------------------------------------------------- */

90
      void setObcParameters(ObcParameters* obcParameters);
91
92
93
 
      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
94
         Return flag signalling whether AceApproximation for nonpolar term is to be included
95
      
Mark Friedrichs's avatar
Mark Friedrichs committed
96
         @return flag
97
98
      
         --------------------------------------------------------------------------------------- */
Mark Friedrichs's avatar
Mark Friedrichs committed
99

100
      int includeAceApproximation() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
101
102
103
104

      /**---------------------------------------------------------------------------------------
      
         Set flag indicating whether AceApproximation is to be included
105
      
Mark Friedrichs's avatar
Mark Friedrichs committed
106
         @param includeAceApproximation new includeAceApproximation value
107
      
Mark Friedrichs's avatar
Mark Friedrichs committed
108
109
         --------------------------------------------------------------------------------------- */

110
      void setIncludeAceApproximation(int includeAceApproximation);
Mark Friedrichs's avatar
Mark Friedrichs committed
111

112
113
      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
114
         Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms()
115
116
117
118
119
      
         @return array
      
         --------------------------------------------------------------------------------------- */
      
120
      std::vector<RealOpenMM>& getObcChain();
121
122
123
124
125
126
127
128
129
130
      
      /**---------------------------------------------------------------------------------------
      
         Get Born radii based on OBC 

         @param atomCoordinates   atomic coordinates
         @param bornRadii         output array of Born radii
      
         --------------------------------------------------------------------------------------- */
      
131
      void computeBornRadii(const std::vector<OpenMM::RealVec>& atomCoordinates, std::vector<RealOpenMM>& bornRadii);
132
      
Mark Friedrichs's avatar
Mark Friedrichs committed
133
134
135
136
137
138
139
140
141
142
143
144
      /**---------------------------------------------------------------------------------------
        
         Get nonpolar solvation force constribution via ACE approximation
        
         @param obcParameters parameters
         @param vdwRadii                  Vdw radii
         @param bornRadii                 Born radii
         @param energy                    energy (output): value is incremented from input value 
         @param forces                    forces: values are incremented from input values
        
            --------------------------------------------------------------------------------------- */
        
145
146
      void computeAceNonPolarForce(const ObcParameters* obcParameters, const std::vector<RealOpenMM>& bornRadii,
                                   RealOpenMM* energy, std::vector<RealOpenMM>& forces) const;
Mark Friedrichs's avatar
Mark Friedrichs committed
147
        
148
149
150
151
152
153
154
155
156
157
      /**---------------------------------------------------------------------------------------
      
         Get Born energy and forces based on OBC 
      
         @param atomCoordinates   atomic coordinates
         @param partialCharges    partial charges
         @param forces            forces
      
         --------------------------------------------------------------------------------------- */
      
158
      RealOpenMM computeBornEnergyForces(const std::vector<OpenMM::RealVec>& atomCoordinates,
159
                                         const std::vector<RealOpenMM>& partialCharges, std::vector<OpenMM::RealVec>& forces);
160
      
161
162
163
164
165
166
167
168
169
170
171
172
173
174
    /**---------------------------------------------------------------------------------------
    
        Print Obc parameters, radii, forces, ...
    
        @param atomCoordinates     atomic coordinates
        @param partialCharges      partial charges
        @param bornRadii           Born radii (may be empty)
        @param bornForces          Born forces (may be empty)
        @param forces              forces (may be empty)
        @param idString            id string (who is calling)
        @param log                 log file
    
        --------------------------------------------------------------------------------------- */
    
175
    void printObc(const std::vector<OpenMM::RealVec>& atomCoordinates,
176
177
178
                  const std::vector<RealOpenMM>& partialCharges,
                  const std::vector<RealOpenMM>& bornRadii,
                  const std::vector<RealOpenMM>& bornForces,
179
180
                  const std::vector<OpenMM::RealVec>& forces,
                  const std::string& idString, FILE* log);
181
    
182
183
};

184
} // namespace OpenMM
185

186
#endif // __ReferenceObc_H__