Commit 7616a965 authored by Michael Sherman's avatar Michael Sherman
Browse files

More wrappers.

parent 9acf1009
...@@ -649,15 +649,15 @@ void OPENMM_GBSAOBCFORCE_SETSOLUTEDIELECTRIC(OpenMM_GBSAOBCForce*& gbsa, const d ...@@ -649,15 +649,15 @@ void OPENMM_GBSAOBCFORCE_SETSOLUTEDIELECTRIC(OpenMM_GBSAOBCForce*& gbsa, const d
{ OpenMM_GBSAOBCForce_setSoluteDielectric(gbsa,d); } { OpenMM_GBSAOBCForce_setSoluteDielectric(gbsa,d); }
// addParticle // addParticle
void OpenMM_GBSAOBCForce_addParticle(OpenMM_GBSAOBCForce* gbsa, int OpenMM_GBSAOBCForce_addParticle(OpenMM_GBSAOBCForce* gbsa,
double charge, double radiusInNm, double scalingFactor) double charge, double radiusInNm, double scalingFactor)
{ ((GBSAOBCForce*)gbsa)->addParticle(charge, radiusInNm, scalingFactor); } { return ((GBSAOBCForce*)gbsa)->addParticle(charge, radiusInNm, scalingFactor); }
void openmm_gbsaobcforce_addparticle_(OpenMM_GBSAOBCForce*& gbsa, int openmm_gbsaobcforce_addparticle_(OpenMM_GBSAOBCForce*& gbsa,
const double& charge, const double& radiusInNm, const double& scalingFactor) const double& charge, const double& radiusInNm, const double& scalingFactor)
{ OpenMM_GBSAOBCForce_addParticle(gbsa,charge, radiusInNm, scalingFactor); } { return OpenMM_GBSAOBCForce_addParticle(gbsa,charge, radiusInNm, scalingFactor); }
void OPENMM_GBSAOBCFORCE_ADDPARTICLE(OpenMM_GBSAOBCForce*& gbsa, int OPENMM_GBSAOBCFORCE_ADDPARTICLE(OpenMM_GBSAOBCForce*& gbsa,
const double& charge, const double& radiusInNm, const double& scalingFactor) const double& charge, const double& radiusInNm, const double& scalingFactor)
{ OpenMM_GBSAOBCForce_addParticle(gbsa,charge, radiusInNm, scalingFactor); } { return OpenMM_GBSAOBCForce_addParticle(gbsa,charge, radiusInNm, scalingFactor); }
/////////////////////////////// ///////////////////////////////
// OpenMM::HarmonicBondForce // // OpenMM::HarmonicBondForce //
...@@ -827,6 +827,12 @@ void OPENMM_PERIODICTORSIONFORCE_GETTORSIONPARAMETERS(const OpenMM_PeriodicTorsi ...@@ -827,6 +827,12 @@ void OPENMM_PERIODICTORSIONFORCE_GETTORSIONPARAMETERS(const OpenMM_PeriodicTorsi
//////////////////////// ////////////////////////
// OpenMM::Integrator // // OpenMM::Integrator //
//////////////////////// ////////////////////////
// This is the generic Integrator class so there is no "create" method. Instead,
// you always create an object of a concrete class like VerletIntegrator and
// then cast it to the generic Integrator.
// step
void OpenMM_Integrator_step(OpenMM_Integrator* integ, int numSteps) void OpenMM_Integrator_step(OpenMM_Integrator* integ, int numSteps)
{ ((Integrator*)integ)->step(numSteps); } { ((Integrator*)integ)->step(numSteps); }
void openmm_integrator_step_(OpenMM_Integrator* const& integ, int& numSteps) void openmm_integrator_step_(OpenMM_Integrator* const& integ, int& numSteps)
...@@ -834,6 +840,7 @@ void openmm_integrator_step_(OpenMM_Integrator* const& integ, int& numSteps) ...@@ -834,6 +840,7 @@ void openmm_integrator_step_(OpenMM_Integrator* const& integ, int& numSteps)
void OPENMM_INTEGRATOR_STEP(OpenMM_Integrator* const& integ, int& numSteps) void OPENMM_INTEGRATOR_STEP(OpenMM_Integrator* const& integ, int& numSteps)
{ OpenMM_Integrator_step(integ, numSteps); } { OpenMM_Integrator_step(integ, numSteps); }
// destroy
void OpenMM_Integrator_destroy(OpenMM_Integrator* doomed) void OpenMM_Integrator_destroy(OpenMM_Integrator* doomed)
{ delete ((Integrator*)doomed); } { delete ((Integrator*)doomed); }
void openmm_integrator_destroy_(OpenMM_Integrator*& doomed) void openmm_integrator_destroy_(OpenMM_Integrator*& doomed)
...@@ -842,6 +849,8 @@ void OPENMM_INTEGRATOR_DESTROY(OpenMM_Integrator*& doomed) ...@@ -842,6 +849,8 @@ void OPENMM_INTEGRATOR_DESTROY(OpenMM_Integrator*& doomed)
{ OpenMM_Integrator_destroy(doomed); doomed = 0; } { OpenMM_Integrator_destroy(doomed); doomed = 0; }
// OpenMM::VerletIntegrator // OpenMM::VerletIntegrator
// create
OpenMM_VerletIntegrator* OpenMM_VerletIntegrator_create(double stepSzInPs) OpenMM_VerletIntegrator* OpenMM_VerletIntegrator_create(double stepSzInPs)
{ return (OpenMM_VerletIntegrator*)new VerletIntegrator(stepSzInPs); } { return (OpenMM_VerletIntegrator*)new VerletIntegrator(stepSzInPs); }
void openmm_verletintegrator_create_(OpenMM_VerletIntegrator*& verlet, double& stepSzInPs) void openmm_verletintegrator_create_(OpenMM_VerletIntegrator*& verlet, double& stepSzInPs)
...@@ -849,6 +858,7 @@ void openmm_verletintegrator_create_(OpenMM_VerletIntegrator*& verlet, double& s ...@@ -849,6 +858,7 @@ void openmm_verletintegrator_create_(OpenMM_VerletIntegrator*& verlet, double& s
void OPENMM_VERLETINTEGRATOR_CREATE(OpenMM_VerletIntegrator*& verlet, double& stepSzInPs) void OPENMM_VERLETINTEGRATOR_CREATE(OpenMM_VerletIntegrator*& verlet, double& stepSzInPs)
{ verlet = OpenMM_VerletIntegrator_create(stepSzInPs); } { verlet = OpenMM_VerletIntegrator_create(stepSzInPs); }
// destroy
void OpenMM_VerletIntegrator_destroy(OpenMM_VerletIntegrator* doomed) void OpenMM_VerletIntegrator_destroy(OpenMM_VerletIntegrator* doomed)
{ delete (VerletIntegrator*)doomed; } { delete (VerletIntegrator*)doomed; }
void openmm_verletintegrator_destroy_(OpenMM_VerletIntegrator*& doomed) void openmm_verletintegrator_destroy_(OpenMM_VerletIntegrator*& doomed)
...@@ -864,6 +874,7 @@ void OPENMM_VERLETINTEGRATOR_ASINTEGRATOR(OpenMM_VerletIntegrator* const& verlet ...@@ -864,6 +874,7 @@ void OPENMM_VERLETINTEGRATOR_ASINTEGRATOR(OpenMM_VerletIntegrator* const& verlet
OpenMM_Integrator*& integ) OpenMM_Integrator*& integ)
{ integ = (OpenMM_Integrator*)verlet; } { integ = (OpenMM_Integrator*)verlet; }
// step
void OpenMM_VerletIntegrator_step(OpenMM_VerletIntegrator* verlet, int numSteps) void OpenMM_VerletIntegrator_step(OpenMM_VerletIntegrator* verlet, int numSteps)
{ ((VerletIntegrator*)verlet)->step(numSteps); } { ((VerletIntegrator*)verlet)->step(numSteps); }
void openmm_verletintegrator_step_(OpenMM_VerletIntegrator* const& verlet, int& numSteps) void openmm_verletintegrator_step_(OpenMM_VerletIntegrator* const& verlet, int& numSteps)
...@@ -872,6 +883,8 @@ void OPENMM_VERLETINTEGRATOR_STEP(OpenMM_VerletIntegrator* const& verlet, int& n ...@@ -872,6 +883,8 @@ void OPENMM_VERLETINTEGRATOR_STEP(OpenMM_VerletIntegrator* const& verlet, int& n
{ OpenMM_VerletIntegrator_step(verlet, numSteps); } { OpenMM_VerletIntegrator_step(verlet, numSteps); }
// OpenMM::LangevinIntegrator // OpenMM::LangevinIntegrator
// create
OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPerPs, double stepSzInPs) OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPerPs, double stepSzInPs)
{ return (OpenMM_LangevinIntegrator*)new LangevinIntegrator(temperature, frictionInPerPs, stepSzInPs); } { return (OpenMM_LangevinIntegrator*)new LangevinIntegrator(temperature, frictionInPerPs, stepSzInPs); }
void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPerPs, double& stepSzInPs) void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPerPs, double& stepSzInPs)
...@@ -879,6 +892,7 @@ void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, dou ...@@ -879,6 +892,7 @@ void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, dou
void OPENMM_LANGEVININTEGRATOR_CREATE(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPerPs, double& stepSzInPs) void OPENMM_LANGEVININTEGRATOR_CREATE(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPerPs, double& stepSzInPs)
{ langevin = OpenMM_LangevinIntegrator_create(temperature, frictionInPerPs, stepSzInPs); } { langevin = OpenMM_LangevinIntegrator_create(temperature, frictionInPerPs, stepSzInPs); }
// destroy
void OpenMM_LangevinIntegrator_destroy(OpenMM_LangevinIntegrator* doomed) void OpenMM_LangevinIntegrator_destroy(OpenMM_LangevinIntegrator* doomed)
{ delete (LangevinIntegrator*)doomed; } { delete (LangevinIntegrator*)doomed; }
void openmm_langevinintegrator_destroy_(OpenMM_LangevinIntegrator*& doomed) void openmm_langevinintegrator_destroy_(OpenMM_LangevinIntegrator*& doomed)
...@@ -886,7 +900,7 @@ void openmm_langevinintegrator_destroy_(OpenMM_LangevinIntegrator*& doomed) ...@@ -886,7 +900,7 @@ void openmm_langevinintegrator_destroy_(OpenMM_LangevinIntegrator*& doomed)
void OPENMM_LANGEVININTEGRATOR_DESTROY(OpenMM_LangevinIntegrator*& doomed) void OPENMM_LANGEVININTEGRATOR_DESTROY(OpenMM_LangevinIntegrator*& doomed)
{ OpenMM_LangevinIntegrator_destroy(doomed); doomed = 0; } { OpenMM_LangevinIntegrator_destroy(doomed); doomed = 0; }
// Fortran only: recast LangevinIntegrator as an Integrator. // asIntegrator Fortran only: recast LangevinIntegrator as an Integrator.
void openmm_langevinintegrator_asintegrator_(OpenMM_LangevinIntegrator* const& langevin, void openmm_langevinintegrator_asintegrator_(OpenMM_LangevinIntegrator* const& langevin,
OpenMM_Integrator*& integ) OpenMM_Integrator*& integ)
{ integ = (OpenMM_Integrator*)langevin; } { integ = (OpenMM_Integrator*)langevin; }
...@@ -894,6 +908,7 @@ void OPENMM_LANGEVININTEGRATOR_ASINTEGRATOR(OpenMM_LangevinIntegrator* const& la ...@@ -894,6 +908,7 @@ void OPENMM_LANGEVININTEGRATOR_ASINTEGRATOR(OpenMM_LangevinIntegrator* const& la
OpenMM_Integrator*& integ) OpenMM_Integrator*& integ)
{ integ = (OpenMM_Integrator*)langevin; } { integ = (OpenMM_Integrator*)langevin; }
// step
void OpenMM_LangevinIntegrator_step(OpenMM_LangevinIntegrator* langevin, int numSteps) void OpenMM_LangevinIntegrator_step(OpenMM_LangevinIntegrator* langevin, int numSteps)
{ ((LangevinIntegrator*)langevin)->step(numSteps); } { ((LangevinIntegrator*)langevin)->step(numSteps); }
void openmm_langevinintegrator_step_(OpenMM_LangevinIntegrator* const& langevin, int& numSteps) void openmm_langevinintegrator_step_(OpenMM_LangevinIntegrator* const& langevin, int& numSteps)
...@@ -929,6 +944,7 @@ void openmm_context_setpositions_(OpenMM_Context* const& context, const OpenMM_V ...@@ -929,6 +944,7 @@ void openmm_context_setpositions_(OpenMM_Context* const& context, const OpenMM_V
void OPENMM_CONTEXT_SETPOSITIONS(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& positions) void OPENMM_CONTEXT_SETPOSITIONS(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& positions)
{ OpenMM_Context_setPositions(context, positions); } { OpenMM_Context_setPositions(context, positions); }
// setVelocities
void OpenMM_Context_setVelocities(OpenMM_Context* context, const OpenMM_Vec3Array* velocities) void OpenMM_Context_setVelocities(OpenMM_Context* context, const OpenMM_Vec3Array* velocities)
{ ((OpenMMContext*)context)->setVelocities(*(const std::vector<Vec3>*)velocities); } { ((OpenMMContext*)context)->setVelocities(*(const std::vector<Vec3>*)velocities); }
void openmm_context_setvelocities_(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& velocities) void openmm_context_setvelocities_(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& velocities)
...@@ -936,6 +952,7 @@ void openmm_context_setvelocities_(OpenMM_Context* const& context, const OpenMM_ ...@@ -936,6 +952,7 @@ void openmm_context_setvelocities_(OpenMM_Context* const& context, const OpenMM_
void OPENMM_CONTEXT_SETVELOCITIES(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& velocities) void OPENMM_CONTEXT_SETVELOCITIES(OpenMM_Context* const& context, const OpenMM_Vec3Array* const& velocities)
{ OpenMM_Context_setVelocities(context, velocities); } { OpenMM_Context_setVelocities(context, velocities); }
// createState
// Note that a Context creates the OpenMM::State object, but you have to destroy // Note that a Context creates the OpenMM::State object, but you have to destroy
// it using OpenMM_State_destroy. // it using OpenMM_State_destroy.
OpenMM_State* OpenMM_Context_createState(const OpenMM_Context* context, int types) OpenMM_State* OpenMM_Context_createState(const OpenMM_Context* context, int types)
...@@ -963,6 +980,7 @@ void openmm_context_getplatformname_(const OpenMM_Context* const& context, char* ...@@ -963,6 +980,7 @@ void openmm_context_getplatformname_(const OpenMM_Context* const& context, char*
void OPENMM_CONTEXT_GETPLATFORMNAME(const OpenMM_Context* const& context, char* buf, int len) void OPENMM_CONTEXT_GETPLATFORMNAME(const OpenMM_Context* const& context, char* buf, int len)
{ openmm_context_getplatformname_(context,buf,len); } { openmm_context_getplatformname_(context,buf,len); }
/////////////////// ///////////////////
// OpenMM::State // // OpenMM::State //
/////////////////// ///////////////////
...@@ -1017,6 +1035,8 @@ void openmm_state_getvelocities_(const OpenMM_State* const& state, const OpenMM_ ...@@ -1017,6 +1035,8 @@ void openmm_state_getvelocities_(const OpenMM_State* const& state, const OpenMM_
void OPENMM_STATE_GETVELOCITIES(const OpenMM_State* const& state, const OpenMM_Vec3Array*& velocities) void OPENMM_STATE_GETVELOCITIES(const OpenMM_State* const& state, const OpenMM_Vec3Array*& velocities)
{ velocities = OpenMM_State_getVelocities(state); } { velocities = OpenMM_State_getVelocities(state); }
/////////////////////////// ///////////////////////////
// OpenMM_RuntimeObjects // // OpenMM_RuntimeObjects //
/////////////////////////// ///////////////////////////
...@@ -1034,14 +1054,6 @@ void openmm_runtimeobjects_create_(OpenMM_RuntimeObjects*& ommrt) ...@@ -1034,14 +1054,6 @@ void openmm_runtimeobjects_create_(OpenMM_RuntimeObjects*& ommrt)
void OPENMM_RUNTIMEOBJECTS_CREATE(OpenMM_RuntimeObjects*& ommrt) void OPENMM_RUNTIMEOBJECTS_CREATE(OpenMM_RuntimeObjects*& ommrt)
{ ommrt = OpenMM_RuntimeObjects_create(); } { ommrt = OpenMM_RuntimeObjects_create(); }
// destroy
void OpenMM_RuntimeObjects_destroy(OpenMM_RuntimeObjects* ommrt)
{ OpenMM_RuntimeObjects_clear(ommrt); delete ommrt; }
void openmm_runtimeobjects_destroy_(OpenMM_RuntimeObjects*& ommrt)
{ OpenMM_RuntimeObjects_destroy(ommrt); ommrt = 0; }
void OPENMM_RUNTIMEOBJECTS_DESTROY(OpenMM_RuntimeObjects*& ommrt)
{ OpenMM_RuntimeObjects_destroy(ommrt); ommrt = 0; }
// clear // clear
void OpenMM_RuntimeObjects_clear(OpenMM_RuntimeObjects* ommrt) { void OpenMM_RuntimeObjects_clear(OpenMM_RuntimeObjects* ommrt) {
if (!ommrt) return; if (!ommrt) return;
...@@ -1054,6 +1066,13 @@ void openmm_runtimeobjects_clear_(OpenMM_RuntimeObjects* const& ommrt) ...@@ -1054,6 +1066,13 @@ void openmm_runtimeobjects_clear_(OpenMM_RuntimeObjects* const& ommrt)
void OPENMM_RUNTIMEOBJECTS_CLEAR(OpenMM_RuntimeObjects* const& ommrt) void OPENMM_RUNTIMEOBJECTS_CLEAR(OpenMM_RuntimeObjects* const& ommrt)
{ OpenMM_RuntimeObjects_clear(ommrt); } { OpenMM_RuntimeObjects_clear(ommrt); }
// destroy
void OpenMM_RuntimeObjects_destroy(OpenMM_RuntimeObjects* ommrt)
{ OpenMM_RuntimeObjects_clear(ommrt); delete ommrt; }
void openmm_runtimeobjects_destroy_(OpenMM_RuntimeObjects*& ommrt)
{ OpenMM_RuntimeObjects_destroy(ommrt); ommrt = 0; }
void OPENMM_RUNTIMEOBJECTS_DESTROY(OpenMM_RuntimeObjects*& ommrt)
{ OpenMM_RuntimeObjects_destroy(ommrt); ommrt = 0; }
// setSystem // setSystem
void OpenMM_RuntimeObjects_setSystem(OpenMM_RuntimeObjects* ommrt, OpenMM_System* sys) void OpenMM_RuntimeObjects_setSystem(OpenMM_RuntimeObjects* ommrt, OpenMM_System* sys)
......
...@@ -229,7 +229,7 @@ extern OpenMM_GBSAOBCForce* OpenMM_GBSAOBCForce_create(); ...@@ -229,7 +229,7 @@ extern OpenMM_GBSAOBCForce* OpenMM_GBSAOBCForce_create();
extern void OpenMM_GBSAOBCForce_destroy (OpenMM_GBSAOBCForce*); extern void OpenMM_GBSAOBCForce_destroy (OpenMM_GBSAOBCForce*);
extern void OpenMM_GBSAOBCForce_setSolventDielectric(OpenMM_GBSAOBCForce*, double); extern void OpenMM_GBSAOBCForce_setSolventDielectric(OpenMM_GBSAOBCForce*, double);
extern void OpenMM_GBSAOBCForce_setSoluteDielectric (OpenMM_GBSAOBCForce*, double); extern void OpenMM_GBSAOBCForce_setSoluteDielectric (OpenMM_GBSAOBCForce*, double);
extern void OpenMM_GBSAOBCForce_addParticle(OpenMM_GBSAOBCForce*, extern int OpenMM_GBSAOBCForce_addParticle(OpenMM_GBSAOBCForce*,
double charge, double charge,
double radiusInNm, double radiusInNm,
double scalingFactor); double scalingFactor);
......
...@@ -24,67 +24,79 @@ ...@@ -24,67 +24,79 @@
! data structures here. You never have to do anything with those ! data structures here. You never have to do anything with those
! pointers to deal with these objects; they get created by the API ! 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 ! for you and you just pass them back to the API when you want to
! do something with them. ! do something with them. We use integer*8 to hold the pointers
! since that is big enough to work on any machine; we don't
! necessarily use the whole thing. If you are working in Fortran 77
! (which doesn't have "type" declarations) you can simply use
! an integer*8 instead; you won't get the type checking provided
! here but it will still work.
!
! We are also making the assumption here that a C "int" is seen from
! Fortran as an integer*4 (32 bit integer) and that a C double is
! a real*8 (64 bit real). That is correct for all the systems we've
! tried; if it isn't on yours you'll need to make some changes.
MODULE OpenMM_Types MODULE OpenMM_Types
implicit none implicit none
! The System, Integrator, and Context must persist between calls. ! The System, Integrator, and Context must persist between calls.
! They can be conveniently grouped in a RuntimeObjects structure. ! They can be conveniently grouped in a RuntimeObjects structure.
type OpenMM_System type OpenMM_System
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
! This is the generic Integrator type; it represents one of ! This is the generic Integrator type; it represents one of
! the concrete integrators like Verlet or Langevin. ! the concrete integrators like Verlet or Langevin.
type OpenMM_Integrator type OpenMM_Integrator
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
! A Context connects a System and an Integrator and manages
! the run-time State.
type OpenMM_Context type OpenMM_Context
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
! This data structure can be used to hold the set of OpenMM objects ! This data structure can be used to hold the set of OpenMM objects
! that must persist from call to call while running a simulation. ! that must persist from call to call while running a simulation.
! It contains an OpenMM_System, _Integrator, and _Context. ! It contains an OpenMM_System, _Integrator, and _Context.
type OpenMM_RuntimeObjects type OpenMM_RuntimeObjects
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_State type OpenMM_State
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_Vec3Array type OpenMM_Vec3Array
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_BondArray type OpenMM_BondArray
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_String type OpenMM_String
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
! This is the generic Force type. ! This is the generic Force type.
type OpenMM_Force type OpenMM_Force
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_NonbondedForce type OpenMM_NonbondedForce
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_GBSAOBCForce type OpenMM_GBSAOBCForce
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_HarmonicBondForce type OpenMM_HarmonicBondForce
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_HarmonicAngleForce type OpenMM_HarmonicAngleForce
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_PeriodicTorsionForce type OpenMM_PeriodicTorsionForce
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_VerletIntegrator type OpenMM_VerletIntegrator
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
type OpenMM_LangevinIntegrator type OpenMM_LangevinIntegrator
character, pointer :: handle => NULL() integer*8 :: handle = 0
end type end type
! OpenMM::State enumerations ! OpenMM::State enumerations
...@@ -105,16 +117,16 @@ MODULE OpenMM_Types ...@@ -105,16 +117,16 @@ MODULE OpenMM_Types
real*8 OpenMM_NmPerAngstrom, OpenMM_AngstromsPerNm, OpenMM_PsPerFs, OpenMM_FsPerPs real*8 OpenMM_NmPerAngstrom, OpenMM_AngstromsPerNm, OpenMM_PsPerFs, OpenMM_FsPerPs
real*8 OpenMM_KJPerKcal, OpenMM_KcalPerKJ, OpenMM_RadiansPerDegree, OpenMM_DegreesPerRadian real*8 OpenMM_KJPerKcal, OpenMM_KcalPerKJ, OpenMM_RadiansPerDegree, OpenMM_DegreesPerRadian
real*8 OpenMM_SigmaPerVdwRadius real*8 OpenMM_SigmaPerVdwRadius
parameter(OpenMM_NmPerAngstrom=0.1, OpenMM_AngstromsPerNm=10.0) parameter(OpenMM_NmPerAngstrom=0.1d0, OpenMM_AngstromsPerNm=10d0)
parameter(OpenMM_PsPerFs=0.001, OpenMM_FsPerPs=1000.0) parameter(OpenMM_PsPerFs=0.001d0, OpenMM_FsPerPs=1000d0)
parameter(OpenMM_KJPerKcal=4.184, OpenMM_KcalPerKJ=1.0/4.184) parameter(OpenMM_KJPerKcal=4.184d0, OpenMM_KcalPerKJ=1d0/4.184d0)
parameter(OpenMM_RadiansPerDegree=3.1415926535897932385/180.0) parameter(OpenMM_RadiansPerDegree=3.1415926535897932385d0/180d0)
parameter(OpenMM_DegreesPerRadian=180.0/3.1415926535897932385) parameter(OpenMM_DegreesPerRadian=180d0/3.1415926535897932385d0)
parameter(OpenMM_SigmaPerVdwRadius=1.78179743628068) parameter(OpenMM_SigmaPerVdwRadius=1.78179743628068d0)
end module OpenMM_Types END MODULE OpenMM_Types
module OpenMM MODULE OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
interface interface
! ------------------------- ! -------------------------
...@@ -132,8 +144,8 @@ module OpenMM ...@@ -132,8 +144,8 @@ module OpenMM
end end
function OpenMM_Vec3Array_size(array) function OpenMM_Vec3Array_size(array)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
integer*4 OpenMM_Vec3Array_size
type (OpenMM_Vec3Array) array type (OpenMM_Vec3Array) array
integer*4 OpenMM_Vec3Array_size
end end
subroutine OpenMM_Vec3Array_resize(array, n) subroutine OpenMM_Vec3Array_resize(array, n)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
...@@ -217,14 +229,12 @@ module OpenMM ...@@ -217,14 +229,12 @@ module OpenMM
subroutine OpenMM_BondArray_get(array, i, p1, p2) subroutine OpenMM_BondArray_get(array, i, p1, p2)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_BondArray) array type (OpenMM_BondArray) array
integer*4 i integer*4 i, p1, p2
integer*4 p1, p2
end end
subroutine OpenMM_BondArray_set(array, i, p1, p2) subroutine OpenMM_BondArray_set(array, i, p1, p2)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_BondArray) array type (OpenMM_BondArray) array
integer*4 i integer*4 i, p1, p2
integer*4 p1, p2
end end
! ------------------------- ! -------------------------
...@@ -244,8 +254,8 @@ module OpenMM ...@@ -244,8 +254,8 @@ module OpenMM
end end
function OpenMM_String_length(string) function OpenMM_String_length(string)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
integer*4 OpenMM_String_length
type (OpenMM_String) string type (OpenMM_String) string
integer*4 OpenMM_String_length
end end
subroutine OpenMM_String_get(string, fstring) subroutine OpenMM_String_get(string, fstring)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
...@@ -282,16 +292,87 @@ module OpenMM ...@@ -282,16 +292,87 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_System) system type (OpenMM_System) system
end end
subroutine OpenMM_System_addForce(system, force)
! Returns the particle index in case you want it.
function OpenMM_System_addParticle(system, mass)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_System) system type (OpenMM_System) system
type (OpenMM_Force) force real*8 mass
integer*4 OpenMM_System_addParticle
end end
subroutine OpenMM_System_addParticle(system, mass) subroutine OpenMM_System_setParticleMass(system, ix, mass)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_System) system type (OpenMM_System) system
integer*4 ix ! particle index
real*8 mass real*8 mass
end end
function OpenMM_System_getParticleMass(system, ix)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 ix ! particle index
real*8 OpenMM_System_getParticleMass
end
! Returns the constraint index in case you want it.
function OpenMM_System_addConstraint(system, p1, p2, distance)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 p1, p2
real*8 distance
integer*4 OpenMM_System_addConstraint
end
subroutine OpenMM_System_setConstraintParameters(system, ix, p1, p2, distance)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 ix, p1, p2
real*8 distance
end
subroutine OpenMM_System_getConstraintParameters(system, ix, p1, p2, distance)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 ix, p1, p2
real*8 distance
end
! Returns the force index in case you want it.
function OpenMM_System_addForce(system, force)
use OpenMM_Types; implicit none
type (OpenMM_System) system
type (OpenMM_Force) force
integer*4 OpenMM_System_addForce
end
! Fortran doesn't distinguish between writable and const objects but
! we'll support both the "get" and "update" calls so it is clear what
! is intended.
subroutine OpenMM_System_updForce(system, ix, force)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 ix ! force index
type (OpenMM_Force) force
end
subroutine OpenMM_System_getForce(system, ix, force)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 ix ! force index
type (OpenMM_Force) force
end
function OpenMM_System_getNumParticles(system)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 OpenMM_System_getNumParticles
end
function OpenMM_System_getNumConstraints(system)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 OpenMM_System_getNumConstraints
end
function OpenMM_System_getNumForces(system)
use OpenMM_Types; implicit none
type (OpenMM_System) system
integer*4 OpenMM_System_getNumForces
end
! ------------------------- ! -------------------------
! OpenMM::NonbondedForce ! OpenMM::NonbondedForce
...@@ -304,11 +385,18 @@ module OpenMM ...@@ -304,11 +385,18 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
end end
! This takes a NonbondedForce handle and recasts it to a generic
! Force handle. This is only a type change; the returned Force
! handle refers to the same NonbondedForce object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_NonbondedForce_asForce(nonbond, force) subroutine OpenMM_NonbondedForce_asForce(nonbond, force)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
type (OpenMM_Force) force type (OpenMM_Force) force
end end
subroutine OpenMM_NonbondedForce_setNonbondedMethod(nonbond, method) subroutine OpenMM_NonbondedForce_setNonbondedMethod(nonbond, method)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
...@@ -339,12 +427,13 @@ module OpenMM ...@@ -339,12 +427,13 @@ module OpenMM
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
real*8 a(3), b(3), c(3) real*8 a(3), b(3), c(3)
end end
! Returns the assigned particle index.
function OpenMM_NonbondedForce_addParticle & function OpenMM_NonbondedForce_addParticle &
(nonbond, charge, sigmaInNm, vdwEnergyInKJ) (nonbond, charge, sigmaInNm, vdwEnergyInKJ)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
integer*4 OpenMM_NonbondedForce_addParticle
real*8 charge, sigmaInNm, vdwEnergyInKJ real*8 charge, sigmaInNm, vdwEnergyInKJ
integer*4 OpenMM_NonbondedForce_addParticle
end end
subroutine OpenMM_NonbondedForce_setParticleParameters & subroutine OpenMM_NonbondedForce_setParticleParameters &
(nonbond, ix, charge, sigmaInNm, vdwEnergyInKJ) (nonbond, ix, charge, sigmaInNm, vdwEnergyInKJ)
...@@ -370,13 +459,14 @@ module OpenMM ...@@ -370,13 +459,14 @@ module OpenMM
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
integer*4 OpenMM_NonbondedForce_getNumExceptions integer*4 OpenMM_NonbondedForce_getNumExceptions
end end
! Returns the assigned exception index.
function OpenMM_NonbondedForce_addException & function OpenMM_NonbondedForce_addException &
(nonbond, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ) (nonbond, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_NonbondedForce) nonbond type (OpenMM_NonbondedForce) nonbond
integer*4 OpenMM_NonbondedForce_addException
integer*4 p1, p2 integer*4 p1, p2
real*8 chargeProd, sigmaInNm, vdwEnergyInKJ real*8 chargeProd, sigmaInNm, vdwEnergyInKJ
integer*4 OpenMM_NonbondedForce_addException
end end
subroutine OpenMM_NonbondedForce_setExceptionParameters & subroutine OpenMM_NonbondedForce_setExceptionParameters &
(nonbond, ix, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ) (nonbond, ix, p1, p2, chargeProd, sigmaInNm, vdwEnergyInKJ)
...@@ -411,11 +501,18 @@ module OpenMM ...@@ -411,11 +501,18 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_GBSAOBCForce) gbsa type (OpenMM_GBSAOBCForce) gbsa
end end
! This takes a GBSAOBCForce handle and recasts it to a generic
! Force handle. This is only a type change; the returned Force
! handle refers to the same GBSAOBCForce object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_GBSAOBCForce_asForce(gbsa, force) subroutine OpenMM_GBSAOBCForce_asForce(gbsa, force)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_GBSAOBCForce) gbsa type (OpenMM_GBSAOBCForce) gbsa
type (OpenMM_Force) force type (OpenMM_Force) force
end end
subroutine OpenMM_GBSAOBCForce_setSolventDielectric(gbsa, d) subroutine OpenMM_GBSAOBCForce_setSolventDielectric(gbsa, d)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_GBSAOBCForce) gbsa type (OpenMM_GBSAOBCForce) gbsa
...@@ -426,11 +523,13 @@ module OpenMM ...@@ -426,11 +523,13 @@ module OpenMM
type (OpenMM_GBSAOBCForce) gbsa type (OpenMM_GBSAOBCForce) gbsa
real*8 d real*8 d
end end
subroutine OpenMM_GBSAOBCForce_addParticle & ! Returns the assigned particle index in case you want it.
function OpenMM_GBSAOBCForce_addParticle &
(gbsa, charge, radiusInNm, scalingFactor) (gbsa, charge, radiusInNm, scalingFactor)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_GBSAOBCForce) gbsa type (OpenMM_GBSAOBCForce) gbsa
real*8 charge, radiusInNm, scalingFactor real*8 charge, radiusInNm, scalingFactor
integer*4 OpenMM_GBSAOBCForce_addParticle
end end
! ------------------------- ! -------------------------
...@@ -444,22 +543,30 @@ module OpenMM ...@@ -444,22 +543,30 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicBondForce) hbf type (OpenMM_HarmonicBondForce) hbf
end end
! This takes a HarmonicBondForce handle and recasts it to a generic
! Force handle. This is only a type change; the returned Force
! handle refers to the same HarmonicBondForce object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_HarmonicBondForce_asForce(hbf, force) subroutine OpenMM_HarmonicBondForce_asForce(hbf, force)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicBondForce) hbf type (OpenMM_HarmonicBondForce) hbf
type (OpenMM_Force) force type (OpenMM_Force) force
end end
function OpenMM_HarmonicBondForce_getNumBonds(hbf) function OpenMM_HarmonicBondForce_getNumBonds(hbf)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicBondForce) hbf type (OpenMM_HarmonicBondForce) hbf
integer*4 OpenMM_HarmonicBondForce_getNumBonds integer*4 OpenMM_HarmonicBondForce_getNumBonds
end end
! Returns bond index in case you want it.
function OpenMM_HarmonicBondForce_addBond(hbf, p1, p2, length, k) function OpenMM_HarmonicBondForce_addBond(hbf, p1, p2, length, k)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicBondForce) hbf type (OpenMM_HarmonicBondForce) hbf
integer*4 OpenMM_HarmonicBondForce_addBond
integer*4 p1, p2 integer*4 p1, p2
real*8 length,k real*8 length, k
integer*4 OpenMM_HarmonicBondForce_addBond
end end
subroutine OpenMM_HarmonicBondForce_setBondParameters(hbf, ix, p1, p2, length, k) subroutine OpenMM_HarmonicBondForce_setBondParameters(hbf, ix, p1, p2, length, k)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
...@@ -485,16 +592,24 @@ module OpenMM ...@@ -485,16 +592,24 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicAngleForce) hbf type (OpenMM_HarmonicAngleForce) hbf
end end
! This takes a HarmonicAngleForce handle and recasts it to a generic
! Force handle. This is only a type change; the returned Force
! handle refers to the same HarmonicAngleForce object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_HarmonicAngleForce_asForce(hbf, force) subroutine OpenMM_HarmonicAngleForce_asForce(hbf, force)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicAngleForce) hbf type (OpenMM_HarmonicAngleForce) hbf
type (OpenMM_Force) force type (OpenMM_Force) force
end end
function OpenMM_HarmonicAngleForce_getNumAngles(hbf) function OpenMM_HarmonicAngleForce_getNumAngles(hbf)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicAngleForce) hbf type (OpenMM_HarmonicAngleForce) hbf
integer*4 OpenMM_HarmonicAngleForce_getNumAngles integer*4 OpenMM_HarmonicAngleForce_getNumAngles
end end
! Returns angle index in case you want it.
function OpenMM_HarmonicAngleForce_addAngle(hbf, p1, p2, p3, angle, k) function OpenMM_HarmonicAngleForce_addAngle(hbf, p1, p2, p3, angle, k)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_HarmonicAngleForce) hbf type (OpenMM_HarmonicAngleForce) hbf
...@@ -528,16 +643,24 @@ module OpenMM ...@@ -528,16 +643,24 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_PeriodicTorsionForce) hbf type (OpenMM_PeriodicTorsionForce) hbf
end end
! This takes a PeriodicTorsionForce handle and recasts it to a generic
! Force handle. This is only a type change; the returned Force
! handle refers to the same PeriodicTorsionForce object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_PeriodicTorsionForce_asForce(hbf, force) subroutine OpenMM_PeriodicTorsionForce_asForce(hbf, force)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_PeriodicTorsionForce) hbf type (OpenMM_PeriodicTorsionForce) hbf
type (OpenMM_Force) force type (OpenMM_Force) force
end end
function OpenMM_PeriodicTorsionForce_getNumTorsions(hbf) function OpenMM_PeriodicTorsionForce_getNumTorsions(hbf)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_PeriodicTorsionForce) hbf type (OpenMM_PeriodicTorsionForce) hbf
integer*4 OpenMM_PeriodicTorsionForce_getNumTorsions integer*4 OpenMM_PeriodicTorsionForce_getNumTorsions
end end
! Returns torsion index in case you want it.
function OpenMM_PeriodicTorsionForce_addTorsion & function OpenMM_PeriodicTorsionForce_addTorsion &
(hbf, p1, p2, p3, p4, periodicity, phase, k) (hbf, p1, p2, p3, p4, periodicity, phase, k)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
...@@ -586,11 +709,18 @@ module OpenMM ...@@ -586,11 +709,18 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_VerletIntegrator) verlet type (OpenMM_VerletIntegrator) verlet
end end
! This takes a VerletIntegrator handle and recasts it to a generic
! Integrator handle. This is only a type change; the returned Integrator
! handle refers to the same VerletIntegrator object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_VerletIntegrator_asIntegrator(verlet, integ) subroutine OpenMM_VerletIntegrator_asIntegrator(verlet, integ)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_VerletIntegrator) verlet type (OpenMM_VerletIntegrator) verlet
type (OpenMM_Integrator) integ type (OpenMM_Integrator) integ
end end
subroutine OpenMM_VerletIntegrator_step(verlet, numSteps) subroutine OpenMM_VerletIntegrator_step(verlet, numSteps)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_VerletIntegrator) verlet type (OpenMM_VerletIntegrator) verlet
...@@ -610,11 +740,18 @@ module OpenMM ...@@ -610,11 +740,18 @@ module OpenMM
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_LangevinIntegrator) langevin type (OpenMM_LangevinIntegrator) langevin
end end
! This takes a LangevinIntegrator handle and recasts it to a generic
! Integrator handle. This is only a type change; the returned Integrator
! handle refers to the same LangevinIntegrator object as the input.
! You can accomplish the same thing with Fortran 95's "transfer"
! intrinsic function.
subroutine OpenMM_LangevinIntegrator_asIntegrator(langevin, integ) subroutine OpenMM_LangevinIntegrator_asIntegrator(langevin, integ)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_LangevinIntegrator) langevin type (OpenMM_LangevinIntegrator) langevin
type (OpenMM_Integrator) integ type (OpenMM_Integrator) integ
end end
subroutine OpenMM_LangevinIntegrator_step(langevin, numSteps) subroutine OpenMM_LangevinIntegrator_step(langevin, numSteps)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_LangevinIntegrator) langevin type (OpenMM_LangevinIntegrator) langevin
...@@ -688,6 +825,10 @@ module OpenMM ...@@ -688,6 +825,10 @@ module OpenMM
type (OpenMM_State) state type (OpenMM_State) state
type (OpenMM_Vec3Array) velocities type (OpenMM_Vec3Array) velocities
end end
! -------------------------
! OpenMM::RuntimeObjects
! -------------------------
subroutine OpenMM_RuntimeObjects_create(omm) subroutine OpenMM_RuntimeObjects_create(omm)
use OpenMM_Types; implicit none use OpenMM_Types; implicit none
type (OpenMM_RuntimeObjects) omm type (OpenMM_RuntimeObjects) omm
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment