PourPy.reaction

Created on Sun May 14 11:00:38 2023

@author: anjakorber

Classes

Reaction

Reaction class featuring all reaction-specific parameters of the (electro)chemical reactions to be included in the Pourbaix diagram.

Module Contents

class PourPy.reaction.Reaction(constituents, system)

Bases: object

Reaction class featuring all reaction-specific parameters of the (electro)chemical reactions to be included in the Pourbaix diagram.

constituents
system
__str__()

Return the string representation of the reaction, where all reactants appear on the left hand side and all products appear on the right of the reacton arrow.

Returns:

A string representation of the reaction, e.g., ‘H2O ⇄ H2 + 0.5*O2’.

Return type:

str

initialize()

Initialize the Reaction object by calculating various reaction-specific properties.

Returns:

None

Return type:

None

_get_reaction_string()

Create the string representation of the reaction, where all reactants appear on the left hand side and all products appear on the right of the reacton arrow.

Returns the string representation of the reaction, e.g., ‘H2O ⇄ H2 + O2’.

Returns:

A string representation of the reaction.

Return type:

str

_get_echem_reaction()

Checks if the reaction is an electrochemical reaction, i.e. whether it contains electrons, and returns True if it’s electrochemical, otherwise returns False.

Returns:

True if the reaction is electrochemical, False otherwise.

Return type:

bool

_get_pH_reaction()

Checks if the reaction is a pH-dependent reaction, i.e. whether it contains protons, and returns True if it’s pH-dependent, otherwise returns False.

Returns:

True if the reaction is pH-dependent, False otherwise.

Return type:

bool

property dGr: float

Calculate the standard Gibbs free energy change of the reaction from the standard molar Gibbs free energies of all reation costituents.

Returns:

The standard Gibbs free energy change of the reaction in joules per mole.

Return type:

float

property dHr: float

Calculate the standard enthalpy change of the reaction from the standard molar enthalpies of all reation costituents.

Returns:

The standard enthalpy change of the reaction in joules per mole.

Return type:

float

property dSr: float

Calculate the standard entropy change of the reaction from the standard Gibbs free energy and enthalpy.

Returns:

The standard entropy change of the reaction in joules per mole per degrees kelvin.

Return type:

float

property K

Calculate the equilibrium constant for the reaction from its standard Gibbs free energy.

Returns:

The equilibrium constant K for the reaction.

Return type:

float

property E0

Calculate the standard electrode potential for the reaction in volts vs. SHE from its standard Gibbs gree energy.

Returns:

The standard electrode potential E0 for the electrochemical reaction in volts vs. SHE, or 0 if the reaction is not an electrochemical reaction.

Return type:

float

property nElectrons

Retrieve the number of electrons involved in the reaction.

Returns:

The number of electrons involved in the electrochemical reaction, or 0 if the reaction is not an electrochemical reaction.

Return type:

float

property nProtons

Retrieve the number of protons involved in the reaction.

Returns:

The number of protons involved in the pH-dependent reaction, or 0 if the reaction is not pH-dependent.

Return type:

float

_get_Hlimit()

Retrieve the range of H+ activities corresponding to the pH limits of the Pourbaix diagram.

Returns:

An array of H+ activities.

Return type:

numpy.ndarray

property Q: float

Calculate the reaction quotient Q for the reaction.

Returns:

The reaction quotient Q for the reaction.

Return type:

float

property rQ: float

Calculate the reduced reaction quotient rQ excluding the activity contribution of protons.

Returns:

The reduced reaction quotient rQ for the reaction.

Return type:

float

property QpH: list

Calculate reaction quotient of the reaction at different H+ activities.

Returns:

A list of reaction quotients at different H+ ion concentrations.

Return type:

list

_get_pourbaixLine()

Calculate the Pourbaix line formulated by the reaction.

Returns:

A list of coordinates defining the Pourbaix line, depending on whether the reaction is potential- and/or pH-dependent.

Return type:

list

Raises:

ValueError – If the reaction is neither potential- nor pH-dependent.

_sanity_check()

Perform a sanity check on the total charge and atom balance of all species in the reaction.

Returns:

A message indicating whether charge and atom balances are correct or if there’s a warning.

Return type:

str

_balanced_charge()

Check if the reaction is charge-balanced.

Returns:

True if the reaction’s charge is balanced, False otherwise.

Return type:

bool

_balanced_atoms()

Check if the reaction has balanced numbers of atoms of each chemical element.

Returns:

True if the reaction’s atoms are balanced, False otherwise.

Return type:

bool