lambda_d

This keyword sets the weight \(\lambda_d\) of the loss term associated with energy differences between structures in the loss function. The syntax is:

lambda_d <weight>

Here, <weight> represents \(\lambda_d\), which must be a positive number. Without the keyword, the term is inactive.

Each line of the file ediff.in defines a linear combination \(k\) of the total energies of named structures, such as the difference \(E_a - E_b\) or the formation energy \(E_\mathrm{vac} + \frac{1}{2} E_\mathrm{O_2} - E_\mathrm{bulk}\). The contribution to the loss is

\[\lambda_d \left( \frac{1}{N_\mathrm{comb}} \sum_k w_k \left[ \sum_i c_{ki} \left( E_i - E_i^\mathrm{tar} \right) \right]^2 \right)^{1/2},\]

where \(E_i\) and \(E_i^\mathrm{tar}\) are the predicted and target total energies of structure \(i\) in eV, \(c_{ki}\) is its coefficient in combination \(k\), and \(w_k\) is the weight of the combination. The term is thus in eV of total energy, while the energy term of the loss function is in eV/atom. The sum runs over the \(N_\mathrm{comb}\) combinations whose structures all lie in the current mini-batch. The fields weight and energy_weight of the structures in train.xyz do not enter the term.

The keyword requires two inputs:

  1. a name= field on the comment line of each structure that takes part in a combination, see train.xyz and test.xyz,

  2. the file ediff.in, which lists the combinations.

Each combination is balanced in the number of atoms of each type, so that any uniform or per-type offset of the predicted energies cancels in it.

nep stops with an input error if ediff.in is missing or if none of its combinations has all its structures in train.xyz. Without the keyword, an ediff.in file is ignored. The keyword is only available for potential models and is an input error together with model_type 1 or model_type 2, also in prediction mode. In prediction mode of a potential model, the keyword has no effect.

When the term is active, loss.out has two additional columns, rmse_ediff_train and rmse_ediff_test.

Mini-batches

With a batch size smaller than the number of training structures, nep keeps the structures of each training combination in one mini-batch. The mini-batches then differ from those of a run without the term, also for the structures that take part in no combination. Structures linked through combinations form a group. The groups are dealt one by one into the mini-batch with the fewest structures, the larger groups first and groups of equal size in the order of their mean energy per atom. Large groups can make a mini-batch larger than the batch size, and nep then prints a warning with the size of the largest mini-batch. A mini-batch left empty is dropped, and nep prints the reduced number of mini-batches.