OpenMM_Module.f90 28.9 KB
Newer Older
Michael Sherman's avatar
Michael Sherman committed
1
! -----------------------------------------------------------------------------
2
!             OpenMM(tm) PROTOTYPE Fortran 95 Interface (June 2009)
Michael Sherman's avatar
Michael Sherman committed
3
4
5
6
7
8
9
10
11
12
13
14
15
! -----------------------------------------------------------------------------
! This is a Fortran 95 interface module providing access to the OpenMM API
! which is written in C++. At link time this module requires that the OpenMM
! C wrapper library (or object file) is available since that provides a
! simplified Fortran-style set of access methods that can be described
! adequately here without using any Fortran 2003 features.
!
! This is experimental and is not part of the OpenMM release. Improvements in
! substance and style would be greatly appreciated. If you have ideas (or 
! better code) please post to the OpenMM forum on simtk.org/home/openmm or
! if you're shy you can email Michael Sherman at msherman@stanford.edu.
! 
! Below we define two modules
16
17
!    OpenMM_Types
!    OpenMM
Michael Sherman's avatar
Michael Sherman committed
18
19
20
! Only "use OpenMM" need be included in Fortran program units since 
! that modules includes the other one.
! -----------------------------------------------------------------------------
21

Michael Sherman's avatar
Michael Sherman committed
22
23
24
25
26
27
! We use defined types containing opaque pointers as a way of getting
! a modicum of type safety without having to expose any of the OpenMM
! data structures here. You never have to do anything with those 
! pointers to deal with these objects; they get created by the API
! for you and you just pass them back to the API when you want to
! do something with them.
28
29
module OpenMM_Types
    implicit none
30
31
32

    ! The System, Integrator, and Context must persist between calls.
    ! They can be conveniently grouped in a RuntimeObjects structure.
33
34
35
    type OpenMM_System
        character, pointer :: handle => NULL()
    end type
36
37
38
39
40
    ! This is the generic Integrator type; it represents one of 
    ! the concrete integrators like Verlet or Langevin.
    type OpenMM_Integrator
        character, pointer :: handle => NULL()
    end type
41
42
43
    type OpenMM_Context
        character, pointer :: handle => NULL()
    end type
44
45
46
47
48
49
50
51

    ! This data structure can be used to hold the set of OpenMM objects
    ! that must persist from call to call while running a simulation.
    ! It contains an OpenMM_System, _Integrator, and _Context.
    type OpenMM_RuntimeObjects
        character, pointer :: handle => NULL()
    end type

52
53
54
55
56
57
    type OpenMM_State
        character, pointer :: handle => NULL()
    end type
    type OpenMM_Vec3Array
        character, pointer :: handle => NULL()
    end type
58
59
60
    type OpenMM_BondArray
        character, pointer :: handle => NULL()
    end type
61
62
63
    type OpenMM_String
        character, pointer :: handle => NULL()
    end type
64
    ! This is the generic Force type.
65
66
67
68
69
70
    type OpenMM_Force
        character, pointer :: handle => NULL()
    end type
    type OpenMM_NonbondedForce
        character, pointer :: handle => NULL()
    end type
Michael Sherman's avatar
Michael Sherman committed
71
72
73
    type OpenMM_GBSAOBCForce
        character, pointer :: handle => NULL()
    end type
74
75
76
77
78
79
80
81
82
    type OpenMM_HarmonicBondForce
        character, pointer :: handle => NULL()
    end type
    type OpenMM_HarmonicAngleForce
        character, pointer :: handle => NULL()
    end type
    type OpenMM_PeriodicTorsionForce
        character, pointer :: handle => NULL()
    end type
83
84
85
86
87
88
89
90
    type OpenMM_VerletIntegrator
        character, pointer :: handle => NULL()
    end type
    type OpenMM_LangevinIntegrator
        character, pointer :: handle => NULL()
    end type

    ! OpenMM::State enumerations
Michael Sherman's avatar
Michael Sherman committed
91
92
93
    integer*4 OpenMM_State_Positions, OpenMM_State_Velocities
    integer*4 OpenMM_State_Forces, OpenMM_State_Energy
    integer*4 OpenMM_State_Parameters
