Generic Reaction Factory

class GenericReactionFactory(bond_orders=None)[source]

Bases: ReactionFactory

Create reactions for GenericFunctionalGroup instances.

This reaction factory assumes that the functional groups, which belong to the EdgeGroup passed to it, are GenericFunctionalGroup instances. It returns a Reaction suitable for two such instances.


get_reaction(construction_state, edge_group)

Get a reaction to use on the edge_group.


Initialize a GenericReactionFactory.


bond_orders (dict, optional) –

Maps a frozenset of GenericFunctionalGroup subclasses to the bond orders for their respective reactions, if a pair of functional groups is missing, a default bond order of 1 will be used for their reactions. If bond_orders is None, the following dict will be used

import stk

bond_orders = {
    frozenset({stk.PrimaryAmino, stk.Aldehyde}): 2,
    frozenset({stk.PrimaryAmino, stk.Aldehyde}): 2,
    frozenset({stk.Amide, stk.PrimaryAmino}): 2,
    frozenset({stk.Alkene}): 2,
    frozenset({stk.Alkyne}): 2,

This means that if you want to get a reaction for an amine and an aldehyde functional group, the reaction will create bonds with a bond order of 2.

get_reaction(construction_state, edge_group)[source]

Get a reaction to use on the edge_group.

  • construction_state (ConstructionState) – The state of the current construction.

  • edge_group (EdgeGroup) – The edge group for which a reaction should be found.


The reaction to use on the edge_group.

Return type: