ObcParameters.h 12 KB
Newer Older
1

2
/* Portions copyright (c) 2006-2009 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
 * 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 __ObcParameters_H__
#define __ObcParameters_H__

28
#include "SimTKOpenMMCommon.h"
29

30
namespace OpenMM {
31

Mark Friedrichs's avatar
Mark Friedrichs committed
32
class ObcParameters {
33
34
35
36
37
38
39
40
41
42
43

   public:

       // OBC types

       enum ObcType { ObcTypeI, ObcTypeII };

   private:

      // OBC constants & parameters
   
Mark Friedrichs's avatar
Mark Friedrichs committed
44
45
46
47
48
49
50
51
      int _numberOfAtoms;

      RealOpenMM _solventDielectric;
      RealOpenMM _soluteDielectric;
      RealOpenMM _electricConstant;
      RealOpenMM _probeRadius;
      RealOpenMM _pi4Asolv;

52
53
54
55
56
57
58
59
      RealOpenMM _dielectricOffset;
      RealOpenMM _alphaObc;
      RealOpenMM _betaObc;
      RealOpenMM _gammaObc;
      ObcType _obcType;

      // scaled radius factors (S_kk in HCT paper)

Mark Friedrichs's avatar
Mark Friedrichs committed
60
61
      RealOpenMMVector _atomicRadii;
      RealOpenMMVector _scaledRadiusFactors;
62

63
64
      // cutoff and periodic boundary conditions
      
Mark Friedrichs's avatar
Mark Friedrichs committed
65
66
      bool _cutoff;
      bool _periodic;
67
      OpenMM::RealVec _periodicBoxVectors[3];
Mark Friedrichs's avatar
Mark Friedrichs committed
68
      RealOpenMM _cutoffDistance;
69

70
71
      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
72
         Set solvent dielectric 
73
74
75
76
77
      
         @param dielectricOffset         solvent dielectric

         --------------------------------------------------------------------------------------- */
      
78
      void setDielectricOffset(RealOpenMM dielectricOffset);
79
80
81
82
83

   public:

      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
84
         ObcParameters constructor 
85
86
87
88
89
      
         @param numberOfAtoms       number of atoms
      
         --------------------------------------------------------------------------------------- */
      
90
       ObcParameters(int numberOfAtoms, ObcParameters::ObcType obcType = ObcTypeII);
91
92
93

      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
94
         ObcParameters destructor 
95
96
97
      
         --------------------------------------------------------------------------------------- */
      
98
       ~ObcParameters();
99

Mark Friedrichs's avatar
Mark Friedrichs committed
100
101
102
103
104
105
106
107
      /**---------------------------------------------------------------------------------------
      
         Get number of atoms
      
         @return number of atoms
      
         --------------------------------------------------------------------------------------- */

108
      int getNumberOfAtoms() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
109
110
111
112
113
114
115
116
117

      /**---------------------------------------------------------------------------------------
      
         Get electric constant
      
         @return electric constant
      
         --------------------------------------------------------------------------------------- */

118
      RealOpenMM getElectricConstant() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
119
120
121
122
123
124
125
126
127

      /**---------------------------------------------------------------------------------------
      
         Get probe radius (Simbios) 
      
         @return probeRadius
      
         --------------------------------------------------------------------------------------- */

128
      RealOpenMM getProbeRadius() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
129
130
131
132
133
134
135
136
137

      /**---------------------------------------------------------------------------------------
      
         Set probe radius (Simbios) 
      
         @param probeRadius   probe radius
      
         --------------------------------------------------------------------------------------- */

138
      void setProbeRadius(RealOpenMM probeRadius);
Mark Friedrichs's avatar
Mark Friedrichs committed
139
140
141
142
143
144
145
146
147
148

      /**---------------------------------------------------------------------------------------
      
         Get pi4Asolv:  used in ACE approximation for nonpolar term  
            ((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f; (Simbios) 
      
         @return pi4Asolv
      
         --------------------------------------------------------------------------------------- */

149
      RealOpenMM getPi4Asolv() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
150
151

      /**---------------------------------------------------------------------------------------
152
153
154
155
156
      
         Set pi4Asolv
      
         --------------------------------------------------------------------------------------- */

157
      void setPi4Asolv(RealOpenMM pi4Asolv);
158
159

      /**---------------------------------------------------------------------------------------
Mark Friedrichs's avatar
Mark Friedrichs committed
160
161
162
163
164
165
166
      
         Get solvent dielectric
      
         @return solvent dielectric
      
         --------------------------------------------------------------------------------------- */

167
      RealOpenMM getSolventDielectric() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
168
169
170
171
172
173
174
175
176

      /**---------------------------------------------------------------------------------------
      
         Set solvent dielectric
      
         @param solventDielectric solvent dielectric
      
         --------------------------------------------------------------------------------------- */

177
      void setSolventDielectric(RealOpenMM solventDielectric);
178

