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
3261df63
"platforms/cpu/vscode:/vscode.git/clone" did not exist on "6d356ddc0b08f014933f0ca3c17ee6dde2f0cdf7"
Commit
3261df63
authored
Jun 11, 2013
by
Robert McGibbon
Browse files
Avoid writing malformed output when the positions are too large.
parent
712a44cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
wrappers/python/simtk/openmm/app/pdbfile.py
wrappers/python/simtk/openmm/app/pdbfile.py
+11
-1
No files found.
wrappers/python/simtk/openmm/app/pdbfile.py
View file @
3261df63
...
@@ -278,7 +278,15 @@ class PDBFile(object):
...
@@ -278,7 +278,15 @@ class PDBFile(object):
else
:
else
:
atomName
=
atom
.
name
atomName
=
atom
.
name
coords
=
positions
[
posIndex
]
coords
=
positions
[
posIndex
]
print
>>
file
,
"ATOM %5d %-4s %3s %s%4d %8.3f%8.3f%8.3f 1.00 0.00"
%
(
atomIndex
%
100000
,
atomName
,
resName
,
chainName
,
(
resIndex
+
1
)
%
10000
,
coords
[
0
],
coords
[
1
],
coords
[
2
])
if
any
(
coord
>
9999.999
for
coord
in
coords
):
raise
PDBFormatOverFlowError
(
'Coordinates greater than'
' 9999.999 angstroms are not represntatable in'
' the fixed-width PDB format. Detected in ATOM'
' %5d %-4s %3s %s%4d'
%
(
atomIndex
%
100000
,
atomName
,
resName
,
chainName
,
(
resIndex
+
1
)
%
10000
))
line
=
"ATOM %5d %-4s %3s %s%4d %8.3f%8.3f%8.3f 1.00 0.00"
%
(
atomIndex
%
100000
,
atomName
,
resName
,
c
assert
len
(
line
)
==
66
,
'Fixed width overflow detected'
print
>>
file
,
line
posIndex
+=
1
posIndex
+=
1
atomIndex
+=
1
atomIndex
+=
1
if
resIndex
==
len
(
residues
)
-
1
:
if
resIndex
==
len
(
residues
)
-
1
:
...
@@ -297,3 +305,5 @@ class PDBFile(object):
...
@@ -297,3 +305,5 @@ class PDBFile(object):
"""
"""
print
>>
file
,
"END"
print
>>
file
,
"END"
class
PDBFormatOverFlowError
(
ValueError
):
pass
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