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
2ffa7cd3
Unverified
Commit
2ffa7cd3
authored
May 29, 2026
by
Peter Eastman
Committed by
GitHub
May 29, 2026
Browse files
Minor cleanup to PythonForce (#5304)
* Minor cleanup to PythonForce * Reverted an incorrect change
parent
35d4ce90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
platforms/common/src/CommonKernels.cpp
platforms/common/src/CommonKernels.cpp
+3
-4
No files found.
platforms/common/src/CommonKernels.cpp
View file @
2ffa7cd3
...
...
@@ -4893,7 +4893,6 @@ double CommonCalcPythonForceKernel::execute(ContextImpl& context, bool includeFo
if
(
cc
.
getContextIndex
()
!=
0
)
return
0.0
;
getPositions
();
executeOnWorkerThread
(
includeForces
);
return
addForces
(
includeForces
,
includeEnergy
,
-
1
);
}
...
...
@@ -4903,11 +4902,11 @@ void CommonCalcPythonForceKernel::getPositions() {
// wrapped to the periodic box. If this force also applies periodic boundary conditions, that's
// alright. Otherwise, we need to move them back.
bool
fix
Periodic
=
usePeriodic
||
!
cc
.
getNonbondedUtilities
().
getUsePeriodic
();
bool
allow
Periodic
=
usePeriodic
||
!
cc
.
getNonbondedUtilities
().
getUsePeriodic
();
if
(
particles
.
size
()
==
0
)
{
// The force applies to the whole system, so we can just use the standard getPositions().
contextImpl
.
getPositions
(
positionsVec
,
fix
Periodic
);
contextImpl
.
getPositions
(
positionsVec
,
allow
Periodic
);
}
else
{
// Retrieve positions for the subset of particles the force is applied to.
...
...
@@ -4926,7 +4925,7 @@ void CommonCalcPythonForceKernel::getPositions() {
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
positionsVec
[
i
]
=
Vec3
((
double
)
pos
[
3
*
i
],
(
double
)
pos
[
3
*
i
+
1
],
(
double
)
pos
[
3
*
i
+
2
]);
}
if
(
fix
Periodic
)
{
if
(
!
allow
Periodic
)
{
Vec3
boxVectors
[
3
];
cc
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
...
...
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