From 12eeaee8a4c605a09a0b01c8040f45b7341242fc Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 16 Feb 2022 13:48:10 -0500 Subject: [PATCH 1/4] Correct bug in PairHybridScaled::single --- src/pair_hybrid_scaled.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 68a6199e19..24158f46a0 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -68,14 +68,14 @@ void PairHybridScaled::compute(int eflag, int vflag) const int nvars = scalevars.size(); if (nvars > 0) { double *vals = new double[nvars]; - for (i = 0; i < nvars; ++i) { - j = input->variable->find(scalevars[i].c_str()); - if (j < 0) - error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]); - vals[i] = input->variable->compute_equal(j); + for (int k = 0; k < nvars; ++k) { + int m = input->variable->find(scalevars[k].c_str()); + if (m < 0) + error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]); + vals[k] = input->variable->compute_equal(m); } - for (i = 0; i < nstyles; ++i) { - if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]]; + for (int k = 0; k < nstyles; ++k) { + if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]]; } delete[] vals; } @@ -386,14 +386,14 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, const int nvars = scalevars.size(); if (nvars > 0) { double *vals = new double[nvars]; - for (i = 0; i < nvars; ++i) { - j = input->variable->find(scalevars[i].c_str()); - if (j < 0) - error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]); - vals[i] = input->variable->compute_equal(j); + for (int k = 0; k < nvars; ++k) { + int m = input->variable->find(scalevars[k].c_str()); + if (m < 0) + error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]); + vals[k] = input->variable->compute_equal(m); } - for (i = 0; i < nstyles; ++i) { - if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]]; + for (int k = 0; k < nstyles; ++k) { + if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]]; } delete[] vals; } @@ -593,7 +593,7 @@ void PairHybridScaled::init_svector() void PairHybridScaled::copy_svector(int itype, int jtype) { int n = 0; - Pair *this_style; + Pair *this_style = nullptr; // fill svector array. // copy data from active styles and use 0.0 for inactive ones From 793d76c546a0a9fe27cdec08ee98ff192e6c121b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 16 Feb 2022 17:40:34 -0500 Subject: [PATCH 2/4] Adjust epsilon in force-style tests --- unittest/force-styles/tests/atomic-pair-kim_lj.yaml | 2 +- unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml index 84bf844350..5663efccbf 100644 --- a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml +++ b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:03 2021 -epsilon: 5e-13 +epsilon: 1e-12 prerequisites: ! | pair kim pre_commands: ! | diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml index 0c4d543e7a..009ceb6359 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_off.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 -epsilon: 2e-08 +epsilon: 5e-08 prerequisites: ! | atom full pair buck/long/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml b/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml index 4f21995ed5..2d6626922f 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_coul_off.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:53 2021 -epsilon: 2e-08 +epsilon: 5e-08 prerequisites: ! | atom full pair lj/long/coul/long From d95f0b3cd5887143cd495f59b5fc30336ce41e7e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 16 Feb 2022 17:43:16 -0500 Subject: [PATCH 3/4] Adjust epsilon in force-style test --- unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml index 84b44bcb0a..e5d77898ec 100644 --- a/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml +++ b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Wed Aug 25 07:37:07 2021 -epsilon: 2e-12 +epsilon: 2e-9 skip_tests: single prerequisites: ! | pair lebedeva/z From f3e14e7b00a5d704f1d8ab75a9474dbb31e0efd0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Thu, 17 Feb 2022 12:58:30 -0500 Subject: [PATCH 4/4] Mark MolPairStyle:soft unstable --- unittest/force-styles/tests/mol-pair-soft.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/force-styles/tests/mol-pair-soft.yaml b/unittest/force-styles/tests/mol-pair-soft.yaml index e5be18374a..d7cba08f72 100644 --- a/unittest/force-styles/tests/mol-pair-soft.yaml +++ b/unittest/force-styles/tests/mol-pair-soft.yaml @@ -1,6 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:56 2021 +tags: unstable epsilon: 1.5e-12 prerequisites: ! | atom full