Reaction

class Reaction[source]

Bases: object

An abstract base class for reactions.

Reactions are used to add and remove atoms and bonds during ConstructedMolecule construction. Each subclass will implement a specific algorithm for doing this. Each Reaction instance should operate on a small set of directly relevant FunctionalGroup instances, and only modify the atoms and bonds of those instances. Normally, like 99% of the time, this should just be two functional groups, and you should ensure your topology graph only needs to react two functional groups at a time, if you can. However, stk does not actually care, and you can modify as many atoms and bonds as you want in any reaction.

See also

reaction_factory

Used for automated creation of Reaction instances. Typically, Reaction instances are not created directly, but only through some kind of ReactionFactory instance.

Notes

You might notice that the public method of this abstract base class, get_result(), is implemented. This is purely for convenience when implementing subclasses. The implemented public method is simply a default implementation, which can be safely ignored or overridden, when implementing subclasses. The private methods are an implementation detail of this default implementation. However, they are not implemented. To use the default implementation of get_result(), the private methods it relies on need to be implemented.

Examples

Subclass Implementation

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

Methods

get_result()

Get the result of carrying out the reaction.

get_result()[source]

Get the result of carrying out the reaction.

Returns

Holds the results of the reaction.

Return type

ReactionResult