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