Skip to content

Commit

Permalink
fix writePDB for anisous
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 3, 2023
1 parent eb11d09 commit 19af9a2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions prody/proteins/pdbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):
NB: ChimeraX seems to prefer hybrid36 and may have problems with hexadecimal.
:type hybrid36: bool
"""

initialACSI = atoms.getACSIndex()
renumber = kwargs.get('renumber', True)

remark = str(atoms)
Expand Down Expand Up @@ -1375,10 +1375,6 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):
if charges2[i] == '0+':
charges2[i] = ' '

anisous = atoms._getAnisous()
if anisous is not None:
anisous = np.array(anisous * 10000, dtype=int)

# write remarks
stream.write('REMARK {0}\n'.format(remark))

Expand Down Expand Up @@ -1441,6 +1437,12 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):
write = stream.write
num_ter_lines = 0
for m, coords in enumerate(coordsets):

atoms.setACSIndex(m)
anisous = atoms._getAnisous()
if anisous is not None:
anisous = np.array(anisous * 10000, dtype=int)

if multi:
write('MODEL{0:9d}\n'.format(m+1))

Expand Down Expand Up @@ -1612,6 +1614,8 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):

write('END ' + " "*74 + '\n')

atoms.setACSIndex(initialACSI)

writePDBStream.__doc__ += _writePDBdoc

def writePDB(filename, atoms, csets=None, autoext=True, **kwargs):
Expand Down

0 comments on commit 19af9a2

Please sign in to comment.