PourPy.reactant

Created on Sun May 14 10:57:37 2023

@author: anjakorber

Classes

Reactant

Reactant class that defines an ion, compound or electron including all required thermodynamic and molecular parameters.

Module Contents

class PourPy.reactant.Reactant(formula, state, dGf, dHf, Sm, elements)

Reactant class that defines an ion, compound or electron including all required thermodynamic and molecular parameters.

formula
state
charge = 0
atoms = 0
MW = 0.0
dGf
dHf
Sm
__str__()
initialize()

Initialize additional properties of the Reactant.

Returns:

None

Return type:

None

_get_formula(formula)

Validate and returns user-input chemical formula of the reactant.

Parameters:

formula – The chemical formula to validate.

Returns:

Validated chemical formula.

_get_state(state)

Validates and returns the user-input physical state of the reactant.

Parameters:

state – The physical state to validate.

Returns:

Validated physical state.

_get_charge()

Validates and returns the user-input charge of the reactant.

Returns:

The charge of the reactant, 0 if not present.

_get_atoms(elements)

Retrieves a dictionary of atoms in the reactant.

Returns:

A dictionary containing atom symbols as keys and their counts as values.

_get_molecular_weight(elements)

Calculates the molecular weight of the reactant.

Returns:

The molecular weight of the reactant in grams per mole.

_get_super_string(x)

Converts numeric characters in the formula of the reactant to Unicode superscript characters.

Parameters:

x – The input string to convert.

Returns:

The input string with numeric characters replaced by super-script characters.

_get_sub_string(x)

Converts numeric characters in the formula of the reactant to Unicode subscript characters.

Parameters:

x – The input string to convert.

Returns:

The input string with numeric characters replaced by sub-script characters.

_get_reactant_string()

Creates a formatted string representing the reactant formula.

Returns:

Formatted string representation of the reactant, including subscripts for number of atoms and superscripts for charge.