AmoebaReferenceKernels.h 25.2 KB
Newer Older
1
2
3
4
#ifndef AMOEBA_OPENMM_REFERENCE_KERNELS_H_
#define AMOEBA_OPENMM_REFERENCE_KERNELS_H_

/* -------------------------------------------------------------------------- *
5
 *                              OpenMMAmoeba                                  *
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * -------------------------------------------------------------------------- *
 * 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.               *
 *                                                                            *
 * Portions copyright (c) 2008 Stanford University and the Authors.           *
 * Authors:                                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify       *
 * it under the terms of the GNU Lesser General Public License as published   *
 * by the Free Software Foundation, either version 3 of the License, or       *
 * (at your option) any later version.                                        *
 *                                                                            *
 * This program is distributed in the hope that it will be useful,            *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Lesser General Public License for more details.                        *
 *                                                                            *
 * You should have received a copy of the GNU Lesser General Public License   *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.      *
 * -------------------------------------------------------------------------- */

#include "openmm/System.h"
31
#include "openmm/amoebaKernels.h"
32
33
#include "openmm/AmoebaMultipoleForce.h"
#include "AmoebaReferenceMultipoleForce.h"
34
35
#include "ReferenceNeighborList.h"
#include "SimTKOpenMMRealType.h"
36
37
38
39

namespace OpenMM {

/**
40
 * This kernel is invoked by AmoebaBondForce to calculate the forces acting on the system and the energy of the system.
41
 */
42
class ReferenceCalcAmoebaBondForceKernel : public CalcAmoebaBondForceKernel {
43
public:
44
    ReferenceCalcAmoebaBondForceKernel(std::string name, 
45
                                               const Platform& platform,
46
                                               const System& system);
47
    ~ReferenceCalcAmoebaBondForceKernel();
48
49
50
51
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
52
     * @param force      the AmoebaBondForce this kernel will be used for
53
     */
54
    void initialize(const System& system, const AmoebaBondForce& force);
55
56
57
58
59
60
61
62
63
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
64
65
66
67
68
69
70
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaBondForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaBondForce& force);
71
72
73
74
75
76
private:
    int numBonds;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<RealOpenMM> length;
    std::vector<RealOpenMM> kQuadratic;
77
78
    RealOpenMM globalBondCubic;
    RealOpenMM globalBondQuartic;
79
    const System& system;
80
81
82
};

/**
83
 * This kernel is invoked by AmoebaAngleForce to calculate the forces acting on the system and the energy of the system.
84
 */
85
class ReferenceCalcAmoebaAngleForceKernel : public CalcAmoebaAngleForceKernel {
86
public:
87
    ReferenceCalcAmoebaAngleForceKernel(std::string name, const Platform& platform, const System& system);
88
    ~ReferenceCalcAmoebaAngleForceKernel();
89
90
91
92
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
93
     * @param force      the AmoebaAngleForce this kernel will be used for
94
     */
95
    void initialize(const System& system, const AmoebaAngleForce& force);
96
97
98
99
100
101
102
103
104
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
105
106
107
108
109
110
111
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaAngleForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaAngleForce& force);
112
113
114
115
116
117
118
private:
    int numAngles;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<RealOpenMM> angle;
    std::vector<RealOpenMM> kQuadratic;
119
120
121
122
    RealOpenMM globalAngleCubic;
    RealOpenMM globalAngleQuartic;
    RealOpenMM globalAnglePentic;
    RealOpenMM globalAngleSextic;
123
    const System& system;
124
125
};

126
/**
127
 * This kernel is invoked by AmoebaInPlaneAngleForce to calculate the forces acting on the system and the energy of the system.
128
 */
129
class ReferenceCalcAmoebaInPlaneAngleForceKernel : public CalcAmoebaInPlaneAngleForceKernel {
130
public:
131
    ReferenceCalcAmoebaInPlaneAngleForceKernel(std::string name, const Platform& platform, const System& system);
132
    ~ReferenceCalcAmoebaInPlaneAngleForceKernel();
133
134
135
136
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
137
     * @param force      the AmoebaInPlaneAngleForce this kernel will be used for
138
     */
139
    void initialize(const System& system, const AmoebaInPlaneAngleForce& force);
140
141
142
143
144
145
146
147
148
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
149
150
151
152
153
154
155
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaInPlaneAngleForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaInPlaneAngleForce& force);
156
157
158
159
160
161
162
163
private:
    int numAngles;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<int>   particle4;
    std::vector<RealOpenMM> angle;
    std::vector<RealOpenMM> kQuadratic;
164
165
166
167
    RealOpenMM globalInPlaneAngleCubic;
    RealOpenMM globalInPlaneAngleQuartic;
    RealOpenMM globalInPlaneAnglePentic;
    RealOpenMM globalInPlaneAngleSextic;
