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
04b1a060
Commit
04b1a060
authored
Oct 28, 2016
by
peastman
Committed by
GitHub
Oct 28, 2016
Browse files
Merge pull request #1655 from peastman/checkaxis
Added error checking to axis particle indices
parents
ff270126
ba19d607
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 @
04b1a060
...
@@ -50,7 +50,8 @@ AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() {
...
@@ -50,7 +50,8 @@ AmoebaMultipoleForceImpl::~AmoebaMultipoleForceImpl() {
void
AmoebaMultipoleForceImpl
::
initialize
(
ContextImpl
&
context
)
{
void
AmoebaMultipoleForceImpl
::
initialize
(
ContextImpl
&
context
)
{
const
System
&
system
=
context
.
getSystem
();
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."
);
throw
OpenMMException
(
"AmoebaMultipoleForce must have exactly as many particles as the System it belongs to."
);
// check cutoff < 0.5*boxSize
// check cutoff < 0.5*boxSize
...
@@ -64,7 +65,7 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
...
@@ -64,7 +65,7 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
}
}
double
quadrupoleValidationTolerance
=
1.0e-05
;
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
;
int
axisType
,
multipoleAtomZ
,
multipoleAtomX
,
multipoleAtomY
;
double
charge
,
thole
,
dampingFactor
,
polarity
;
double
charge
,
thole
,
dampingFactor
,
polarity
;
...
@@ -121,6 +122,23 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
...
@@ -121,6 +122,23 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
buffer
<<
"] (ZThenX, Bisector, Z-Bisect, ThreeFold, NoAxisType) currently handled ."
;
buffer
<<
"] (ZThenX, Bisector, Z-Bisect, ThreeFold, NoAxisType) currently handled ."
;
throw
OpenMMException
(
buffer
.
str
());
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
=
context
.
getPlatform
().
createKernel
(
CalcAmoebaMultipoleForceKernel
::
Name
(),
context
);
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
initialize
(
context
.
getSystem
(),
owner
);
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