def generateKekulizedResonanceIsomers(mol): """ Generate the kekulized (single-double bond) form of the molecule. """ cython.declare(isomers=list, atom=Atom) isomers = [] for atom in mol.atoms: if atom.atomType.label == 'Cb' or atom.atomType.label == 'Cbf': break else: return isomers rdkitmol = generator.toRDKitMol(mol) # This perceives aromaticit isomer = parser.fromRDKitMol(Molecule(), rdkitmol)# This step Kekulizes the molecule isomer.updateAtomTypes() isomers.append(isomer) return isomers
def generateKekulizedResonanceIsomers(mol): """ Generate a kekulized (single-double bond) form of the molecule. Returns a single Kekule form, as an element of a list of length 1. If there's an error (eg. in RDKit) then it just returns an empty list. """ cython.declare(atom=Atom) for atom in mol.atoms: if atom.atomType.label == "Cb" or atom.atomType.label == "Cbf": break else: return [] try: rdkitmol = generator.toRDKitMol(mol) # This perceives aromaticity isomer = parser.fromRDKitMol(Molecule(), rdkitmol) # This step Kekulizes the molecule except ValueError: return [] isomer.updateAtomTypes() return [isomer]
def generateKekulizedResonanceIsomers(mol): """ Generate a kekulized (single-double bond) form of the molecule. Returns a single Kekule form, as an element of a list of length 1. If there's an error (eg. in RDKit) then it just returns an empty list. """ cython.declare(atom=Atom) for atom in mol.atoms: if atom.atomType.label == 'Cb' or atom.atomType.label == 'Cbf': break else: return [] try: rdkitmol = generator.toRDKitMol(mol) # This perceives aromaticity isomer = parser.fromRDKitMol(Molecule(), rdkitmol) # This step Kekulizes the molecule except ValueError: return [] isomer.updateAtomTypes(logSpecies=False) return [isomer]
def generateKekuleStructure(mol): """ Generate a kekulized (single-double bond) form of the molecule. The specific arrangement of double bonds is non-deterministic, and depends on RDKit. Returns a single Kekule structure as an element of a list of length 1. If there's an error (eg. in RDKit) then it just returns an empty list. """ cython.declare(atom=Atom) for atom in mol.atoms: if atom.atomType.label == 'Cb' or atom.atomType.label == 'Cbf': break else: return [] try: rdkitmol = generator.toRDKitMol(mol) # This perceives aromaticity isomer = parser.fromRDKitMol(Molecule(), rdkitmol) # This step Kekulizes the molecule except ValueError: return [] isomer.updateAtomTypes(logSpecies=False) return [isomer]