stko.MoleculeTransformer

class stko.MoleculeTransformer(replacer_smarts, functional_groups)[source]

Bases: object

Split an stk.molecule into many with new functional groups.

Parameters:
  • replacer_smarts (str) – SMARTS string of atom to replace dummy atoms with. This must be a single atom.

  • functional_groups (Iterable[FunctionalGroupFactory]) – Functional group factories to use to define new building block.

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

Transform a molecule.

transform(molecule)[source]

Transform a molecule.

Parameters
molecule:

Molecule to modify.

Returns:

The resulting molecule.

Parameters:

molecule (Molecule)

Return type:

BuildingBlock