Alcohol Factory

class AlcoholFactory(bonders=(1), deleters=(2), placers=None)[source]

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

Creates Alcohol instances.

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

Examples

Creating Functional Groups with the Factory

You want to create a building block which has Alcohol functional groups. You want the oxygen atom in those functional groups to be the bonder atom, and the hydrogen atom to be the deleter atom.

import stk

building_block = stk.BuildingBlock(
    smiles='OCCCO',
    functional_groups=(stk.AlcoholFactory(), ),
)

Changing the Bonder and Deleter Atoms

You want to create a building block which has Alcohol functional groups. You want the OH group to be treated as a leaving group. This means the non-hydrogen atom bonded to oxygen is the bonder atom and both the oxygen and hydrogen atoms are deleter atoms.

import stk

alcohol_factory = stk.AlcoholFactory(
    # The index of the non-hydrogen atom connected to oxygen
    # is 0 in the functional group string (see docstring).
    bonders=(0, ),
    # The indices of the oxygen and hydrogen atoms in the
    # functional group string (see docstring) are
    # 1 and 2, respectively.
    deleters=(1, 2),
)
building_block = stk.BuildingBlock(
    smiles='OCCCO',
    functional_groups=(alcohol_factory, ),
)

See also

GenericFunctionalGroup

Defines bonders and deleters.

Methods

get_functional_groups(molecule)

Yield functional groups in molecule.

__init__(bonders=(1), deleters=(2), placers=None)[source]

Initialize an AlcoholFactory 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.