From b08051321c20ddf760ac9b4a3364131720fda6e4 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 5 Sep 2023 15:28:51 -0400 Subject: [PATCH 1/2] lmp: add unit_style requirement for compute deeptensor/atom The input of the model should be Angstron so that the unit style can only be metal or real. Signed-off-by: Jinzhe Zeng --- source/lmp/compute_deeptensor_atom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/lmp/compute_deeptensor_atom.cpp b/source/lmp/compute_deeptensor_atom.cpp index 6af57f0b3c..c4f6616aab 100644 --- a/source/lmp/compute_deeptensor_atom.cpp +++ b/source/lmp/compute_deeptensor_atom.cpp @@ -26,6 +26,12 @@ using namespace LAMMPS_NS; ComputeDeeptensorAtom::ComputeDeeptensorAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), dp(lmp), tensor(nullptr) { + if (!(strcmp(update->unit_style, "metal") == 0 || strcmp(update->unit_style, "real") == 0)) { + error->all(FLERR, + "Compute deeptensor/atom requires metal or real unit; please set it by " + "\"units metal\" or \"units real\""); + } + if (narg < 4) { error->all(FLERR, "Illegal compute deeptensor/atom command"); } From 1b3702c346e7ec4723abe45bebe8d87d0bc2c4b2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:29:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- source/lmp/compute_deeptensor_atom.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/lmp/compute_deeptensor_atom.cpp b/source/lmp/compute_deeptensor_atom.cpp index c4f6616aab..0de523e1bf 100644 --- a/source/lmp/compute_deeptensor_atom.cpp +++ b/source/lmp/compute_deeptensor_atom.cpp @@ -26,10 +26,12 @@ using namespace LAMMPS_NS; ComputeDeeptensorAtom::ComputeDeeptensorAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), dp(lmp), tensor(nullptr) { - if (!(strcmp(update->unit_style, "metal") == 0 || strcmp(update->unit_style, "real") == 0)) { - error->all(FLERR, - "Compute deeptensor/atom requires metal or real unit; please set it by " - "\"units metal\" or \"units real\""); + if (!(strcmp(update->unit_style, "metal") == 0 || + strcmp(update->unit_style, "real") == 0)) { + error->all( + FLERR, + "Compute deeptensor/atom requires metal or real unit; please set it by " + "\"units metal\" or \"units real\""); } if (narg < 4) {