168
    const System& system;
169
170
};

171
172
173
174
175
/**
 * This kernel is invoked by AmoebaPiTorsionForce to calculate the forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaPiTorsionForceKernel : public CalcAmoebaPiTorsionForceKernel {
public:
176
    ReferenceCalcAmoebaPiTorsionForceKernel(std::string name, const Platform& platform, const System& system);
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
    ~ReferenceCalcAmoebaPiTorsionForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaPiTorsionForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaPiTorsionForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
194
195
196
197
198
199
200
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaPiTorsionForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaPiTorsionForce& force);
201
202
203
204
205
206
207
208
209
private:
    int numPiTorsions;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<int>   particle4;
    std::vector<int>   particle5;
    std::vector<int>   particle6;
    std::vector<RealOpenMM> kTorsion;
210
    const System& system;
211
212
};

213
214
215
216
217
/**
 * This kernel is invoked by AmoebaStretchBendForce to calculate the forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaStretchBendForceKernel : public CalcAmoebaStretchBendForceKernel {
public:
218
    ReferenceCalcAmoebaStretchBendForceKernel(std::string name, const Platform& platform, const System& system);
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
    ~ReferenceCalcAmoebaStretchBendForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaStretchBendForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaStretchBendForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
236
237
238
239
240
241
242
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaStretchBendForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaStretchBendForce& force);
243
244
245
246
247
248
249
250
251
private:
    int numStretchBends;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<RealOpenMM> lengthABParameters;
    std::vector<RealOpenMM> lengthCBParameters;
    std::vector<RealOpenMM> angleParameters;
    std::vector<RealOpenMM> kParameters;
252
    const System& system;
253
};
254
255
256
257
258
259

/**
 * This kernel is invoked by AmoebaOutOfPlaneBendForce to calculate the forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaOutOfPlaneBendForceKernel : public CalcAmoebaOutOfPlaneBendForceKernel {
public:
260
    ReferenceCalcAmoebaOutOfPlaneBendForceKernel(std::string name, const Platform& platform, const System& system);
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
    ~ReferenceCalcAmoebaOutOfPlaneBendForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaOutOfPlaneBendForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaOutOfPlaneBendForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
278
279
280
281
282
283
284
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaOutOfPlaneBendForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaOutOfPlaneBendForce& force);
285
286
287
288
289
290
291
292
293
294
295
private:
    int numOutOfPlaneBends;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<int>   particle4;
    std::vector<RealOpenMM> kParameters;
    RealOpenMM globalOutOfPlaneBendAngleCubic;
    RealOpenMM globalOutOfPlaneBendAngleQuartic;
    RealOpenMM globalOutOfPlaneBendAnglePentic;
    RealOpenMM globalOutOfPlaneBendAngleSextic;
296
    const System& system;
297
298
};

299
300
301
302
303
/**
 * This kernel is invoked by AmoebaTorsionTorsionForce to calculate the forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaTorsionTorsionForceKernel : public CalcAmoebaTorsionTorsionForceKernel {
public:
304
    ReferenceCalcAmoebaTorsionTorsionForceKernel(std::string name, const Platform& platform, const System& system);
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
    ~ReferenceCalcAmoebaTorsionTorsionForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaTorsionTorsionForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaTorsionTorsionForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private:
    int numTorsionTorsions;
    std::vector<int>   particle1;
    std::vector<int>   particle2;
    std::vector<int>   particle3;
    std::vector<int>   particle4;
    std::vector<int>   particle5;
    std::vector<int>   chiralCheckAtom;
    std::vector<int>   gridIndices;

    int numTorsionTorsionGrids;
    std::vector< std::vector< std::vector< std::vector<RealOpenMM> > > > torsionTorsionGrids;

335
    const System& system;
336
337
};

338
339
340
341
342
/**
 * This kernel is invoked by AmoebaMultipoleForce to calculate the forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaMultipoleForceKernel : public CalcAmoebaMultipoleForceKernel {
public:
343
    ReferenceCalcAmoebaMultipoleForceKernel(std::string name, const Platform& platform, const System& system);
344
345
346
347
348
349
350
351
    ~ReferenceCalcAmoebaMultipoleForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaMultipoleForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaMultipoleForce& force);
352
353
354
355
356
357
358
359
    /**
     * Setup for AmoebaReferenceMultipoleForce instance. 
     *
     * @param context        the current context
     *
     * @return pointer to initialized instance of AmoebaReferenceMultipoleForce
     */
    AmoebaReferenceMultipoleForce* setupAmoebaReferenceMultipoleForce(ContextImpl& context );
