xnn.common.benchmark.energy.fit_atomic_energies#

xnn.common.benchmark.energy.fit_atomic_energies(structures)[source]#

Least-squares fit per-element reference energies from total energies.

Solves C @ E0 ~= E_total where C[i, j] is the count of species j in structure i – the standard way to estimate E0s when they are not supplied (MACE’s average scheme). Structures without an energy are skipped.

Parameters:

structures (sequence of dict) – Structure dicts with atomic_numbers and energy.

Returns:

The sorted unique atomic numbers and their fitted reference energies.

Return type:

tuple of (list of int, list of float)

Raises:

ValueError – If no structure carries an energy.