pymatgen.analysis.reaction_calculator module¶
-
class
BalancedReaction(reactants_coeffs, products_coeffs)[source]¶ Bases:
monty.json.MSONableAn object representing a complete chemical reaction.
Reactants and products to be specified as dict of {Composition: coeff}.
- Parameters
({Composition (products_coeffs) – float}): Reactants as dict of {Composition: amt}.
({Composition – float}): Products as dict of {Composition: amt}.
-
TOLERANCE= 1e-06¶
-
property
all_comp¶ List of all compositions in the reaction.
-
calculate_energy(energies)[source]¶ Calculates the energy of the reaction.
- Parameters
({Composition (energies) – float}): Energy for each composition. E.g ., {comp1: energy1, comp2: energy2}.
- Returns
reaction energy as a float.
-
property
coeffs¶ Final coefficients of the calculated reaction
-
property
elements¶ List of elements in the reaction
-
static
from_string(rxn_string)[source]¶ Generates a balanced reaction from a string. The reaction must already be balanced.
- Parameters
rxn_string – The reaction string. For example, “4 Li + O2-> 2Li2O”
- Returns
BalancedReaction
-
get_el_amount(element)[source]¶ Returns the amount of the element in the reaction.
- Parameters
element (Element/Specie) – Element in the reaction
- Returns
Amount of that element in the reaction.
-
normalize_to(comp, factor=1)[source]¶ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified.
- Parameters
comp (Composition) – Composition to normalize to
factor (float) – Factor to normalize to. Defaults to 1.
-
normalize_to_element(element, factor=1)[source]¶ Normalizes the reaction to one of the elements. By default, normalizes such that the amount of the element is 1. Another factor can be specified.
- Parameters
element (Element/Specie) – Element to normalize to.
factor (float) – Factor to normalize to. Defaults to 1.
-
property
normalized_repr¶ A normalized representation of the reaction. All factors are converted to lowest common factors.
-
normalized_repr_and_factor()[source]¶ Normalized representation for a reaction For example,
4 Li + 2 O -> 2Li2Obecomes2 Li + O -> Li2O
-
property
products¶ List of products
-
property
reactants¶ List of reactants
-
class
ComputedReaction(reactant_entries, product_entries)[source]¶ Bases:
pymatgen.analysis.reaction_calculator.ReactionConvenience class to generate a reaction from ComputedEntry objects, with some additional attributes, such as a reaction energy based on computed energies.
- Parameters
reactant_entries ([ComputedEntry]) – List of reactant_entries.
product_entries ([ComputedEntry]) – List of product_entries.
-
property
all_entries¶ Equivalent of all_comp but returns entries, in the same order as the coefficients.
-
property
calculated_reaction_energy¶
-
class
Reaction(reactants, products)[source]¶ Bases:
pymatgen.analysis.reaction_calculator.BalancedReactionA more flexible class representing a Reaction. The reaction amounts will be automatically balanced. Reactants and products can swap sides so that all coefficients are positive. Normalizes so that the FIRST product (or products, if underdetermined) has a coefficient of one.
Reactants and products to be specified as list of pymatgen.core.structure.Composition. e.g., [comp1, comp2]
- Parameters
reactants ([Composition]) – List of reactants.
products ([Composition]) – List of products.