{ "cells": [ { "cell_type": "markdown", "id": "aa90a36c", "metadata": {}, "source": [ "# Evaluating standard thermodynamic properties of substances and reactions\n", "\n", "This tutorial demonstrates how to use Reaktoro to evaluate the standard thermodynamic properties of substances and\n", "reactions.\n", "\n", "> **Note:** If your main interest is on computing thermodynamic properties, rather than chemical equilibrium and\n", "kinetics modeling, you may want to check [ThermoFun](https://thermohub.org/thermofun/thermofun/), which is an\n", "excellent project dedicated for this task.\n", "\n", "First, we import the `reaktoro` package:" ] }, { "cell_type": "code", "execution_count": null, "id": "6f3636fe", "metadata": {}, "outputs": [], "source": [ "from reaktoro import *" ] }, { "cell_type": "markdown", "id": "a5db9bee", "metadata": {}, "source": [ "Then we create an object of class [Database](https://reaktoro.org/cpp/classReaktoro_1_1Database.html) to have\n", "access to a thermodynamic database that contains the necessary data and allows us to compute thermodynamic properties\n", "at a given temperature and pressure condition:" ] }, { "cell_type": "code", "execution_count": null, "id": "6fbece62", "metadata": {}, "outputs": [], "source": [ "db = Database('supcrt98.xml')" ] }, { "cell_type": "markdown", "id": "6bb95def", "metadata": {}, "source": [ "To evaluate the thermodynamic properties, we create a\n", "[Thermo](https://reaktoro.org/cpp/classReaktoro_1_1Thermo.html) object:" ] }, { "cell_type": "code", "execution_count": null, "id": "8f1e7041", "metadata": {}, "outputs": [], "source": [ "thermo = Thermo(db)" ] }, { "cell_type": "markdown", "id": "11b4c3f1", "metadata": {}, "source": [ "Below, we show how the standard Gibbs energy of Na+ is computed at 360 K and 10 bar:" ] }, { "cell_type": "code", "execution_count": null, "id": "67f54cf3", "metadata": {}, "outputs": [], "source": [ "T = 360.0 # temperature in K\n", "P = 10.0e5 # pressure in Pa (equivalent to 10 bar)\n", "G0 = thermo.standardPartialMolarGibbsEnergy(T, P, 'Na+')\n", "print(f'G0(Na+) = {G0.val} J/mol')" ] }, { "cell_type": "markdown", "id": "11ad8b7c", "metadata": {}, "source": [ "> **Note:** Use `G0.ddT` or `G0.ddP` to get temperature or pressure derivatives.\n", "\n", "We can also compute the log(*K*) of a reaction at given *T* and *P* as follows:" ] }, { "cell_type": "code", "execution_count": null, "id": "a391438a", "metadata": {}, "outputs": [], "source": [ "logK = thermo.logEquilibriumConstant(T, P, 'Ca++ + 2*Cl- = CaCl2(aq)')\n", "print(f'logK(Ca++ + 2*Cl- = CaCl2(aq)) = {logK.val}')" ] }, { "cell_type": "markdown", "id": "a30a6757", "metadata": {}, "source": [ "> **Note:** Use `logK.ddT` or `logK.ddP` to get temperature or pressure derivatives.\n", "\n", "The rest of the properties, e.g., the standard partial molar enthalpy, entropy, or internal energy of say\n", "Ca2+ at 250 K and 1 bar can be similarly accessed by the corresponding functions:" ] }, { "cell_type": "code", "execution_count": null, "id": "867eee88", "metadata": {}, "outputs": [], "source": [ "T = 250.0\n", "P = 1.0e5\n", "H = thermo.standardPartialMolarEnthalpy(T, P, 'Ca++')\n", "S = thermo.standardPartialMolarEntropy(T, P, 'Ca++')\n", "U = thermo.standardPartialMolarInternalEnergy(T, P, 'Ca++')\n", "\n", "print(f'H(Ca++) = {H.val} J/mol')\n", "print(f'S(Ca++) = {S.val} J/K')\n", "print(f'U(Ca++) = {U.val} J/mol')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }