Commit 980003cc authored by Peter Eastman's avatar Peter Eastman
Browse files

OpenMMContext.reinitialize() works correctly with CudaPlatform. Also fixed an incorrect comment.

parent dd741b6d
......@@ -39,7 +39,7 @@
namespace OpenMM {
/**
* This is an Integrator which simulates a System using the leap-frog Verlet algorithm.
* This is an Integrator which simulates a System using the velocity Verlet algorithm.
*/
class OPENMM_EXPORT VerletIntegrator : public Integrator {
......
......@@ -144,10 +144,6 @@ public:
* ForceImpl in the system, allowing them to modify the values of state variables.
*/
void updateContextState();
/**
* Delete all ForceImpl objects that have been created and create new ones.
*/
void reinitialize();
/**
* Get the platform-specific data stored in this context.
*/
......
......@@ -113,5 +113,9 @@ void OpenMMContext::setParameter(string name, double value) {
}
void OpenMMContext::reinitialize() {
impl->reinitialize();
System& system = impl->getSystem();
Integrator& integrator = impl->getIntegrator();
Platform& platform = impl->getPlatform();
delete impl;
impl = new OpenMMContextImpl(*this, system, integrator, &platform);
}
......@@ -121,17 +121,6 @@ void OpenMMContextImpl::updateContextState() {
forceImpls[i]->updateContextState(*this);
}
void OpenMMContextImpl::reinitialize() {
for (int i = 0; i < (int) forceImpls.size(); ++i)
delete forceImpls[i];
forceImpls.resize(0);
for (int i = 0; i < system.getNumForces(); ++i) {
forceImpls.push_back(system.getForce(i).createImpl());
forceImpls[i]->initialize(*this);
}
integrator.initialize(*this);
}
void* OpenMMContextImpl::getPlatformData() {
return platformData;
}
......
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