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
ba19d607
"platforms/hip/tests/TestHipSort.cpp" did not exist on "8d293880fd5efc3f7ba1471e27bb013bc76409f0"
Commit
ba19d607
authored
Oct 28, 2016
by
peastman
Browse files
Added error checking to axis particle indices
parent
5f509089
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
+20
-2
No files found.
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
View file @
ba19d607
...
...
@@ -50,7 +50,8 @@ AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() {
void
AmoebaMultipoleForceImpl
::
initialize
(
ContextImpl
&
context
)
{
const
System
&
system
=
context
.
getSystem
();
if
(
owner
.
getNumMultipoles
()
!=
system
.
getNumParticles
())
int
numParticles
=
system
.
getNumParticles
();
if
(
owner
.
getNumMultipoles
()
!=
numParticles
)
throw
OpenMMException
(
"AmoebaMultipoleForce must have exactly as many particles as the System it belongs to."
);
// check cutoff < 0.5*boxSize
...
...
@@ -64,7 +65,7 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
}
double
quadrupoleValidationTolerance
=
1.0e-05
;
for
(
int
ii
=
0
;
ii
<
system
.
getN
umParticles
()
;
ii
++
)
{
for
(
int
ii
=
0
;
ii
<
n
umParticles
;
ii
++
)
{
int
axisType
,
multipoleAtomZ
,
multipoleAtomX
,
multipoleAtomY
;
double
charge
,
thole
,
dampingFactor
,
polarity
;
...
...
@@ -121,6 +122,23 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
buffer
<<
"] (ZThenX, Bisector, Z-Bisect, ThreeFold, NoAxisType) currently handled ."
;
throw
OpenMMException
(
buffer
.
str
());
}
if
(
axisType
!=
AmoebaMultipoleForce
::
NoAxisType
&&
(
multipoleAtomZ
<
0
||
multipoleAtomZ
>=
numParticles
))
{
std
::
stringstream
buffer
;
buffer
<<
"AmoebaMultipoleForce: invalid z axis particle: "
<<
multipoleAtomZ
;
throw
OpenMMException
(
buffer
.
str
());
}
if
(
axisType
!=
AmoebaMultipoleForce
::
NoAxisType
&&
axisType
!=
AmoebaMultipoleForce
::
ZOnly
&&
(
multipoleAtomX
<
0
||
multipoleAtomX
>=
numParticles
))
{
std
::
stringstream
buffer
;
buffer
<<
"AmoebaMultipoleForce: invalid x axis particle: "
<<
multipoleAtomX
;
throw
OpenMMException
(
buffer
.
str
());
}
if
((
axisType
==
AmoebaMultipoleForce
::
ZBisect
||
axisType
==
AmoebaMultipoleForce
::
ThreeFold
)
&&
(
multipoleAtomY
<
0
||
multipoleAtomY
>=
numParticles
))
{
std
::
stringstream
buffer
;
buffer
<<
"AmoebaMultipoleForce: invalid y axis particle: "
<<
multipoleAtomY
;
throw
OpenMMException
(
buffer
.
str
());
}
}
kernel
=
context
.
getPlatform
().
createKernel
(
CalcAmoebaMultipoleForceKernel
::
Name
(),
context
);
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
initialize
(
context
.
getSystem
(),
owner
);
...
...
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