360
361
362
363
364
365
366
367
368
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
369
370
371
372
373
374
375
    /**
     * Get the induced dipole moments of all particles.
     * 
     * @param context    the Context for which to get the induced dipoles
     * @param dipoles    the induced dipole moment of particle i is stored into the i'th element
     */
    void getInducedDipoles(ContextImpl& context, std::vector<Vec3>& dipoles);
376
    /** 
377
     * Calculate the electrostatic potential given vector of grid coordinates.
378
     *
379
380
     * @param context                      context
     * @param inputGrid                    input grid coordinates
381
382
383
384
     * @param outputElectrostaticPotential output potential 
     */
    void getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid,
                                   std::vector< double >& outputElectrostaticPotential );
385
386

    /**
387
     * Get the system multipole moments.
388
     *
389
     * @param context                context 
390
     * @param outputMultipoleMoments vector of multipole moments:
391
                                     (charge,
392
393
394
395
396
                                      dipole_x, dipole_y, dipole_z,
                                      quadrupole_xx, quadrupole_xy, quadrupole_xz,
                                      quadrupole_yx, quadrupole_yy, quadrupole_yz,
                                      quadrupole_zx, quadrupole_zy, quadrupole_zz )
     */
Lee-Ping Wang's avatar
Lee-Ping Wang committed
397
    void getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments);
398
399
400
401
402
403
404
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaMultipoleForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaMultipoleForce& force);
405

406
private:
407

408
    int numMultipoles;
409
    AmoebaMultipoleForce::NonbondedMethod nonbondedMethod;
410
    AmoebaMultipoleForce::PolarizationType polarizationType;
411
412
413
414
415
416
417
    std::vector<RealOpenMM> charges;
    std::vector<RealOpenMM> dipoles;
    std::vector<RealOpenMM> quadrupoles;
    std::vector<RealOpenMM> tholes;
    std::vector<RealOpenMM> dampingFactors;
    std::vector<RealOpenMM> polarity;
    std::vector<int>   axisTypes;
418
419
420
    std::vector<int>   multipoleAtomZs;
    std::vector<int>   multipoleAtomXs;
    std::vector<int>   multipoleAtomYs;
421
422
423
424
425
    std::vector< std::vector< std::vector<int> > > multipoleAtomCovalentInfo;

    int mutualInducedMaxIterations;
    RealOpenMM mutualInducedTargetEpsilon;

426
427
428
429
430
    bool usePme;
    RealOpenMM alphaEwald;
    RealOpenMM cutoffDistance;
    std::vector<int> pmeGridDimension;

431
    const System& system;
432
433
};

Mark Friedrichs's avatar
Mark Friedrichs committed
434
435
436
437
438
/**
 * This kernel is invoked to calculate the vdw forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaVdwForceKernel : public CalcAmoebaVdwForceKernel {
public:
439
    ReferenceCalcAmoebaVdwForceKernel(std::string name, const Platform& platform, const System& system);
Mark Friedrichs's avatar
Mark Friedrichs committed
440
441
442
443
444
    ~ReferenceCalcAmoebaVdwForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
445
     * @param force      the AmoebaVdwForce this kernel will be used for
Mark Friedrichs's avatar
Mark Friedrichs committed
446
447
448
449
450
451
452
453
454
455
456
     */
    void initialize(const System& system, const AmoebaVdwForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
457
458
459
460
461
462
463
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaVdwForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaVdwForce& force);
Mark Friedrichs's avatar
Mark Friedrichs committed
464
465
private:
    int numParticles;
466
    int useCutoff;
467
468
    int usePBC;
    double cutoff;
469
    double dispersionCoefficient;
Mark Friedrichs's avatar
Mark Friedrichs committed
470
    std::vector<int> indexIVs;
471
    std::vector< std::set<int> > allExclusions;
Mark Friedrichs's avatar
Mark Friedrichs committed
472
473
474
475
476
    std::vector<RealOpenMM> sigmas;
    std::vector<RealOpenMM> epsilons;
    std::vector<RealOpenMM> reductions;
    std::string sigmaCombiningRule;
    std::string epsilonCombiningRule;
477
    const System& system;
478
    NeighborList* neighborList;
Mark Friedrichs's avatar
Mark Friedrichs committed
479
480
};

