Commit d5b80604 authored by Peter Eastman's avatar Peter Eastman
Browse files

RPMDIntegrator throws an exception if the System includes virtual sites

parent 703842be
...@@ -54,8 +54,12 @@ RPMDIntegrator::RPMDIntegrator(int numCopies, double temperature, double frictio ...@@ -54,8 +54,12 @@ RPMDIntegrator::RPMDIntegrator(int numCopies, double temperature, double frictio
void RPMDIntegrator::initialize(ContextImpl& contextRef) { void RPMDIntegrator::initialize(ContextImpl& contextRef) {
if (owner != NULL && &contextRef.getOwner() != owner) if (owner != NULL && &contextRef.getOwner() != owner)
throw OpenMMException("This Integrator is already bound to a context"); throw OpenMMException("This Integrator is already bound to a context");
if (contextRef.getSystem().getNumConstraints() > 0) const System& system = contextRef.getSystem();
if (system.getNumConstraints() > 0)
throw OpenMMException("RPMDIntegrator cannot be used with Systems that include constraints"); throw OpenMMException("RPMDIntegrator cannot be used with Systems that include constraints");
for (int i = 0; i < system.getNumParticles(); i++)
if (system.isVirtualSite(i))
throw OpenMMException("RPMDIntegrator cannot be used with Systems that include virtual sites");
context = &contextRef; context = &contextRef;
owner = &contextRef.getOwner(); owner = &contextRef.getOwner();
kernel = context->getPlatform().createKernel(IntegrateRPMDStepKernel::Name(), contextRef); kernel = context->getPlatform().createKernel(IntegrateRPMDStepKernel::Name(), contextRef);
......
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