Skip to content

Commit

Permalink
breaking(lmp): do not apply scale factor to model deviation (#3036)
Browse files Browse the repository at this point in the history
Resolves #3027.

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored Dec 6, 2023
1 parent 44aba83 commit 3c54949
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 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
15 changes: 7 additions & 8 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 All @@ -798,8 +798,7 @@ void PairDeepMD::compute(int eflag, int vflag) {
displacements, MPI_DOUBLE, 0, world);
if (rank == 0) {
for (int dd = 0; dd < all_nlocal; ++dd) {
std_f_all[tagrecv[dd] - 1] =
stdfrecv[dd] * scale[1][1] * force_unit_cvt_factor;
std_f_all[tagrecv[dd] - 1] = stdfrecv[dd] * force_unit_cvt_factor;
}
for (int dd = 0; dd < all_nlocal; ++dd) {
fp << " " << setw(18) << std_f_all[dd];
Expand Down

0 comments on commit 3c54949

Please sign in to comment.