PourPy.system
Created on Mon Jul 24 09:50:23 2023
@author: fabioenricofurcas
Classes
System class that contains all required physiochemical parameters, elements and reacion constituents nessecary to create a pourbaix diagram. |
Module Contents
- class PourPy.system.System(filename=None)
System class that contains all required physiochemical parameters, elements and reacion constituents nessecary to create a pourbaix diagram.
- reactions = []
- elements
- property temperature
Get the system temperature.
- Returns:
Temperature in degrees Kelvin.
- Return type:
float
- property pressure
Get the system pressure.
- Returns:
Pressure in bar.
- Return type:
float
- property pHmin
Get the minimum pH value of the system.
- Returns:
Minimum pH value.
- Return type:
float
- property pHmax
Get the maximum pH value of the system.
- Returns:
Maximum pH value.
- Return type:
float
- property Emin
Get the minimum electrode potential value of the system.
- Returns:
Minimum electrode potential value in volts vs. SHE.
- Return type:
float
- property Emax
Get the maximum electrode potential value of the system.
- Returns:
Maximum electrode potential value in volts vs. SHE.
- Return type:
float
- property reference_electrode
Get the reference electrode information.
- Returns:
A tuple containing the reference electrode abbreviation and potential difference.
- Return type:
tuple
- set_database(database)
- __str__()
Generate a string of the System object containing all chemical reactions, its temperature and pressure.
- Returns:
String representation of the System.
- Return type:
str
- initialize()
Initialize all chemical reactions included in the system using its current physiochemical parameters.
- Returns:
None
- Return type:
None
- write_parameters_to_file(filename)
Writes a dictionary of standard system parameters and physical constants into a JSON file.
- Parameters:
filename (str) – Name of the JSON file to write parameters to.
R (float) – Ideal gas constant R = 8.31446262 J/mol/K.
F (float) – Faraday constant F = 96485.3321 A*s/mol.
T0 (float) – Standard temperature T0 = 298.15 degree Kelvin.
P0 (float) – Standard pressure P0 = 1.00 bar.
Reference_abbreviation (str) – Abbreviation of the reference electrode.
dE (float) – Potential difference of the reference electrode in volts vs. the standard hydrogen electrode.
T (float) – Temperature in degree Kelvin.
P (float) – Pressure in bar.
pHmin (float) – Minimum pH of the diagram.
pHmax (float) – Maximum pH of the diagram.
Emin (float) – Minimum potential of the diagram in volts vs. SHE.
Emax (float) – Maximum potential of the diagram in volts vs. SHE.
- read_parameters_from_file(filename)
Reads system parameters from a JSON file.
- Parameters:
filename (str) – Name of the JSON file to read parameters from.
- Returns:
None
- Return type:
None
- property pHs
Get the system pH range.
- Returns:
A tuple containing the minimum and maximum pH values.
- Return type:
tuple
- property electrode_potentials
Get the electrode potential range of the system and automatically check which value is the lower one an which one corresponds to the upper limit.
- Returns:
A tuple containing the minimum and maximum electrode potentials.
- Return type:
tuple
- property reference_abbreviation
Get the abbreviation of the reference electrode.
- Returns:
Abbreviation of the reference electrode.
- Return type:
str
- property deltaE
Get the potential difference of the reference electrode in volts vs. the standard hydrogen electrode.
- Returns:
Potential difference in volts.
- Return type:
float
- add_elements(elements: list)
Adds elements to the chemical system.
- Parameters:
elements (list) – List of chemical elements in the system.
- abstractmethod add_reactions(reactions)
- _(reactions: list)
Adds reactions to the chemical system.
- Parameters:
reactions (list) – List of chemical reactions in the system.
- read_reactions_from_file(filename: str)
Reads the reactions from a file and adds reactions to the chemical system
- Parameters:
filename (str) – filename with reactions
- set_aqueous_activity(element: str, activity: float)
Modifies the aqueous activity of singular elements previously defined to be included in the chemical system.
- Parameters:
element (str) – Chemical element in the system.
activity (float) – Chemical activity of element.
- _get_elements(elements)
Validates the user-input list of chemical elements and updates the dictionary in system_parameters.json to include a dictionary of elements together with their aqueous activities.
- Parameters:
elements (list) – List of chemical elements in the system.
- Raises:
ValueError – Error raised if the list of elements provided contains entries that are not in element_list of know and supported elements.
- Returns:
Dictionary of validated elements as keys and standard aqueous activities as values.
- Return type:
dict
- construct_reactions_from_reactants(reactants: dict)
Validates the user-input reactants and constructs reactions from reactants from a dictionary containing the reactants and their corresponding activities.
- Parameters:
reactants (dict) – A dictionary of reactants (species) as keys and their corresponding activities as values.
- Returns:
A Reaction object created based on the provided reactants and activities.
- Return type:
- Raises:
ValueError – If any reactant contains elements not yet added to the system.
- _get_reactions(reactions)
Validates the user-input list of chemical reactions to appear on the Pourbaix diagram.
- Parameters:
reactions (list) – List of chemical reactions in the system.
- Raises:
ValueError – Error raised if list entries are not in the form of a dictionary. Further error validation upon creating the reaction() object from each entry provided.
- Returns:
List of chemical reaction objects featuring the systems potential and pH limits as well as the temperature and pressure.
- Return type:
list
- _set_aqueous_activity(element: str, activity: float) dict
Validates the user-input element and corresponding chemical activity and updates the dictionary in system_parameters.json.
- Parameters:
element (str) – Chemical element whose activity is modified.
activity (float) – Chemical activity of the element.
- Raises:
ValueError – Error raised if element provided is not part of the chemical system.
- Returns:
Dictionary of elements as keys and updated standard aqueous activities as values.
- Return type:
dict