94
95
96
97
98
    parameter(OpenMM_State_Positions=1, OpenMM_State_Velocities=2)
    parameter(OpenMM_State_Forces=4, OpenMM_State_Energy=8)
    parameter(OpenMM_State_Parameters=16)

    !OpenMM::NonbondedForce enumerations
Michael Sherman's avatar
Michael Sherman committed
99
100
    integer*4 OpenMM_NonbondedForce_NoCutoff, OpenMM_NonbondedForce_CutoffNonPeriodic
    integer*4 OpenMM_NonbondedForce_CutoffPeriodic, OpenMM_NonbondedForce_Ewald
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    parameter(OpenMM_NonbondedForce_NoCutoff=0, OpenMM_NonbondedForce_CutoffNonPeriodic=1)
    parameter(OpenMM_NonbondedForce_CutoffPeriodic=2, OpenMM_NonbondedForce_Ewald=3)

    !OpenMM units conversion constants
    real*8 OpenMM_NmPerAngstrom, OpenMM_AngstromsPerNm, OpenMM_PsPerFs, OpenMM_FsPerPs
    real*8 OpenMM_KJPerKcal, OpenMM_KcalPerKJ, OpenMM_RadiansPerDegree, OpenMM_DegreesPerRadian
    real*8 OpenMM_SigmaPerVdwRadius
    parameter(OpenMM_NmPerAngstrom=0.1, OpenMM_AngstromsPerNm=10.0)
    parameter(OpenMM_PsPerFs=0.001, OpenMM_FsPerPs=1000.0)
    parameter(OpenMM_KJPerKcal=4.184, OpenMM_KcalPerKJ=1.0/4.184)
    parameter(OpenMM_RadiansPerDegree=3.1415926535897932385/180.0)
    parameter(OpenMM_DegreesPerRadian=180.0/3.1415926535897932385)
    parameter(OpenMM_SigmaPerVdwRadius=1.78179743628068)

end module OpenMM_Types

module OpenMM
118
    use OpenMM_Types; implicit none
119
    interface
120
121
122
        ! -------------------------
        ! OpenMM::Vec3Array
        ! -------------------------
123
124
125
        ! OpenMM_Vec3Array is an interface to the std::vector<Vec3>
        ! arrays used in various contexts by OpenMM. It is not the
        ! same as a Fortran array of Vec3s would be.
126
127
        ! You can create this with zero elements and then 
        ! append to it and it will grow as needed.
128
        subroutine OpenMM_Vec3Array_create(array, n)
129
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
130
131
            type (OpenMM_Vec3Array) array
            integer*4 n
132
133
        end
        function OpenMM_Vec3Array_size(array)
134
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
135
136
            integer*4 OpenMM_Vec3Array_size
            type (OpenMM_Vec3Array) array
137
138
        end
        subroutine OpenMM_Vec3Array_resize(array, n)
139
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
140
141
            type (OpenMM_Vec3Array) array
            integer*4 n
142
143
        end
        subroutine OpenMM_Vec3Array_destroy(array)
144
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
145
            type (OpenMM_Vec3Array) array
146
147
        end
        subroutine OpenMM_Vec3Array_append(array, v3)
148
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
149
150
            type (OpenMM_Vec3Array) array
            real*8 v3(3)
151
152
        end
        subroutine OpenMM_Vec3Array_get(array, i, v3)
153
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
154
155
            type (OpenMM_Vec3Array) array
            integer*4 i
156
157
158
            real*8, intent(out) :: v3(3)
        end
        subroutine OpenMM_Vec3Array_getScaled(array, i, s, v3)
159
            use OpenMM_Types; implicit none
160
161
162
163
164
165
            type (OpenMM_Vec3Array) array
            integer*4 i
            real*8    s
            real*8, intent(out) :: v3(3)
        end
        subroutine OpenMM_Vec3Array_set(array, i, v3)
166
            use OpenMM_Types; implicit none
