rdtools.resonance.rdkit_backend#
This module contains the function generating resonance structures.
- rdtools.resonance.rdkit_backend.generate_charged_resonance_structures(mol: RWMol, keep_isomorphic: bool = False, copy: bool = True, kekulize: bool = True, **kwargs: Any) list[Mol] #
Generate resonance structures for a charged molecule.
- Parameters:
mol (Chem.RWMol) – A charged molecule in RDKit RWMol.
keep_isomorphic (bool, optional) – If keep isomorphic resonance structures. Defaults to
False
.copy (bool, optional) – If copy the input molecule. Defaults to
True
.kekulize (bool, optional) – If kekulize the molecule in generating resonance structures. Defaults to
True
.**kwargs (Any) – Additional arguments for the resonance algorithms.
- Returns:
list[Chem.Mol] – a list of molecules with resonance structures.
- rdtools.resonance.rdkit_backend.generate_radical_resonance_structures(mol: RWMol, keep_isomorphic: bool = False, copy: bool = True, kekulize: bool = True, **kwargs: Any) list[Mol] #
Generate resonance structures for a radical molecule.
RDKit by design doesn’t work for radical resonance. The approach is a temporary workaround by replacing radical electrons by positive charges and generating resonance structures by RDKit ResonanceMolSupplier. Currently, this function only works for neutral radicals.
Known issues:
Phenyl radical only generate one resonance structure when
kekulize=True
, expecting 2.
- Parameters:
mol (Chem.RWMol) – A radical molecule in RDKit RWMol.
keep_isomorphic (bool, optional) – If keep isomorphic resonance structures. Defaults to
False
.copy (bool, optional) – If copy the input molecule. Defaults to
True
.kekulize (bool, optional) – If kekulize the molecule in generating resonance structures. Defaults to
True
.**kwargs (Any) – Additional arguments for the resonance algorithms.
- Returns:
list[Chem.Mol] – a list of molecules with resonance structures.
- rdtools.resonance.rdkit_backend.generate_resonance_structures(mol: RWMol, keep_isomorphic: bool = False, copy: bool = True, kekulize: bool = True, **kwargs: Any) list[Mol] #
Generate resonance structures with RDKit algorithm.
- Parameters:
mol (Chem.RWMol) – A charged molecule in RDKit RWMol.
keep_isomorphic (bool, optional) – If keep isomorphic resonance structures. Defaults to
False
.copy (bool, optional) – If copy the input molecule. Defaults to
True
.kekulize (bool, optional) – If kekulize the molecule in generating resonance structures. Defaults to
True
.**kwargs (Any) – Additional arguments for the resonance algorithms.
- Returns:
list[Chem.Mol] – a list of molecules with resonance structures.