コード例 #1
0
ファイル: resonance.py プロジェクト: rgillis8/RMG-Py
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
コード例 #2
0
ファイル: resonance.py プロジェクト: aelong/RMG-Py
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]
コード例 #3
0
ファイル: resonance.py プロジェクト: fredwbacon/RMG-Py
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]
コード例 #4
0
ファイル: resonance.py プロジェクト: bslakman/RMG-Py
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]