mlchem.chem.manipulation.create_molecule¶
- create_molecule(mol_input: str | str_ | Mol, add_hydrogens: bool = False, show: bool = False, solid_sticks: bool = False, is_3d: bool = False, embedding_params: Literal['ETDG', 'ETKDG', 'ETKDGv2', 'ETKDGv3'] = 'ETKDGv3', size: tuple = [300, 300], optimise: bool = True, optimiser: Literal['MMFF94', 'UFF'] = 'MMFF94', random_seed: int = 61453) Mol | None¶
Create and optionally display a molecule from a SMILES string or RDKit Mol object.
Supports 2D/3D visualisation, hydrogen addition, geometry optimisation, and rendering options.
- Parameters:
mol_input (str or numpy.str_ or rdkit.Chem.rdchem.Mol) – The molecule input as a SMILES string, numpy string, or RDKit Mol object.
add_hydrogens (bool, optional) – Whether to add hydrogens to the molecule. Default is False.
show (bool, optional) – Whether to display the molecule. Default is False.
solid_sticks (bool, optional) – Whether to render the molecule as solid sticks. Default is False.
is_3d (bool, optional) – Whether to generate a 3D representation. Default is False.
embedding_params ({'ETDG', 'ETKDG', 'ETKDGv2', 'ETKDGv3'}, optional) – Embedding parameters for 3D generation. Default is ‘ETKDGv3’.
size (tuple, optional) – Size of the displayed image. Default is (300, 300).
optimise (bool, optional) – Whether to optimise the geometry. Default is True.
optimiser ({'MMFF94', 'UFF'}, optional) – Optimisation method. Default is ‘MMFF94’.
random_seed (int, optional) – Random seed for embedding. Default is 0xf00d.
- Returns:
The processed molecule object, or None if only visualisation is requested.
- Return type:
rdkit.Chem.rdchem.Mol or None