.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/thermo/thermochemistry/plot_01_hess_law.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_thermo_thermochemistry_plot_01_hess_law.py: Hess's law: reaction enthalpy does not depend on the path ========================================================= Burning graphite straight to :math:`CO_2` releases the same heat as burning it first to :math:`CO` and then burning the :math:`CO`. The enthalpy-level diagram below shows both routes, summed with :func:`~chemistrykit.thermo.systems.thermochemistry.hess_law_enthalpy`. The same principle lets :func:`~chemistrykit.thermo.systems.thermochemistry.reaction_enthalpy_from_formation` compute any reaction enthalpy from tabulated enthalpies of formation, shown here for the combustion of methane. .. GENERATED FROM PYTHON SOURCE LINES 16-41 .. code-block:: Python import matplotlib.pyplot as plt from chemistrykit.thermo.systems.thermochemistry import hess_law_enthalpy, reaction_enthalpy_from_formation dH_C_to_CO = -110.5 # C(graphite) + 1/2 O2 -> CO, kJ/mol dH_CO_to_CO2 = -283.0 # CO + 1/2 O2 -> CO2 dH_direct = hess_law_enthalpy([1.0, 1.0], [dH_C_to_CO, dH_CO_to_CO2]) levels = {"C + O2": 0.0, "CO + 1/2 O2": dH_C_to_CO, "CO2": dH_direct} fig, ax = plt.subplots(figsize=(7, 5)) for x, (label, H) in zip([0.0, 1.0, 2.0], levels.items()): ax.hlines(H, x - 0.3, x + 0.3, color="black", linewidth=2) ax.text(x, H + 10, label, ha="center") ax.annotate("", xy=(1.0, dH_C_to_CO), xytext=(0.0, 0.0), arrowprops=dict(arrowstyle="->", color="steelblue")) ax.annotate("", xy=(2.0, dH_direct), xytext=(1.0, dH_C_to_CO), arrowprops=dict(arrowstyle="->", color="steelblue")) ax.annotate("", xy=(2.0, dH_direct), xytext=(0.0, 0.0), arrowprops=dict(arrowstyle="->", color="crimson")) ax.text(0.35, -70, f"{dH_C_to_CO} kJ/mol", color="steelblue") ax.text(1.55, -230, f"{dH_CO_to_CO2} kJ/mol", color="steelblue") ax.text(0.7, -300, f"direct: {dH_direct} kJ/mol", color="crimson") ax.set_xlim(-0.6, 2.6) ax.set_xticks([]) ax.set_ylabel("enthalpy (kJ/mol)") ax.set_title("Two routes from graphite to CO2, one enthalpy change") fig.tight_layout() .. image-sg:: /api/gallery/thermo/thermochemistry/images/sphx_glr_plot_01_hess_law_001.png :alt: Two routes from graphite to CO2, one enthalpy change :srcset: /api/gallery/thermo/thermochemistry/images/sphx_glr_plot_01_hess_law_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 42-44 Methane combustion, :math:`CH_4 + 2O_2 \to CO_2 + 2H_2O(l)`, from standard enthalpies of formation (kJ/mol): .. GENERATED FROM PYTHON SOURCE LINES 44-51 .. code-block:: Python dHf = {"CH4": -74.8, "O2": 0.0, "CO2": -393.5, "H2O(l)": -285.8} dH_comb = reaction_enthalpy_from_formation([-1, -2, 1, 2], list(dHf.values())) print(f"Two-step graphite combustion: {dH_direct:.1f} kJ/mol") print(f"Methane combustion from formation enthalpies: {dH_comb:.1f} kJ/mol") plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none Two-step graphite combustion: -393.5 kJ/mol Methane combustion from formation enthalpies: -890.3 kJ/mol .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.038 seconds) .. _sphx_glr_download_api_gallery_thermo_thermochemistry_plot_01_hess_law.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_hess_law.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_hess_law.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_hess_law.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_