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
29
#include "RealVec.h"
#include <vector>
30

31
namespace OpenMM {
32

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

   public:

       // OBC types

       enum ObcType { ObcTypeI, ObcTypeII };

   private:

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

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

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

      // scaled radius factors (S_kk in HCT paper)

61
62
      std::vector<RealOpenMM> _atomicRadii;
      std::vector<RealOpenMM> _scaledRadiusFactors;
63

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

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

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

   public:

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

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

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

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

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

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

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

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

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

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

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

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

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

158
      void setPi4Asolv(RealOpenMM pi4Asolv);
159
160

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

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

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

178
      void setSolventDielectric(RealOpenMM solventDielectric);
179

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

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

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

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

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

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

288
      const std::vector<RealOpenMM>& getAtomicRadii() const;
289
290
291
292
293
294
295
296
297

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

298
      void setAtomicRadii(const std::vector<RealOpenMM>& atomicRadii);
299
300


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

         Set the force to use a cutoff.

         @param distance            the cutoff distance

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

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

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

         Get whether to use a cutoff.

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

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

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

         Get the cutoff distance.

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

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

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

         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.

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

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

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

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

         Get whether to use periodic boundary conditions.

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

      bool getPeriodic();

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

349
         Get the periodic box vectors
350
351
352

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

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

355
};
356
357

} // namespace OpenMM
358
359

#endif // __ObcParameters_H__