167
168
169
170
171
            type (OpenMM_Vec3Array) array
            integer*4 i
            real*8, intent(in) :: v3(3)
        end
        subroutine OpenMM_Vec3Array_setScaled(array, i, v3, s)
172
            use OpenMM_Types; implicit none
173
174
175
176
177
178
179
180
181
            type (OpenMM_Vec3Array) array
            integer*4 i
            real*8, intent(in) :: v3(3)
            real*8    s
        end
        subroutine OpenMM_Vec3_scale(v3in, s, v3out)
            real*8, intent(in)  :: v3in(3)
            real*8  s
            real*8, intent(out) :: v3out(3)
182
183
        end

184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
        ! -------------------------
        ! OpenMM::BondArray
        ! -------------------------
        ! OpenMM_BondArray is an interface to the
        ! std::vector<std::pair<int,int>> arrays used for
        ! bond lists by OpenMM. It is not the
        ! same as a Fortran array of integer(2)'s would be.
        ! You can create this with zero elements and then 
        ! append to it and it will grow as needed.
        subroutine OpenMM_BondArray_create(array, n)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
            integer*4 n
        end
        function OpenMM_BondArray_size(array)
            use OpenMM_Types; implicit none
            integer*4 OpenMM_BondArray_size
            type (OpenMM_BondArray) array
        end
        subroutine OpenMM_BondArray_resize(array, n)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
            integer*4 n
        end
        subroutine OpenMM_BondArray_destroy(array)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
        end
        subroutine OpenMM_BondArray_append(array, p1, p2)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
            integer*4 p1, p2
        end
        subroutine OpenMM_BondArray_get(array, i, p1, p2)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
            integer*4 i
            integer*4 p1, p2
        end
        subroutine OpenMM_BondArray_set(array, i, p1, p2)
            use OpenMM_Types; implicit none
            type (OpenMM_BondArray) array
            integer*4 i
            integer*4 p1, p2
        end

        ! -------------------------
        ! OpenMM::String
        ! -------------------------
233
234
235
236
        ! OpenMM_String is an interface to std::string, with some
        ! crude ability to copy from and out to fixed-size Fortran
        ! character arrays (with blank padding).
        subroutine OpenMM_String_create(string, initVal)
237
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
238
239
            type (OpenMM_String) string
            character(*) initVal
240
241
        end
        subroutine OpenMM_String_destroy(string)
242
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
243
            type (OpenMM_String) string
244
245
        end
        function OpenMM_String_length(string)
246
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
247
248
            integer*4 OpenMM_String_length
            type (OpenMM_String) string
249
250
        end
        subroutine OpenMM_String_get(string, fstring)
251
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
252
253
            type (OpenMM_String) string
            character(*) fstring
254
255
        end
        subroutine OpenMM_String_set(string, fstring)
256
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
257
258
            type (OpenMM_String) string
            character(*) fstring
259
260
261
        end
        

262
        ! -------------------------
263
        ! OpenMM::Platform
264
        ! -------------------------
265
        subroutine OpenMM_Platform_loadPluginsFromDirectory(dirName)
266
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
267
            type (OpenMM_String) dirName
268
269
        end
        subroutine OpenMM_Platform_getDefaultPluginsDirectory(dirName)
270
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
271
            type (OpenMM_String) dirName
272
273
        end

274
        ! -------------------------
275
        ! OpenMM::System
276
        ! -------------------------
277
        subroutine OpenMM_System_create(system)
278
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
279
            type (OpenMM_System) system
280
281
        end
        subroutine OpenMM_System_destroy(system)
282
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
283
            type (OpenMM_System) system
284
285
        end
        subroutine OpenMM_System_addForce(system, force)
286
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
287
288
            type (OpenMM_System) system
            type (OpenMM_Force) force
289
290
        end
        subroutine OpenMM_System_addParticle(system, mass)
291
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
292
293
            type (OpenMM_System) system
            real*8 mass
294
295
        end
  
296
        ! -------------------------
297
        ! OpenMM::NonbondedForce
298
        ! -------------------------
