
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples_generated/tutorials/atomization.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_generated_tutorials_atomization.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_generated_tutorials_atomization.py:

.. _atomization:

Atomization energy
==================

The following script will calculate the atomization energy of a
nitrogen molecule.

.. GENERATED FROM PYTHON SOURCE LINES 9-13

.. code-block:: Python


    from ase import Atoms
    from ase.calculators.emt import EMT








.. GENERATED FROM PYTHON SOURCE LINES 14-17

First, an ``Atoms`` object containing one nitrogen is created and a
fast EMT calculator is attached to it simply as an argument.


.. GENERATED FROM PYTHON SOURCE LINES 17-21

.. code-block:: Python


    atom = Atoms('N')
    atom.calc = EMT()








.. GENERATED FROM PYTHON SOURCE LINES 22-25

The total energy for the isolated atom is then calculated
and stored in the ``e_atom`` variable.


.. GENERATED FROM PYTHON SOURCE LINES 25-28

.. code-block:: Python


    e_atom = atom.get_potential_energy()








.. GENERATED FROM PYTHON SOURCE LINES 29-32

The ``molecule`` object is defined, holding the nitrogen molecule at
the experimental bond length ``d=1.1`` Angstrom.


.. GENERATED FROM PYTHON SOURCE LINES 32-44

.. code-block:: Python


    d = 1.1
    molecule = Atoms('2N', [(0.0, 0.0, 0.0), (0.0, 0.0, d)])

    import matplotlib.pyplot as plt

    from ase.visualize.plot import plot_atoms

    fig, ax = plt.subplots()
    plot_atoms(molecule, ax, rotation=('90x,0y,90z'))
    ax.set_axis_off()




.. image-sg:: /examples_generated/tutorials/images/sphx_glr_atomization_001.png
   :alt: atomization
   :srcset: /examples_generated/tutorials/images/sphx_glr_atomization_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 45-48

The EMT calculator is then attached to the molecule
and the total energy is extracted into the ``e_molecule`` variable.


.. GENERATED FROM PYTHON SOURCE LINES 48-52

.. code-block:: Python


    molecule.calc = EMT()
    e_molecule = molecule.get_potential_energy()








.. GENERATED FROM PYTHON SOURCE LINES 53-57

The atomization energy is the energy required to break the bond,
meaning that it is the negative energetic difference between
the molecule and twice the single atom's energy.


.. GENERATED FROM PYTHON SOURCE LINES 57-60

.. code-block:: Python


    e_atomization = -1.0 * (e_molecule - 2 * e_atom)








.. GENERATED FROM PYTHON SOURCE LINES 61-63

Finally we print the relevant energies:


.. GENERATED FROM PYTHON SOURCE LINES 63-67

.. code-block:: Python


    print(f'Nitrogen atom energy: {e_atom:5.2f} eV')
    print(f'Nitrogen molecule energy: {e_molecule:5.2f} eV')
    print(f'Atomization energy: {e_atomization:5.2f} eV')




.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    Nitrogen atom energy:  5.10 eV
    Nitrogen molecule energy:  0.44 eV
    Atomization energy:  9.76 eV





.. _sphx_glr_download_examples_generated_tutorials_atomization.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: atomization.ipynb <atomization.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: atomization.py <atomization.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: atomization.zip <atomization.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
