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
48d99fee
Commit
48d99fee
authored
Jan 02, 2016
by
John Chodera (MSKCC)
Browse files
Added more helpful error messages when atom type lookup fails.
parent
ab60c418
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+13
-2
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
48d99fee
...
...
@@ -113,7 +113,7 @@ class ForceField(object):
(for built in force fields), or an open file-like object with a
read() method from which the forcefield XML data can be loaded.
"""
self
.
_atomTypes
=
{}
self
.
_atomTypes
=
{}
# self._atomTypes[typename] = (atomclass, mass, element)
self
.
_templates
=
{}
self
.
_templateSignatures
=
{
None
:[]}
self
.
_atomClasses
=
{
''
:
set
()}
...
...
@@ -622,7 +622,18 @@ class ForceField(object):
sys
=
mm
.
System
()
for
atom
in
topology
.
atoms
():
sys
.
addParticle
(
self
.
_atomTypes
[
data
.
atomType
[
atom
]][
1
])
if
atom
not
in
data
.
atomType
:
raise
Exception
(
"Could not identify atom type for atom '%s'."
%
str
(
atom
))
typename
=
data
.
atomType
[
atom
]
if
typename
not
in
self
.
_atomTypes
:
msg
=
"Could not find typename '%s' for atom '%s' in list of known atom types.
\n
"
%
(
typename
,
str
(
atom
))
msg
+=
"Known atom types are: %s"
%
str
(
self
.
_atomTypes
.
keys
())
raise
Exception
(
msg
)
atomtype_data
=
self
.
_atomTypes
[
typename
]
mass
=
atomtype_data
[
1
]
sys
.
addParticle
(
mass
)
# Adjust masses.
...
...
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