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
c13a8697
Commit
c13a8697
authored
Feb 05, 2016
by
Peter Eastman
Browse files
Fixed another error in CustomIntegrator
parent
90ddfc31
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 @
c13a8697
...
@@ -6775,6 +6775,7 @@ void CudaIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarget
...
@@ -6775,6 +6775,7 @@ void CudaIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarget
case DT:
case DT:
if (value != globalValuesDouble[dtVariableIndex])
if (value != globalValuesDouble[dtVariableIndex])
deviceGlobalsAreCurrent = false;
deviceGlobalsAreCurrent = false;
expressionSet.setVariable(dtVariableIndex, value);
globalValuesDouble[dtVariableIndex] = value;
globalValuesDouble[dtVariableIndex] = value;
cu.getIntegrationUtilities().setNextStepSize(value);
cu.getIntegrationUtilities().setNextStepSize(value);
break;
break;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
c13a8697
...
@@ -7053,6 +7053,7 @@ void OpenCLIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarg
...
@@ -7053,6 +7053,7 @@ void OpenCLIntegrateCustomStepKernel::recordGlobalValue(double value, GlobalTarg
case
DT
:
case
DT
:
if
(
value
!=
globalValuesDouble
[
dtVariableIndex
])
if
(
value
!=
globalValuesDouble
[
dtVariableIndex
])
deviceGlobalsAreCurrent
=
false
;
deviceGlobalsAreCurrent
=
false
;
expressionSet
.
setVariable
(
dtVariableIndex
,
value
);
globalValuesDouble
[
dtVariableIndex
]
=
value
;
globalValuesDouble
[
dtVariableIndex
]
=
value
;
cl
.
getIntegrationUtilities
().
setNextStepSize
(
value
);
cl
.
getIntegrationUtilities
().
setNextStepSize
(
value
);
break
;
break
;
...
...
tests/TestCustomIntegrator.h
View file @
c13a8697
...
@@ -391,21 +391,21 @@ void testSum() {
...
@@ -391,21 +391,21 @@ void testSum() {
}
}
CustomIntegrator
integrator
(
0.005
);
CustomIntegrator
integrator
(
0.005
);
integrator
.
addGlobalVariable
(
"ke"
,
0
);
integrator
.
addGlobalVariable
(
"ke"
,
0
);
integrator
.
addGlobalVariable
(
"
kecopy
"
,
0
);
integrator
.
addGlobalVariable
(
"
temp
"
,
0
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"v"
,
"v+dt*f/m"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputePerDof
(
"x"
,
"x+dt*v"
);
integrator
.
addComputeSum
(
"ke"
,
"m*v*v/2"
);
integrator
.
addComputeSum
(
"ke"
,
"m*v*v/2"
);
integrator
.
addComputeGlobal
(
"
kecopy
"
,
"ke"
);
integrator
.
addComputeGlobal
(
"
temp
"
,
"ke
+dt
"
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
// See if the sum is being computed correctly.
// See if the sum is being computed correctly.
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
integrator
.
step
(
1
);
State
state
=
context
.
getState
(
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Energy
);
ASSERT_EQUAL_TOL
(
state
.
getKineticEnergy
(),
integrator
.
getGlobalVariable
(
0
),
1e-5
);
ASSERT_EQUAL_TOL
(
state
.
getKineticEnergy
(),
integrator
.
getGlobalVariable
(
0
),
1e-5
);
ASSERT_EQUAL
(
integrator
.
getGlobalVariable
(
0
),
integrator
.
getGlobalVariable
(
1
));
ASSERT_EQUAL_TOL
(
integrator
.
getGlobalVariable
(
0
)
+
integrator
.
getStepSize
(),
integrator
.
getGlobalVariable
(
1
),
1e-5
);
integrator
.
step
(
1
);
}
}
}
}
...
...
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