Commit 7cbeb289 authored by Peter Eastman's avatar Peter Eastman
Browse files

Added some missing imports in examples

parent b1b4e547
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "OpenMM.h" #include "OpenMM.h"
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <utility> #include <utility>
...@@ -46,8 +47,8 @@ int main() { ...@@ -46,8 +47,8 @@ int main() {
// ALWAYS enclose all OpenMM calls with a try/catch block to make sure that // ALWAYS enclose all OpenMM calls with a try/catch block to make sure that
// usage and runtime errors are caught and reported. // usage and runtime errors are caught and reported.
try { try {
// Load all available OpenMM plugins from their default location. // Load all available OpenMM plugins from their default location.
OpenMM::Platform::loadPluginsFromDirectory OpenMM::Platform::loadPluginsFromDirectory
(OpenMM::Platform::getDefaultPluginsDirectory()); (OpenMM::Platform::getDefaultPluginsDirectory());
simulateWaterBox(); simulateWaterBox();
...@@ -121,11 +122,11 @@ static void simulateWaterBox() { ...@@ -121,11 +122,11 @@ static void simulateWaterBox() {
double boxEdgeLength = waterSize * watersPerEdge; double boxEdgeLength = waterSize * watersPerEdge;
// Create periodic box // Create periodic box
nonbond.setNonbondedMethod(OpenMM::NonbondedForce::CutoffPeriodic); nonbond.setNonbondedMethod(OpenMM::NonbondedForce::CutoffPeriodic);
nonbond.setCutoffDistance(2); nonbond.setCutoffDistance(2);
nonbond.setPeriodicBoxVectors(Vec3(boxEdgeLength,0,0), Vec3(0,boxEdgeLength,0), Vec3(0,0,boxEdgeLength)); nonbond.setPeriodicBoxVectors(Vec3(boxEdgeLength,0,0), Vec3(0,boxEdgeLength,0), Vec3(0,0,boxEdgeLength));
// Create data structures to hold lists of initial positions and bonds // Create data structures to hold lists of initial positions and bonds
std::vector<Vec3> initialPositions; std::vector<Vec3> initialPositions;
std::vector< std::pair<int,int> > bondPairs; std::vector< std::pair<int,int> > bondPairs;
...@@ -239,9 +240,9 @@ static void simulateWaterBox() { ...@@ -239,9 +240,9 @@ static void simulateWaterBox() {
static void static void
writePDB(const OpenMM::OpenMMContext& context) { writePDB(const OpenMM::OpenMMContext& context) {
// We don't calculate energy in this example because it would take most of the time // We don't calculate energy in this example because it would take most of the time
const OpenMM::State state = context.getState(OpenMM::State::Positions); const OpenMM::State state = context.getState(OpenMM::State::Positions);
const std::vector<Vec3>& positions = state.getPositions(); const std::vector<Vec3>& positions = state.getPositions();
static int modelFrameNumber = 0; // numbering for MODEL records in pdb output static int modelFrameNumber = 0; // numbering for MODEL records in pdb output
modelFrameNumber++; modelFrameNumber++;
printf("MODEL %d\n", modelFrameNumber); printf("MODEL %d\n", modelFrameNumber);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include "OpenMM_CWrapper.h" #include "OpenMM_CWrapper.h"
#include <cstring>
// Suppress irrelevant warnings from Microsoft's compiler. // Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER #ifdef _MSC_VER
......
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