Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
11a1982a
"platforms/vscode:/vscode.git/clone" did not exist on "59b8afb1b0f01fbdd85d050e093f4e4d62c93daf"
Unverified
Commit
11a1982a
authored
Apr 15, 2022
by
Peter Eastman
Committed by
GitHub
Apr 15, 2022
Browse files
Fixed inconsistency in computing kinetic energy (#3574)
parent
c8981916
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
platforms/cpu/src/CpuKernels.cpp
platforms/cpu/src/CpuKernels.cpp
+8
-6
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+3
-2
No files found.
platforms/cpu/src/CpuKernels.cpp
View file @
11a1982a
...
@@ -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.
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
11a1982a
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment