{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Computing standard thermodynamic properties of reactions\n", "\n", "

Written by Allan Leal (ETH Zurich) on Jan 21th, 2022

\n", "\n", "{attention}\n", "Always make sure you are using the [latest version of Reaktoro](https://anaconda.org/conda-forge/reaktoro). Otherwise, some new features documented on this website will not work on your machine and you may receive unintuitive errors. Follow these [update instructions](updating_reaktoro_via_conda) to get the latest version of Reaktoro!\n", "\n", "\n", "This tutorial demonstrates the use of Reaktoro for the computation of standard thermodynamic properties of a chemical reaction such as:\n", "\n", "* the equilibrium constant of reaction, $K_r$\n", "* the standard Gibbs energy of reaction, $\\Delta G_r^\\circ$\n", "* the standard Helmholtz energy of reaction, $\\Delta A_r^\\circ$\n", "* the standard enthalpy of reaction, $\\Delta H_r^\\circ$\n", "* the standard internal energy of reaction, $\\Delta U_r^\\circ$\n", "* the standard entropy of reaction, $\\Delta S_r^\\circ$\n", "* the standard volume of reaction, $\\Delta V_r^\\circ$\n", "* the standard heat capacity (constant pressure) of reaction, $\\Delta C_{P,r}^\\circ$\n", "* the standard heat capacity (constant volume) of reaction, $\\Delta C_{V,r}^\\circ$\n", "\n", "Reaktoro computes these reaction properties using the standard thermodynamic properties of the reacting species at a given temperature and pressure. For example, consider the reaction\n", "\n", "$$2\\mathrm{A}+3\\mathrm{B}=\\mathrm{C}.$$\n", "\n", "The standard Gibbs energy of this reaction is computed using\n", "\n", "$$\\Delta G_{r}^{\\circ}=G_{\\mathrm{C}}^{\\circ}-2G_{\\mathrm{A}}^{\\circ}-3G_{\\mathrm{B}}^{\\circ}.$$\n", "\n", "This rationale (stoichiometric property contribution from product species minus the contribution of reactant species) can be applied to all other standard thermodynamic properties (e.g., $\\Delta H_r^\\circ$) and every reaction. \n", "\n", "The equilibrium constant of the reaction is defined as:\n", "\n", "$$\\ln K_r = -\\dfrac{\\Delta G^{\\circ}_m}{RT}$$\n", "\n", "but it's often handled in logarithm base 10, $\\lg K_r = \\ln K_r/\\ln 10$.\n", "\n", "It's very easy to compute these reaction properties in Reaktoro as shown next:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+------------------------------------------------+-------------+-------------+\n", "| Property | Value | Unit |\n", "+------------------------------------------------+-------------+-------------+\n", "| Temperature | 298.15 | K |\n", "| Pressure | 101325 | Pa |\n", "| Equilibrium Constant (log base 10) | 13.9948 | - |\n", "| Delta Standard Gibbs Energy | -79882.2 | J/mol |\n", "| Delta Standard Enthalpy | -56358.9 | J/mol |\n", "| Delta Standard Volume | 2.22078e-05 | m3/mol |\n", "| Delta Standard Volume (Temperature Derivative) | 0 | m3/(mol*K) |\n", "| Delta Standard Volume (Pressure Derivative) | 0 | m3/(mol*Pa) |\n", "| Delta Standard Isobaric Heat Capacity | 0 | J/(mol*K) |\n", "| Delta Standard Isochoric Heat Capacity | 0 | J/(mol*K) |\n", "| Delta Standard Internal Energy | -56361.2 | J/mol |\n", "| Delta Standard Entropy | 78.8974 | J/(mol*K) |\n", "| Delta Standard Helmholtz Energy | -79884.4 | J/mol |\n", "+------------------------------------------------+-------------+-------------+\n" ] } ], "source": [ "from reaktoro import *\n", "\n", "db = PhreeqcDatabase(\"phreeqc.dat\")\n", "\n", "rxn = db.reaction(\"H+ + OH- = H2O\")\n", "\n", "rprops = rxn.props(25.0, \"C\", 1.0, \"atm\")\n", "print(rprops)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Another more complicated example (mineral dissolution reaction):" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+------------------------------------------------+--------------+-------------+\n", "| Property | Value | Unit |\n", "+------------------------------------------------+--------------+-------------+\n", "| Temperature | 313.15 | K |\n", "| Pressure | 101325 | Pa |\n", "| Equilibrium Constant (log base 10) | 6.19557 | - |\n", "| Delta Standard Gibbs Energy | -37143.6 | J/mol |\n", "| Delta Standard Enthalpy | -147695 | J/mol |\n", "| Delta Standard Volume | -6.64235e-05 | m3/mol |\n", "| Delta Standard Volume (Temperature Derivative) | 0 | m3/(mol*K) |\n", "| Delta Standard Volume (Pressure Derivative) | 0 | m3/(mol*Pa) |\n", "| Delta Standard Isobaric Heat Capacity | 0 | J/(mol*K) |\n", "| Delta Standard Isochoric Heat Capacity | 0 | J/(mol*K) |\n", "| Delta Standard Internal Energy | -147688 | J/mol |\n", "| Delta Standard Entropy | -353.031 | J/(mol*K) |\n", "| Delta Standard Helmholtz Energy | -37136.9 | J/mol |\n", "+------------------------------------------------+--------------+-------------+\n" ] } ], "source": [ "rxn = db.reaction(\"Kaolinite + 6*H+ = H2O + 2*H4SiO4 + 2*Al+3\")\n", "\n", "rprops = rxn.props(40.0, \"C\", 1.0, \"atm\")\n", "print(rprops)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That's it! As long as you specify species names that exists in the database, you are free to define your reaction as you wish." ] } ], "metadata": { "interpreter": { "hash": "e4e8b2f3ae27709963f14fd23a6560d362beea55eaec742263828e04d814e23c" }, "kernelspec": { "display_name": "Python 3.9.7 64-bit ('reaktoro-jupyter-book': conda)", "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.9" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }