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)