{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Pourbaix Diagram for Copper"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pyPourbaix as pb"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Like elucidated in the previous examples, let's define the nessecarry Reactants for the hydrogen evolution reaction $(\\text{HER})$ and oxygen evolution reaction $(\\text{OER})$."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"species = ('H|+1|, state=aq, dGf=0, dHf=0, Sm=0',\n",
" 'H2, state=g, dGf=0, dHf=0, Sm=0',\n",
" 'e|-1|, state=e, dGf=0, dHf=0, Sm=0',\n",
" 'H2O, state=l, dGf=-2.37140E+05, dHf=-2.85830E+05, Sm=69.95',\n",
" 'O2, state=g, dGf=0, dHf=0, Sm=205.137')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The Pourbaix diagram of Copper is slightly more compley than the Pourbaix diagram of Aluminium. It involves 3 solid phases, crystalline $\\text{Cu}^{0}(\\text{s})$, copper oxide $\\text{Cu}_2\\text{O}(\\text{s})$ and copper hydroxide $\\text{Cu}(\\text{OH})_2(\\text{s})$:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"species = ('H|+1|, state=aq, dGf=0, dHf=0, Sm=0',\n",
" 'H2, state=g, dGf=0, dHf=0, Sm=0',\n",
" 'e|-1|, state=e, dGf=0, dHf=0, Sm=0',\n",
" 'H2O, state=l, dGf=-2.37140E+05, dHf=-2.85830E+05, Sm=69.95',\n",
" 'O2, state=g, dGf=0, dHf=0, Sm=205.137',\n",
" 'Cu|0|, state=s, dGf=0, dHf=0, Sm=33.15',\n",
" 'Cu2O|0|, state=s, dGf=-147.9E+03, dHf=0, Sm=92.36',\n",
" 'Cu(OH)2|0|, state=s, dGf=-359.92E+03, dHf=0, Sm=87.0'\n",
" )\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will again consider two aqueous species, $\\text{Cu}^{2+}$ predominantly present at acidic $\\text{pH}$ and $\\text{Cu}(\\text{OH})_4^{2-}$ that is preferrentially stabilised in alkaline media."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"species = ('H|+1|, state=aq, dGf=0, dHf=0, Sm=0',\n",
" 'H2, state=g, dGf=0, dHf=0, Sm=0',\n",
" 'e|-1|, state=e, dGf=0, dHf=0, Sm=0',\n",
" 'H2O, state=l, dGf=-2.37140E+05, dHf=-2.85830E+05, Sm=69.95',\n",
" 'O2, state=g, dGf=0, dHf=0, Sm=205.137',\n",
" 'Cu|0|, state=s, dGf=0, dHf=0, Sm=33.15',\n",
" 'Cu2O|0|, state=s, dGf=-147.9E+03, dHf=0, Sm=92.36',\n",
" 'Cu(OH)2|0|, state=s, dGf=-359.92E+03, dHf=0, Sm=87.0',\n",
" 'Cu|+2|, state=aq, dGf=65.04E+03, dHf=0, Sm=-98.0',\n",
" 'Cu(OH)4|-2|,state=aq, dGf=-657.48e+03, dHf=0, Sm=-175'\n",
" )\n",
"\n",
"db = pb.Database.from_default(species)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Having 5 rather that 4 stable constituents significantly increases the complexity of the final Pourbaix diagram. First of all, let's implement all $\\text{Cu}^{0}(\\text{s})$ oxidation reactions to form $\\text{Cu}^{2+}$, $\\text{Cu}_2\\text{O}(\\text{s})$ and $\\text{Cu}(\\text{OH})_4^{2-}$."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"\n",
"reactions = ('2H|+1| + 2e|-1| -> H2',\n",
" 'O2 + 4H|+1| + 4e|-1| -> 2H2O',\n",
" 'Cu|0| -> Cu|+2| + 2e|-1|',\n",
" 'Cu2O|0| + 2H|+1| + 2e|-1| -> 2Cu|0| + H2O',\n",
" 'Cu(OH)4|-2| + 4H|+1| + 2e|-1| -> Cu|0| + 4H2O'\n",
" )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The $\\text{Cu}(\\text{I})$ copper oxide $\\text{Cu}_2\\text{O}(\\text{s})$ furthermore features 3 potential and $\\text{pH}$-dependent transitions to the aqueous species $\\text{Cu}^{2+}$ and $\\text{Cu}(\\text{OH})_4^{2-}$ as well as the $\\text{Cu}(\\text{II})$ copper hydroxide $\\text{Cu}(\\text{OH})_2(\\text{s})$:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"reactions = ('2H|+1| + 2e|-1| -> H2',\n",
" 'O2 + 4H|+1| + 4e|-1| -> 2H2O',\n",
" 'Cu|0| -> Cu|+2| + 2e|-1|',\n",
" 'Cu2O|0| + 2H|+1| + 2e|-1| -> 2Cu|0| + H2O',\n",
" 'Cu(OH)4|-2| + 4H|+1| + 2e|-1| -> Cu|0| + 4H2O',\n",
" '2Cu|+2| + H2O + 2e|-1| -> Cu2O|0| + 2H|+1|',\n",
" '2Cu(OH)4|-2| + 6H|+1| + 2e|-1| -> Cu2O|0| + 7H2O',\n",
" '2Cu(OH)2|0| + 2H|+1| + 2e|-1| -> Cu2O|0| + 3H2O'\n",
" )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lastly, 2 potential-independent hydrolysis reactions mark the transitions between the 3 $\\text{Cu}(\\text{II})$ species $\\text{Cu}^{2+}$, $\\text{Cu}(\\text{OH})_2(\\text{s})$ and $\\text{Cu}(\\text{OH})_4^{2-}$:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"reactions = ('2H|+1| + 2e|-1| -> H2',\n",
" 'O2 + 4H|+1| + 4e|-1| -> 2H2O',\n",
" 'Cu|0| -> Cu|+2| + 2e|-1|',\n",
" 'Cu2O|0| + 2H|+1| + 2e|-1| -> 2Cu|0| + H2O',\n",
" 'Cu(OH)4|-2| + 4H|+1| + 2e|-1| -> Cu|0| + 4H2O',\n",
" '2Cu|+2| + H2O + 2e|-1| -> Cu2O|0| + 2H|+1|',\n",
" '2Cu(OH)4|-2| + 6H|+1| + 2e|-1| -> Cu2O|0| + 7H2O',\n",
" '2Cu(OH)2|0| + 2H|+1| + 2e|-1| -> Cu2O|0| + 3H2O',\n",
" 'Cu(OH)2|0| + 2H|+1| -> Cu|+2| + 2H2O',\n",
" 'Cu(OH)4|-2| + 2H|+1| -> Cu(OH)2|0| + 2H2O'\n",
" )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that 1 additional solid species added a total of 3 reactions to the Pourbaix diagram. By this time, setting up the reactive system should come natural:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"Cu_system = pb.System()\n",
"Cu_system.set_database(db)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As the transition of $\\text{Cu}^{0}(\\text{s})$ to $\\text{Cu}(\\text{OH})_4^{2-}$ is only visible at strongly alkaline pH, we will pick a borad $\\text{pH}$ interval of $[0, \\ 18]$."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"Cu_system.pHs = (0, 18)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will continue defining the reference electrode of our system. How about we pick the copper suphate electrode (CSE) this time, that sounds appropriate considering we want to generate a Pourbaix diagram of the element copper."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"Cu_system.reference_electrode = (\"CSE\",0.241)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's quickly define the electrode potential boundaries as well as all elements to be plotted. We will also set the activity of aqueous species to $\\{\\text{Cu}\\}_{\\text{aq}} = 1\\cdot10^{-3}$."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"Cu_system.electrode_potentials = (-1.5, 2)\n",
"Cu_system.add_elements([\"O\",\"H\",\"Cu\"])\n",
"Cu_system.set_aqueous_activity(\"Cu\",1e-3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After adding so many different reactions to the reactive system, users might have lost track. Luckily, we can easily get an overview over the reactive system and generate a summary of all reactions added using the print command like so:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-----------------------------System-----------------------------\n",
"Temperature : 298.15, Pressure : 1.0\n",
"----------------------------------------------------------------\n",
"\t1.0H₂ ⇄ 2.0H⁺¹ + 2.0e⁻¹\n",
"\t2.0H₂O ⇄ 1.0O₂ + 4.0H⁺¹ + 4.0e⁻¹\n",
"\t1.0Cu⁺² + 2.0e⁻¹ ⇄ 1.0Cu⁰\n",
"\t2.0Cu⁰ + 1.0H₂O ⇄ 1.0Cu₂O⁰ + 2.0H⁺¹ + 2.0e⁻¹\n",
"\t1.0Cu⁰ + 4.0H₂O ⇄ 1.0Cu(OH)₄⁻² + 4.0H⁺¹ + 2.0e⁻¹\n",
"\t1.0Cu₂O⁰ + 2.0H⁺¹ ⇄ 2.0Cu⁺² + 1.0H₂O + 2.0e⁻¹\n",
"\t1.0Cu₂O⁰ + 7.0H₂O ⇄ 2.0Cu(OH)₄⁻² + 6.0H⁺¹ + 2.0e⁻¹\n",
"\t1.0Cu₂O⁰ + 3.0H₂O ⇄ 2.0Cu(OH)₂⁰ + 2.0H⁺¹ + 2.0e⁻¹\n",
"\t1.0Cu⁺² + 2.0H₂O ⇄ 1.0Cu(OH)₂⁰ + 2.0H⁺¹\n",
"\t1.0Cu(OH)₂⁰ + 2.0H₂O ⇄ 1.0Cu(OH)₄⁻² + 2.0H⁺¹\n",
"----------------------------------------------------------------\n"
]
}
],
"source": [
"Cu_system.add_reactions(reactions)\n",
"print(Cu_system)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Likewise, we can inspect the database of species, together with all entered thermodynamic parameters:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----------------------------Database----------------------------\n",
"Species \t dGf\t dHf\t Sm\n",
"----------------------------------------------------------------\n",
"H|+1| \t 0.0\t 0.0\t 0.0\n",
"H2 \t 0.0\t 0.0\t 0.0\n",
"e|-1| \t 0.0\t 0.0\t 0.0\n",
"H2O \t-237140.0\t-285830.0\t 69.95\n",
"O2 \t 0.0\t 0.0\t 205.137\n",
"Cu|0| \t 0.0\t 0.0\t 33.15\n",
"Cu2O|0| \t-147900.0\t 0.0\t 92.36\n",
"Cu(OH)2|0|\t-359920.0\t 0.0\t 87.0\n",
"Cu|+2| \t 65040.0\t 0.0\t -98.0\n",
"Cu(OH)4|-2|\t-657480.0\t 0.0\t -175.0\n",
"----------------------------------------------------------------\n"
]
}
],
"source": [
"print(db)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's generate and plot the diagram using th plotting backend bokeh:"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"Cu_diagram = pb.PourbaixDiagram(Cu_system,HER=True,OER=True)\n",
"Cu_diagram.solve()\n",
"Cu_diagram.show(backend='bokeh',plot_regions=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It can be recognised that any of the $\\text{Cu}^{0}(\\text{s})$ oxidation reactions feature a potential greater than the hydrogen evolution line $\\text{E}_{\\text{H}^+/\\text{H}_2} = \\text{E}^0_{\\text{H}^+/\\text{H}_2} - 0.059\\times\\text{pH}$."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}