Reaction Factory
- class 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 creatingReaction
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 implementget_reaction()
. Your implementation can then pick which reaction to use for a particularEdgeGroup
. You will then pass an instance of yourReactionFactory
subclass to theTopologyGraph
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
(construction_state, edge_group)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