Skip to content

Reaction Workflow

This workflow provides a tool to calculate the reaction energies from reactants and products.

In this first example, the the energy of forming a water molecule from atoms is calculated using GFN1-xTB level of theory:

import sierra
from sierra.inputs import *

method = XTBMethod()

water = Molecule(pubchem="water")
products = [water]

hydrogen = Molecule(data="H 0 0 0")
oxygen = Molecule(data="O 0 0 0")
reactants = [oxygen, hydrogen, hydrogen]

input = ReactionInput(reactants=reactants, products=products, method=method)

result = sierra.run(input)

print(f"Reaction energy: {result.energy:.6f} Hartree")
#> Reaction energy: -0.612930 Hartree
print(f"Summary: {result.string_summary()}")
#> Summary: O + H + H → H₂O  ΔE = -384.619 kcal/mol

Here the ReactionInput is configured with the reactants, products and energy method. The reactants and products are a list of Molecule objects. Energies for each of these are computed using the supplied method.

To avoid repeated calculations, it is also possible to supply a factor for each molecule. In the example above we could use reactants = [oxygen, (hydrogen, 2)].

The ReactionResult contains the energy and a convenience function .string_summary() can be used for display.

ReactionInput

Fields

method
products
reactants
workflow
  • Type: WorkflowIdentifier
  • Default: WorkflowIdentifier(name='reaction', image=None)

ReactionResult

Fields

All the fields in ReactionInput and the following:

computations
energy
  • Type: float

Functions

ReactionResult.string_summary

string_summary() -> str:

This function summarizes the results of a calculation using the ReactionWorkflow in a human-readable string format. This function does not take any arguments.

Returns

A str summarizing the reaction.