Skip to content

Commit

Permalink
better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 6, 2023
1 parent 1ac6aa0 commit c1fc38e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions prody/proteins/pdbfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,12 +1242,7 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):
Default is **False**, which means using hexadecimal instead.
NB: ChimeraX seems to prefer hybrid36 and may have problems with hexadecimal.
:type hybrid36: bool
"""
keepACSI = False
if hasattr(atoms, 'getACSIndex'):
initialACSI = atoms.getACSIndex()
keepACSI = True

"""
renumber = kwargs.get('renumber', True)

remark = str(atoms)
Expand All @@ -1268,6 +1263,7 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):

try:
acsi = atoms.getACSIndex()
had_atoms = True
except AttributeError:
try:
atoms = atoms.getAtoms()
Expand Down Expand Up @@ -1442,10 +1438,11 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):
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 had_atoms:
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 @@ -1618,8 +1615,8 @@ def writePDBStream(stream, atoms, csets=None, **kwargs):

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

if keepACSI:
atoms.setACSIndex(initialACSI)
if had_atoms:
atoms.setACSIndex(acsi)

writePDBStream.__doc__ += _writePDBdoc

Expand Down

0 comments on commit c1fc38e

Please sign in to comment.