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
fed2d322
Commit
fed2d322
authored
Feb 05, 2016
by
peastman
Browse files
Merge pull request #1386 from peastman/dtglobal
Fixed another error in CustomIntegrator
parents
90ddfc31
c13a8697
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+1
-0
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+1
-0
tests/TestCustomIntegrator.h
tests/TestCustomIntegrator.h
+4
-4
No files found.
platforms/cuda/src/CudaKernels.cpp
View file @
fed2d322
...
...
@@ -6775,6 +6775,7 @@ void CudaIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarget
case DT:
if (value != globalValuesDouble[dtVariableIndex])
deviceGlobalsAreCurrent = false;
expressionSet.setVariable(dtVariableIndex, value);
globalValuesDouble[dtVariableIndex] = value;
cu.getIntegrationUtilities().setNextStepSize(value);
break;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
fed2d322
...
...
@@ -7053,6 +7053,7 @@ void OpenCLIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarg
case DT:
if (value != globalValuesDouble[dtVariableIndex])
deviceGlobalsAreCurrent = false;
expressionSet.setVariable(dtVariableIndex, value);
globalValuesDouble[dtVariableIndex] = value;
cl.getIntegrationUtilities().setNextStepSize(value);
break;
...
...
tests/TestCustomIntegrator.h
View file @
fed2d322
...
...
@@ -391,21 +391,21 @@ void testSum() {
}
CustomIntegrator
integrator
(
0.005
);
integrator
.
addGlobalVariable
(
"ke"
,
0
);
integrator
.
addGlobalVariable
(
"
kecopy
"
,
0
);
integrator
.
addGlobalVariable
(
"
temp
"
,
0
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputeSum
(
"ke"
,
"m*v*v/2"
);
integrator
.
addComputeGlobal
(
"
kecopy
"
,
"ke"
);
integrator
.
addComputeGlobal
(
"
temp
"
,
"ke
+dt
"
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
// See if the sum is being computed correctly.
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Energy
);
ASSERT_EQUAL_TOL
(
state
.
getKineticEnergy
(),
integrator
.
getGlobalVariable
(
0
),
1e-5
);
ASSERT_EQUAL
(
integrator
.
getGlobalVariable
(
0
),
integrator
.
getGlobalVariable
(
1
));
integrator
.
step
(
1
);
ASSERT_EQUAL_TOL
(
integrator
.
getGlobalVariable
(
0
)
+
integrator
.
getStepSize
(),
integrator
.
getGlobalVariable
(
1
),
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