From 65ba58f4f2b298d22b73d608e76296ef3b1304e7 Mon Sep 17 00:00:00 2001 From: Aaron Virshup Date: Sun, 18 Jun 2017 23:06:40 -0700 Subject: [PATCH] Tell py2 to use uniocde for xyz files --- moldesign/fileio.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/moldesign/fileio.py b/moldesign/fileio.py index d3e7ed6..85a4d6c 100644 --- a/moldesign/fileio.py +++ b/moldesign/fileio.py @@ -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) @@ -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