Mark Friedrichs's avatar
Mark Friedrichs committed
481
482
483
484
485
/**
 * This kernel is invoked to calculate the WCA dispersion forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaWcaDispersionForceKernel : public CalcAmoebaWcaDispersionForceKernel {
public:
486
    ReferenceCalcAmoebaWcaDispersionForceKernel(std::string name, const Platform& platform, const System& system);
Mark Friedrichs's avatar
Mark Friedrichs committed
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
    ~ReferenceCalcAmoebaWcaDispersionForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaMultipoleForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaWcaDispersionForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
504
505
506
507
508
509
510
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaWcaDispersionForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaWcaDispersionForce& force);
Mark Friedrichs's avatar
Mark Friedrichs committed
511
512
513
514
515
516
517
518
519
520
521
522
523
524
private:

    int numParticles;
    std::vector<RealOpenMM> radii;
    std::vector<RealOpenMM> epsilons;
    RealOpenMM epso; 
    RealOpenMM epsh; 
    RealOpenMM rmino; 
    RealOpenMM rminh; 
    RealOpenMM awater; 
    RealOpenMM shctd; 
    RealOpenMM dispoff;
    RealOpenMM slevy;
    RealOpenMM totalMaximumDispersionEnergy;
525
    const System& system;
Mark Friedrichs's avatar
Mark Friedrichs committed
526
};
527

528
529
530
531
532
/**
 * This kernel is invoked to calculate the Gerneralized Kirkwood forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel : public CalcAmoebaGeneralizedKirkwoodForceKernel {
public:
533
    ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel(std::string name, const Platform& platform, const System& system);
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
    ~ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
     * @param force      the AmoebaMultipoleForce this kernel will be used for
     */
    void initialize(const System& system, const AmoebaGeneralizedKirkwoodForce& force);
    /**
     * Execute the kernel to calculate the forces and/or energy.
     *
     * @param context        the context in which to execute this kernel
     * @param includeForces  true if forces should be calculated
     * @param includeEnergy  true if the energy should be calculated
     * @return the potential energy due to the force
     */
    double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
 
    /**
553
     *  Get the 'include cavity term' flag.
554
555
556
557
558
559
     *
     *  @return includeCavityTerm
     */
    int getIncludeCavityTerm( void ) const;

    /**
560
     *  Get the number of particles.
561
562
563
564
565
566
     *
     *  @return number of particles
     */
    int getNumParticles( void ) const;

    /**
567
     *  Get Direct Polarization flag.
568
569
570
571
572
573
574
     *
     *  @return directPolarization
     *
     */
    int getDirectPolarization( void ) const;

    /**
575
     *  Get the solute dielectric.
576
577
578
579
580
581
582
     *
     *  @return soluteDielectric
     *
     */
    RealOpenMM getSoluteDielectric( void ) const;

    /**
583
     *  Get the solvent dielectric.
584
585
586
587
588
589
590
     *
     *  @return solventDielectric
     *
     */
    RealOpenMM getSolventDielectric( void ) const;

    /**
591
     *  Get the dielectric offset.
592
593
594
595
596
597
598
     *
     *  @return dielectricOffset
     *
     */
    RealOpenMM getDielectricOffset( void ) const;

    /**
599
     *  Get the probe radius.
600
601
602
603
604
605
606
     *
     *  @return probeRadius
     *
     */
    RealOpenMM getProbeRadius( void ) const;

    /**
607
     *  Get the surface area factor.
608
609
610
611
612
613
614
     *
     *  @return surfaceAreaFactor
     *
     */
    RealOpenMM getSurfaceAreaFactor( void ) const;

    /**
615
     *  Get the vector of particle radii.
616
617
618
619
620
621
622
     *
     *  @param atomicRadii vector of atomic radii
     *
     */
    void getAtomicRadii( std::vector<RealOpenMM>& atomicRadii ) const;

    /**
623
     *  Get the vector of scale factors.
624
625
626
627
628
629
630
     *
     *  @param scaleFactors vector of scale factors
     *
     */
    void getScaleFactors( std::vector<RealOpenMM>& scaleFactors ) const;

    /**
631
     *  Get the vector of charges.
632
633
634
635
636
637
     *
     *  @param charges vector of charges
     *
     */
    void getCharges( std::vector<RealOpenMM>& charges ) const;

638
639
640
641
642
643
644
645
    /**
     * Copy changed parameters over to a context.
     *
     * @param context    the context to copy parameters to
     * @param force      the AmoebaGeneralizedKirkwoodForce to copy the parameters from
     */
    void copyParametersToContext(ContextImpl& context, const AmoebaGeneralizedKirkwoodForce& force);

646
647
648
649
650
651
652
653
654
655
656
657
658
private:

    int numParticles;
    std::vector<RealOpenMM> atomicRadii;
    std::vector<RealOpenMM> scaleFactors;
    std::vector<RealOpenMM> charges;
    RealOpenMM soluteDielectric;
    RealOpenMM solventDielectric;
    RealOpenMM dielectricOffset;
    RealOpenMM probeRadius;
    RealOpenMM surfaceAreaFactor;
    int includeCavityTerm;
    int directPolarization;
659
    const System& system;
660
661
};

662
663
664
} // namespace OpenMM

#endif /*AMOEBA_OPENMM_REFERENCE_KERNELS_H*/