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
d817b46b
Commit
d817b46b
authored
Feb 13, 2012
by
Peter Eastman
Browse files
Improved rounding behavior when computing the number of ions to add
parent
285a4d88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
wrappers/python/simtk/openmm/app/modeller.py
wrappers/python/simtk/openmm/app/modeller.py
+1
-1
No files found.
wrappers/python/simtk/openmm/app/modeller.py
View file @
d817b46b
...
@@ -316,7 +316,7 @@ class Modeller(object):
...
@@ -316,7 +316,7 @@ class Modeller(object):
# Add ions to neutralize the system.
# Add ions to neutralize the system.
totalCharge
=
int
(
sum
((
nonbonded
.
getParticleParameters
(
i
)[
0
].
value_in_unit
(
elementary_charge
)
for
i
in
range
(
system
.
getNumParticles
()))))
totalCharge
=
int
(
floor
(
0.5
+
sum
((
nonbonded
.
getParticleParameters
(
i
)[
0
].
value_in_unit
(
elementary_charge
)
for
i
in
range
(
system
.
getNumParticles
()))))
)
if
abs
(
totalCharge
)
>
len
(
addedWaters
):
if
abs
(
totalCharge
)
>
len
(
addedWaters
):
raise
Exception
(
'Cannot neutralize the system because the charge is greater than the number of available positions for ions'
)
raise
Exception
(
'Cannot neutralize the system because the charge is greater than the number of available positions for ions'
)
def
addIon
(
element
):
def
addIon
(
element
):
...
...
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