Commit f62ba9d8 authored by Michael Sherman's avatar Michael Sherman
Browse files

Minor tweaks and comments.

parent f337005b
...@@ -187,9 +187,9 @@ struct MyOpenMMData { ...@@ -187,9 +187,9 @@ struct MyOpenMMData {
// INITIALIZE OpenMM DATA STRUCTURES // INITIALIZE OpenMM DATA STRUCTURES
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// We take these actions here: // We take these actions here:
// (1) Allocate a MyOpenMMData structure to hang on to OpenMM data structures // (1) Load any available OpenMM plugins, e.g. Cuda and Brook.
// (2) Allocate a MyOpenMMData structure to hang on to OpenMM data structures
// in a manner which is opaque to the caller. // in a manner which is opaque to the caller.
// (2) Allocate the OpenMM objects which persist from call to call.
// (3) Fill the OpenMM::System with the force field parameters we want to // (3) Fill the OpenMM::System with the force field parameters we want to
// use and the particular set of atoms to be simulated. // use and the particular set of atoms to be simulated.
// (4) Create an Integrator and a Context associating the Integrator with // (4) Create an Integrator and a Context associating the Integrator with
...@@ -232,7 +232,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[], ...@@ -232,7 +232,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
// (1) System needs to know the masses. // (1) System needs to know the masses.
// (2) NonbondedForce needs charges,van der Waals properties (in MD units!). // (2) NonbondedForce needs charges,van der Waals properties (in MD units!).
// (3) GBSA needs charge, radius, and scale factor. // (3) GBSA needs charge, radius, and scale factor.
// (3) Collect default positions for initializing the simulation later. // (4) Collect default positions for initializing the simulation later.
std::vector<Vec3> initialPosInNm; std::vector<Vec3> initialPosInNm;
for (int n=0; *atoms[n].pdb; ++n) { for (int n=0; *atoms[n].pdb; ++n) {
const MyAtomInfo& atom = atoms[n]; const MyAtomInfo& atom = atoms[n];
......
...@@ -184,7 +184,7 @@ struct MyOpenMMData_s { ...@@ -184,7 +184,7 @@ struct MyOpenMMData_s {
* *
* Note that this function must understand the calling MD code's molecule and * Note that this function must understand the calling MD code's molecule and
* force field data structures so will need to be customized for each MD code. * force field data structures so will need to be customized for each MD code.
*/ */
static MyOpenMMData* static MyOpenMMData*
myInitializeOpenMM( const MyAtomInfo atoms[], myInitializeOpenMM( const MyAtomInfo atoms[],
double temperature, double temperature,
...@@ -274,7 +274,7 @@ myGetOpenMMState(MyOpenMMData* omm, int wantEnergy, ...@@ -274,7 +274,7 @@ myGetOpenMMState(MyOpenMMData* omm, int wantEnergy,
MyAtomInfo atoms[]) MyAtomInfo atoms[])
{ {
OpenMM_State* state; OpenMM_State* state;
const OpenMM_Vec3Array* posArray; const OpenMM_Vec3Array* posArrayInNm;
int infoMask; int infoMask;
int n; int n;
...@@ -291,12 +291,11 @@ myGetOpenMMState(MyOpenMMData* omm, int wantEnergy, ...@@ -291,12 +291,11 @@ myGetOpenMMState(MyOpenMMData* omm, int wantEnergy,
/* Positions are maintained as a Vec3Array inside the State. This will give /* Positions are maintained as a Vec3Array inside the State. This will give
* us access, but don't destroy it yourself -- it will go away with the State. */ * us access, but don't destroy it yourself -- it will go away with the State. */
posArray = OpenMM_State_getPositions(state); posArrayInNm = OpenMM_State_getPositions(state);
for (n=0; *atoms[n].pdb; ++n) { for (n=0; *atoms[n].pdb; ++n)
double posInNm[3]; /* Sets atoms[n].pos = posArray[n] * Angstroms/nm. */
OpenMM_Vec3Array_get(posArray, n, posInNm); OpenMM_Vec3Array_getScaled(posArrayInNm, n, OpenMM_AngstromsPerNm,
OpenMM_Vec3_scale(posInNm, OpenMM_AngstromsPerNm, atoms[n].posInAng); atoms[n].posInAng);
}
/* If energy has been requested, obtain it and convert from kJ to kcal. */ /* If energy has been requested, obtain it and convert from kJ to kcal. */
*energyInKcal = 0; *energyInKcal = 0;
......
...@@ -299,7 +299,7 @@ void OpenMM_GBSAOBCForce_destroy(OpenMM_GBSAOBCForce* doomed) ...@@ -299,7 +299,7 @@ void OpenMM_GBSAOBCForce_destroy(OpenMM_GBSAOBCForce* doomed)
void openmm_gbsaobcforce_destroy_(OpenMM_GBSAOBCForce*& doomed) void openmm_gbsaobcforce_destroy_(OpenMM_GBSAOBCForce*& doomed)
{ OpenMM_GBSAOBCForce_destroy(doomed); doomed = 0;} { OpenMM_GBSAOBCForce_destroy(doomed); doomed = 0;}
// Fortran only: recast NonbondedForce as a Force. // Fortran only: recast GBSAOBCForce as a Force.
void openmm_gbsaobcforce_asforce_(OpenMM_GBSAOBCForce* const& gbsa, void openmm_gbsaobcforce_asforce_(OpenMM_GBSAOBCForce* const& gbsa,
OpenMM_Force*& force) OpenMM_Force*& force)
{ force = (OpenMM_Force*)gbsa; } { force = (OpenMM_Force*)gbsa; }
......
...@@ -129,7 +129,7 @@ extern void OpenMM_Vec3Array_get(const OpenMM_Vec3Array*, int i, ...@@ -129,7 +129,7 @@ extern void OpenMM_Vec3Array_get(const OpenMM_Vec3Array*, int i,
extern void OpenMM_Vec3Array_getScaled(const OpenMM_Vec3Array*, int i, double s, double[3]); extern void OpenMM_Vec3Array_getScaled(const OpenMM_Vec3Array*, int i, double s, double[3]);
extern void OpenMM_Vec3Array_set(OpenMM_Vec3Array*, int i, const double[3]); extern void OpenMM_Vec3Array_set(OpenMM_Vec3Array*, int i, const double[3]);
extern void OpenMM_Vec3Array_setScaled(OpenMM_Vec3Array*, int i, const double[3], double s); extern void OpenMM_Vec3Array_setScaled(OpenMM_Vec3Array*, int i, const double[3], double s);
extern void OpenMM_Vec3_scale(const double[3], double s, double[3]); extern void OpenMM_Vec3_scale(const double in[3], double s, double out[3]);
/* OpenMM_String */ /* OpenMM_String */
extern OpenMM_String* OpenMM_String_create(const char* init); extern OpenMM_String* OpenMM_String_create(const char* init);
......
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