Created
May 29, 2014 22:17
-
-
Save proteneer/390ddd4ed4d165141a19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <OpenMM.h> | |
#include <iostream> | |
#include <fstream> | |
#include <limits> | |
using namespace OpenMM; | |
using namespace std; | |
extern "C" void registerSerializationProxies(); | |
extern "C" void registerOpenCLPlatform(); | |
extern "C" void registerCudaPlatform(); | |
int main() { | |
// not needed if linking against dlls | |
registerSerializationProxies(); | |
registerOpenCLPlatform(); | |
registerCudaPlatform(); | |
ifstream system_stream("system.xml"); | |
System* shared_system = OpenMM::XmlSerializer::deserialize<OpenMM::System>(system_stream); | |
ifstream state_stream("state.xml"); | |
State* state = OpenMM::XmlSerializer::deserialize<OpenMM::State>(state_stream); | |
ifstream integrator_stream("integrator.xml"); | |
Integrator* integrator = OpenMM::XmlSerializer::deserialize<OpenMM::Integrator>(integrator_stream); | |
Context* ctxt = new Context(*shared_system, *integrator, Platform::getPlatformByName("OpenCL")); | |
ctxt->setState(*state); | |
for(int i=0; i < 1e7; i++) { | |
integrator->step(1); | |
} | |
delete ctxt; | |
delete shared_system; | |
delete state; | |
delete integrator; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment