AmoebaReferenceKernels.h 25.9 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
 * -------------------------------------------------------------------------- *
 * 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.               *
 *                                                                            *
12
 * Portions copyright (c) 2008-2015 Stanford University and the Authors.      *
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * 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
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;
251
252
    std::vector<RealOpenMM> k1Parameters;
    std::vector<RealOpenMM> k2Parameters;
253
    const System& system;
254
};
255
256
257
258
259
260

/**
 * 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:
261
    ReferenceCalcAmoebaOutOfPlaneBendForceKernel(std::string name, const Platform& platform, const System& system);
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
    ~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);
279
280
281
282
283
284
285
    /**
     * 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);
286
287
288
289
290
291
292
293
294
295
296
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;
297
    const System& system;
298
299
};

300
301
302
303
304
/**
 * 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:
305
    ReferenceCalcAmoebaTorsionTorsionForceKernel(std::string name, const Platform& platform, const System& system);
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
335
    ~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;

336
    const System& system;
337
338
};

339
340
341
342
343
/**
 * 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:
344
    ReferenceCalcAmoebaMultipoleForceKernel(std::string name, const Platform& platform, const System& system);
345
346
347
348
349
350
351
352
    ~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);
353
354
355
356
357
358
359
    /**
     * Setup for AmoebaReferenceMultipoleForce instance. 
     *
     * @param context        the current context
     *
     * @return pointer to initialized instance of AmoebaReferenceMultipoleForce
     */
360
    AmoebaReferenceMultipoleForce* setupAmoebaReferenceMultipoleForce(ContextImpl& context);
361
362
363
364
365
366
367
368
369
    /**
     * 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);
370
371
372
373
374
375
376
    /**
     * 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);
377
378
379
380
381
382
    /**
     * Get the fixed dipole moments of all particles in the global reference frame.
     * 
     * @param context    the Context for which to get the fixed dipoles
     * @param dipoles    the fixed dipole moment of particle i is stored into the i'th element
     */
383
//    void getLabFramePermanentDipoles(ContextImpl& context, std::vector<Vec3>& dipoles);
384
    /** 
385
     * Calculate the electrostatic potential given vector of grid coordinates.
386
     *
387
388
     * @param context                      context
     * @param inputGrid                    input grid coordinates
389
390
391
     * @param outputElectrostaticPotential output potential 
     */
    void getElectrostaticPotential(ContextImpl& context, const std::vector< Vec3 >& inputGrid,
392
                                   std::vector< double >& outputElectrostaticPotential);
393
394

    /**
395
     * Get the system multipole moments.
396
     *
397
     * @param context                context 
398
     * @param outputMultipoleMoments vector of multipole moments:
399
                                     (charge,
400
401
402
                                      dipole_x, dipole_y, dipole_z,
                                      quadrupole_xx, quadrupole_xy, quadrupole_xz,
                                      quadrupole_yx, quadrupole_yy, quadrupole_yz,
403
                                      quadrupole_zx, quadrupole_zy, quadrupole_zz)
404
     */
Lee-Ping Wang's avatar
Lee-Ping Wang committed
405
    void getSystemMultipoleMoments(ContextImpl& context, std::vector< double >& outputMultipoleMoments);
406
407
408
409
410
411
412
    /**
     * 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);
413
414
415
416
417
418
419
420
421
    /**
     * Get the parameters being used for PME.
     * 
     * @param alpha   the separation parameter
     * @param nx      the number of grid points along the X axis
     * @param ny      the number of grid points along the Y axis
     * @param nz      the number of grid points along the Z axis
     */
    void getPMEParameters(double& alpha, int& nx, int& ny, int& nz) const;
422

423
private:
424

425
    int numMultipoles;
426
    AmoebaMultipoleForce::NonbondedMethod nonbondedMethod;
427
    AmoebaMultipoleForce::PolarizationType polarizationType;
428
429
430
431
432
433
434
    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;
435
436
437
    std::vector<int>   multipoleAtomZs;
    std::vector<int>   multipoleAtomXs;
    std::vector<int>   multipoleAtomYs;
438
439
440
441
442
    std::vector< std::vector< std::vector<int> > > multipoleAtomCovalentInfo;

    int mutualInducedMaxIterations;
    RealOpenMM mutualInducedTargetEpsilon;

443
444
445
446
447
    bool usePme;
    RealOpenMM alphaEwald;
    RealOpenMM cutoffDistance;
    std::vector<int> pmeGridDimension;

448
    const System& system;
449
450
};

Mark Friedrichs's avatar
Mark Friedrichs committed
451
452
453
454
455
/**
 * This kernel is invoked to calculate the vdw forces acting on the system and the energy of the system.
 */
