Diol Factory

class DiolFactory(bonders=(2, 3), deleters=(0, 1, 4, 5), placers=None)[source]

Bases: stk.molecular.functional_groups.factories.functional_group_factory.FunctionalGroupFactory

Creates Diol instances.

Creates functional groups from substructures, which match the [H][O][#6]~[#6][O][H] functional group string.

Examples

Creating Functional Groups with the Factory

You want to create a building block which has Diol functional groups. You want the carbon atoms in those functional groups to be the bonder atoms, and the OH groups to be a leaving groups.

import stk

building_block = stk.BuildingBlock(
    smiles='CCCC(O)C(O)CCCC',
    functional_groups=(stk.DiolFactory(), ),
)

Changing the Bonder and Deleter Atoms

You want to create a building block which has Diol functional groups. You want the oxygen atoms to be the bonder atoms and the hydrogen atoms to be the deleter atoms.

import stk

diol_factory = stk.DiolFactory(
    # The indices of the oxygen atoms in the functional
    # group string (see docstring) are 1 and 4.
    bonders=(1, 4),
    # The indices of the hydrogen atoms in the functional
    # group string (see docstring) are 0 and 5.
    deleters=(0, 5),
)
building_block = stk.BuildingBlock(
    smiles='CCCC(O)C(O)CCCC',
    functional_groups=(diol_factory, ),
)

See also

GenericFunctionalGroup

Defines bonders and deleters.

Methods

get_functional_groups(molecule)

Yield functional groups in molecule.

__init__(bonders=(2, 3), deleters=(0, 1, 4, 5), placers=None)[source]

Initialize a DiolFactory instance.

Parameters
  • bonders (tuple of int) – The indices of atoms in the functional group string, which are bonder atoms.

  • deleters (tuple of int) – The indices of atoms in the functional group string, which are deleter atoms.

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

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.