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
245f18cf
Unverified
Commit
245f18cf
authored
Jul 22, 2021
by
Peter Eastman
Committed by
GitHub
Jul 22, 2021
Browse files
Fixed compilation error in kernel with CustomIntegrator (#3187)
parent
4399fa69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
platforms/common/src/ExpressionUtilities.cpp
platforms/common/src/ExpressionUtilities.cpp
+11
-4
tests/TestCustomIntegrator.h
tests/TestCustomIntegrator.h
+2
-2
No files found.
platforms/common/src/ExpressionUtilities.cpp
View file @
245f18cf
...
...
@@ -698,9 +698,16 @@ void ExpressionUtilities::processExpression(stringstream& out, const ExpressionT
case
Operation
::
POWER_CONSTANT
:
{
double
exponent
=
dynamic_cast
<
const
Operation
::
PowerConstant
*>
(
&
node
.
getOperation
())
->
getValue
();
if
(
exponent
==
0.0
)
if
(
exponent
==
0.0
)
{
if
(
isVecType
)
out
<<
"make_"
<<
tempType
<<
"(1.0f)"
;
else
out
<<
"1.0f"
;
}
else
if
(
exponent
==
(
int
)
exponent
)
{
if
(
isVecType
)
out
<<
"make_"
<<
tempType
<<
"(0.0f);
\n
"
;
else
out
<<
"0.0f;
\n
"
;
temps
.
push_back
(
make_pair
(
node
,
name
));
hasRecordedNode
=
true
;
...
...
@@ -727,7 +734,7 @@ void ExpressionUtilities::processExpression(stringstream& out, const ExpressionT
}
}
out
<<
"{
\n
"
;
out
<<
"real
multiplier = "
<<
(
exponent
<
0.0
?
"RECIP("
:
"("
)
<<
getTempName
(
node
.
getChildren
()[
0
],
temps
)
<<
");
\n
"
;
out
<<
tempType
<<
"
multiplier = "
<<
(
exponent
<
0.0
?
"RECIP("
:
"("
)
<<
getTempName
(
node
.
getChildren
()[
0
],
temps
)
<<
");
\n
"
;
bool
done
=
false
;
while
(
!
done
)
{
done
=
true
;
...
...
tests/TestCustomIntegrator.h
View file @
245f18cf
...
...
@@ -543,7 +543,7 @@ void testPerDofVariables() {
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputePerDof
(
"pos"
,
"x"
);
integrator
.
addComputePerDof
(
"computed"
,
"step(v)*log(x^
2
)"
);
integrator
.
addComputePerDof
(
"computed"
,
"step(v)*log(x^
4
)"
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
vector
<
Vec3
>
initialValues
(
numParticles
);
...
...
@@ -571,7 +571,7 @@ void testPerDofVariables() {
}
else
{
double
v
=
state
.
getPositions
()[
j
][
k
];
ASSERT_EQUAL_TOL
(
log
(
v
*
v
),
values
[
j
][
k
],
1e-5
);
ASSERT_EQUAL_TOL
(
log
(
v
*
v
*
v
*
v
),
values
[
j
][
k
],
1e-5
);
}
}
}
...
...
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