Example #1
0
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
Example #2
0
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]
Example #3
0
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]
Example #4
0
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]