Atomization

For the source code, see atomization_energy.

Introduction

The atomization energy, \(\Delta E\), of a molecule can be expressed as:

\[\Delta E = n_{\text{atom}} \times E_{\text{atom}} - E_{\text{molecule}}\]

Where:

  • \(\Delta E\) is the atomization energy of the molecule.

  • \(n_{\text{atom}}\) is the number of atoms.

  • \(E_{\text{atom}}\) is the energy of an isolated atom.

  • \(E_{\text{molecule}}\) is the energy of the molecule.

Example: Atomization energy of a molecule N2

Prepare the inputs and submit the workflow

[4]:
from ase.build import molecule
from ase import Atoms
from aiida import load_profile
from workgraph_collections.ase.espresso.atomization_energy import AtomizationEnergy
from aiida_pythonjob.config import config
# allow pickle
config["allow_pickle"] = True
load_profile()

# create input structure
n_atom = Atoms("N", pbc=True)
n_atom.center(vacuum=5.0)
n2_molecule = molecule("N2", pbc=True)
n2_molecule.center(vacuum=5.0)

metadata = {
    "options": {
        'prepend_text' : """eval "$(conda shell.posix hook)"
        conda activate aiida
        export OMP_NUM_THREADS=1
        """,
    }
}
pseudopotentials = {"N": "N.pbe-n-rrkjus_psl.1.0.0.UPF"}
pseudo_dir = "/home/xing/data/ase/espresso_pseudo"
# pseudo_dir = "/home/wang_x3/datas/pseudos/psl"
input_data = {
    "system": {"ecutwfc": 30, "ecutrho": 240,
               "occupations": "smearing",
                "degauss": 0.01,
                "smearing": "cold",},
}
#------------------------- Set the inputs -------------------------
wg = AtomizationEnergy.build_graph(atom=n_atom,
                       molecule=n2_molecule,
                       pseudopotentials=pseudopotentials,
                       input_data=input_data,
                       pseudo_dir=pseudo_dir,
                       computer="localhost",
                       metadata=metadata)

wg.to_html()
[4]:

Run the workflow

[2]:
wg.run()

09/04/2025 07:22:58 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator,pw_calculator1
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|continue_workgraph]: tasks ready to run: pw_calculator,pw_calculator1
09/04/2025 07:23:01 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 180062, 180075
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|on_wait]: Process status: Waiting for child processes: 180062, 180075
09/04/2025 07:23:04 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|update_task_state]: Task: pw_calculator, type: PYTHONJOB, finished.
09/04/2025 07:23:04 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|update_task_state]: Task: pw_calculator1, type: PYTHONJOB, finished.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|update_task_state]: Task: pw_calculator1, type: PYTHONJOB, finished.
09/04/2025 07:23:06 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|continue_workgraph]: tasks ready to run: calc_atomization_energy
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|continue_workgraph]: tasks ready to run: calc_atomization_energy
INFO:aiida_pythonjob.decorator:Executing process function, current stack status: 47 frames of 3000
09/04/2025 07:23:07 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|update_task_state]: Task: calc_atomization_energy, type: PYFUNCTION, finished.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|update_task_state]: Task: calc_atomization_energy, type: PYFUNCTION, finished.
09/04/2025 07:23:07 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|continue_workgraph]: tasks ready to run:
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|continue_workgraph]: tasks ready to run:
09/04/2025 07:23:07 AM <581732> aiida.orm.nodes.process.workflow.workchain.WorkChainNode: [REPORT] [180058|WorkGraphEngine|finalize]: Finalize workgraph.
REPORT:aiida.orm.nodes.process.workflow.workchain.WorkChainNode:[180058|WorkGraphEngine|finalize]: Finalize workgraph.

Print out the result

[3]:
#------------------------- Print the output -------------------------
print('Atomization energy:                  {:0.3f} eV'.format(wg.outputs.atomization_energy.value.value))
Atomization energy:                  16.262 eV