class ReferenceCalcAmoebaVdwForceKernel : public CalcAmoebaVdwForceKernel {
public:
456
    ReferenceCalcAmoebaVdwForceKernel(std::string name, const Platform& platform, const System& system);
Mark Friedrichs's avatar
Mark Friedrichs committed
457
458
459
460
461
    ~ReferenceCalcAmoebaVdwForceKernel();
    /**
     * Initialize the kernel.
     * 
     * @param system     the System this kernel will be applied to
462
     * @param force      the AmoebaVdwForce this kernel will be used for
Mark Friedrichs's avatar
Mark Friedrichs committed
463
464
465
466
467
468
469
470
471
472
473
     */
    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);
474
475
476
477
478
479
480
    /**
     * 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
481
482
private:
    int numParticles;
483
    int useCutoff;
484
485
    int usePBC;
    double cutoff;
486
    double dispersionCoefficient;
Mark Friedrichs's avatar
Mark Friedrichs committed
487
    std::vector<int> indexIVs;
488
    std::vector< std::set<int> > allExclusions;
Mark Friedrichs's avatar
Mark Friedrichs committed
489
490
491
492
493
    std::vector<RealOpenMM> sigmas;
    std::vector<RealOpenMM> epsilons;
    std::vector<RealOpenMM> reductions;
    std::string sigmaCombiningRule;
    std::string epsilonCombiningRule;
494
    const System& system;
495
    NeighborList* neighborList;
Mark Friedrichs's avatar
Mark Friedrichs committed
496
497
};

Mark Friedrichs's avatar
Mark Friedrichs committed
498
499
500
501
502
/**
 * 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:
503
    ReferenceCalcAmoebaWcaDispersionForceKernel(std::string name, const Platform& platform, const System& system);
Mark Friedrichs's avatar
Mark Friedrichs committed
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
    ~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);
521
522
523
524
525
526
527
    /**
     * 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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
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;
542
    const System& system;
Mark Friedrichs's avatar
Mark Friedrichs committed
543
};
544

545
546
547
548
549
/**
 * 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:
550
    ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel(std::string name, const Platform& platform, const System& system);
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
    ~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);
 
    /**
570
     *  Get the 'include cavity term' flag.
571
572
573
     *
     *  @return includeCavityTerm
     */
574
    int getIncludeCavityTerm() const;
575
576

    /**
577
     *  Get the number of particles.
578
579
580
     *
     *  @return number of particles
     */
581
    int getNumParticles() const;
582
583

    /**
584
     *  Get Direct Polarization flag.
585
586
587
588
     *
     *  @return directPolarization
     *
     */
589
    int getDirectPolarization() const;
590
591

    /**
592
     *  Get the solute dielectric.
593
594
595
596
     *
     *  @return soluteDielectric
     *
     */
597
    RealOpenMM getSoluteDielectric() const;
598
599

    /**
600
     *  Get the solvent dielectric.
601
602
603
604
     *
     *  @return solventDielectric
     *
     */
605
    RealOpenMM getSolventDielectric() const;
606
607

    /**
608
     *  Get the dielectric offset.
609
610
611
612
     *
     *  @return dielectricOffset
     *
     */
613
    RealOpenMM getDielectricOffset() const;
614
615

    /**
616
     *  Get the probe radius.
617
618
619
620
     *
     *  @return probeRadius
     *
     */
621
    RealOpenMM getProbeRadius() const;
622
623

    /**
624
     *  Get the surface area factor.
625
626
627
628
     *
     *  @return surfaceAreaFactor
     *
     */
629
    RealOpenMM getSurfaceAreaFactor() const;
630
631

    /**
632
     *  Get the vector of particle radii.
633
634
635
636
     *
     *  @param atomicRadii vector of atomic radii
     *
     */
637
    void getAtomicRadii(std::vector<RealOpenMM>& atomicRadii) const;
638
639

    /**
640
     *  Get the vector of scale factors.
641
642
643
644
     *
     *  @param scaleFactors vector of scale factors
     *
     */
645
    void getScaleFactors(std::vector<RealOpenMM>& scaleFactors) const;
646
647

    /**
648
     *  Get the vector of charges.
649
650
651
652
     *
     *  @param charges vector of charges
     *
     */
653
    void getCharges(std::vector<RealOpenMM>& charges) const;
654

655
656
657
658
659
660
661
662
    /**
     * 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);

663
664
665
666
667
668
669
670
671
672
673
674
675
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;
676
    const System& system;
677
678
};

679
680
681
} // namespace OpenMM

#endif /*AMOEBA_OPENMM_REFERENCE_KERNELS_H*/