stko.MoleculeTransformer
- class stko.MoleculeTransformer(replacer_smarts, functional_groups)[source]
Bases:
objectSplit an stk.molecule into many with new functional groups.
- Parameters:
- Raises:
ValueError – If replacer_smarts does not correspond to a single atom.
Examples
Given a molecule, this class allows you to cap a split molecule (see
MoleculeSplitter) at the broken bond with an atom defined in replacer_smarts.import stk import stko full_mol = stk.BuildingBlock('C1=CC=NC(=C1)C=NC2=CC=C(C=C2)Br') splitter = stko.MoleculeSplitter( breaker_smarts='[#6X3]~[#7X2]~[#6X3H1]~[#6X3!H1]', bond_deleter_ids=(0, 1), ) split_mols = splitter.split(full_mol) transformer = stko.MoleculeTransformer( replacer_smarts='[Br]', functional_groups=(stk.BromoFactory(), ), ) for split in split_mols: transformed_mol = transformer.transform(split)
Methods
Transform a molecule.