299
        subroutine OpenMM_NonbondedForce_create(nonbond)
300
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
301
            type (OpenMM_NonbondedForce) nonbond
302
303
        end
        subroutine OpenMM_NonbondedForce_destroy(nonbond)
304
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
305
            type (OpenMM_NonbondedForce) nonbond
306
307
        end
        subroutine OpenMM_NonbondedForce_asForce(nonbond, force)
308
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
309
310
            type (OpenMM_NonbondedForce) nonbond
            type (OpenMM_Force)          force
311
312
        end
        subroutine OpenMM_NonbondedForce_setNonbondedMethod(nonbond, method)
313
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
314
315
            type (OpenMM_NonbondedForce) nonbond
            integer*4 method
316
        end
317
318
319
320
321
        function OpenMM_NonbondedForce_getNonbondedMethod(nonbond)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 OpenMM_NonbondedForce_getNonbondedMethod
        end
322
        subroutine OpenMM_NonbondedForce_setCutoffDistance(nonbond, distanceInNm)
323
324
325
326
327
328
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            real*8, intent(in) :: distanceInNm
        end
        function OpenMM_NonbondedForce_getCutoffDistance(nonbond)
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
329
            type (OpenMM_NonbondedForce) nonbond
330
            real*8 OpenMM_NonbondedForce_getCutoffDistance
331
332
        end
        subroutine OpenMM_NonbondedForce_setPeriodicBoxVectors(nonbond, a, b, c)
333
334
335
336
337
338
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            real*8 a(3), b(3), c(3)
        end
        subroutine OpenMM_NonbondedForce_getPeriodicBoxVectors(nonbond, a, b, c)
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
339
340
            type (OpenMM_NonbondedForce) nonbond
            real*8 a(3), b(3), c(3)
341
        end
342
        function OpenMM_NonbondedForce_addParticle &
Michael Sherman's avatar
Michael Sherman committed
343
                            (nonbond, charge, sigmaInNm, vdwEnergyInKJ)
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 OpenMM_NonbondedForce_addParticle
            real*8 charge, sigmaInNm, vdwEnergyInKJ
        end
        subroutine OpenMM_NonbondedForce_setParticleParameters &
                            (nonbond, ix, charge, sigmaInNm, vdwEnergyInKJ)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 ix
            real*8 charge, sigmaInNm, vdwEnergyInKJ
        end
        subroutine OpenMM_NonbondedForce_getParticleParameters &
                            (nonbond, ix, charge, sigmaInNm, vdwEnergyInKJ)
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
359
            type (OpenMM_NonbondedForce) nonbond
360
            integer*4 ix
