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
c2166480
Commit
c2166480
authored
Sep 27, 2016
by
peastman
Committed by
GitHub
Sep 27, 2016
Browse files
Merge pull request #1603 from peastman/unknownglobal
CustomIntegrator checks for writing to an unknown variable
parents
6cf592be
b44ff2fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
openmmapi/src/CustomIntegrator.cpp
openmmapi/src/CustomIntegrator.cpp
+10
-1
No files found.
openmmapi/src/CustomIntegrator.cpp
View file @
c2166480
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2011-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2011-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -63,6 +63,15 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
if
(
contextRef
.
getParameters
().
find
(
name
)
!=
contextRef
.
getParameters
().
end
())
throw
OpenMMException
(
"The Integrator defines a variable with the same name as a Context parameter: "
+
name
);
}
set
<
std
::
string
>
globalTargets
;
globalTargets
.
insert
(
globalNames
.
begin
(),
globalNames
.
end
());
globalTargets
.
insert
(
"dt"
);
for
(
map
<
string
,
double
>::
const_iterator
iter
=
contextRef
.
getParameters
().
begin
();
iter
!=
contextRef
.
getParameters
().
end
();
++
iter
)
globalTargets
.
insert
(
iter
->
first
);
for
(
int
i
=
0
;
i
<
computations
.
size
();
i
++
)
{
if
(
computations
[
i
].
type
==
ComputeGlobal
&&
globalTargets
.
find
(
computations
[
i
].
variable
)
==
globalTargets
.
end
())
throw
OpenMMException
(
"Unknown global variable: "
+
computations
[
i
].
variable
);
}
context
=
&
contextRef
;
owner
=
&
contextRef
.
getOwner
();
kernel
=
context
->
getPlatform
().
createKernel
(
IntegrateCustomStepKernel
::
Name
(),
contextRef
);
...
...
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