stk.SmartsFunctionalGroupFactory

class stk.SmartsFunctionalGroupFactory(smarts, bonders, deleters, placers=None)[source]

Bases: FunctionalGroupFactory

Creates GenericFunctionalGroup instances.

Examples

Using SMARTS to Define Functional Groups

You want to create a building block which has GenericFunctionalGroup functional groups based on the SMARTS string: [Br][C]. You want the C atom to be the bonder atom, and the Br atom to be the deleter atom.

import stk

building_block = stk.BuildingBlock(
    smiles='BrCCCBr',
    functional_groups=(
        stk.SmartsFunctionalGroupFactory(
            smarts='[Br][C]',
            bonders=(1, ),
            deleters=(0, ),
        ),
    ),
)

See also

GenericFunctionalGroup

Defines bonders and deleters.

Initialize a SmartsFunctionalGroupFactory instance.

Parameters:
  • smarts (str) – The SMARTS defining the functional group.

  • bonders (tuple of int) – The indices of atoms in smarts, which are bonder atoms.

  • deleters (tuple of int) – The indices of atoms in smarts, which are deleter atoms.

  • placers (tuple of int, optional) – The indices of atoms in smarts, which are placer atoms. If None, the bonder atoms will be used.

Methods

get_functional_groups

Yield functional groups in molecule.

get_functional_groups(molecule)[source]

Yield functional groups in molecule.

Parameters:

molecule (Molecule) – The molecule, whose functional groups are to be found.

Yields:

FunctionalGroup – A functional group in molecule.

Examples

See FunctionalGroupFactory.