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

Fixed inconsistency in computing kinetic energy (#3574)

parent c8981916
......@@ -124,10 +124,12 @@ static double computeShiftedKineticEnergy(ContextImpl& context, vector<double>&
// Apply constraints to them.
if (timeShift != 0) {
vector<double> inverseMasses(numParticles);
for (int i = 0; i < numParticles; i++)
inverseMasses[i] = (masses[i] == 0 ? 0 : 1/masses[i]);
extractConstraints(context).applyToVelocities(posData, shiftedVel, inverseMasses, 1e-4);
}
// Compute the kinetic energy.
......
......@@ -263,6 +263,7 @@ void ReferenceUpdateStateDataKernel::computeShiftedVelocities(ContextImpl& conte
// Apply constraints to them.
if (timeShift != 0)
extractConstraints(context).applyToVelocities(posData, velocities, inverseMasses, 1e-4);
}
......
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