PourPy.pourbaix

Created on Sun May 14 11:01:46 2023

@author: anjakorber

Classes

PourbaixDiagram

PourbaixDiagram class that defines and plots a Pourbaix diagram.

Module Contents

class PourPy.pourbaix.PourbaixDiagram(reactive_system, line_inspection=False, HER=False, OER=False)

Bases: object

PourbaixDiagram class that defines and plots a Pourbaix diagram.

Parameters:
  • reactive_system (ReactiveSystem) – The reactive system for which the diagram is constructed.

  • HER (Reaction, optional) – Hydrogen Evolution Reaction.

  • OER (Reaction, optional) – Oxygen Evolution Reaction.

system
inspectorMode = False
stable_regions
solve()

Solve the Pourbaix diagram by computing the intersections of all Nernst equation reaction lines and the regions of stability enclosed between the lines.

show(backend='bokeh', plot_regions=False, labelling=True)

Plots the Pourbaix diagram using the specified plotting backend.

Parameters:

backend (str) – The plotting backend to use (either ‘bokeh’ or ‘matplotlib’).

Raises:

RuntimeError – If the specified backend is invalid.

_get_unique_constitutents()

Get a dictionary of unique constituents in the included in the reactive system. Species H+, e-, H2O(l), O2(g) and H2(g) are automatically excluded, as these species are unique constituents of the aqueous solvent bound by the HER and OER by default.

Returns:

A dictionary of unique constituents.

Return type:

dict

check_pH(pH_to_check)
_compute_intersections(unique_constituents: dict)

Compute intersections between the reactions marking the stablity region of each unique constituent.

Parameters:

unique_constituents (dict) – A dictionary of unique constituents.

static _compute_boundary_lines(system)

Compute the boundary lines that actually enclose the stability region of each unique constituent.

Parameters:

system (ReactiveSystem) – The reactive system.

_construct_stability_regions()

Construct stability regions on the Pourbaix diagram.

This method calculates stability regions for different constituents on the Pourbaix diagram and adds corner points where the computed intersection points are on the boundary of the diagram.

Returns:

None

Return type:

None

_polar_angle(point, reference_point)

Calculate the polar angle of a point relative to a reference intersection point.

Parameters:
  • point (tuple) – The point to calculate the angle for.

  • reference_point (tuple) – The reference point with respect to which the angle is calculated.

Returns:

The polar angle of the point relative to the reference point.

Return type:

float

_average_values(i)
get_stable_phases()

Get all stable phases within the created Pourbaix diagram.

Returns:

A list of stable phases.

Return type:

list

get_stable_phase_at(pH, potential)

Get the stable phase at a specific pH, potential coordinate relative to the reference electrode.

Parameters:
  • pH (float) – The pH value.

  • potential (float) – The potential value.

Returns:

The stable phase at the specified pH and potential.

Return type:

str

Raises:

warnings.warn if the point does not exist within the calculated range.

_get_matplotlib_plot(plot_regions=False, labelling=True)

Display the created Pourbaix diagram using Matplotlib.

Returns:

None

Return type:

None

_get_bokeh_plot(plot_regions=True, labelling=True)

Display and return the created Pourbaix diagram using Bokeh.

Returns:

Bokeh plot object.

Return type:

Bokeh.plotting.figure