Energy Baseline Shift: Remove a Large Constant Energy

The most common purpose of energy baseline shifting is to remove a large constant term from DFT total energies before training. Some ABACUS and CP2K datasets can still reach thousands or even tens of thousands of eV per atom, while the model needs to learn much smaller energy differences between structures. With float32 training, the large values consume significant digits; shifting the baseline close to zero preserves more numerical precision for those small differences.

In the energy plot, this usually appears as a systematic offset between DFT energies and NEP predictions while the relative shape of the point cloud remains the same. Shifting only changes the energy zero; it does not improve the model. If the points are scattered, curved, or only a few structures are off, inspect the model and data first.

1. 先看能量图

Open the dataset containing DFT energies and its corresponding NEP model in NEP Dataset Display, then inspect the energy scatter plot.

Energy plot and energy baseline shift button

After confirming a large overall baseline, click Energy baseline shift in the toolbar.

The shift changes energy in the current dataset. NepTrainKit records the value before the first shift as energy_original, but it does not automatically undo later shifts. Export a copy of the original data first.

2. 按这个例子设置

Energy baseline shift settings

For the first run, use the following settings:

  1. Leave Use existing preset empty.

  2. If the data come from the same software and computational settings, enter .* so all Config_type values share one baseline.

  3. Set Alignment mode to DFT to NEP. It uses the current NEP predictions to fit a baseline for each element and shifts the dataset’s DFT energies.

  4. Keep the default values for Max generations, Population size, and Convergence tolerance.

  5. Click OK and wait for the energy plot to redraw.

Do not fit each group separately just because the dataset contains multiple Config_type values. Even for the same software, separate fits can absorb small solver differences into the baselines; using .* for one calculation source is more robust.

Config_type grouping is mainly for distinguishing different energy-baseline sources. Split groups only when the dataset mixes different software, for example abacus.*;cp2k.*; separate rules with semicolons. Differences in functionals, pseudopotentials, or numerical settings affect more than the energy zero, so do not force such data together with a shift.

3. 看结果是否正确

Return to the energy plot after the shift:

Scatter plot after removing the systematic energy offset
  • The large absolute-energy baseline is removed, bringing energies into a numerical range better suited to training.

  • The point cloud moves close to the diagonal, indicating that the main difference came from the energy zero.

  • The relative ordering and shape of the point cloud should remain largely unchanged.

  • If the points remain widely scattered, do not repeat the shift. Check abnormal structures, grouping rules, and model error instead.

An energy baseline is not one constant subtracted from every structure. NepTrainKit subtracts element-specific baselines according to the element counts, so structures with different elements or atom counts can be handled in one dataset.

After checking the result, use Save to export a new file without overwriting the original training set. For the same kind of data in the future, select Save baseline as preset; a preset applies only when the elements and Config_type grouping match.