1
2
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
28
29
30
31
32
33
34
35
36
37
38 package ffx.openmm.amoeba;
39
40 import com.sun.jna.Pointer;
41 import com.sun.jna.ptr.DoubleByReference;
42 import com.sun.jna.ptr.IntByReference;
43 import ffx.openmm.Context;
44 import ffx.openmm.Force;
45 import ffx.openmm.IntArray;
46
47 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_Lambda;
48 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_addParticle;
49 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_addParticleType;
50 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_addParticle_1;
51 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_addTypePair;
52 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_create;
53 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_destroy;
54 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getAlchemicalMethod;
55 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getCutoff;
56 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getCutoffDistance;
57 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getEpsilonCombiningRule;
58 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getNonbondedMethod;
59 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getNumParticleTypes;
60 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getNumParticles;
61 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getNumTypePairs;
62 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getParticleExclusions;
63 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getParticleParameters;
64 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getParticleTypeParameters;
65 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getPotentialFunction;
66 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getSigmaCombiningRule;
67 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getSoftcoreAlpha;
68 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getSoftcorePower;
69 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getTypePairParameters;
70 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getUseDispersionCorrection;
71 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_getUseParticleTypes;
72 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setAlchemicalMethod;
73 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setCutoff;
74 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setCutoffDistance;
75 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setEpsilonCombiningRule;
76 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setLambdaName;
77 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setNonbondedMethod;
78 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setParticleExclusions;
79 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setParticleParameters;
80 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setParticleTypeParameters;
81 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setPotentialFunction;
82 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setSigmaCombiningRule;
83 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setSoftcoreAlpha;
84 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setSoftcorePower;
85 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setTypePairParameters;
86 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_setUseDispersionCorrection;
87 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_updateParametersInContext;
88 import static edu.uiowa.jopenmm.OpenMMAmoebaLibrary.OpenMM_AmoebaVdwForce_usesPeriodicBoundaryConditions;
89 import static edu.uiowa.jopenmm.OpenMMLibrary.OpenMM_Boolean.OpenMM_True;
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130 public class VdwForce extends Force {
131
132
133
134
135 public VdwForce() {
136 super(OpenMM_AmoebaVdwForce_create());
137 }
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152 public int addParticle(int parentIndex, double sigma, double epsilon, double reductionFactor, int isAlchemical, double scaleFactor) {
153 return OpenMM_AmoebaVdwForce_addParticle(pointer, parentIndex, sigma, epsilon, reductionFactor, isAlchemical, scaleFactor);
154 }
155
156
157
158
159
160
161
162
163
164
165
166
167
168 public int addParticle(int parentIndex, int typeIndex, double reductionFactor, int isAlchemical, double scaleFactor) {
169 return OpenMM_AmoebaVdwForce_addParticle_1(pointer, parentIndex, typeIndex, reductionFactor, isAlchemical, scaleFactor);
170 }
171
172
173
174
175
176
177
178
179 public int addParticleType(double sigma, double epsilon) {
180 return OpenMM_AmoebaVdwForce_addParticleType(pointer, sigma, epsilon);
181 }
182
183
184
185
186
187
188
189
190
191
192
193 public int addTypePair(int type1, int type2, double sigma, double epsilon) {
194 return OpenMM_AmoebaVdwForce_addTypePair(pointer, type1, type2, sigma, epsilon);
195 }
196
197
198
199
200 @Override
201 public void destroy() {
202 if (pointer != null) {
203 OpenMM_AmoebaVdwForce_destroy(pointer);
204 pointer = null;
205 }
206 }
207
208
209
210
211
212
213 public int getAlchemicalMethod() {
214 return OpenMM_AmoebaVdwForce_getAlchemicalMethod(pointer);
215 }
216
217
218
219
220
221
222 @Deprecated
223 public double getCutoff() {
224 return OpenMM_AmoebaVdwForce_getCutoff(pointer);
225 }
226
227
228
229
230
231
232
233 public double getCutoffDistance() {
234 return OpenMM_AmoebaVdwForce_getCutoffDistance(pointer);
235 }
236
237
238
239
240
241
242 public String getEpsilonCombiningRule() {
243 Pointer rule = OpenMM_AmoebaVdwForce_getEpsilonCombiningRule(pointer);
244 if (rule == null) {
245 return null;
246 }
247 return rule.getString(0);
248 }
249
250
251
252
253
254
255 public Pointer getLambda() {
256 return OpenMM_AmoebaVdwForce_Lambda(pointer);
257 }
258
259
260
261
262
263
264 public int getNonbondedMethod() {
265 return OpenMM_AmoebaVdwForce_getNonbondedMethod(pointer);
266 }
267
268
269
270
271
272
273 public int getNumParticles() {
274 return OpenMM_AmoebaVdwForce_getNumParticles(pointer);
275 }
276
277
278
279
280
281
282 public int getNumParticleTypes() {
283 return OpenMM_AmoebaVdwForce_getNumParticleTypes(pointer);
284 }
285
286
287
288
289
290
291 public int getNumTypePairs() {
292 return OpenMM_AmoebaVdwForce_getNumTypePairs(pointer);
293 }
294
295
296
297
298
299
300
301 public IntArray getParticleExclusions(int i) {
302 IntArray exclusions = new IntArray(0);
303 if (pointer != null) {
304 OpenMM_AmoebaVdwForce_getParticleExclusions(pointer, i, exclusions.getPointer());
305 }
306 return exclusions;
307 }
308
309
310
311
312
313
314
315
316
317
318
319
320
321 public void getParticleParameters(int index, IntByReference ired, DoubleByReference rad,
322 DoubleByReference eps, DoubleByReference reductionFactor,
323 IntByReference isAlchemical, IntByReference type,
324 DoubleByReference scaleFactor) {
325 OpenMM_AmoebaVdwForce_getParticleParameters(pointer, index, ired, rad, eps, reductionFactor,
326 isAlchemical, type, scaleFactor);
327 }
328
329
330
331
332
333
334
335
336 public void getParticleTypeParameters(int index, DoubleByReference rad, DoubleByReference eps) {
337 OpenMM_AmoebaVdwForce_getParticleTypeParameters(pointer, index, rad, eps);
338 }
339
340
341
342
343
344
345 public int getPotentialFunction() {
346 return OpenMM_AmoebaVdwForce_getPotentialFunction(pointer);
347 }
348
349
350
351
352
353
354 public String getSigmaCombiningRule() {
355 Pointer rule = OpenMM_AmoebaVdwForce_getSigmaCombiningRule(pointer);
356 if (rule == null) {
357 return null;
358 }
359 return rule.getString(0);
360 }
361
362
363
364
365
366
367 public double getSoftcoreAlpha() {
368 return OpenMM_AmoebaVdwForce_getSoftcoreAlpha(pointer);
369 }
370
371
372
373
374
375
376 public int getSoftcorePower() {
377 return OpenMM_AmoebaVdwForce_getSoftcorePower(pointer);
378 }
379
380
381
382
383
384
385
386
387
388
389 public void getTypePairParameters(int index, IntByReference type1, IntByReference type2,
390 DoubleByReference rad, DoubleByReference eps) {
391 OpenMM_AmoebaVdwForce_getTypePairParameters(pointer, index, type1, type2, rad, eps);
392 }
393
394
395
396
397
398
399
400 public boolean getUseDispersionCorrection() {
401 return OpenMM_AmoebaVdwForce_getUseDispersionCorrection(pointer) != 0;
402 }
403
404
405
406
407
408
409 public int getUseParticleTypes() {
410 return OpenMM_AmoebaVdwForce_getUseParticleTypes(pointer);
411 }
412
413
414
415
416
417
418 public void setAlchemicalMethod(int method) {
419 OpenMM_AmoebaVdwForce_setAlchemicalMethod(pointer, method);
420 }
421
422
423
424
425
426
427 @Deprecated
428 public void setCutoff(double cutoff) {
429 OpenMM_AmoebaVdwForce_setCutoff(pointer, cutoff);
430 }
431
432
433
434
435
436
437
438 public void setCutoffDistance(double distance) {
439 OpenMM_AmoebaVdwForce_setCutoffDistance(pointer, distance);
440 }
441
442
443
444
445
446
447 public void setEpsilonCombiningRule(String rule) {
448 OpenMM_AmoebaVdwForce_setEpsilonCombiningRule(pointer, rule);
449 }
450
451
452
453
454
455
456 public void setLambdaName(String name) {
457 OpenMM_AmoebaVdwForce_setLambdaName(pointer, name);
458 }
459
460
461
462
463
464
465 public void setNonbondedMethod(int method) {
466 OpenMM_AmoebaVdwForce_setNonbondedMethod(pointer, method);
467 }
468
469
470
471
472
473
474
475 public void setParticleExclusions(int i, IntArray exclusions) {
476 OpenMM_AmoebaVdwForce_setParticleExclusions(pointer, i, exclusions.getPointer());
477 }
478
479
480
481
482
483
484
485
486
487
488
489
490
491 public void setParticleParameters(int index, int ired, double rad, double eps, double reductionFactor, int isAlchemical, int type, double scaleFactor) {
492 OpenMM_AmoebaVdwForce_setParticleParameters(pointer, index, ired, rad, eps, reductionFactor, isAlchemical, type, scaleFactor);
493 }
494
495
496
497
498
499
500
501
502 public void setParticleTypeParameters(int index, double rad, double eps) {
503 OpenMM_AmoebaVdwForce_setParticleTypeParameters(pointer, index, rad, eps);
504 }
505
506
507
508
509
510
511 public void setPotentialFunction(int function) {
512 OpenMM_AmoebaVdwForce_setPotentialFunction(pointer, function);
513 }
514
515
516
517
518
519
520 public void setSigmaCombiningRule(String rule) {
521 OpenMM_AmoebaVdwForce_setSigmaCombiningRule(pointer, rule);
522 }
523
524
525
526
527
528
529 public void setSoftcoreAlpha(double vdWSoftcoreAlpha) {
530 OpenMM_AmoebaVdwForce_setSoftcoreAlpha(pointer, vdWSoftcoreAlpha);
531 }
532
533
534
535
536
537
538 public void setSoftcorePower(int vdwSoftcorePower) {
539 OpenMM_AmoebaVdwForce_setSoftcorePower(pointer, vdwSoftcorePower);
540 }
541
542
543
544
545
546
547
548
549
550
551 public void setTypePairParameters(int index, int type1, int type2, double rad, double eps) {
552 OpenMM_AmoebaVdwForce_setTypePairParameters(pointer, index, type1, type2, rad, eps);
553 }
554
555
556
557
558
559
560
561 public void setUseDispersionCorrection(boolean useCorrection) {
562 OpenMM_AmoebaVdwForce_setUseDispersionCorrection(pointer, useCorrection ? 1 : 0);
563 }
564
565
566
567
568
569
570
571
572
573
574 public void updateParametersInContext(Context context) {
575 if (context.hasContextPointer()) {
576 OpenMM_AmoebaVdwForce_updateParametersInContext(pointer, context.getPointer());
577 }
578 }
579
580
581
582
583
584
585
586 @Override
587 public boolean usesPeriodicBoundaryConditions() {
588 int pbc = OpenMM_AmoebaVdwForce_usesPeriodicBoundaryConditions(pointer);
589 return pbc == OpenMM_True;
590 }
591 }