Mark Friedrichs's avatar
Mark Friedrichs committed
179
180
181
182
183
184
185
      /**---------------------------------------------------------------------------------------
      
         Get solute dielectric
      
         @return soluteDielectric
      
         --------------------------------------------------------------------------------------- */
186

187
      RealOpenMM getSoluteDielectric() const;
Mark Friedrichs's avatar
Mark Friedrichs committed
188
189
190
191
192
193
194
195
196

      /**---------------------------------------------------------------------------------------
      
         Set solute dielectric
      
         @param soluteDielectric solute dielectric
      
         --------------------------------------------------------------------------------------- */

197
      void setSoluteDielectric(RealOpenMM soluteDielectric);
198
199
200
201
202
203
204
205
206

      /**---------------------------------------------------------------------------------------
      
         Get OBC type
      
         @return OBC type
      
         --------------------------------------------------------------------------------------- */
      
207
      ObcParameters::ObcType getObcType() const;
208
209
210
211
212
213
214
215
216
      
      /**---------------------------------------------------------------------------------------
      
         Set OBC type specific parameters
      
         @param obcType OBC type (ObcTypeI or ObcTypeII -- Eq. 7 or 8)
      
         --------------------------------------------------------------------------------------- */
      
217
      void setObcTypeParameters(ObcParameters::ObcType obcType);
218
219
220
221
222
223
224
225
226
      
      /**---------------------------------------------------------------------------------------
      
         Get alpha OBC (Eqs. 6 & 7) in Proteins paper
      
         @return alphaObc
      
         --------------------------------------------------------------------------------------- */
      
227
      RealOpenMM getAlphaObc() const;
228
229
230
231
232
233
234
235
236
      
      /**---------------------------------------------------------------------------------------
      
         Get beta OBC (Eqs. 6 & 7) in Proteins paper
      
         @return betaObc
      
         --------------------------------------------------------------------------------------- */
      
237
      RealOpenMM getBetaObc() const;
238
239
240
241
242
243
244
245
246
      
      /**---------------------------------------------------------------------------------------
      
         Get gamma OBC (Eqs. 6 & 7) in Proteins paper
      
         @return gammaObc
      
         --------------------------------------------------------------------------------------- */
      
247
      RealOpenMM getGammaObc() const;
248
249
250
      
      /**---------------------------------------------------------------------------------------
      
Mark Friedrichs's avatar
Mark Friedrichs committed
251
         Get solvent dielectric 
252
253
254
255
256
      
         @return dielectricOffset dielectric offset
      
         --------------------------------------------------------------------------------------- */
      
257
      RealOpenMM getDielectricOffset() const;
258
259
260
261
262
263
264
265
266

      /**---------------------------------------------------------------------------------------
      
         Return OBC scale factors
      
         @return array
      
         --------------------------------------------------------------------------------------- */
      
267
      const RealOpenMMVector& getScaledRadiusFactors() const;
268
269
270
271
272
273
274
275
276
        
      /**---------------------------------------------------------------------------------------
      
         Return OBC scale factors
      
         @return array
      
         --------------------------------------------------------------------------------------- */
      
277
      void setScaledRadiusFactors(const RealOpenMMVector& scaledRadiusFactors);
278
279
280
281
282
283
284
285
286
        
      /**---------------------------------------------------------------------------------------
      
         Get AtomicRadii array w/ dielectric offset applied
      
         @return array of atom volumes
      
         --------------------------------------------------------------------------------------- */

287
      const RealOpenMMVector& getAtomicRadii() const;
288
289
290
291
292
293
294
295
296

      /**---------------------------------------------------------------------------------------
      
         Set AtomicRadii array
      
         @param atomicRadii vector of atomic radii
      
         --------------------------------------------------------------------------------------- */

297
      void setAtomicRadii(const RealOpenMMVector& atomicRadii);
298
299


300
301
302
303
304
305
306
307
      /**---------------------------------------------------------------------------------------

         Set the force to use a cutoff.

         @param distance            the cutoff distance

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

308
      void setUseCutoff(RealOpenMM distance);
309
310
311
312
313
314
315

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

         Get whether to use a cutoff.

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

316
      bool getUseCutoff() const;
317
318
319
320
321
322
323

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

         Get the cutoff distance.

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

324
      RealOpenMM getCutoffDistance() const;
325
326
327
328
329
330
331

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

         Set the force to use periodic boundary conditions.  This requires that a cutoff has
         already been set, and the smallest side of the periodic box is at least twice the cutoff
         distance.

332
         @param vectors    the vectors defining the periodic box
333
334
335

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

336
      void setPeriodic(OpenMM::RealVec* vectors);
337
338
339
340
341
342
343
344
345
346
347

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

         Get whether to use periodic boundary conditions.

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

      bool getPeriodic();

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

348
         Get the periodic box vectors
349
350
351

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

352
      const OpenMM::RealVec* getPeriodicBox();
353

354
};
355
356

} // namespace OpenMM
357
358

#endif // __ObcParameters_H__