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
471cbbf0
Commit
471cbbf0
authored
Dec 03, 2012
by
Peter Eastman
Browse files
If a PDB file specifies elements, use them (see bug 1773)
parent
3835b2c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
44 deletions
+26
-44
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
+2
-20
wrappers/python/simtk/openmm/app/pdbfile.py
wrappers/python/simtk/openmm/app/pdbfile.py
+24
-24
No files found.
wrappers/python/simtk/openmm/app/internal/pdbstructure.py
View file @
471cbbf0
...
...
@@ -708,27 +708,9 @@ class Atom(object):
except
ValueError
:
self
.
formal_charge
=
None
# figure out atom element
try
:
#
First t
ry to find a sensible element symbol from columns 76-77
#
T
ry to find a sensible element symbol from columns 76-77
self
.
element
=
element
.
get_by_symbol
(
self
.
element_symbol
)
except
KeyError
:
# otherwise, deduce element from first two characters of atom name
# remove digits found in some hydrogen atom names
symbol
=
self
.
name_with_spaces
[
0
:
2
].
strip
().
lstrip
(
"0123456789"
)
try
:
# Some molecular dynamics PDB files, such as gromacs with ffamber force
# field, include 4-character hydrogen atom names beginning with "H".
# Hopefully elements like holmium (Ho) and mercury (Hg) will have fewer than four
# characters in the atom name. This problem is the fault of molecular
# dynamics code authors who feel the need to make up their own atom
# nomenclature because it is too tedious to read that provided by the PDB.
# These are the same folks who invent their own meanings for biochemical terms
# like "dipeptide". Clowntards.
if
len
(
self
.
name
)
==
4
and
self
.
name
[
0
:
1
]
==
"H"
:
self
.
element
=
element
.
hydrogen
else
:
self
.
element
=
element
.
get_by_symbol
(
symbol
)
except
KeyError
:
# OK, I give up
self
.
element
=
None
def
iter_locations
(
self
):
...
...
wrappers/python/simtk/openmm/app/pdbfile.py
View file @
471cbbf0
...
...
@@ -92,8 +92,8 @@ class PDBFile(object):
if
atomName
in
atomReplacements
:
atomName
=
atomReplacements
[
atomName
]
atomName
=
atomName
.
strip
()
element
=
None
element
=
atom
.
element
if
element
is
None
:
# Try to guess the element.
upper
=
atomName
.
upper
()
...
...
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