Worked Example · D1

Balance Reference Reactions and Normalization

Use exact rational stoichiometry to compare an elemental formation reaction with a distinct compound-reservoir reaction for one abstract deterministic energy fixture.

Open the source records before balancing the reaction

A researcher normally begins with the candidate and reservoir structures, the calculation records that produced their energies, and the paper or database metadata defining the reference convention. Put stoichiometries and per-cell energies in a spreadsheet, balance the reaction by hand, and inspect whether charge, composition, method, and state identity are compatible before converting to a per-atom or per-formula-unit value. Use structure and data sources and literature sources to recover missing reference definitions.

Optional arithmetic check: the abstract reaction is a deterministic teaching fixture. Use it after writing the real reaction and inspecting its source records; it checks rational stoichiometry and normalization, not a material reaction or formation energy.

Use this fixture when you need to check reaction balance, coefficient signs, and reporting normalization before inserting calculated energies. It uses invented energies for abstract species A, B2, AB, and A2B3; none denotes a real material.

From the repository root, print the complete report:

python3 examples/practical-guides/formation_energy_reactions.py

Inspect both named reaction records, their signed coefficients, exact balances, and both normalizations. The command does not execute DFT.

Enter the reactions exactly

The fixture compares two distinct reservoir choices:

2 A+32 B2→A2B3,2\,\mathrm A+\frac{3}{2}\,\mathrm{B_2} \rightarrow \mathrm{A_2B_3}, 2 AB+12 B2→A2B3.2\,\mathrm{AB}+\frac{1}{2}\,\mathrm{B_2} \rightarrow \mathrm{A_2B_3}.

Both conserve two A atoms and three B atoms. The first is formation from declared elemental references; the second starts from an AB precursor and a B2 reservoir. They answer different questions.

Keep the coefficients exact when copying the written reactions into a ledger:

ReactionAB2ABA2B3
Elemental references−2-2−3/2-3/2—+1+1
Compound reservoir—−1/2-1/2−2-2+1+1

Reactants are negative and products positive. The first check is the net amount of every element and charge. Do not calculate an energy until each balance is zero.

Inspect the report

For either reaction,

ΔErxn=∑jνjEj.\Delta E_{\mathrm{rxn}}=\sum_j\nu_jE_j.

Confirm that the report preserves the written reaction, signed coefficients, exact balance, energy per formula unit, and energy per atom. The invented values are −0.50-0.50 eV per A2B3 formula unit for the elemental reaction and −0.10-0.10 eV per formula unit for the compound-reservoir reaction. Because A2B3 has five atoms, the corresponding fixture values are −0.10-0.10 and −0.02-0.02 eV per atom.

Those numbers check fixture arithmetic only. If a real ledger uses a different cell size, convert each energy to the same reaction extent before summing. Keep fitted references and database corrections as separate named terms.

Claim boundary

Accept the reaction object only when:

  • every conserved component balances exactly;
  • each energy corresponds to the object named by its coefficient;
  • the coefficient sign convention is explicit;
  • the formula-unit, atom, or reaction denominator is stored;
  • the same method and correction model applies to all accepted terms.

A negative result places the written products below the written reactants in the stated static model. It does not establish an omitted competitor, a barrier, finite-temperature equilibrium, calculation accuracy, or synthesizability. Move to a convex hull only after a compatible competitor ledger exists.

Official and primary sources

Ways to work: Python

Companion checked with: Python 3.12.

Reproducibility note

The companion material was checked with Python 3.12. It tests only the bounded software or analysis behaviour described here; it does not establish numerical convergence, model validity, or a material property.