Creating a reactive system
[1]:
import pyPourbaix as pb
The pyPourbaix package includes 7 classes that handle the user-input thermodynamic and physiochemical data, (electro)chemical reactions as well as the generation of the final Pourbaix diagram. The first step in creating such a potential - pH diagram is to define the reactive system to be plotted. To do this, we create an object of the System class:
[2]:
reactive_system = pb.System()
Any object of the class System features a variety of physiochemical parameters, some specific to the elements to be included in the Pourbaix diagram and some others that every Pourbaix diagram requires. These non-optional parameters include the system temperature \(T\) in degree Kelvin, pressure \(P\) in bar as well as the upper and lower pH and potential limit \(E\). Their default values are deposited in the Defaults class and can be accessed by each object of the class System at any time. Their standard values are:
Temperature \(T = 298.15\) K.
Pressure \(P = 1.00\) bar.
Minimum potential \(E_{min} = -2.00\) V vs. SHE.
Maximum potential \(E_{max} = 2.00\) V vs. SHE.
Minimum pH = 0.
Maximum pH = 14.
These 6 parameters are required for any kind of Pourbaix diagram and don’t nessecarily have to be specified by the user. The reactive system also accesses a bunch of physical constants including the Faraday constant \(F\), the ideal gas constant \(R\) and the standard temperature \(T_0\) and pressure \(P_0\) required to e.g. calculate the standard equilibrium constant of the reactions added to the diagram. Their values are stored in the Constants class:
Faraday constant \(F = 96485.3321\) A/mol/sec.
Ideal gas constant \(R = 8.31446262\) J/mol/K.
Standard temperature \(T_0 = 298.15\) K.
Standard pressure \(P_0 = 1.00\) bar.
Tip: Any physiochemical property that does not deviate from these default values does not have to be specified to create the Pourbaix diagram. The System class retrieves all unspecified values automatically.
Suppose the user wants to plot a Pourbaix diagram at the slightly elevated temperature of \(T = 315.15\) K. The default temperature can easily be modified by setting the attribute .temperature to its desired value:
[3]:
reactive_system.temperature = 315.15
Similarly, the pressure can be modified using .pressure:
[4]:
reactive_system.pressure = 0.90
Sometimes, the broad default potential and pH space is well beyond the region of interest for the Pourbaix diagrams of certain elements. We may modify both boundaries by the comands .pHs and .electrode_potentials:
[5]:
reactive_system.pHs = (2,9)
reactive_system.electrode_potentials = (-1,1)
We have now accessed and defined all physiochemical parameters required for the Pourbaix diagram to be plotted. Before we proceed on to defining our first set of chemical reactions, we will have to add all elements to be included in the diagram. As we want to investigate the electrochemical stability of compounds in aqueous electrolytes, we will always require the elements hydrogen and oxygen. This can be achieved with the command .add_elements():
[6]:
reactive_system.add_elements(["O","H"])
We have now introduced all nessecary commands to plot our first reaction. Let’s move on.
Tip: As the elements hydrogen and oxygen are required for aqueous systems by default, they are included in the list of elements anyways.
Warning: Any string or letter in the element list that does not represent an element as displayed in the periodic system of elements will raise an error message.