PourPy.reaction =============== .. py:module:: PourPy.reaction .. autoapi-nested-parse:: Created on Sun May 14 11:00:38 2023 @author: anjakorber Classes ------- .. autoapisummary:: PourPy.reaction.Reaction Module Contents --------------- .. py:class:: Reaction(constituents, system) Bases: :py:obj:`object` Reaction class featuring all reaction-specific parameters of the (electro)chemical reactions to be included in the Pourbaix diagram. .. py:attribute:: constituents .. py:attribute:: system .. py:method:: __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. :return: A string representation of the reaction, e.g., 'H2O ⇄ H2 + 0.5*O2'. :rtype: str .. py:method:: initialize() Initialize the Reaction object by calculating various reaction-specific properties. :return: None :rtype: None .. py:method:: _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'. :return: A string representation of the reaction. :rtype: str .. py:method:: _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. :return: True if the reaction is electrochemical, False otherwise. :rtype: bool .. py:method:: _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. :return: True if the reaction is pH-dependent, False otherwise. :rtype: bool .. py:property:: dGr :type: float Calculate the standard Gibbs free energy change of the reaction from the standard molar Gibbs free energies of all reation costituents. :return: The standard Gibbs free energy change of the reaction in joules per mole. :rtype: float .. py:property:: dHr :type: float Calculate the standard enthalpy change of the reaction from the standard molar enthalpies of all reation costituents. :return: The standard enthalpy change of the reaction in joules per mole. :rtype: float .. py:property:: dSr :type: float Calculate the standard entropy change of the reaction from the standard Gibbs free energy and enthalpy. :return: The standard entropy change of the reaction in joules per mole per degrees kelvin. :rtype: float .. py:property:: K Calculate the equilibrium constant for the reaction from its standard Gibbs free energy. :return: The equilibrium constant K for the reaction. :rtype: float .. py:property:: E0 Calculate the standard electrode potential for the reaction in volts vs. SHE from its standard Gibbs gree energy. :return: The standard electrode potential E0 for the electrochemical reaction in volts vs. SHE, or 0 if the reaction is not an electrochemical reaction. :rtype: float .. py:property:: nElectrons Retrieve the number of electrons involved in the reaction. :return: The number of electrons involved in the electrochemical reaction, or 0 if the reaction is not an electrochemical reaction. :rtype: float .. py:property:: nProtons Retrieve the number of protons involved in the reaction. :return: The number of protons involved in the pH-dependent reaction, or 0 if the reaction is not pH-dependent. :rtype: float .. py:method:: _get_Hlimit() Retrieve the range of H+ activities corresponding to the pH limits of the Pourbaix diagram. :return: An array of H+ activities. :rtype: numpy.ndarray .. py:property:: Q :type: float Calculate the reaction quotient Q for the reaction. :return: The reaction quotient Q for the reaction. :rtype: float .. py:property:: rQ :type: float Calculate the reduced reaction quotient rQ excluding the activity contribution of protons. :return: The reduced reaction quotient rQ for the reaction. :rtype: float .. py:property:: QpH :type: list Calculate reaction quotient of the reaction at different H+ activities. :return: A list of reaction quotients at different H+ ion concentrations. :rtype: list .. py:method:: _get_pourbaixLine() Calculate the Pourbaix line formulated by the reaction. :return: A list of coordinates defining the Pourbaix line, depending on whether the reaction is potential- and/or pH-dependent. :rtype: list :raises ValueError: If the reaction is neither potential- nor pH-dependent. .. py:method:: _sanity_check() Perform a sanity check on the total charge and atom balance of all species in the reaction. :return: A message indicating whether charge and atom balances are correct or if there's a warning. :rtype: str .. py:method:: _balanced_charge() Check if the reaction is charge-balanced. :return: True if the reaction's charge is balanced, False otherwise. :rtype: bool .. py:method:: _balanced_atoms() Check if the reaction has balanced numbers of atoms of each chemical element. :return: True if the reaction's atoms are balanced, False otherwise. :rtype: bool