Unverified Commit a0c7a7cb authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Fixed bug in CustomIntegrator detecting changes to context parameters (#4206)

parent e069e1f1
...@@ -7087,6 +7087,7 @@ void CommonIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context ...@@ -7087,6 +7087,7 @@ void CommonIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
for (int i = 0; i < (int) parameterNames.size(); i++) { for (int i = 0; i < (int) parameterNames.size(); i++) {
double value = context.getParameter(parameterNames[i]); double value = context.getParameter(parameterNames[i]);
if (value != localGlobalValues[parameterVariableIndex[i]]) { if (value != localGlobalValues[parameterVariableIndex[i]]) {
expressionSet.setVariable(parameterVariableIndex[i], value);
localGlobalValues[parameterVariableIndex[i]] = value; localGlobalValues[parameterVariableIndex[i]] = value;
deviceGlobalsAreCurrent = false; deviceGlobalsAreCurrent = false;
} }
......
...@@ -439,6 +439,10 @@ void testParameter() { ...@@ -439,6 +439,10 @@ void testParameter() {
integrator.step(1); integrator.step(1);
ASSERT_EQUAL_TOL(context.getParameter("AndersenTemperature"), 0.1*(1<<(i+1)), 1e-10); ASSERT_EQUAL_TOL(context.getParameter("AndersenTemperature"), 0.1*(1<<(i+1)), 1e-10);
} }
context.setParameter("AndersenTemperature", -5.0);
integrator.step(1);
ASSERT_EQUAL(-5.0, integrator.getGlobalVariable(0));
ASSERT_EQUAL(-10.0, context.getParameter("AndersenTemperature"));
} }
/** /**
......
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