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

Fix, but this is going away.

parent 0accdd2c
// Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#include "OpenMM.h" #include "OpenMM.h"
#include <iostream> #include <iostream>
...@@ -40,7 +46,7 @@ static const double SimulationTimePs = 1000; // total simulation time (ps) ...@@ -40,7 +46,7 @@ static const double SimulationTimePs = 1000; // total simulation time (ps)
static const double SigmaPerVdwRadius = 2*std::pow(2., -1./6.); static const double SigmaPerVdwRadius = 2*std::pow(2., -1./6.);
static void showState(const OpenMMContext&); static double showState(const OpenMMContext&);
int main() { int main() {
try { try {
...@@ -80,13 +86,13 @@ try { ...@@ -80,13 +86,13 @@ try {
context.setPositions(positions); context.setPositions(positions);
// Output the initial state. // Output the initial state.
showState(context); double time = showState(context);
const int NumSilentSteps = (int)(ReportIntervalFs / StepSizeFs + 0.5); const int NumSilentSteps = (int)(ReportIntervalFs / StepSizeFs + 0.5);
do { do {
integrator.step(NumSilentSteps); integrator.step(NumSilentSteps);
showState(context); time = showState(context);
} while (context.getTime() < SimulationTimePs); } while (time < SimulationTimePs);
} catch(const std::exception& e) { } catch(const std::exception& e) {
std::cout << "EXCEPTION: " << e.what() << std::endl; std::cout << "EXCEPTION: " << e.what() << std::endl;
...@@ -96,7 +102,7 @@ try { ...@@ -96,7 +102,7 @@ try {
return 0; return 0;
} }
static void static double
showState(const OpenMMContext& context) { showState(const OpenMMContext& context) {
// Caution: at the moment asking for energy requires use of slow reference calculation. // Caution: at the moment asking for energy requires use of slow reference calculation.
const State state = context.getState( State::Positions | State::Velocities const State state = context.getState( State::Positions | State::Velocities
...@@ -112,5 +118,7 @@ showState(const OpenMMContext& context) { ...@@ -112,5 +118,7 @@ showState(const OpenMMContext& context) {
std::cout << i << " " << positions[i] * AngstromsPerNm << std::endl; std::cout << i << " " << positions[i] * AngstromsPerNm << std::endl;
std::cout << "f=" << forces[i] << " dq=" << dq << std::endl; std::cout << "f=" << forces[i] << " dq=" << dq << std::endl;
} }
return state.getTime();
} }
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