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
54e86e72
Commit
54e86e72
authored
Oct 29, 2015
by
peastman
Browse files
Merge pull request #1221 from rmcgibbo/interaction-group-checkindex
Check for index validity when setting interaction groups
parents
6a985cfd
38e6be18
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
openmmapi/src/CustomNonbondedForce.cpp
openmmapi/src/CustomNonbondedForce.cpp
+8
-0
No files found.
openmmapi/src/CustomNonbondedForce.cpp
View file @
54e86e72
...
...
@@ -262,6 +262,10 @@ void CustomNonbondedForce::setFunctionParameters(int index, const std::string& n
}
int
CustomNonbondedForce
::
addInteractionGroup
(
const
std
::
set
<
int
>&
set1
,
const
std
::
set
<
int
>&
set2
)
{
for
(
set
<
int
>::
iterator
it
=
set1
.
begin
();
it
!=
set1
.
end
();
++
it
)
ASSERT_VALID_INDEX
(
*
it
,
particles
);
for
(
set
<
int
>::
iterator
it
=
set2
.
begin
();
it
!=
set2
.
end
();
++
it
)
ASSERT_VALID_INDEX
(
*
it
,
particles
);
interactionGroups
.
push_back
(
InteractionGroupInfo
(
set1
,
set2
));
return
interactionGroups
.
size
()
-
1
;
}
...
...
@@ -274,6 +278,10 @@ void CustomNonbondedForce::getInteractionGroupParameters(int index, std::set<int
void
CustomNonbondedForce
::
setInteractionGroupParameters
(
int
index
,
const
std
::
set
<
int
>&
set1
,
const
std
::
set
<
int
>&
set2
)
{
ASSERT_VALID_INDEX
(
index
,
interactionGroups
);
for
(
set
<
int
>::
iterator
it
=
set1
.
begin
();
it
!=
set1
.
end
();
++
it
)
ASSERT_VALID_INDEX
(
*
it
,
particles
);
for
(
set
<
int
>::
iterator
it
=
set2
.
begin
();
it
!=
set2
.
end
();
++
it
)
ASSERT_VALID_INDEX
(
*
it
,
particles
);
interactionGroups
[
index
].
set1
=
set1
;
interactionGroups
[
index
].
set2
=
set2
;
}
...
...
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