stk.ReactionFactory

class stk.ReactionFactory[source]

Bases: object

An abstract base class for reaction factories.

Reaction factories are responsible for creating Reaction instances. Different subclasses of this class will provide different options for creating Reaction instances.

If you want to change which reactions are used to create and delete atoms and bonds during ConstructedMolecule construction, you want to subclass this abstract base class and implement get_reaction(). Your implementation can then pick which reaction to use for a particular EdgeGroup. You will then pass an instance of your ReactionFactory subclass to the TopologyGraph initializer, so that it knows to use it.

Examples

Subclass Implementation

The source code of the subclasses, listed in reaction_factory, can serve as good examples.

Methods

get_reaction

Get a reaction to use on the edge_group.

get_reaction(construction_state, edge_group)[source]

Get a reaction to use on the edge_group.

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

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

Returns:

The reaction to use on the edge_group.

Return type:

Reaction