ObcParameters.h 11.9 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__

peastman's avatar
peastman committed
28
#include "openmm/Vec3.h"
29
#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
      int _numberOfAtoms;

peastman's avatar
peastman committed
47
48
49
50
51
      double _solventDielectric;
      double _soluteDielectric;
      double _electricConstant;
      double _probeRadius;
      double _pi4Asolv;
Mark Friedrichs's avatar
Mark Friedrichs committed
52

peastman's avatar
peastman committed
53
54
55
56
      double _dielectricOffset;
      double _alphaObc;
      double _betaObc;
      double _gammaObc;
57
58
59
60
      ObcType _obcType;

      // scaled radius factors (S_kk in HCT paper)

peastman's avatar
peastman committed
61
62
      std::vector<double> _atomicRadii;
      std::vector<double> _scaledRadiusFactors;
63

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

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

         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
79
      void setDielectricOffset(double 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
      
         --------------------------------------------------------------------------------------- */

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

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

peastman's avatar
peastman committed
129
      double 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
      
         --------------------------------------------------------------------------------------- */

peastman's avatar
peastman committed
139
      void setProbeRadius(double probeRadius);
Mark Friedrichs's avatar
Mark Friedrichs committed
140
141
142
143

      /**---------------------------------------------------------------------------------------
      
         Get pi4Asolv:  used in ACE approximation for nonpolar term  
peastman's avatar
peastman committed
144
            M_PI*4.0f*0.0049f*1000.0f; (Simbios) 
Mark Friedrichs's avatar
Mark Friedrichs committed
145
146
147
148
149
      
         @return pi4Asolv
      
         --------------------------------------------------------------------------------------- */

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

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

peastman's avatar
peastman committed
158
      void setPi4Asolv(double pi4Asolv);
159
160

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

peastman's avatar
peastman committed
168
      double 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
      
         --------------------------------------------------------------------------------------- */

peastman's avatar
peastman committed
178
      void setSolventDielectric(double solventDielectric);
179

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

peastman's avatar
peastman committed
188
      double 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
      
         --------------------------------------------------------------------------------------- */

peastman's avatar
peastman committed
198
      void setSoluteDielectric(double 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
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
228
      double getAlphaObc() const;
229
230
231
232
233
234
235
236
237
      
      /**---------------------------------------------------------------------------------------
      
         Get beta OBC (Eqs. 6 & 7) in Proteins paper
      
         @return betaObc
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
238
      double getBetaObc() const;
239
240
241
242
243
244
245
246
247
      
      /**---------------------------------------------------------------------------------------
      
         Get gamma OBC (Eqs. 6 & 7) in Proteins paper
      
         @return gammaObc
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
248
      double 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
      
         --------------------------------------------------------------------------------------- */
      
peastman's avatar
peastman committed
258
      double getDielectricOffset() const;
259
260
261
262
263
264
265
266
267

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

peastman's avatar
peastman committed
288
      const std::vector<double>& getAtomicRadii() const;
289
290
291
292
293
294
295
296
297

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

peastman's avatar
peastman committed
298
      void setAtomicRadii(const std::vector<double>& atomicRadii);
299
300


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

         Set the force to use a cutoff.

         @param distance            the cutoff distance

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

peastman's avatar
peastman committed
309
      void setUseCutoff(double 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.

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

peastman's avatar
peastman committed
325
      double 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

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

peastman's avatar
peastman committed
337
      void setPeriodic(OpenMM::Vec3* 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

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

peastman's avatar
peastman committed
353
      const OpenMM::Vec3* getPeriodicBox();
354

355
};
356
357

} // namespace OpenMM
358
359

#endif // __ObcParameters_H__