Commit 3f5d98a5 authored by Michael Sherman's avatar Michael Sherman
Browse files

Thanks to Chris, we now know that the Langevin friction parameter is in ONE...

Thanks to Chris, we now know that the Langevin friction parameter is in ONE OVER picoseconds, NOT picoseconds!!
parent 804ffc62
......@@ -47,8 +47,8 @@ int main() {
// ALWAYS enclose all OpenMM calls with a try/catch block to make sure that
// usage and runtime errors are caught and reported.
try {
// Load all available OpenMM plugins from their default location.
OpenMM::Platform::loadPluginsFromDirectory
// Load all available OpenMM plugins from their default location.
OpenMM::Platform::loadPluginsFromDirectory
(OpenMM::Platform::getDefaultPluginsDirectory());
simulateEthane();
......@@ -275,12 +275,12 @@ static void
writePDB(const OpenMM::OpenMMContext& context) {
// Caution: at the moment asking for energy requires use of slow Reference
// platform calculation.
const OpenMM::State state = context.getState( OpenMM::State::Positions
| OpenMM::State::Velocities
| OpenMM::State::Energy);
const double energy = state.getPotentialEnergy() + state.getKineticEnergy();
const std::vector<Vec3>& positions = state.getPositions();
static int modelFrameNumber = 0; // numbering for MODEL records in pdb output
const OpenMM::State state = context.getState( OpenMM::State::Positions
| OpenMM::State::Velocities
| OpenMM::State::Energy);
const double energy = state.getPotentialEnergy() + state.getKineticEnergy();
const std::vector<Vec3>& positions = state.getPositions();
static int modelFrameNumber = 0; // numbering for MODEL records in pdb output
modelFrameNumber++;
printf("MODEL %d\n", modelFrameNumber);
......
......@@ -24,7 +24,7 @@ using std::printf;
// MODELING AND SIMULATION PARAMETERS
// -----------------------------------------------------------------------------
static const double Temperature = 300; // Kelvins
static const double FrictionInPs = 1./91.; // picoseconds between collisions
static const double FrictionInPerPs = 91.; // collisions per picosecond
static const double SolventDielectric = 80.; // typical for water
static const double SoluteDielectric = 2.; // typical for protein
......@@ -119,7 +119,7 @@ int main() {
std::string platformName;
// Set up OpenMM data structures; returns OpenMM Platform name.
MyOpenMMData* omm = myInitializeOpenMM(atoms, Temperature, FrictionInPs,
MyOpenMMData* omm = myInitializeOpenMM(atoms, Temperature, FrictionInPerPs,
SolventDielectric, SoluteDielectric,
StepSizeInFs, platformName);
......@@ -173,13 +173,13 @@ namespace OpenMM {
// (defined as the zero crossing separation). The value is 2*pow(2, -1/6).
static const double SigmaPerVdwRadius = 1.78179743628068;
}
struct MyOpenMMData {
MyOpenMMData() : system(0), context(0), integrator(0) {}
~MyOpenMMData() {delete system; delete context; delete integrator;}
OpenMM::System* system;
OpenMM::OpenMMContext* context;
OpenMM::Integrator* integrator;
struct MyOpenMMData {
MyOpenMMData() : system(0), context(0), integrator(0) {}
~MyOpenMMData() {delete system; delete context; delete integrator;}
OpenMM::System* system;
OpenMM::OpenMMContext* context;
OpenMM::Integrator* integrator;
};
......
......@@ -25,7 +25,7 @@
* MODELING AND SIMULATION PARAMETERS
* -------------------------------------------------------------------------- */
static const double Temperature = 300; /*Kelvins */
static const double FrictionInPs = 1./91.; /*ps between collisions*/
static const double FrictionInPerPs = 91.; /*collisions per ps*/
static const double SolventDielectric = 80.; /*typical for water */
static const double SoluteDielectric = 2.; /*typical for protein */
......@@ -124,7 +124,7 @@ int main() {
const char* platformName;
// Set up OpenMM data structures; returns OpenMM Platform name.
MyOpenMMData* omm = myInitializeOpenMM(atoms, Temperature, FrictionInPs,
MyOpenMMData* omm = myInitializeOpenMM(atoms, Temperature, FrictionInPerPs,
SolventDielectric, SoluteDielectric,
StepSizeInFs, &platformName);
......@@ -187,7 +187,7 @@ struct MyOpenMMData_s {
static MyOpenMMData*
myInitializeOpenMM( const MyAtomInfo atoms[],
double temperature,
double frictionInPs,
double frictionInPerPs,
double solventDielectric,
double soluteDielectric,
double stepSizeInFs,
......@@ -252,7 +252,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
* positions we collected above. Initial velocities will be zero but could
* have been set here. */
omm->integrator = (OpenMM_Integrator*)OpenMM_LangevinIntegrator_create(
temperature, frictionInPs,
temperature, frictionInPerPs,
stepSizeInFs * OpenMM_PsPerFs);
omm->context = OpenMM_Context_create(omm->system, omm->integrator);
OpenMM_Context_setPositions(omm->context, initialPosInNm);
......
......@@ -32,8 +32,8 @@ static AtomInfo atoms[] = {
{""} // end of list
};
static const double Temperature = 100; // Kelvins
static const double Friction = 1./91.; // picoseconds between collisions
static const double Temperature = 100; // Kelvins
static const double FrictionInPerPs = 91.; // collisions per ps
static const double StepSizeFs = 2; // femtoseconds
static const double ReportIntervalFs = 1000;
static const double SimulationTimePs = 1000; // total simulation time (ps)
......
......@@ -333,10 +333,10 @@ void openmm_verletintegrator_step_(OpenMM_VerletIntegrator* const& verlet, int&
// OpenMM::LangevinIntegrator
OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPs, double stepSzInPs)
{ return (OpenMM_LangevinIntegrator*)new LangevinIntegrator(temperature, frictionInPs, stepSzInPs); }
void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPs, double& stepSzInPs)
{ langevin = OpenMM_LangevinIntegrator_create(temperature, frictionInPs, stepSzInPs); }
OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPerPs, double stepSzInPs)
{ return (OpenMM_LangevinIntegrator*)new LangevinIntegrator(temperature, frictionInPerPs, stepSzInPs); }
void openmm_langevinintegrator_create_(OpenMM_LangevinIntegrator*& langevin, double& temperature, double& frictionInPerPs, double& stepSzInPs)
{ langevin = OpenMM_LangevinIntegrator_create(temperature, frictionInPerPs, stepSzInPs); }
void OpenMM_LangevinIntegrator_destroy(OpenMM_LangevinIntegrator* doomed)
{ delete (LangevinIntegrator*)doomed; }
......
// -----------------------------------------------------------------------------
// OpenMM(tm) example C wrapper function declarations (June 2009)
// -----------------------------------------------------------------------------
// This header should be included by a C main program that would like to
// access the OpenMM API through the C wrappers. Please note that this is not
// an official part of OpenMM; it is just an example of how the C++ API can be
// wrapped for access from C.
// -----------------------------------------------------------------------------
#ifndef OPENMM_CWRAPPER_H
#define OPENMM_CWRAPPER_H
#if defined(__cplusplus)
#include <cmath>
#else
#include <math.h>
#endif
/*
* This header file is intended to be included in a C compilation unit so must
* not use any C++ features that are not also present in ANSI C.
*/
/* --------------------------------------------------------------------------
* OpenMM(tm) example C wrapper function declarations (June 2009)
* --------------------------------------------------------------------------
* This header should be included by a C main program that would like to
* access the OpenMM API through the C wrappers. Please note that this is not
* an official part of OpenMM; it is just an example of how the C++ API can
* be wrapped for access from C.
*
* Note: this header must be includable in both ANSI C and C++ code, because
* the function declarations must be common to both the users and the
* implementing code, which is in C++.
* -------------------------------------------------------------------------- */
#ifndef OPENMM_CWRAPPER_H_
#define OPENMM_CWRAPPER_H_
//#if defined(__cplusplus)
// #include <cmath>
//#else
// #include <math.h>
//#endif
/* These incomplete types are declared so we can have unique pointer types. */
typedef struct OpenMM_System_s OpenMM_System;
......@@ -168,7 +167,7 @@ extern OpenMM_VerletIntegrator* OpenMM_VerletIntegrator_create(double stepSzInPs
extern void OpenMM_VerletIntegrator_destroy(OpenMM_VerletIntegrator*);
extern void OpenMM_VerletIntegrator_step(OpenMM_VerletIntegrator*, int numSteps);
/* OpenMM::LangevinIntegrator */
extern OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPs, double stepSzInPs);
extern OpenMM_LangevinIntegrator* OpenMM_LangevinIntegrator_create(double temperature, double frictionInPerPs, double stepSzInPs);
extern void OpenMM_VLangevinIntegrator_destroy(OpenMM_LangevinIntegrator*);
extern void OpenMM_LangevinIntegrator_step(OpenMM_LangevinIntegrator*, int numSteps);
......@@ -204,7 +203,7 @@ static void OpenMM_Vec3_set(double x, double y, double z, OpenMM_Vec3 out) {
}
#endif /*OPENMM_CWRAPPER_H*/
#endif /*OPENMM_CWRAPPER_H_*/
......
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