Skip to content

Commit

Permalink
lmp: do not apply scale factor to model deviation
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Dec 5, 2023
1 parent ea45295 commit 66cc41e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/third-party/lammps-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Evaluate the interaction of the system by using [Deep Potential][DP] or [Deep Po
This pair style takes the deep potential defined in a model file that usually has the .pb extension. The model can be trained and frozen by package [DeePMD-kit](https://github.com/deepmodeling/deepmd-kit), which can have either double or single float precision interface.

The model deviation evalulates the consistency of the force predictions from multiple models. By default, only the maximal, minimal and average model deviations are output. If the key `atomic` is set, then the model deviation of force prediction of each atom will be output.
The unit follows [LAMMPS units](#units) and the [scale factor](https://docs.lammps.org/pair_hybrid.html) is not applied.

By default, the model deviation is output in absolute value. If the keyword `relative` is set, then the relative model deviation of the force will be output, including values output by the keyword `atomic`. The relative model deviation of the force on atom $i$ is defined by

Expand Down
12 changes: 6 additions & 6 deletions source/lmp/pair_deepmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,12 @@ void PairDeepMD::compute(int eflag, int vflag) {
all_v_avg = sqrt(all_v_avg / 9);
}
if (rank == 0) {
all_v_max *= scale[1][1] * ener_unit_cvt_factor;
all_v_min *= scale[1][1] * ener_unit_cvt_factor;
all_v_avg *= scale[1][1] * ener_unit_cvt_factor;
all_f_max *= scale[1][1] * force_unit_cvt_factor;
all_f_min *= scale[1][1] * force_unit_cvt_factor;
all_f_avg *= scale[1][1] * force_unit_cvt_factor;
all_v_max *= ener_unit_cvt_factor;
all_v_min *= ener_unit_cvt_factor;
all_v_avg *= ener_unit_cvt_factor;
all_f_max *= force_unit_cvt_factor;
all_f_min *= force_unit_cvt_factor;
all_f_avg *= force_unit_cvt_factor;
fp << setw(12) << update->ntimestep << " " << setw(18) << all_v_max
<< " " << setw(18) << all_v_min << " " << setw(18) << all_v_avg
<< " " << setw(18) << all_f_max << " " << setw(18) << all_f_min
Expand Down

0 comments on commit 66cc41e

Please sign in to comment.