def MyReadPDBMolecule(ifs, mol):
mol.Clear()
if OEReadPDBFile(ifs,mol):
OEDetermineConnectivity(mol)
OEFindRingAtomsAndBonds(mol)
OEPerceiveBondOrders(mol)
OEAssignImplicitHydrogens(mol)
OEAssignFormalCharges(mol)
OEAssignAromaticFlags(mol)
return 1
mol.Clear()
return 0
def MyWritePDBMolecule(ofs, mol):
if OEHasResidues(mol):
OEPDBOrderAtoms(mol)
else:
OEPerceiveResidues(mol)
if mol.GetDimension() < 3:
# If no co-ordinates, write out bonds and bond orders.
flags = OEPDBOFlag_ORDERS | OEPDBOFlag_BONDS;
else:
flags = OEPDBOFlag_DEFAULT;
OEWritePDBFile(ofs, mol, flags)