Skip to content

Commit

Permalink
Tell py2 to use uniocde for xyz files
Browse files Browse the repository at this point in the history
  • Loading branch information
avirshup committed Jun 19, 2017
1 parent b83faa3 commit 65ba58f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions moldesign/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,16 @@ def write_trajectory(traj, filename=None, format=None, overwrite=True):
def read_pdb(f, assign_ccd_bonds=True):
""" Read a PDB file and return a molecule.
This uses the biopython parser to get the molecular structure, but uses internal parsers
to create bonds and biomolecular assembly data.
This uses ParmEd's parser to get the molecular structure, with additional functionality
to assign Chemical Component Dictionary bonds, detect missing residues, and find
biomolecular assembly information.
Note:
Users won't typically use this routine; instead, they'll use ``moldesign.read``, which will
delegate to this routine when appropriate.
Args:
f (filelike): filelike object giving access to the PDB file (must implement seek)
f (filelike): filelike object giving access to the PDB file (must implement readline+seek)
assign_ccd_bonds (bool): Use the PDB Chemical Component Dictionary (CCD) to create bond
topology (note that bonds from CONECT records will always be created as well)
Expand Down Expand Up @@ -325,10 +326,10 @@ def read_xyz(f):


def write_xyz(mol, fileobj):
fileobj.write(" %d\n%s\n" % (mol.num_atoms, mol.name))
fileobj.write(u" %d\n%s\n" % (mol.num_atoms, mol.name))
for atom in mol.atoms:
x, y, z = atom.position.value_in(mdt.units.angstrom)
fileobj.write("%s %24.14f %24.14f %24.14f\n" % (atom.element, x, y, z))
fileobj.write(u"%s %24.14f %24.14f %24.14f\n" % (atom.element, x, y, z))


@utils.exports
Expand Down

0 comments on commit 65ba58f

Please sign in to comment.