class kliff.analyzers.rmse.AnalyzerError(msg)[source]
class kliff.analyzers.rmse.EnergyForcesRMSE(calculator, energy=True, forces=True)[source]

Analyzer to compute the root-mean-square error (RMSE) for energy and forces.

The energy difference norm for a configuration is defined as:

e_\text{norm} = |e_\text{pred} - e_\text{ref}| / N,

where e_\text{pred} is the prediction of the total energy from the model, e_\text{ref} is the corresponding reference energy, and N is the number of atoms in the configuration. The division by N is applied only when normalize = True in run. Similarly, the forces difference norm for a configuration is defined as:

f_\text{norm} = || \bm f_\text{pred} - \bm f_\text{ref}|| / N,

where f_\text{pred} is the prediction of the forces on atoms from the model and f_\text{ref} is the corresponding reference forces, N is the number of atoms in the configuration. The division by N is applied only when normalize = True in run.

The RMSEs for energy and forces are defined as:

e_\text{RMSE} = \sqrt{ \frac{\sum_{m=1}^M e_\text{norm}^2}{M}}

and

f_\text{RMSE} = \sqrt{ \frac{\sum_{m=1}^M f_\text{norm}^2}{M}},

in which M is the total number of configurations in the dataset.

run(normalize=True, sort=None, path=None, verbose=1)[source]

Run the RMSE analyzer.

Parameters:
  • normalize (bool) – Whether to normalize the energy (forces) by the number of atoms in a configuration.

  • sort (str (optional)) – Sort per configuration information according to energy or forces. If None, no sort. This works only when per configuration information is requested, i.e. verbose > 0.

  • path (str (optional)) – Path to write out the results. If None, write to stdout, otherwise, write to the file specified by path. Note, if verbose==3, the difference of energy and forces will be written to a directory named energy_forces_RMSE-difference.

  • verbose (int (optional)) – Verbose level of the output info. Available values are: 0, 1, 2. If verbose=0, only output the energy and forces RMSEs for the dataset. If verbose==1, output the norms of the energy and forces for each configuration additionally. If verbose==2, output the difference of the energy and forces for each atom, and the information is written to extended XYZ files with the location specified by path.