Michael Sherman's avatar
Michael Sherman committed
361
362
            real*8 charge, sigmaInNm, vdwEnergyInKJ
        end
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
        function OpenMM_NonbondedForce_getNumParticles(nonbond)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 OpenMM_NonbondedForce_getNumParticles
        end
        function OpenMM_NonbondedForce_getNumExceptions(nonbond)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 OpenMM_NonbondedForce_getNumExceptions
        end
        function OpenMM_NonbondedForce_addException &
                            (nonbond, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 OpenMM_NonbondedForce_addException
            integer*4 p1, p2
            real*8 chargeProd, sigmaInNm, vdwEnergyInKJ
        end
        subroutine OpenMM_NonbondedForce_setExceptionParameters &
                            (nonbond, ix, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 ix, p1, p2
            real*8 chargeProd, sigmaInNm, vdwEnergyInKJ
        end
        subroutine OpenMM_NonbondedForce_getExceptionParameters &
                            (nonbond, ix, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            integer*4 ix, p1, p2
            real*8 chargeProd, sigmaInNm, vdwEnergyInKJ
        end
        subroutine OpenMM_NonbondedForce_createExceptionsFromBonds &
                            (nonbond, bonds, coulomb14Scale, lj14Scale)
            use OpenMM_Types; implicit none
            type (OpenMM_NonbondedForce) nonbond
            type (OpenMM_BondArray) bonds
            real*8 coulomb14Scale, lj14Scale
        end
Michael Sherman's avatar
Michael Sherman committed
402

403
        ! -------------------------
Michael Sherman's avatar
Michael Sherman committed
404
        ! OpenMM::GBSAOBCForce
405
        ! -------------------------
Michael Sherman's avatar
Michael Sherman committed
406
        subroutine OpenMM_GBSAOBCForce_create(gbsa)
407
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
408
409
410
            type (OpenMM_GBSAOBCForce) gbsa
        end
        subroutine OpenMM_GBSAOBCForce_destroy(gbsa)
411
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
412
413
414
            type (OpenMM_GBSAOBCForce) gbsa
        end
        subroutine OpenMM_GBSAOBCForce_asForce(gbsa, force)
415
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
416
            type (OpenMM_GBSAOBCForce) gbsa
417
            type (OpenMM_Force)        force
Michael Sherman's avatar
Michael Sherman committed
418
419
        end
        subroutine OpenMM_GBSAOBCForce_setSolventDielectric(gbsa, d)
420
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
421
422
423
424
            type (OpenMM_GBSAOBCForce) gbsa
            real*8 d
        end
        subroutine OpenMM_GBSAOBCForce_setSoluteDielectric(gbsa, d)
425
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
426
427
428
429
430
            type (OpenMM_GBSAOBCForce) gbsa
            real*8 d
        end
        subroutine OpenMM_GBSAOBCForce_addParticle &
                            (gbsa, charge, radiusInNm, scalingFactor)
431
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
432
433
            type (OpenMM_GBSAOBCForce) gbsa
            real*8 charge, radiusInNm, scalingFactor
434
435
        end

436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
        ! -------------------------
        ! OpenMM::HarmonicBondForce
        ! -------------------------
        subroutine OpenMM_HarmonicBondForce_create(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
        end
        subroutine OpenMM_HarmonicBondForce_destroy(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
        end
        subroutine OpenMM_HarmonicBondForce_asForce(hbf, force)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
            type (OpenMM_Force)             force
        end
        function OpenMM_HarmonicBondForce_getNumBonds(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
            integer*4 OpenMM_HarmonicBondForce_getNumBonds
        end
        function OpenMM_HarmonicBondForce_addBond(hbf, p1, p2, length, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
            integer*4 OpenMM_HarmonicBondForce_addBond
            integer*4 p1, p2
            real*8 length,k
        end
        subroutine OpenMM_HarmonicBondForce_setBondParameters(hbf, ix, p1, p2, length, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
            integer*4 ix, p1, p2
            real*8 length,k
        end
        subroutine OpenMM_HarmonicBondForce_getBondParameters(hbf, ix, p1, p2, length, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicBondForce) hbf
            integer*4 ix, p1, p2
            real*8 length,k
        end

        ! --------------------------
        ! OpenMM::HarmonicAngleForce
        ! --------------------------
        subroutine OpenMM_HarmonicAngleForce_create(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
        end
        subroutine OpenMM_HarmonicAngleForce_destroy(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
        end
        subroutine OpenMM_HarmonicAngleForce_asForce(hbf, force)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
            type (OpenMM_Force)             force
        end
        function OpenMM_HarmonicAngleForce_getNumAngles(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
            integer*4 OpenMM_HarmonicAngleForce_getNumAngles
        end
        function OpenMM_HarmonicAngleForce_addAngle(hbf, p1, p2, p3, angle, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
            integer*4 OpenMM_HarmonicAngleForce_addAngle
            integer*4 p1, p2, p3
            real*8 angle,k
        end
        subroutine OpenMM_HarmonicAngleForce_setAngleParameters &
                (hbf, ix, p1, p2, p3, angle, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
            integer*4 ix, p1, p2, p3
            real*8 angle,k
        end
        subroutine OpenMM_HarmonicAngleForce_getAngleParameters &
                (hbf, ix, p1, p2, p3, angle, k)
            use OpenMM_Types; implicit none
            type (OpenMM_HarmonicAngleForce) hbf
            integer*4 ix, p1, p2, p3
            real*8 angle,k
        end

        ! ----------------------------
        ! OpenMM::PeriodicTorsionForce
        ! ----------------------------
        subroutine OpenMM_PeriodicTorsionForce_create(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
        end
        subroutine OpenMM_PeriodicTorsionForce_destroy(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
        end
        subroutine OpenMM_PeriodicTorsionForce_asForce(hbf, force)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
            type (OpenMM_Force)                force
        end
        function OpenMM_PeriodicTorsionForce_getNumTorsions(hbf)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
            integer*4 OpenMM_PeriodicTorsionForce_getNumTorsions
        end
        function OpenMM_PeriodicTorsionForce_addTorsion &
                (hbf, p1, p2, p3, p4, periodicity, phase, k)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
            integer*4 OpenMM_PeriodicTorsionForce_addTorsion
            integer*4 p1, p2, p3, p4, periodicity
            real*8 phase,k
        end
        subroutine OpenMM_PeriodicTorsionForce_setTorsionParameters &
                (hbf, ix, p1, p2, p3, p4, periodicity, phase, k)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
            integer*4 ix, p1, p2, p3, p4, periodicity
            real*8 phase,k
        end
        subroutine OpenMM_PeriodicTorsionForce_getTorsionParameters &
                (hbf, ix, p1, p2, p3, p4, periodicity, phase, k)
            use OpenMM_Types; implicit none
            type (OpenMM_PeriodicTorsionForce) hbf
            integer*4 ix, p1, p2, p3, p4, periodicity
            real*8 phase,k
        end

        ! -------------------------
565
        ! OpenMM::Integrator
566
        ! -------------------------
567
        subroutine OpenMM_Integrator_step(integrator, numSteps)
568
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
569
570
            type (OpenMM_Integrator) integrator
            integer*4 numSteps
571
572
        end
        subroutine OpenMM_Integrator_destroy(integrator)
573
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
574
            type (OpenMM_Integrator) integrator
575
576
        end

577
        ! -------------------------
578
        ! OpenMM::VerletIntegrator
579
        ! -------------------------
580
        subroutine OpenMM_VerletIntegrator_create(verlet, stepSzInPs)
581
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
582
583
            type (OpenMM_VerletIntegrator) verlet
            real*8 stepSzInPs
584
585
        end
        subroutine OpenMM_VerletIntegrator_destroy(verlet)
586
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
587
            type (OpenMM_VerletIntegrator) verlet
588
589
        end
        subroutine OpenMM_VerletIntegrator_asIntegrator(verlet, integ)
590
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
591
592
            type (OpenMM_VerletIntegrator) verlet
            type (OpenMM_Integrator)       integ
593
594
        end
        subroutine OpenMM_VerletIntegrator_step(verlet, numSteps)
595
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
596
597
598
599
            type (OpenMM_VerletIntegrator) verlet
            integer*4 numSteps
        end

600
        ! -------------------------
Michael Sherman's avatar
Michael Sherman committed
601
        ! OpenMM::LangevinIntegrator
602
        ! -------------------------
Michael Sherman's avatar
Michael Sherman committed
603
604
        subroutine OpenMM_LangevinIntegrator_create &
                            (langevin, temperature, frictionInPerPs, stepSzInPs)
605
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
606
607
608
609
            type (OpenMM_LangevinIntegrator) langevin
            real*8 temperature, frictionInPerPs, stepSzInPs
        end
        subroutine OpenMM_LangevinIntegrator_destroy(langevin)
610
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
611
612
613
            type (OpenMM_LangevinIntegrator) langevin
        end
        subroutine OpenMM_LangevinIntegrator_asIntegrator(langevin, integ)
614
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
615
616
617
618
            type (OpenMM_LangevinIntegrator) langevin
            type (OpenMM_Integrator)         integ
        end
        subroutine OpenMM_LangevinIntegrator_step(langevin, numSteps)
619
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
620
621
            type (OpenMM_LangevinIntegrator) langevin
            integer*4 numSteps
622
623
        end

624
        ! -------------------------
625
        ! OpenMM::Context
626
        ! -------------------------
627
        subroutine OpenMM_Context_create(context, system, integrator)
628
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
629
630
631
            type (OpenMM_Context) context
            type (OpenMM_System) system
            type (OpenMM_Integrator) integrator
632
633
        end
        subroutine OpenMM_Context_destroy(context)
634
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
635
            type (OpenMM_Context) context
636
637
        end
        subroutine OpenMM_Context_setPositions(context, positions)
638
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
639
640
            type (OpenMM_Context) context
            type (OpenMM_Vec3Array) positions
641
642
        end
        subroutine OpenMM_Context_setVelocities(context, velocities)
643
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
644
645
            type (OpenMM_Context) context
            type (OpenMM_Vec3Array) velocities
646
647
        end
        subroutine OpenMM_Context_createState(context, types, state)
648
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
649
650
651
            type (OpenMM_Context) context
            integer*4 types
            type (OpenMM_State) state
652
653
        end
        subroutine OpenMM_Context_getPlatformName(context, platformName)
654
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
655
656
            type (OpenMM_Context) context
            character(*) platformName
657
658
        end

659
        ! -------------------------
660
        ! OpenMM::State
661
        ! -------------------------
662
        subroutine OpenMM_State_destroy(state)
663
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
664
            type (OpenMM_State) state
665
666
        end
        function OpenMM_State_getTime(state)
667
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
668
669
            type (OpenMM_State) state
            real*8 OpenMM_State_getTime
670
671
        end
        function OpenMM_State_getPotentialEnergy(state)
672
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
673
674
            type (OpenMM_State) state
            real*8 OpenMM_State_getPotentialEnergy
675
676
        end
        function OpenMM_State_getKineticEnergy(state)
677
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
678
679
            type (OpenMM_State) state
            real*8 OpenMM_State_getKineticEnergy
680
681
        end
        subroutine OpenMM_State_getPositions(state, positions)
682
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
683
684
            type (OpenMM_State) state
            type (OpenMM_Vec3Array) positions
685
686
        end
        subroutine OpenMM_State_getVelocities(state, velocities)
687
            use OpenMM_Types; implicit none
Michael Sherman's avatar
Michael Sherman committed
688
689
            type (OpenMM_State) state
            type (OpenMM_Vec3Array) velocities
690
        end
691
        subroutine OpenMM_RuntimeObjects_create(omm)
692
            use OpenMM_Types; implicit none
693
694
695
            type (OpenMM_RuntimeObjects) omm
        end
        subroutine OpenMM_RuntimeObjects_clear(omm)
696
            use OpenMM_Types; implicit none
697
698
699
            type (OpenMM_RuntimeObjects) omm
        end
        subroutine OpenMM_RuntimeObjects_destroy(omm)
700
            use OpenMM_Types; implicit none
701
702
703
            type (OpenMM_RuntimeObjects) omm
        end
        subroutine OpenMM_RuntimeObjects_setSystem(omm,sys)
704
            use OpenMM_Types; implicit none
705
706
707
708
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_System) sys
        end
        subroutine OpenMM_RuntimeObjects_setIntegrator(omm,integ)
709
            use OpenMM_Types; implicit none
710
711
712
713
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_Integrator) integ
        end
        subroutine OpenMM_RuntimeObjects_setContext(omm,context)
714
            use OpenMM_Types; implicit none
715
716
717
718
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_Context) context
        end
        subroutine OpenMM_RuntimeObjects_getSystem(omm,sys)
719
            use OpenMM_Types; implicit none
720
721
722
723
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_System) sys
        end
        subroutine OpenMM_RuntimeObjects_getIntegrator(omm,integ)
724
            use OpenMM_Types; implicit none
725
726
727
728
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_Integrator) integ
        end
        subroutine OpenMM_RuntimeObjects_getContext(omm,context)
729
            use OpenMM_Types; implicit none
730
731
732
            type (OpenMM_RuntimeObjects) omm
            type (OpenMM_Context) context
        end
Michael Sherman's avatar
Michael Sherman committed
733

734
735
    end interface
end module OpenMM