From 5ed24b330eaac2aea7f35e3071f88ab9543d6c6b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Aug 2020 21:46:18 -0400 Subject: [PATCH 001/370] add preliminary support for testing pair styles in the GPU package --- unittest/force-styles/test_pair_style.cpp | 115 +++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 2cc39f712d..3d45c2075a 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -109,7 +109,6 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new } else { command("variable newton_pair index off"); } - command("variable input_dir index " + INPUT_FOLDER); for (auto &pre_command : cfg.pre_commands) { @@ -124,6 +123,8 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new for (auto &pair_coeff : cfg.pair_coeff) { command("pair_coeff " + pair_coeff); } + command("pair_modify table 0"); + command("pair_modify table/disp 0"); for (auto &post_command : cfg.post_commands) { command(post_command); @@ -798,6 +799,118 @@ TEST(PairStyle, omp) if (!verbose) ::testing::internal::GetCapturedStdout(); }; +TEST(PairStyle, gpu) +{ + if (!LAMMPS::is_installed_pkg("GPU")) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"}; + + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); + + ::testing::internal::CaptureStdout(); + LAMMPS *lmp = init_lammps(argc, argv, test_config, false); + + std::string output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + + if (!lmp) { + std::cerr << "One or more prerequisite styles with /gpu suffix\n" + "are not available in this LAMMPS configuration:\n"; + for (auto &prerequisite : test_config.prerequisites) { + std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n"; + } + GTEST_SKIP(); + } + + EXPECT_THAT(output, StartsWith("LAMMPS (")); + EXPECT_THAT(output, HasSubstr("Loop time")); + + // abort if running in parallel and not all atoms are local + const int nlocal = lmp->atom->nlocal; + ASSERT_EQ(lmp->atom->natoms, nlocal); + + // skip over tests using tabulated coulomb + if ((lmp->force->pair->ncoultablebits > 0) || (lmp->force->pair->ndisptablebits > 0)) { + if (!verbose) ::testing::internal::CaptureStdout(); + cleanup_lammps(lmp, test_config); + if (!verbose) ::testing::internal::GetCapturedStdout(); + GTEST_SKIP(); + } + + // relax error a bit for GPU package + double epsilon = 7.5 * test_config.epsilon; + // relax test precision when using pppm and single precision FFTs +#if defined(FFT_SINGLE) + if (lmp->force->kspace && lmp->force->kspace->compute_flag) + if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; +#endif + const std::vector &f_ref = test_config.init_forces; + const std::vector &f_run = test_config.run_forces; + ErrorStats stats; + + auto f = lmp->atom->f; + auto tag = lmp->atom->tag; + stats.reset(); + for (int i = 0; i < nlocal; ++i) { + EXPECT_FP_LE_WITH_EPS(f[i][0], f_ref[tag[i]].x, epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon); + } + if (print_stats) std::cerr << "init_forces stats, newton off:" << stats << std::endl; + + auto pair = lmp->force->pair; + auto stress = pair->virial; + stats.reset(); + EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, 10 * epsilon); + if (print_stats) std::cerr << "init_stress stats, newton off:" << stats << std::endl; + + stats.reset(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, epsilon); + if (print_stats) std::cerr << "init_energy stats, newton off:" << stats << std::endl; + + if (!verbose) ::testing::internal::CaptureStdout(); + run_lammps(lmp); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + f = lmp->atom->f; + tag = lmp->atom->tag; + stats.reset(); + for (int i = 0; i < nlocal; ++i) { + EXPECT_FP_LE_WITH_EPS(f[i][0], f_run[tag[i]].x, 5 * epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][1], f_run[tag[i]].y, 5 * epsilon); + EXPECT_FP_LE_WITH_EPS(f[i][2], f_run[tag[i]].z, 5 * epsilon); + } + if (print_stats) std::cerr << "run_forces stats, newton off:" << stats << std::endl; + + stress = pair->virial; + stats.reset(); + EXPECT_FP_LE_WITH_EPS(stress[0], test_config.run_stress.xx, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[1], test_config.run_stress.yy, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[2], test_config.run_stress.zz, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[3], test_config.run_stress.xy, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[4], test_config.run_stress.xz, 10 * epsilon); + EXPECT_FP_LE_WITH_EPS(stress[5], test_config.run_stress.yz, 10 * epsilon); + if (print_stats) std::cerr << "run_stress stats, newton off:" << stats << std::endl; + + stats.reset(); + auto id = lmp->modify->find_compute("sum"); + auto energy = lmp->modify->compute[id]->compute_scalar(); + EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.run_vdwl, epsilon); + EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.run_coul, epsilon); + EXPECT_FP_LE_WITH_EPS((pair->eng_vdwl + pair->eng_coul), energy, epsilon); + if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl; + + if (!verbose) ::testing::internal::CaptureStdout(); + cleanup_lammps(lmp, test_config); + if (!verbose) ::testing::internal::GetCapturedStdout(); +}; + TEST(PairStyle, intel) { if (!LAMMPS::is_installed_pkg("USER-INTEL")) GTEST_SKIP(); From 13cf665712363469ef4fabab3afb20352bd6bc7e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Aug 2020 21:47:17 -0400 Subject: [PATCH 002/370] update pair style unit test input files to be compatible with testing GPU package styles --- unittest/force-styles/tests/atomic-pair-atm.yaml | 2 +- unittest/force-styles/tests/atomic-pair-edip.yaml | 2 +- unittest/force-styles/tests/atomic-pair-meam_c.yaml | 2 +- unittest/force-styles/tests/atomic-pair-meam_spline.yaml | 2 +- unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml | 2 +- unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml | 2 +- unittest/force-styles/tests/manybody-pair-airebo.yaml | 2 +- unittest/force-styles/tests/manybody-pair-airebo_00.yaml | 2 +- unittest/force-styles/tests/manybody-pair-airebo_m.yaml | 2 +- unittest/force-styles/tests/manybody-pair-airebo_m00.yaml | 2 +- unittest/force-styles/tests/manybody-pair-bop.yaml | 2 +- unittest/force-styles/tests/manybody-pair-bop_save.yaml | 2 +- unittest/force-styles/tests/manybody-pair-comb.yaml | 2 +- unittest/force-styles/tests/manybody-pair-comb3.yaml | 2 +- unittest/force-styles/tests/manybody-pair-extep.yaml | 2 +- unittest/force-styles/tests/manybody-pair-gw.yaml | 2 +- unittest/force-styles/tests/manybody-pair-gw_zbl.yaml | 2 +- unittest/force-styles/tests/manybody-pair-lcbop.yaml | 2 +- unittest/force-styles/tests/manybody-pair-meam_c.yaml | 2 +- unittest/force-styles/tests/manybody-pair-mliap_snap.yaml | 2 +- .../force-styles/tests/manybody-pair-mliap_snap_chem.yaml | 2 +- unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml | 2 +- unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml | 2 +- .../force-styles/tests/manybody-pair-polymorphic_tersoff.yaml | 2 +- unittest/force-styles/tests/manybody-pair-rebo.yaml | 2 +- unittest/force-styles/tests/manybody-pair-snap.yaml | 2 +- unittest/force-styles/tests/manybody-pair-snap_chem.yaml | 2 +- unittest/force-styles/tests/manybody-pair-sw-multi.yaml | 2 +- unittest/force-styles/tests/manybody-pair-sw.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff_table.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml | 2 +- unittest/force-styles/tests/manybody-pair-vashishta.yaml | 2 +- .../force-styles/tests/manybody-pair-vashishta_table.yaml | 2 +- unittest/force-styles/tests/manybody-pair_edip_multi.yaml | 2 +- unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml | 2 +- unittest/force-styles/tests/mol-pair-buck.yaml | 2 +- unittest/force-styles/tests/mol-pair-buck_coul_long.yaml | 2 +- unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml | 2 +- unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml | 2 +- unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml | 2 +- unittest/force-styles/tests/mol-pair-e3b.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_cubic.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml | 2 +- .../force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml | 2 +- .../force-styles/tests/mol-pair-lj_table_tip4p_table.yaml | 2 +- unittest/force-styles/tests/mol-pair-tip4p_cut.yaml | 4 ++-- unittest/force-styles/tests/mol-pair-tip4p_long.yaml | 2 +- unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml | 2 +- unittest/force-styles/tests/mol-pair-tip4p_table.yaml | 2 +- unittest/force-styles/tests/mol-pair-zbl.yaml | 2 +- 56 files changed, 57 insertions(+), 57 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-atm.yaml b/unittest/force-styles/tests/atomic-pair-atm.yaml index 3297ae8ba6..dc0db1e37d 100644 --- a/unittest/force-styles/tests/atomic-pair-atm.yaml +++ b/unittest/force-styles/tests/atomic-pair-atm.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair atm pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.metal pair_style: atm 12.0 5.0 diff --git a/unittest/force-styles/tests/atomic-pair-edip.yaml b/unittest/force-styles/tests/atomic-pair-edip.yaml index c46742a30c..f7a16be94d 100644 --- a/unittest/force-styles/tests/atomic-pair-edip.yaml +++ b/unittest/force-styles/tests/atomic-pair-edip.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pre_commands: ! | echo screen variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" atom_modify map array units metal lattice diamond 5.43 diff --git a/unittest/force-styles/tests/atomic-pair-meam_c.yaml b/unittest/force-styles/tests/atomic-pair-meam_c.yaml index 7e5e04f258..a254155a2b 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_c.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair meam/c pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.metal pair_style: meam/c diff --git a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml index 26b41e3246..e395d8b1b4 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair meam/spline pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.metal pair_style: meam/spline diff --git a/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml b/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml index 255a424c9e..e8c744851b 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pre_commands: ! | echo screen variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" atom_modify map array units metal lattice diamond 5.43 diff --git a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml index 4ac11509e6..635c57742c 100644 --- a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair polymorphic pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | change_box all x final 0 18 y final 0 18 z final 0 18 input_file: in.metal diff --git a/unittest/force-styles/tests/manybody-pair-airebo.yaml b/unittest/force-styles/tests/manybody-pair-airebo.yaml index 57c71a6325..1dfecf47f8 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair airebo pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.airebo pair_style: airebo 3.0 1 1 diff --git a/unittest/force-styles/tests/manybody-pair-airebo_00.yaml b/unittest/force-styles/tests/manybody-pair-airebo_00.yaml index 30fe7fde4e..408ed51ce0 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_00.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_00.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair airebo pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.airebo pair_style: airebo 3.0 0 0 diff --git a/unittest/force-styles/tests/manybody-pair-airebo_m.yaml b/unittest/force-styles/tests/manybody-pair-airebo_m.yaml index e5d4a97ec1..f57e9add95 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_m.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_m.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair airebo/morse pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.airebo pair_style: airebo/morse 3.0 1 1 diff --git a/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml b/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml index 50325ee197..770ee99d98 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair airebo/morse pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.airebo pair_style: airebo/morse 3.0 0 0 diff --git a/unittest/force-styles/tests/manybody-pair-bop.yaml b/unittest/force-styles/tests/manybody-pair-bop.yaml index 14ed8865a0..b750d77d8c 100644 --- a/unittest/force-styles/tests/manybody-pair-bop.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair bop pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" comm_modify cutoff 14.0 post_commands: ! | change_box all x final 0 14 y final 0 14 z final 0 14 diff --git a/unittest/force-styles/tests/manybody-pair-bop_save.yaml b/unittest/force-styles/tests/manybody-pair-bop_save.yaml index 72a2351f5d..c3102bcdcc 100644 --- a/unittest/force-styles/tests/manybody-pair-bop_save.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop_save.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair bop pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" comm_modify cutoff 14.0 post_commands: ! | change_box all x final 0 14 y final 0 14 z final 0 14 diff --git a/unittest/force-styles/tests/manybody-pair-comb.yaml b/unittest/force-styles/tests/manybody-pair-comb.yaml index 58de3040c3..6a18ab6733 100644 --- a/unittest/force-styles/tests/manybody-pair-comb.yaml +++ b/unittest/force-styles/tests/manybody-pair-comb.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair comb pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody-charge pair_style: comb diff --git a/unittest/force-styles/tests/manybody-pair-comb3.yaml b/unittest/force-styles/tests/manybody-pair-comb3.yaml index 1d44d5e289..4b79f2b5b0 100644 --- a/unittest/force-styles/tests/manybody-pair-comb3.yaml +++ b/unittest/force-styles/tests/manybody-pair-comb3.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair comb3 pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody-charge pair_style: comb3 polar_off diff --git a/unittest/force-styles/tests/manybody-pair-extep.yaml b/unittest/force-styles/tests/manybody-pair-extep.yaml index 2bc3ad35a7..1a490a0120 100644 --- a/unittest/force-styles/tests/manybody-pair-extep.yaml +++ b/unittest/force-styles/tests/manybody-pair-extep.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair extep pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: extep diff --git a/unittest/force-styles/tests/manybody-pair-gw.yaml b/unittest/force-styles/tests/manybody-pair-gw.yaml index b9e284293e..b01e0221f3 100644 --- a/unittest/force-styles/tests/manybody-pair-gw.yaml +++ b/unittest/force-styles/tests/manybody-pair-gw.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair gw pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: gw diff --git a/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml b/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml index 7d9fd2460d..6c5c302770 100644 --- a/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml +++ b/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair gw/zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: gw/zbl diff --git a/unittest/force-styles/tests/manybody-pair-lcbop.yaml b/unittest/force-styles/tests/manybody-pair-lcbop.yaml index c666afd3ae..6e07460668 100644 --- a/unittest/force-styles/tests/manybody-pair-lcbop.yaml +++ b/unittest/force-styles/tests/manybody-pair-lcbop.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair lcbop pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: lcbop diff --git a/unittest/force-styles/tests/manybody-pair-meam_c.yaml b/unittest/force-styles/tests/manybody-pair-meam_c.yaml index 2f5051abad..23593c1cca 100644 --- a/unittest/force-styles/tests/manybody-pair-meam_c.yaml +++ b/unittest/force-styles/tests/manybody-pair-meam_c.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair meam/c pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: meam/c diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml index a45d7a8f49..32927b9750 100644 --- a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: hybrid/overlay zbl 4.0 4.8 mliap model linear Ta06A.mliap.model descriptor diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml index e4719e6eb5..b5e6ca7b36 100644 --- a/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" variable zblz1 index 49 variable zblz2 index 15 post_commands: ! "" diff --git a/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml b/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml index bd33af6f16..c449e733ce 100644 --- a/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml +++ b/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair nb3b/harmonic pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" variable units delete variable units index real post_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml index 2aee0ed5fb..ba10a03e94 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair polymorphic pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | change_box all x final 0 9.8 y final 0 9.8 z final 0 9.8 input_file: in.manybody diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml index 2025068084..8f8ed15eeb 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair polymorphic pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | change_box all x final 0 9.9 y final 0 9.9 z final 0 9.9 input_file: in.manybody diff --git a/unittest/force-styles/tests/manybody-pair-rebo.yaml b/unittest/force-styles/tests/manybody-pair-rebo.yaml index 6cc14a8259..94c442cc58 100644 --- a/unittest/force-styles/tests/manybody-pair-rebo.yaml +++ b/unittest/force-styles/tests/manybody-pair-rebo.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair rebo pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.airebo pair_style: rebo diff --git a/unittest/force-styles/tests/manybody-pair-snap.yaml b/unittest/force-styles/tests/manybody-pair-snap.yaml index 2dc2b6a568..e1d466f1f0 100644 --- a/unittest/force-styles/tests/manybody-pair-snap.yaml +++ b/unittest/force-styles/tests/manybody-pair-snap.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: hybrid/overlay zbl 4.0 4.8 snap diff --git a/unittest/force-styles/tests/manybody-pair-snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml index 8e8c2c8f86..10098a64d9 100644 --- a/unittest/force-styles/tests/manybody-pair-snap_chem.yaml +++ b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: hybrid/overlay zbl 4.0 4.2 snap diff --git a/unittest/force-styles/tests/manybody-pair-sw-multi.yaml b/unittest/force-styles/tests/manybody-pair-sw-multi.yaml index 45d912c0c2..5152d63b2a 100644 --- a/unittest/force-styles/tests/manybody-pair-sw-multi.yaml +++ b/unittest/force-styles/tests/manybody-pair-sw-multi.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair sw pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: sw diff --git a/unittest/force-styles/tests/manybody-pair-sw.yaml b/unittest/force-styles/tests/manybody-pair-sw.yaml index 0d18a55a9d..f3744ec031 100644 --- a/unittest/force-styles/tests/manybody-pair-sw.yaml +++ b/unittest/force-styles/tests/manybody-pair-sw.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair sw pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: sw diff --git a/unittest/force-styles/tests/manybody-pair-tersoff.yaml b/unittest/force-styles/tests/manybody-pair-tersoff.yaml index b3f2e22f48..c3c6b39fd8 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair tersoff pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: tersoff diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml index 6427c8f9fa..5f6655aeb1 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair tersoff/mod pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: tersoff/mod diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml index f172c97895..e14866b11c 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair tersoff/mod/c pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: tersoff/mod/c diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml index 3cb005cf46..36a30ac27b 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair tersoff/table pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: tersoff/table diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml index d11fed80ca..05808d5520 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair tersoff/zbl pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: tersoff/zbl diff --git a/unittest/force-styles/tests/manybody-pair-vashishta.yaml b/unittest/force-styles/tests/manybody-pair-vashishta.yaml index d0f2eb94ad..50baf7d7a0 100644 --- a/unittest/force-styles/tests/manybody-pair-vashishta.yaml +++ b/unittest/force-styles/tests/manybody-pair-vashishta.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair vashishta pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: vashishta diff --git a/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml b/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml index b04f710dac..7bf18c0058 100644 --- a/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml +++ b/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair vashishta/table pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: vashishta/table 10000 0.2 diff --git a/unittest/force-styles/tests/manybody-pair_edip_multi.yaml b/unittest/force-styles/tests/manybody-pair_edip_multi.yaml index ae1200100b..5aa31dcc9e 100644 --- a/unittest/force-styles/tests/manybody-pair_edip_multi.yaml +++ b/unittest/force-styles/tests/manybody-pair_edip_multi.yaml @@ -6,7 +6,7 @@ prerequisites: ! | pair edip/multi pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! "" input_file: in.manybody pair_style: edip/multi diff --git a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml index bdb35df831..02bf840ad9 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Sat Aug 1 16:17:46 202 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair born/coul/dsf diff --git a/unittest/force-styles/tests/mol-pair-buck.yaml b/unittest/force-styles/tests/mol-pair-buck.yaml index 947e2e9755..562ff550a5 100644 --- a/unittest/force-styles/tests/mol-pair-buck.yaml +++ b/unittest/force-styles/tests/mol-pair-buck.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Fri Jul 31 12:07:29 202 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair buck diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml index f93f53861d..ed7db64343 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Sat Aug 1 08:33:03 202 -epsilon: 5e-14 +epsilon: 5e-13 prerequisites: ! | atom full pair buck/coul/long diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml index 8082009c41..30891f3e60 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Sat Aug 1 08:36:45 202 -epsilon: 5e-14 +epsilon: 2.5e-13 prerequisites: ! | atom full pair buck/coul/msm diff --git a/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml b/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml index f37079d9ad..a0e6bbbe90 100644 --- a/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml @@ -8,7 +8,7 @@ prerequisites: ! | pre_commands: ! | variable units index metal variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic velocity all scale 100.0 diff --git a/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml b/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml index fcb8b91122..68f0a9c0a1 100644 --- a/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml @@ -8,7 +8,7 @@ prerequisites: ! | pre_commands: ! | variable units index metal variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic velocity all scale 100.0 diff --git a/unittest/force-styles/tests/mol-pair-e3b.yaml b/unittest/force-styles/tests/mol-pair-e3b.yaml index 961cd77784..342db5b02b 100644 --- a/unittest/force-styles/tests/mol-pair-e3b.yaml +++ b/unittest/force-styles/tests/mol-pair-e3b.yaml @@ -8,7 +8,7 @@ prerequisites: ! | pair e3b pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic input_file: in.fourmol diff --git a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml index 3850747330..f7ac67a3a9 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Sat Aug 1 13:39:00 202 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair lj/cubic diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml index 3c550f4a7d..cccc9ba760 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair lj/cut/tip4p/cut pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic input_file: in.fourmol diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml index 7b334554b3..820bef3fc3 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml @@ -8,7 +8,7 @@ prerequisites: ! | kspace pppm/tip4p pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml index 254b45b510..f9fcfd8a40 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml @@ -8,7 +8,7 @@ prerequisites: ! | kspace pppm/tip4p pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml index cab2e7c3c1..40a342f24a 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml @@ -8,7 +8,7 @@ prerequisites: ! | kspace pppm/tip4p pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 16 diff --git a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml index 6e7a91b1d4..b713dbfdd6 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml @@ -8,7 +8,7 @@ prerequisites: ! | kspace pppm/disp/tip4p pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 diff --git a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml index 359f98d281..411716eb84 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml @@ -8,7 +8,7 @@ prerequisites: ! | kspace pppm/disp/tip4p pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 16 diff --git a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml index 2d9e3c7666..8bf231754b 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml @@ -1,13 +1,13 @@ --- lammps_version: 21 Jul 2020 date_generated: Thu Aug 6 16:52:44 202 -epsilon: 1e-14 +epsilon: 7.5e-13 prerequisites: ! | atom full pair tip4p/cut pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic input_file: in.fourmol diff --git a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml index 9d96a981c2..a81c8caab3 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair tip4p/long pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 diff --git a/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml index c55d60adf9..156e60afdd 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml @@ -9,7 +9,7 @@ prerequisites: ! | pair lj/cut pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 diff --git a/unittest/force-styles/tests/mol-pair-tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-tip4p_table.yaml index 6dd612151f..83d7d6d289 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_table.yaml @@ -7,7 +7,7 @@ prerequisites: ! | pair tip4p/long pre_commands: ! | variable newton_pair delete - variable newton_pair index on + if "$(is_active(package,gpu)) > 0.0" then "variable newton_pair index off" else "variable newton_pair index on" post_commands: ! | pair_modify mix arithmetic pair_modify table 16 diff --git a/unittest/force-styles/tests/mol-pair-zbl.yaml b/unittest/force-styles/tests/mol-pair-zbl.yaml index 8aca114255..48046b9584 100644 --- a/unittest/force-styles/tests/mol-pair-zbl.yaml +++ b/unittest/force-styles/tests/mol-pair-zbl.yaml @@ -1,7 +1,7 @@ --- lammps_version: 21 Jul 2020 date_generated: Sat Aug 1 14:40:56 202 -epsilon: 1e-12 +epsilon: 2e-12 prerequisites: ! | atom full pair zbl From 5127071da27955a5e529bfaaf0ffaabc23aef142 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 26 Aug 2020 18:41:32 -0400 Subject: [PATCH 003/370] Fixes segfault due to uninitialized pointers --- src/KSPACE/pair_buck_coul_long.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index a46424baf7..a63047ea9f 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -43,7 +43,17 @@ PairBuckCoulLong::PairBuckCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; + cut_lj = nullptr; + cut_ljsq = nullptr; + a = nullptr; + rho = nullptr; + c = nullptr; + rhoinv = nullptr; + buck1 = nullptr; + buck2 = nullptr; + offset = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ From 9b0c07f79781bfd418f01652b3d0be912f64550f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 27 Aug 2020 19:06:29 -0400 Subject: [PATCH 004/370] remove undesired trailing whitespace --- .../force-styles/tests/mol-pair-born.yaml | 28 ++++++++--------- .../tests/mol-pair-born_coul_dsf.yaml | 28 ++++++++--------- .../tests/mol-pair-born_coul_long.yaml | 30 +++++++++---------- .../tests/mol-pair-born_coul_msm.yaml | 30 +++++++++---------- .../tests/mol-pair-born_coul_wolf.yaml | 28 ++++++++--------- .../force-styles/tests/mol-pair-morse.yaml | 30 +++++++++---------- 6 files changed, 87 insertions(+), 87 deletions(-) diff --git a/unittest/force-styles/tests/mol-pair-born.yaml b/unittest/force-styles/tests/mol-pair-born.yaml index ed7b5976b0..2323ddee17 100644 --- a/unittest/force-styles/tests/mol-pair-born.yaml +++ b/unittest/force-styles/tests/mol-pair-born.yaml @@ -10,20 +10,20 @@ post_commands: ! "" input_file: in.fourmol pair_style: born 8.0 pair_coeff: ! | - 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 - 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 - 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 - 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 - 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 - 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 - 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 - 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | a 2 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml index 02bf840ad9..cd6b6abab0 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml @@ -10,20 +10,20 @@ post_commands: ! "" input_file: in.fourmol pair_style: born/coul/dsf 0.25 8.0 pair_coeff: ! | - 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 - 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 - 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 - 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 - 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 - 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 - 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 - 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! "" natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml index e45f7dc6b7..e35b4417d9 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml @@ -15,21 +15,21 @@ post_commands: ! | input_file: in.fourmol pair_style: born/coul/long 8.0 pair_coeff: ! | - 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 - 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 - 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 - 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 - 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 - 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 - 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 - 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml index 779a79dd9f..a06da1edc5 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml @@ -16,21 +16,21 @@ post_commands: ! | input_file: in.fourmol pair_style: born/coul/msm 12.0 pair_coeff: ! | - 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 - 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 - 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 - 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 - 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 - 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 - 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 - 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml index 7d419e2da2..afaf63d7c3 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml @@ -10,20 +10,20 @@ post_commands: ! "" input_file: in.fourmol pair_style: born/coul/wolf 0.25 8.0 pair_coeff: ! | - 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 - 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 - 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 - 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 - 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 - 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 - 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 - 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 - 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 - 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 - 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! "" natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-morse.yaml b/unittest/force-styles/tests/mol-pair-morse.yaml index 60e5f8736f..aae3f78199 100644 --- a/unittest/force-styles/tests/mol-pair-morse.yaml +++ b/unittest/force-styles/tests/mol-pair-morse.yaml @@ -10,21 +10,21 @@ post_commands: ! "" input_file: in.fourmol pair_style: morse 8.0 pair_coeff: ! | - 1 1 0.0202798941614106 2.78203488021395 2.725417159299 - 1 2 0.0101167811264648 3.9793050302425 1.90749569018897 - 1 3 0.0202934330695928 2.43948720203264 3.10711749999622 - 1 4 0.0175731334238374 2.48316585521317 3.05258880102438 - 1 5 0.0175731334238374 2.48316585521317 3.05258880102438 - 2 2 0.00503064360487288 6.98433077606902 1.08960295117864 - 2 3 0.0101296013842819 3.31380153807866 2.28919067558352 - 2 4 0.00497405122588691 14.0508902925745 0.544416409093563 - 2 5 0.00877114211614446 3.39491256196178 2.23466262511073 - 3 3 0.0203039874239943 2.17204344301477 3.48881895084762 - 3 4 0.0175825321440736 2.20660439192238 3.43428999287994 - 3 5 0.0175825321440736 2.20660439192238 3.43428999287994 - 4 4 0.0152259201379927 2.24227873774009 3.37976131582396 - 4 5 0.0152259201379927 2.24227873774009 3.37976131582396 - 5 5 0.0152259201379927 2.24227873774009 3.37976131582396 + 1 1 0.0202798941614106 2.78203488021395 2.725417159299 + 1 2 0.0101167811264648 3.9793050302425 1.90749569018897 + 1 3 0.0202934330695928 2.43948720203264 3.10711749999622 + 1 4 0.0175731334238374 2.48316585521317 3.05258880102438 + 1 5 0.0175731334238374 2.48316585521317 3.05258880102438 + 2 2 0.00503064360487288 6.98433077606902 1.08960295117864 + 2 3 0.0101296013842819 3.31380153807866 2.28919067558352 + 2 4 0.00497405122588691 14.0508902925745 0.544416409093563 + 2 5 0.00877114211614446 3.39491256196178 2.23466262511073 + 3 3 0.0203039874239943 2.17204344301477 3.48881895084762 + 3 4 0.0175825321440736 2.20660439192238 3.43428999287994 + 3 5 0.0175825321440736 2.20660439192238 3.43428999287994 + 4 4 0.0152259201379927 2.24227873774009 3.37976131582396 + 4 5 0.0152259201379927 2.24227873774009 3.37976131582396 + 5 5 0.0152259201379927 2.24227873774009 3.37976131582396 extract: ! | d0 2 r0 2 From 606b33ea03e824ef9061c5d2f7aa87d0df793c8e Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 16:05:37 -0600 Subject: [PATCH 005/370] Added fix_charge_regulation source code and documentation. --- doc/src/fix_charge_regulation.rst | 184 +++ examples/USER/misc/charge_regulation/README | 7 + .../misc/charge_regulation/data_acid.chreg | 235 +++ .../misc/charge_regulation/data_polymer.chreg | 264 ++++ .../USER/misc/charge_regulation/in_acid.chreg | 40 + .../misc/charge_regulation/in_polymer.chreg | 35 + .../misc/charge_regulation/log_acid.lammps | 163 ++ .../misc/charge_regulation/log_polymer.lammps | 181 +++ src/USER-MISC/README | 1 + src/USER-MISC/fix_charge_regulation.cpp | 1335 +++++++++++++++++ src/USER-MISC/fix_charge_regulation.h | 117 ++ 11 files changed, 2562 insertions(+) create mode 100644 doc/src/fix_charge_regulation.rst create mode 100644 examples/USER/misc/charge_regulation/README create mode 100644 examples/USER/misc/charge_regulation/data_acid.chreg create mode 100644 examples/USER/misc/charge_regulation/data_polymer.chreg create mode 100644 examples/USER/misc/charge_regulation/in_acid.chreg create mode 100644 examples/USER/misc/charge_regulation/in_polymer.chreg create mode 100644 examples/USER/misc/charge_regulation/log_acid.lammps create mode 100644 examples/USER/misc/charge_regulation/log_polymer.lammps create mode 100644 src/USER-MISC/fix_charge_regulation.cpp create mode 100644 src/USER-MISC/fix_charge_regulation.h diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst new file mode 100644 index 0000000000..585761e8a9 --- /dev/null +++ b/doc/src/fix_charge_regulation.rst @@ -0,0 +1,184 @@ + +.. Yuan documentation master file, created by + sphinx-quickstart on Sat Jan 30 14:06:22 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + tc387: Multiple text additions/changes, Feb 2 2021 +.. index:: fix fix_charge_regulation + +fix_charge_regulation command +============================= +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID charge_regulation cation_type anion_type keyword value(s) + +* ID, group-ID are documented in fix command +* charge_regulation = style name of this fix command +* cation_type = atom type of free cations +* anion_type = atom type of free anions + +* zero or more keyword/value pairs may be appended + + .. parsed-literal:: + + keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *xrd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves* + *pH* value = pH of the solution + *pKa* value = acid dissociation constant + *pKb* value = base dissociation constant + *pIp* value = chemical potential of free cations + *pIm* value = chemical potential of free anions + *pKs* value = solution self-dissociation constant + *acid_type* = atom type of acid groups + *base_type* = atom type of base groups + *lunit_nm* value = unit length used by LAMMPS (# in the units of nanometers) + *temp* value = temperature + *tempfixid* value = fix ID of temperature thermostat + *nevery* value = invoke this fix every nevery steps + *nmc* value = number of charge regulation MC moves to attempt every nevery steps + *xrd* value = cutoff distance for acid/base reaction + *seed* value = random # seed (positive integer) + *tag* value = yes or no (yes: The code assign unique tags to inserted ions; no: The tag of all inserted ions is "0") + *group* value = group-ID, inserted ions are assigned to group group-ID. Can be used multiple times to assign inserted ions to multiple groups. + *onlysalt* values = flag charge_cation charge_anion. + flag = yes or no (yes: the fix performs only ion insertion/deletion, no: perform acid/base dissociation and ion insertion/deletion) + charge_cation, charge_anion = value of cation/anion charge, must be an integer (only specify if flag = yes) + *pmcmoves* values = pmcA pmcB pmcI - MC move fractions for acid ionization (pmcA), base ionization (pmcB) and free ion exchange (pmcI) + +Examples +"""""""" +.. code-block:: LAMMPS + + fix chareg all charge_regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT + + fix chareg all charge_regulation 1 2 pIp 3 pIm 3 tempfixid fT tag yes onlysalt yes 2 -1 + +Description +""""""""""" +This fix performs Monte Carlo (MC) sampling of charge regulation and exchange of ions with a reservoir as discussed in :ref:`(Curk1) ` and :ref:`(Curk2) `. +The implemented method is largely analogous to the grand-reaction ensemble method in :ref:`(Landsgesell) `. +The implementation is parallelized, compatible with existing LAMMPS functionalities, and applicable to any system utilizing discreet, ionizable groups or surface sites. + + +Specifically, the fix implements the following three types of MC moves, which discretely change the charge state of individual particles and insert ions into the systems: :math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{X}^+`, :math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{X}^-`, +and :math:`\emptyset \rightleftharpoons Z^-\mathrm{X}^{Z^+}+Z^+\mathrm{X}^{-Z^-}`. +In the former two types of reactions, Monte Carlo moves alter the charge value of specific atoms (:math:`\mathrm{A}`, :math:`\mathrm{B}`) and simultaneously insert a counterion to preserve the charge neutrality of the system, modeling the dissociation/association process. +The last type of reaction performs grand canonical MC exchange of ion pairs with a (fictitious) reservoir. + +In our implementation "acid" refers to particles that can attain charge :math:`q=\{0,-1\}` and "base" to particles with :math:`q=\{0,1\}`, +whereas the MC exchange of free ions allows any integer charge values of :math:`{Z^+}` and :math:`{Z^-}`. + +Here we provide several practical examples for modeling charge regulation effects in solvated systems. +An acid ionization reaction (:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{H}^+`) can be defined via a single line in the input file + +.. code-block:: LAMMPS + + fix acid_reaction all charge_regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 7.0 pIm 7.0 + +where the fix attempts to charge :math:`\mathrm{A}` (discharge :math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and insert (delete) a proton (atom type 2). Besides, the fix implements self-ionization reaction of water :math:`\emptyset \rightleftharpoons \mathrm{H}^++\mathrm{OH}^-`. +However, this approach is highly inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of both protons and hydroxyl ions is low, resulting in a relatively low acceptance rate of MC moves. + +A more efficient way is to allow salt ions to +participate in ionization reactions, which can be easily achieved via + +.. code-block:: LAMMPS + + fix acid_reaction all charge_regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 + +where particles of atom type 4 and 5 are the salt cations and anions, both at chemical potential pI=2.0, see :ref:`(Curk1) ` and :ref:`(Landsgesell) ` for more details. + + + Similarly, we could have simultanously added a base ionization reaction (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`) + +.. code-block:: LAMMPS + + fix base_reaction all charge_regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0 + +where the fix will attempt to charge :math:`\mathrm{B}` (discharge :math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. +If neither the acid or the base type is specified, for example, + +.. code-block:: LAMMPS + + fix salt_reaction all charge_regulation 4 5 pIp 2.0 pIm 2.0 + +the fix simply inserts or deletes an ion pair of a free cation (atom type 4) and a free anion (atom type 5) as done in a conventional grand-canonical MC simulation. + + +The fix is compatible with LAMMPS sub-packages such as *molecule* or *rigid*. That said, the acid and base particles can be part of larger molecules or rigid bodies. Free ions that are inserted to or deleted from the system must be defined as single particles (no bonded interactions allowed) and cannot be part of larger molecules or rigid bodies. If *molecule* package is used, all inserted ions have a molecule ID equal to zero. + +Note that LAMMPS implicitly assumes a constant number of particles (degrees of freedom). Since using this fix alters the total number of particles during the simulation, any thermostat used by LAMMPS, such as NVT or Langevin, must use a dynamic calculation of system temperature. This can be achieved by specifying a dynamic temperature compute (e.g. dtemp) and using it with the desired thermostat, e.g. a Langevin thermostat: + +.. code-block:: LAMMPS + + compute dtemp all temp + compute_modify dtemp dynamic yes + fix fT all langevin 1.0 1.0 1.0 123 + fix_modify fT temp dtemp + +The chemical potential units (e.g. pH) are in the standard log10 representation assuming reference concentration :math:`\rho_0 = \mathrm{mol}/\mathrm{l}`. +Therefore, to perform the internal unit conversion, the length (in nanometers) of the LAMMPS unit length +must be specified via *lunit_nm* (default is set to the Bjerrum length in water at room temprature *lunit_nm* = 0.72nm). For example, in the dilute ideal solution limit, the concentration of free ions +will be :math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. + +The temperature used in MC acceptance probability is set by *temp*. This temperature should be the same as the temperature set by the molecular dynamics thermostat. For most purposes, it is probably best to use *tempfixid* keyword which dynamically sets the temperature equal to the chosen MD thermostat temperature, in the example above we assumed the thermostat fix-ID is *fT*. The inserted particles attain a random velocity corresponding to the specified temperature. Using *tempfixid* overrides any fixed temperature set by *temp*. + +The *xrd* keyword can be used to restrict the inserted/deleted counterions to a specific radial distance from an acid or base particle that is currently participating in a reaction. This can be used to simulate more realist reaction dynamics. If *xrd* = 0 or *xrd* > *L* / 2, where *L* is the smallest box dimension, the radial restriction is automatically turned off and free ion can be inserted or deleted anywhere in the simulation box. + +If the *tag yes* is used, every inserted atom gets a unique tag ID, otherwise, the tag of every inserted atom is set to 0. *tag yes* might cause an integer overflow in very long simulations since the tags are unique to every particle and thus increase with every successful particle insertion. + +The *pmcmoves* keyword sets the relative probability of attempting the three types of MC moves (reactions): acid charging, base charging, and ion pair exchange. +The fix only attempts to perform particle charging MC moves if *acid_type* or *base_type* is defined. Otherwise fix only performs free ion insertion/deletion. For example, if *acid_type* is not defined, *pmcA* is automatically set to 0. The vector *pmcmoves* is automatically normalized, for example, if set to *pmcmoves* 0 0.33 0.33, the vector would be normalized to [0,0.5,0.5]. + +The *only_salt* option can be used to perform multivalent grand-canonical ion-exchange moves. If *only_salt yes* is used, no charge exchange is performed, only ion insertion/deletion (*pmcmoves* is set to [0,0,1]), but ions can be multivalent. In the example above, an MC move would consist of three ion insertion/deletion to preserve the charge neutrality of the system. + +The *group* keyword can be used to add inserted particles to a specific group-ID. All inserted particles are automatically added to group *all*. + + +Output +"""""" +This fix computes a global vector of length 8, which can be accessed by various output commands. The vector values are the following global cumulative quantities: + +* 1 = cumulative MC attempts +* 2 = cumulative MC successes +* 3 = current # of neutral acid atoms +* 4 = current # of -1 charged acid atoms +* 5 = current # of neutral base atoms +* 6 = current # of +1 charged acid atoms +* 7 = current # of free cations +* 8 = current # of free anions + + +Restrictions +"""""""""""" +This fix is part of the USER-MISC package. It is only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` doc page for more info. + +The :doc:`atom_style `, used must contain the charge property, for example, the style could be *charge* or *full*. Only usable for 3D simulations. Atoms specified as free ions cannot be part of rigid bodies or molecules and cannot have bonding interactions. The scheme is limited to integer charges, any atoms with non-integer charges will not be considered by the fix. + +Note: Region restrictions are not yet implemented. + +Related commands +"""""""""""""""" + +:doc:`fix gcmc `, +:doc:`fix atom/swap ` + +Default +""""""" +pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs=14.0; acid_type = -1; base_type = -1; lunit_nm = 0.72; temp = 1.0; nevery = 100; nmc = 100; xrd = 0; seed = 2345; tag = no; onlysalt = no, pmcmoves = 0.33 0.33 0.33, group-ID = all + +---------- + +.. _Curk1: + +**(Curk1)** T. Curk, J. Yuan, and E. Luijten, "Coarse-grained simulation of charge regulation using LAMMPS", preprint (2021). + +.. _Curk2: + +**(Curk2)** T. Curk and E. Luijten, "Charge-regulation effects in nanoparticle self-assembly", PRL (2021) + +.. _Landsgesell: + +**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, “Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning,” Macromolecules 53, 3007–3020 (2020). diff --git a/examples/USER/misc/charge_regulation/README b/examples/USER/misc/charge_regulation/README new file mode 100644 index 0000000000..e0be86d7e4 --- /dev/null +++ b/examples/USER/misc/charge_regulation/README @@ -0,0 +1,7 @@ +This directory has two input scripts that illustrates how to use fix charge_regulation in LAMMPS to perform coarse-grained molecular dynamics (MD) simulations with incorporation of charge regulation effects. The charge regulation is implemented via Monte Carlo (MC) sampling following the reaction ensemble MC approach, producing a MC/MD hybrid tool for modeling charge regulation in solvated systems. + +The script `in_acid.chreg` sets up a simple weak acid electrolyte (pH=7,pKa=6,pI=3). Four different types of MC moves are implemented: acid protonation & de-protonation, and monovalent ion pair insertion and deletion. Note here we have grouped all free monovalent ions into a single type, a physically natural choice on the level of coarse-grained primitive electrolyte models, which increases the calculation performance but has no effects on thermodynamic observables. The variables such as pH, pKa, pI, and lb at the top of the input script can be adjusted to play with various simulation parameters. The cumulative MC attempted moves and cumulative number of accepted moves, as well as, current number of neutral and charged acid particles, neutral and charged base particles (in this example always 0), and the current number of free cations and anions in the system are printed in the `log_acid.lammps`. + +The script `in_polymer.chreg` sets up a weak polyelectrolyte chain of N=80 beads. Each bead is a weak acid with pKa=5 and solution has pH=7 and salt pI=3. In this example, we choose to treat salt ions, protons, and hydroxyl ions separately, which results in 5 types of MC moves: acid [type 1] protonation & de-protonation (with protons [type 4] insertion & deletion), acid [type 1] protonation & de-protonation (with salt cation [type 2] insertion & deletion), water self-ionization (insertion and deletion of proton [type4] and hydroxyl ion [type 5] pair), insertion and deletion of monovalent salt pair [type 2 and type 3] , insertion and deletion +Of a proton [type4] and salt anion [type 3]. The current number of neutral and charged acid particles, the current number of free salt cations and anions, and the current number of protons and hydroxyl ions are printed in the `log_polymer.lammps`. + diff --git a/examples/USER/misc/charge_regulation/data_acid.chreg b/examples/USER/misc/charge_regulation/data_acid.chreg new file mode 100644 index 0000000000..edc7082ad0 --- /dev/null +++ b/examples/USER/misc/charge_regulation/data_acid.chreg @@ -0,0 +1,235 @@ +LAMMPS data file generated by get_input.py + +219 atoms +3 atom types +-2.5000000000000000e+01 2.5000000000000000e+01 xlo xhi +-2.5000000000000000e+01 2.5000000000000000e+01 ylo yhi +-2.5000000000000000e+01 2.5000000000000000e+01 zlo zhi + +Masses + +1 1 +2 1 +3 1 + +Atoms + +1 1 0 2.5983275747497636 -8.368052973860795 20.001288664343484 +2 1 -1 -18.182868728594865 -8.079792367885453 8.253737231981816 +3 1 -1 -17.437350808966414 8.120411567445771 10.747650340639332 +4 1 -1 6.502476583291578 -23.497326620756837 19.948223080086798 +5 1 -1 -22.528179279677296 -18.783433570718127 -17.964657736688018 +6 1 -1 -9.713496019164342 18.97235576760402 -19.495620818582825 +7 1 -1 -12.831976006720659 0.12265736526942561 -21.679396938423718 +8 1 -1 20.909063679212295 -2.16535062758771 0.46197866620165584 +9 1 -1 23.86211981166997 24.024928465132284 10.534067202515907 +10 1 -1 -0.5289298325031275 23.820222457999776 -2.657199543669442 +11 1 -1 9.57021229491361 11.973871502198485 3.4206509716759186 +12 1 -1 -10.201559985782705 7.557482594092384 12.07004973873643 +13 1 -1 4.898458045226889 2.0169997859717945 -20.765285372762087 +14 1 -1 -24.086606883730077 4.424991619615298 -4.204294764756856 +15 1 -1 3.6837161829600795 -4.763233144818308 -12.75873457519811 +16 1 -1 -12.217842496816345 -17.720229208905618 -13.556354139556914 +17 1 -1 -21.456229140133704 -7.423996317612119 -6.94398044071275 +18 1 -1 13.697298849253912 8.503639732052164 8.085487457359058 +19 1 -1 -5.764222710061347 11.49890485049034 -5.1113880296575935 +20 1 -1 3.9944161041544426 16.928204188257893 -14.875635895409372 +21 1 -1 4.509525276444776 16.63590711792657 -22.21846494992397 +22 1 -1 22.115374932704306 -18.97293932558108 -23.982486000144267 +23 1 -1 14.169061011408473 -16.69837647199978 13.779039228068108 +24 1 -1 17.186846147657228 8.827459489898189 23.055435051390333 +25 1 -1 2.9822901981431045 -16.83687718528342 -21.278623587083484 +26 1 -1 16.657554689423897 -1.6217275605348647 -11.315859420404218 +27 1 -1 19.215533149393543 -15.512634977936068 7.2701088767584565 +28 1 -1 -8.886744157248422 -24.09644410100167 4.013016013803799 +29 1 -1 20.99918340066754 4.4716257356730225 0.3847245765737597 +30 1 -1 1.3442294253060716 5.601341425720583 -14.918594492786674 +31 1 -1 -6.962977050326831 20.470183675946515 -16.37885865567279 +32 1 -1 -9.98531733187143 9.52233798117566 -24.979630708193724 +33 1 -1 -17.327989778292306 5.761352103841766 5.720220488689204 +34 1 -1 5.168359673466362 -23.698812306679418 2.6199762372169744 +35 1 -1 18.978042448492154 6.41188742965139 6.31975357155018 +36 1 -1 -16.38534911663758 -14.8262205163943 4.125239045887575 +37 1 -1 7.974455406459249 -18.88332583451115 11.00721254217055 +38 1 -1 13.779816416416402 1.8581999350851426 9.104219696003227 +39 1 -1 -23.90949397031401 -3.346877828308571 -10.228782973473443 +40 1 -1 21.61647622174447 8.443955423089903 -19.12066464239769 +41 1 -1 -8.823979405515548 14.461154001848172 16.061704411241706 +42 1 -1 -2.4406878944912513 12.5535360118296 20.606764200087852 +43 1 -1 -18.459404356124697 15.260951448001258 21.187332685021346 +44 1 -1 2.2354003384439878 -23.350013178190736 11.369307324043625 +45 1 -1 15.595889705552018 -6.6075680254604805 5.434256329408505 +46 1 -1 -17.528243443870238 4.109747707896265 -1.4167331089310942 +47 1 -1 2.161977144405782 -16.511059804921263 -12.186191310598671 +48 1 -1 -8.685671837367341 -7.0743613044263185 -1.1561844713769105 +49 1 -1 15.62258718398045 -6.559293763708908 20.556775995508488 +50 1 -1 -6.965207014475155 -14.348784897390543 -14.421447863144754 +51 1 -1 -12.099361509567913 -24.62785640990423 -15.839126670614329 +52 1 -1 6.673854222058246 7.83575773885061 -9.714128155619994 +53 1 -1 -17.413453800948826 12.386754276446203 -16.882300786608994 +54 1 -1 21.8966589175091 12.485943283688762 -14.553421680298634 +55 1 -1 -8.37629917390651 -24.783875012947064 7.454467809536389 +56 1 -1 14.081149297694104 -21.719204113108943 -17.447225564400064 +57 1 -1 4.681992702049627 1.9719544892622558 -7.823736613205725 +58 1 -1 4.353171917533494 15.86928389762705 24.669680272563014 +59 1 -1 23.31502072066573 -4.685724298328946 2.459643890128799 +60 1 -1 7.0470920520598455 23.016693234922386 -13.139471333592677 +61 1 -1 11.725555941181668 -15.809323171320772 -1.6292879532275037 +62 1 -1 -20.36388898925061 -12.084932320023162 -22.816700826388757 +63 1 -1 -2.492146614764735 -0.7314052253623018 -15.89959178250266 +64 1 -1 -22.45303825831233 -11.27996814407809 -9.553770912146142 +65 1 -1 24.76771926037101 20.128947543233757 10.528974830883733 +66 1 -1 11.326213670190818 -11.624187194192492 -9.687726413467862 +67 1 -1 -5.712764220166093 15.778887306376163 -0.9263244618113831 +68 1 -1 -15.073201136996362 -12.372916148178115 -5.461704510273556 +69 1 -1 -5.82976670348781 -4.57812040989473 9.0443548565365 +70 1 -1 -5.429195387856279 1.4542054472230177 -7.397291151203568 +71 1 -1 -23.385555726942343 -11.924588975396505 3.8215294321466153 +72 1 -1 -1.0694104826815725 2.999945633116507 3.67092922106918 +73 1 -1 12.134312161994352 1.9747455475585376 -14.895893366599623 +74 1 -1 21.30950120583112 18.97294626436546 -17.520867878211376 +75 1 -1 -24.356703356157063 3.594879254976714 17.172993705171677 +76 1 -1 12.634233603338409 24.373499564220822 4.561976273909789 +77 1 -1 -10.740243207970495 19.345205140729554 -3.3368424800818097 +78 1 -1 -3.027848793907552 10.604939843027267 7.493012332728249 +79 1 -1 5.000539296336658 11.770088203844622 17.227492055930185 +80 1 -1 1.1585200269400353 -24.45822157176123 -12.515688997756257 +81 1 -1 1.9163088584430596 -14.064330279670672 11.302445490552905 +82 1 -1 -20.857041355570576 21.292791787236673 17.397470691573346 +83 1 -1 -24.50473305235651 -12.741459355708756 -1.9325218065560357 +84 1 -1 2.658628688373309 -1.1131226252194608 7.491603553398086 +85 1 -1 -18.515435126408363 24.20642384141299 14.466889392835121 +86 1 -1 19.63928177206153 9.942655640416291 8.691463646789934 +87 1 -1 -7.69626451160762 11.762517043363786 -7.457263991495665 +88 1 -1 1.051431093064835 -11.460307039827766 16.90304637479744 +89 1 -1 0.9157815447227939 23.656751182559688 -6.538587603918376 +90 1 -1 23.330169435555234 -7.293893221439802 -10.739388379883973 +91 1 -1 1.3454906653067376 0.3584300740797559 8.837879234629618 +92 1 -1 -21.93056639286312 -10.890279576013356 -10.412914392053596 +93 1 -1 21.9136101677979 -10.780221720642636 11.543925933359859 +94 1 -1 1.213289938136601 -7.171863230861625 20.734527885288102 +95 1 -1 23.102370131877777 21.949933206350458 0.29281565885028016 +96 1 -1 -18.917780884063298 -0.03244735062602544 23.633906995676227 +97 1 -1 7.583004866601307 10.74178675512821 -4.857297835527785 +98 1 -1 -7.4910066746799835 -14.168364618485734 -6.426540836249767 +99 1 -1 -20.672200987670426 -8.746789722660697 11.011389790610103 +100 1 -1 -18.662115132221917 -21.356740361991612 -8.735991534410413 +101 2 1 11.900973676882046 6.591531431964558 19.018193594877637 +102 2 1 -23.433591822114983 -18.956429005519567 4.8373984358422994 +103 2 1 -11.825475204099472 -3.8206287568445134 3.1167558949026173 +104 2 1 -17.49780467176259 -23.115560141825554 9.614132296727426 +105 2 1 10.88916113281772 4.512200980010334 18.685489050240854 +106 2 1 -22.04662313800728 23.973268925992897 -23.417792740205652 +107 2 1 -13.57041123540546 17.3687874050987 21.186270978357783 +108 2 1 6.586851196789095 16.27860887432974 -3.638909639278946 +109 2 1 8.191448685630277 6.828880619305412 -6.347576950950089 +110 2 1 -15.723292856220288 -20.484673256634117 -15.14713811293425 +111 2 1 18.58081219522701 19.060706710849452 -10.295676869062909 +112 2 1 -21.09194001526127 -7.739334786748358 5.417635948058724 +113 2 1 -14.10404878784055 -15.769737592448523 -18.881834262561505 +114 2 1 -14.644589058195612 8.84169065013063 8.611654925486256 +115 2 1 -11.719050253933538 -4.9700119000832 -0.9846728956163453 +116 2 1 19.498247505274143 -10.418045613133986 -22.12098182226518 +117 2 1 21.857683401772697 20.157098661061575 -13.652393197742995 +118 2 1 -17.623414455798407 21.873813778550875 -6.533965802006303 +119 2 1 7.231785003326529 -13.925962842972222 5.360080190636602 +120 2 1 -7.509430039873415 19.13541714591672 -16.23545960168472 +121 2 1 -4.048249209544995 13.126195473202351 -7.156541250053138 +122 2 1 -20.26837137264583 21.46366988603839 15.603080527043964 +123 2 1 -4.478253524569759 -3.1812369811955783 -18.52918159641348 +124 2 1 21.541019047040052 13.514999235394065 -1.8086547561089752 +125 2 1 -15.223319907923727 -5.958117989814905 -7.194967640819577 +126 2 1 -20.87181173003304 -7.66780336209651 20.518235718821714 +127 2 1 -3.7444846073700297 21.014628245718292 7.197818215477007 +128 2 1 -5.904222844268787 7.656315546673127 -1.3911802017487425 +129 2 1 -21.49072414090769 -23.123923448235523 10.49453669763092 +130 2 1 24.90628307456096 7.081046671281136 -14.422530828641655 +131 2 1 -12.173002002514222 -23.250366655717176 -5.145802772598103 +132 2 1 -19.68809858318764 4.476541650697328 6.249229323733747 +133 2 1 16.85550827580734 -0.8462194407221624 18.011901711631936 +134 2 1 17.289399533444858 -11.99379336569853 11.875868193611936 +135 2 1 19.532020913911126 -23.053375288330326 -4.9162076250112605 +136 2 1 -12.432304028989998 5.029488375070969 7.535325299264009 +137 2 1 14.934807008644 8.086694342170496 19.68691014849572 +138 2 1 -7.088283921093918 -23.094109864922018 16.57088328184242 +139 2 1 14.77413976080318 21.343550134324772 13.996489344579572 +140 2 1 -14.606423208703657 -6.928316926567433 -22.717483260149475 +141 2 1 -17.139771555632173 14.533410346451518 -21.83064865887975 +142 2 1 4.261830086466784 15.518968841247663 -17.791505649414617 +143 2 1 -9.814793042774223 -5.120956154726329 14.054454130549104 +144 2 1 8.313311590434793 3.9666876022475606 -20.677101093823236 +145 2 1 10.603190079756637 -2.62347089527481 1.6661989541795634 +146 2 1 -17.763718339721695 1.2541370478041287 -21.55649971308305 +147 2 1 -8.538066365356812 14.81814356892842 -4.478673557614034 +148 2 1 -5.809558827384787 14.611789154829552 13.287687188309562 +149 2 1 8.986830839040898 -17.43898584267833 -18.08640526127862 +150 2 1 -13.315275244526854 8.890431200255954 -8.708179477452443 +151 2 1 -0.5407152591412618 -23.67970550599055 -24.1586910560046 +152 2 1 -19.79961109336906 -16.10906604558887 -5.879899717095562 +153 2 1 -23.626316306846658 9.337407355717588 -9.640842288307239 +154 2 1 -18.847256196659333 -16.303517291166603 -10.786416046984721 +155 2 1 13.567770091716845 -24.4927974402177 8.896906985984664 +156 2 1 13.652894892068794 -24.87567116574863 21.89026113439551 +157 2 1 -8.575912713332162 9.92386172372207 5.029537530028822 +158 2 1 20.69339436974964 1.129252448454178 0.3584458063532807 +159 2 1 -0.9971941518705947 18.317397852358788 6.795424830570379 +160 2 1 23.155704681402298 15.458725773368961 17.01599672991628 +161 2 1 22.278634187244123 14.642946508468171 20.543957651530896 +162 2 1 9.771629496835963 -21.696904301438853 -5.259678202922196 +163 2 1 5.253009955872763 17.911287158418148 15.769047957152992 +164 2 1 -20.759038961257414 5.59089552770853 -12.383953925685166 +165 2 1 3.2163819108147145 -4.948608591009169 -17.85036103684716 +166 2 1 20.637631925250837 9.109955226257064 6.177181979863878 +167 2 1 5.306344093540837 12.647347581939556 23.229957406774105 +168 2 1 -24.15187998806597 17.263903348029615 -17.141028077545826 +169 2 1 -15.705280442832997 -15.655358704303895 -10.488762557871972 +170 2 1 -6.601131108664461 -22.50322976595015 -5.672942609306119 +171 2 1 22.869179482568555 13.369592422303498 -9.378437532422556 +172 2 1 -23.151055417980903 -3.928919101213168 -11.117061489640207 +173 2 1 1.3592343286386246 -18.552063924235036 -15.346172149331993 +174 2 1 10.23567488314778 -18.14207926130103 -1.6884247085891886 +175 2 1 12.595888032974493 -1.7416169207452157 -21.786811832485718 +176 2 1 -0.14792438162408672 17.11748549051584 1.2788726677139053 +177 2 1 24.349235298880274 -8.664350854740949 12.4309854455257 +178 2 1 -18.827147816604253 -18.80258748867273 -1.6980553939283212 +179 2 1 -9.048793002383698 -1.788614428205263 -11.841289777017172 +180 2 1 -22.49667217853208 -22.112076711777533 10.01393503943838 +181 2 1 -16.183333848138453 1.3098533508906556 0.8096413611556166 +182 2 1 -4.007575369376703 -24.447854073342157 -19.683971619997376 +183 2 1 8.79123015290173 -15.890906503248287 -23.45721570121758 +184 2 1 -8.557898021171628 -21.985380426316674 22.626382729361595 +185 2 1 7.143974673263372 16.57516065778192 0.5907315164854055 +186 2 1 7.05280226857041 6.658154377550723 17.993436860997946 +187 2 1 20.98391844656716 -3.7711929542825544 -22.37222924252256 +188 2 1 -8.856382807041598 -16.421301042649826 -7.682473719905396 +189 2 1 -14.381919492441797 -7.667674808763277 -10.178028203828621 +190 2 1 -22.93472549116592 10.072854607637751 3.756868463885592 +191 2 1 9.458987867260412 17.23200182595278 -0.03503381482496337 +192 2 1 11.013603635791974 19.842184408029837 -5.83598462187852 +193 2 1 23.28897987479008 2.835578651649044 -20.512845011389647 +194 2 1 -18.86161127148128 8.956542530565656 14.193388541103026 +195 2 1 13.688477473034126 -15.973205475346514 10.952445409682397 +196 2 1 2.1058159557459497 2.740725960214597 -23.72037436968614 +197 2 1 20.982351847235442 7.072739454450108 -24.07322254392252 +198 2 1 5.962360707177609 -19.424513569281604 22.469955103109243 +199 2 1 -17.13607356062674 20.038457022813326 12.94227215395123 +200 2 1 11.592617137491743 22.283887092702138 2.339699650677858 +201 2 1 -1.3864952037065237 19.199632510575505 -7.684210221911414 +202 2 1 -22.44476570586083 -19.66385674506424 -8.981660607669522 +203 2 1 0.36547911522815824 -7.628556098996082 16.326944822668068 +204 2 1 -9.766164330974753 24.38435844399602 -14.352553497163 +205 2 1 -0.6310792726759544 -5.625399375968325 13.665993163571486 +206 2 1 2.6795300975636103 -0.37097710463575595 15.575183407667495 +207 2 1 10.68508361399715 24.638181487800373 -17.538711281692827 +208 2 1 18.30809729940504 18.39121662193474 18.285926328751984 +209 2 1 -11.52561870836783 -11.871004571782223 12.890674390475048 +210 3 -1 16.038097437687007 -0.8308290507120688 9.140710202344948 +211 3 -1 -12.071581865552927 23.77532123232212 -6.250109721970887 +212 3 -1 24.179073767023887 19.6390206210449 22.20321951706368 +213 3 -1 22.899159789805424 8.918385700451317 -1.1269016129923664 +214 3 -1 -10.48576153865241 5.691510884812594 21.955276995406933 +215 3 -1 6.272776670877239 10.035821052072265 22.22030412319301 +216 3 -1 14.689947575936934 -7.785907120217196 0.5033983092114553 +217 3 -1 23.173937996535116 -21.041572031861037 -21.057283440516468 +218 3 -1 -6.015120142466472 6.3962924962024985 21.58241945230285 +219 3 -1 -0.77667042466472 0.3962848125024985 1.582473830285 \ No newline at end of file diff --git a/examples/USER/misc/charge_regulation/data_polymer.chreg b/examples/USER/misc/charge_regulation/data_polymer.chreg new file mode 100644 index 0000000000..2c5bd3e1ed --- /dev/null +++ b/examples/USER/misc/charge_regulation/data_polymer.chreg @@ -0,0 +1,264 @@ +##A Weak PE Chain of N=80 + +160 atoms +79 bonds + +5 atom types +1 bond types + +-50 50 xlo xhi +-50 50 ylo yhi +-50 50 zlo zhi + +Masses + +1 1.0 +2 1.0 +3 1.0 +4 1.0 +5 1.0 + +Atoms +# atom_id molecule_id atom_type charge x y z +1 1 1 -1 0 0 -48.37753795169063 +2 1 1 -1 0 0 -47.255075903381254 +3 1 1 -1 0 0 -46.13261385507188 +4 1 1 -1 0 0 -45.01015180676251 +5 1 1 -1 0 0 -43.887689758453135 +6 1 1 -1 0 0 -42.76522771014376 +7 1 1 -1 0 0 -41.64276566183439 +8 1 1 -1 0 0 -40.520303613525016 +9 1 1 -1 0 0 -39.39784156521564 +10 1 1 -1 0 0 -38.27537951690627 +11 1 1 -1 0 0 -37.1529174685969 +12 1 1 -1 0 0 -36.030455420287524 +13 1 1 -1 0 0 -34.90799337197815 +14 1 1 -1 0 0 -33.78553132366878 +15 1 1 -1 0 0 -32.663069275359405 +16 1 1 -1 0 0 -31.54060722705003 +17 1 1 -1 0 0 -30.41814517874066 +18 1 1 -1 0 0 -29.295683130431286 +19 1 1 -1 0 0 -28.173221082121913 +20 1 1 -1 0 0 -27.05075903381254 +21 1 1 -1 0 0 -25.928296985503167 +22 1 1 -1 0 0 -24.805834937193794 +23 1 1 -1 0 0 -23.68337288888442 +24 1 1 -1 0 0 -22.560910840575048 +25 1 1 -1 0 0 -21.438448792265675 +26 1 1 -1 0 0 -20.3159867439563 +27 1 1 -1 0 0 -19.19352469564693 +28 1 1 -1 0 0 -18.071062647337556 +29 1 1 -1 0 0 -16.948600599028183 +30 1 1 -1 0 0 -15.82613855071881 +31 1 1 -1 0 0 -14.703676502409436 +32 1 1 -1 0 0 -13.581214454100063 +33 1 1 -1 0 0 -12.45875240579069 +34 1 1 -1 0 0 -11.336290357481317 +35 1 1 -1 0 0 -10.213828309171944 +36 1 1 -1 0 0 -9.091366260862571 +37 1 1 -1 0 0 -7.968904212553198 +38 1 1 -1 0 0 -6.846442164243825 +39 1 1 -1 0 0 -5.723980115934452 +40 1 1 -1 0 0 -4.601518067625079 +41 1 1 -1 0 0 -3.4790560193157063 +42 1 1 -1 0 0 -2.3565939710063333 +43 1 1 -1 0 0 -1.2341319226969603 +44 1 1 -1 0 0 -0.11166987438758724 +45 1 1 -1 0 0 1.0107921739217858 +46 1 1 -1 0 0 2.133254222231159 +47 1 1 -1 0 0 3.255716270540532 +48 1 1 -1 0 0 4.378178318849905 +49 1 1 -1 0 0 5.500640367159278 +50 1 1 -1 0 0 6.623102415468651 +51 1 1 -1 0 0 7.745564463778024 +52 1 1 -1 0 0 8.868026512087397 +53 1 1 -1 0 0 9.99048856039677 +54 1 1 -1 0 0 11.112950608706143 +55 1 1 -1 0 0 12.235412657015516 +56 1 1 -1 0 0 13.357874705324889 +57 1 1 -1 0 0 14.480336753634262 +58 1 1 -1 0 0 15.602798801943635 +59 1 1 -1 0 0 16.725260850253008 +60 1 1 -1 0 0 17.84772289856238 +61 1 1 -1 0 0 18.970184946871754 +62 1 1 -1 0 0 20.092646995181127 +63 1 1 -1 0 0 21.2151090434905 +64 1 1 -1 0 0 22.337571091799873 +65 1 1 -1 0 0 23.460033140109246 +66 1 1 -1 0 0 24.58249518841862 +67 1 1 -1 0 0 25.704957236727992 +68 1 1 -1 0 0 26.827419285037365 +69 1 1 -1 0 0 27.949881333346738 +70 1 1 -1 0 0 29.07234338165611 +71 1 1 -1 0 0 30.194805429965484 +72 1 1 -1 0 0 31.317267478274857 +73 1 1 -1 0 0 32.43972952658423 +74 1 1 -1 0 0 33.5621915748936 +75 1 1 -1 0 0 34.684653623202976 +76 1 1 -1 0 0 35.80711567151235 +77 1 1 -1 0 0 36.92957771982172 +78 1 1 -1 0 0 38.052039768131095 +79 1 1 -1 0 0 39.17450181644047 +80 1 1 -1 0 0 40.29696386474984 +81 0 2 1 -27.886422274724097 27.72001798427955 38.68169635811057 +82 0 2 1 29.812255760623188 17.871838747003693 -29.094648426460257 +83 0 2 1 -13.23881351410531 13.28123966828678 -24.422176415560116 +84 0 2 1 4.9465650593939685 -37.7521903558826 -15.115417767729575 +85 0 2 1 34.82527943387106 29.457664434004897 -25.565595338061254 +86 0 2 1 46.35660570786446 -7.161776614070412 -20.2471250527001 +87 0 2 1 39.20854546781531 34.96815569014278 13.893531822586723 +88 0 2 1 -7.797240698180197 0.07861219105048889 48.686453603015224 +89 0 2 1 43.92391845355516 -39.42362941705827 22.448930565867585 +90 0 2 1 -40.371744364329984 -17.743039071967246 -15.08153047835009 +91 0 2 1 -21.573165497710058 -0.5844447399891948 -45.73596994149077 +92 0 2 1 -19.882394451769102 -7.392447895357577 30.733607063808876 +93 0 2 1 -17.393031309514107 26.882975097407467 -47.64059480000892 +94 0 2 1 25.652222561671735 1.0229206994719107 -14.959030208952043 +95 0 2 1 26.075045766879313 19.902341017250052 46.70284805469666 +96 0 2 1 39.91980369168496 0.753749460187592 -26.203575929573407 +97 0 2 1 13.777613371273958 7.112171629839359 -33.5270487721399 +98 0 2 1 18.944534687271826 20.090215089875286 -34.381335468790574 +99 0 2 1 -23.801856387842435 -42.275962146864586 -8.322936238250279 +100 0 2 1 -31.386991395893826 29.83894468611787 8.937114269513422 +101 0 2 1 -41.07090001085809 49.59339931450579 6.666864232174753 +102 0 2 1 -46.58911504232167 -32.46068937927039 19.40424197066872 +103 0 2 1 -39.94659416571965 -36.28203465180086 5.841020764632312 +104 0 2 1 -26.027467090120137 -41.05522015175137 -1.1145958296128313 +105 0 2 1 37.09602855959457 23.76087951027276 45.09142423198867 +106 0 2 1 -27.78138413517528 -48.97344929918942 45.91491289356401 +107 0 2 1 4.468912883622387 -5.217782298407556 6.381420595433383 +108 0 2 1 36.758686966564525 48.425582881586166 -25.909273336802997 +109 0 2 1 -27.045102667146036 -19.713951008254117 4.339232870380627 +110 0 2 1 -5.984280016624311 -49.45311479123866 36.35727783065221 +111 0 2 1 27.833389147163018 -47.80144978082761 -47.71458334276804 +112 0 2 1 -23.628507668044364 -30.353876765128685 36.174277933133254 +113 0 2 1 -40.93360714431151 40.1336490864843 -27.035347797435495 +114 0 2 1 6.3523980881104976 -28.636485436097082 -10.671354350535445 +115 0 2 1 42.765716958607086 -32.85779663523676 -1.9682360265562124 +116 0 2 1 -33.68069757415453 16.800769050458484 -6.273374390373085 +117 0 2 1 13.909148568042937 4.921040289518388 12.111069913598996 +118 0 2 1 6.728324076730296 -48.44092815223126 -35.92436883370601 +119 0 2 1 -18.121173967321912 -15.76903395165283 2.2495451015454933 +120 0 2 1 -11.75253233489407 -45.82569982175387 -12.477142440015896 +121 0 2 1 1.9713864197144133 17.961034900064007 32.97992150691711 +122 0 2 1 -3.993384770632943 -47.63120435620297 27.75490859098018 +123 0 2 1 -0.32208279553454844 -47.30616152402566 -22.751109302380367 +124 0 2 1 -0.135777029397957 23.88599790464609 -31.87440560354473 +125 0 2 1 -6.123924906817393 -2.038519565120424 45.4809181974626 +126 0 2 1 -29.622588299895046 42.40404115712096 6.640479709229595 +127 0 2 1 -11.694512971272673 19.983258641775762 -38.152427411711145 +128 0 2 1 -20.93721440637313 39.46397829322392 -45.52708262202337 +129 0 2 1 34.13340147809369 36.14268504987945 -23.978137043267044 +130 0 2 1 -37.422309952611485 29.181841318883087 27.55677757161692 +131 0 2 1 30.11314373799594 18.721794400471353 1.5553303682670574 +132 0 2 1 -7.3563467211571805 46.84253369205935 -39.84708490437832 +133 0 2 1 -3.695927445484358 2.494403998274727 -7.634369981832755 +134 0 2 1 44.09701173592077 17.717328437831043 31.54108326477207 +135 0 2 1 48.070189931616795 10.601166369398662 -28.28574863896286 +136 0 2 1 -7.044858382811761 -42.080663380241766 -1.4369925734636553 +137 0 2 1 -12.485032488076918 23.87106169116919 6.178803347562642 +138 0 2 1 -15.613232443702309 10.103630885941392 -20.447182948810916 +139 0 2 1 28.610332347774147 37.08335835592116 -19.90280831362493 +140 0 2 1 25.853920233242505 -27.768648181803655 24.971357611943475 +141 0 2 1 9.256159541363296 -23.562096053197934 -4.722701100419371 +142 0 2 1 39.96929397877305 -11.88228547846326 -28.70638149104603 +143 0 2 1 -37.98545134633291 -23.50528193202669 -10.939982626098441 +144 0 2 1 25.40017763114089 -47.49220127581256 15.1783064865064 +145 0 2 1 28.073596076651768 3.6631266774864386 31.54355751177208 +146 0 2 1 -19.596457173068703 46.79824882013442 -12.302655772327597 +147 0 2 1 -36.46192411958321 -2.785830672302666 -25.1901381125736 +148 0 2 1 -27.377389198969894 11.295792272951147 39.32842550184691 +149 0 2 1 32.24967019136358 -20.517755791016402 31.20590722085157 +150 0 2 1 47.70698618147787 9.75462874031868 -28.267447889542563 +151 0 2 1 17.157803106328345 -27.48141290657965 7.7670687016760525 +152 0 2 1 15.089833959419678 5.342811012118396 27.35336620165029 +153 0 2 1 9.836963929211372 -11.047378229392443 -20.960811370690678 +154 0 2 1 44.66600586278604 14.949733274456321 -29.328965994323575 +155 0 2 1 -21.006260382140685 8.492712712433658 -46.31580169190271 +156 0 2 1 -29.970979487850748 -36.46250489415931 26.914372830947457 +157 0 2 1 -1.0821372755756329 -8.453379951300242 -19.95665062432509 +158 0 2 1 -24.033653425909772 -39.51330620205049 20.067656167683793 +159 0 2 1 27.747287624384626 -21.904990435351312 -10.819345241055956 +160 0 2 1 -40.86737066410612 -25.609300376714796 -21.128139356809783 + +Bonds + # bond_id bond_type atom1_id atom2_id +1 1 1 2 +2 1 2 3 +3 1 3 4 +4 1 4 5 +5 1 5 6 +6 1 6 7 +7 1 7 8 +8 1 8 9 +9 1 9 10 +10 1 10 11 +11 1 11 12 +12 1 12 13 +13 1 13 14 +14 1 14 15 +15 1 15 16 +16 1 16 17 +17 1 17 18 +18 1 18 19 +19 1 19 20 +20 1 20 21 +21 1 21 22 +22 1 22 23 +23 1 23 24 +24 1 24 25 +25 1 25 26 +26 1 26 27 +27 1 27 28 +28 1 28 29 +29 1 29 30 +30 1 30 31 +31 1 31 32 +32 1 32 33 +33 1 33 34 +34 1 34 35 +35 1 35 36 +36 1 36 37 +37 1 37 38 +38 1 38 39 +39 1 39 40 +40 1 40 41 +41 1 41 42 +42 1 42 43 +43 1 43 44 +44 1 44 45 +45 1 45 46 +46 1 46 47 +47 1 47 48 +48 1 48 49 +49 1 49 50 +50 1 50 51 +51 1 51 52 +52 1 52 53 +53 1 53 54 +54 1 54 55 +55 1 55 56 +56 1 56 57 +57 1 57 58 +58 1 58 59 +59 1 59 60 +60 1 60 61 +61 1 61 62 +62 1 62 63 +63 1 63 64 +64 1 64 65 +65 1 65 66 +66 1 66 67 +67 1 67 68 +68 1 68 69 +69 1 69 70 +70 1 70 71 +71 1 71 72 +72 1 72 73 +73 1 73 74 +74 1 74 75 +75 1 75 76 +76 1 76 77 +77 1 77 78 +78 1 78 79 +79 1 79 80 diff --git a/examples/USER/misc/charge_regulation/in_acid.chreg b/examples/USER/misc/charge_regulation/in_acid.chreg new file mode 100644 index 0000000000..32beeda732 --- /dev/null +++ b/examples/USER/misc/charge_regulation/in_acid.chreg @@ -0,0 +1,40 @@ +# Charge regulation lammps for simple weak electrolyte + +units lj +atom_style charge +dimension 3 +boundary p p p +processors * * * +neighbor 3.0 bin +read_data data_acid.chreg + +variable cut_long equal 12.5 +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0) +variable lunit_nm equal 0.72 # in the units of nm +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_coeff * * 1.0 1.0 ${cut_lj} # charges +kspace_style ewald 1.0e-3 +dielectric 1.0 +pair_modify shift no + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg all charge_regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep 0.005 +run 10000 diff --git a/examples/USER/misc/charge_regulation/in_polymer.chreg b/examples/USER/misc/charge_regulation/in_polymer.chreg new file mode 100644 index 0000000000..4dc72a8156 --- /dev/null +++ b/examples/USER/misc/charge_regulation/in_polymer.chreg @@ -0,0 +1,35 @@ +# Charge regulation lammps for a polymer chain +units lj +atom_style full +dimension 3 +boundary p p p +processors * * * +neighbor 3.0 bin +read_data data_polymer.chreg + +bond_style harmonic +bond_coeff 1 100 1.122462 # K R0 +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long 1.122462 20 +pair_coeff * * 1.0 1.0 1.122462 # charges +kspace_style pppm 1.0e-3 +pair_modify shift no +dielectric 1.0 + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg1 all charge_regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 +fix chareg2 all charge_regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 +fix chareg3 all charge_regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 + +thermo 100 +# print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions +thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] +timestep 0.005 +run 10000 diff --git a/examples/USER/misc/charge_regulation/log_acid.lammps b/examples/USER/misc/charge_regulation/log_acid.lammps new file mode 100644 index 0000000000..cbc3661eb1 --- /dev/null +++ b/examples/USER/misc/charge_regulation/log_acid.lammps @@ -0,0 +1,163 @@ +LAMMPS (24 Dec 2020) +Reading data file ... + orthogonal box = (-25.000000 -25.000000 -25.000000) to (25.000000 25.000000 25.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 219 atoms + read_data CPU = 0.001 seconds +Ewald initialization ... + using 12-bit tables for long-range coulomb (../kspace.cpp:339) + G vector (1/distance) = 0.14221027 + estimated absolute RMS force accuracy = 0.0010128126 + estimated relative force accuracy = 0.0010128126 + KSpace vectors: actual max1d max3d = 257 5 665 + kxmax kymax kzmax = 5 5 5 +0 atoms in group Fix_CR:exclusion_group:chareg +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 15.5 + ghost atom cutoff = 15.5 + binsize = 7.75, bins = 7 7 7 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Setting up Verlet run ... + Unit style : lj + Current step : 0 + Time step : 0.005 +Per MPI rank memory allocation (min/avg/max) = 11.91 | 11.91 | 11.91 Mbytes +Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] + 0 -0.054228269 1 0 0 1 99 0 0 109 10 + 100 -0.058672881 0.99159291 100 71 16 84 0 0 92 8 + 200 -0.05399313 0.92006523 200 154 26 74 0 0 85 11 + 300 -0.047035343 0.92728143 300 240 22 78 0 0 85 7 + 400 -0.049597809 1.0617937 400 319 16 84 0 0 92 8 + 500 -0.052409835 1.0006148 500 404 12 88 0 0 97 9 + 600 -0.056012172 0.98059344 600 481 15 85 0 0 92 7 + 700 -0.053639989 0.99572709 700 561 16 84 0 0 94 10 + 800 -0.060026132 0.95764632 800 639 22 78 0 0 84 6 + 900 -0.050785422 0.98399084 900 719 28 72 0 0 82 10 + 1000 -0.062294743 0.97200068 1000 797 26 74 0 0 82 8 + 1100 -0.051269402 1.0064376 1100 877 25 75 0 0 84 9 + 1200 -0.077744839 1.0159098 1200 955 23 77 0 0 88 11 + 1300 -0.084889696 1.1230485 1300 1037 20 80 0 0 90 10 + 1400 -0.059361445 0.96735845 1400 1120 18 82 0 0 93 11 + 1500 -0.052926174 0.95579188 1500 1199 24 76 0 0 86 10 + 1600 -0.052376649 0.99376378 1600 1284 22 78 0 0 89 11 + 1700 -0.052480188 0.96085964 1700 1361 27 73 0 0 84 11 + 1800 -0.065884306 0.96747971 1800 1441 21 79 0 0 84 5 + 1900 -0.054315859 0.95873145 1900 1521 23 77 0 0 84 7 + 2000 -0.037161802 0.93562039 2000 1604 27 73 0 0 79 6 + 2100 -0.034977265 0.97177103 2100 1684 26 74 0 0 85 11 + 2200 -0.047434868 0.97897613 2200 1762 17 83 0 0 93 10 + 2300 -0.047392634 0.96570672 2300 1837 18 82 0 0 92 10 + 2400 -0.044879306 0.98620033 2400 1910 19 81 0 0 89 8 + 2500 -0.069690496 1.0690505 2500 1988 16 84 0 0 91 7 + 2600 -0.081588407 0.97711054 2600 2067 17 83 0 0 92 9 + 2700 -0.06341681 1.0386711 2700 2146 20 80 0 0 85 5 + 2800 -0.045290012 1.0402055 2800 2230 18 82 0 0 91 9 + 2900 -0.046875012 1.0609775 2900 2317 24 76 0 0 86 10 + 3000 -0.031258722 0.93861202 3000 2400 24 76 0 0 85 9 + 3100 -0.04673342 0.90800583 3100 2485 25 75 0 0 90 15 + 3200 -0.054354227 0.94493881 3200 2567 16 84 0 0 94 10 + 3300 -0.053647746 0.92321446 3300 2641 17 83 0 0 94 11 + 3400 -0.031751732 0.93735127 3400 2725 22 78 0 0 92 14 + 3500 -0.053806113 0.98798136 3500 2795 28 72 0 0 84 12 + 3600 -0.040751349 0.84291639 3600 2873 28 72 0 0 84 12 + 3700 -0.051747138 1.072448 3700 2951 24 76 0 0 92 16 + 3800 -0.043420594 1.0076309 3800 3030 26 74 0 0 79 5 + 3900 -0.050845848 1.0250023 3900 3103 29 71 0 0 76 5 + 4000 -0.039837847 1.064111 4000 3182 29 71 0 0 83 12 + 4100 -0.045638995 1.1249685 4100 3262 28 72 0 0 81 9 + 4200 -0.047956491 0.92255907 4200 3348 26 74 0 0 87 13 + 4300 -0.054052822 1.006239 4300 3423 19 81 0 0 90 9 + 4400 -0.053148034 1.0028887 4400 3506 24 76 0 0 83 7 + 4500 -0.062132076 1.0317847 4500 3587 23 77 0 0 82 5 + 4600 -0.04616043 0.99066453 4600 3673 28 72 0 0 82 10 + 4700 -0.066990889 1.0242064 4700 3755 18 82 0 0 90 8 + 4800 -0.0564736 0.91765628 4800 3832 22 78 0 0 91 13 + 4900 -0.052301294 0.95348659 4900 3912 28 72 0 0 81 9 + 5000 -0.062630677 1.0336579 5000 3989 18 82 0 0 92 10 + 5100 -0.053645908 1.0314613 5100 4062 20 80 0 0 85 5 + 5200 -0.062189568 1.0504732 5200 4133 23 77 0 0 84 7 + 5300 -0.049092746 1.0310832 5300 4217 24 76 0 0 82 6 + 5400 -0.051859257 0.99600428 5400 4299 27 73 0 0 80 7 + 5500 -0.065540815 0.98012128 5500 4381 19 81 0 0 92 11 + 5600 -0.071018582 0.9252814 5600 4455 23 77 0 0 84 7 + 5700 -0.066954185 1.0325214 5700 4535 26 74 0 0 82 8 + 5800 -0.064847249 1.0313536 5800 4617 21 79 0 0 90 11 + 5900 -0.063173056 0.95455853 5900 4703 18 82 0 0 92 10 + 6000 -0.064807837 0.97182222 6000 4790 21 79 0 0 91 12 + 6100 -0.07067683 0.91775921 6100 4875 16 84 0 0 94 10 + 6200 -0.071400842 1.0162225 6200 4952 17 83 0 0 87 4 + 6300 -0.078479449 1.0106706 6300 5033 21 79 0 0 84 5 + 6400 -0.083167651 1.0246584 6400 5111 18 82 0 0 90 8 + 6500 -0.092611537 1.0766467 6500 5195 20 80 0 0 88 8 + 6600 -0.096710071 1.0246648 6600 5274 15 85 0 0 91 6 + 6700 -0.073399857 0.94939392 6700 5351 17 83 0 0 92 9 + 6800 -0.062479375 0.9393967 6800 5434 18 82 0 0 93 11 + 6900 -0.065391043 0.93475954 6900 5514 22 78 0 0 89 11 + 7000 -0.045655499 0.98688239 7000 5601 21 79 0 0 90 11 + 7100 -0.061186309 1.0309063 7100 5684 22 78 0 0 87 9 + 7200 -0.074737514 1.0516593 7200 5769 25 75 0 0 80 5 + 7300 -0.075228979 1.0167704 7300 5847 21 79 0 0 86 7 + 7400 -0.06660147 1.0947107 7400 5930 25 75 0 0 87 12 + 7500 -0.071915247 1.10542 7500 6009 24 76 0 0 84 8 + 7600 -0.029974303 0.99202697 7600 6095 28 72 0 0 80 8 + 7700 -0.029024004 1.0390995 7700 6182 28 72 0 0 83 11 + 7800 -0.056250746 0.96393961 7800 6260 18 82 0 0 91 9 + 7900 -0.072178944 0.9833919 7900 6339 21 79 0 0 86 7 + 8000 -0.070377248 1.021342 8000 6419 23 77 0 0 88 11 + 8100 -0.07753283 0.96194312 8100 6493 26 74 0 0 86 12 + 8200 -0.075617309 0.9715344 8200 6576 25 75 0 0 89 14 + 8300 -0.077480013 0.99106705 8300 6662 20 80 0 0 91 11 + 8400 -0.079901928 0.89855112 8400 6744 23 77 0 0 91 14 + 8500 -0.069192745 1.0606791 8500 6822 19 81 0 0 91 10 + 8600 -0.058657202 1.1270217 8600 6898 15 85 0 0 95 10 + 8700 -0.044985397 1.0367419 8700 6979 27 73 0 0 84 11 + 8800 -0.064266376 0.91557003 8800 7060 21 79 0 0 89 10 + 8900 -0.068680533 0.95963643 8900 7133 19 81 0 0 88 7 + 9000 -0.051736144 1.0398547 9000 7213 13 87 0 0 94 7 + 9100 -0.058381436 0.98047663 9100 7290 17 83 0 0 89 6 + 9200 -0.05531014 0.92541631 9200 7368 22 78 0 0 85 7 + 9300 -0.04386907 0.9339658 9300 7454 22 78 0 0 89 11 + 9400 -0.052293168 0.94314034 9400 7539 22 78 0 0 86 8 + 9500 -0.050362046 1.0489028 9500 7617 18 82 0 0 90 8 + 9600 -0.054272227 1.0879161 9600 7697 11 89 0 0 96 7 + 9700 -0.042514179 1.0051505 9700 7771 22 78 0 0 84 6 + 9800 -0.045365018 0.95363669 9800 7850 25 75 0 0 77 2 + 9900 -0.064287274 0.91994667 9900 7928 27 73 0 0 81 8 + 10000 -0.05689162 0.99963208 10000 8011 22 78 0 0 84 6 +Loop time of 19.4452 on 1 procs for 10000 steps with 190 atoms + +Performance: 222162.510 tau/day, 514.265 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.68864 | 0.68864 | 0.68864 | 0.0 | 3.54 +Kspace | 6.7893 | 6.7893 | 6.7893 | 0.0 | 34.92 +Neigh | 0.060782 | 0.060782 | 0.060782 | 0.0 | 0.31 +Comm | 0.047035 | 0.047035 | 0.047035 | 0.0 | 0.24 +Output | 0.0027227 | 0.0027227 | 0.0027227 | 0.0 | 0.01 +Modify | 11.838 | 11.838 | 11.838 | 0.0 | 60.88 +Other | | 0.01878 | | | 0.10 + +Nlocal: 190.000 ave 190 max 190 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 592.000 ave 592 max 592 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 2194.00 ave 2194 max 2194 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 2194 +Ave neighs/atom = 11.547368 +Neighbor list builds = 10287 +Dangerous builds = 0 +Total wall time: 0:00:19 \ No newline at end of file diff --git a/examples/USER/misc/charge_regulation/log_polymer.lammps b/examples/USER/misc/charge_regulation/log_polymer.lammps new file mode 100644 index 0000000000..87cab63a6c --- /dev/null +++ b/examples/USER/misc/charge_regulation/log_polymer.lammps @@ -0,0 +1,181 @@ +LAMMPS (24 Dec 2020) +Reading data file ... + orthogonal box = (-50.000000 -50.000000 -50.000000) to (50.000000 50.000000 50.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 160 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 79 bonds +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 2 = max # of 1-3 neighbors + 4 = max # of 1-4 neighbors + 6 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.004 seconds +PPPM initialization ... + using 12-bit tables for long-range coulomb (../kspace.cpp:339) + G vector (1/distance) = 0.077106934 + grid = 8 8 8 + stencil order = 5 + estimated absolute RMS force accuracy = 0.00074388331 + estimated relative force accuracy = 0.00074388331 + using double precision KISS FFT + 3d grid and FFT values/proc = 2197 512 +0 atoms in group Fix_CR:exclusion_group:chareg1 +0 atoms in group Fix_CR:exclusion_group:chareg2 +0 atoms in group Fix_CR:exclusion_group:chareg3 +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 23 + ghost atom cutoff = 23 + binsize = 11.5, bins = 9 9 9 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Setting up Verlet run ... + Unit style : lj + Current step : 0 + Time step : 0.005 +Per MPI rank memory allocation (min/avg/max) = 6.962 | 6.962 | 6.962 Mbytes +Step PotEng c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + 0 0.49903297 1 0 80 80 0 0 0 + 100 0.63380666 0.87307225 8 72 77 6 1 0 + 200 0.5865464 1.0048645 16 64 81 16 0 1 + 300 0.55802913 1.0499142 19 61 91 29 0 1 + 400 0.44734087 1.0838048 24 56 98 41 0 1 + 500 0.47010775 1.005226 23 57 106 48 0 1 + 600 0.3452105 0.97814306 28 52 109 56 0 1 + 700 0.29208955 0.99766419 32 48 115 67 0 0 + 800 0.27821915 1.0091641 31 49 128 80 1 0 + 900 0.28943788 0.93619239 26 54 145 91 0 0 + 1000 0.22963142 1.0162138 27 53 150 97 0 0 + 1100 0.24238916 0.99146577 31 49 149 100 0 0 + 1200 0.17029095 1.0406453 38 42 144 102 0 0 + 1300 0.15830969 0.94661447 34 46 155 109 0 0 + 1400 0.16698712 1.0116563 35 45 159 114 0 0 + 1500 0.15432936 0.95600941 36 44 162 118 0 0 + 1600 0.16973501 0.98326602 31 49 171 122 0 0 + 1700 0.19725116 0.9915273 33 47 175 128 0 0 + 1800 0.15278999 1.0304873 29 51 193 142 0 0 + 1900 0.17418479 0.99490216 30 50 194 144 0 0 + 2000 0.14238391 0.9638301 32 48 189 141 0 0 + 2100 0.13054378 0.97164976 32 48 192 144 0 0 + 2200 0.092083069 1.0112059 40 40 191 151 0 0 + 2300 0.085175091 1.0070667 39 41 200 159 0 0 + 2400 0.083367076 0.9934796 35 45 208 163 0 0 + 2500 0.11494744 0.97650855 31 49 220 172 1 0 + 2600 0.10796032 0.97047046 34 46 221 175 0 0 + 2700 0.11080141 0.93570013 36 44 223 179 0 0 + 2800 0.096699277 0.97702627 35 45 223 178 0 0 + 2900 0.079403783 1.0870961 32 48 229 181 0 0 + 3000 0.08288836 1.0642515 35 45 231 186 0 0 + 3100 0.094000833 1.0241111 38 42 229 187 0 0 + 3200 0.10011052 1.043594 34 46 235 189 0 0 + 3300 0.096782103 0.99549134 34 46 234 188 0 0 + 3400 0.057703946 1.00292 34 46 236 190 0 0 + 3500 0.074345642 0.95064523 36 44 234 190 0 0 + 3600 0.085872341 0.9759514 35 45 238 192 0 1 + 3700 0.086427565 0.99843063 35 45 240 194 0 1 + 3800 0.076091357 0.98516844 32 48 252 203 0 1 + 3900 0.047187813 1.0063336 37 43 247 204 0 0 + 4000 0.068269223 1.0390369 35 45 248 203 0 0 + 4100 0.074209582 0.99912762 36 44 249 205 0 0 + 4200 0.087016078 1.050265 36 44 246 202 0 0 + 4300 0.081325479 1.0417103 35 45 245 200 0 0 + 4400 0.047345973 0.96517298 39 41 243 202 0 0 + 4500 0.041856955 0.94569673 38 42 245 203 0 0 + 4600 0.049588267 0.99046371 42 38 249 211 0 0 + 4700 0.043079897 1.0098538 43 37 245 208 0 0 + 4800 0.049122913 1.0229995 41 39 247 208 0 0 + 4900 0.059151797 1.0236679 36 44 249 205 0 0 + 5000 0.053806841 1.0308397 42 38 243 205 0 0 + 5100 0.053623833 1.0638841 39 41 246 205 0 0 + 5200 0.086215806 1.0027613 37 43 243 200 0 0 + 5300 0.031422797 1.0338154 38 42 245 203 0 0 + 5400 0.051341116 0.92205149 34 46 246 200 0 0 + 5500 0.039292708 0.97530704 32 48 251 203 0 0 + 5600 0.035215415 1.023123 33 47 246 199 0 0 + 5700 0.054553598 0.95833063 30 50 253 203 0 0 + 5800 0.035699456 1.0721613 37 43 248 205 0 0 + 5900 0.062426908 1.0612245 38 42 252 210 0 0 + 6000 0.056362902 1.0002968 36 44 248 204 0 0 + 6100 0.061550208 0.97270904 38 42 245 203 0 0 + 6200 0.051825485 0.98187623 36 44 253 209 0 0 + 6300 0.052137885 0.98906723 36 44 253 210 1 0 + 6400 0.068218075 1.0511584 36 44 256 212 0 0 + 6500 0.080167413 0.97270144 36 44 252 208 0 0 + 6600 0.052169204 1.0160108 41 39 249 210 0 0 + 6700 0.057313326 0.98033894 38 42 251 209 0 0 + 6800 0.073008094 0.96239565 35 45 256 211 0 0 + 6900 0.060159599 1.0063892 37 43 264 221 0 0 + 7000 0.061738744 1.0031443 39 41 259 218 0 0 + 7100 0.043263424 1.0425248 44 36 255 219 0 0 + 7200 0.052179167 0.99512151 39 41 261 220 0 0 + 7300 0.053258707 1.0171204 43 37 256 219 0 0 + 7400 0.026037532 0.93786837 45 35 259 224 0 0 + 7500 0.029731213 1.0172281 46 34 250 216 0 0 + 7600 0.023118288 0.95628439 42 38 262 224 0 0 + 7700 0.037021854 0.99991854 42 38 263 225 0 0 + 7800 0.050404736 1.0130826 40 40 260 220 0 0 + 7900 0.035658921 0.95772506 40 40 259 219 0 0 + 8000 0.034426806 1.0028052 40 40 254 214 0 0 + 8100 0.041427611 1.0347682 40 40 256 216 0 0 + 8200 0.05986843 0.9804614 38 42 262 220 0 0 + 8300 0.041419023 1.0613186 37 43 264 221 0 0 + 8400 0.065701758 1.0511531 40 40 256 216 0 0 + 8500 0.091954526 0.97190676 37 43 257 214 0 0 + 8600 0.056982532 1.017813 35 45 252 207 0 0 + 8700 0.075615111 1.0148527 29 51 263 212 0 0 + 8800 0.066070082 1.0259454 33 47 260 213 0 0 + 8900 0.055054194 1.0183535 37 43 247 204 0 0 + 9000 0.063070816 1.0266115 39 41 244 203 0 0 + 9100 0.10174156 0.99457684 34 46 246 200 0 0 + 9200 0.071667261 1.033159 33 47 249 202 0 0 + 9300 0.05520096 0.99821492 38 42 243 201 0 0 + 9400 0.050355422 0.99148522 37 43 243 200 0 0 + 9500 0.062314961 1.0042937 36 44 252 208 0 0 + 9600 0.061148899 1.0052132 37 43 254 211 0 0 + 9700 0.078695273 1.0175164 37 43 252 209 0 0 + 9800 0.067487202 1.0110138 35 45 258 213 0 0 + 9900 0.070340779 0.99640142 31 49 263 214 0 0 + 10000 0.037252172 0.99863894 32 48 259 211 0 0 +Loop time of 23.0419 on 1 procs for 10000 steps with 550 atoms + +Performance: 187484.206 tau/day, 433.991 timesteps/s +100.0% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.5444 | 2.5444 | 2.5444 | 0.0 | 11.04 +Bond | 0.025075 | 0.025075 | 0.025075 | 0.0 | 0.11 +Kspace | 4.7385 | 4.7385 | 4.7385 | 0.0 | 20.56 +Neigh | 0.2058 | 0.2058 | 0.2058 | 0.0 | 0.89 +Comm | 0.073087 | 0.073087 | 0.073087 | 0.0 | 0.32 +Output | 0.003464 | 0.003464 | 0.003464 | 0.0 | 0.02 +Modify | 15.417 | 15.417 | 15.417 | 0.0 | 66.91 +Other | | 0.03479 | | | 0.15 + +Nlocal: 550.000 ave 550 max 550 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1023.00 ave 1023 max 1023 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 9644.00 ave 9644 max 9644 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 9644 +Ave neighs/atom = 17.534545 +Ave special neighs/atom = 0.85090909 +Neighbor list builds = 7576 +Dangerous builds = 0 +Total wall time: 0:00:23 \ No newline at end of file diff --git a/src/USER-MISC/README b/src/USER-MISC/README index 314fe6146e..ef25a0c116 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -53,6 +53,7 @@ dihedral_style table/cut, Mike Salerno, ksalerno@pha.jhu.edu, 11 May 18 fix accelerate/cos, Zheng Gong (ENS de Lyon), z.gong@outlook.com, 24 Apr 20 fix addtorque, Laurent Joly (U Lyon), ljoly.ulyon at gmail.com, 8 Aug 11 fix ave/correlate/long, Jorge Ramirez (UPM Madrid), jorge.ramirez at upm.es, 21 Oct 2015 +fix charge_regulation, Tine Curk and Jiaxing Yuan, tcurk5@gmail.com, 02 Feb 2021 fix electron/stopping/fit, James Stewart (SNL), jstewa .at. sandia.gov, 23 Sep 2020 fix electron/stopping, Konstantin Avchaciov, k.avchachov at gmail.com, 26 Feb 2019 fix ffl, David Wilkins (EPFL Lausanne), david.wilkins @ epfl.ch, 28 Sep 2018 diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp new file mode 100644 index 0000000000..3bb9de1b27 --- /dev/null +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -0,0 +1,1335 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Tine Curk (tcurk5@gmail.com) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) +------------------------------------------------------------------------- */ +#include "fix_charge_regulation.h" +#include +#include +#include +#include "atom.h" +#include "atom_vec.h" +#include "molecule.h" +#include "update.h" +#include "modify.h" +#include "fix.h" +#include "comm.h" +#include "compute.h" +#include "group.h" +#include "domain.h" +#include "region.h" +#include "random_park.h" +#include "force.h" +#include "pair.h" +#include "bond.h" +#include "angle.h" +#include "dihedral.h" +#include "improper.h" +#include "kspace.h" +#include "math_extra.h" +#include "math_const.h" +#include "memory.h" +#include "error.h" +#include "neighbor.h" + +using namespace LAMMPS_NS; +using namespace FixConst; +using namespace MathConst; + +// large energy value used to signal overlap +#define MAXENERGYSIGNAL 1.0e100 +#define MAXENERGYTEST 1.0e50 +#define small 0.0000001 +#define PI 3.1415926 + +/* ---------------------------------------------------------------------- */ +Fix_charge_regulation::Fix_charge_regulation(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), + ngroups(0), groupstrings(NULL), + random_equal(NULL), random_unequal(NULL), + idftemp(NULL), ptype_ID(NULL) { + + // Region restrictions not yet implemented .. + + vector_flag = 1; + size_vector = 8; + global_freq = 1; + extvector = 0; + restart_global = 1; + time_depend = 1; + cr_nmax = 0; + overlap_flag = 0; + energy_stored = 0; + + // necessary to specify the free ion types + cation_type = utils::inumeric(FLERR, arg[3], false, lmp); + anion_type = utils::inumeric(FLERR, arg[4], false, lmp); + + // set defaults and read optional arguments + options(narg - 5, &arg[5]); + + if (nevery <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (nmc < 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (llength_unit_in_nm < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (*target_temperature_tcp < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (seed <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (cation_type <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (anion_type <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (reaction_distance < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (salt_charge[0] <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (salt_charge[1] >= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if ((salt_charge[1] % salt_charge[0] != 0) && (salt_charge[0] % salt_charge[1] != 0)) + error->all(FLERR, + "Illegal fix charge_regulation command, multivalent cation/anion charges are allowed, " + "but must be divisible, e.g. (3,-1) is fine, but (3,-2) is not implemented"); + + if (pmcmoves[0] < 0 || pmcmoves[1] < 0 || pmcmoves[2] < 0) + error->all(FLERR, "Illegal fix charge_regulation command"); + if (acid_type < 0) pmcmoves[0] = 0; + if (base_type < 0) pmcmoves[1] = 0; + // normalize + double psum = pmcmoves[0] + pmcmoves[1] + pmcmoves[2]; + if (psum <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + pmcmoves[0] /= psum; + pmcmoves[1] /= psum; + pmcmoves[2] /= psum; + + force_reneighbor = 1; + next_reneighbor = update->ntimestep + 1; + random_equal = new RanPark(lmp, seed); + random_unequal = new RanPark(lmp, seed); + nacid_attempts = 0; + nacid_successes = 0; + nbase_attempts = 0; + nbase_successes = 0; + nsalt_attempts = 0; + nsalt_successes = 0; +} + +Fix_charge_regulation::~Fix_charge_regulation() { + + memory->destroy(ptype_ID); + + delete random_equal; + delete random_unequal; + + if (group) { + int igroupall = group->find("all"); + neighbor->exclusion_group_group_delete(exclusion_group, igroupall); + } +} + +int Fix_charge_regulation::setmask() { + int mask = 0; + mask |= PRE_EXCHANGE; + return mask; +} + +void Fix_charge_regulation::init() { + + triclinic = domain->triclinic; + + char *id_pe = (char *) "thermo_pe"; + int ipe = modify->find_compute(id_pe); + c_pe = modify->compute[ipe]; + + if (atom->molecule_flag) { + + int flag = 0; + for (int i = 0; i < atom->nlocal; i++) + if (atom->type[i] == cation_type || atom->type[i] == anion_type) + if (atom->molecule[i]) flag = 1; + int flagall = flag; + + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); + if (flagall && comm->me == 0) + error->all(FLERR, "Fix charge regulation cannot exchange individual atoms (ions) belonging to a molecule"); + } + + if (domain->dimension == 2) + error->all(FLERR, "Cannot use fix charge regulation in a 2d simulation"); + + // create a new group for interaction exclusions + // used for attempted atom deletions + // skip if already exists from previous init() + + if (!exclusion_group_bit) { + char **group_arg = new char *[4]; + + // create unique group name for atoms to be excluded + int len = strlen(id) + 30; + group_arg[0] = new char[len]; + sprintf(group_arg[0], "Fix_CR:exclusion_group:%s", id); + group_arg[1] = (char *) "subtract"; + group_arg[2] = (char *) "all"; + group_arg[3] = (char *) "all"; + group->assign(4, group_arg); + exclusion_group = group->find(group_arg[0]); + if (exclusion_group == -1) + error->all(FLERR, "Could not find fix CR exclusion group ID"); + exclusion_group_bit = group->bitmask[exclusion_group]; + + // neighbor list exclusion setup + // turn off interactions between group all and the exclusion group + + int narg = 4; + char **arg = new char *[narg];; + arg[0] = (char *) "exclude"; + arg[1] = (char *) "group"; + arg[2] = group_arg[0]; + arg[3] = (char *) "all"; + neighbor->modify_params(narg, arg); + delete[] group_arg[0]; + delete[] group_arg; + delete[] arg; + } + + // check that no deletable atoms are in atom->firstgroup + // deleting such an atom would not leave firstgroup atoms first + + if (atom->firstgroup >= 0) { + int *mask = atom->mask; + int firstgroupbit = group->bitmask[atom->firstgroup]; + + int flag = 0; + for (int i = 0; i < atom->nlocal; i++) + if ((mask[i] == groupbit) && (mask[i] && firstgroupbit)) flag = 1; + + int flagall; + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); + + if (flagall) + error->all(FLERR, "Cannot do Fix charge regulation on atoms in atom_modify first group"); + } + + // construct group bitmask for all new atoms + // aggregated over all group keywords + + groupbitall = 1 | groupbit; + + for (int igroup = 0; igroup < ngroups; igroup++) { + int jgroup = group->find(groupstrings[igroup]); + if (jgroup == -1) + error->all(FLERR, "Could not find specified fix charge regulation group ID"); + groupbitall |= group->bitmask[jgroup]; + } +} + +void Fix_charge_regulation::pre_exchange() { + + if (next_reneighbor != update->ntimestep) return; + xlo = domain->boxlo[0]; + xhi = domain->boxhi[0]; + ylo = domain->boxlo[1]; + yhi = domain->boxhi[1]; + zlo = domain->boxlo[2]; + zhi = domain->boxhi[2]; + + if (triclinic) { + sublo = domain->sublo_lamda; + subhi = domain->subhi_lamda; + } else { + sublo = domain->sublo; + subhi = domain->subhi; + } + volume = domain->xprd * domain->yprd * domain->zprd; + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + comm->exchange(); + atom->nghost = 0; + comm->borders(); + + if (triclinic) domain->lamda2x(atom->nlocal + atom->nghost); + energy_stored = energy_full(); + if (energy_stored > MAXENERGYTEST) + error->warning(FLERR, "Energy of old configuration in fix charge_regulation is > MAXENERGYTEST."); + + if ((reaction_distance > fabs(domain->boxhi[0] - domain->boxlo[0]) / 2) || + (reaction_distance > fabs(domain->boxhi[1] - domain->boxlo[1]) / 2) || + (reaction_distance > fabs(domain->boxhi[2] - domain->boxlo[2]) / 2)) { + error->warning(FLERR, + "reaction distance (rxd) is larger than half the box dimension, resetting default: xrd = 0."); + reaction_distance = 0; + } + // volume in units of (N_A * mol / liter) + volume_rx = (xhi - xlo) * (yhi - ylo) * (zhi - zlo) * pow(llength_unit_in_nm, 3) * 0.602214; + if (reaction_distance < small) { + vlocal_xrd = volume_rx; + } else { + vlocal_xrd = 4.0 * PI * pow(reaction_distance, 3) / 3.0 * pow(llength_unit_in_nm, 3) * 0.602214; + } + beta = 1.0 / (force->boltz * *target_temperature_tcp); + + // reinitialize counters + nacid_neutral = particle_number(acid_type, 0); + nacid_charged = particle_number(acid_type, -1); + nbase_neutral = particle_number(base_type, 0); + nbase_charged = particle_number(base_type, 1); + ncation = particle_number(cation_type, salt_charge[0]); + nanion = particle_number(anion_type, salt_charge[1]); + + + // Attempt exchanges + if (!only_salt_flag) { + + // Do charge regulation + for (int i = 0; i < nmc; i++) { + double rand_number = random_equal->uniform(); + if (rand_number < pmcmoves[0] / 2) { + forward_acid(); + nacid_attempts++; + } else if (rand_number < pmcmoves[0]) { + backward_acid(); + nacid_attempts++; + } else if (rand_number < pmcmoves[0] + pmcmoves[1] / 2) { + forward_base(); + nbase_attempts++; + } else if (rand_number < pmcmoves[0] + pmcmoves[1]) { + backward_base(); + nbase_attempts++; + } else if (rand_number < pmcmoves[0] + pmcmoves[1] + pmcmoves[2] / 2) { + forward_ions(); + nsalt_attempts++; + } else { + backward_ions(); + nsalt_attempts++; + } + } + } else { + // do only ion insertion, multivalent cation/anions are implemented + if (salt_charge[0] >= -salt_charge[1]) { + salt_charge_ratio = -salt_charge[0] / salt_charge[1]; + } else { + salt_charge_ratio = -salt_charge[1] / salt_charge[0]; + } + for (int i = 0; i < nmc; i++) { + double rand_number = random_equal->uniform(); + if (rand_number < 0.5) { + forward_ions_multival(); + nsalt_attempts++; + } else { + backward_ions_multival(); + nsalt_attempts++; + } + } + } + + // assign unique tags to newly inserted ions + if (add_tags_flag && atom->tag_enable) assign_tags(); + + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + comm->exchange(); + atom->nghost = 0; + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal + atom->nghost); + next_reneighbor = update->ntimestep + nevery; +} + +void Fix_charge_regulation::forward_acid() { + + double energy_before = energy_stored; + double factor; + double *dummyp; + double pos[3]; + pos[0] = 0; + pos[1] = 0; + pos[2] = 0; // acid/base particle position + double pos_all[3]; + int m1 = -1, m2 = -1; + + m1 = get_random_particle(acid_type, 0, 0, dummyp); + if (npart_xrd != nacid_neutral) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + + if (nacid_neutral > 0) { + if (m1 >= 0) { + atom->q[m1] = -1; // assign negative charge to acid + pos[0] = atom->x[m1][0]; + pos[1] = atom->x[m1][1]; + pos[2] = atom->x[m1][2]; + } + npart_xrd2 = ncation; + if (reaction_distance >= small) { + pos_all[0] = pos[0]; + pos_all[1] = pos[1]; + pos_all[2] = pos[2]; + MPI_Allreduce(pos, pos_all, 3, MPI_DOUBLE, MPI_SUM, world); + npart_xrd2 = particle_number_xrd(cation_type, 1, reaction_distance, pos_all); + } + m2 = insert_particle(cation_type, 1, reaction_distance, pos_all); + factor = nacid_neutral * vlocal_xrd * pow(10, -pKa) + * (1 + pow(10, pH - pI_plus)) / ((1 + nacid_charged) * (1 + npart_xrd2)); + + double energy_after = energy_full(); + + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + nacid_successes += 1; + ncation++; + nacid_charged++; + nacid_neutral--; + } else { + energy_stored = energy_before; + atom->natoms--; + if (m2 >= 0) { + atom->nlocal--; + } + if (m1 >= 0) { + atom->q[m1] = 0; + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + } + } +} + +void Fix_charge_regulation::backward_acid() { + + double energy_before = energy_stored; + double factor; + int mask_tmp; + double *dummyp; + double pos[3]; + pos[0] = 0; + pos[1] = 0; + pos[2] = 0; // acid/base particle position + double pos_all[3]; + int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + + m1 = get_random_particle(acid_type, -1, 0, dummyp); + if (npart_xrd != nacid_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + + if (nacid_charged > 0) { + if (m1 >= 0) { + atom->q[m1] = 0; + pos[0] = atom->x[m1][0]; + pos[1] = atom->x[m1][1]; + pos[2] = atom->x[m1][2]; + } + if (reaction_distance >= small) { + pos_all[0] = pos[0]; + pos_all[1] = pos[1]; + pos_all[2] = pos[2]; + MPI_Allreduce(pos, pos_all, 3, MPI_DOUBLE, MPI_SUM, world); + } + m2 = get_random_particle(cation_type, 1, reaction_distance, pos_all); + // note: npart_xrd changes everytime get_random_particle is called. + + if (npart_xrd > 0) { + if (m2 >= 0) { + atom->q[m2] = 0; + mask_tmp = atom->mask[m2]; // remember group bits. + atom->mask[m2] = exclusion_group_bit; + } + factor = (1 + nacid_neutral) * vlocal_xrd * pow(10, -pKa) + * (1 + pow(10, pH - pI_plus)) / (nacid_charged * npart_xrd); + + double energy_after = energy_full(); + + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < (1.0 / factor) * exp(beta * (energy_before - energy_after))) { + nacid_successes += 1; + atom->natoms--; + energy_stored = energy_after; + nacid_charged--; + nacid_neutral++; + ncation--; + if (m2 >= 0) { + atom->avec->copy(atom->nlocal - 1, m2, 1); + atom->nlocal--; + } + } else { + energy_stored = energy_before; + if (m1 >= 0) { + atom->q[m1] = -1; + } + if (m2 >= 0) { + atom->q[m2] = 1; + atom->mask[m2] = mask_tmp; + } + } + } else { + if (m1 >= 0) { + atom->q[m1] = -1; + } + } + } +} + +void Fix_charge_regulation::forward_base() { + + double energy_before = energy_stored; + double factor; + double *dummyp; + double pos[3]; + pos[0] = 0; + pos[1] = 0; + pos[2] = 0; // acid/base particle position + double pos_all[3]; + int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + + m1 = get_random_particle(base_type, 0, 0, dummyp); + if (npart_xrd != nbase_neutral) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + + if (nbase_neutral > 0) { + if (m1 >= 0) { + atom->q[m1] = 1; // assign negative charge to acid + pos[0] = atom->x[m1][0]; + pos[1] = atom->x[m1][1]; + pos[2] = atom->x[m1][2]; + } + npart_xrd2 = nanion; + if (reaction_distance >= small) { + pos_all[0] = pos[0]; + pos_all[1] = pos[1]; + pos_all[2] = pos[2]; + MPI_Allreduce(pos, pos_all, 3, MPI_DOUBLE, MPI_SUM, world); + npart_xrd2 = particle_number_xrd(anion_type, -1, reaction_distance, pos_all); + } + factor = nbase_neutral * vlocal_xrd * pow(10, -pKb) + * (1 + pow(10, pKs - pH - pI_minus)) / + ((1 + nbase_charged) * (1 + npart_xrd2)); + m2 = insert_particle(anion_type, -1, reaction_distance, pos_all); + + double energy_after = energy_full(); + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + nbase_successes += 1; + nbase_charged++; + nbase_neutral--; + nanion++; + } else { + energy_stored = energy_before; + atom->natoms--; + if (m2 >= 0) { + atom->nlocal--; + } + if (m1 >= 0) { + atom->q[m1] = 0; + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + } + } +} + +void Fix_charge_regulation::backward_base() { + + double energy_before = energy_stored; + double factor; + double *dummyp; + int mask_tmp; + double pos[3]; + pos[0] = 0; + pos[1] = 0; + pos[2] = 0; // acid/base particle position + double pos_all[3]; + int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + + m1 = get_random_particle(base_type, 1, 0, dummyp); + if (npart_xrd != nbase_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + + if (nbase_charged > 0) { + if (m1 >= 0) { + atom->q[m1] = 0; + pos[0] = atom->x[m1][0]; + pos[1] = atom->x[m1][1]; + pos[2] = atom->x[m1][2]; + } + if (reaction_distance >= small) { + pos_all[0] = pos[0]; + pos_all[1] = pos[1]; + pos_all[2] = pos[2]; + MPI_Allreduce(pos, pos_all, 3, MPI_DOUBLE, MPI_SUM, world); + } + m2 = get_random_particle(anion_type, -1, reaction_distance, pos_all); + + if (npart_xrd > 0) { + if (m2 >= 0) { + atom->q[m2] = 0; + mask_tmp = atom->mask[m2]; // remember group bits. + atom->mask[m2] = exclusion_group_bit; + } + factor = (1 + nbase_neutral) * vlocal_xrd * pow(10, -pKb) + * (1 + pow(10, pKs - pH - pI_minus)) / (nbase_charged * npart_xrd); + + double energy_after = energy_full(); + + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < (1.0 / factor) * exp(beta * (energy_before - energy_after))) { + nbase_successes += 1; + atom->natoms--; + energy_stored = energy_after; + nbase_charged--; + nbase_neutral++; + nanion--; + if (m2 >= 0) { + atom->avec->copy(atom->nlocal - 1, m2, 1); + atom->nlocal--; + } + } else { + energy_stored = energy_before; + if (m1 >= 0) { + atom->q[m1] = 1; + } + if (m2 >= 0) { + atom->q[m2] = -1; + atom->mask[m2] = mask_tmp; + } + } + } else { + if (m1 >= 0) { + atom->q[m1] = 1; + } + } + } +} + +void Fix_charge_regulation::forward_ions() { + + double energy_before = energy_stored; + double factor; + double *dummyp; + int m1 = -1, m2 = -1; + factor = volume_rx * volume_rx * (pow(10, -pH) + pow(10, -pI_plus)) + * (pow(10, -pKs + pH) + pow(10, -pI_minus)) / + ((1 + ncation) * (1 + nanion)); + + m1 = insert_particle(cation_type, +1, 0, dummyp); + m2 = insert_particle(anion_type, -1, 0, dummyp); + double energy_after = energy_full(); + if (energy_after < MAXENERGYTEST && random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + nsalt_successes += 1; + ncation++; + nanion++; + } else { + energy_stored = energy_before; + atom->natoms--; + if (m1 >= 0) { + atom->nlocal--; + } + atom->natoms--; + if (m2 >= 0) { + atom->nlocal--; + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + } +} + + +void Fix_charge_regulation::backward_ions() { + + double energy_before = energy_stored; + double factor; + int mask1_tmp, mask2_tmp; + double *dummyp; // dummy pointer + int m1 = -1, m2 = -1; + + m1 = get_random_particle(cation_type, +1, 0, dummyp); + if (npart_xrd != ncation) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (ncation > 0) { + m2 = get_random_particle(anion_type, -1, 0, dummyp); + if (npart_xrd != nanion) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (nanion > 0) { + + // attempt deletion + + if (m1 >= 0) { + atom->q[m1] = 0; + mask1_tmp = atom->mask[m1]; + atom->mask[m1] = exclusion_group_bit; + } + if (m2 >= 0) { + atom->q[m2] = 0; + mask2_tmp = atom->mask[m2]; + atom->mask[m2] = exclusion_group_bit; + } + factor = (volume_rx * volume_rx * (pow(10, -pH) + pow(10, -pI_plus)) * + (pow(10, -pKs + pH) + pow(10, -pI_minus))) / (ncation * nanion); + + double energy_after = energy_full(); + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < (1.0 / factor) * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + nsalt_successes += 1; + ncation--; + nanion--; + + // ions must be deleted in order, otherwise index m could change upon the first deletion + atom->natoms -= 2; + if (m1 > m2) { + if (m1 >= 0) { + atom->avec->copy(atom->nlocal - 1, m1, 1); + atom->nlocal--; + } + if (m2 >= 0) { + atom->avec->copy(atom->nlocal - 1, m2, 1); + atom->nlocal--; + } + } else { + if (m2 >= 0) { + atom->avec->copy(atom->nlocal - 1, m2, 1); + atom->nlocal--; + } + if (m1 >= 0) { + atom->avec->copy(atom->nlocal - 1, m1, 1); + atom->nlocal--; + } + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + + } else { + energy_stored = energy_before; + + // reassign original charge and mask + if (m1 >= 0) { + atom->q[m1] = 1; + atom->mask[m1] = mask1_tmp; + } + if (m2 >= 0) { + atom->q[m2] = -1; + atom->mask[m2] = mask2_tmp; + } + } + } else { + // reassign original charge and mask + if (m1 >= 0) { + atom->q[m1] = 1; + atom->mask[m1] = mask1_tmp; + } + } + } +} + +void Fix_charge_regulation::forward_ions_multival() { + + double energy_before = energy_stored; + double factor = 1; + double *dummyp; + int mm[salt_charge_ratio + 1];// particle ID array for all ions to be inserted + + if (salt_charge[0] <= -salt_charge[1]) { + // insert one anion and (salt_charge_ratio) cations + + mm[0] = insert_particle(anion_type, salt_charge[1], 0, dummyp); + factor *= volume_rx * pow(10, -pI_minus) / (1 + nanion); + for (int i = 0; i < salt_charge_ratio; i++) { + mm[i + 1] = insert_particle(cation_type, salt_charge[0], 0, dummyp); + factor *= volume_rx * pow(10, -pI_plus) / (1 + ncation + i); + } + } else { + // insert one cation and (salt_charge_ratio) anions + + mm[0] = insert_particle(cation_type, salt_charge[0], 0, dummyp); + factor *= volume_rx * pow(10, -pI_plus) / (1 + ncation); + for (int i = 0; i < salt_charge_ratio; i++) { + mm[i + 1] = insert_particle(anion_type, salt_charge[1], 0, dummyp); + factor *= volume_rx * pow(10, -pI_minus) / (1 + nanion + i); + } + } + + double energy_after = energy_full(); + if (energy_after < MAXENERGYTEST && random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + nsalt_successes += 1; + + if (salt_charge[0] <= -salt_charge[1]) { + ncation += salt_charge_ratio; + nanion++; + } else { + nanion += salt_charge_ratio; + ncation++; + } + } else { + energy_stored = energy_before; + + // delete inserted ions + for (int i = 0; i < salt_charge_ratio + 1; i++) { + atom->natoms--; + if (mm[i] >= 0) { + atom->nlocal--; + } + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + } +} + +void Fix_charge_regulation::backward_ions_multival() { + + double energy_before = energy_stored; + double factor = 1; + double *dummyp; // dummy pointer + int mm[salt_charge_ratio + 1]; // particle ID array for all deleted ions + double qq[salt_charge_ratio + 1]; // charge array for all deleted ions + int mask_tmp[salt_charge_ratio + 1]; // temporary mask array + + if (salt_charge[0] <= -salt_charge[1]) { + // delete one anion and (salt_charge_ratio) cations + if (ncation < salt_charge_ratio || nanion < 1) return; + + mm[0] = get_random_particle(anion_type, salt_charge[1], 0, dummyp); + if (npart_xrd != nanion) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + factor *= volume_rx * pow(10, -pI_minus) / (nanion); + if (mm[0] >= 0) { + qq[0] = atom->q[mm[0]]; + atom->q[mm[0]] = 0; + mask_tmp[0] = atom->mask[mm[0]]; + atom->mask[mm[0]] = exclusion_group_bit; + } + for (int i = 0; i < salt_charge_ratio; i++) { + mm[i + 1] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); + if (npart_xrd != ncation - i) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + factor *= volume_rx * pow(10, -pI_plus) / (ncation - i); + if (mm[i + 1] >= 0) { + qq[i + 1] = atom->q[mm[i + 1]]; + atom->q[mm[i + 1]] = 0; + mask_tmp[i + 1] = atom->mask[mm[i + 1]]; + atom->mask[mm[i + 1]] = exclusion_group_bit; + } + } + } else { + // delete one cation and (salt_charge_ratio) anions + + if (nanion < salt_charge_ratio || ncation < 1) return; + mm[0] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); + if (npart_xrd != ncation) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + factor *= volume_rx * pow(10, -pI_plus) / (ncation); + if (mm[0] >= 0) { + qq[0] = atom->q[mm[0]]; + atom->q[mm[0]] = 0; + mask_tmp[0] = atom->mask[mm[0]]; + atom->mask[mm[0]] = exclusion_group_bit; + } + for (int i = 0; i < salt_charge_ratio; i++) { + mm[i + 1] = get_random_particle(anion_type, salt_charge[1], 0, dummyp); + if (npart_xrd != nanion - i) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (mm[i + 1] >= 0) { + qq[i + 1] = atom->q[mm[i + 1]]; + atom->q[mm[i + 1]] = 0; + mask_tmp[i + 1] = atom->mask[mm[i + 1]]; + atom->mask[mm[i + 1]] = exclusion_group_bit; + } + factor *= volume_rx * pow(10, -pI_minus) / (nanion - i); + } + } + + // attempt deletion + + double energy_after = energy_full(); + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < (1.0 / factor) * exp(beta * (energy_before - energy_after))) { + energy_stored = energy_after; + + atom->natoms -= 1 + salt_charge_ratio; + // ions must be deleted in order, otherwise index m could change upon the first deletion + for (int i = 0; i < salt_charge_ratio + 1; i++) { + // get max mm value, poor N^2 scaling, but charge ratio is a small number (2 or 3). + int maxmm = -1, jmaxm = -1; + for (int j = 0; j < salt_charge_ratio + 1; j++) { + if (mm[j] > maxmm) { + maxmm = mm[j]; + jmaxm = j; + } + } + if (maxmm < 0) { + break; // already deleted all particles in this thread + } else { + // delete particle maxmm + atom->avec->copy(atom->nlocal - 1, maxmm, 1); + atom->nlocal--; + mm[jmaxm] = -1; + } + } + + // update indices + nsalt_successes += 1; + if (salt_charge[0] <= -salt_charge[1]) { + ncation -= salt_charge_ratio; + nanion--; + } else { + nanion -= salt_charge_ratio; + ncation--; + } + if (force->kspace) force->kspace->qsum_qsq(); + if (force->pair->tail_flag) force->pair->reinit(); + + } else { + energy_stored = energy_before; + + // reassign original charge and mask + for (int i = 0; i < salt_charge_ratio + 1; i++) { + if (mm[i] >= 0) { + atom->q[mm[i]] = qq[i]; + atom->mask[mm[i]] = mask_tmp[i]; + } + } + } +} + +int Fix_charge_regulation::insert_particle(int ptype, double charge, double rd, double *target) { + + // insert a particle of type (ptype) with charge (charge) within distance (rd) of (target) + + double coord[3]; + int m = -1; + if (rd < small) { + coord[0] = xlo + random_equal->uniform() * (xhi - xlo); + coord[1] = ylo + random_equal->uniform() * (yhi - ylo); + coord[2] = zlo + random_equal->uniform() * (zhi - zlo); + } else { + double radius = reaction_distance * random_equal->uniform(); + double theta = random_equal->uniform() * PI; + double phi = random_equal->uniform() * 2 * PI; + coord[0] = target[0] + radius * sin(theta) * cos(phi); + coord[1] = target[1] + radius * sin(theta) * sin(phi); + coord[2] = target[2] + radius * cos(theta); + coord[0] = coord[0] - floor(1.0 * (coord[0] - xlo) / (xhi - xlo)) * (xhi - xlo); + coord[1] = coord[1] - floor(1.0 * (coord[1] - ylo) / (yhi - ylo)) * (yhi - ylo); + coord[2] = coord[2] - floor(1.0 * (coord[2] - zlo) / (zhi - zlo)) * (zhi - zlo); + } + + if (coord[0] >= sublo[0] && coord[0] < subhi[0] && + coord[1] >= sublo[1] && coord[1] < subhi[1] && + coord[2] >= sublo[2] && coord[2] < subhi[2]) { + atom->avec->create_atom(ptype, coord); + m = atom->nlocal - 1; + atom->mask[m] = groupbitall; + + sigma = sqrt(force->boltz * *target_temperature_tcp / atom->mass[ptype] / force->mvv2e); + atom->v[m][0] = random_unequal->gaussian() * sigma; + atom->v[m][1] = random_unequal->gaussian() * sigma; + atom->v[m][2] = random_unequal->gaussian() * sigma; + atom->q[m] = charge; + modify->create_attribute(m); + + } + atom->nghost = 0; + comm->borders(); + atom->natoms++; + return m; +} + +int Fix_charge_regulation::get_random_particle(int ptype, double charge, double rd, double *target) { + + // returns a randomly chosen particle of type (ptype) with charge (charge) + // chosen among particles within distance (rd) of (target) + + int nlocal = atom->nlocal; + + // expand memory, if necessary + if (atom->nmax > cr_nmax) { + memory->sfree(ptype_ID); + cr_nmax = atom->nmax; + ptype_ID = (int *) memory->smalloc(cr_nmax * sizeof(int), + "CR: local_atom_list"); + } + + int count_local, count_global, count_before; + int m = -1; + count_local = 0; + count_global = 0; + count_before = 0; + + if (rd < small) { //reaction_distance < small: No geometry constraint on random particle choice + for (int i = 0; i < nlocal; i++) { + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && + atom->mask[i] != exclusion_group_bit) { + ptype_ID[count_local] = i; + count_local++; + } + } + } else { + double dx, dy, dz, distance_check; + for (int i = 0; i < nlocal; i++) { + dx = fabs(atom->x[i][0] - target[0]); + dx -= static_cast(1.0 * dx / (xhi - xlo) + 0.5) * (xhi - xlo); + dy = fabs(atom->x[i][1] - target[1]); + dy -= static_cast(1.0 * dy / (yhi - ylo) + 0.5) * (yhi - ylo); + dz = fabs(atom->x[i][2] - target[2]); + dz -= static_cast(1.0 * dz / (zhi - zlo) + 0.5) * (zhi - zlo); + distance_check = dx * dx + dy * dy + dz * dz; + if ((distance_check < rd * rd) && atom->type[i] == ptype && + fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) { + ptype_ID[count_local] = i; + count_local++; + } + } + } + count_global = count_local; + count_before = count_local; + MPI_Allreduce(&count_local, &count_global, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&count_local, &count_before, 1, MPI_INT, MPI_SUM, world); + count_before -= count_local; + + npart_xrd = count_global; // save the number of particles, for use in MC acceptance ratio + if (count_global > 0) { + const int ID_global = floor(random_equal->uniform() * count_global); + if ((ID_global >= count_before) && (ID_global < (count_before + count_local))) { + const int ID_local = ID_global - count_before; + m = ptype_ID[ID_local]; // local ID of the chosen particle + return m; + } + } + return -1; +} + +double Fix_charge_regulation::energy_full() { + int imolecule; + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + comm->exchange(); + atom->nghost = 0; + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal + atom->nghost); + if (modify->n_pre_neighbor) modify->pre_neighbor(); + neighbor->build(1); + int eflag = 1; + int vflag = 0; + if (overlap_flag) { + int overlaptestall; + int overlaptest = 0; + double delx, dely, delz, rsq; + double **x = atom->x; + tagint *molecule = atom->molecule; + int nall = atom->nlocal + atom->nghost; + for (int i = 0; i < atom->nlocal; i++) { + for (int j = i + 1; j < nall; j++) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq < overlap_cutoffsq) { + overlaptest = 1; + break; + } + } + if (overlaptest) break; + } + overlaptestall = overlaptest; + MPI_Allreduce(&overlaptest, &overlaptestall, 1, + MPI_INT, MPI_MAX, world); + if (overlaptestall) return MAXENERGYSIGNAL; + } + size_t nbytes = sizeof(double) * (atom->nlocal + atom->nghost); + if (nbytes) memset(&atom->f[0][0], 0, 3 * nbytes); + + if (modify->n_pre_force) modify->pre_force(vflag); + + if (force->pair) force->pair->compute(eflag, vflag); + + if (atom->molecular) { + if (force->bond) force->bond->compute(eflag, vflag); + if (force->angle) force->angle->compute(eflag, vflag); + if (force->dihedral) force->dihedral->compute(eflag, vflag); + if (force->improper) force->improper->compute(eflag, vflag); + } + + if (force->kspace) force->kspace->compute(eflag, vflag); + + if (modify->n_post_force) modify->post_force(vflag); + if (modify->n_end_of_step) modify->end_of_step(); + update->eflag_global = update->ntimestep; + double total_energy = c_pe->compute_scalar(); + return total_energy; +} + +int Fix_charge_regulation::particle_number_xrd(int ptype, double charge, double rd, double *target) { + + int count = 0; + if (rd < small) { + for (int i = 0; i < atom->nlocal; i++) { + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) + count++; + } + } else { + double dx, dy, dz, distance_check; + for (int i = 0; i < atom->nlocal; i++) { + dx = fabs(atom->x[i][0] - target[0]); + dx -= static_cast(1.0 * dx / (xhi - xlo) + 0.5) * (xhi - xlo); + dy = fabs(atom->x[i][1] - target[1]); + dy -= static_cast(1.0 * dy / (yhi - ylo) + 0.5) * (yhi - ylo); + dz = fabs(atom->x[i][2] - target[2]); + dz -= static_cast(1.0 * dz / (zhi - zlo) + 0.5) * (zhi - zlo); + distance_check = dx * dx + dy * dy + dz * dz; + if ((distance_check < rd * rd) && atom->type[i] == ptype && + fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) { + count++; + } + } + } + int count_sum = count; + MPI_Allreduce(&count, &count_sum, 1, MPI_INT, MPI_SUM, world); + return count_sum; +} + +int Fix_charge_regulation::particle_number(int ptype, double charge) { + + int count = 0; + for (int i = 0; i < atom->nlocal; i++) { + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) + count = count + 1; + } + int count_sum = count; + MPI_Allreduce(&count, &count_sum, 1, MPI_INT, MPI_SUM, world); + return count_sum; +} + +double Fix_charge_regulation::compute_vector(int n) { + double count_temp = 0; + if (n == 0) { + return nacid_attempts + nbase_attempts + nsalt_attempts; + } else if (n == 1) { + return nacid_successes + nbase_successes + nsalt_successes; + } else if (n == 2) { + return particle_number(acid_type, 0); + } else if (n == 3) { + return particle_number(acid_type, -1); + } else if (n == 4) { + return particle_number(base_type, 0); + } else if (n == 5) { + return particle_number(base_type, 1); + } else if (n == 6) { + return particle_number(cation_type, salt_charge[0]); + } else if (n == 7) { + return particle_number(anion_type, salt_charge[1]); + } + return 0.0; +} + +void Fix_charge_regulation::setThermoTemperaturePointer() { + int ifix = -1; + ifix = modify->find_fix(idftemp); + if (ifix == -1) { + error->all(FLERR, + "Fix charge regulation regulation could not find a temperature fix id provided by tempfixid\n"); + } + Fix *temperature_fix = modify->fix[ifix]; + int dim; + target_temperature_tcp = (double *) temperature_fix->extract("t_target", dim); + +} + +void Fix_charge_regulation::assign_tags() { + // Assign tags to ions with zero tags + if (atom->tag_enable) { + tagint *tag = atom->tag; + tagint maxtag_all = 0; + tagint maxtag = 0; + for (int i = 0; i < atom->nlocal; i++) maxtag = MAX(maxtag, tag[i]); + maxtag_all = maxtag; + MPI_Allreduce(&maxtag, &maxtag_all, 1, MPI_LMP_TAGINT, MPI_MAX, world); + if (maxtag_all >= MAXTAGINT) + error->all(FLERR, "New atom IDs exceed maximum allowed ID"); + + tagint notag = 0; + tagint notag_all; + for (int i = 0; i < atom->nlocal; i++) + if (tag[i] == 0 && (atom->type[i] == cation_type || atom->type[i] == anion_type))notag++; + notag_all = notag; + MPI_Allreduce(¬ag, ¬ag_all, 1, MPI_LMP_TAGINT, MPI_SUM, world); + if (notag_all >= MAXTAGINT) + error->all(FLERR, "New atom IDs exceed maximum allowed ID"); + + tagint notag_sum = notag; + MPI_Scan(¬ag, ¬ag_sum, 1, MPI_LMP_TAGINT, MPI_SUM, world); + // itag = 1st new tag that my untagged atoms should use + + tagint itag = maxtag_all + notag_sum - notag + 1; + for (int i = 0; i < atom->nlocal; i++) { + if (tag[i] == 0 && (atom->type[i] == cation_type || atom->type[i] == anion_type)) { + tag[i] = itag++; + } + } + if (atom->map_style) atom->map_init(); + atom->nghost = 0; + comm->borders(); + } +} + +/* ---------------------------------------------------------------------- + parse input options +------------------------------------------------------------------------- */ + +void Fix_charge_regulation::options(int narg, char **arg) { + if (narg < 0) error->all(FLERR, "Illegal fix charge regulation command"); + + // defaults + + pH = 7.0; + pI_plus = 100; + pI_minus = 100; + acid_type = -1; + base_type = -1; + pKa = 100; + pKb = 100; + pKs = 14.0; + nevery = 100; + nmc = 100; + pmcmoves[0] = pmcmoves[1] = pmcmoves[2] = 0.33; + llength_unit_in_nm= 0.72; + + reservoir_temperature = 1.0; + reaction_distance = 0; + seed = 12345; + target_temperature_tcp = &reservoir_temperature; + add_tags_flag = false; + only_salt_flag = false; + salt_charge[0] = 1; // cation charge + salt_charge[1] = -1; // anion charge + + exclusion_group = 0; + exclusion_group_bit = 0; + ngroups = 0; + int ngroupsmax = 0; + groupstrings = NULL; + + int iarg = 0; + while (iarg < narg) { + + if (strcmp(arg[iarg], "lunit_nm") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + llength_unit_in_nm = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "acid_type") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + acid_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "base_type") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + base_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pH") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pH = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pIp") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pI_plus = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pIm") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pI_minus = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pKa") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pKa = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pKb") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pKb = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + + } else if (strcmp(arg[iarg], "temp") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + reservoir_temperature = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pKs") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pKs = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "tempfixid") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + int n = strlen(arg[iarg + 1]) + 1; + delete[] idftemp; + idftemp = new char[n]; + strcpy(idftemp, arg[iarg + 1]); + setThermoTemperaturePointer(); + iarg += 2; + } else if (strcmp(arg[iarg], "rxd") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + reaction_distance = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if ((reaction_distance > fabs(domain->boxhi[0] - domain->boxlo[0]) / 2) || + (reaction_distance > fabs(domain->boxhi[1] - domain->boxlo[1]) / 2) || + (reaction_distance > fabs(domain->boxhi[2] - domain->boxlo[2]) / 2)) { + error->warning(FLERR, + "reaction distance (rxd) is larger than half the box dimension, resetting default: xrd = 0."); + reaction_distance = 0; + } + iarg += 2; + } else if (strcmp(arg[iarg], "nevery") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + nevery = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "nmc") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + nmc = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "pmcmoves") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + pmcmoves[0] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + pmcmoves[1] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + pmcmoves[2] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + iarg += 4; + } else if (strcmp(arg[iarg], "seed") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + seed = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + iarg += 2; + } else if (strcmp(arg[iarg], "tag") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (strcmp(arg[iarg + 1], "yes") == 0) { + add_tags_flag = true; + } else if (strcmp(arg[iarg + 1], "no") == 0) { + add_tags_flag = false; + } else { error->all(FLERR, "Illegal fix charge regulation command"); } + iarg += 2; + } else if (strcmp(arg[iarg], "onlysalt") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (strcmp(arg[iarg + 1], "yes") == 0) { + only_salt_flag = true; + // need to specify salt charge + if (iarg + 4 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + salt_charge[0] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + salt_charge[1] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + if (fabs(salt_charge[0] - utils::inumeric(FLERR, arg[iarg + 2], false, lmp)) > small) + error->all(FLERR, "Illegal fix charge regulation command, cation charge must be an integer"); + if (fabs(salt_charge[1] - utils::inumeric(FLERR, arg[iarg + 3], false, lmp)) > small) + error->all(FLERR, "Illegal fix charge regulation command, anion charge must be an integer"); + iarg += 4; + } else if (strcmp(arg[iarg + 1], "no") == 0) { + only_salt_flag = false; + iarg += 2; + } else { error->all(FLERR, "Illegal fix charge regulation command"); } + + } else if (strcmp(arg[iarg], "group") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix fix charge regulation command"); + if (ngroups >= ngroupsmax) { + ngroupsmax = ngroups + 1; + groupstrings = (char **) + memory->srealloc(groupstrings, + ngroupsmax * sizeof(char *), + "fix_charge_regulation:groupstrings"); + } + int n = strlen(arg[iarg + 1]) + 1; + groupstrings[ngroups] = new char[n]; + strcpy(groupstrings[ngroups], arg[iarg + 1]); + ngroups++; + iarg += 2; + } else { error->all(FLERR, "Illegal fix charge regulation command"); } + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based arrays +------------------------------------------------------------------------- */ + +double Fix_charge_regulation::memory_usage() { + double bytes = cr_nmax * sizeof(int); + return bytes; +} diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/USER-MISC/fix_charge_regulation.h new file mode 100644 index 0000000000..280a6c0d49 --- /dev/null +++ b/src/USER-MISC/fix_charge_regulation.h @@ -0,0 +1,117 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Tine Curk (curk@northwestern.edu) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(charge_regulation,Fix_charge_regulation) + +#else + +#ifndef LMP_FIX_charge_regulation_H +#define LMP_FIX_charge_regulation_H + +#include "fix.h" + +namespace LAMMPS_NS { + + class Fix_charge_regulation : public Fix { + public: + Fix_charge_regulation(class LAMMPS *, int, char **); + ~Fix_charge_regulation(); + int setmask(); + void init(); + void pre_exchange(); + void forward_acid(); + void backward_acid(); + void forward_base(); + void backward_base(); + void forward_ions(); + void forward_ions_multival(); + void backward_ions(); + void backward_ions_multival(); + int get_random_particle(int, double, double, double *); + int insert_particle(int, double, double, double *); + double energy_full(); + int particle_number(int, double); + int particle_number_xrd(int, double, double, double *); + double compute_vector(int n); + void assign_tags(); + void options(int, char **); + void setThermoTemperaturePointer(); + double memory_usage(); + + private: + int exclusion_group, exclusion_group_bit; + int ngcmc_type, nevery, seed; + int nmc; // mc moves per cycle + double llength_unit_in_nm ; // LAMMPS unit of length in nm, needed since chemical potentials are in units of mol/l + double pH, pKa, pKb, pKs, pI_plus, pI_minus; // chemical potentials + double pmcmoves[3]; // mc move attempt probability, acid, base, salt; and comulative + double pmcc; // mc move cumulative attempt probability + int npart_xrd; // # of particles (ions) within xrd + int npart_xrd2; // # of particles (ions) within xrd + double vlocal_xrd; // # local volume within xrd + bool only_salt_flag; // true if performing only salt insertion/deletion, no acid/base dissociation. + bool add_tags_flag; // true if each inserted atom gets its unique atom tag + int groupbitall; // group bitmask for inserted atoms + int ngroups; // number of group-ids for inserted atoms + char **groupstrings; // list of group-ids for inserted atoms + // counters + unsigned long int nacid_attempts, nacid_successes, nbase_attempts, nbase_successes, nsalt_attempts, nsalt_successes; + int nacid_neutral, nacid_charged, nbase_neutral, nbase_charged, ncation, nanion; // particle type counts + int cr_nmax; // max number of local particles + double reservoir_temperature; + double beta, sigma, volume, volume_rx; // inverse temperature, speed, total volume, reacting volume + int salt_charge[2]; // charge of salt ions: [0] - cation, [1] - anion + int salt_charge_ratio; + double xlo, xhi, ylo, yhi, zlo, zhi; // box size + double energy_stored; // full energy of old/current configuration + int triclinic; // 0 = orthog box, 1 = triclinic + double *sublo, *subhi; // triclinic size + int *ptype_ID; // particle ID array + double overlap_cutoffsq; // square distance cutoff for overlap + int overlap_flag; + int acid_type, cation_type, base_type, anion_type; // reacting atom types + int reaction_distance_flag; + double reaction_distance; // max radial distance for atom insertion + + + class Pair *pair; + class Compute *c_pe; // energy compute pointer + class RanPark *random_equal; // random number generator + class RanPark *random_unequal; // random number generator + char *idftemp; // pointer to the temperature fix + + double *target_temperature_tcp; // current temperature of the thermostat + + }; +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +Self-explanatory. + +*/ From 6d862569ea8ab8f44e68207bd41adfe8a28a5e2b Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 16:24:55 -0600 Subject: [PATCH 006/370] Updated emails --- src/USER-MISC/fix_charge_regulation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/USER-MISC/fix_charge_regulation.h index 280a6c0d49..f0151390e6 100644 --- a/src/USER-MISC/fix_charge_regulation.h +++ b/src/USER-MISC/fix_charge_regulation.h @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Tine Curk (curk@northwestern.edu) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) + Contributing author: Tine Curk (tcurk5@gmail.com) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) ------------------------------------------------------------------------- */ #ifdef FIX_CLASS From d62ba49f1a431b920cb29e0dce8f23b4a9815f26 Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 16:57:00 -0600 Subject: [PATCH 007/370] added minor comments --- src/USER-MISC/fix_charge_regulation.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/USER-MISC/fix_charge_regulation.h index f0151390e6..e64ea6b63f 100644 --- a/src/USER-MISC/fix_charge_regulation.h +++ b/src/USER-MISC/fix_charge_regulation.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { int nmc; // mc moves per cycle double llength_unit_in_nm ; // LAMMPS unit of length in nm, needed since chemical potentials are in units of mol/l double pH, pKa, pKb, pKs, pI_plus, pI_minus; // chemical potentials - double pmcmoves[3]; // mc move attempt probability, acid, base, salt; and comulative + double pmcmoves[3]; // mc move attempt probability: acid, base, ion pair exchange double pmcc; // mc move cumulative attempt probability int npart_xrd; // # of particles (ions) within xrd int npart_xrd2; // # of particles (ions) within xrd @@ -70,6 +70,7 @@ namespace LAMMPS_NS { int groupbitall; // group bitmask for inserted atoms int ngroups; // number of group-ids for inserted atoms char **groupstrings; // list of group-ids for inserted atoms + // counters unsigned long int nacid_attempts, nacid_successes, nbase_attempts, nbase_successes, nsalt_attempts, nsalt_successes; int nacid_neutral, nacid_charged, nbase_neutral, nbase_charged, ncation, nanion; // particle type counts @@ -77,7 +78,7 @@ namespace LAMMPS_NS { double reservoir_temperature; double beta, sigma, volume, volume_rx; // inverse temperature, speed, total volume, reacting volume int salt_charge[2]; // charge of salt ions: [0] - cation, [1] - anion - int salt_charge_ratio; + int salt_charge_ratio; // charge ration when using multivalent ion exchange double xlo, xhi, ylo, yhi, zlo, zhi; // box size double energy_stored; // full energy of old/current configuration int triclinic; // 0 = orthog box, 1 = triclinic @@ -86,16 +87,15 @@ namespace LAMMPS_NS { double overlap_cutoffsq; // square distance cutoff for overlap int overlap_flag; int acid_type, cation_type, base_type, anion_type; // reacting atom types - int reaction_distance_flag; - double reaction_distance; // max radial distance for atom insertion + int reaction_distance_flag; // radial reaction restriction flag + double reaction_distance; // max radial distance from acid/base for ion insertion class Pair *pair; - class Compute *c_pe; // energy compute pointer + class Compute *c_pe; // energy compute pointer class RanPark *random_equal; // random number generator class RanPark *random_unequal; // random number generator - char *idftemp; // pointer to the temperature fix - + char *idftemp; // pointer to the temperature fix double *target_temperature_tcp; // current temperature of the thermostat }; From 0bc31fad0922d3f3f76ec5fdd894714112a75826 Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 17:03:15 -0600 Subject: [PATCH 008/370] header file minor cleanup --- src/USER-MISC/fix_charge_regulation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/USER-MISC/fix_charge_regulation.h index e64ea6b63f..d698bd6bb7 100644 --- a/src/USER-MISC/fix_charge_regulation.h +++ b/src/USER-MISC/fix_charge_regulation.h @@ -56,8 +56,8 @@ namespace LAMMPS_NS { private: int exclusion_group, exclusion_group_bit; - int ngcmc_type, nevery, seed; - int nmc; // mc moves per cycle + int nevery, seed; // begin MC cycle every nevery MD timesteps, random seed + int nmc; // MC move attempts per cycle double llength_unit_in_nm ; // LAMMPS unit of length in nm, needed since chemical potentials are in units of mol/l double pH, pKa, pKb, pKs, pI_plus, pI_minus; // chemical potentials double pmcmoves[3]; // mc move attempt probability: acid, base, ion pair exchange From 2f5588733bf752bef213e0ea47e6c04cc9516df1 Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 18:47:04 -0600 Subject: [PATCH 009/370] fixed doc Latex error --- doc/src/fix_charge_regulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index 585761e8a9..d2384fdc13 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -70,7 +70,7 @@ The last type of reaction performs grand canonical MC exchange of ion pairs with In our implementation "acid" refers to particles that can attain charge :math:`q=\{0,-1\}` and "base" to particles with :math:`q=\{0,1\}`, whereas the MC exchange of free ions allows any integer charge values of :math:`{Z^+}` and :math:`{Z^-}`. -Here we provide several practical examples for modeling charge regulation effects in solvated systems. +Here we provide several practical examples for modeling charge regulation effects in solvated systems. An acid ionization reaction (:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{H}^+`) can be defined via a single line in the input file .. code-block:: LAMMPS From 4421843604c090ef8e776ca32bdab2a6da74f33b Mon Sep 17 00:00:00 2001 From: tc387 Date: Fri, 5 Feb 2021 19:00:33 -0600 Subject: [PATCH 010/370] fixed Latex doc error #2 --- doc/src/fix_charge_regulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index d2384fdc13..a98288eb51 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -106,7 +106,7 @@ If neither the acid or the base type is specified, for example, the fix simply inserts or deletes an ion pair of a free cation (atom type 4) and a free anion (atom type 5) as done in a conventional grand-canonical MC simulation. -The fix is compatible with LAMMPS sub-packages such as *molecule* or *rigid*. That said, the acid and base particles can be part of larger molecules or rigid bodies. Free ions that are inserted to or deleted from the system must be defined as single particles (no bonded interactions allowed) and cannot be part of larger molecules or rigid bodies. If *molecule* package is used, all inserted ions have a molecule ID equal to zero. +The fix is compatible with LAMMPS sub-packages such as *molecule* or *rigid*. That said, the acid and base particles can be part of larger molecules or rigid bodies. Free ions that are inserted to or deleted from the system must be defined as single particles (no bonded interactions allowed) and cannot be part of larger molecules or rigid bodies. If *molecule* package is used, all inserted ions have a molecule ID equal to zero. Note that LAMMPS implicitly assumes a constant number of particles (degrees of freedom). Since using this fix alters the total number of particles during the simulation, any thermostat used by LAMMPS, such as NVT or Langevin, must use a dynamic calculation of system temperature. This can be achieved by specifying a dynamic temperature compute (e.g. dtemp) and using it with the desired thermostat, e.g. a Langevin thermostat: From 60113a6ddf92566d4eee3ba03dc960795f1471c5 Mon Sep 17 00:00:00 2001 From: tc387 Date: Wed, 10 Feb 2021 13:24:30 -0600 Subject: [PATCH 011/370] Applied edits/optimizations suggested by Axel. Further simplifified/fixed MC acceptance equations, few clarifications to documentation. --- doc/src/fix_charge_regulation.rst | 38 ++- examples/USER/misc/charge_regulation/README | 5 +- .../USER/misc/charge_regulation/in_acid.chreg | 7 +- .../misc/charge_regulation/in_polymer.chreg | 12 +- src/USER-MISC/fix_charge_regulation.cpp | 282 ++++++++++-------- src/USER-MISC/fix_charge_regulation.h | 17 +- 6 files changed, 193 insertions(+), 168 deletions(-) diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index a98288eb51..cb9f55c7cd 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -1,22 +1,18 @@ -.. Yuan documentation master file, created by - sphinx-quickstart on Sat Jan 30 14:06:22 2021. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - tc387: Multiple text additions/changes, Feb 2 2021 -.. index:: fix fix_charge_regulation +.. index:: fix charge/regulation -fix_charge_regulation command +fix charge/regulation command ============================= + Syntax """""" .. parsed-literal:: - fix ID group-ID charge_regulation cation_type anion_type keyword value(s) + fix ID group-ID charge/regulation cation_type anion_type keyword value(s) * ID, group-ID are documented in fix command -* charge_regulation = style name of this fix command +* charge/regulation = style name of this fix command * cation_type = atom type of free cations * anion_type = atom type of free anions @@ -51,9 +47,9 @@ Examples """""""" .. code-block:: LAMMPS - fix chareg all charge_regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT + fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT - fix chareg all charge_regulation 1 2 pIp 3 pIm 3 tempfixid fT tag yes onlysalt yes 2 -1 + fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0 Description """"""""""" @@ -75,7 +71,7 @@ An acid ionization reaction (:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\ .. code-block:: LAMMPS - fix acid_reaction all charge_regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 7.0 pIm 7.0 + fix acid_reaction all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 7.0 pIm 7.0 where the fix attempts to charge :math:`\mathrm{A}` (discharge :math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and insert (delete) a proton (atom type 2). Besides, the fix implements self-ionization reaction of water :math:`\emptyset \rightleftharpoons \mathrm{H}^++\mathrm{OH}^-`. However, this approach is highly inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of both protons and hydroxyl ions is low, resulting in a relatively low acceptance rate of MC moves. @@ -85,7 +81,7 @@ participate in ionization reactions, which can be easily achieved via .. code-block:: LAMMPS - fix acid_reaction all charge_regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 + fix acid_reaction all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 where particles of atom type 4 and 5 are the salt cations and anions, both at chemical potential pI=2.0, see :ref:`(Curk1) ` and :ref:`(Landsgesell) ` for more details. @@ -94,14 +90,14 @@ where particles of atom type 4 and 5 are the salt cations and anions, both at ch .. code-block:: LAMMPS - fix base_reaction all charge_regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0 + fix base_reaction all charge/regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0 where the fix will attempt to charge :math:`\mathrm{B}` (discharge :math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. If neither the acid or the base type is specified, for example, .. code-block:: LAMMPS - fix salt_reaction all charge_regulation 4 5 pIp 2.0 pIm 2.0 + fix salt_reaction all charge/regulation 4 5 pIp 2.0 pIm 2.0 the fix simply inserts or deletes an ion pair of a free cation (atom type 4) and a free anion (atom type 5) as done in a conventional grand-canonical MC simulation. @@ -119,7 +115,7 @@ Note that LAMMPS implicitly assumes a constant number of particles (degrees of f The chemical potential units (e.g. pH) are in the standard log10 representation assuming reference concentration :math:`\rho_0 = \mathrm{mol}/\mathrm{l}`. Therefore, to perform the internal unit conversion, the length (in nanometers) of the LAMMPS unit length -must be specified via *lunit_nm* (default is set to the Bjerrum length in water at room temprature *lunit_nm* = 0.72nm). For example, in the dilute ideal solution limit, the concentration of free ions +must be specified via *lunit_nm* (default is set to the Bjerrum length in water at room temprature *lunit_nm* = 0.71nm). For example, in the dilute ideal solution limit, the concentration of free ions will be :math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. The temperature used in MC acceptance probability is set by *temp*. This temperature should be the same as the temperature set by the molecular dynamics thermostat. For most purposes, it is probably best to use *tempfixid* keyword which dynamically sets the temperature equal to the chosen MD thermostat temperature, in the example above we assumed the thermostat fix-ID is *fT*. The inserted particles attain a random velocity corresponding to the specified temperature. Using *tempfixid* overrides any fixed temperature set by *temp*. @@ -138,14 +134,14 @@ The *group* keyword can be used to add inserted particles to a specific group-ID Output """""" -This fix computes a global vector of length 8, which can be accessed by various output commands. The vector values are the following global cumulative quantities: +This fix computes a global vector of length 8, which can be accessed by various output commands. The vector values are the following global quantities: * 1 = cumulative MC attempts * 2 = cumulative MC successes * 3 = current # of neutral acid atoms * 4 = current # of -1 charged acid atoms * 5 = current # of neutral base atoms -* 6 = current # of +1 charged acid atoms +* 6 = current # of +1 charged base atoms * 7 = current # of free cations * 8 = current # of free anions @@ -157,6 +153,8 @@ See the :doc:`Build package ` doc page for more info. The :doc:`atom_style `, used must contain the charge property, for example, the style could be *charge* or *full*. Only usable for 3D simulations. Atoms specified as free ions cannot be part of rigid bodies or molecules and cannot have bonding interactions. The scheme is limited to integer charges, any atoms with non-integer charges will not be considered by the fix. +All interaction potentials used must be continuous, otherwise the MD integration and the particle exchange MC moves do not correspond to the same equilibrium ensemble. For example, if an lj/cut pair style is used, the LJ potential must be shifted so that it vanishes at the cutoff. This can be easily achieved using the :doc:`pair_modify ` command, i.e., by using: *pair_modify shift yes*. + Note: Region restrictions are not yet implemented. Related commands @@ -167,7 +165,7 @@ Related commands Default """"""" -pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs=14.0; acid_type = -1; base_type = -1; lunit_nm = 0.72; temp = 1.0; nevery = 100; nmc = 100; xrd = 0; seed = 2345; tag = no; onlysalt = no, pmcmoves = 0.33 0.33 0.33, group-ID = all +pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0; acid_type = -1; base_type = -1; lunit_nm = 0.71; temp = 1.0; nevery = 100; nmc = 100; xrd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves = [1/3, 1/3, 1/3], group-ID = all ---------- @@ -181,4 +179,4 @@ pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs=14.0; acid_type = .. _Landsgesell: -**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, “Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning,” Macromolecules 53, 3007–3020 (2020). +**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, "Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning", Macromolecules 53, 3007–3020 (2020). diff --git a/examples/USER/misc/charge_regulation/README b/examples/USER/misc/charge_regulation/README index e0be86d7e4..5666d6d025 100644 --- a/examples/USER/misc/charge_regulation/README +++ b/examples/USER/misc/charge_regulation/README @@ -2,6 +2,7 @@ This directory has two input scripts that illustrates how to use fix charge_regu The script `in_acid.chreg` sets up a simple weak acid electrolyte (pH=7,pKa=6,pI=3). Four different types of MC moves are implemented: acid protonation & de-protonation, and monovalent ion pair insertion and deletion. Note here we have grouped all free monovalent ions into a single type, a physically natural choice on the level of coarse-grained primitive electrolyte models, which increases the calculation performance but has no effects on thermodynamic observables. The variables such as pH, pKa, pI, and lb at the top of the input script can be adjusted to play with various simulation parameters. The cumulative MC attempted moves and cumulative number of accepted moves, as well as, current number of neutral and charged acid particles, neutral and charged base particles (in this example always 0), and the current number of free cations and anions in the system are printed in the `log_acid.lammps`. -The script `in_polymer.chreg` sets up a weak polyelectrolyte chain of N=80 beads. Each bead is a weak acid with pKa=5 and solution has pH=7 and salt pI=3. In this example, we choose to treat salt ions, protons, and hydroxyl ions separately, which results in 5 types of MC moves: acid [type 1] protonation & de-protonation (with protons [type 4] insertion & deletion), acid [type 1] protonation & de-protonation (with salt cation [type 2] insertion & deletion), water self-ionization (insertion and deletion of proton [type4] and hydroxyl ion [type 5] pair), insertion and deletion of monovalent salt pair [type 2 and type 3] , insertion and deletion -Of a proton [type4] and salt anion [type 3]. The current number of neutral and charged acid particles, the current number of free salt cations and anions, and the current number of protons and hydroxyl ions are printed in the `log_polymer.lammps`. +The script `in_polymer.chreg` sets up a weak polyelectrolyte chain of N=80 beads. Each bead is a weak acid with pKa=5 and solution has pH=7 and monovalent salt chemical potential pI=3. In this example, we choose to treat salt ions, protons, and hydroxyl ions separately, which results in 5 types of MC moves: acid [type 1] protonation & de-protonation (with protons [type 4] insertion & deletion), acid [type 1] protonation & de-protonation (with salt cation [type 2] insertion & deletion), water self-ionization (insertion and deletion of proton [type4] and hydroxyl ion [type 5] pair), insertion and deletion of monovalent salt pair [type 2 and type 3] , insertion and deletion +Of a proton [type4] and salt anion [type 3]. +The current number of neutral and charged acid particles, the current number of free salt cations and anions, and the current number of protons and hydroxyl ions are printed in the `log_polymer.lammps`. diff --git a/examples/USER/misc/charge_regulation/in_acid.chreg b/examples/USER/misc/charge_regulation/in_acid.chreg index 32beeda732..73a40f7389 100644 --- a/examples/USER/misc/charge_regulation/in_acid.chreg +++ b/examples/USER/misc/charge_regulation/in_acid.chreg @@ -24,7 +24,7 @@ pair_style lj/cut/coul/long ${cut_lj} ${cut_long} pair_coeff * * 1.0 1.0 ${cut_lj} # charges kspace_style ewald 1.0e-3 dielectric 1.0 -pair_modify shift no +pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### fix fnve all nve @@ -33,8 +33,9 @@ compute_modify dtemp dynamic yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp -fix chareg all charge_regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT thermo 100 thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +log log_acid.lammps timestep 0.005 -run 10000 +run 20000 diff --git a/examples/USER/misc/charge_regulation/in_polymer.chreg b/examples/USER/misc/charge_regulation/in_polymer.chreg index 4dc72a8156..e35ba28661 100644 --- a/examples/USER/misc/charge_regulation/in_polymer.chreg +++ b/examples/USER/misc/charge_regulation/in_polymer.chreg @@ -14,7 +14,7 @@ velocity all create 1.0 8008 loop geom pair_style lj/cut/coul/long 1.122462 20 pair_coeff * * 1.0 1.0 1.122462 # charges kspace_style pppm 1.0e-3 -pair_modify shift no +pair_modify shift yes dielectric 1.0 ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### @@ -24,12 +24,14 @@ compute_modify dtemp dynamic yes fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp -fix chareg1 all charge_regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 -fix chareg2 all charge_regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 -fix chareg3 all charge_regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 +fix chareg1 all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 seed 2345 +fix chareg2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 seed 2345 +fix chareg3 all charge/regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 seed 2345 thermo 100 # print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] +log log_polymer.lammps + timestep 0.005 -run 10000 +run 20000 diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp index 3bb9de1b27..c43a509f61 100644 --- a/src/USER-MISC/fix_charge_regulation.cpp +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -15,50 +15,56 @@ Contributing author: Tine Curk (tcurk5@gmail.com) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) ------------------------------------------------------------------------- */ #include "fix_charge_regulation.h" -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "molecule.h" -#include "update.h" -#include "modify.h" -#include "fix.h" +#include "bond.h" #include "comm.h" #include "compute.h" -#include "group.h" -#include "domain.h" -#include "region.h" -#include "random_park.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "math_extra.h" #include "math_const.h" +#include "math_extra.h" +#include "math_special.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "molecule.h" #include "neighbor.h" +#include "pair.h" +#include "random_park.h" +#include "region.h" +#include "update.h" + +#include +#include + using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; +using namespace MathSpecial; // large energy value used to signal overlap #define MAXENERGYSIGNAL 1.0e100 #define MAXENERGYTEST 1.0e50 -#define small 0.0000001 -#define PI 3.1415926 +#define SMALL 0.0000001 +#define NA_RHO0 0.602214 // Avogadro's constant times reference concentration (N_A * mol / liter) [nm^-3] /* ---------------------------------------------------------------------- */ -Fix_charge_regulation::Fix_charge_regulation(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - ngroups(0), groupstrings(NULL), - random_equal(NULL), random_unequal(NULL), - idftemp(NULL), ptype_ID(NULL) { + +FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), + ngroups(0), groupstrings(NULL), + random_equal(NULL), random_unequal(NULL), + idftemp(NULL), ptype_ID(NULL) + { // Region restrictions not yet implemented .. @@ -79,28 +85,28 @@ Fix_charge_regulation::Fix_charge_regulation(LAMMPS *lmp, int narg, char **arg) // set defaults and read optional arguments options(narg - 5, &arg[5]); - if (nevery <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (nmc < 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (llength_unit_in_nm < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (*target_temperature_tcp < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (seed <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (cation_type <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (anion_type <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (reaction_distance < 0.0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (salt_charge[0] <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); - if (salt_charge[1] >= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (nevery <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (nmc < 0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (llength_unit_in_nm < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (*target_temperature_tcp < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (seed <= 0) error->all(FLERR, "Illegal fix charge/regulation command: Seed value (positive integer) must be provided "); + if (cation_type <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (anion_type <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (reaction_distance < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (salt_charge[0] <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); + if (salt_charge[1] >= 0) error->all(FLERR, "Illegal fix charge/regulation command"); if ((salt_charge[1] % salt_charge[0] != 0) && (salt_charge[0] % salt_charge[1] != 0)) error->all(FLERR, - "Illegal fix charge_regulation command, multivalent cation/anion charges are allowed, " + "Illegal fix charge/regulation command, multivalent cation/anion charges are allowed, " "but must be divisible, e.g. (3,-1) is fine, but (3,-2) is not implemented"); if (pmcmoves[0] < 0 || pmcmoves[1] < 0 || pmcmoves[2] < 0) - error->all(FLERR, "Illegal fix charge_regulation command"); + error->all(FLERR, "Illegal fix charge/regulation command"); if (acid_type < 0) pmcmoves[0] = 0; if (base_type < 0) pmcmoves[1] = 0; // normalize double psum = pmcmoves[0] + pmcmoves[1] + pmcmoves[2]; - if (psum <= 0) error->all(FLERR, "Illegal fix charge_regulation command"); + if (psum <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); pmcmoves[0] /= psum; pmcmoves[1] /= psum; pmcmoves[2] /= psum; @@ -117,7 +123,7 @@ Fix_charge_regulation::Fix_charge_regulation(LAMMPS *lmp, int narg, char **arg) nsalt_successes = 0; } -Fix_charge_regulation::~Fix_charge_regulation() { +FixChargeRegulation::~FixChargeRegulation() { memory->destroy(ptype_ID); @@ -130,18 +136,16 @@ Fix_charge_regulation::~Fix_charge_regulation() { } } -int Fix_charge_regulation::setmask() { +int FixChargeRegulation::setmask() { int mask = 0; mask |= PRE_EXCHANGE; return mask; } -void Fix_charge_regulation::init() { +void FixChargeRegulation::init() { - triclinic = domain->triclinic; - - char *id_pe = (char *) "thermo_pe"; - int ipe = modify->find_compute(id_pe); + triclinic = domain->triclinic; + int ipe = modify->find_compute("thermo_pe"); c_pe = modify->compute[ipe]; if (atom->molecule_flag) { @@ -165,34 +169,27 @@ void Fix_charge_regulation::init() { // skip if already exists from previous init() if (!exclusion_group_bit) { - char **group_arg = new char *[4]; // create unique group name for atoms to be excluded - int len = strlen(id) + 30; - group_arg[0] = new char[len]; - sprintf(group_arg[0], "Fix_CR:exclusion_group:%s", id); - group_arg[1] = (char *) "subtract"; - group_arg[2] = (char *) "all"; - group_arg[3] = (char *) "all"; - group->assign(4, group_arg); - exclusion_group = group->find(group_arg[0]); + + auto group_id = std::string("FixChargeRegulation:CR_exclusion_group:") + id; + group->assign(group_id + " subtract all all"); + exclusion_group = group->find(group_id); if (exclusion_group == -1) - error->all(FLERR, "Could not find fix CR exclusion group ID"); + error->all(FLERR,"Could not find fix charge/regulation exclusion group ID"); exclusion_group_bit = group->bitmask[exclusion_group]; // neighbor list exclusion setup // turn off interactions between group all and the exclusion group int narg = 4; - char **arg = new char *[narg];; + char **arg = new char*[narg];; arg[0] = (char *) "exclude"; arg[1] = (char *) "group"; - arg[2] = group_arg[0]; + arg[2] = (char *) group_id.c_str(); arg[3] = (char *) "all"; - neighbor->modify_params(narg, arg); - delete[] group_arg[0]; - delete[] group_arg; - delete[] arg; + neighbor->modify_params(narg,arg); + delete [] arg; } // check that no deletable atoms are in atom->firstgroup @@ -226,7 +223,7 @@ void Fix_charge_regulation::init() { } } -void Fix_charge_regulation::pre_exchange() { +void FixChargeRegulation::pre_exchange() { if (next_reneighbor != update->ntimestep) return; xlo = domain->boxlo[0]; @@ -263,14 +260,22 @@ void Fix_charge_regulation::pre_exchange() { reaction_distance = 0; } // volume in units of (N_A * mol / liter) - volume_rx = (xhi - xlo) * (yhi - ylo) * (zhi - zlo) * pow(llength_unit_in_nm, 3) * 0.602214; - if (reaction_distance < small) { + volume_rx = (xhi - xlo) * (yhi - ylo) * (zhi - zlo) * cube(llength_unit_in_nm) * NA_RHO0; + if (reaction_distance < SMALL) { vlocal_xrd = volume_rx; } else { - vlocal_xrd = 4.0 * PI * pow(reaction_distance, 3) / 3.0 * pow(llength_unit_in_nm, 3) * 0.602214; + vlocal_xrd = 4.0 * MY_PI * cube(reaction_distance) / 3.0 * cube(llength_unit_in_nm) * NA_RHO0; } beta = 1.0 / (force->boltz * *target_temperature_tcp); + // pre-compute powers + c10pH = pow(10.0,-pH); // dissociated ion (H+) activity + c10pKa = pow(10.0,-pKa); // acid dissociation constant + c10pKb = pow(10.0,-pKb); // base dissociation constant + c10pOH = pow(10.0,-pKs + pH); // dissociated anion (OH-) activity + c10pI_plus = pow(10.0,-pI_plus); // free cation activity + c10pI_minus = pow(10.0,-pI_minus); // free anion activity + // reinitialize counters nacid_neutral = particle_number(acid_type, 0); nacid_charged = particle_number(acid_type, -1); @@ -337,7 +342,7 @@ void Fix_charge_regulation::pre_exchange() { next_reneighbor = update->ntimestep + nevery; } -void Fix_charge_regulation::forward_acid() { +void FixChargeRegulation::forward_acid() { double energy_before = energy_stored; double factor; @@ -360,7 +365,7 @@ void Fix_charge_regulation::forward_acid() { pos[2] = atom->x[m1][2]; } npart_xrd2 = ncation; - if (reaction_distance >= small) { + if (reaction_distance >= SMALL) { pos_all[0] = pos[0]; pos_all[1] = pos[1]; pos_all[2] = pos[2]; @@ -368,8 +373,8 @@ void Fix_charge_regulation::forward_acid() { npart_xrd2 = particle_number_xrd(cation_type, 1, reaction_distance, pos_all); } m2 = insert_particle(cation_type, 1, reaction_distance, pos_all); - factor = nacid_neutral * vlocal_xrd * pow(10, -pKa) - * (1 + pow(10, pH - pI_plus)) / ((1 + nacid_charged) * (1 + npart_xrd2)); + factor = nacid_neutral * vlocal_xrd * c10pKa * c10pI_plus / + (c10pH * (1 + nacid_charged) * (1 + npart_xrd2)); double energy_after = energy_full(); @@ -395,7 +400,7 @@ void Fix_charge_regulation::forward_acid() { } } -void Fix_charge_regulation::backward_acid() { +void FixChargeRegulation::backward_acid() { double energy_before = energy_stored; double factor; @@ -418,7 +423,7 @@ void Fix_charge_regulation::backward_acid() { pos[1] = atom->x[m1][1]; pos[2] = atom->x[m1][2]; } - if (reaction_distance >= small) { + if (reaction_distance >= SMALL) { pos_all[0] = pos[0]; pos_all[1] = pos[1]; pos_all[2] = pos[2]; @@ -433,8 +438,8 @@ void Fix_charge_regulation::backward_acid() { mask_tmp = atom->mask[m2]; // remember group bits. atom->mask[m2] = exclusion_group_bit; } - factor = (1 + nacid_neutral) * vlocal_xrd * pow(10, -pKa) - * (1 + pow(10, pH - pI_plus)) / (nacid_charged * npart_xrd); + factor = (1 + nacid_neutral) * vlocal_xrd * c10pKa * c10pI_plus / + (c10pH * nacid_charged * npart_xrd); double energy_after = energy_full(); @@ -468,7 +473,7 @@ void Fix_charge_regulation::backward_acid() { } } -void Fix_charge_regulation::forward_base() { +void FixChargeRegulation::forward_base() { double energy_before = energy_stored; double factor; @@ -491,16 +496,15 @@ void Fix_charge_regulation::forward_base() { pos[2] = atom->x[m1][2]; } npart_xrd2 = nanion; - if (reaction_distance >= small) { + if (reaction_distance >= SMALL) { pos_all[0] = pos[0]; pos_all[1] = pos[1]; pos_all[2] = pos[2]; MPI_Allreduce(pos, pos_all, 3, MPI_DOUBLE, MPI_SUM, world); npart_xrd2 = particle_number_xrd(anion_type, -1, reaction_distance, pos_all); } - factor = nbase_neutral * vlocal_xrd * pow(10, -pKb) - * (1 + pow(10, pKs - pH - pI_minus)) / - ((1 + nbase_charged) * (1 + npart_xrd2)); + factor = nbase_neutral * vlocal_xrd * c10pKb * c10pI_minus / + (c10pOH * (1 + nbase_charged) * (1 + npart_xrd2)); m2 = insert_particle(anion_type, -1, reaction_distance, pos_all); double energy_after = energy_full(); @@ -526,7 +530,7 @@ void Fix_charge_regulation::forward_base() { } } -void Fix_charge_regulation::backward_base() { +void FixChargeRegulation::backward_base() { double energy_before = energy_stored; double factor; @@ -549,7 +553,7 @@ void Fix_charge_regulation::backward_base() { pos[1] = atom->x[m1][1]; pos[2] = atom->x[m1][2]; } - if (reaction_distance >= small) { + if (reaction_distance >= SMALL) { pos_all[0] = pos[0]; pos_all[1] = pos[1]; pos_all[2] = pos[2]; @@ -563,8 +567,8 @@ void Fix_charge_regulation::backward_base() { mask_tmp = atom->mask[m2]; // remember group bits. atom->mask[m2] = exclusion_group_bit; } - factor = (1 + nbase_neutral) * vlocal_xrd * pow(10, -pKb) - * (1 + pow(10, pKs - pH - pI_minus)) / (nbase_charged * npart_xrd); + factor = (1 + nbase_neutral) * vlocal_xrd * c10pKb * c10pI_minus / + (c10pOH * nbase_charged * npart_xrd); double energy_after = energy_full(); @@ -598,20 +602,20 @@ void Fix_charge_regulation::backward_base() { } } -void Fix_charge_regulation::forward_ions() { +void FixChargeRegulation::forward_ions() { double energy_before = energy_stored; double factor; double *dummyp; int m1 = -1, m2 = -1; - factor = volume_rx * volume_rx * (pow(10, -pH) + pow(10, -pI_plus)) - * (pow(10, -pKs + pH) + pow(10, -pI_minus)) / + factor = volume_rx * volume_rx * c10pI_plus * c10pI_minus / ((1 + ncation) * (1 + nanion)); m1 = insert_particle(cation_type, +1, 0, dummyp); m2 = insert_particle(anion_type, -1, 0, dummyp); double energy_after = energy_full(); - if (energy_after < MAXENERGYTEST && random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { + if (energy_after < MAXENERGYTEST && + random_equal->uniform() < factor * exp(beta * (energy_before - energy_after))) { energy_stored = energy_after; nsalt_successes += 1; ncation++; @@ -632,7 +636,7 @@ void Fix_charge_regulation::forward_ions() { } -void Fix_charge_regulation::backward_ions() { +void FixChargeRegulation::backward_ions() { double energy_before = energy_stored; double factor; @@ -659,8 +663,7 @@ void Fix_charge_regulation::backward_ions() { mask2_tmp = atom->mask[m2]; atom->mask[m2] = exclusion_group_bit; } - factor = (volume_rx * volume_rx * (pow(10, -pH) + pow(10, -pI_plus)) * - (pow(10, -pKs + pH) + pow(10, -pI_minus))) / (ncation * nanion); + factor = volume_rx * volume_rx * c10pI_plus * c10pI_minus / (ncation * nanion); double energy_after = energy_full(); if (energy_after < MAXENERGYTEST && @@ -717,7 +720,7 @@ void Fix_charge_regulation::backward_ions() { } } -void Fix_charge_regulation::forward_ions_multival() { +void FixChargeRegulation::forward_ions_multival() { double energy_before = energy_stored; double factor = 1; @@ -728,19 +731,19 @@ void Fix_charge_regulation::forward_ions_multival() { // insert one anion and (salt_charge_ratio) cations mm[0] = insert_particle(anion_type, salt_charge[1], 0, dummyp); - factor *= volume_rx * pow(10, -pI_minus) / (1 + nanion); + factor *= volume_rx * c10pI_minus / (1 + nanion); for (int i = 0; i < salt_charge_ratio; i++) { mm[i + 1] = insert_particle(cation_type, salt_charge[0], 0, dummyp); - factor *= volume_rx * pow(10, -pI_plus) / (1 + ncation + i); + factor *= volume_rx *c10pI_plus / (1 + ncation + i); } } else { // insert one cation and (salt_charge_ratio) anions mm[0] = insert_particle(cation_type, salt_charge[0], 0, dummyp); - factor *= volume_rx * pow(10, -pI_plus) / (1 + ncation); + factor *= volume_rx * c10pI_plus / (1 + ncation); for (int i = 0; i < salt_charge_ratio; i++) { mm[i + 1] = insert_particle(anion_type, salt_charge[1], 0, dummyp); - factor *= volume_rx * pow(10, -pI_minus) / (1 + nanion + i); + factor *= volume_rx * c10pI_minus / (1 + nanion + i); } } @@ -771,7 +774,7 @@ void Fix_charge_regulation::forward_ions_multival() { } } -void Fix_charge_regulation::backward_ions_multival() { +void FixChargeRegulation::backward_ions_multival() { double energy_before = energy_stored; double factor = 1; @@ -786,7 +789,7 @@ void Fix_charge_regulation::backward_ions_multival() { mm[0] = get_random_particle(anion_type, salt_charge[1], 0, dummyp); if (npart_xrd != nanion) error->all(FLERR, "Fix charge regulation salt count inconsistent"); - factor *= volume_rx * pow(10, -pI_minus) / (nanion); + factor *= volume_rx * c10pI_minus / (nanion); if (mm[0] >= 0) { qq[0] = atom->q[mm[0]]; atom->q[mm[0]] = 0; @@ -796,7 +799,7 @@ void Fix_charge_regulation::backward_ions_multival() { for (int i = 0; i < salt_charge_ratio; i++) { mm[i + 1] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); if (npart_xrd != ncation - i) error->all(FLERR, "Fix charge regulation salt count inconsistent"); - factor *= volume_rx * pow(10, -pI_plus) / (ncation - i); + factor *= volume_rx * c10pI_plus / (ncation - i); if (mm[i + 1] >= 0) { qq[i + 1] = atom->q[mm[i + 1]]; atom->q[mm[i + 1]] = 0; @@ -810,7 +813,7 @@ void Fix_charge_regulation::backward_ions_multival() { if (nanion < salt_charge_ratio || ncation < 1) return; mm[0] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); if (npart_xrd != ncation) error->all(FLERR, "Fix charge regulation salt count inconsistent"); - factor *= volume_rx * pow(10, -pI_plus) / (ncation); + factor *= volume_rx * c10pI_plus / (ncation); if (mm[0] >= 0) { qq[0] = atom->q[mm[0]]; atom->q[mm[0]] = 0; @@ -826,7 +829,7 @@ void Fix_charge_regulation::backward_ions_multival() { mask_tmp[i + 1] = atom->mask[mm[i + 1]]; atom->mask[mm[i + 1]] = exclusion_group_bit; } - factor *= volume_rx * pow(10, -pI_minus) / (nanion - i); + factor *= volume_rx * c10pI_minus / (nanion - i); } } @@ -840,7 +843,7 @@ void Fix_charge_regulation::backward_ions_multival() { atom->natoms -= 1 + salt_charge_ratio; // ions must be deleted in order, otherwise index m could change upon the first deletion for (int i = 0; i < salt_charge_ratio + 1; i++) { - // get max mm value, poor N^2 scaling, but charge ratio is a small number (2 or 3). + // get max mm value, poor N^2 scaling, but charge ratio is a SMALL number (2 or 3). int maxmm = -1, jmaxm = -1; for (int j = 0; j < salt_charge_ratio + 1; j++) { if (mm[j] > maxmm) { @@ -883,23 +886,42 @@ void Fix_charge_regulation::backward_ions_multival() { } } -int Fix_charge_regulation::insert_particle(int ptype, double charge, double rd, double *target) { +int FixChargeRegulation::insert_particle(int ptype, double charge, double rd, double *target) { // insert a particle of type (ptype) with charge (charge) within distance (rd) of (target) double coord[3]; int m = -1; - if (rd < small) { + if (rd < SMALL) { coord[0] = xlo + random_equal->uniform() * (xhi - xlo); coord[1] = ylo + random_equal->uniform() * (yhi - ylo); coord[2] = zlo + random_equal->uniform() * (zhi - zlo); } else { - double radius = reaction_distance * random_equal->uniform(); - double theta = random_equal->uniform() * PI; - double phi = random_equal->uniform() * 2 * PI; - coord[0] = target[0] + radius * sin(theta) * cos(phi); - coord[1] = target[1] + radius * sin(theta) * sin(phi); - coord[2] = target[2] + radius * cos(theta); + // get a random point inside a sphere with radius rd + // simple rejection sampling, probably the fastest method + double dxx=1,dyy=1,dzz=1; + while (dxx * dxx + dyy * dyy + dzz * dzz > 1.0) { + dxx = 2 * random_equal->uniform() - 1.0; + dyy = 2 * random_equal->uniform() - 1.0; + dzz = 2 * random_equal->uniform() - 1.0; + } + coord[0] = target[0] + rd * dxx; + coord[1] = target[1] + rd * dyy; + coord[2] = target[2] + rd * dzz; + + // Alternative way, but likely somewhat less efficient + /* + double radius = rd * pow(random_equal->uniform(), THIRD); + double theta = acos(2 * random_equal->uniform() - 1); + double phi = random_equal->uniform() * 2 * MY_PI; + double sinphi = sin(phi); + double cosphi = cos(phi); + double sintheta = sin(theta); + double costheta = cos(theta); + coord[0] = target[0] + radius * sintheta * cosphi; + coord[1] = target[1] + radius * sintheta * sinphi; + coord[2] = target[2] + radius * costheta; + */ coord[0] = coord[0] - floor(1.0 * (coord[0] - xlo) / (xhi - xlo)) * (xhi - xlo); coord[1] = coord[1] - floor(1.0 * (coord[1] - ylo) / (yhi - ylo)) * (yhi - ylo); coord[2] = coord[2] - floor(1.0 * (coord[2] - zlo) / (zhi - zlo)) * (zhi - zlo); @@ -926,7 +948,7 @@ int Fix_charge_regulation::insert_particle(int ptype, double charge, double rd, return m; } -int Fix_charge_regulation::get_random_particle(int ptype, double charge, double rd, double *target) { +int FixChargeRegulation::get_random_particle(int ptype, double charge, double rd, double *target) { // returns a randomly chosen particle of type (ptype) with charge (charge) // chosen among particles within distance (rd) of (target) @@ -947,9 +969,9 @@ int Fix_charge_regulation::get_random_particle(int ptype, double charge, double count_global = 0; count_before = 0; - if (rd < small) { //reaction_distance < small: No geometry constraint on random particle choice + if (rd < SMALL) { //reaction_distance < SMALL: No constraint on random particle choice for (int i = 0; i < nlocal; i++) { - if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < SMALL && atom->mask[i] != exclusion_group_bit) { ptype_ID[count_local] = i; count_local++; @@ -966,7 +988,7 @@ int Fix_charge_regulation::get_random_particle(int ptype, double charge, double dz -= static_cast(1.0 * dz / (zhi - zlo) + 0.5) * (zhi - zlo); distance_check = dx * dx + dy * dy + dz * dz; if ((distance_check < rd * rd) && atom->type[i] == ptype && - fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) { + fabs(atom->q[i] - charge) < SMALL && atom->mask[i] != exclusion_group_bit) { ptype_ID[count_local] = i; count_local++; } @@ -990,7 +1012,7 @@ int Fix_charge_regulation::get_random_particle(int ptype, double charge, double return -1; } -double Fix_charge_regulation::energy_full() { +double FixChargeRegulation::energy_full() { int imolecule; if (triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -1050,12 +1072,12 @@ double Fix_charge_regulation::energy_full() { return total_energy; } -int Fix_charge_regulation::particle_number_xrd(int ptype, double charge, double rd, double *target) { +int FixChargeRegulation::particle_number_xrd(int ptype, double charge, double rd, double *target) { int count = 0; - if (rd < small) { + if (rd < SMALL) { for (int i = 0; i < atom->nlocal; i++) { - if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < SMALL && atom->mask[i] != exclusion_group_bit) count++; } } else { @@ -1069,7 +1091,7 @@ int Fix_charge_regulation::particle_number_xrd(int ptype, double charge, double dz -= static_cast(1.0 * dz / (zhi - zlo) + 0.5) * (zhi - zlo); distance_check = dx * dx + dy * dy + dz * dz; if ((distance_check < rd * rd) && atom->type[i] == ptype && - fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) { + fabs(atom->q[i] - charge) < SMALL && atom->mask[i] != exclusion_group_bit) { count++; } } @@ -1079,11 +1101,11 @@ int Fix_charge_regulation::particle_number_xrd(int ptype, double charge, double return count_sum; } -int Fix_charge_regulation::particle_number(int ptype, double charge) { +int FixChargeRegulation::particle_number(int ptype, double charge) { int count = 0; for (int i = 0; i < atom->nlocal; i++) { - if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < small && atom->mask[i] != exclusion_group_bit) + if (atom->type[i] == ptype && fabs(atom->q[i] - charge) < SMALL && atom->mask[i] != exclusion_group_bit) count = count + 1; } int count_sum = count; @@ -1091,7 +1113,7 @@ int Fix_charge_regulation::particle_number(int ptype, double charge) { return count_sum; } -double Fix_charge_regulation::compute_vector(int n) { +double FixChargeRegulation::compute_vector(int n) { double count_temp = 0; if (n == 0) { return nacid_attempts + nbase_attempts + nsalt_attempts; @@ -1113,7 +1135,7 @@ double Fix_charge_regulation::compute_vector(int n) { return 0.0; } -void Fix_charge_regulation::setThermoTemperaturePointer() { +void FixChargeRegulation::setThermoTemperaturePointer() { int ifix = -1; ifix = modify->find_fix(idftemp); if (ifix == -1) { @@ -1126,7 +1148,7 @@ void Fix_charge_regulation::setThermoTemperaturePointer() { } -void Fix_charge_regulation::assign_tags() { +void FixChargeRegulation::assign_tags() { // Assign tags to ions with zero tags if (atom->tag_enable) { tagint *tag = atom->tag; @@ -1167,14 +1189,14 @@ void Fix_charge_regulation::assign_tags() { parse input options ------------------------------------------------------------------------- */ -void Fix_charge_regulation::options(int narg, char **arg) { +void FixChargeRegulation::options(int narg, char **arg) { if (narg < 0) error->all(FLERR, "Illegal fix charge regulation command"); // defaults pH = 7.0; - pI_plus = 100; - pI_minus = 100; + pI_plus = 5; + pI_minus = 5; acid_type = -1; base_type = -1; pKa = 100; @@ -1182,12 +1204,12 @@ void Fix_charge_regulation::options(int narg, char **arg) { pKs = 14.0; nevery = 100; nmc = 100; - pmcmoves[0] = pmcmoves[1] = pmcmoves[2] = 0.33; - llength_unit_in_nm= 0.72; + pmcmoves[0] = pmcmoves[1] = pmcmoves[2] = THIRD; + llength_unit_in_nm= 0.71; // Default set to Bjerrum length in water at 20 degrees C [nm] reservoir_temperature = 1.0; reaction_distance = 0; - seed = 12345; + seed = 0; target_temperature_tcp = &reservoir_temperature; add_tags_flag = false; only_salt_flag = false; @@ -1297,9 +1319,9 @@ void Fix_charge_regulation::options(int narg, char **arg) { if (iarg + 4 > narg) error->all(FLERR, "Illegal fix charge regulation command"); salt_charge[0] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); salt_charge[1] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if (fabs(salt_charge[0] - utils::inumeric(FLERR, arg[iarg + 2], false, lmp)) > small) + if (fabs(salt_charge[0] - utils::inumeric(FLERR, arg[iarg + 2], false, lmp)) > SMALL) error->all(FLERR, "Illegal fix charge regulation command, cation charge must be an integer"); - if (fabs(salt_charge[1] - utils::inumeric(FLERR, arg[iarg + 3], false, lmp)) > small) + if (fabs(salt_charge[1] - utils::inumeric(FLERR, arg[iarg + 3], false, lmp)) > SMALL) error->all(FLERR, "Illegal fix charge regulation command, anion charge must be an integer"); iarg += 4; } else if (strcmp(arg[iarg + 1], "no") == 0) { @@ -1329,7 +1351,7 @@ void Fix_charge_regulation::options(int narg, char **arg) { memory usage of local atom-based arrays ------------------------------------------------------------------------- */ -double Fix_charge_regulation::memory_usage() { +double FixChargeRegulation::memory_usage() { double bytes = cr_nmax * sizeof(int); return bytes; } diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/USER-MISC/fix_charge_regulation.h index d698bd6bb7..3afaffddb7 100644 --- a/src/USER-MISC/fix_charge_regulation.h +++ b/src/USER-MISC/fix_charge_regulation.h @@ -17,21 +17,21 @@ #ifdef FIX_CLASS -FixStyle(charge_regulation,Fix_charge_regulation) +FixStyle(charge/regulation,FixChargeRegulation) #else -#ifndef LMP_FIX_charge_regulation_H -#define LMP_FIX_charge_regulation_H +#ifndef LMP_FIX_CHARGE_REGULATION_H +#define LMP_FIX_CHARGE_REGULATION_H #include "fix.h" namespace LAMMPS_NS { - class Fix_charge_regulation : public Fix { + class FixChargeRegulation : public Fix { public: - Fix_charge_regulation(class LAMMPS *, int, char **); - ~Fix_charge_regulation(); + FixChargeRegulation(class LAMMPS *, int, char **); + ~FixChargeRegulation(); int setmask(); void init(); void pre_exchange(); @@ -59,7 +59,8 @@ namespace LAMMPS_NS { int nevery, seed; // begin MC cycle every nevery MD timesteps, random seed int nmc; // MC move attempts per cycle double llength_unit_in_nm ; // LAMMPS unit of length in nm, needed since chemical potentials are in units of mol/l - double pH, pKa, pKb, pKs, pI_plus, pI_minus; // chemical potentials + double pH, pKa, pKb, pKs, pI_plus, pI_minus; // chemical potentials and equilibrium constant in log10 base + double c10pH, c10pKa, c10pKb, c10pOH, c10pI_plus, c10pI_minus; // 10 raised to chemical potential value, in units of concentration [mol/liter] double pmcmoves[3]; // mc move attempt probability: acid, base, ion pair exchange double pmcc; // mc move cumulative attempt probability int npart_xrd; // # of particles (ions) within xrd @@ -78,7 +79,7 @@ namespace LAMMPS_NS { double reservoir_temperature; double beta, sigma, volume, volume_rx; // inverse temperature, speed, total volume, reacting volume int salt_charge[2]; // charge of salt ions: [0] - cation, [1] - anion - int salt_charge_ratio; // charge ration when using multivalent ion exchange + int salt_charge_ratio; // charge ratio when using multivalent ion exchange double xlo, xhi, ylo, yhi, zlo, zhi; // box size double energy_stored; // full energy of old/current configuration int triclinic; // 0 = orthog box, 1 = triclinic From faa2407aa46805bea4caf9e90c768b5bd187a8ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 07:04:19 -0500 Subject: [PATCH 012/370] plug memory leak --- src/USER-MISC/fix_charge_regulation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp index c43a509f61..0a9619096e 100644 --- a/src/USER-MISC/fix_charge_regulation.cpp +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -129,6 +129,7 @@ FixChargeRegulation::~FixChargeRegulation() { delete random_equal; delete random_unequal; + delete idftemp; if (group) { int igroupall = group->find("all"); From 8ee693204a7b7f3fb5071770dae1713b34dd8270 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 07:05:07 -0500 Subject: [PATCH 013/370] use nullptr instead of NULL to initialize pointers --- src/USER-MISC/fix_charge_regulation.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp index 0a9619096e..7608849190 100644 --- a/src/USER-MISC/fix_charge_regulation.cpp +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -61,10 +61,10 @@ using namespace MathSpecial; FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - ngroups(0), groupstrings(NULL), - random_equal(NULL), random_unequal(NULL), - idftemp(NULL), ptype_ID(NULL) - { + ngroups(0), groupstrings(nullptr), ptype_ID(nullptr), + random_equal(nullptr), random_unequal(nullptr), + idftemp(nullptr) +{ // Region restrictions not yet implemented .. @@ -1221,7 +1221,7 @@ void FixChargeRegulation::options(int narg, char **arg) { exclusion_group_bit = 0; ngroups = 0; int ngroupsmax = 0; - groupstrings = NULL; + groupstrings = nullptr; int iarg = 0; while (iarg < narg) { From 9671ba79003171d7d50e8bc3c385c99d78d05774 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 07:05:28 -0500 Subject: [PATCH 014/370] silence compiler warnings --- src/USER-MISC/fix_charge_regulation.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp index 7608849190..8a6530ef2b 100644 --- a/src/USER-MISC/fix_charge_regulation.cpp +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -347,7 +347,7 @@ void FixChargeRegulation::forward_acid() { double energy_before = energy_stored; double factor; - double *dummyp; + double *dummyp = nullptr; double pos[3]; pos[0] = 0; pos[1] = 0; @@ -406,13 +406,13 @@ void FixChargeRegulation::backward_acid() { double energy_before = energy_stored; double factor; int mask_tmp; - double *dummyp; + double *dummyp = nullptr; double pos[3]; pos[0] = 0; pos[1] = 0; pos[2] = 0; // acid/base particle position double pos_all[3]; - int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + int m1 = -1, m2 = -1; m1 = get_random_particle(acid_type, -1, 0, dummyp); if (npart_xrd != nacid_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); @@ -478,13 +478,13 @@ void FixChargeRegulation::forward_base() { double energy_before = energy_stored; double factor; - double *dummyp; + double *dummyp = nullptr; double pos[3]; pos[0] = 0; pos[1] = 0; pos[2] = 0; // acid/base particle position double pos_all[3]; - int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + int m1 = -1, m2 = -1; m1 = get_random_particle(base_type, 0, 0, dummyp); if (npart_xrd != nbase_neutral) error->all(FLERR, "Fix charge regulation acid count inconsistent"); @@ -535,14 +535,14 @@ void FixChargeRegulation::backward_base() { double energy_before = energy_stored; double factor; - double *dummyp; + double *dummyp = nullptr; int mask_tmp; double pos[3]; pos[0] = 0; pos[1] = 0; pos[2] = 0; // acid/base particle position double pos_all[3]; - int m1 = -1, m1_all = -1, m2 = -1, m2_all = -1; + int m1 = -1, m2 = -1; m1 = get_random_particle(base_type, 1, 0, dummyp); if (npart_xrd != nbase_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); @@ -607,7 +607,7 @@ void FixChargeRegulation::forward_ions() { double energy_before = energy_stored; double factor; - double *dummyp; + double *dummyp = nullptr; int m1 = -1, m2 = -1; factor = volume_rx * volume_rx * c10pI_plus * c10pI_minus / ((1 + ncation) * (1 + nanion)); @@ -642,7 +642,7 @@ void FixChargeRegulation::backward_ions() { double energy_before = energy_stored; double factor; int mask1_tmp, mask2_tmp; - double *dummyp; // dummy pointer + double *dummyp = nullptr; int m1 = -1, m2 = -1; m1 = get_random_particle(cation_type, +1, 0, dummyp); @@ -1014,7 +1014,6 @@ int FixChargeRegulation::get_random_particle(int ptype, double charge, double rd } double FixChargeRegulation::energy_full() { - int imolecule; if (triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); comm->exchange(); @@ -1030,7 +1029,6 @@ double FixChargeRegulation::energy_full() { int overlaptest = 0; double delx, dely, delz, rsq; double **x = atom->x; - tagint *molecule = atom->molecule; int nall = atom->nlocal + atom->nghost; for (int i = 0; i < atom->nlocal; i++) { for (int j = i + 1; j < nall; j++) { @@ -1115,7 +1113,6 @@ int FixChargeRegulation::particle_number(int ptype, double charge) { } double FixChargeRegulation::compute_vector(int n) { - double count_temp = 0; if (n == 0) { return nacid_attempts + nbase_attempts + nsalt_attempts; } else if (n == 1) { From 676191f3303751c39ce4a36bcb964f7d079d527d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 07:28:15 -0500 Subject: [PATCH 015/370] various cosmetic changes - print warnings only on MPI rank 0 - use the fix name charge/regulation consistently - use domain->prd_half for half box length instead of computing it - use utils::inumeric() to guarantee integer charge input - LAMMPS coding style adjustments --- src/USER-MISC/fix_charge_regulation.cpp | 194 ++++++++++++++---------- 1 file changed, 114 insertions(+), 80 deletions(-) diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/USER-MISC/fix_charge_regulation.cpp index 8a6530ef2b..5479082158 100644 --- a/src/USER-MISC/fix_charge_regulation.cpp +++ b/src/USER-MISC/fix_charge_regulation.cpp @@ -85,25 +85,27 @@ FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) : // set defaults and read optional arguments options(narg - 5, &arg[5]); - if (nevery <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (nmc < 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (llength_unit_in_nm < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (*target_temperature_tcp < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (seed <= 0) error->all(FLERR, "Illegal fix charge/regulation command: Seed value (positive integer) must be provided "); - if (cation_type <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (anion_type <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (reaction_distance < 0.0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (salt_charge[0] <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if (salt_charge[1] >= 0) error->all(FLERR, "Illegal fix charge/regulation command"); - if ((salt_charge[1] % salt_charge[0] != 0) && (salt_charge[0] % salt_charge[1] != 0)) - error->all(FLERR, - "Illegal fix charge/regulation command, multivalent cation/anion charges are allowed, " - "but must be divisible, e.g. (3,-1) is fine, but (3,-2) is not implemented"); + if ((nevery <= 0) || (nmc < 0) || (llength_unit_in_nm < 0.0) + || (*target_temperature_tcp < 0.0) || (cation_type <= 0) + || (anion_type <= 0) || (reaction_distance < 0.0) + || (salt_charge[0] <= 0) || (salt_charge[1] >= 0)) + error->all(FLERR, "Illegal fix charge/regulation command"); + + if (seed <= 0) + error->all(FLERR, "Illegal fix charge/regulation command: " + "Seed value (positive integer) must be provided "); + if ((salt_charge[1] % salt_charge[0] != 0) + && (salt_charge[0] % salt_charge[1] != 0)) + error->all(FLERR,"Illegal fix charge/regulation command, " + "multivalent cation/anion charges are allowed, " + "but must be divisible, e.g. (3,-1) is fine, " + "but (3,-2) is not implemented"); if (pmcmoves[0] < 0 || pmcmoves[1] < 0 || pmcmoves[2] < 0) error->all(FLERR, "Illegal fix charge/regulation command"); if (acid_type < 0) pmcmoves[0] = 0; if (base_type < 0) pmcmoves[1] = 0; + // normalize double psum = pmcmoves[0] + pmcmoves[1] + pmcmoves[2]; if (psum <= 0) error->all(FLERR, "Illegal fix charge/regulation command"); @@ -159,11 +161,12 @@ void FixChargeRegulation::init() { MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); if (flagall && comm->me == 0) - error->all(FLERR, "Fix charge regulation cannot exchange individual atoms (ions) belonging to a molecule"); + error->all(FLERR, "fix charge/regulation cannot exchange " + "individual atoms (ions) belonging to a molecule"); } if (domain->dimension == 2) - error->all(FLERR, "Cannot use fix charge regulation in a 2d simulation"); + error->all(FLERR, "Cannot use fix charge/regulation in a 2d simulation"); // create a new group for interaction exclusions // used for attempted atom deletions @@ -173,11 +176,12 @@ void FixChargeRegulation::init() { // create unique group name for atoms to be excluded - auto group_id = std::string("FixChargeRegulation:CR_exclusion_group:") + id; + auto group_id = fmt::format("FixChargeRegulation:exclusion_group:{}",id); group->assign(group_id + " subtract all all"); exclusion_group = group->find(group_id); if (exclusion_group == -1) - error->all(FLERR,"Could not find fix charge/regulation exclusion group ID"); + error->all(FLERR,"Could not find fix charge/regulation exclusion " + "group ID"); exclusion_group_bit = group->bitmask[exclusion_group]; // neighbor list exclusion setup @@ -208,7 +212,8 @@ void FixChargeRegulation::init() { MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); if (flagall) - error->all(FLERR, "Cannot do Fix charge regulation on atoms in atom_modify first group"); + error->all(FLERR, "Cannot use fix charge/regulation on atoms " + "in atom_modify first group"); } // construct group bitmask for all new atoms @@ -219,7 +224,7 @@ void FixChargeRegulation::init() { for (int igroup = 0; igroup < ngroups; igroup++) { int jgroup = group->find(groupstrings[igroup]); if (jgroup == -1) - error->all(FLERR, "Could not find specified fix charge regulation group ID"); + error->all(FLERR, "Could not find fix charge/regulation group ID"); groupbitall |= group->bitmask[jgroup]; } } @@ -250,22 +255,26 @@ void FixChargeRegulation::pre_exchange() { if (triclinic) domain->lamda2x(atom->nlocal + atom->nghost); energy_stored = energy_full(); - if (energy_stored > MAXENERGYTEST) - error->warning(FLERR, "Energy of old configuration in fix charge_regulation is > MAXENERGYTEST."); + if ((energy_stored > MAXENERGYTEST) && (comm->me == 0)) + error->warning(FLERR, "Energy of old configuration in fix " + "charge/regulation is > MAXENERGYTEST."); - if ((reaction_distance > fabs(domain->boxhi[0] - domain->boxlo[0]) / 2) || - (reaction_distance > fabs(domain->boxhi[1] - domain->boxlo[1]) / 2) || - (reaction_distance > fabs(domain->boxhi[2] - domain->boxlo[2]) / 2)) { - error->warning(FLERR, - "reaction distance (rxd) is larger than half the box dimension, resetting default: xrd = 0."); + if ((reaction_distance > domain->prd_half[0]) || + (reaction_distance > domain->prd_half[1]) || + (reaction_distance > domain->prd_half[2])) { + if (comm->me == 0) + error->warning(FLERR,"reaction distance (rxd) is larger than " + "half the box dimension, resetting default: xrd = 0."); reaction_distance = 0; } // volume in units of (N_A * mol / liter) - volume_rx = (xhi - xlo) * (yhi - ylo) * (zhi - zlo) * cube(llength_unit_in_nm) * NA_RHO0; + volume_rx = (xhi - xlo) * (yhi - ylo) * (zhi - zlo) + * cube(llength_unit_in_nm) * NA_RHO0; if (reaction_distance < SMALL) { vlocal_xrd = volume_rx; } else { - vlocal_xrd = 4.0 * MY_PI * cube(reaction_distance) / 3.0 * cube(llength_unit_in_nm) * NA_RHO0; + vlocal_xrd = 4.0 * MY_PI * cube(reaction_distance) + / 3.0 * cube(llength_unit_in_nm) * NA_RHO0; } beta = 1.0 / (force->boltz * *target_temperature_tcp); @@ -356,7 +365,7 @@ void FixChargeRegulation::forward_acid() { int m1 = -1, m2 = -1; m1 = get_random_particle(acid_type, 0, 0, dummyp); - if (npart_xrd != nacid_neutral) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + if (npart_xrd != nacid_neutral) error->all(FLERR, "fix charge/regulation acid count inconsistent"); if (nacid_neutral > 0) { if (m1 >= 0) { @@ -415,7 +424,8 @@ void FixChargeRegulation::backward_acid() { int m1 = -1, m2 = -1; m1 = get_random_particle(acid_type, -1, 0, dummyp); - if (npart_xrd != nacid_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + if (npart_xrd != nacid_charged) + error->all(FLERR, "fix charge/regulation acid count inconsistent"); if (nacid_charged > 0) { if (m1 >= 0) { @@ -487,7 +497,8 @@ void FixChargeRegulation::forward_base() { int m1 = -1, m2 = -1; m1 = get_random_particle(base_type, 0, 0, dummyp); - if (npart_xrd != nbase_neutral) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + if (npart_xrd != nbase_neutral) + error->all(FLERR, "fix charge/regulation acid count inconsistent"); if (nbase_neutral > 0) { if (m1 >= 0) { @@ -545,7 +556,8 @@ void FixChargeRegulation::backward_base() { int m1 = -1, m2 = -1; m1 = get_random_particle(base_type, 1, 0, dummyp); - if (npart_xrd != nbase_charged) error->all(FLERR, "Fix charge regulation acid count inconsistent"); + if (npart_xrd != nbase_charged) + error->all(FLERR, "fix charge/regulation acid count inconsistent"); if (nbase_charged > 0) { if (m1 >= 0) { @@ -646,10 +658,12 @@ void FixChargeRegulation::backward_ions() { int m1 = -1, m2 = -1; m1 = get_random_particle(cation_type, +1, 0, dummyp); - if (npart_xrd != ncation) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != ncation) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); if (ncation > 0) { m2 = get_random_particle(anion_type, -1, 0, dummyp); - if (npart_xrd != nanion) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != nanion) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); if (nanion > 0) { // attempt deletion @@ -789,7 +803,8 @@ void FixChargeRegulation::backward_ions_multival() { if (ncation < salt_charge_ratio || nanion < 1) return; mm[0] = get_random_particle(anion_type, salt_charge[1], 0, dummyp); - if (npart_xrd != nanion) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != nanion) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); factor *= volume_rx * c10pI_minus / (nanion); if (mm[0] >= 0) { qq[0] = atom->q[mm[0]]; @@ -799,7 +814,8 @@ void FixChargeRegulation::backward_ions_multival() { } for (int i = 0; i < salt_charge_ratio; i++) { mm[i + 1] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); - if (npart_xrd != ncation - i) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != ncation - i) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); factor *= volume_rx * c10pI_plus / (ncation - i); if (mm[i + 1] >= 0) { qq[i + 1] = atom->q[mm[i + 1]]; @@ -813,7 +829,8 @@ void FixChargeRegulation::backward_ions_multival() { if (nanion < salt_charge_ratio || ncation < 1) return; mm[0] = get_random_particle(cation_type, salt_charge[0], 0, dummyp); - if (npart_xrd != ncation) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != ncation) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); factor *= volume_rx * c10pI_plus / (ncation); if (mm[0] >= 0) { qq[0] = atom->q[mm[0]]; @@ -823,7 +840,8 @@ void FixChargeRegulation::backward_ions_multival() { } for (int i = 0; i < salt_charge_ratio; i++) { mm[i + 1] = get_random_particle(anion_type, salt_charge[1], 0, dummyp); - if (npart_xrd != nanion - i) error->all(FLERR, "Fix charge regulation salt count inconsistent"); + if (npart_xrd != nanion - i) + error->all(FLERR, "fix charge/regulation salt count inconsistent"); if (mm[i + 1] >= 0) { qq[i + 1] = atom->q[mm[i + 1]]; atom->q[mm[i + 1]] = 0; @@ -1138,7 +1156,7 @@ void FixChargeRegulation::setThermoTemperaturePointer() { ifix = modify->find_fix(idftemp); if (ifix == -1) { error->all(FLERR, - "Fix charge regulation regulation could not find a temperature fix id provided by tempfixid\n"); + "fix charge/regulation regulation could not find a temperature fix id provided by tempfixid\n"); } Fix *temperature_fix = modify->fix[ifix]; int dim; @@ -1188,7 +1206,7 @@ void FixChargeRegulation::assign_tags() { ------------------------------------------------------------------------- */ void FixChargeRegulation::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR, "Illegal fix charge regulation command"); + if (narg < 0) error->all(FLERR, "Illegal fix charge/regulation command"); // defaults @@ -1224,48 +1242,59 @@ void FixChargeRegulation::options(int narg, char **arg) { while (iarg < narg) { if (strcmp(arg[iarg], "lunit_nm") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); llength_unit_in_nm = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "acid_type") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); acid_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "base_type") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); base_type = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pH") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pH = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pIp") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pI_plus = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pIm") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pI_minus = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pKa") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pKa = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pKb") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pKb = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "temp") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); reservoir_temperature = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pKs") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pKs = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "tempfixid") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); int n = strlen(arg[iarg + 1]) + 1; delete[] idftemp; idftemp = new char[n]; @@ -1273,75 +1302,81 @@ void FixChargeRegulation::options(int narg, char **arg) { setThermoTemperaturePointer(); iarg += 2; } else if (strcmp(arg[iarg], "rxd") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); reaction_distance = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - if ((reaction_distance > fabs(domain->boxhi[0] - domain->boxlo[0]) / 2) || - (reaction_distance > fabs(domain->boxhi[1] - domain->boxlo[1]) / 2) || - (reaction_distance > fabs(domain->boxhi[2] - domain->boxlo[2]) / 2)) { - error->warning(FLERR, - "reaction distance (rxd) is larger than half the box dimension, resetting default: xrd = 0."); + if ((reaction_distance > domain->prd_half[0]) || + (reaction_distance > domain->prd_half[1]) || + (reaction_distance > domain->prd_half[2])) { + if (comm->me == 0) + error->warning(FLERR,"reaction distance (rxd) is larger than half " + "the box dimension, resetting default: xrd = 0."); reaction_distance = 0; } iarg += 2; } else if (strcmp(arg[iarg], "nevery") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); nevery = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "nmc") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); nmc = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "pmcmoves") == 0) { - if (iarg + 4 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 4 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); pmcmoves[0] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); pmcmoves[1] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); pmcmoves[2] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; } else if (strcmp(arg[iarg], "seed") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); seed = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "tag") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); if (strcmp(arg[iarg + 1], "yes") == 0) { add_tags_flag = true; } else if (strcmp(arg[iarg + 1], "no") == 0) { add_tags_flag = false; - } else { error->all(FLERR, "Illegal fix charge regulation command"); } + } else error->all(FLERR, "Illegal fix charge/regulation command"); iarg += 2; } else if (strcmp(arg[iarg], "onlysalt") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); if (strcmp(arg[iarg + 1], "yes") == 0) { only_salt_flag = true; // need to specify salt charge - if (iarg + 4 > narg) error->all(FLERR, "Illegal fix charge regulation command"); - salt_charge[0] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - salt_charge[1] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if (fabs(salt_charge[0] - utils::inumeric(FLERR, arg[iarg + 2], false, lmp)) > SMALL) - error->all(FLERR, "Illegal fix charge regulation command, cation charge must be an integer"); - if (fabs(salt_charge[1] - utils::inumeric(FLERR, arg[iarg + 3], false, lmp)) > SMALL) - error->all(FLERR, "Illegal fix charge regulation command, anion charge must be an integer"); + if (iarg + 4 > narg) + error->all(FLERR, "Illegal fix charge/regulation command"); + salt_charge[0] = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + salt_charge[1] = utils::inumeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; } else if (strcmp(arg[iarg + 1], "no") == 0) { only_salt_flag = false; iarg += 2; - } else { error->all(FLERR, "Illegal fix charge regulation command"); } + } else error->all(FLERR, "Illegal fix charge/regulation command"); } else if (strcmp(arg[iarg], "group") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix fix charge regulation command"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix fix charge/regulation command"); if (ngroups >= ngroupsmax) { ngroupsmax = ngroups + 1; groupstrings = (char **) - memory->srealloc(groupstrings, - ngroupsmax * sizeof(char *), - "fix_charge_regulation:groupstrings"); + memory->srealloc(groupstrings, + ngroupsmax * sizeof(char *), + "fix_charge_regulation:groupstrings"); } int n = strlen(arg[iarg + 1]) + 1; groupstrings[ngroups] = new char[n]; strcpy(groupstrings[ngroups], arg[iarg + 1]); ngroups++; iarg += 2; - } else { error->all(FLERR, "Illegal fix charge regulation command"); } + } else error->all(FLERR, "Illegal fix charge/regulation command"); } } @@ -1350,6 +1385,5 @@ void FixChargeRegulation::options(int narg, char **arg) { ------------------------------------------------------------------------- */ double FixChargeRegulation::memory_usage() { - double bytes = cr_nmax * sizeof(int); - return bytes; + return (double)cr_nmax * sizeof(int); } From 6c2abf4739a2ba78dc35d122d0697b826405ab9b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 07:53:19 -0500 Subject: [PATCH 016/370] update fix charge/regulation input example to follow LAMMPS conventions closer --- examples/USER/misc/charge_regulation/README | 38 +++- .../{data_acid.chreg => data.chreg-acid} | 0 ...{data_polymer.chreg => data.chreg-polymer} | 0 .../{in_acid.chreg => in.chreg-acid} | 41 ++--- .../misc/charge_regulation/in.chreg-polymer | 33 ++++ .../misc/charge_regulation/in_polymer.chreg | 37 ---- .../misc/charge_regulation/log_acid.lammps | 163 ------------------ 7 files changed, 84 insertions(+), 228 deletions(-) rename examples/USER/misc/charge_regulation/{data_acid.chreg => data.chreg-acid} (100%) rename examples/USER/misc/charge_regulation/{data_polymer.chreg => data.chreg-polymer} (100%) rename examples/USER/misc/charge_regulation/{in_acid.chreg => in.chreg-acid} (52%) create mode 100644 examples/USER/misc/charge_regulation/in.chreg-polymer delete mode 100644 examples/USER/misc/charge_regulation/in_polymer.chreg delete mode 100644 examples/USER/misc/charge_regulation/log_acid.lammps diff --git a/examples/USER/misc/charge_regulation/README b/examples/USER/misc/charge_regulation/README index 5666d6d025..c704b67dea 100644 --- a/examples/USER/misc/charge_regulation/README +++ b/examples/USER/misc/charge_regulation/README @@ -1,8 +1,36 @@ -This directory has two input scripts that illustrates how to use fix charge_regulation in LAMMPS to perform coarse-grained molecular dynamics (MD) simulations with incorporation of charge regulation effects. The charge regulation is implemented via Monte Carlo (MC) sampling following the reaction ensemble MC approach, producing a MC/MD hybrid tool for modeling charge regulation in solvated systems. +This directory has two input scripts that illustrates how to use fix +charge_regulation in LAMMPS to perform coarse-grained molecular dynamics +(MD) simulations with incorporation of charge regulation effects. The +charge regulation is implemented via Monte Carlo (MC) sampling following +the reaction ensemble MC approach, producing a MC/MD hybrid tool for +modeling charge regulation in solvated systems. -The script `in_acid.chreg` sets up a simple weak acid electrolyte (pH=7,pKa=6,pI=3). Four different types of MC moves are implemented: acid protonation & de-protonation, and monovalent ion pair insertion and deletion. Note here we have grouped all free monovalent ions into a single type, a physically natural choice on the level of coarse-grained primitive electrolyte models, which increases the calculation performance but has no effects on thermodynamic observables. The variables such as pH, pKa, pI, and lb at the top of the input script can be adjusted to play with various simulation parameters. The cumulative MC attempted moves and cumulative number of accepted moves, as well as, current number of neutral and charged acid particles, neutral and charged base particles (in this example always 0), and the current number of free cations and anions in the system are printed in the `log_acid.lammps`. +The script `in.chreg-acid` sets up a simple weak acid electrolyte +(pH=7,pKa=6,pI=3). Four different types of MC moves are implemented: +acid protonation & de-protonation, and monovalent ion pair insertion and +deletion. Note here we have grouped all free monovalent ions into a +single type, a physically natural choice on the level of coarse-grained +primitive electrolyte models, which increases the calculation +performance but has no effects on thermodynamic observables. The +variables such as pH, pKa, pI, and lb at the top of the input script can +be adjusted to play with various simulation parameters. The cumulative +MC attempted moves and cumulative number of accepted moves, as well as, +current number of neutral and charged acid particles, neutral and +charged base particles (in this example always 0), and the current +number of free cations and anions in the system are printed in the +output. -The script `in_polymer.chreg` sets up a weak polyelectrolyte chain of N=80 beads. Each bead is a weak acid with pKa=5 and solution has pH=7 and monovalent salt chemical potential pI=3. In this example, we choose to treat salt ions, protons, and hydroxyl ions separately, which results in 5 types of MC moves: acid [type 1] protonation & de-protonation (with protons [type 4] insertion & deletion), acid [type 1] protonation & de-protonation (with salt cation [type 2] insertion & deletion), water self-ionization (insertion and deletion of proton [type4] and hydroxyl ion [type 5] pair), insertion and deletion of monovalent salt pair [type 2 and type 3] , insertion and deletion -Of a proton [type4] and salt anion [type 3]. -The current number of neutral and charged acid particles, the current number of free salt cations and anions, and the current number of protons and hydroxyl ions are printed in the `log_polymer.lammps`. +The script `in.chreg-polymer` sets up a weak poly-electrolyte chain of +N=80 beads. Each bead is a weak acid with pKa=5 and solution has pH=7 +and monovalent salt chemical potential pI=3. In this example, we choose +to treat salt ions, protons, and hydroxyl ions separately, which results +in 5 types of MC moves: acid [type 1] protonation & de-protonation (with +protons [type 4] insertion & deletion), acid [type 1] protonation & +de-protonation (with salt cation [type 2] insertion & deletion), water +self-ionization (insertion and deletion of proton [type4] and hydroxyl +ion [type 5] pair), insertion and deletion of monovalent salt pair [type +2 and type 3] , insertion and deletion of a proton [type4] and salt +anion [type 3]. The current number of neutral and charged acid +particles, the current number of free salt cations and anions, and the +current number of protons and hydroxyl ions are printed in the output. diff --git a/examples/USER/misc/charge_regulation/data_acid.chreg b/examples/USER/misc/charge_regulation/data.chreg-acid similarity index 100% rename from examples/USER/misc/charge_regulation/data_acid.chreg rename to examples/USER/misc/charge_regulation/data.chreg-acid diff --git a/examples/USER/misc/charge_regulation/data_polymer.chreg b/examples/USER/misc/charge_regulation/data.chreg-polymer similarity index 100% rename from examples/USER/misc/charge_regulation/data_polymer.chreg rename to examples/USER/misc/charge_regulation/data.chreg-polymer diff --git a/examples/USER/misc/charge_regulation/in_acid.chreg b/examples/USER/misc/charge_regulation/in.chreg-acid similarity index 52% rename from examples/USER/misc/charge_regulation/in_acid.chreg rename to examples/USER/misc/charge_regulation/in.chreg-acid index 73a40f7389..68ef5e1b7c 100644 --- a/examples/USER/misc/charge_regulation/in_acid.chreg +++ b/examples/USER/misc/charge_regulation/in.chreg-acid @@ -1,12 +1,9 @@ # Charge regulation lammps for simple weak electrolyte -units lj -atom_style charge -dimension 3 -boundary p p p -processors * * * -neighbor 3.0 bin -read_data data_acid.chreg +units lj +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid variable cut_long equal 12.5 variable nevery equal 100 @@ -16,26 +13,24 @@ variable pKa equal 6.0 variable pIm equal 3.0 variable pIp equal 3.0 -variable cut_lj equal 2^(1.0/6.0) -variable lunit_nm equal 0.72 # in the units of nm -velocity all create 1.0 8008 loop geom +variable cut_lj equal 2^(1.0/6.0) +variable lunit_nm equal 0.72 # in the units of nm +velocity all create 1.0 8008 loop geom -pair_style lj/cut/coul/long ${cut_lj} ${cut_long} -pair_coeff * * 1.0 1.0 ${cut_lj} # charges -kspace_style ewald 1.0e-3 -dielectric 1.0 -pair_modify shift yes +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_coeff * * 1.0 1.0 +kspace_style ewald 1.0e-3 +pair_modify shift yes ######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### -fix fnve all nve -compute dtemp all temp -compute_modify dtemp dynamic yes -fix fT all langevin 1.0 1.0 1.0 123 +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT -thermo 100 +thermo 100 thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] -log log_acid.lammps -timestep 0.005 -run 20000 +timestep 0.005 +run 2000 diff --git a/examples/USER/misc/charge_regulation/in.chreg-polymer b/examples/USER/misc/charge_regulation/in.chreg-polymer new file mode 100644 index 0000000000..0adab9b5e7 --- /dev/null +++ b/examples/USER/misc/charge_regulation/in.chreg-polymer @@ -0,0 +1,33 @@ +# Charge regulation lammps for a polymer chain +units lj +atom_style full +neighbor 3.0 bin +read_data data.chreg-polymer + +bond_style harmonic +bond_coeff 1 100 1.122462 # K R0 +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long 1.122462 20 +pair_coeff * * 1.0 1.0 1.122462 # charges +kspace_style pppm 1.0e-3 +pair_modify shift yes +dielectric 1.0 + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg1 all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 seed 2345 +fix chareg2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 seed 2345 +fix chareg3 all charge/regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 seed 2345 + +thermo 100 +# print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions +thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + +timestep 0.005 +run 2000 diff --git a/examples/USER/misc/charge_regulation/in_polymer.chreg b/examples/USER/misc/charge_regulation/in_polymer.chreg deleted file mode 100644 index e35ba28661..0000000000 --- a/examples/USER/misc/charge_regulation/in_polymer.chreg +++ /dev/null @@ -1,37 +0,0 @@ -# Charge regulation lammps for a polymer chain -units lj -atom_style full -dimension 3 -boundary p p p -processors * * * -neighbor 3.0 bin -read_data data_polymer.chreg - -bond_style harmonic -bond_coeff 1 100 1.122462 # K R0 -velocity all create 1.0 8008 loop geom - -pair_style lj/cut/coul/long 1.122462 20 -pair_coeff * * 1.0 1.0 1.122462 # charges -kspace_style pppm 1.0e-3 -pair_modify shift yes -dielectric 1.0 - -######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### -fix fnve all nve -compute dtemp all temp -compute_modify dtemp dynamic yes -fix fT all langevin 1.0 1.0 1.0 123 -fix_modify fT temp dtemp - -fix chareg1 all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 seed 2345 -fix chareg2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 seed 2345 -fix chareg3 all charge/regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 seed 2345 - -thermo 100 -# print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions -thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] -log log_polymer.lammps - -timestep 0.005 -run 20000 diff --git a/examples/USER/misc/charge_regulation/log_acid.lammps b/examples/USER/misc/charge_regulation/log_acid.lammps deleted file mode 100644 index cbc3661eb1..0000000000 --- a/examples/USER/misc/charge_regulation/log_acid.lammps +++ /dev/null @@ -1,163 +0,0 @@ -LAMMPS (24 Dec 2020) -Reading data file ... - orthogonal box = (-25.000000 -25.000000 -25.000000) to (25.000000 25.000000 25.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 219 atoms - read_data CPU = 0.001 seconds -Ewald initialization ... - using 12-bit tables for long-range coulomb (../kspace.cpp:339) - G vector (1/distance) = 0.14221027 - estimated absolute RMS force accuracy = 0.0010128126 - estimated relative force accuracy = 0.0010128126 - KSpace vectors: actual max1d max3d = 257 5 665 - kxmax kymax kzmax = 5 5 5 -0 atoms in group Fix_CR:exclusion_group:chareg -WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 15.5 - ghost atom cutoff = 15.5 - binsize = 7.75, bins = 7 7 7 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Setting up Verlet run ... - Unit style : lj - Current step : 0 - Time step : 0.005 -Per MPI rank memory allocation (min/avg/max) = 11.91 | 11.91 | 11.91 Mbytes -Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] - 0 -0.054228269 1 0 0 1 99 0 0 109 10 - 100 -0.058672881 0.99159291 100 71 16 84 0 0 92 8 - 200 -0.05399313 0.92006523 200 154 26 74 0 0 85 11 - 300 -0.047035343 0.92728143 300 240 22 78 0 0 85 7 - 400 -0.049597809 1.0617937 400 319 16 84 0 0 92 8 - 500 -0.052409835 1.0006148 500 404 12 88 0 0 97 9 - 600 -0.056012172 0.98059344 600 481 15 85 0 0 92 7 - 700 -0.053639989 0.99572709 700 561 16 84 0 0 94 10 - 800 -0.060026132 0.95764632 800 639 22 78 0 0 84 6 - 900 -0.050785422 0.98399084 900 719 28 72 0 0 82 10 - 1000 -0.062294743 0.97200068 1000 797 26 74 0 0 82 8 - 1100 -0.051269402 1.0064376 1100 877 25 75 0 0 84 9 - 1200 -0.077744839 1.0159098 1200 955 23 77 0 0 88 11 - 1300 -0.084889696 1.1230485 1300 1037 20 80 0 0 90 10 - 1400 -0.059361445 0.96735845 1400 1120 18 82 0 0 93 11 - 1500 -0.052926174 0.95579188 1500 1199 24 76 0 0 86 10 - 1600 -0.052376649 0.99376378 1600 1284 22 78 0 0 89 11 - 1700 -0.052480188 0.96085964 1700 1361 27 73 0 0 84 11 - 1800 -0.065884306 0.96747971 1800 1441 21 79 0 0 84 5 - 1900 -0.054315859 0.95873145 1900 1521 23 77 0 0 84 7 - 2000 -0.037161802 0.93562039 2000 1604 27 73 0 0 79 6 - 2100 -0.034977265 0.97177103 2100 1684 26 74 0 0 85 11 - 2200 -0.047434868 0.97897613 2200 1762 17 83 0 0 93 10 - 2300 -0.047392634 0.96570672 2300 1837 18 82 0 0 92 10 - 2400 -0.044879306 0.98620033 2400 1910 19 81 0 0 89 8 - 2500 -0.069690496 1.0690505 2500 1988 16 84 0 0 91 7 - 2600 -0.081588407 0.97711054 2600 2067 17 83 0 0 92 9 - 2700 -0.06341681 1.0386711 2700 2146 20 80 0 0 85 5 - 2800 -0.045290012 1.0402055 2800 2230 18 82 0 0 91 9 - 2900 -0.046875012 1.0609775 2900 2317 24 76 0 0 86 10 - 3000 -0.031258722 0.93861202 3000 2400 24 76 0 0 85 9 - 3100 -0.04673342 0.90800583 3100 2485 25 75 0 0 90 15 - 3200 -0.054354227 0.94493881 3200 2567 16 84 0 0 94 10 - 3300 -0.053647746 0.92321446 3300 2641 17 83 0 0 94 11 - 3400 -0.031751732 0.93735127 3400 2725 22 78 0 0 92 14 - 3500 -0.053806113 0.98798136 3500 2795 28 72 0 0 84 12 - 3600 -0.040751349 0.84291639 3600 2873 28 72 0 0 84 12 - 3700 -0.051747138 1.072448 3700 2951 24 76 0 0 92 16 - 3800 -0.043420594 1.0076309 3800 3030 26 74 0 0 79 5 - 3900 -0.050845848 1.0250023 3900 3103 29 71 0 0 76 5 - 4000 -0.039837847 1.064111 4000 3182 29 71 0 0 83 12 - 4100 -0.045638995 1.1249685 4100 3262 28 72 0 0 81 9 - 4200 -0.047956491 0.92255907 4200 3348 26 74 0 0 87 13 - 4300 -0.054052822 1.006239 4300 3423 19 81 0 0 90 9 - 4400 -0.053148034 1.0028887 4400 3506 24 76 0 0 83 7 - 4500 -0.062132076 1.0317847 4500 3587 23 77 0 0 82 5 - 4600 -0.04616043 0.99066453 4600 3673 28 72 0 0 82 10 - 4700 -0.066990889 1.0242064 4700 3755 18 82 0 0 90 8 - 4800 -0.0564736 0.91765628 4800 3832 22 78 0 0 91 13 - 4900 -0.052301294 0.95348659 4900 3912 28 72 0 0 81 9 - 5000 -0.062630677 1.0336579 5000 3989 18 82 0 0 92 10 - 5100 -0.053645908 1.0314613 5100 4062 20 80 0 0 85 5 - 5200 -0.062189568 1.0504732 5200 4133 23 77 0 0 84 7 - 5300 -0.049092746 1.0310832 5300 4217 24 76 0 0 82 6 - 5400 -0.051859257 0.99600428 5400 4299 27 73 0 0 80 7 - 5500 -0.065540815 0.98012128 5500 4381 19 81 0 0 92 11 - 5600 -0.071018582 0.9252814 5600 4455 23 77 0 0 84 7 - 5700 -0.066954185 1.0325214 5700 4535 26 74 0 0 82 8 - 5800 -0.064847249 1.0313536 5800 4617 21 79 0 0 90 11 - 5900 -0.063173056 0.95455853 5900 4703 18 82 0 0 92 10 - 6000 -0.064807837 0.97182222 6000 4790 21 79 0 0 91 12 - 6100 -0.07067683 0.91775921 6100 4875 16 84 0 0 94 10 - 6200 -0.071400842 1.0162225 6200 4952 17 83 0 0 87 4 - 6300 -0.078479449 1.0106706 6300 5033 21 79 0 0 84 5 - 6400 -0.083167651 1.0246584 6400 5111 18 82 0 0 90 8 - 6500 -0.092611537 1.0766467 6500 5195 20 80 0 0 88 8 - 6600 -0.096710071 1.0246648 6600 5274 15 85 0 0 91 6 - 6700 -0.073399857 0.94939392 6700 5351 17 83 0 0 92 9 - 6800 -0.062479375 0.9393967 6800 5434 18 82 0 0 93 11 - 6900 -0.065391043 0.93475954 6900 5514 22 78 0 0 89 11 - 7000 -0.045655499 0.98688239 7000 5601 21 79 0 0 90 11 - 7100 -0.061186309 1.0309063 7100 5684 22 78 0 0 87 9 - 7200 -0.074737514 1.0516593 7200 5769 25 75 0 0 80 5 - 7300 -0.075228979 1.0167704 7300 5847 21 79 0 0 86 7 - 7400 -0.06660147 1.0947107 7400 5930 25 75 0 0 87 12 - 7500 -0.071915247 1.10542 7500 6009 24 76 0 0 84 8 - 7600 -0.029974303 0.99202697 7600 6095 28 72 0 0 80 8 - 7700 -0.029024004 1.0390995 7700 6182 28 72 0 0 83 11 - 7800 -0.056250746 0.96393961 7800 6260 18 82 0 0 91 9 - 7900 -0.072178944 0.9833919 7900 6339 21 79 0 0 86 7 - 8000 -0.070377248 1.021342 8000 6419 23 77 0 0 88 11 - 8100 -0.07753283 0.96194312 8100 6493 26 74 0 0 86 12 - 8200 -0.075617309 0.9715344 8200 6576 25 75 0 0 89 14 - 8300 -0.077480013 0.99106705 8300 6662 20 80 0 0 91 11 - 8400 -0.079901928 0.89855112 8400 6744 23 77 0 0 91 14 - 8500 -0.069192745 1.0606791 8500 6822 19 81 0 0 91 10 - 8600 -0.058657202 1.1270217 8600 6898 15 85 0 0 95 10 - 8700 -0.044985397 1.0367419 8700 6979 27 73 0 0 84 11 - 8800 -0.064266376 0.91557003 8800 7060 21 79 0 0 89 10 - 8900 -0.068680533 0.95963643 8900 7133 19 81 0 0 88 7 - 9000 -0.051736144 1.0398547 9000 7213 13 87 0 0 94 7 - 9100 -0.058381436 0.98047663 9100 7290 17 83 0 0 89 6 - 9200 -0.05531014 0.92541631 9200 7368 22 78 0 0 85 7 - 9300 -0.04386907 0.9339658 9300 7454 22 78 0 0 89 11 - 9400 -0.052293168 0.94314034 9400 7539 22 78 0 0 86 8 - 9500 -0.050362046 1.0489028 9500 7617 18 82 0 0 90 8 - 9600 -0.054272227 1.0879161 9600 7697 11 89 0 0 96 7 - 9700 -0.042514179 1.0051505 9700 7771 22 78 0 0 84 6 - 9800 -0.045365018 0.95363669 9800 7850 25 75 0 0 77 2 - 9900 -0.064287274 0.91994667 9900 7928 27 73 0 0 81 8 - 10000 -0.05689162 0.99963208 10000 8011 22 78 0 0 84 6 -Loop time of 19.4452 on 1 procs for 10000 steps with 190 atoms - -Performance: 222162.510 tau/day, 514.265 timesteps/s -99.9% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.68864 | 0.68864 | 0.68864 | 0.0 | 3.54 -Kspace | 6.7893 | 6.7893 | 6.7893 | 0.0 | 34.92 -Neigh | 0.060782 | 0.060782 | 0.060782 | 0.0 | 0.31 -Comm | 0.047035 | 0.047035 | 0.047035 | 0.0 | 0.24 -Output | 0.0027227 | 0.0027227 | 0.0027227 | 0.0 | 0.01 -Modify | 11.838 | 11.838 | 11.838 | 0.0 | 60.88 -Other | | 0.01878 | | | 0.10 - -Nlocal: 190.000 ave 190 max 190 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 592.000 ave 592 max 592 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 2194.00 ave 2194 max 2194 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 2194 -Ave neighs/atom = 11.547368 -Neighbor list builds = 10287 -Dangerous builds = 0 -Total wall time: 0:00:19 \ No newline at end of file From 7f8e8c635c10f0c99343c0f31565b91ac2de951b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 08:00:59 -0500 Subject: [PATCH 017/370] create new reference log files --- .../log.10Feb21.chreg-acid.g++.1 | 125 ++++++++++++ .../log.10Feb21.chreg-acid.g++.4 | 125 ++++++++++++ .../log.10Feb21.chreg-polymer.g++.1 | 131 +++++++++++++ .../log.10Feb21.chreg-polymer.g++.4 | 131 +++++++++++++ .../misc/charge_regulation/log_polymer.lammps | 181 ------------------ 5 files changed, 512 insertions(+), 181 deletions(-) create mode 100644 examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.1 create mode 100644 examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.4 create mode 100644 examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.1 create mode 100644 examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.4 delete mode 100644 examples/USER/misc/charge_regulation/log_polymer.lammps diff --git a/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.1 b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.1 new file mode 100644 index 0000000000..627281217b --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.1 @@ -0,0 +1,125 @@ +LAMMPS (10 Feb 2021) + using 1 OpenMP thread(s) per MPI task +# Charge regulation lammps for simple weak electrolyte + +units lj +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid +Reading data file ... + orthogonal box = (-25.000000 -25.000000 -25.000000) to (25.000000 25.000000 25.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 219 atoms + read_data CPU = 0.003 seconds + +variable cut_long equal 12.5 +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0) +variable lunit_nm equal 0.72 # in the units of nm +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_style lj/cut/coul/long 1.12246204830937 ${cut_long} +pair_style lj/cut/coul/long 1.12246204830937 12.5 +pair_coeff * * 1.0 1.0 +kspace_style ewald 1.0e-3 +pair_modify shift yes + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery 100 nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery 100 nmc 100 seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep 0.005 +run 2000 +Ewald initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.14221027 + estimated absolute RMS force accuracy = 0.0010128126 + estimated relative force accuracy = 0.0010128126 + KSpace vectors: actual max1d max3d = 257 5 665 + kxmax kymax kzmax = 5 5 5 +0 atoms in group FixChargeRegulation:exclusion_group:chareg +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 15.5 + ghost atom cutoff = 15.5 + binsize = 7.75, bins = 7 7 7 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.91 | 11.91 | 11.91 Mbytes +Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] + 0 -0.049662059 1 0 0 1 99 0 0 109 10 + 100 -0.053672881 0.99159291 100 71 16 84 0 0 92 8 + 200 -0.053383027 0.90935145 200 156 26 74 0 0 85 11 + 300 -0.040471335 0.97937429 300 240 21 79 0 0 87 8 + 400 -0.036188123 1.0837424 400 319 14 86 0 0 92 6 + 500 -0.057294925 1.0507526 500 407 10 90 0 0 98 8 + 600 -0.056009748 1.0669354 600 487 15 85 0 0 92 7 + 700 -0.069686562 0.99202496 700 567 14 86 0 0 96 10 + 800 -0.054695624 1.0592933 800 647 25 75 0 0 82 7 + 900 -0.058693653 0.97870458 900 728 27 73 0 0 83 10 + 1000 -0.062352957 1.0008923 1000 805 24 76 0 0 84 8 + 1100 -0.065011926 0.91691048 1100 886 22 78 0 0 87 9 + 1200 -0.080463686 0.98879304 1200 963 23 77 0 0 88 11 + 1300 -0.062146141 1.0566033 1300 1047 21 79 0 0 88 9 + 1400 -0.046980246 1.0847512 1400 1129 17 83 0 0 94 11 + 1500 -0.042935292 1.0075805 1500 1203 24 76 0 0 86 10 + 1600 -0.056075891 0.94173489 1600 1277 23 77 0 0 90 13 + 1700 -0.042279161 1.1126317 1700 1355 28 72 0 0 82 10 + 1800 -0.036842528 1.0255327 1800 1436 24 76 0 0 83 7 + 1900 -0.038816022 0.93883373 1900 1511 23 77 0 0 86 9 + 2000 -0.047008287 0.98904085 2000 1592 26 74 0 0 81 7 +Loop time of 11.6365 on 1 procs for 2000 steps with 188 atoms + +Performance: 74249.079 tau/day, 171.873 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.24337 | 0.24337 | 0.24337 | 0.0 | 2.09 +Kspace | 4.6009 | 4.6009 | 4.6009 | 0.0 | 39.54 +Neigh | 0.023451 | 0.023451 | 0.023451 | 0.0 | 0.20 +Comm | 0.027729 | 0.027729 | 0.027729 | 0.0 | 0.24 +Output | 0.0007813 | 0.0007813 | 0.0007813 | 0.0 | 0.01 +Modify | 6.7345 | 6.7345 | 6.7345 | 0.0 | 57.87 +Other | | 0.005713 | | | 0.05 + +Nlocal: 188.000 ave 188 max 188 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 597.000 ave 597 max 597 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 2196.00 ave 2196 max 2196 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 2196 +Ave neighs/atom = 11.680851 +Neighbor list builds = 2059 +Dangerous builds = 0 +Total wall time: 0:00:11 diff --git a/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.4 b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.4 new file mode 100644 index 0000000000..465dcbdb4e --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-acid.g++.4 @@ -0,0 +1,125 @@ +LAMMPS (10 Feb 2021) + using 1 OpenMP thread(s) per MPI task +# Charge regulation lammps for simple weak electrolyte + +units lj +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid +Reading data file ... + orthogonal box = (-25.000000 -25.000000 -25.000000) to (25.000000 25.000000 25.000000) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 219 atoms + read_data CPU = 0.003 seconds + +variable cut_long equal 12.5 +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0) +variable lunit_nm equal 0.72 # in the units of nm +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_style lj/cut/coul/long 1.12246204830937 ${cut_long} +pair_style lj/cut/coul/long 1.12246204830937 12.5 +pair_coeff * * 1.0 1.0 +kspace_style ewald 1.0e-3 +pair_modify shift yes + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp ${pIp} pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm ${pIm} lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm ${lunit_nm} nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery 100 nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.72 nevery 100 nmc 100 seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep 0.005 +run 2000 +Ewald initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.14221027 + estimated absolute RMS force accuracy = 0.0010128126 + estimated relative force accuracy = 0.0010128126 + KSpace vectors: actual max1d max3d = 257 5 665 + kxmax kymax kzmax = 5 5 5 +0 atoms in group FixChargeRegulation:exclusion_group:chareg +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 15.5 + ghost atom cutoff = 15.5 + binsize = 7.75, bins = 7 7 7 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 11.89 | 11.89 | 11.89 Mbytes +Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] + 0 -0.049662059 1 0 0 1 99 0 0 109 10 + 100 -0.06196414 1.0156327 100 72 15 85 0 0 93 8 + 200 -0.053901683 0.95128403 200 160 24 76 0 0 87 11 + 300 -0.043852423 0.98035058 300 246 22 78 0 0 85 7 + 400 -0.048370798 1.0909844 400 324 16 84 0 0 91 7 + 500 -0.042546472 1.026849 500 410 13 87 0 0 95 8 + 600 -0.06133022 0.97805065 600 494 14 86 0 0 93 7 + 700 -0.053815853 1.0641005 700 572 17 83 0 0 91 8 + 800 -0.059974814 1.0192348 800 650 23 77 0 0 83 6 + 900 -0.051808132 1.0773288 900 728 25 75 0 0 85 10 + 1000 -0.050390995 1.0236954 1000 804 28 72 0 0 81 9 + 1100 -0.069766444 1.030965 1100 890 25 75 0 0 85 10 + 1200 -0.074580231 1.0490058 1200 963 21 79 0 0 88 9 + 1300 -0.060169443 0.93456607 1300 1043 22 78 0 0 86 8 + 1400 -0.05120764 1.0374062 1400 1127 19 81 0 0 92 11 + 1500 -0.027644416 0.99804782 1500 1204 24 76 0 0 85 9 + 1600 -0.038599195 0.99015524 1600 1283 22 78 0 0 90 12 + 1700 -0.050222686 1.1444379 1700 1365 27 73 0 0 84 11 + 1800 -0.049338003 1.1188048 1800 1449 22 78 0 0 84 6 + 1900 -0.04533154 0.99894341 1900 1527 22 78 0 0 86 8 + 2000 -0.058837311 0.95302017 2000 1608 26 74 0 0 81 7 +Loop time of 3.98119 on 4 procs for 2000 steps with 188 atoms + +Performance: 217020.495 tau/day, 502.362 timesteps/s +96.2% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.050626 | 0.061127 | 0.071318 | 3.4 | 1.54 +Kspace | 1.1987 | 1.2504 | 1.288 | 3.1 | 31.41 +Neigh | 0.0056982 | 0.0063858 | 0.0069821 | 0.7 | 0.16 +Comm | 0.068302 | 0.11638 | 0.17922 | 12.8 | 2.92 +Output | 0.00055408 | 0.00092399 | 0.0020106 | 0.0 | 0.02 +Modify | 2.5399 | 2.5406 | 2.5417 | 0.0 | 63.81 +Other | | 0.005394 | | | 0.14 + +Nlocal: 47.0000 ave 55 max 42 min +Histogram: 1 0 1 1 0 0 0 0 0 1 +Nghost: 328.250 ave 335 max 317 min +Histogram: 1 0 0 0 0 1 0 0 0 2 +Neighs: 547.000 ave 659 max 466 min +Histogram: 2 0 0 0 0 0 1 0 0 1 + +Total # of neighbors = 2188 +Ave neighs/atom = 11.638298 +Neighbor list builds = 2057 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.1 b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.1 new file mode 100644 index 0000000000..c386b2bed9 --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.1 @@ -0,0 +1,131 @@ +LAMMPS (10 Feb 2021) + using 1 OpenMP thread(s) per MPI task +# Charge regulation lammps for a polymer chain +units lj +atom_style full +neighbor 3.0 bin +read_data data.chreg-polymer +Reading data file ... + orthogonal box = (-50.000000 -50.000000 -50.000000) to (50.000000 50.000000 50.000000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 160 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 79 bonds +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 2 = max # of 1-3 neighbors + 4 = max # of 1-4 neighbors + 6 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.009 seconds + +bond_style harmonic +bond_coeff 1 100 1.122462 # K R0 +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long 1.122462 20 +pair_coeff * * 1.0 1.0 1.122462 # charges +kspace_style pppm 1.0e-3 +pair_modify shift yes +dielectric 1.0 + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg1 all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 seed 2345 +fix chareg2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 seed 2345 +fix chareg3 all charge/regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 seed 2345 + +thermo 100 +# print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions +thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + +timestep 0.005 +run 2000 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.077106934 + grid = 8 8 8 + stencil order = 5 + estimated absolute RMS force accuracy = 0.00074388331 + estimated relative force accuracy = 0.00074388331 + using double precision FFTW3 + 3d grid and FFT values/proc = 2197 512 +0 atoms in group FixChargeRegulation:exclusion_group:chareg1 +0 atoms in group FixChargeRegulation:exclusion_group:chareg2 +0 atoms in group FixChargeRegulation:exclusion_group:chareg3 +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 23 + ghost atom cutoff = 23 + binsize = 11.5, bins = 9 9 9 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.962 | 6.962 | 6.962 Mbytes +Step PotEng c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + 0 0.50528297 1 0 80 80 0 0 0 + 100 0.61185377 0.95892928 13 67 74 7 0 0 + 200 0.54355177 1.1282424 19 61 76 15 0 0 + 300 0.4519957 1.0764688 20 60 85 26 1 0 + 400 0.41479389 0.99212685 24 56 92 36 0 0 + 500 0.37382446 0.99776674 28 52 98 46 0 0 + 600 0.34785337 1.1115081 28 52 109 57 0 0 + 700 0.34637618 1.0332262 28 52 120 68 0 0 + 800 0.21020932 1.1264036 29 51 125 74 0 0 + 900 0.21246108 1.1168609 30 50 131 81 0 0 + 1000 0.20997475 1.1201478 32 48 132 84 0 0 + 1100 0.1984165 1.0209092 31 49 144 95 0 0 + 1200 0.2061932 0.95880059 35 45 151 106 0 0 + 1300 0.17220376 0.980077 36 44 156 112 0 0 + 1400 0.15671143 0.93535342 37 43 161 118 0 0 + 1500 0.16174665 0.9495928 36 44 168 124 0 0 + 1600 0.11062965 0.94072924 40 40 164 124 0 0 + 1700 0.13002563 0.95010828 38 42 167 125 0 0 + 1800 0.14527814 0.93555342 37 43 172 129 0 0 + 1900 0.17627465 0.96682495 32 48 176 128 0 0 + 2000 0.16497265 0.95226954 33 47 180 133 0 0 +Loop time of 7.45499 on 1 procs for 2000 steps with 393 atoms + +Performance: 115895.577 tau/day, 268.277 timesteps/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.45607 | 0.45607 | 0.45607 | 0.0 | 6.12 +Bond | 0.0062385 | 0.0062385 | 0.0062385 | 0.0 | 0.08 +Kspace | 2.3257 | 2.3257 | 2.3257 | 0.0 | 31.20 +Neigh | 0.067103 | 0.067103 | 0.067103 | 0.0 | 0.90 +Comm | 0.02577 | 0.02577 | 0.02577 | 0.0 | 0.35 +Output | 0.00087047 | 0.00087047 | 0.00087047 | 0.0 | 0.01 +Modify | 4.5664 | 4.5664 | 4.5664 | 0.0 | 61.25 +Other | | 0.006848 | | | 0.09 + +Nlocal: 393.000 ave 393 max 393 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 749.000 ave 749 max 749 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 5359.00 ave 5359 max 5359 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 5359 +Ave neighs/atom = 13.636132 +Ave special neighs/atom = 1.1908397 +Neighbor list builds = 1489 +Dangerous builds = 0 +Total wall time: 0:00:07 diff --git a/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.4 b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.4 new file mode 100644 index 0000000000..c623d3048b --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.10Feb21.chreg-polymer.g++.4 @@ -0,0 +1,131 @@ +LAMMPS (10 Feb 2021) + using 1 OpenMP thread(s) per MPI task +# Charge regulation lammps for a polymer chain +units lj +atom_style full +neighbor 3.0 bin +read_data data.chreg-polymer +Reading data file ... + orthogonal box = (-50.000000 -50.000000 -50.000000) to (50.000000 50.000000 50.000000) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 160 atoms + scanning bonds ... + 1 = max bonds/atom + reading bonds ... + 79 bonds +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 2 = max # of 1-3 neighbors + 4 = max # of 1-4 neighbors + 6 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.016 seconds + +bond_style harmonic +bond_coeff 1 100 1.122462 # K R0 +velocity all create 1.0 8008 loop geom + +pair_style lj/cut/coul/long 1.122462 20 +pair_coeff * * 1.0 1.0 1.122462 # charges +kspace_style pppm 1.0e-3 +pair_modify shift yes +dielectric 1.0 + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin 1.0 1.0 1.0 123 +fix_modify fT temp dtemp + +fix chareg1 all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 6.5 pIp 3.0 pIm 3.0 temp 1.0 nmc 40 seed 2345 +fix chareg2 all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 6.5 pIp 7.0 pIm 7.0 temp 1.0 nmc 40 seed 2345 +fix chareg3 all charge/regulation 4 3 pIp 7.0 pIm 3.0 temp 1.0 nmc 20 seed 2345 + +thermo 100 +# print: step, potential energy, temperature, neutral acids, charged acids, salt cations, salt anions, H+ ions, OH- ions +thermo_style custom step pe c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + +timestep 0.005 +run 2000 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.077106934 + grid = 8 8 8 + stencil order = 5 + estimated absolute RMS force accuracy = 0.00074388331 + estimated relative force accuracy = 0.00074388331 + using double precision FFTW3 + 3d grid and FFT values/proc = 1053 128 +0 atoms in group FixChargeRegulation:exclusion_group:chareg1 +0 atoms in group FixChargeRegulation:exclusion_group:chareg2 +0 atoms in group FixChargeRegulation:exclusion_group:chareg3 +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 23 + ghost atom cutoff = 23 + binsize = 11.5, bins = 9 9 9 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.878 | 6.935 | 6.992 Mbytes +Step PotEng c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] + 0 0.50528297 1 0 80 80 0 0 0 + 100 0.60223729 0.89547569 13 67 75 8 0 0 + 200 0.65253636 0.87662399 18 62 78 16 0 0 + 300 0.51550501 1.0542131 22 58 84 27 1 0 + 400 0.43566766 0.94557633 26 54 90 36 0 0 + 500 0.36269507 1.0386276 31 49 94 45 0 0 + 600 0.32430641 0.99903033 27 53 111 58 0 0 + 700 0.30255299 0.91225991 28 52 121 69 0 0 + 800 0.27189951 0.9747089 28 52 127 75 0 0 + 900 0.25495247 1.0747821 28 52 135 83 0 0 + 1000 0.25950416 0.95256449 32 48 134 86 0 0 + 1100 0.22561248 1.0102255 32 48 147 99 0 0 + 1200 0.1734754 0.99475154 33 47 157 110 0 0 + 1300 0.20081084 0.99873599 36 44 160 116 0 0 + 1400 0.14240417 0.99442152 36 44 164 121 1 0 + 1500 0.15314186 0.94559876 39 41 167 126 0 0 + 1600 0.13574107 1.0484195 43 37 164 127 0 0 + 1700 0.14477789 1.0105172 42 38 166 128 0 0 + 1800 0.13493107 1.0349667 41 39 171 132 0 0 + 1900 0.14849779 0.9994329 33 47 178 131 0 0 + 2000 0.14485171 0.99739608 34 46 183 137 0 0 +Loop time of 3.18871 on 4 procs for 2000 steps with 400 atoms + +Performance: 270955.695 tau/day, 627.212 timesteps/s +94.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.086456 | 0.11738 | 0.18562 | 11.8 | 3.68 +Bond | 0.00099182 | 0.0018544 | 0.0030079 | 1.8 | 0.06 +Kspace | 0.77406 | 0.79354 | 0.80895 | 1.5 | 24.89 +Neigh | 0.017894 | 0.017948 | 0.018002 | 0.0 | 0.56 +Comm | 0.029044 | 0.07885 | 0.11432 | 11.3 | 2.47 +Output | 0.00054932 | 0.0009656 | 0.0021319 | 0.0 | 0.03 +Modify | 2.1676 | 2.1706 | 2.1733 | 0.2 | 68.07 +Other | | 0.007591 | | | 0.24 + +Nlocal: 100.000 ave 110 max 89 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Nghost: 415.000 ave 418 max 411 min +Histogram: 1 0 1 0 0 0 0 0 0 2 +Neighs: 1360.75 ave 1872 max 1018 min +Histogram: 1 1 0 0 1 0 0 0 0 1 + +Total # of neighbors = 5443 +Ave neighs/atom = 13.607500 +Ave special neighs/atom = 1.1700000 +Neighbor list builds = 1492 +Dangerous builds = 0 +Total wall time: 0:00:03 diff --git a/examples/USER/misc/charge_regulation/log_polymer.lammps b/examples/USER/misc/charge_regulation/log_polymer.lammps deleted file mode 100644 index 87cab63a6c..0000000000 --- a/examples/USER/misc/charge_regulation/log_polymer.lammps +++ /dev/null @@ -1,181 +0,0 @@ -LAMMPS (24 Dec 2020) -Reading data file ... - orthogonal box = (-50.000000 -50.000000 -50.000000) to (50.000000 50.000000 50.000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 160 atoms - scanning bonds ... - 1 = max bonds/atom - reading bonds ... - 79 bonds -Finding 1-2 1-3 1-4 neighbors ... - special bond factors lj: 0 0 0 - special bond factors coul: 0 0 0 - 2 = max # of 1-2 neighbors - 2 = max # of 1-3 neighbors - 4 = max # of 1-4 neighbors - 6 = max # of special neighbors - special bonds CPU = 0.000 seconds - read_data CPU = 0.004 seconds -PPPM initialization ... - using 12-bit tables for long-range coulomb (../kspace.cpp:339) - G vector (1/distance) = 0.077106934 - grid = 8 8 8 - stencil order = 5 - estimated absolute RMS force accuracy = 0.00074388331 - estimated relative force accuracy = 0.00074388331 - using double precision KISS FFT - 3d grid and FFT values/proc = 2197 512 -0 atoms in group Fix_CR:exclusion_group:chareg1 -0 atoms in group Fix_CR:exclusion_group:chareg2 -0 atoms in group Fix_CR:exclusion_group:chareg3 -WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 23 - ghost atom cutoff = 23 - binsize = 11.5, bins = 9 9 9 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Setting up Verlet run ... - Unit style : lj - Current step : 0 - Time step : 0.005 -Per MPI rank memory allocation (min/avg/max) = 6.962 | 6.962 | 6.962 Mbytes -Step PotEng c_dtemp f_chareg1[3] f_chareg1[4] f_chareg1[7] f_chareg1[8] f_chareg2[7] f_chareg2[8] - 0 0.49903297 1 0 80 80 0 0 0 - 100 0.63380666 0.87307225 8 72 77 6 1 0 - 200 0.5865464 1.0048645 16 64 81 16 0 1 - 300 0.55802913 1.0499142 19 61 91 29 0 1 - 400 0.44734087 1.0838048 24 56 98 41 0 1 - 500 0.47010775 1.005226 23 57 106 48 0 1 - 600 0.3452105 0.97814306 28 52 109 56 0 1 - 700 0.29208955 0.99766419 32 48 115 67 0 0 - 800 0.27821915 1.0091641 31 49 128 80 1 0 - 900 0.28943788 0.93619239 26 54 145 91 0 0 - 1000 0.22963142 1.0162138 27 53 150 97 0 0 - 1100 0.24238916 0.99146577 31 49 149 100 0 0 - 1200 0.17029095 1.0406453 38 42 144 102 0 0 - 1300 0.15830969 0.94661447 34 46 155 109 0 0 - 1400 0.16698712 1.0116563 35 45 159 114 0 0 - 1500 0.15432936 0.95600941 36 44 162 118 0 0 - 1600 0.16973501 0.98326602 31 49 171 122 0 0 - 1700 0.19725116 0.9915273 33 47 175 128 0 0 - 1800 0.15278999 1.0304873 29 51 193 142 0 0 - 1900 0.17418479 0.99490216 30 50 194 144 0 0 - 2000 0.14238391 0.9638301 32 48 189 141 0 0 - 2100 0.13054378 0.97164976 32 48 192 144 0 0 - 2200 0.092083069 1.0112059 40 40 191 151 0 0 - 2300 0.085175091 1.0070667 39 41 200 159 0 0 - 2400 0.083367076 0.9934796 35 45 208 163 0 0 - 2500 0.11494744 0.97650855 31 49 220 172 1 0 - 2600 0.10796032 0.97047046 34 46 221 175 0 0 - 2700 0.11080141 0.93570013 36 44 223 179 0 0 - 2800 0.096699277 0.97702627 35 45 223 178 0 0 - 2900 0.079403783 1.0870961 32 48 229 181 0 0 - 3000 0.08288836 1.0642515 35 45 231 186 0 0 - 3100 0.094000833 1.0241111 38 42 229 187 0 0 - 3200 0.10011052 1.043594 34 46 235 189 0 0 - 3300 0.096782103 0.99549134 34 46 234 188 0 0 - 3400 0.057703946 1.00292 34 46 236 190 0 0 - 3500 0.074345642 0.95064523 36 44 234 190 0 0 - 3600 0.085872341 0.9759514 35 45 238 192 0 1 - 3700 0.086427565 0.99843063 35 45 240 194 0 1 - 3800 0.076091357 0.98516844 32 48 252 203 0 1 - 3900 0.047187813 1.0063336 37 43 247 204 0 0 - 4000 0.068269223 1.0390369 35 45 248 203 0 0 - 4100 0.074209582 0.99912762 36 44 249 205 0 0 - 4200 0.087016078 1.050265 36 44 246 202 0 0 - 4300 0.081325479 1.0417103 35 45 245 200 0 0 - 4400 0.047345973 0.96517298 39 41 243 202 0 0 - 4500 0.041856955 0.94569673 38 42 245 203 0 0 - 4600 0.049588267 0.99046371 42 38 249 211 0 0 - 4700 0.043079897 1.0098538 43 37 245 208 0 0 - 4800 0.049122913 1.0229995 41 39 247 208 0 0 - 4900 0.059151797 1.0236679 36 44 249 205 0 0 - 5000 0.053806841 1.0308397 42 38 243 205 0 0 - 5100 0.053623833 1.0638841 39 41 246 205 0 0 - 5200 0.086215806 1.0027613 37 43 243 200 0 0 - 5300 0.031422797 1.0338154 38 42 245 203 0 0 - 5400 0.051341116 0.92205149 34 46 246 200 0 0 - 5500 0.039292708 0.97530704 32 48 251 203 0 0 - 5600 0.035215415 1.023123 33 47 246 199 0 0 - 5700 0.054553598 0.95833063 30 50 253 203 0 0 - 5800 0.035699456 1.0721613 37 43 248 205 0 0 - 5900 0.062426908 1.0612245 38 42 252 210 0 0 - 6000 0.056362902 1.0002968 36 44 248 204 0 0 - 6100 0.061550208 0.97270904 38 42 245 203 0 0 - 6200 0.051825485 0.98187623 36 44 253 209 0 0 - 6300 0.052137885 0.98906723 36 44 253 210 1 0 - 6400 0.068218075 1.0511584 36 44 256 212 0 0 - 6500 0.080167413 0.97270144 36 44 252 208 0 0 - 6600 0.052169204 1.0160108 41 39 249 210 0 0 - 6700 0.057313326 0.98033894 38 42 251 209 0 0 - 6800 0.073008094 0.96239565 35 45 256 211 0 0 - 6900 0.060159599 1.0063892 37 43 264 221 0 0 - 7000 0.061738744 1.0031443 39 41 259 218 0 0 - 7100 0.043263424 1.0425248 44 36 255 219 0 0 - 7200 0.052179167 0.99512151 39 41 261 220 0 0 - 7300 0.053258707 1.0171204 43 37 256 219 0 0 - 7400 0.026037532 0.93786837 45 35 259 224 0 0 - 7500 0.029731213 1.0172281 46 34 250 216 0 0 - 7600 0.023118288 0.95628439 42 38 262 224 0 0 - 7700 0.037021854 0.99991854 42 38 263 225 0 0 - 7800 0.050404736 1.0130826 40 40 260 220 0 0 - 7900 0.035658921 0.95772506 40 40 259 219 0 0 - 8000 0.034426806 1.0028052 40 40 254 214 0 0 - 8100 0.041427611 1.0347682 40 40 256 216 0 0 - 8200 0.05986843 0.9804614 38 42 262 220 0 0 - 8300 0.041419023 1.0613186 37 43 264 221 0 0 - 8400 0.065701758 1.0511531 40 40 256 216 0 0 - 8500 0.091954526 0.97190676 37 43 257 214 0 0 - 8600 0.056982532 1.017813 35 45 252 207 0 0 - 8700 0.075615111 1.0148527 29 51 263 212 0 0 - 8800 0.066070082 1.0259454 33 47 260 213 0 0 - 8900 0.055054194 1.0183535 37 43 247 204 0 0 - 9000 0.063070816 1.0266115 39 41 244 203 0 0 - 9100 0.10174156 0.99457684 34 46 246 200 0 0 - 9200 0.071667261 1.033159 33 47 249 202 0 0 - 9300 0.05520096 0.99821492 38 42 243 201 0 0 - 9400 0.050355422 0.99148522 37 43 243 200 0 0 - 9500 0.062314961 1.0042937 36 44 252 208 0 0 - 9600 0.061148899 1.0052132 37 43 254 211 0 0 - 9700 0.078695273 1.0175164 37 43 252 209 0 0 - 9800 0.067487202 1.0110138 35 45 258 213 0 0 - 9900 0.070340779 0.99640142 31 49 263 214 0 0 - 10000 0.037252172 0.99863894 32 48 259 211 0 0 -Loop time of 23.0419 on 1 procs for 10000 steps with 550 atoms - -Performance: 187484.206 tau/day, 433.991 timesteps/s -100.0% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.5444 | 2.5444 | 2.5444 | 0.0 | 11.04 -Bond | 0.025075 | 0.025075 | 0.025075 | 0.0 | 0.11 -Kspace | 4.7385 | 4.7385 | 4.7385 | 0.0 | 20.56 -Neigh | 0.2058 | 0.2058 | 0.2058 | 0.0 | 0.89 -Comm | 0.073087 | 0.073087 | 0.073087 | 0.0 | 0.32 -Output | 0.003464 | 0.003464 | 0.003464 | 0.0 | 0.02 -Modify | 15.417 | 15.417 | 15.417 | 0.0 | 66.91 -Other | | 0.03479 | | | 0.15 - -Nlocal: 550.000 ave 550 max 550 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1023.00 ave 1023 max 1023 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 9644.00 ave 9644 max 9644 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 9644 -Ave neighs/atom = 17.534545 -Ave special neighs/atom = 0.85090909 -Neighbor list builds = 7576 -Dangerous builds = 0 -Total wall time: 0:00:23 \ No newline at end of file From f705d49d4557014e6af45a45fff89606799ac61e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Feb 2021 09:17:14 -0500 Subject: [PATCH 018/370] reformat docs, correct spelling errors, and update false positives list --- doc/src/fix_charge_regulation.rst | 202 ++++++++++++++------ doc/utils/sphinx-config/false_positives.txt | 28 ++- 2 files changed, 172 insertions(+), 58 deletions(-) diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index cb9f55c7cd..fb63c8d7a5 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -8,21 +8,21 @@ Syntax """""" .. parsed-literal:: - + fix ID group-ID charge/regulation cation_type anion_type keyword value(s) * ID, group-ID are documented in fix command * charge/regulation = style name of this fix command * cation_type = atom type of free cations * anion_type = atom type of free anions - + * zero or more keyword/value pairs may be appended .. parsed-literal:: - - keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *xrd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves* + + keyword = *pH*, *pKa*, *pKb*, *pIp*, *pIm*, *pKs*, *acid_type*, *base_type*, *lunit_nm*, *temp*, *tempfixid*, *nevery*, *nmc*, *xrd*, *seed*, *tag*, *group*, *onlysalt*, *pmcmoves* *pH* value = pH of the solution - *pKa* value = acid dissociation constant + *pKa* value = acid dissociation constant *pKb* value = base dissociation constant *pIp* value = chemical potential of free cations *pIm* value = chemical potential of free anions @@ -30,7 +30,7 @@ Syntax *acid_type* = atom type of acid groups *base_type* = atom type of base groups *lunit_nm* value = unit length used by LAMMPS (# in the units of nanometers) - *temp* value = temperature + *temp* value = temperature *tempfixid* value = fix ID of temperature thermostat *nevery* value = invoke this fix every nevery steps *nmc* value = number of charge regulation MC moves to attempt every nevery steps @@ -38,124 +38,212 @@ Syntax *seed* value = random # seed (positive integer) *tag* value = yes or no (yes: The code assign unique tags to inserted ions; no: The tag of all inserted ions is "0") *group* value = group-ID, inserted ions are assigned to group group-ID. Can be used multiple times to assign inserted ions to multiple groups. - *onlysalt* values = flag charge_cation charge_anion. + *onlysalt* values = flag charge_cation charge_anion. flag = yes or no (yes: the fix performs only ion insertion/deletion, no: perform acid/base dissociation and ion insertion/deletion) charge_cation, charge_anion = value of cation/anion charge, must be an integer (only specify if flag = yes) - *pmcmoves* values = pmcA pmcB pmcI - MC move fractions for acid ionization (pmcA), base ionization (pmcB) and free ion exchange (pmcI) + *pmcmoves* values = pmcA pmcB pmcI - MC move fractions for acid ionization (pmcA), base ionization (pmcB) and free ion exchange (pmcI) Examples """""""" .. code-block:: LAMMPS - fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT + fix chareg all charge/regulation 1 2 acid_type 3 base_type 4 pKa 5 pKb 7 lb 1.0 nevery 200 nexchange 200 seed 123 tempfixid fT fix chareg all charge/regulation 1 2 pIp 3 pIm 3 onlysalt yes 2 -1 seed 123 tag yes temp 1.0 Description """"""""""" -This fix performs Monte Carlo (MC) sampling of charge regulation and exchange of ions with a reservoir as discussed in :ref:`(Curk1) ` and :ref:`(Curk2) `. -The implemented method is largely analogous to the grand-reaction ensemble method in :ref:`(Landsgesell) `. -The implementation is parallelized, compatible with existing LAMMPS functionalities, and applicable to any system utilizing discreet, ionizable groups or surface sites. +This fix performs Monte Carlo (MC) sampling of charge regulation and +exchange of ions with a reservoir as discussed in :ref:`(Curk1) ` +and :ref:`(Curk2) `. The implemented method is largely analogous +to the grand-reaction ensemble method in :ref:`(Landsgesell) +`. The implementation is parallelized, compatible with +existing LAMMPS functionalities, and applicable to any system utilizing +discrete, ionizable groups or surface sites. -Specifically, the fix implements the following three types of MC moves, which discretely change the charge state of individual particles and insert ions into the systems: :math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{X}^+`, :math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{X}^-`, -and :math:`\emptyset \rightleftharpoons Z^-\mathrm{X}^{Z^+}+Z^+\mathrm{X}^{-Z^-}`. -In the former two types of reactions, Monte Carlo moves alter the charge value of specific atoms (:math:`\mathrm{A}`, :math:`\mathrm{B}`) and simultaneously insert a counterion to preserve the charge neutrality of the system, modeling the dissociation/association process. -The last type of reaction performs grand canonical MC exchange of ion pairs with a (fictitious) reservoir. +Specifically, the fix implements the following three types of MC moves, +which discretely change the charge state of individual particles and +insert ions into the systems: :math:`\mathrm{A} \rightleftharpoons +\mathrm{A}^-+\mathrm{X}^+`, :math:`\mathrm{B} \rightleftharpoons +\mathrm{B}^++\mathrm{X}^-`, and :math:`\emptyset \rightleftharpoons +Z^-\mathrm{X}^{Z^+}+Z^+\mathrm{X}^{-Z^-}`. In the former two types of +reactions, Monte Carlo moves alter the charge value of specific atoms +(:math:`\mathrm{A}`, :math:`\mathrm{B}`) and simultaneously insert a +counterion to preserve the charge neutrality of the system, modeling the +dissociation/association process. The last type of reaction performs +grand canonical MC exchange of ion pairs with a (fictitious) reservoir. -In our implementation "acid" refers to particles that can attain charge :math:`q=\{0,-1\}` and "base" to particles with :math:`q=\{0,1\}`, -whereas the MC exchange of free ions allows any integer charge values of :math:`{Z^+}` and :math:`{Z^-}`. +In our implementation "acid" refers to particles that can attain charge +:math:`q=\{0,-1\}` and "base" to particles with :math:`q=\{0,1\}`, +whereas the MC exchange of free ions allows any integer charge values of +:math:`{Z^+}` and :math:`{Z^-}`. -Here we provide several practical examples for modeling charge regulation effects in solvated systems. -An acid ionization reaction (:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{H}^+`) can be defined via a single line in the input file +Here we provide several practical examples for modeling charge +regulation effects in solvated systems. An acid ionization reaction +(:math:`\mathrm{A} \rightleftharpoons \mathrm{A}^-+\mathrm{H}^+`) can be +defined via a single line in the input file .. code-block:: LAMMPS fix acid_reaction all charge/regulation 2 3 acid_type 1 pH 7.0 pKa 5.0 pIp 7.0 pIm 7.0 -where the fix attempts to charge :math:`\mathrm{A}` (discharge :math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and insert (delete) a proton (atom type 2). Besides, the fix implements self-ionization reaction of water :math:`\emptyset \rightleftharpoons \mathrm{H}^++\mathrm{OH}^-`. -However, this approach is highly inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of both protons and hydroxyl ions is low, resulting in a relatively low acceptance rate of MC moves. +where the fix attempts to charge :math:`\mathrm{A}` (discharge +:math:`\mathrm{A}^-`) to :math:`\mathrm{A}^-` (:math:`\mathrm{A}`) and +insert (delete) a proton (atom type 2). Besides, the fix implements +self-ionization reaction of water :math:`\emptyset \rightleftharpoons +\mathrm{H}^++\mathrm{OH}^-`. However, this approach is highly +inefficient at :math:`\mathrm{pH} \approx 7` when the concentration of +both protons and hydroxyl ions is low, resulting in a relatively low +acceptance rate of MC moves. -A more efficient way is to allow salt ions to -participate in ionization reactions, which can be easily achieved via +A more efficient way is to allow salt ions to participate in ionization +reactions, which can be easily achieved via .. code-block:: LAMMPS fix acid_reaction all charge/regulation 4 5 acid_type 1 pH 7.0 pKa 5.0 pIp 2.0 pIm 2.0 -where particles of atom type 4 and 5 are the salt cations and anions, both at chemical potential pI=2.0, see :ref:`(Curk1) ` and :ref:`(Landsgesell) ` for more details. +where particles of atom type 4 and 5 are the salt cations and anions, +both at chemical potential pI=2.0, see :ref:`(Curk1) ` and +:ref:`(Landsgesell) ` for more details. - Similarly, we could have simultanously added a base ionization reaction (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`) + Similarly, we could have simultaneously added a base ionization reaction + (:math:`\mathrm{B} \rightleftharpoons \mathrm{B}^++\mathrm{OH}^-`) .. code-block:: LAMMPS fix base_reaction all charge/regulation 2 3 base_type 6 pH 7.0 pKb 6.0 pIp 7.0 pIm 7.0 - -where the fix will attempt to charge :math:`\mathrm{B}` (discharge :math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. -If neither the acid or the base type is specified, for example, + +where the fix will attempt to charge :math:`\mathrm{B}` (discharge +:math:`\mathrm{B}^+`) to :math:`\mathrm{B}^+` (:math:`\mathrm{B}`) and +insert (delete) a hydroxyl ion :math:`\mathrm{OH}^-` of atom type 3. If +neither the acid or the base type is specified, for example, .. code-block:: LAMMPS fix salt_reaction all charge/regulation 4 5 pIp 2.0 pIm 2.0 - -the fix simply inserts or deletes an ion pair of a free cation (atom type 4) and a free anion (atom type 5) as done in a conventional grand-canonical MC simulation. + +the fix simply inserts or deletes an ion pair of a free cation (atom +type 4) and a free anion (atom type 5) as done in a conventional +grand-canonical MC simulation. -The fix is compatible with LAMMPS sub-packages such as *molecule* or *rigid*. That said, the acid and base particles can be part of larger molecules or rigid bodies. Free ions that are inserted to or deleted from the system must be defined as single particles (no bonded interactions allowed) and cannot be part of larger molecules or rigid bodies. If *molecule* package is used, all inserted ions have a molecule ID equal to zero. +The fix is compatible with LAMMPS sub-packages such as *molecule* or +*rigid*. That said, the acid and base particles can be part of larger +molecules or rigid bodies. Free ions that are inserted to or deleted +from the system must be defined as single particles (no bonded +interactions allowed) and cannot be part of larger molecules or rigid +bodies. If *molecule* package is used, all inserted ions have a molecule +ID equal to zero. -Note that LAMMPS implicitly assumes a constant number of particles (degrees of freedom). Since using this fix alters the total number of particles during the simulation, any thermostat used by LAMMPS, such as NVT or Langevin, must use a dynamic calculation of system temperature. This can be achieved by specifying a dynamic temperature compute (e.g. dtemp) and using it with the desired thermostat, e.g. a Langevin thermostat: +Note that LAMMPS implicitly assumes a constant number of particles +(degrees of freedom). Since using this fix alters the total number of +particles during the simulation, any thermostat used by LAMMPS, such as +NVT or Langevin, must use a dynamic calculation of system +temperature. This can be achieved by specifying a dynamic temperature +compute (e.g. dtemp) and using it with the desired thermostat, e.g. a +Langevin thermostat: .. code-block:: LAMMPS compute dtemp all temp - compute_modify dtemp dynamic yes - fix fT all langevin 1.0 1.0 1.0 123 + compute_modify dtemp dynamic yes + fix fT all langevin 1.0 1.0 1.0 123 fix_modify fT temp dtemp -The chemical potential units (e.g. pH) are in the standard log10 representation assuming reference concentration :math:`\rho_0 = \mathrm{mol}/\mathrm{l}`. -Therefore, to perform the internal unit conversion, the length (in nanometers) of the LAMMPS unit length -must be specified via *lunit_nm* (default is set to the Bjerrum length in water at room temprature *lunit_nm* = 0.71nm). For example, in the dilute ideal solution limit, the concentration of free ions -will be :math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. +The chemical potential units (e.g. pH) are in the standard log10 +representation assuming reference concentration :math:`\rho_0 = +\mathrm{mol}/\mathrm{l}`. Therefore, to perform the internal unit +conversion, the length (in nanometers) of the LAMMPS unit length must be +specified via *lunit_nm* (default is set to the Bjerrum length in water +at room temperature *lunit_nm* = 0.71nm). For example, in the dilute +ideal solution limit, the concentration of free ions will be +:math:`c_\mathrm{I} = 10^{-\mathrm{pIp}}\mathrm{mol}/\mathrm{l}`. -The temperature used in MC acceptance probability is set by *temp*. This temperature should be the same as the temperature set by the molecular dynamics thermostat. For most purposes, it is probably best to use *tempfixid* keyword which dynamically sets the temperature equal to the chosen MD thermostat temperature, in the example above we assumed the thermostat fix-ID is *fT*. The inserted particles attain a random velocity corresponding to the specified temperature. Using *tempfixid* overrides any fixed temperature set by *temp*. +The temperature used in MC acceptance probability is set by *temp*. This +temperature should be the same as the temperature set by the molecular +dynamics thermostat. For most purposes, it is probably best to use +*tempfixid* keyword which dynamically sets the temperature equal to the +chosen MD thermostat temperature, in the example above we assumed the +thermostat fix-ID is *fT*. The inserted particles attain a random +velocity corresponding to the specified temperature. Using *tempfixid* +overrides any fixed temperature set by *temp*. -The *xrd* keyword can be used to restrict the inserted/deleted counterions to a specific radial distance from an acid or base particle that is currently participating in a reaction. This can be used to simulate more realist reaction dynamics. If *xrd* = 0 or *xrd* > *L* / 2, where *L* is the smallest box dimension, the radial restriction is automatically turned off and free ion can be inserted or deleted anywhere in the simulation box. +The *xrd* keyword can be used to restrict the inserted/deleted +counterions to a specific radial distance from an acid or base particle +that is currently participating in a reaction. This can be used to +simulate more realist reaction dynamics. If *xrd* = 0 or *xrd* > *L* / +2, where *L* is the smallest box dimension, the radial restriction is +automatically turned off and free ion can be inserted or deleted +anywhere in the simulation box. -If the *tag yes* is used, every inserted atom gets a unique tag ID, otherwise, the tag of every inserted atom is set to 0. *tag yes* might cause an integer overflow in very long simulations since the tags are unique to every particle and thus increase with every successful particle insertion. +If the *tag yes* is used, every inserted atom gets a unique tag ID, +otherwise, the tag of every inserted atom is set to 0. *tag yes* might +cause an integer overflow in very long simulations since the tags are +unique to every particle and thus increase with every successful +particle insertion. -The *pmcmoves* keyword sets the relative probability of attempting the three types of MC moves (reactions): acid charging, base charging, and ion pair exchange. -The fix only attempts to perform particle charging MC moves if *acid_type* or *base_type* is defined. Otherwise fix only performs free ion insertion/deletion. For example, if *acid_type* is not defined, *pmcA* is automatically set to 0. The vector *pmcmoves* is automatically normalized, for example, if set to *pmcmoves* 0 0.33 0.33, the vector would be normalized to [0,0.5,0.5]. +The *pmcmoves* keyword sets the relative probability of attempting the +three types of MC moves (reactions): acid charging, base charging, and +ion pair exchange. The fix only attempts to perform particle charging +MC moves if *acid_type* or *base_type* is defined. Otherwise fix only +performs free ion insertion/deletion. For example, if *acid_type* is not +defined, *pmcA* is automatically set to 0. The vector *pmcmoves* is +automatically normalized, for example, if set to *pmcmoves* 0 0.33 0.33, +the vector would be normalized to [0,0.5,0.5]. -The *only_salt* option can be used to perform multivalent grand-canonical ion-exchange moves. If *only_salt yes* is used, no charge exchange is performed, only ion insertion/deletion (*pmcmoves* is set to [0,0,1]), but ions can be multivalent. In the example above, an MC move would consist of three ion insertion/deletion to preserve the charge neutrality of the system. +The *only_salt* option can be used to perform multivalent +grand-canonical ion-exchange moves. If *only_salt yes* is used, no +charge exchange is performed, only ion insertion/deletion (*pmcmoves* is +set to [0,0,1]), but ions can be multivalent. In the example above, an +MC move would consist of three ion insertion/deletion to preserve the +charge neutrality of the system. -The *group* keyword can be used to add inserted particles to a specific group-ID. All inserted particles are automatically added to group *all*. +The *group* keyword can be used to add inserted particles to a specific +group-ID. All inserted particles are automatically added to group *all*. Output """""" -This fix computes a global vector of length 8, which can be accessed by various output commands. The vector values are the following global quantities: + +This fix computes a global vector of length 8, which can be accessed by +various output commands. The vector values are the following global +quantities: * 1 = cumulative MC attempts * 2 = cumulative MC successes -* 3 = current # of neutral acid atoms -* 4 = current # of -1 charged acid atoms -* 5 = current # of neutral base atoms -* 6 = current # of +1 charged base atoms -* 7 = current # of free cations +* 3 = current # of neutral acid atoms +* 4 = current # of -1 charged acid atoms +* 5 = current # of neutral base atoms +* 6 = current # of +1 charged base atoms +* 7 = current # of free cations * 8 = current # of free anions Restrictions """""""""""" -This fix is part of the USER-MISC package. It is only enabled if LAMMPS was built with that package. -See the :doc:`Build package ` doc page for more info. -The :doc:`atom_style `, used must contain the charge property, for example, the style could be *charge* or *full*. Only usable for 3D simulations. Atoms specified as free ions cannot be part of rigid bodies or molecules and cannot have bonding interactions. The scheme is limited to integer charges, any atoms with non-integer charges will not be considered by the fix. +This fix is part of the USER-MISC package. It is only enabled if LAMMPS +was built with that package. See the :doc:`Build package +` doc page for more info. -All interaction potentials used must be continuous, otherwise the MD integration and the particle exchange MC moves do not correspond to the same equilibrium ensemble. For example, if an lj/cut pair style is used, the LJ potential must be shifted so that it vanishes at the cutoff. This can be easily achieved using the :doc:`pair_modify ` command, i.e., by using: *pair_modify shift yes*. +The :doc:`atom_style `, used must contain the charge +property, for example, the style could be *charge* or *full*. Only +usable for 3D simulations. Atoms specified as free ions cannot be part +of rigid bodies or molecules and cannot have bonding interactions. The +scheme is limited to integer charges, any atoms with non-integer charges +will not be considered by the fix. -Note: Region restrictions are not yet implemented. +All interaction potentials used must be continuous, otherwise the MD +integration and the particle exchange MC moves do not correspond to the +same equilibrium ensemble. For example, if an lj/cut pair style is used, +the LJ potential must be shifted so that it vanishes at the cutoff. This +can be easily achieved using the :doc:`pair_modify ` +command, i.e., by using: *pair_modify shift yes*. + +Note: Region restrictions are not yet implemented. Related commands """""""""""""""" diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 9937a98850..3a3729eefa 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -260,6 +260,7 @@ bitmask bitrate bitrates Bitzek +Bjerrum Blaise blanchedalmond blocksize @@ -500,6 +501,8 @@ coulgauss coulombic Coulombic Coulombics +counterion +counterions Courant covalent covalently @@ -728,6 +731,7 @@ DRUDE dsf dsmc dt +dtemp dtgrow dtheta dtshrink @@ -876,6 +880,7 @@ equilibrates equilibrating equilibration Equilibria +equilibria equilization equipartitioning Ercolessi @@ -1210,6 +1215,7 @@ hbnewflag hbond hcp heatconduction +Hebbeker Hebenstreit Hecht Heenen @@ -1277,6 +1283,7 @@ hy hydrophobicity hydrostatic hydrostatically +hydroxyl Hynninen Hyoungki hyperdynamics @@ -1367,6 +1374,7 @@ ints inv invariants inversed +ionizable ionocovalent iostreams iparam @@ -1546,6 +1554,7 @@ Koning Kooser Korn Koskinen +Kosovan Koster Kosztin Kp @@ -1591,6 +1600,7 @@ Lamoureux Lanczos Lande Landron +Landsgesell langevin Langevin Langston @@ -1728,10 +1738,13 @@ lpsapi lrt lsfftw ltbbmalloc +Lua lubricateU lucy -Lua Luding +Luijten +lunit +Lunkad Lussetti Lustig lval @@ -2015,6 +2028,7 @@ multiscale multisectioning multithreading Multithreading +multivalent Mundy Murdick Murtola @@ -2060,6 +2074,7 @@ Nanoletters nanomechanics nanometer nanometers +nanoparticle nanoparticles Nanotube nanotube @@ -2167,6 +2182,7 @@ nm Nm Nmax nmax +nmc Nmin nmin Nmols @@ -2299,6 +2315,7 @@ omp OMP onelevel oneway +onlysalt onn ons OO @@ -2380,6 +2397,8 @@ pbc pc pchain Pchain +pcmoves +pmcmoves Pdamp pdb pdf @@ -2424,6 +2443,7 @@ phosphide Phs Physica physik +pI Piaggi picocoulomb picocoulombs @@ -2435,7 +2455,9 @@ pid piecewise Pieniazek Pieter +pIm pimd +pIp Piola Pisarev Pishevar @@ -2450,6 +2472,9 @@ ploop PloS plt plumedfile +pKa +pKb +pKs pmb Pmolrotate Pmoltrans @@ -2768,6 +2793,7 @@ rst rstyle Rubensson Rubia +Rud Rudd Rudra Rudranarayan From 19311d408db82bab339c84090c4cbd451b5b5d77 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 26 Feb 2021 23:10:43 -0500 Subject: [PATCH 019/370] use utils::trim() to remove extra whitespace from ctime() output. --- unittest/force-styles/test_angle_style.cpp | 3 +-- unittest/force-styles/test_bond_style.cpp | 3 +-- unittest/force-styles/test_dihedral_style.cpp | 3 +-- unittest/force-styles/test_fix_timestep.cpp | 3 +-- unittest/force-styles/test_improper_style.cpp | 3 +-- unittest/force-styles/test_pair_style.cpp | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index 833aa69174..bf5cb34e7f 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -240,8 +240,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index 0d20a0bb62..d6a6e9c82d 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -240,8 +240,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index e60968bb0a..a27c50afb7 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -249,8 +249,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index e4b0fa6e02..2680367c88 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -198,8 +198,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index 858db0fb65..b13b571546 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -240,8 +240,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index aa0edfa2ad..4e1ad8d0e3 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -244,8 +244,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // date_generated std::time_t now = time(NULL); - block = ctime(&now); - block = block.substr(0, block.find("\n") - 1); + block = utils::trim(ctime(&now)); writer.emit("date_generated", block); // epsilon From 981ed019837051167a99303dc38d538e6d9f1a18 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 26 Feb 2021 23:16:51 -0500 Subject: [PATCH 020/370] recreate all yaml files with updated timestamps --- unittest/force-styles/tests/angle-charmm.yaml | 4 +- unittest/force-styles/tests/angle-class2.yaml | 4 +- .../force-styles/tests/angle-class2_p6.yaml | 4 +- unittest/force-styles/tests/angle-cosine.yaml | 4 +- .../tests/angle-cosine_delta.yaml | 4 +- .../tests/angle-cosine_periodic.yaml | 4 +- .../tests/angle-cosine_shift.yaml | 4 +- .../tests/angle-cosine_shift_exp.yaml | 4 +- .../tests/angle-cosine_squared.yaml | 4 +- unittest/force-styles/tests/angle-cross.yaml | 4 +- .../force-styles/tests/angle-fourier.yaml | 4 +- .../tests/angle-fourier_simple.yaml | 4 +- .../force-styles/tests/angle-gaussian.yaml | 4 +- .../force-styles/tests/angle-harmonic.yaml | 4 +- unittest/force-styles/tests/angle-hybrid.yaml | 4 +- unittest/force-styles/tests/angle-mm3.yaml | 4 +- .../force-styles/tests/angle-quartic.yaml | 4 +- .../tests/angle-table_linear.yaml | 4 +- .../tests/angle-table_spline.yaml | 4 +- unittest/force-styles/tests/angle-zero.yaml | 4 +- .../force-styles/tests/atomic-pair-adp.yaml | 4 +- .../force-styles/tests/atomic-pair-atm.yaml | 4 +- .../force-styles/tests/atomic-pair-beck.yaml | 4 +- .../force-styles/tests/atomic-pair-born.yaml | 4 +- .../tests/atomic-pair-colloid.yaml | 4 +- .../tests/atomic-pair-colloid_multi.yaml | 4 +- .../tests/atomic-pair-colloid_multi_tri.yaml | 4 +- .../tests/atomic-pair-colloid_tiled.yaml | 4 +- .../tests/atomic-pair-colloid_tiled_tri.yaml | 4 +- .../force-styles/tests/atomic-pair-eam.yaml | 4 +- .../tests/atomic-pair-eam_alloy.yaml | 4 +- .../tests/atomic-pair-eam_alloy_real.yaml | 4 +- .../tests/atomic-pair-eam_cd.yaml | 4 +- .../tests/atomic-pair-eam_cd_old.yaml | 4 +- .../tests/atomic-pair-eam_cd_real.yaml | 4 +- .../tests/atomic-pair-eam_fs.yaml | 4 +- .../tests/atomic-pair-eam_fs_real.yaml | 4 +- .../tests/atomic-pair-eam_he.yaml | 4 +- .../tests/atomic-pair-eam_he_real.yaml | 4 +- .../tests/atomic-pair-eam_real.yaml | 4 +- .../force-styles/tests/atomic-pair-edip.yaml | 4 +- .../force-styles/tests/atomic-pair-eim.yaml | 4 +- .../force-styles/tests/atomic-pair-gauss.yaml | 4 +- .../tests/atomic-pair-hybrid-eam.yaml | 4 +- .../tests/atomic-pair-hybrid-eam_fs.yaml | 4 +- .../tests/atomic-pair-kim_lj.yaml | 4 +- .../tests/atomic-pair-meam_c.yaml | 4 +- .../tests/atomic-pair-meam_spline.yaml | 4 +- .../tests/atomic-pair-meam_sw_spline.yaml | 4 +- .../force-styles/tests/atomic-pair-momb.yaml | 4 +- .../tests/atomic-pair-polymorphic_eam.yaml | 4 +- .../tests/atomic-pair-reax_c.yaml | 4 +- .../tests/atomic-pair-reax_c_lgvdw.yaml | 4 +- .../tests/atomic-pair-reax_c_noqeq.yaml | 4 +- .../tests/atomic-pair-table_bitmap.yaml | 4 +- .../tests/atomic-pair-table_linear.yaml | 4 +- .../tests/atomic-pair-table_lookup.yaml | 4 +- .../tests/atomic-pair-table_spline.yaml | 4 +- .../tests/atomic-pair-yukawa_colloid.yaml | 4 +- unittest/force-styles/tests/bond-class2.yaml | 4 +- unittest/force-styles/tests/bond-fene.yaml | 4 +- .../force-styles/tests/bond-fene_expand.yaml | 4 +- .../force-styles/tests/bond-gaussian.yaml | 4 +- unittest/force-styles/tests/bond-gromos.yaml | 6 +- .../force-styles/tests/bond-harmonic.yaml | 6 +- .../tests/bond-harmonic_shift.yaml | 6 +- .../tests/bond-harmonic_shift_cut.yaml | 6 +- unittest/force-styles/tests/bond-hybrid.yaml | 6 +- unittest/force-styles/tests/bond-mm3.yaml | 6 +- unittest/force-styles/tests/bond-morse.yaml | 6 +- .../force-styles/tests/bond-nonlinear.yaml | 6 +- unittest/force-styles/tests/bond-quartic.yaml | 4 +- .../force-styles/tests/bond-table_linear.yaml | 6 +- .../force-styles/tests/bond-table_spline.yaml | 6 +- unittest/force-styles/tests/bond-zero.yaml | 6 +- .../force-styles/tests/dihedral-charmm.yaml | 2 +- .../tests/dihedral-charmmfsw.yaml | 2 +- .../force-styles/tests/dihedral-class2.yaml | 2 +- .../tests/dihedral-cosine_shift_exp.yaml | 2 +- .../force-styles/tests/dihedral-fourier.yaml | 2 +- .../force-styles/tests/dihedral-harmonic.yaml | 2 +- .../force-styles/tests/dihedral-helix.yaml | 2 +- .../force-styles/tests/dihedral-hybrid.yaml | 2 +- .../tests/dihedral-multi_harmonic.yaml | 2 +- .../tests/dihedral-nharmonic.yaml | 2 +- .../force-styles/tests/dihedral-opls.yaml | 2 +- .../tests/dihedral-quadratic.yaml | 2 +- .../force-styles/tests/dihedral-zero.yaml | 2 +- .../tests/fix-timestep-addforce_const.yaml | 4 +- .../tests/fix-timestep-addforce_variable.yaml | 4 +- .../tests/fix-timestep-aveforce_const.yaml | 4 +- .../tests/fix-timestep-aveforce_variable.yaml | 4 +- .../force-styles/tests/fix-timestep-drag.yaml | 4 +- .../tests/fix-timestep-efield_const.yaml | 6 +- .../tests/fix-timestep-efield_region.yaml | 4 +- .../tests/fix-timestep-efield_variable.yaml | 6 +- .../force-styles/tests/fix-timestep-heat.yaml | 4 +- .../tests/fix-timestep-heat_region.yaml | 4 +- .../tests/fix-timestep-lineforce.yaml | 4 +- .../tests/fix-timestep-momentum.yaml | 4 +- .../tests/fix-timestep-momentum_chunk.yaml | 4 +- .../force-styles/tests/fix-timestep-nph.yaml | 4 +- .../tests/fix-timestep-npt_aniso.yaml | 4 +- .../tests/fix-timestep-npt_iso.yaml | 4 +- .../tests/fix-timestep-npt_tri.yaml | 6 +- .../force-styles/tests/fix-timestep-nve.yaml | 4 +- .../tests/fix-timestep-nve_limit.yaml | 4 +- .../tests/fix-timestep-nve_noforce.yaml | 4 +- .../force-styles/tests/fix-timestep-nvt.yaml | 4 +- .../tests/fix-timestep-oneway.yaml | 4 +- .../tests/fix-timestep-planeforce.yaml | 4 +- .../fix-timestep-press_berendsen_iso.yaml | 4 +- .../tests/fix-timestep-rattle_angle.yaml | 4 +- .../tests/fix-timestep-rattle_bond.yaml | 4 +- .../tests/fix-timestep-restrain.yaml | 6 +- .../tests/fix-timestep-rigid_group.yaml | 4 +- .../tests/fix-timestep-rigid_molecule.yaml | 4 +- .../fix-timestep-rigid_molecule_tri.yaml | 26 +-- .../tests/fix-timestep-rigid_nph.yaml | 4 +- .../tests/fix-timestep-rigid_nph_small.yaml | 4 +- .../tests/fix-timestep-rigid_npt.yaml | 4 +- .../tests/fix-timestep-rigid_npt_small.yaml | 4 +- .../tests/fix-timestep-rigid_nve_group.yaml | 4 +- .../fix-timestep-rigid_nve_molecule.yaml | 4 +- .../tests/fix-timestep-rigid_nve_single.yaml | 4 +- .../tests/fix-timestep-rigid_nve_small.yaml | 4 +- .../tests/fix-timestep-rigid_nvt.yaml | 4 +- .../tests/fix-timestep-rigid_nvt_small.yaml | 4 +- .../tests/fix-timestep-rigid_single.yaml | 4 +- .../tests/fix-timestep-rigid_small.yaml | 4 +- .../tests/fix-timestep-setforce_const.yaml | 4 +- .../tests/fix-timestep-setforce_region.yaml | 4 +- .../tests/fix-timestep-setforce_variable.yaml | 4 +- .../tests/fix-timestep-shake_angle.yaml | 4 +- .../tests/fix-timestep-shake_bond.yaml | 4 +- .../tests/fix-timestep-smd_couple.yaml | 4 +- .../tests/fix-timestep-smd_tether.yaml | 6 +- .../tests/fix-timestep-spring_chunk.yaml | 4 +- .../tests/fix-timestep-spring_couple.yaml | 4 +- .../tests/fix-timestep-spring_rg.yaml | 4 +- .../tests/fix-timestep-spring_self.yaml | 4 +- .../tests/fix-timestep-spring_tether.yaml | 4 +- .../tests/fix-timestep-temp_berendsen.yaml | 4 +- .../tests/fix-timestep-temp_csld.yaml | 4 +- .../tests/fix-timestep-temp_csvr.yaml | 4 +- .../tests/fix-timestep-temp_rescale.yaml | 4 +- .../fix-timestep-wall_harmonic_const.yaml | 6 +- .../tests/fix-timestep-wall_lj1043_const.yaml | 6 +- .../tests/fix-timestep-wall_lj126_const.yaml | 6 +- .../tests/fix-timestep-wall_lj93_const.yaml | 6 +- .../tests/fix-timestep-wall_morse_const.yaml | 6 +- .../force-styles/tests/improper-class2.yaml | 2 +- .../force-styles/tests/improper-cossq.yaml | 2 +- .../force-styles/tests/improper-cvff.yaml | 2 +- .../force-styles/tests/improper-distance.yaml | 2 +- .../force-styles/tests/improper-distharm.yaml | 2 +- .../force-styles/tests/improper-fourier.yaml | 2 +- .../force-styles/tests/improper-harmonic.yaml | 2 +- .../force-styles/tests/improper-hybrid.yaml | 2 +- .../tests/improper-inversion_harmonic.yaml | 2 +- .../force-styles/tests/improper-ring.yaml | 2 +- .../tests/improper-sqdistharm.yaml | 2 +- .../force-styles/tests/improper-umbrella.yaml | 2 +- .../force-styles/tests/improper-zero.yaml | 2 +- unittest/force-styles/tests/kspace-ewald.yaml | 4 +- .../force-styles/tests/kspace-ewald_disp.yaml | 54 ++--- .../tests/kspace-ewald_nozforce.yaml | 4 +- .../force-styles/tests/kspace-ewald_slab.yaml | 4 +- .../force-styles/tests/kspace-ewald_tri.yaml | 4 +- unittest/force-styles/tests/kspace-msm.yaml | 4 +- .../force-styles/tests/kspace-msm_cg.yaml | 4 +- .../force-styles/tests/kspace-msm_nopbc.yaml | 4 +- unittest/force-styles/tests/kspace-pppm.yaml | 4 +- .../force-styles/tests/kspace-pppm_ad.yaml | 4 +- .../force-styles/tests/kspace-pppm_cg.yaml | 4 +- .../force-styles/tests/kspace-pppm_cg_ad.yaml | 4 +- .../tests/kspace-pppm_cg_tiled.yaml | 4 +- .../force-styles/tests/kspace-pppm_disp.yaml | 4 +- .../tests/kspace-pppm_disp_ad.yaml | 4 +- .../tests/kspace-pppm_disp_ad_only.yaml | 4 +- .../tests/kspace-pppm_disp_only.yaml | 4 +- .../tests/kspace-pppm_disp_tip4p.yaml | 4 +- .../tests/kspace-pppm_nozforce.yaml | 4 +- .../force-styles/tests/kspace-pppm_slab.yaml | 4 +- .../tests/kspace-pppm_stagger.yaml | 104 ++++----- .../tests/kspace-pppm_stagger_tiled.yaml | 104 ++++----- .../force-styles/tests/kspace-pppm_tiled.yaml | 4 +- .../force-styles/tests/kspace-pppm_tip4p.yaml | 4 +- .../tests/kspace-pppm_tip4p_ad.yaml | 4 +- .../tests/kspace-pppm_tip4p_nozforce.yaml | 4 +- .../tests/kspace-pppm_tip4p_slab.yaml | 4 +- .../force-styles/tests/kspace-pppm_tri.yaml | 4 +- .../tests/manybody-pair-airebo.yaml | 4 +- .../tests/manybody-pair-airebo_00.yaml | 4 +- .../tests/manybody-pair-airebo_m.yaml | 4 +- .../tests/manybody-pair-airebo_m00.yaml | 4 +- .../force-styles/tests/manybody-pair-bop.yaml | 4 +- .../tests/manybody-pair-bop_save.yaml | 4 +- .../tests/manybody-pair-comb.yaml | 4 +- .../tests/manybody-pair-comb3.yaml | 4 +- .../tests/manybody-pair-edip_multi.yaml | 4 +- .../tests/manybody-pair-extep.yaml | 4 +- .../force-styles/tests/manybody-pair-gw.yaml | 4 +- .../tests/manybody-pair-gw_zbl.yaml | 4 +- .../tests/manybody-pair-lcbop.yaml | 4 +- .../tests/manybody-pair-meam_c.yaml | 4 +- .../tests/manybody-pair-mliap_snap.yaml | 12 +- .../tests/manybody-pair-mliap_snap_chem.yaml | 8 +- .../tests/manybody-pair-nb3b_harmonic.yaml | 4 +- .../tests/manybody-pair-polymorphic_sw.yaml | 4 +- .../manybody-pair-polymorphic_tersoff.yaml | 4 +- .../tests/manybody-pair-rebo.yaml | 4 +- .../tests/manybody-pair-snap.yaml | 12 +- .../tests/manybody-pair-snap_chem.yaml | 8 +- .../tests/manybody-pair-sw-multi.yaml | 4 +- .../force-styles/tests/manybody-pair-sw.yaml | 4 +- .../tests/manybody-pair-tersoff.yaml | 158 ++++++------- .../tests/manybody-pair-tersoff_mod.yaml | 210 +++++++++--------- .../tests/manybody-pair-tersoff_mod_c.yaml | 210 +++++++++--------- .../manybody-pair-tersoff_mod_c_shift.yaml | 4 +- .../manybody-pair-tersoff_mod_shift.yaml | 4 +- .../tests/manybody-pair-tersoff_shift.yaml | 4 +- .../tests/manybody-pair-tersoff_table.yaml | 4 +- .../tests/manybody-pair-tersoff_zbl.yaml | 188 ++++++++-------- .../manybody-pair-tersoff_zbl_shift.yaml | 4 +- .../tests/manybody-pair-vashishta.yaml | 4 +- .../tests/manybody-pair-vashishta_table.yaml | 4 +- .../force-styles/tests/mol-pair-beck.yaml | 4 +- .../force-styles/tests/mol-pair-born.yaml | 4 +- .../tests/mol-pair-born_coul_dsf.yaml | 4 +- .../tests/mol-pair-born_coul_dsf_cs.yaml | 4 +- .../tests/mol-pair-born_coul_long.yaml | 4 +- .../tests/mol-pair-born_coul_long_cs.yaml | 4 +- .../tests/mol-pair-born_coul_msm.yaml | 4 +- .../tests/mol-pair-born_coul_msm_table.yaml | 4 +- .../tests/mol-pair-born_coul_table_cs.yaml | 4 +- .../tests/mol-pair-born_coul_wolf.yaml | 4 +- .../tests/mol-pair-born_coul_wolf_cs.yaml | 4 +- .../force-styles/tests/mol-pair-buck.yaml | 4 +- .../tests/mol-pair-buck_coul_cut.yaml | 4 +- .../tests/mol-pair-buck_coul_long.yaml | 4 +- .../tests/mol-pair-buck_coul_long_cs.yaml | 4 +- .../tests/mol-pair-buck_coul_msm.yaml | 4 +- .../tests/mol-pair-buck_coul_msm_table.yaml | 4 +- .../tests/mol-pair-buck_coul_table.yaml | 4 +- .../tests/mol-pair-buck_coul_table_cs.yaml | 4 +- .../tests/mol-pair-buck_long_coul_long.yaml | 130 +++++------ .../tests/mol-pair-buck_long_coul_off.yaml | 4 +- .../mol-pair-buck_long_cut_coul_long.yaml | 4 +- .../force-styles/tests/mol-pair-buck_mdf.yaml | 4 +- .../tests/mol-pair-buck_table_coul_long.yaml | 4 +- .../tests/mol-pair-buck_table_coul_off.yaml | 4 +- .../tests/mol-pair-buck_table_coul_table.yaml | 130 +++++------ .../tests/mol-pair-cosine_squared.yaml | 4 +- .../force-styles/tests/mol-pair-coul_cut.yaml | 4 +- .../tests/mol-pair-coul_cut_soft.yaml | 4 +- .../tests/mol-pair-coul_debye.yaml | 4 +- .../tests/mol-pair-coul_diel.yaml | 4 +- .../force-styles/tests/mol-pair-coul_dsf.yaml | 4 +- .../tests/mol-pair-coul_long.yaml | 4 +- .../tests/mol-pair-coul_long_cs.yaml | 4 +- .../tests/mol-pair-coul_long_soft.yaml | 4 +- .../force-styles/tests/mol-pair-coul_msm.yaml | 4 +- .../tests/mol-pair-coul_msm_table.yaml | 4 +- .../tests/mol-pair-coul_shield.yaml | 4 +- .../tests/mol-pair-coul_slater_cut.yaml | 4 +- .../tests/mol-pair-coul_slater_long.yaml | 4 +- .../tests/mol-pair-coul_streitz_long.yaml | 4 +- .../tests/mol-pair-coul_streitz_wolf.yaml | 4 +- .../tests/mol-pair-coul_table.yaml | 4 +- .../tests/mol-pair-coul_table_cs.yaml | 4 +- .../tests/mol-pair-coul_wolf.yaml | 4 +- .../tests/mol-pair-coul_wolf_cs.yaml | 4 +- unittest/force-styles/tests/mol-pair-dpd.yaml | 4 +- .../tests/mol-pair-dpd_tstat.yaml | 4 +- unittest/force-styles/tests/mol-pair-e3b.yaml | 4 +- .../force-styles/tests/mol-pair-gauss.yaml | 4 +- .../tests/mol-pair-gauss_cut.yaml | 4 +- .../tests/mol-pair-hybrid-overlay.yaml | 4 +- .../force-styles/tests/mol-pair-hybrid.yaml | 4 +- .../tests/mol-pair-lennard_mdf.yaml | 4 +- .../force-styles/tests/mol-pair-lj96_cut.yaml | 4 +- .../tests/mol-pair-lj_charmm_coul_charmm.yaml | 4 +- ...l-pair-lj_charmm_coul_charmm_implicit.yaml | 4 +- .../tests/mol-pair-lj_charmm_coul_long.yaml | 4 +- .../mol-pair-lj_charmm_coul_long_soft.yaml | 4 +- .../tests/mol-pair-lj_charmm_coul_msm.yaml | 4 +- .../mol-pair-lj_charmm_coul_msm_table.yaml | 4 +- .../tests/mol-pair-lj_charmm_coul_table.yaml | 4 +- .../mol-pair-lj_charmmfsw_coul_charmmfsw.yaml | 4 +- .../mol-pair-lj_charmmfsw_coul_long.yaml | 4 +- .../mol-pair-lj_charmmfsw_coul_table.yaml | 4 +- .../tests/mol-pair-lj_class2.yaml | 4 +- .../tests/mol-pair-lj_class2_coul_cut.yaml | 4 +- .../mol-pair-lj_class2_coul_cut_soft.yaml | 4 +- .../tests/mol-pair-lj_class2_coul_long.yaml | 4 +- .../mol-pair-lj_class2_coul_long_cs.yaml | 4 +- .../mol-pair-lj_class2_coul_long_soft.yaml | 4 +- .../tests/mol-pair-lj_class2_coul_table.yaml | 4 +- .../mol-pair-lj_class2_coul_table_cs.yaml | 4 +- .../tests/mol-pair-lj_class2_soft.yaml | 4 +- .../force-styles/tests/mol-pair-lj_cubic.yaml | 4 +- .../force-styles/tests/mol-pair-lj_cut.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_cut.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_cut_soft.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_debye.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_dsf.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_long.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_long_cs.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_long_soft.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_msm.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_msm_table.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_table.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_table_cs.yaml | 4 +- .../tests/mol-pair-lj_cut_coul_wolf.yaml | 4 +- .../tests/mol-pair-lj_cut_soft.yaml | 4 +- .../tests/mol-pair-lj_cut_tip4p_cut.yaml | 4 +- .../tests/mol-pair-lj_cut_tip4p_long.yaml | 4 +- .../mol-pair-lj_cut_tip4p_long_soft.yaml | 4 +- .../tests/mol-pair-lj_cut_tip4p_table.yaml | 4 +- .../tests/mol-pair-lj_expand.yaml | 4 +- .../tests/mol-pair-lj_expand_coul_long.yaml | 4 +- .../tests/mol-pair-lj_expand_coul_table.yaml | 4 +- .../tests/mol-pair-lj_gromacs.yaml | 4 +- .../mol-pair-lj_gromacs_coul_gromacs.yaml | 4 +- .../tests/mol-pair-lj_long_coul_long.yaml | 130 +++++------ .../tests/mol-pair-lj_long_coul_off.yaml | 4 +- .../tests/mol-pair-lj_long_cut_coul_long.yaml | 4 +- .../mol-pair-lj_long_cut_tip4p_long.yaml | 4 +- .../tests/mol-pair-lj_long_tip4p_long.yaml | 98 ++++---- .../force-styles/tests/mol-pair-lj_mdf.yaml | 4 +- .../force-styles/tests/mol-pair-lj_sdk.yaml | 4 +- .../tests/mol-pair-lj_sdk_coul_long.yaml | 4 +- .../tests/mol-pair-lj_sdk_coul_msm.yaml | 4 +- .../tests/mol-pair-lj_sdk_coul_msm_table.yaml | 4 +- .../tests/mol-pair-lj_sdk_coul_table.yaml | 4 +- .../tests/mol-pair-lj_smooth.yaml | 4 +- .../tests/mol-pair-lj_smooth_linear.yaml | 4 +- .../tests/mol-pair-lj_table_coul_long.yaml | 4 +- .../tests/mol-pair-lj_table_coul_off.yaml | 4 +- .../tests/mol-pair-lj_table_coul_table.yaml | 4 +- .../tests/mol-pair-lj_table_tip4p_long.yaml | 4 +- .../tests/mol-pair-lj_table_tip4p_table.yaml | 4 +- .../force-styles/tests/mol-pair-mie_cut.yaml | 4 +- .../force-styles/tests/mol-pair-morse.yaml | 4 +- .../tests/mol-pair-morse_smooth_linear.yaml | 4 +- .../tests/mol-pair-morse_soft.yaml | 4 +- .../force-styles/tests/mol-pair-nm_cut.yaml | 4 +- .../tests/mol-pair-nm_cut_coul_cut.yaml | 4 +- .../tests/mol-pair-nm_cut_coul_long.yaml | 4 +- .../tests/mol-pair-nm_cut_coul_table.yaml | 4 +- .../tests/mol-pair-python_hybrid.yaml | 4 +- .../tests/mol-pair-python_lj.yaml | 4 +- .../force-styles/tests/mol-pair-soft.yaml | 4 +- .../force-styles/tests/mol-pair-table.yaml | 4 +- .../tests/mol-pair-tip4p_cut.yaml | 4 +- .../tests/mol-pair-tip4p_long.yaml | 4 +- .../tests/mol-pair-tip4p_long_soft.yaml | 4 +- .../tests/mol-pair-tip4p_table.yaml | 4 +- unittest/force-styles/tests/mol-pair-ufm.yaml | 4 +- .../force-styles/tests/mol-pair-wf_cut.yaml | 4 +- .../force-styles/tests/mol-pair-yukawa.yaml | 4 +- unittest/force-styles/tests/mol-pair-zbl.yaml | 4 +- .../force-styles/tests/mol-pair-zero.yaml | 4 +- 364 files changed, 1482 insertions(+), 1482 deletions(-) diff --git a/unittest/force-styles/tests/angle-charmm.yaml b/unittest/force-styles/tests/angle-charmm.yaml index 3d0dc17371..83c9609995 100644 --- a/unittest/force-styles/tests/angle-charmm.yaml +++ b/unittest/force-styles/tests/angle-charmm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-class2.yaml b/unittest/force-styles/tests/angle-class2.yaml index a82e2f66b3..ffd48d7727 100644 --- a/unittest/force-styles/tests/angle-class2.yaml +++ b/unittest/force-styles/tests/angle-class2.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-class2_p6.yaml b/unittest/force-styles/tests/angle-class2_p6.yaml index f8b3982573..72ee6626c8 100644 --- a/unittest/force-styles/tests/angle-class2_p6.yaml +++ b/unittest/force-styles/tests/angle-class2_p6.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine.yaml b/unittest/force-styles/tests/angle-cosine.yaml index 69d3c7439d..3b80dfe647 100644 --- a/unittest/force-styles/tests/angle-cosine.yaml +++ b/unittest/force-styles/tests/angle-cosine.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine_delta.yaml b/unittest/force-styles/tests/angle-cosine_delta.yaml index 131e91789f..e59eda767f 100644 --- a/unittest/force-styles/tests/angle-cosine_delta.yaml +++ b/unittest/force-styles/tests/angle-cosine_delta.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine_periodic.yaml b/unittest/force-styles/tests/angle-cosine_periodic.yaml index 814c837dcd..55beb13fdd 100644 --- a/unittest/force-styles/tests/angle-cosine_periodic.yaml +++ b/unittest/force-styles/tests/angle-cosine_periodic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine_shift.yaml b/unittest/force-styles/tests/angle-cosine_shift.yaml index 3ea5e257e0..0518db6d83 100644 --- a/unittest/force-styles/tests/angle-cosine_shift.yaml +++ b/unittest/force-styles/tests/angle-cosine_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine_shift_exp.yaml b/unittest/force-styles/tests/angle-cosine_shift_exp.yaml index cf19a26b1f..f237af9bb2 100644 --- a/unittest/force-styles/tests/angle-cosine_shift_exp.yaml +++ b/unittest/force-styles/tests/angle-cosine_shift_exp.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cosine_squared.yaml b/unittest/force-styles/tests/angle-cosine_squared.yaml index c9ab2e5448..ad00a9e357 100644 --- a/unittest/force-styles/tests/angle-cosine_squared.yaml +++ b/unittest/force-styles/tests/angle-cosine_squared.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-cross.yaml b/unittest/force-styles/tests/angle-cross.yaml index ccaf5f3be6..5e5db1d8cb 100644 --- a/unittest/force-styles/tests/angle-cross.yaml +++ b/unittest/force-styles/tests/angle-cross.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-fourier.yaml b/unittest/force-styles/tests/angle-fourier.yaml index d36d2cefd7..487458bf60 100644 --- a/unittest/force-styles/tests/angle-fourier.yaml +++ b/unittest/force-styles/tests/angle-fourier.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-fourier_simple.yaml b/unittest/force-styles/tests/angle-fourier_simple.yaml index abd9218c7f..ee318b013f 100644 --- a/unittest/force-styles/tests/angle-fourier_simple.yaml +++ b/unittest/force-styles/tests/angle-fourier_simple.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-gaussian.yaml b/unittest/force-styles/tests/angle-gaussian.yaml index 0103811913..dd11d73b1f 100644 --- a/unittest/force-styles/tests/angle-gaussian.yaml +++ b/unittest/force-styles/tests/angle-gaussian.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 29 Oct 2020 -date_generated: Sat Nov 14 17:18:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-harmonic.yaml b/unittest/force-styles/tests/angle-harmonic.yaml index 6d9cf67210..7490bf6764 100644 --- a/unittest/force-styles/tests/angle-harmonic.yaml +++ b/unittest/force-styles/tests/angle-harmonic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-hybrid.yaml b/unittest/force-styles/tests/angle-hybrid.yaml index f68d23e790..a46c6c69e4 100644 --- a/unittest/force-styles/tests/angle-hybrid.yaml +++ b/unittest/force-styles/tests/angle-hybrid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-mm3.yaml b/unittest/force-styles/tests/angle-mm3.yaml index d4bf2b8cb5..cf857f86d5 100644 --- a/unittest/force-styles/tests/angle-mm3.yaml +++ b/unittest/force-styles/tests/angle-mm3.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:24 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-quartic.yaml b/unittest/force-styles/tests/angle-quartic.yaml index 912825d3a2..3fd927ac4a 100644 --- a/unittest/force-styles/tests/angle-quartic.yaml +++ b/unittest/force-styles/tests/angle-quartic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 4e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-table_linear.yaml b/unittest/force-styles/tests/angle-table_linear.yaml index 7dc66d9edf..979750b11c 100644 --- a/unittest/force-styles/tests/angle-table_linear.yaml +++ b/unittest/force-styles/tests/angle-table_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-table_spline.yaml b/unittest/force-styles/tests/angle-table_spline.yaml index 10edec26fd..7adb7240ec 100644 --- a/unittest/force-styles/tests/angle-table_spline.yaml +++ b/unittest/force-styles/tests/angle-table_spline.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/angle-zero.yaml b/unittest/force-styles/tests/angle-zero.yaml index 71f4451d72..b2f1a0ec90 100644 --- a/unittest/force-styles/tests/angle-zero.yaml +++ b/unittest/force-styles/tests/angle-zero.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 1e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/atomic-pair-adp.yaml b/unittest/force-styles/tests/atomic-pair-adp.yaml index c8eb06a3be..8d8a707bff 100644 --- a/unittest/force-styles/tests/atomic-pair-adp.yaml +++ b/unittest/force-styles/tests/atomic-pair-adp.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:58 2021 epsilon: 5e-13 prerequisites: ! | pair adp diff --git a/unittest/force-styles/tests/atomic-pair-atm.yaml b/unittest/force-styles/tests/atomic-pair-atm.yaml index 525cfdcd5f..0fc90345a3 100644 --- a/unittest/force-styles/tests/atomic-pair-atm.yaml +++ b/unittest/force-styles/tests/atomic-pair-atm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:58 2021 epsilon: 5e-12 prerequisites: ! | pair atm diff --git a/unittest/force-styles/tests/atomic-pair-beck.yaml b/unittest/force-styles/tests/atomic-pair-beck.yaml index e2398914a2..3faebc561b 100644 --- a/unittest/force-styles/tests/atomic-pair-beck.yaml +++ b/unittest/force-styles/tests/atomic-pair-beck.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 prerequisites: ! | pair beck diff --git a/unittest/force-styles/tests/atomic-pair-born.yaml b/unittest/force-styles/tests/atomic-pair-born.yaml index 4769fc729c..52fcbef141 100644 --- a/unittest/force-styles/tests/atomic-pair-born.yaml +++ b/unittest/force-styles/tests/atomic-pair-born.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 prerequisites: ! | pair born diff --git a/unittest/force-styles/tests/atomic-pair-colloid.yaml b/unittest/force-styles/tests/atomic-pair-colloid.yaml index 9ac3710674..537ac447b5 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 prerequisites: ! | pair colloid diff --git a/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml b/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml index 7923d672eb..025a7faa05 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_multi.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 prerequisites: ! | pair colloid diff --git a/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml b/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml index 38d51f3566..9ead662a06 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_multi_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 prerequisites: ! | pair colloid diff --git a/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml b/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml index 516395e3c2..be3ba744d0 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_tiled.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-14 prerequisites: ! | pair colloid diff --git a/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml b/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml index b52ad6fe37..cd6c7595e8 100644 --- a/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml +++ b/unittest/force-styles/tests/atomic-pair-colloid_tiled_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:59 2021 epsilon: 5e-13 prerequisites: ! | pair colloid diff --git a/unittest/force-styles/tests/atomic-pair-eam.yaml b/unittest/force-styles/tests/atomic-pair-eam.yaml index 455f932258..c606813d56 100644 --- a/unittest/force-styles/tests/atomic-pair-eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 6e-12 prerequisites: ! | pair eam diff --git a/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml b/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml index a2d39bdd7c..072a0a97c0 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_alloy.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 prerequisites: ! | pair eam/alloy diff --git a/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml index 4684951547..033c341f08 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_alloy_real.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 7.5e-12 prerequisites: ! | pair eam/alloy diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd.yaml index c1d189e1d8..bda14a9e5a 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 prerequisites: ! | pair eam/cd diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml index 6dd89be146..4f6891bae6 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd_old.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 prerequisites: ! | pair eam/cd/old diff --git a/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml index bf5269b8cb..e2ac5f0cae 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_cd_real.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:00 2021 epsilon: 5e-12 prerequisites: ! | pair eam/cd diff --git a/unittest/force-styles/tests/atomic-pair-eam_fs.yaml b/unittest/force-styles/tests/atomic-pair-eam_fs.yaml index f978b7d444..89ad740424 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_fs.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_fs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:01 2021 epsilon: 5e-12 prerequisites: ! | pair eam/fs diff --git a/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml index eae925a38d..bf7f4f338b 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_fs_real.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:01 2021 epsilon: 7.5e-12 prerequisites: ! | pair eam/fs diff --git a/unittest/force-styles/tests/atomic-pair-eam_he.yaml b/unittest/force-styles/tests/atomic-pair-eam_he.yaml index f82b4182b3..001301fe1a 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_he.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_he.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Wed Jan 13 22:16:02 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:01 2021 epsilon: 5e-12 prerequisites: ! | pair eam/he diff --git a/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml index 62324447a3..236b9538a7 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_he_real.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Wed Jan 13 22:16:02 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 7.5e-12 prerequisites: ! | pair eam/he diff --git a/unittest/force-styles/tests/atomic-pair-eam_real.yaml b/unittest/force-styles/tests/atomic-pair-eam_real.yaml index a9df9364a0..89e7c1ce0b 100644 --- a/unittest/force-styles/tests/atomic-pair-eam_real.yaml +++ b/unittest/force-styles/tests/atomic-pair-eam_real.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 5e-12 prerequisites: ! | pair eam diff --git a/unittest/force-styles/tests/atomic-pair-edip.yaml b/unittest/force-styles/tests/atomic-pair-edip.yaml index 3d9f4a00fa..91b7fd8db4 100644 --- a/unittest/force-styles/tests/atomic-pair-edip.yaml +++ b/unittest/force-styles/tests/atomic-pair-edip.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 7.5e-13 prerequisites: ! | pair edip diff --git a/unittest/force-styles/tests/atomic-pair-eim.yaml b/unittest/force-styles/tests/atomic-pair-eim.yaml index 8e9b4ee2c0..4814029a3c 100644 --- a/unittest/force-styles/tests/atomic-pair-eim.yaml +++ b/unittest/force-styles/tests/atomic-pair-eim.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 1e-11 prerequisites: ! | pair eim diff --git a/unittest/force-styles/tests/atomic-pair-gauss.yaml b/unittest/force-styles/tests/atomic-pair-gauss.yaml index a6db06e019..7d4c2029db 100644 --- a/unittest/force-styles/tests/atomic-pair-gauss.yaml +++ b/unittest/force-styles/tests/atomic-pair-gauss.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:22 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 5e-12 prerequisites: ! | pair gauss diff --git a/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml b/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml index b3569a7e74..a681657b65 100644 --- a/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-hybrid-eam.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:02 2021 epsilon: 1e-11 prerequisites: ! | pair eam/fs diff --git a/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml b/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml index 2098f90e13..d2f511b3ea 100644 --- a/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml +++ b/unittest/force-styles/tests/atomic-pair-hybrid-eam_fs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 5e-12 prerequisites: ! | pair eam/fs diff --git a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml index 87d7994740..84bf844350 100644 --- a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml +++ b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 5e-13 prerequisites: ! | pair kim diff --git a/unittest/force-styles/tests/atomic-pair-meam_c.yaml b/unittest/force-styles/tests/atomic-pair-meam_c.yaml index 0d369326cc..7d93a698e0 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_c.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 5e-13 prerequisites: ! | pair meam/c diff --git a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml index 43db461160..7fd61ac2aa 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 1e-14 prerequisites: ! | pair meam/spline diff --git a/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml b/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml index ca9bad14f5..b9f330e6de 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_sw_spline.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 1e-14 prerequisites: ! | pair meam/sw/spline diff --git a/unittest/force-styles/tests/atomic-pair-momb.yaml b/unittest/force-styles/tests/atomic-pair-momb.yaml index 525198b071..2ee1c80ff0 100644 --- a/unittest/force-styles/tests/atomic-pair-momb.yaml +++ b/unittest/force-styles/tests/atomic-pair-momb.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:03 2021 epsilon: 2.5e-12 prerequisites: ! | pair momb diff --git a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml index dcc041f6e0..57f0812bca 100644 --- a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:23 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:04 2021 epsilon: 1e-12 prerequisites: ! | pair polymorphic diff --git a/unittest/force-styles/tests/atomic-pair-reax_c.yaml b/unittest/force-styles/tests/atomic-pair-reax_c.yaml index b88eb7235b..fe6c93db05 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:24 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:04 2021 epsilon: 2.5e-11 prerequisites: ! | pair reax/c diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml index db4bb284fa..567bddf5ce 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_lgvdw.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:25 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:06 2021 epsilon: 2e-10 prerequisites: ! | pair reax/c diff --git a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml index 32a75749b1..efdf3ff5de 100644 --- a/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml +++ b/unittest/force-styles/tests/atomic-pair-reax_c_noqeq.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:26 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:08 2021 epsilon: 5e-13 prerequisites: ! | pair reax/c diff --git a/unittest/force-styles/tests/atomic-pair-table_bitmap.yaml b/unittest/force-styles/tests/atomic-pair-table_bitmap.yaml index d4401d6895..c67ff58bf8 100644 --- a/unittest/force-styles/tests/atomic-pair-table_bitmap.yaml +++ b/unittest/force-styles/tests/atomic-pair-table_bitmap.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:09 2021 epsilon: 5e-13 prerequisites: ! | pair table diff --git a/unittest/force-styles/tests/atomic-pair-table_linear.yaml b/unittest/force-styles/tests/atomic-pair-table_linear.yaml index 14dd697e49..bb7f3959e0 100644 --- a/unittest/force-styles/tests/atomic-pair-table_linear.yaml +++ b/unittest/force-styles/tests/atomic-pair-table_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-13 prerequisites: ! | pair table diff --git a/unittest/force-styles/tests/atomic-pair-table_lookup.yaml b/unittest/force-styles/tests/atomic-pair-table_lookup.yaml index 769d94b350..8752fa49a8 100644 --- a/unittest/force-styles/tests/atomic-pair-table_lookup.yaml +++ b/unittest/force-styles/tests/atomic-pair-table_lookup.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-13 prerequisites: ! | pair table diff --git a/unittest/force-styles/tests/atomic-pair-table_spline.yaml b/unittest/force-styles/tests/atomic-pair-table_spline.yaml index a4dce1338b..276dae27c2 100644 --- a/unittest/force-styles/tests/atomic-pair-table_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-table_spline.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-13 prerequisites: ! | pair table diff --git a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml index 4011d89240..1529cf51b9 100644 --- a/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml +++ b/unittest/force-styles/tests/atomic-pair-yukawa_colloid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-14 prerequisites: ! | atom sphere diff --git a/unittest/force-styles/tests/bond-class2.yaml b/unittest/force-styles/tests/bond-class2.yaml index 13c2493d88..19647a56ed 100644 --- a/unittest/force-styles/tests/bond-class2.yaml +++ b/unittest/force-styles/tests/bond-class2.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/bond-fene.yaml b/unittest/force-styles/tests/bond-fene.yaml index dffbcf6f8b..00b66e2466 100644 --- a/unittest/force-styles/tests/bond-fene.yaml +++ b/unittest/force-styles/tests/bond-fene.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/bond-fene_expand.yaml b/unittest/force-styles/tests/bond-fene_expand.yaml index 8b3513737f..f29213e126 100644 --- a/unittest/force-styles/tests/bond-fene_expand.yaml +++ b/unittest/force-styles/tests/bond-fene_expand.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/bond-gaussian.yaml b/unittest/force-styles/tests/bond-gaussian.yaml index 92157d7155..b5553fb053 100644 --- a/unittest/force-styles/tests/bond-gaussian.yaml +++ b/unittest/force-styles/tests/bond-gaussian.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 29 Oct 2020 -date_generated: Sat Nov 14 16:49:01 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/bond-gromos.yaml b/unittest/force-styles/tests/bond-gromos.yaml index 14fc81b49c..13ad366fed 100644 --- a/unittest/force-styles/tests/bond-gromos.yaml +++ b/unittest/force-styles/tests/bond-gromos.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 4 650.0 1.2 5 450.0 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | kappa 1 r0 1 diff --git a/unittest/force-styles/tests/bond-harmonic.yaml b/unittest/force-styles/tests/bond-harmonic.yaml index 0bbe86c3c2..a277586a2e 100644 --- a/unittest/force-styles/tests/bond-harmonic.yaml +++ b/unittest/force-styles/tests/bond-harmonic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 4 650.0 1.2 5 450.0 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | kappa 1 r0 1 diff --git a/unittest/force-styles/tests/bond-harmonic_shift.yaml b/unittest/force-styles/tests/bond-harmonic_shift.yaml index bc8fa72d85..9726574bee 100644 --- a/unittest/force-styles/tests/bond-harmonic_shift.yaml +++ b/unittest/force-styles/tests/bond-harmonic_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 0.3 4 650.0 1.2 0.2 5 450.0 1.0 0.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: -9395.51998238922 diff --git a/unittest/force-styles/tests/bond-harmonic_shift_cut.yaml b/unittest/force-styles/tests/bond-harmonic_shift_cut.yaml index 9fe6db9b1f..9406206497 100644 --- a/unittest/force-styles/tests/bond-harmonic_shift_cut.yaml +++ b/unittest/force-styles/tests/bond-harmonic_shift_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 0.3 4 650.0 1.2 0.2 5 450.0 1.0 0.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 0 diff --git a/unittest/force-styles/tests/bond-hybrid.yaml b/unittest/force-styles/tests/bond-hybrid.yaml index 9e2d6f9be7..44d4579aa2 100644 --- a/unittest/force-styles/tests/bond-hybrid.yaml +++ b/unittest/force-styles/tests/bond-hybrid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -16,7 +16,7 @@ bond_coeff: ! | 3 morse 7000.0 0.2 1.3 4 harmonic 650.0 1.2 5 harmonic 450.0 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 4.63957309438403 diff --git a/unittest/force-styles/tests/bond-mm3.yaml b/unittest/force-styles/tests/bond-mm3.yaml index f93ee4ace3..4e4c2c19d3 100644 --- a/unittest/force-styles/tests/bond-mm3.yaml +++ b/unittest/force-styles/tests/bond-mm3.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 4 650.0 1.2 5 450.0 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 4.24726500827314 diff --git a/unittest/force-styles/tests/bond-morse.yaml b/unittest/force-styles/tests/bond-morse.yaml index fea8739e5e..ba76e2f153 100644 --- a/unittest/force-styles/tests/bond-morse.yaml +++ b/unittest/force-styles/tests/bond-morse.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 7000.0 0.2 1.3 4 7500.0 0.4 1.2 5 7000.0 0.3 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | r0 1 natoms: 29 diff --git a/unittest/force-styles/tests/bond-nonlinear.yaml b/unittest/force-styles/tests/bond-nonlinear.yaml index cb3e10d14f..ef4f59df5b 100644 --- a/unittest/force-styles/tests/bond-nonlinear.yaml +++ b/unittest/force-styles/tests/bond-nonlinear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 350.0 1.3 2.0 4 650.0 1.2 1.4 5 450.0 1.0 1.1 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 1.94517280328209 diff --git a/unittest/force-styles/tests/bond-quartic.yaml b/unittest/force-styles/tests/bond-quartic.yaml index b7248b64cf..9d49991d5a 100644 --- a/unittest/force-styles/tests/bond-quartic.yaml +++ b/unittest/force-styles/tests/bond-quartic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 10:06:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/bond-table_linear.yaml b/unittest/force-styles/tests/bond-table_linear.yaml index 307c9ef9bd..b2ffe6360a 100644 --- a/unittest/force-styles/tests/bond-table_linear.yaml +++ b/unittest/force-styles/tests/bond-table_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:22 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 ${input_dir}/bond_table.txt harmonic_3 4 ${input_dir}/bond_table.txt harmonic_4 5 ${input_dir}/bond_table.txt harmonic_5 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 4.83475893645922 diff --git a/unittest/force-styles/tests/bond-table_spline.yaml b/unittest/force-styles/tests/bond-table_spline.yaml index 23ee0426da..3b4ffe462e 100644 --- a/unittest/force-styles/tests/bond-table_spline.yaml +++ b/unittest/force-styles/tests/bond-table_spline.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 ${input_dir}/bond_table.txt harmonic_3 4 ${input_dir}/bond_table.txt harmonic_4 5 ${input_dir}/bond_table.txt harmonic_5 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! "" natoms: 29 init_energy: 4.78937402460163 diff --git a/unittest/force-styles/tests/bond-zero.yaml b/unittest/force-styles/tests/bond-zero.yaml index 9c87712465..e3458f7d50 100644 --- a/unittest/force-styles/tests/bond-zero.yaml +++ b/unittest/force-styles/tests/bond-zero.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:23 2021 epsilon: 1e-14 prerequisites: ! | atom full @@ -15,7 +15,7 @@ bond_coeff: ! | 3 1.3 4 1.2 5 1.0 -equilibrium: 5 1.5 1.1 1.3 1.2 1.0 +equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | r0 1 natoms: 29 diff --git a/unittest/force-styles/tests/dihedral-charmm.yaml b/unittest/force-styles/tests/dihedral-charmm.yaml index 18df3bcd0f..471e85de89 100644 --- a/unittest/force-styles/tests/dihedral-charmm.yaml +++ b/unittest/force-styles/tests/dihedral-charmm.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:32:00 202 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-charmmfsw.yaml b/unittest/force-styles/tests/dihedral-charmmfsw.yaml index f1aa53eb63..0f0a76c8de 100644 --- a/unittest/force-styles/tests/dihedral-charmmfsw.yaml +++ b/unittest/force-styles/tests/dihedral-charmmfsw.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:32:07 202 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-class2.yaml b/unittest/force-styles/tests/dihedral-class2.yaml index 9ba2319072..9dfcc918a5 100644 --- a/unittest/force-styles/tests/dihedral-class2.yaml +++ b/unittest/force-styles/tests/dihedral-class2.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 8e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-cosine_shift_exp.yaml b/unittest/force-styles/tests/dihedral-cosine_shift_exp.yaml index 69735c90a7..806a65bd8a 100644 --- a/unittest/force-styles/tests/dihedral-cosine_shift_exp.yaml +++ b/unittest/force-styles/tests/dihedral-cosine_shift_exp.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-fourier.yaml b/unittest/force-styles/tests/dihedral-fourier.yaml index b2e9dffad2..84b5d8f920 100644 --- a/unittest/force-styles/tests/dihedral-fourier.yaml +++ b/unittest/force-styles/tests/dihedral-fourier.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-harmonic.yaml b/unittest/force-styles/tests/dihedral-harmonic.yaml index 4e8fa89118..6c54a96142 100644 --- a/unittest/force-styles/tests/dihedral-harmonic.yaml +++ b/unittest/force-styles/tests/dihedral-harmonic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-helix.yaml b/unittest/force-styles/tests/dihedral-helix.yaml index 992916d8ab..f775cd2164 100644 --- a/unittest/force-styles/tests/dihedral-helix.yaml +++ b/unittest/force-styles/tests/dihedral-helix.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 4e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-hybrid.yaml b/unittest/force-styles/tests/dihedral-hybrid.yaml index 4826754536..4747958fab 100644 --- a/unittest/force-styles/tests/dihedral-hybrid.yaml +++ b/unittest/force-styles/tests/dihedral-hybrid.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 20:43:34 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-multi_harmonic.yaml b/unittest/force-styles/tests/dihedral-multi_harmonic.yaml index 60ce4d574f..1694ed2e66 100644 --- a/unittest/force-styles/tests/dihedral-multi_harmonic.yaml +++ b/unittest/force-styles/tests/dihedral-multi_harmonic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-nharmonic.yaml b/unittest/force-styles/tests/dihedral-nharmonic.yaml index b3101ff379..564864a636 100644 --- a/unittest/force-styles/tests/dihedral-nharmonic.yaml +++ b/unittest/force-styles/tests/dihedral-nharmonic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-opls.yaml b/unittest/force-styles/tests/dihedral-opls.yaml index 3b0c897d68..03164e2c36 100644 --- a/unittest/force-styles/tests/dihedral-opls.yaml +++ b/unittest/force-styles/tests/dihedral-opls.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-quadratic.yaml b/unittest/force-styles/tests/dihedral-quadratic.yaml index c03382dc22..ed230b7c23 100644 --- a/unittest/force-styles/tests/dihedral-quadratic.yaml +++ b/unittest/force-styles/tests/dihedral-quadratic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:38 202 +date_generated: Fri Feb 26 23:09:35 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-zero.yaml b/unittest/force-styles/tests/dihedral-zero.yaml index 2573cf7501..04652cbfc6 100644 --- a/unittest/force-styles/tests/dihedral-zero.yaml +++ b/unittest/force-styles/tests/dihedral-zero.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 18:38:39 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-addforce_const.yaml b/unittest/force-styles/tests/fix-timestep-addforce_const.yaml index 39bbfcf280..47786b33fe 100644 --- a/unittest/force-styles/tests/fix-timestep-addforce_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-addforce_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 9e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-addforce_variable.yaml b/unittest/force-styles/tests/fix-timestep-addforce_variable.yaml index 421051601a..78f260bd39 100644 --- a/unittest/force-styles/tests/fix-timestep-addforce_variable.yaml +++ b/unittest/force-styles/tests/fix-timestep-addforce_variable.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-aveforce_const.yaml b/unittest/force-styles/tests/fix-timestep-aveforce_const.yaml index 18dd4cf4b2..34c6afbbf5 100644 --- a/unittest/force-styles/tests/fix-timestep-aveforce_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-aveforce_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-aveforce_variable.yaml b/unittest/force-styles/tests/fix-timestep-aveforce_variable.yaml index 41299b2ec8..6b52979777 100644 --- a/unittest/force-styles/tests/fix-timestep-aveforce_variable.yaml +++ b/unittest/force-styles/tests/fix-timestep-aveforce_variable.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2.5e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-drag.yaml b/unittest/force-styles/tests/fix-timestep-drag.yaml index bb4908f55e..fbcee25721 100644 --- a/unittest/force-styles/tests/fix-timestep-drag.yaml +++ b/unittest/force-styles/tests/fix-timestep-drag.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-efield_const.yaml b/unittest/force-styles/tests/fix-timestep-efield_const.yaml index 394af87faa..cd0fe2b7d4 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2e-13 prerequisites: ! | atom full @@ -13,7 +13,7 @@ input_file: in.fourmol natoms: 29 global_scalar: -0.0309186331146529 global_vector: ! |- - 3 0.0 -2.220446049250313e-16 2.220446049250313e-16 + 3 0 -2.220446049250313e-16 2.220446049250313e-16 run_pos: ! |2 1 -2.7045797446143222e-01 2.4912780824342802e+00 -1.6702148063946790e-01 2 3.1004707684044314e-01 2.9610914097014920e+00 -8.5452223796947857e-01 diff --git a/unittest/force-styles/tests/fix-timestep-efield_region.yaml b/unittest/force-styles/tests/fix-timestep-efield_region.yaml index f45b6c05c9..6312ce5d52 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_region.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_region.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-efield_variable.yaml b/unittest/force-styles/tests/fix-timestep-efield_variable.yaml index 94137f59b8..13d43663a2 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_variable.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_variable.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:53 2021 epsilon: 2e-13 prerequisites: ! | atom full @@ -18,7 +18,7 @@ input_file: in.fourmol natoms: 29 global_scalar: 0 global_vector: ! |- - 3 10.275935322301738 0.0 -1.1102230246251565e-16 + 3 10.275935322301738 0 -1.1102230246251565e-16 run_pos: ! |2 1 -2.7027400245078581e-01 2.4912153249078419e+00 -1.6697700443575972e-01 2 3.1048749486212474e-01 2.9612319277095587e+00 -8.5462053704633356e-01 diff --git a/unittest/force-styles/tests/fix-timestep-heat.yaml b/unittest/force-styles/tests/fix-timestep-heat.yaml index a7197528f5..a93468f7e8 100644 --- a/unittest/force-styles/tests/fix-timestep-heat.yaml +++ b/unittest/force-styles/tests/fix-timestep-heat.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-heat_region.yaml b/unittest/force-styles/tests/fix-timestep-heat_region.yaml index 1439af67ad..9c8f740456 100644 --- a/unittest/force-styles/tests/fix-timestep-heat_region.yaml +++ b/unittest/force-styles/tests/fix-timestep-heat_region.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-lineforce.yaml b/unittest/force-styles/tests/fix-timestep-lineforce.yaml index 8acfe82ce3..fbb3a4f16f 100644 --- a/unittest/force-styles/tests/fix-timestep-lineforce.yaml +++ b/unittest/force-styles/tests/fix-timestep-lineforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-momentum.yaml b/unittest/force-styles/tests/fix-timestep-momentum.yaml index 96a3e9d4bb..4ae3b928bf 100644 --- a/unittest/force-styles/tests/fix-timestep-momentum.yaml +++ b/unittest/force-styles/tests/fix-timestep-momentum.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml index 454d9c632c..89e6518c7b 100644 --- a/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml +++ b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-nph.yaml b/unittest/force-styles/tests/fix-timestep-nph.yaml index 0eb8716aaf..a21fe19fa8 100644 --- a/unittest/force-styles/tests/fix-timestep-nph.yaml +++ b/unittest/force-styles/tests/fix-timestep-nph.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_aniso.yaml b/unittest/force-styles/tests/fix-timestep-npt_aniso.yaml index b086a1b95e..b7d7a2a32e 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_aniso.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_aniso.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 4e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_iso.yaml b/unittest/force-styles/tests/fix-timestep-npt_iso.yaml index 8dec2a1bec..1a47662b76 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_iso.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_iso.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 2e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_tri.yaml b/unittest/force-styles/tests/fix-timestep-npt_tri.yaml index b4093b7a3d..c2a4da9695 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_tri.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:54 2021 epsilon: 5e-12 prerequisites: ! | atom full @@ -13,7 +13,7 @@ input_file: in.fourmol natoms: 29 global_scalar: 354.174797856098 global_vector: ! |- - 48 1.3901404465408471 5.463126417846173 27.522868094744837 0.6808509272696268 1.432899560678195 24.73621155835892 0.059175794171946315 0.058864829843401814 0.12700748296200176 0.02134537927441898 -0.006866713927713234 -0.03517153788806217 0.03214843910942283 0.03135716661218002 0.05847613666451851 0.010015733944968137 -0.004026286211139594 -0.020364872327366976 0.32458573874717506 0.03420953094338522 0.00010301961702814269 0.40071682483624077 0.09021935542363528 0.0016272628807846479 23.20496983817849 1.0856361420490914 5.469362788109317 3.86897924261614 0.20400675418492722 60.79661790199697 0.004555933286932949 0.004555933286932949 0.004555933286932949 0.0 0.0 0.0 23.105498800354294 21.982100664555755 76.44567329133054 2.242648057096569 0.36241390540377744 9.27169098501188 0.06450189547628359 0.006798140909455242 2.0472127318975922e-05 119.66012864844495 6.065599766319885 0.0019732846899264155 + 48 1.3901404465408471 5.463126417846173 27.522868094744837 0.6808509272696268 1.432899560678195 24.73621155835892 0.059175794171946315 0.058864829843401814 0.12700748296200176 0.02134537927441898 -0.006866713927713234 -0.03517153788806217 0.03214843910942283 0.03135716661218002 0.05847613666451851 0.010015733944968137 -0.004026286211139594 -0.020364872327366976 0.32458573874717506 0.03420953094338522 0.00010301961702814269 0.40071682483624077 0.09021935542363528 0.0016272628807846479 23.20496983817849 1.0856361420490914 5.469362788109317 3.86897924261614 0.20400675418492722 60.79661790199697 0.004555933286932949 0.004555933286932949 0.004555933286932949 0 0 0 23.105498800354294 21.982100664555755 76.44567329133054 2.242648057096569 0.36241390540377744 9.27169098501188 0.06450189547628359 0.006798140909455242 2.0472127318975922e-05 119.66012864844495 6.065599766319885 0.0019732846899264155 run_pos: ! |2 1 -8.2271095985417642e-01 2.8289040859356991e+00 -1.1444756137720979e-01 2 -2.2035635832079414e-01 3.3160751622563218e+00 -8.8905665482321261e-01 diff --git a/unittest/force-styles/tests/fix-timestep-nve.yaml b/unittest/force-styles/tests/fix-timestep-nve.yaml index 5d2efa1373..09d1efe402 100644 --- a/unittest/force-styles/tests/fix-timestep-nve.yaml +++ b/unittest/force-styles/tests/fix-timestep-nve.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:40 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-nve_limit.yaml b/unittest/force-styles/tests/fix-timestep-nve_limit.yaml index bc6a16704f..1efd576e57 100644 --- a/unittest/force-styles/tests/fix-timestep-nve_limit.yaml +++ b/unittest/force-styles/tests/fix-timestep-nve_limit.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-nve_noforce.yaml b/unittest/force-styles/tests/fix-timestep-nve_noforce.yaml index 17e9923d45..33b5295a53 100644 --- a/unittest/force-styles/tests/fix-timestep-nve_noforce.yaml +++ b/unittest/force-styles/tests/fix-timestep-nve_noforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-nvt.yaml b/unittest/force-styles/tests/fix-timestep-nvt.yaml index 6a4ead99c1..298b506ab2 100644 --- a/unittest/force-styles/tests/fix-timestep-nvt.yaml +++ b/unittest/force-styles/tests/fix-timestep-nvt.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-oneway.yaml b/unittest/force-styles/tests/fix-timestep-oneway.yaml index 01131a3803..413902e1ff 100644 --- a/unittest/force-styles/tests/fix-timestep-oneway.yaml +++ b/unittest/force-styles/tests/fix-timestep-oneway.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 4e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-planeforce.yaml b/unittest/force-styles/tests/fix-timestep-planeforce.yaml index e4ad9f124e..ba1b93f9f2 100644 --- a/unittest/force-styles/tests/fix-timestep-planeforce.yaml +++ b/unittest/force-styles/tests/fix-timestep-planeforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-press_berendsen_iso.yaml b/unittest/force-styles/tests/fix-timestep-press_berendsen_iso.yaml index 5bbf178dc3..c5bed62746 100644 --- a/unittest/force-styles/tests/fix-timestep-press_berendsen_iso.yaml +++ b/unittest/force-styles/tests/fix-timestep-press_berendsen_iso.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 2e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rattle_angle.yaml b/unittest/force-styles/tests/fix-timestep-rattle_angle.yaml index 03ba9a64b9..92ac0b5cab 100644 --- a/unittest/force-styles/tests/fix-timestep-rattle_angle.yaml +++ b/unittest/force-styles/tests/fix-timestep-rattle_angle.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 3e-10 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml b/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml index cad83187c6..2a4b6d9cb6 100644 --- a/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml +++ b/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:55 2021 epsilon: 1e-10 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-restrain.yaml b/unittest/force-styles/tests/fix-timestep-restrain.yaml index b504554484..c6806c3176 100644 --- a/unittest/force-styles/tests/fix-timestep-restrain.yaml +++ b/unittest/force-styles/tests/fix-timestep-restrain.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:41 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 2e-13 prerequisites: ! | atom full @@ -13,7 +13,7 @@ input_file: in.fourmol natoms: 29 global_scalar: 114.558406487374 global_vector: ! |- - 3 0.15090319643872077 29.7021302625337 0.0 + 3 0.15090319643872077 29.7021302625337 0 run_pos: ! |2 1 -2.7049081044736850e-01 2.4911173559795530e+00 -1.6698991821614786e-01 2 3.0937052624736794e-01 2.9607167765013171e+00 -8.5481885843536709e-01 diff --git a/unittest/force-styles/tests/fix-timestep-rigid_group.yaml b/unittest/force-styles/tests/fix-timestep-rigid_group.yaml index 00201c36b5..9646f73313 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_group.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_group.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:53 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_molecule.yaml b/unittest/force-styles/tests/fix-timestep-rigid_molecule.yaml index 418614b035..bf27b25c5d 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_molecule.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_molecule.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:54 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_molecule_tri.yaml b/unittest/force-styles/tests/fix-timestep-rigid_molecule_tri.yaml index f23297ece8..3a3f0cd59a 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_molecule_tri.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_molecule_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:54 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-12 prerequisites: ! | atom full @@ -14,7 +14,7 @@ post_commands: ! | input_file: in.fourmol natoms: 29 run_stress: ! |- - -4.9200116134789241e+01 -2.6907707565985238e+01 -6.0080860422273377e+00 -2.5620423972099417e+01 -1.3450224059984127e+01 -1.4947288486998911e+00 + -4.9200116134788829e+01 -2.6907707565985422e+01 -6.0080860422273261e+00 -2.5620423972099612e+01 -1.3450224059983762e+01 -1.4947288487001149e+00 global_scalar: 18.3405601674143 run_pos: ! |2 1 -2.7993683669226854e-01 2.4726588069312836e+00 -1.7200860244148508e-01 @@ -41,7 +41,7 @@ run_pos: ! |2 22 4.3655322291888483e+00 -4.2084949965552569e+00 -4.4622011117402334e+00 23 5.7380414793463101e+00 -3.5841969195032686e+00 -3.8827839830470232e+00 24 2.0701314765323913e+00 3.1499370533342308e+00 3.1565324852522920e+00 - 25 1.3030170721374779e+00 3.2711173927682236e+00 2.5081940917429755e+00 + 25 1.3030170721374770e+00 3.2711173927682236e+00 2.5081940917429755e+00 26 2.5776230782480054e+00 4.0127347068243875e+00 3.2182355138709262e+00 27 -1.9613581876744357e+00 -4.3556300596085160e+00 2.1101467673534788e+00 28 -2.7406520384725965e+00 -4.0207251278130975e+00 1.5828689861678509e+00 @@ -64,15 +64,15 @@ run_vel: ! |2 15 -4.3301707382721859e-03 -3.1802661664634938e-03 3.2037919043360571e-03 16 -9.6715751018414326e-05 -5.0016572678960377e-04 1.4945658875149626e-03 17 6.5692180538157174e-04 3.6635779995305095e-04 8.3495414466050911e-04 - 18 3.6149625095704480e-04 -3.1032459262907435e-04 8.1043030117346128e-04 - 19 8.5103884665346124e-04 -1.4572280596788089e-03 1.0163621287634045e-03 - 20 -6.5204659278589121e-04 4.3989037444288817e-04 4.9909839028508280e-04 - 21 -1.3888125881903863e-03 -3.1978049143082245e-04 1.1455681499836596e-03 - 22 -1.6084223477729515e-03 -1.5355394240820991e-03 1.4772010826232349e-03 - 23 2.6392672378804170e-04 -3.9375414431174621e-03 -3.6991583139727824e-04 - 24 8.6062827067889477e-04 -9.4179873474469237e-04 5.5396395550012714e-04 - 25 1.5933645477487534e-03 -2.2139156625681600e-03 -5.5078029695647803e-04 - 26 -1.5679561743998831e-03 3.5146224354725699e-04 2.4446924193334539e-03 + 18 3.6149625095704670e-04 -3.1032459262907857e-04 8.1043030117346052e-04 + 19 8.5103884665345799e-04 -1.4572280596788108e-03 1.0163621287634071e-03 + 20 -6.5204659278590292e-04 4.3989037444289630e-04 4.9909839028508204e-04 + 21 -1.3888125881903854e-03 -3.1978049143082060e-04 1.1455681499836594e-03 + 22 -1.6084223477729519e-03 -1.5355394240820970e-03 1.4772010826232353e-03 + 23 2.6392672378803975e-04 -3.9375414431174552e-03 -3.6991583139727889e-04 + 24 8.6062827067889835e-04 -9.4179873474469346e-04 5.5396395550012497e-04 + 25 1.5933645477487516e-03 -2.2139156625681669e-03 -5.5078029695647564e-04 + 26 -1.5679561743998831e-03 3.5146224354726187e-04 2.4446924193334495e-03 27 -2.6510179146429716e-04 3.6306203629019116e-04 -5.6235585400647747e-04 28 -2.3068708109787484e-04 -8.5663070212203200e-04 2.1302563179109169e-03 29 -2.5054744388303732e-03 -1.6773997805290820e-04 2.8436699761004796e-03 diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nph.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nph.yaml index 4e5c3cf1bc..4b4f53b240 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nph.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nph.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:55 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nph_small.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nph_small.yaml index 11d6870a42..6a7fa3c8a5 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nph_small.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nph_small.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:55 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 6.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_npt.yaml b/unittest/force-styles/tests/fix-timestep-rigid_npt.yaml index f85f2119b5..2b1fbc73b5 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_npt.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_npt.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:56 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_npt_small.yaml b/unittest/force-styles/tests/fix-timestep-rigid_npt_small.yaml index 4b5a717e25..008499c206 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_npt_small.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_npt_small.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:56 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nve_group.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nve_group.yaml index ee40036bf9..a78dd6c421 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nve_group.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nve_group.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:57 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:56 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nve_molecule.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nve_molecule.yaml index d422c3d56e..32a3f6af71 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nve_molecule.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nve_molecule.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:57 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nve_single.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nve_single.yaml index d72a0ff3b7..85aa11e3e0 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nve_single.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nve_single.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:58 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nve_small.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nve_small.yaml index 74121559aa..87655f456b 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nve_small.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nve_small.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:58 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nvt.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nvt.yaml index 8a3a1d9c31..be224eb6ad 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nvt.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nvt.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:59 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_nvt_small.yaml b/unittest/force-styles/tests/fix-timestep-rigid_nvt_small.yaml index 654b85416a..b0e0040070 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_nvt_small.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_nvt_small.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:36:59 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_single.yaml b/unittest/force-styles/tests/fix-timestep-rigid_single.yaml index e419416c7e..61957af75d 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_single.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_single.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:37:00 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-rigid_small.yaml b/unittest/force-styles/tests/fix-timestep-rigid_small.yaml index 2c5fa3a2c0..837363d059 100644 --- a/unittest/force-styles/tests/fix-timestep-rigid_small.yaml +++ b/unittest/force-styles/tests/fix-timestep-rigid_small.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 22:37:00 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-setforce_const.yaml b/unittest/force-styles/tests/fix-timestep-setforce_const.yaml index 4ff222aff6..05ea1b2adb 100644 --- a/unittest/force-styles/tests/fix-timestep-setforce_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-setforce_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 2e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-setforce_region.yaml b/unittest/force-styles/tests/fix-timestep-setforce_region.yaml index bf1d08df34..50eafa8f6a 100644 --- a/unittest/force-styles/tests/fix-timestep-setforce_region.yaml +++ b/unittest/force-styles/tests/fix-timestep-setforce_region.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:57 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-setforce_variable.yaml b/unittest/force-styles/tests/fix-timestep-setforce_variable.yaml index 960368a081..00a1b270f9 100644 --- a/unittest/force-styles/tests/fix-timestep-setforce_variable.yaml +++ b/unittest/force-styles/tests/fix-timestep-setforce_variable.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 1e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-shake_angle.yaml b/unittest/force-styles/tests/fix-timestep-shake_angle.yaml index 1cc3dfe429..3317f7a187 100644 --- a/unittest/force-styles/tests/fix-timestep-shake_angle.yaml +++ b/unittest/force-styles/tests/fix-timestep-shake_angle.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 3e-10 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml index afbba6c6d7..41b3e8c1f9 100644 --- a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml +++ b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 3.5e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-smd_couple.yaml b/unittest/force-styles/tests/fix-timestep-smd_couple.yaml index 3b2858ba00..7207392b84 100644 --- a/unittest/force-styles/tests/fix-timestep-smd_couple.yaml +++ b/unittest/force-styles/tests/fix-timestep-smd_couple.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-smd_tether.yaml b/unittest/force-styles/tests/fix-timestep-smd_tether.yaml index f25b7b0334..c6627219d7 100644 --- a/unittest/force-styles/tests/fix-timestep-smd_tether.yaml +++ b/unittest/force-styles/tests/fix-timestep-smd_tether.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 2e-14 prerequisites: ! | atom full @@ -12,7 +12,7 @@ post_commands: ! | input_file: in.fourmol natoms: 29 global_vector: ! |- - 7 3.468936708094085 -3.4952703851457807 -0.8657730938070575 5.0 1.1439828473945521 1.1439828473945521 0.0 + 7 3.468936708094085 -3.4952703851457807 -0.8657730938070575 5 1.1439828473945521 1.1439828473945521 0 run_pos: ! |2 1 -2.7043651355831022e-01 2.4911967678686477e+00 -1.6696328159792090e-01 2 3.1005937993458582e-01 2.9612162404086972e+00 -8.5466839405216255e-01 diff --git a/unittest/force-styles/tests/fix-timestep-spring_chunk.yaml b/unittest/force-styles/tests/fix-timestep-spring_chunk.yaml index 66a9ff9449..266d88dc85 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_chunk.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_chunk.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 1e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-spring_couple.yaml b/unittest/force-styles/tests/fix-timestep-spring_couple.yaml index 66588fefaf..496f903c1a 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_couple.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_couple.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-spring_rg.yaml b/unittest/force-styles/tests/fix-timestep-spring_rg.yaml index fbd7e9d879..bcb672321e 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_rg.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_rg.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-spring_self.yaml b/unittest/force-styles/tests/fix-timestep-spring_self.yaml index 96755572bf..cf303b8757 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_self.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_self.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:58 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-spring_tether.yaml b/unittest/force-styles/tests/fix-timestep-spring_tether.yaml index bdb2cad1d4..d7172d3811 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_tether.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_tether.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-temp_berendsen.yaml b/unittest/force-styles/tests/fix-timestep-temp_berendsen.yaml index 7975b61a13..8b2d946782 100644 --- a/unittest/force-styles/tests/fix-timestep-temp_berendsen.yaml +++ b/unittest/force-styles/tests/fix-timestep-temp_berendsen.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-temp_csld.yaml b/unittest/force-styles/tests/fix-timestep-temp_csld.yaml index ef6535888d..a25a54e733 100644 --- a/unittest/force-styles/tests/fix-timestep-temp_csld.yaml +++ b/unittest/force-styles/tests/fix-timestep-temp_csld.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-temp_csvr.yaml b/unittest/force-styles/tests/fix-timestep-temp_csvr.yaml index 8716de39de..c66a1f2f59 100644 --- a/unittest/force-styles/tests/fix-timestep-temp_csvr.yaml +++ b/unittest/force-styles/tests/fix-timestep-temp_csvr.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 3e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-temp_rescale.yaml b/unittest/force-styles/tests/fix-timestep-temp_rescale.yaml index 6c53252d14..9cb1a096e5 100644 --- a/unittest/force-styles/tests/fix-timestep-temp_rescale.yaml +++ b/unittest/force-styles/tests/fix-timestep-temp_rescale.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml index e1de14d018..779d1b30c3 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 3e-14 prerequisites: ! | atom full @@ -17,7 +17,7 @@ run_stress: ! |2- 0.0000000000000000e+00 7.2422093200265749e+02 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 global_scalar: 42.6997744353244 global_vector: ! |- - 2 0.0 161.92409617466126 + 2 0 161.92409617466126 run_pos: ! |2 1 -2.7051715090682593e-01 2.4891718422041942e+00 -1.6687343912524535e-01 2 3.1037661579862175e-01 2.9347166386691113e+00 -8.5496435221221156e-01 diff --git a/unittest/force-styles/tests/fix-timestep-wall_lj1043_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_lj1043_const.yaml index e8be8b41a2..1bf3d793fb 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_lj1043_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_lj1043_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 5e-14 prerequisites: ! | atom full @@ -17,7 +17,7 @@ run_stress: ! |2- 0.0000000000000000e+00 -2.6193298572154652e+02 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 global_scalar: -21.0862098649006 global_vector: ! |- - 2 0.0 -57.92496787419014 + 2 0 -57.92496787419014 run_pos: ! |2 1 -2.7044985531646820e-01 2.4925110873587433e+00 -1.6698786670029320e-01 2 3.0995988119031520e-01 2.9684930337266713e+00 -8.5459207531887627e-01 diff --git a/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml index e65b582c09..9db35c4e80 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-14 prerequisites: ! | atom full @@ -17,7 +17,7 @@ run_stress: ! |2- 0.0000000000000000e+00 -3.4585143439781433e+01 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 global_scalar: -2.5475438051924 global_vector: ! |- - 2 0.0 -7.685735804480931 + 2 0 -7.685735804480931 run_pos: ! |2 1 -2.7045416679061030e-01 2.4913627730949424e+00 -1.6696242213969814e-01 2 3.1002806235873631e-01 2.9622866518897246e+00 -8.5465272505609957e-01 diff --git a/unittest/force-styles/tests/fix-timestep-wall_lj93_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_lj93_const.yaml index d1c27927a2..451ce34c0b 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_lj93_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_lj93_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:59 2021 epsilon: 2e-14 prerequisites: ! | atom full @@ -17,7 +17,7 @@ run_stress: ! |2- 0.0000000000000000e+00 -5.0602303343219951e+01 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 global_scalar: -4.10898799728224 global_vector: ! |- - 2 0.0 -11.164431050504302 + 2 0 -11.164431050504302 run_pos: ! |2 1 -2.7045470054680359e-01 2.4914748797509958e+00 -1.6696421170224640e-01 2 3.1002519717316468e-01 2.9626113274873114e+00 -8.5465020014164161e-01 diff --git a/unittest/force-styles/tests/fix-timestep-wall_morse_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_morse_const.yaml index 2b935dbf14..60261f9bfc 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_morse_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_morse_const.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:43 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:10:00 2021 epsilon: 4e-14 prerequisites: ! | atom full @@ -17,7 +17,7 @@ run_stress: ! |2- 0.0000000000000000e+00 -1.6447328969000660e+03 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 global_scalar: -715.415406257395 global_vector: ! |- - 2 0.0 -362.76807567062644 + 2 0 -362.76807567062644 run_pos: ! |2 1 -2.7045893790409276e-01 2.5008322800634093e+00 -1.6714018607090517e-01 2 3.0963184116147618e-01 3.0014595399936281e+00 -8.5430140686816214e-01 diff --git a/unittest/force-styles/tests/improper-class2.yaml b/unittest/force-styles/tests/improper-class2.yaml index a02d8276ad..2ee0feaa6b 100644 --- a/unittest/force-styles/tests/improper-class2.yaml +++ b/unittest/force-styles/tests/improper-class2.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:14 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-cossq.yaml b/unittest/force-styles/tests/improper-cossq.yaml index a4043011a3..facb268a94 100644 --- a/unittest/force-styles/tests/improper-cossq.yaml +++ b/unittest/force-styles/tests/improper-cossq.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:38:24 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-cvff.yaml b/unittest/force-styles/tests/improper-cvff.yaml index 462b7e4427..1c432a683b 100644 --- a/unittest/force-styles/tests/improper-cvff.yaml +++ b/unittest/force-styles/tests/improper-cvff.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:14 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-distance.yaml b/unittest/force-styles/tests/improper-distance.yaml index 2de3d21c73..7401dc3f42 100644 --- a/unittest/force-styles/tests/improper-distance.yaml +++ b/unittest/force-styles/tests/improper-distance.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:14 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-distharm.yaml b/unittest/force-styles/tests/improper-distharm.yaml index e07d02aace..6d2bedcb9e 100644 --- a/unittest/force-styles/tests/improper-distharm.yaml +++ b/unittest/force-styles/tests/improper-distharm.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:14 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-fourier.yaml b/unittest/force-styles/tests/improper-fourier.yaml index 0a1b801656..4c3fa1ff7e 100644 --- a/unittest/force-styles/tests/improper-fourier.yaml +++ b/unittest/force-styles/tests/improper-fourier.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-harmonic.yaml b/unittest/force-styles/tests/improper-harmonic.yaml index 5daaa0c509..e10307e3a2 100644 --- a/unittest/force-styles/tests/improper-harmonic.yaml +++ b/unittest/force-styles/tests/improper-harmonic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-hybrid.yaml b/unittest/force-styles/tests/improper-hybrid.yaml index 0f00d56909..5351cb86d4 100644 --- a/unittest/force-styles/tests/improper-hybrid.yaml +++ b/unittest/force-styles/tests/improper-hybrid.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 20:50:39 202 +date_generated: Fri Feb 26 23:09:36 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-inversion_harmonic.yaml b/unittest/force-styles/tests/improper-inversion_harmonic.yaml index 3cabd4c74a..e1fc0499a8 100644 --- a/unittest/force-styles/tests/improper-inversion_harmonic.yaml +++ b/unittest/force-styles/tests/improper-inversion_harmonic.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:37 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-ring.yaml b/unittest/force-styles/tests/improper-ring.yaml index fb2750e36c..355a2ff170 100644 --- a/unittest/force-styles/tests/improper-ring.yaml +++ b/unittest/force-styles/tests/improper-ring.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:37 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-sqdistharm.yaml b/unittest/force-styles/tests/improper-sqdistharm.yaml index ed40f1340f..e16dbde61d 100644 --- a/unittest/force-styles/tests/improper-sqdistharm.yaml +++ b/unittest/force-styles/tests/improper-sqdistharm.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:37 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-umbrella.yaml b/unittest/force-styles/tests/improper-umbrella.yaml index 85fa142b49..f049680409 100644 --- a/unittest/force-styles/tests/improper-umbrella.yaml +++ b/unittest/force-styles/tests/improper-umbrella.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:35:15 202 +date_generated: Fri Feb 26 23:09:37 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/improper-zero.yaml b/unittest/force-styles/tests/improper-zero.yaml index 9497e184e2..e082e11908 100644 --- a/unittest/force-styles/tests/improper-zero.yaml +++ b/unittest/force-styles/tests/improper-zero.yaml @@ -1,6 +1,6 @@ --- lammps_version: 10 Feb 2021 -date_generated: Wed Feb 24 19:37:56 202 +date_generated: Fri Feb 26 23:09:37 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-ewald.yaml b/unittest/force-styles/tests/kspace-ewald.yaml index b0c9e46000..f03b236aac 100644 --- a/unittest/force-styles/tests/kspace-ewald.yaml +++ b/unittest/force-styles/tests/kspace-ewald.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-ewald_disp.yaml b/unittest/force-styles/tests/kspace-ewald_disp.yaml index 0bf3fb8280..e20bdc149a 100644 --- a/unittest/force-styles/tests/kspace-ewald_disp.yaml +++ b/unittest/force-styles/tests/kspace-ewald_disp.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 5e-12 prerequisites: ! | atom full @@ -61,33 +61,33 @@ run_coul: 0 run_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 run_forces: ! |2 - 1 -1.5321369646512287e-01 3.1811336640254428e-02 -7.5291966466499854e-02 - 2 4.1718499667107591e-02 -6.0993280056077008e-02 7.1251624481841025e-02 - 3 -9.5279894353951251e-03 -1.4941462712424192e-03 -2.3308420217005594e-03 - 4 5.2578632823907109e-02 7.1842522102449641e-03 8.4623035788519083e-03 - 5 5.1098021938378535e-02 9.7285355839204727e-03 1.0253349643675837e-02 - 6 1.1944881653432865e-01 7.6133381161564387e-02 8.1359427537698162e-02 - 7 -6.3591857746436040e-02 -8.6414432169993630e-02 -7.9109433076114163e-02 - 8 -3.7433525775956008e-03 -1.0990369365284677e-01 -1.1224509664376907e-01 - 9 3.4723473525535330e-03 5.8483564454419018e-02 7.3945790434835998e-02 + 1 -1.5321369646512289e-01 3.1811336640254428e-02 -7.5291966466499868e-02 + 2 4.1718499667107597e-02 -6.0993280056077008e-02 7.1251624481841025e-02 + 3 -9.5279894353951268e-03 -1.4941462712424198e-03 -2.3308420217005594e-03 + 4 5.2578632823907102e-02 7.1842522102449641e-03 8.4623035788519083e-03 + 5 5.1098021938378528e-02 9.7285355839204779e-03 1.0253349643675840e-02 + 6 1.1944881653432862e-01 7.6133381161564415e-02 8.1359427537698162e-02 + 7 -6.3591857746436053e-02 -8.6414432169993630e-02 -7.9109433076114136e-02 + 8 -3.7433525775956017e-03 -1.0990369365284679e-01 -1.1224509664376904e-01 + 9 3.4723473525535304e-03 5.8483564454419046e-02 7.3945790434835998e-02 10 -1.9931615263391753e-02 2.3230336652331492e-02 2.2930261922462034e-02 - 11 -2.7043515997570565e-02 3.3096788353233382e-02 2.7833272909244686e-02 - 12 1.4733114619496521e-01 -7.4907012571817977e-02 -9.9310508068793157e-02 - 13 -6.0568451603864093e-02 2.6904500638990563e-02 3.7502952815534972e-02 - 14 -4.7602620526011358e-02 2.4118387991499554e-02 2.8503007637066029e-02 + 11 -2.7043515997570568e-02 3.3096788353233382e-02 2.7833272909244679e-02 + 12 1.4733114619496521e-01 -7.4907012571817991e-02 -9.9310508068793130e-02 + 13 -6.0568451603864079e-02 2.6904500638990563e-02 3.7502952815534972e-02 + 14 -4.7602620526011344e-02 2.4118387991499554e-02 2.8503007637066029e-02 15 -4.5640946475327245e-02 1.1215448404197493e-02 3.2219246480274404e-02 - 16 -2.0008038374075984e-01 1.6245819219836355e-01 1.8812371878208675e-01 - 17 1.3640979614708312e-01 -1.4877360903977560e-01 -1.3970849833566271e-01 + 16 -2.0008038374075982e-01 1.6245819219836355e-01 1.8812371878208675e-01 + 17 1.3640979614708318e-01 -1.4877360903977557e-01 -1.3970849833566271e-01 18 3.1313062271288683e-01 3.0970376465951444e-01 -2.9690888050690195e-01 - 19 -1.2278633817042253e-01 -1.5053154281354220e-01 1.1083205911757414e-01 - 20 -1.7800087923017122e-01 -1.7031941581576107e-01 1.4510467117661957e-01 + 19 -1.2278633817042250e-01 -1.5053154281354220e-01 1.1083205911757414e-01 + 20 -1.7800087923017119e-01 -1.7031941581576107e-01 1.4510467117661957e-01 21 3.5089545735563610e-01 -9.5838434134800643e-02 -2.8233685525513896e-01 - 22 -1.9415564585497339e-01 7.5645499568197841e-02 9.1631181795561512e-02 - 23 -1.4017971783984279e-01 3.7892211453094168e-02 1.1299558998235543e-01 - 24 1.7884203136981469e-01 3.1247703983741304e-01 1.4068927063619113e-01 - 25 -2.7624350380010359e-02 -1.2477864845951722e-01 -2.6147141449362275e-02 - 26 -1.3999328961714030e-01 -1.7823800630539485e-01 -8.7261723908124589e-02 - 27 -3.3286289860045476e-01 1.7647878511351975e-01 -1.8733303262234685e-01 - 28 2.1399771535404677e-01 -1.1748172155357729e-01 1.2097428314785649e-01 - 29 1.5762446207378214e-01 -5.6888082076411807e-02 8.3371966274683518e-02 + 22 -1.9415564585497344e-01 7.5645499568197813e-02 9.1631181795561525e-02 + 23 -1.4017971783984279e-01 3.7892211453094155e-02 1.1299558998235543e-01 + 24 1.7884203136981472e-01 3.1247703983741310e-01 1.4068927063619110e-01 + 25 -2.7624350380010373e-02 -1.2477864845951719e-01 -2.6147141449362272e-02 + 26 -1.3999328961714033e-01 -1.7823800630539485e-01 -8.7261723908124589e-02 + 27 -3.3286289860045476e-01 1.7647878511351969e-01 -1.8733303262234691e-01 + 28 2.1399771535404671e-01 -1.1748172155357726e-01 1.2097428314785651e-01 + 29 1.5762446207378211e-01 -5.6888082076411807e-02 8.3371966274683545e-02 ... diff --git a/unittest/force-styles/tests/kspace-ewald_nozforce.yaml b/unittest/force-styles/tests/kspace-ewald_nozforce.yaml index d18f965aba..f6c3060d3d 100644 --- a/unittest/force-styles/tests/kspace-ewald_nozforce.yaml +++ b/unittest/force-styles/tests/kspace-ewald_nozforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-ewald_slab.yaml b/unittest/force-styles/tests/kspace-ewald_slab.yaml index 6b133a663c..0df035667a 100644 --- a/unittest/force-styles/tests/kspace-ewald_slab.yaml +++ b/unittest/force-styles/tests/kspace-ewald_slab.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-ewald_tri.yaml b/unittest/force-styles/tests/kspace-ewald_tri.yaml index 4141dd0cd1..dddfe7018a 100644 --- a/unittest/force-styles/tests/kspace-ewald_tri.yaml +++ b/unittest/force-styles/tests/kspace-ewald_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:25 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-msm.yaml b/unittest/force-styles/tests/kspace-msm.yaml index ce503e0d01..f3cbb4604d 100644 --- a/unittest/force-styles/tests/kspace-msm.yaml +++ b/unittest/force-styles/tests/kspace-msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:35 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:26 2021 epsilon: 5e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-msm_cg.yaml b/unittest/force-styles/tests/kspace-msm_cg.yaml index 835b6dfe25..25892a4528 100644 --- a/unittest/force-styles/tests/kspace-msm_cg.yaml +++ b/unittest/force-styles/tests/kspace-msm_cg.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:26 2021 epsilon: 5e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-msm_nopbc.yaml b/unittest/force-styles/tests/kspace-msm_nopbc.yaml index 4d3080bcc9..ce5e3cd0e3 100644 --- a/unittest/force-styles/tests/kspace-msm_nopbc.yaml +++ b/unittest/force-styles/tests/kspace-msm_nopbc.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Wed Sep 16 23:34:54 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:27 2021 epsilon: 5e-11 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm.yaml b/unittest/force-styles/tests/kspace-pppm.yaml index 302f51280b..5282084567 100644 --- a/unittest/force-styles/tests/kspace-pppm.yaml +++ b/unittest/force-styles/tests/kspace-pppm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_ad.yaml b/unittest/force-styles/tests/kspace-pppm_ad.yaml index bdeacc50a9..3f77eb99c5 100644 --- a/unittest/force-styles/tests/kspace-pppm_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_ad.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_cg.yaml b/unittest/force-styles/tests/kspace-pppm_cg.yaml index fd892d044e..e6bb6c78f3 100644 --- a/unittest/force-styles/tests/kspace-pppm_cg.yaml +++ b/unittest/force-styles/tests/kspace-pppm_cg.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_cg_ad.yaml b/unittest/force-styles/tests/kspace-pppm_cg_ad.yaml index a8c1b364e7..a8d9efc1fa 100644 --- a/unittest/force-styles/tests/kspace-pppm_cg_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_cg_ad.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_cg_tiled.yaml b/unittest/force-styles/tests/kspace-pppm_cg_tiled.yaml index 9477bcba77..270ee0418c 100644 --- a/unittest/force-styles/tests/kspace-pppm_cg_tiled.yaml +++ b/unittest/force-styles/tests/kspace-pppm_cg_tiled.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:36 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_disp.yaml b/unittest/force-styles/tests/kspace-pppm_disp.yaml index 55243a9a68..8c528baf76 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:37 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:30 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml b/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml index 02f36588bc..4ef71d7333 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:37 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml b/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml index 6c441a3df8..203eceb209 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_disp_only.yaml b/unittest/force-styles/tests/kspace-pppm_disp_only.yaml index bd7fe74594..f0243c8da1 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_only.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_only.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml b/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml index d713c813e9..79951aab2f 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:32 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_nozforce.yaml b/unittest/force-styles/tests/kspace-pppm_nozforce.yaml index 57bb160873..7442e862e9 100644 --- a/unittest/force-styles/tests/kspace-pppm_nozforce.yaml +++ b/unittest/force-styles/tests/kspace-pppm_nozforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:32 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_slab.yaml b/unittest/force-styles/tests/kspace-pppm_slab.yaml index 8aa1adbfd7..aa1566aab5 100644 --- a/unittest/force-styles/tests/kspace-pppm_slab.yaml +++ b/unittest/force-styles/tests/kspace-pppm_slab.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:32 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_stagger.yaml b/unittest/force-styles/tests/kspace-pppm_stagger.yaml index 0e4c9631e2..ea24b6cfd3 100644 --- a/unittest/force-styles/tests/kspace-pppm_stagger.yaml +++ b/unittest/force-styles/tests/kspace-pppm_stagger.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:38 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:33 2021 epsilon: 7.5e-14 prerequisites: ! | atom full @@ -22,67 +22,67 @@ init_coul: 0 init_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 init_forces: ! |2 - 1 -5.2227715900845750e-01 8.1950519891037896e-02 2.1568864750376832e-01 + 1 -5.2227715900845739e-01 8.1950519891037882e-02 2.1568864750376829e-01 2 2.1709329984201631e-01 -2.7910826043908610e-01 -1.3501796562404628e-01 - 3 -3.4431410110235108e-02 -9.3026609475793179e-03 1.9970153652663108e-02 - 4 1.6294612553322482e-01 2.8820208915782589e-02 -7.8041537992552090e-02 - 5 1.6018614143950777e-01 7.5432356753115826e-02 -3.7722588054429150e-02 + 3 -3.4431410110235101e-02 -9.3026609475793179e-03 1.9970153652663108e-02 + 4 1.6294612553322479e-01 2.8820208915782589e-02 -7.8041537992552104e-02 + 5 1.6018614143950774e-01 7.5432356753115812e-02 -3.7722588054429143e-02 6 5.6492988309033354e-01 4.1696814706534630e-01 -6.7673476362799612e-01 - 7 -3.4216205471660566e-01 -4.0009165524095192e-01 3.9325085501474977e-01 - 8 -1.4121658810415072e-01 -6.1694926607232958e-01 3.3967088097622000e-01 + 7 -3.4216205471660560e-01 -4.0009165524095192e-01 3.9325085501474977e-01 + 8 -1.4121658810415072e-01 -6.1694926607232969e-01 3.3967088097622000e-01 9 1.8213420211015810e-01 3.2023550501078568e-01 5.0865716213608053e-02 10 -5.1659753410710330e-02 1.1063713004312387e-01 -1.4434062323990951e-02 - 11 -8.4675426404111437e-02 1.5093767469541053e-01 -3.9273222694910556e-02 - 12 4.5743278086428246e-01 -4.2657803621344026e-01 3.4765791147615285e-02 - 13 -1.5598326968651899e-01 1.1609333380277490e-01 2.6827585674639255e-02 - 14 -1.7229830712699734e-01 1.3660265515995373e-01 1.0364293545061238e-02 - 15 -1.3779624948415931e-01 8.5611514314178239e-02 -1.4417936578185790e-02 - 16 -3.4309620718952316e-01 4.3358259515061448e-01 5.3264911488862143e-01 - 17 1.3394866253126306e-01 -4.1287506953147796e-01 -7.8819987038465467e-01 - 18 7.3032854805187175e-01 1.5459002190369358e+00 -1.3876618467094484e+00 - 19 -2.5946241349817661e-01 -7.7450328984918526e-01 7.7107291114413901e-01 - 20 -3.9364379163465191e-01 -7.0318115064463305e-01 7.3145133273582563e-01 + 11 -8.4675426404111423e-02 1.5093767469541053e-01 -3.9273222694910556e-02 + 12 4.5743278086428241e-01 -4.2657803621344026e-01 3.4765791147615244e-02 + 13 -1.5598326968651899e-01 1.1609333380277490e-01 2.6827585674639266e-02 + 14 -1.7229830712699731e-01 1.3660265515995373e-01 1.0364293545061243e-02 + 15 -1.3779624948415931e-01 8.5611514314178239e-02 -1.4417936578185776e-02 + 16 -3.4309620718952311e-01 4.3358259515061459e-01 5.3264911488862143e-01 + 17 1.3394866253126297e-01 -4.1287506953147801e-01 -7.8819987038465467e-01 + 18 7.3032854805187197e-01 1.5459002190369358e+00 -1.3876618467094484e+00 + 19 -2.5946241349817667e-01 -7.7450328984918526e-01 7.7107291114413901e-01 + 20 -3.9364379163465191e-01 -7.0318115064463316e-01 7.3145133273582541e-01 21 5.1854207039779388e-01 5.4316140431986648e-01 -1.1630561612460866e+00 - 22 -2.9474924657955082e-01 -1.2314722330232061e-01 5.8311514555951505e-01 - 23 -2.8773056143507980e-01 -2.9281856868591627e-01 5.5619506923778372e-01 - 24 6.2752036539684239e-02 1.7441478631220706e+00 -2.7849000426516041e-01 - 25 1.2955239352175907e-01 -7.0427160638100861e-01 2.2582608971039136e-01 - 26 -2.2227598237037974e-01 -9.7470415379148345e-01 7.4514829391794934e-02 - 27 -8.5917766336431800e-01 1.6506499588643100e+00 -9.3704596621935576e-01 - 28 5.7091533654326099e-01 -9.1760299361767794e-01 5.4073727763352530e-01 - 29 4.1187460365847078e-01 -8.0559715142821642e-01 4.4313023169089372e-01 + 22 -2.9474924657955082e-01 -1.2314722330232067e-01 5.8311514555951494e-01 + 23 -2.8773056143507975e-01 -2.9281856868591627e-01 5.5619506923778372e-01 + 24 6.2752036539684308e-02 1.7441478631220706e+00 -2.7849000426516035e-01 + 25 1.2955239352175901e-01 -7.0427160638100861e-01 2.2582608971039136e-01 + 26 -2.2227598237037974e-01 -9.7470415379148345e-01 7.4514829391794962e-02 + 27 -8.5917766336431800e-01 1.6506499588643098e+00 -9.3704596621935576e-01 + 28 5.7091533654326088e-01 -9.1760299361767794e-01 5.4073727763352530e-01 + 29 4.1187460365847078e-01 -8.0559715142821631e-01 4.4313023169089372e-01 run_vdwl: 0 run_coul: 0 run_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 run_forces: ! |2 - 1 -5.2110389443047966e-01 8.2174837617142615e-02 2.1808851100884483e-01 - 2 2.1575362837922490e-01 -2.7985507607146648e-01 -1.3635384720562826e-01 + 1 -5.2110389443047966e-01 8.2174837617142657e-02 2.1808851100884480e-01 + 2 2.1575362837922490e-01 -2.7985507607146654e-01 -1.3635384720562826e-01 3 -3.4412499347272141e-02 -9.2851595240179864e-03 2.0082401999342678e-02 - 4 1.6309295424664277e-01 2.8699106597915747e-02 -7.8424598315124466e-02 - 5 1.6000485976650286e-01 7.5419186199252142e-02 -3.8271532199610915e-02 - 6 5.6452922927167792e-01 4.1651437288870052e-01 -6.8002099522971760e-01 - 7 -3.4234246122559975e-01 -4.0055178531012858e-01 3.9535126657784059e-01 - 8 -1.4009341296531477e-01 -6.1677431194167931e-01 3.4313561304132167e-01 - 9 1.8118627304514590e-01 3.1987212964642597e-01 4.8663680015288674e-02 - 10 -5.1826170633221855e-02 1.1075413671703493e-01 -1.4899488513243717e-02 - 11 -8.4864826013217043e-02 1.5131714121992473e-01 -3.9677764977413960e-02 - 12 4.5802321421041658e-01 -4.2663086780254944e-01 3.6737616091024911e-02 - 13 -1.5618224691804056e-01 1.1618618922421080e-01 2.6228930224266901e-02 - 14 -1.7245201237131119e-01 1.3673119094228264e-01 9.9092533250611670e-03 - 15 -1.3784363552277656e-01 8.5481154737307205e-02 -1.5195517836673982e-02 - 16 -3.4428489670225737e-01 4.3434535352096393e-01 5.3049265061272988e-01 - 17 1.3490425019990776e-01 -4.1238003101359266e-01 -7.8594268071624529e-01 - 18 7.3489377624877839e-01 1.5518891144247411e+00 -1.3833209761015994e+00 - 19 -2.6071651353161379e-01 -7.7650154707748187e-01 7.6978890572474756e-01 + 4 1.6309295424664277e-01 2.8699106597915754e-02 -7.8424598315124466e-02 + 5 1.6000485976650286e-01 7.5419186199252128e-02 -3.8271532199610915e-02 + 6 5.6452922927167803e-01 4.1651437288870052e-01 -6.8002099522971760e-01 + 7 -3.4234246122559986e-01 -4.0055178531012858e-01 3.9535126657784053e-01 + 8 -1.4009341296531477e-01 -6.1677431194167931e-01 3.4313561304132162e-01 + 9 1.8118627304514590e-01 3.1987212964642592e-01 4.8663680015288632e-02 + 10 -5.1826170633221855e-02 1.1075413671703493e-01 -1.4899488513243714e-02 + 11 -8.4864826013217043e-02 1.5131714121992476e-01 -3.9677764977413953e-02 + 12 4.5802321421041658e-01 -4.2663086780254944e-01 3.6737616091024890e-02 + 13 -1.5618224691804056e-01 1.1618618922421080e-01 2.6228930224266905e-02 + 14 -1.7245201237131119e-01 1.3673119094228264e-01 9.9092533250611705e-03 + 15 -1.3784363552277656e-01 8.5481154737307191e-02 -1.5195517836673979e-02 + 16 -3.4428489670225748e-01 4.3434535352096382e-01 5.3049265061272988e-01 + 17 1.3490425019990779e-01 -4.1238003101359261e-01 -7.8594268071624529e-01 + 18 7.3489377624877827e-01 1.5518891144247409e+00 -1.3833209761015994e+00 + 19 -2.6071651353161379e-01 -7.7650154707748176e-01 7.6978890572474756e-01 20 -3.9638127767834741e-01 -7.0644000153250031e-01 7.2935384554137617e-01 - 21 5.1893256827191392e-01 5.3441769782139692e-01 -1.1580900287803464e+00 - 22 -2.9449738462629443e-01 -1.1887047311705630e-01 5.8095962163225279e-01 + 21 5.1893256827191392e-01 5.3441769782139703e-01 -1.1580900287803464e+00 + 22 -2.9449738462629454e-01 -1.1887047311705637e-01 5.8095962163225279e-01 23 -2.8790115407696282e-01 -2.8923985224095883e-01 5.5380720899811053e-01 - 24 6.4191177940294664e-02 1.7394984516077767e+00 -2.7670608704288824e-01 - 25 1.2835128052019390e-01 -7.0221042172703485e-01 2.2447137762053931e-01 - 26 -2.2247931035350960e-01 -9.7223221992333508e-01 7.3515699476410554e-02 - 27 -8.6026914570906921e-01 1.6503940402012782e+00 -9.3240873788746348e-01 - 28 5.7146552243716164e-01 -9.1711088161406329e-01 5.3820268912067859e-01 - 29 4.1232210756742665e-01 -8.0561147447049097e-01 4.4052298379611776e-01 + 24 6.4191177940294691e-02 1.7394984516077767e+00 -2.7670608704288829e-01 + 25 1.2835128052019393e-01 -7.0221042172703474e-01 2.2447137762053931e-01 + 26 -2.2247931035350965e-01 -9.7223221992333508e-01 7.3515699476410554e-02 + 27 -8.6026914570906943e-01 1.6503940402012782e+00 -9.3240873788746348e-01 + 28 5.7146552243716164e-01 -9.1711088161406340e-01 5.3820268912067859e-01 + 29 4.1232210756742671e-01 -8.0561147447049097e-01 4.4052298379611776e-01 ... diff --git a/unittest/force-styles/tests/kspace-pppm_stagger_tiled.yaml b/unittest/force-styles/tests/kspace-pppm_stagger_tiled.yaml index c38767f900..cb8ba3813e 100644 --- a/unittest/force-styles/tests/kspace-pppm_stagger_tiled.yaml +++ b/unittest/force-styles/tests/kspace-pppm_stagger_tiled.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:33 2021 epsilon: 7.5e-14 prerequisites: ! | atom full @@ -24,67 +24,67 @@ init_coul: 0 init_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 init_forces: ! |2 - 1 -5.2227715900845750e-01 8.1950519891037896e-02 2.1568864750376832e-01 + 1 -5.2227715900845739e-01 8.1950519891037882e-02 2.1568864750376829e-01 2 2.1709329984201631e-01 -2.7910826043908610e-01 -1.3501796562404628e-01 - 3 -3.4431410110235108e-02 -9.3026609475793179e-03 1.9970153652663108e-02 - 4 1.6294612553322482e-01 2.8820208915782589e-02 -7.8041537992552090e-02 - 5 1.6018614143950777e-01 7.5432356753115826e-02 -3.7722588054429150e-02 + 3 -3.4431410110235101e-02 -9.3026609475793179e-03 1.9970153652663108e-02 + 4 1.6294612553322479e-01 2.8820208915782589e-02 -7.8041537992552104e-02 + 5 1.6018614143950774e-01 7.5432356753115812e-02 -3.7722588054429143e-02 6 5.6492988309033354e-01 4.1696814706534630e-01 -6.7673476362799612e-01 - 7 -3.4216205471660566e-01 -4.0009165524095192e-01 3.9325085501474977e-01 - 8 -1.4121658810415072e-01 -6.1694926607232958e-01 3.3967088097622000e-01 + 7 -3.4216205471660560e-01 -4.0009165524095192e-01 3.9325085501474977e-01 + 8 -1.4121658810415072e-01 -6.1694926607232969e-01 3.3967088097622000e-01 9 1.8213420211015810e-01 3.2023550501078568e-01 5.0865716213608053e-02 10 -5.1659753410710330e-02 1.1063713004312387e-01 -1.4434062323990951e-02 - 11 -8.4675426404111437e-02 1.5093767469541053e-01 -3.9273222694910556e-02 - 12 4.5743278086428246e-01 -4.2657803621344026e-01 3.4765791147615285e-02 - 13 -1.5598326968651899e-01 1.1609333380277490e-01 2.6827585674639255e-02 - 14 -1.7229830712699734e-01 1.3660265515995373e-01 1.0364293545061238e-02 - 15 -1.3779624948415931e-01 8.5611514314178239e-02 -1.4417936578185790e-02 - 16 -3.4309620718952316e-01 4.3358259515061448e-01 5.3264911488862143e-01 - 17 1.3394866253126306e-01 -4.1287506953147796e-01 -7.8819987038465467e-01 - 18 7.3032854805187175e-01 1.5459002190369358e+00 -1.3876618467094484e+00 - 19 -2.5946241349817661e-01 -7.7450328984918526e-01 7.7107291114413901e-01 - 20 -3.9364379163465191e-01 -7.0318115064463305e-01 7.3145133273582563e-01 + 11 -8.4675426404111423e-02 1.5093767469541053e-01 -3.9273222694910556e-02 + 12 4.5743278086428241e-01 -4.2657803621344026e-01 3.4765791147615244e-02 + 13 -1.5598326968651899e-01 1.1609333380277490e-01 2.6827585674639266e-02 + 14 -1.7229830712699731e-01 1.3660265515995373e-01 1.0364293545061243e-02 + 15 -1.3779624948415931e-01 8.5611514314178239e-02 -1.4417936578185776e-02 + 16 -3.4309620718952311e-01 4.3358259515061459e-01 5.3264911488862143e-01 + 17 1.3394866253126297e-01 -4.1287506953147801e-01 -7.8819987038465467e-01 + 18 7.3032854805187197e-01 1.5459002190369358e+00 -1.3876618467094484e+00 + 19 -2.5946241349817667e-01 -7.7450328984918526e-01 7.7107291114413901e-01 + 20 -3.9364379163465191e-01 -7.0318115064463316e-01 7.3145133273582541e-01 21 5.1854207039779388e-01 5.4316140431986648e-01 -1.1630561612460866e+00 - 22 -2.9474924657955082e-01 -1.2314722330232061e-01 5.8311514555951505e-01 - 23 -2.8773056143507980e-01 -2.9281856868591627e-01 5.5619506923778372e-01 - 24 6.2752036539684239e-02 1.7441478631220706e+00 -2.7849000426516041e-01 - 25 1.2955239352175907e-01 -7.0427160638100861e-01 2.2582608971039136e-01 - 26 -2.2227598237037974e-01 -9.7470415379148345e-01 7.4514829391794934e-02 - 27 -8.5917766336431800e-01 1.6506499588643100e+00 -9.3704596621935576e-01 - 28 5.7091533654326099e-01 -9.1760299361767794e-01 5.4073727763352530e-01 - 29 4.1187460365847078e-01 -8.0559715142821642e-01 4.4313023169089372e-01 + 22 -2.9474924657955082e-01 -1.2314722330232067e-01 5.8311514555951494e-01 + 23 -2.8773056143507975e-01 -2.9281856868591627e-01 5.5619506923778372e-01 + 24 6.2752036539684308e-02 1.7441478631220706e+00 -2.7849000426516035e-01 + 25 1.2955239352175901e-01 -7.0427160638100861e-01 2.2582608971039136e-01 + 26 -2.2227598237037974e-01 -9.7470415379148345e-01 7.4514829391794962e-02 + 27 -8.5917766336431800e-01 1.6506499588643098e+00 -9.3704596621935576e-01 + 28 5.7091533654326088e-01 -9.1760299361767794e-01 5.4073727763352530e-01 + 29 4.1187460365847078e-01 -8.0559715142821631e-01 4.4313023169089372e-01 run_vdwl: 0 run_coul: 0 run_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 run_forces: ! |2 - 1 -5.2110389443047966e-01 8.2174837617142615e-02 2.1808851100884483e-01 - 2 2.1575362837922490e-01 -2.7985507607146648e-01 -1.3635384720562826e-01 + 1 -5.2110389443047966e-01 8.2174837617142657e-02 2.1808851100884480e-01 + 2 2.1575362837922490e-01 -2.7985507607146654e-01 -1.3635384720562826e-01 3 -3.4412499347272141e-02 -9.2851595240179864e-03 2.0082401999342678e-02 - 4 1.6309295424664277e-01 2.8699106597915747e-02 -7.8424598315124466e-02 - 5 1.6000485976650286e-01 7.5419186199252142e-02 -3.8271532199610915e-02 - 6 5.6452922927167792e-01 4.1651437288870052e-01 -6.8002099522971760e-01 - 7 -3.4234246122559975e-01 -4.0055178531012858e-01 3.9535126657784059e-01 - 8 -1.4009341296531477e-01 -6.1677431194167931e-01 3.4313561304132167e-01 - 9 1.8118627304514590e-01 3.1987212964642597e-01 4.8663680015288674e-02 - 10 -5.1826170633221855e-02 1.1075413671703493e-01 -1.4899488513243717e-02 - 11 -8.4864826013217043e-02 1.5131714121992473e-01 -3.9677764977413960e-02 - 12 4.5802321421041658e-01 -4.2663086780254944e-01 3.6737616091024911e-02 - 13 -1.5618224691804056e-01 1.1618618922421080e-01 2.6228930224266901e-02 - 14 -1.7245201237131119e-01 1.3673119094228264e-01 9.9092533250611670e-03 - 15 -1.3784363552277656e-01 8.5481154737307205e-02 -1.5195517836673982e-02 - 16 -3.4428489670225737e-01 4.3434535352096393e-01 5.3049265061272988e-01 - 17 1.3490425019990776e-01 -4.1238003101359266e-01 -7.8594268071624529e-01 - 18 7.3489377624877839e-01 1.5518891144247411e+00 -1.3833209761015994e+00 - 19 -2.6071651353161379e-01 -7.7650154707748187e-01 7.6978890572474756e-01 + 4 1.6309295424664277e-01 2.8699106597915754e-02 -7.8424598315124466e-02 + 5 1.6000485976650286e-01 7.5419186199252128e-02 -3.8271532199610915e-02 + 6 5.6452922927167803e-01 4.1651437288870052e-01 -6.8002099522971760e-01 + 7 -3.4234246122559986e-01 -4.0055178531012858e-01 3.9535126657784053e-01 + 8 -1.4009341296531477e-01 -6.1677431194167931e-01 3.4313561304132162e-01 + 9 1.8118627304514590e-01 3.1987212964642592e-01 4.8663680015288632e-02 + 10 -5.1826170633221855e-02 1.1075413671703493e-01 -1.4899488513243714e-02 + 11 -8.4864826013217043e-02 1.5131714121992476e-01 -3.9677764977413953e-02 + 12 4.5802321421041658e-01 -4.2663086780254944e-01 3.6737616091024890e-02 + 13 -1.5618224691804056e-01 1.1618618922421080e-01 2.6228930224266905e-02 + 14 -1.7245201237131119e-01 1.3673119094228264e-01 9.9092533250611705e-03 + 15 -1.3784363552277656e-01 8.5481154737307191e-02 -1.5195517836673979e-02 + 16 -3.4428489670225748e-01 4.3434535352096382e-01 5.3049265061272988e-01 + 17 1.3490425019990779e-01 -4.1238003101359261e-01 -7.8594268071624529e-01 + 18 7.3489377624877827e-01 1.5518891144247409e+00 -1.3833209761015994e+00 + 19 -2.6071651353161379e-01 -7.7650154707748176e-01 7.6978890572474756e-01 20 -3.9638127767834741e-01 -7.0644000153250031e-01 7.2935384554137617e-01 - 21 5.1893256827191392e-01 5.3441769782139692e-01 -1.1580900287803464e+00 - 22 -2.9449738462629443e-01 -1.1887047311705630e-01 5.8095962163225279e-01 + 21 5.1893256827191392e-01 5.3441769782139703e-01 -1.1580900287803464e+00 + 22 -2.9449738462629454e-01 -1.1887047311705637e-01 5.8095962163225279e-01 23 -2.8790115407696282e-01 -2.8923985224095883e-01 5.5380720899811053e-01 - 24 6.4191177940294664e-02 1.7394984516077767e+00 -2.7670608704288824e-01 - 25 1.2835128052019390e-01 -7.0221042172703485e-01 2.2447137762053931e-01 - 26 -2.2247931035350960e-01 -9.7223221992333508e-01 7.3515699476410554e-02 - 27 -8.6026914570906921e-01 1.6503940402012782e+00 -9.3240873788746348e-01 - 28 5.7146552243716164e-01 -9.1711088161406329e-01 5.3820268912067859e-01 - 29 4.1232210756742665e-01 -8.0561147447049097e-01 4.4052298379611776e-01 + 24 6.4191177940294691e-02 1.7394984516077767e+00 -2.7670608704288829e-01 + 25 1.2835128052019393e-01 -7.0221042172703474e-01 2.2447137762053931e-01 + 26 -2.2247931035350965e-01 -9.7223221992333508e-01 7.3515699476410554e-02 + 27 -8.6026914570906943e-01 1.6503940402012782e+00 -9.3240873788746348e-01 + 28 5.7146552243716164e-01 -9.1711088161406340e-01 5.3820268912067859e-01 + 29 4.1232210756742671e-01 -8.0561147447049097e-01 4.4052298379611776e-01 ... diff --git a/unittest/force-styles/tests/kspace-pppm_tiled.yaml b/unittest/force-styles/tests/kspace-pppm_tiled.yaml index 769826d7c6..d1b95c8ca9 100644 --- a/unittest/force-styles/tests/kspace-pppm_tiled.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tiled.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:33 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p.yaml index 8efbeef010..f5785b54d7 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:33 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml index e2a644a7b2..66404f39b5 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 3e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p_nozforce.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p_nozforce.yaml index f214cd1644..846e1a8605 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p_nozforce.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p_nozforce.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p_slab.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p_slab.yaml index b64d7db0f6..35a8ef56f5 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p_slab.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p_slab.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-pppm_tri.yaml b/unittest/force-styles/tests/kspace-pppm_tri.yaml index effcc73b4c..dbcbe44e52 100644 --- a/unittest/force-styles/tests/kspace-pppm_tri.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tri.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:39 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:34 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/manybody-pair-airebo.yaml b/unittest/force-styles/tests/manybody-pair-airebo.yaml index f78643e7d0..58c81fb093 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:10 2021 epsilon: 5e-06 prerequisites: ! | pair airebo diff --git a/unittest/force-styles/tests/manybody-pair-airebo_00.yaml b/unittest/force-styles/tests/manybody-pair-airebo_00.yaml index 1444fed8a2..aa9aea8ca9 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_00.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_00.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:27 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:11 2021 epsilon: 1e-07 prerequisites: ! | pair airebo diff --git a/unittest/force-styles/tests/manybody-pair-airebo_m.yaml b/unittest/force-styles/tests/manybody-pair-airebo_m.yaml index 84df99a6a8..ae1e670cea 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_m.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_m.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:28 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:11 2021 epsilon: 1e-07 prerequisites: ! | pair airebo/morse diff --git a/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml b/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml index e1a365c5bd..eecfd2a08e 100644 --- a/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml +++ b/unittest/force-styles/tests/manybody-pair-airebo_m00.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:28 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:11 2021 epsilon: 1e-07 prerequisites: ! | pair airebo/morse diff --git a/unittest/force-styles/tests/manybody-pair-bop.yaml b/unittest/force-styles/tests/manybody-pair-bop.yaml index 40ca463a5e..0ce8d31d46 100644 --- a/unittest/force-styles/tests/manybody-pair-bop.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:28 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:12 2021 epsilon: 1e-12 prerequisites: ! | pair bop diff --git a/unittest/force-styles/tests/manybody-pair-bop_save.yaml b/unittest/force-styles/tests/manybody-pair-bop_save.yaml index 957476f4eb..1b1d1274a5 100644 --- a/unittest/force-styles/tests/manybody-pair-bop_save.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop_save.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:29 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:13 2021 epsilon: 1e-12 prerequisites: ! | pair bop diff --git a/unittest/force-styles/tests/manybody-pair-comb.yaml b/unittest/force-styles/tests/manybody-pair-comb.yaml index 1b2e0b5c0c..d41aa476db 100644 --- a/unittest/force-styles/tests/manybody-pair-comb.yaml +++ b/unittest/force-styles/tests/manybody-pair-comb.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:29 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:14 2021 epsilon: 1e-12 prerequisites: ! | pair comb diff --git a/unittest/force-styles/tests/manybody-pair-comb3.yaml b/unittest/force-styles/tests/manybody-pair-comb3.yaml index 49e07069dc..2238108055 100644 --- a/unittest/force-styles/tests/manybody-pair-comb3.yaml +++ b/unittest/force-styles/tests/manybody-pair-comb3.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:29 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:14 2021 epsilon: 1e-13 prerequisites: ! | pair comb3 diff --git a/unittest/force-styles/tests/manybody-pair-edip_multi.yaml b/unittest/force-styles/tests/manybody-pair-edip_multi.yaml index 1f12c9955a..ad2dc9018e 100644 --- a/unittest/force-styles/tests/manybody-pair-edip_multi.yaml +++ b/unittest/force-styles/tests/manybody-pair-edip_multi.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:29 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 5e-14 prerequisites: ! | pair edip/multi diff --git a/unittest/force-styles/tests/manybody-pair-extep.yaml b/unittest/force-styles/tests/manybody-pair-extep.yaml index 21c02745ab..ec69217b4a 100644 --- a/unittest/force-styles/tests/manybody-pair-extep.yaml +++ b/unittest/force-styles/tests/manybody-pair-extep.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:29 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 5e-13 prerequisites: ! | pair extep diff --git a/unittest/force-styles/tests/manybody-pair-gw.yaml b/unittest/force-styles/tests/manybody-pair-gw.yaml index d3455dac5b..94a2db51a4 100644 --- a/unittest/force-styles/tests/manybody-pair-gw.yaml +++ b/unittest/force-styles/tests/manybody-pair-gw.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 5e-13 prerequisites: ! | pair gw diff --git a/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml b/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml index 1d4fc81229..bdda7df922 100644 --- a/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml +++ b/unittest/force-styles/tests/manybody-pair-gw_zbl.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 5e-13 prerequisites: ! | pair gw/zbl diff --git a/unittest/force-styles/tests/manybody-pair-lcbop.yaml b/unittest/force-styles/tests/manybody-pair-lcbop.yaml index be2f18a176..5c406b2315 100644 --- a/unittest/force-styles/tests/manybody-pair-lcbop.yaml +++ b/unittest/force-styles/tests/manybody-pair-lcbop.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 7.5e-12 prerequisites: ! | pair lcbop diff --git a/unittest/force-styles/tests/manybody-pair-meam_c.yaml b/unittest/force-styles/tests/manybody-pair-meam_c.yaml index b1cb051fa7..e2867c4dd6 100644 --- a/unittest/force-styles/tests/manybody-pair-meam_c.yaml +++ b/unittest/force-styles/tests/manybody-pair-meam_c.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 7.5e-12 prerequisites: ! | pair meam/c diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml index e6bef38ab6..3650405db1 100644 --- a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:15 2021 epsilon: 5e-13 prerequisites: ! | pair mliap @@ -20,7 +20,7 @@ natoms: 64 init_vdwl: -473.569864629026 init_coul: 0 init_stress: ! |2- - 3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184845e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00 + 3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184823e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00 init_forces: ! |2 1 -3.7538180163781538e+00 8.8612947043788708e+00 6.7712977816732263e+00 2 -7.6696525239232596e+00 -3.7674335682223203e-01 -5.7958054718422760e+00 @@ -28,7 +28,7 @@ init_forces: ! |2 4 -4.7103509354198474e+00 9.2783458784125941e+00 4.3108702582741429e+00 5 -2.0331946400488916e+00 -2.9593716047756180e+00 -1.6136351145373196e+00 6 1.8086748683348572e+00 4.6479727629048675e+00 3.0425695895915184e-01 - 7 -3.0573043543220644e+00 -4.0575899915120281e+00 1.5283788878527900e+00 + 7 -3.0573043543220644e+00 -4.0575899915120264e+00 1.5283788878527900e+00 8 2.7148403621334427e-01 1.3063473238306007e+00 -1.1268098385676173e+00 9 5.2043326273129953e-01 -2.9340446386399996e+00 -7.6461969078455834e+00 10 -6.2786875145099508e-01 5.6606570005199308e-02 -5.3746300485699576e+00 @@ -64,11 +64,11 @@ init_forces: ! |2 40 9.5193696695210637e+00 -7.0213638399035432e+00 -1.5692669012530696e+00 41 2.4000089474497699e-01 1.0045144396502914e+00 -2.3032449685213630e+00 42 -9.4741999244791426e+00 -6.3134658287662750e+00 -3.6928028439517893e+00 - 43 2.7218639962411773e-01 -1.3813634477251096e+01 5.5147832931992202e-01 + 43 2.7218639962411728e-01 -1.3813634477251096e+01 5.5147832931992291e-01 44 8.0196107396135208e+00 -8.1793730426384545e+00 3.5131695854462590e+00 45 -1.8910274064701343e-01 3.9137627573846219e+00 -7.4450993876429399e+00 46 -3.5282857552811575e+00 -5.1713579630178099e+00 1.2477491203990510e+01 - 47 5.1131478665605341e+00 2.3800985688973468e+00 5.1348001359881987e+00 + 47 5.1131478665605341e+00 2.3800985688973459e+00 5.1348001359881970e+00 48 2.1755560727357057e+00 2.9996491762493216e+00 -9.9575511910097214e-01 49 -2.3978299788760209e+00 -1.2283692236805253e+01 -8.3755937565454435e+00 50 3.6161933080447888e+00 5.6291551969069182e+00 -6.9709721613230968e-01 diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml index 7429d09b91..99f36d8c65 100644 --- a/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:30 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:16 2021 epsilon: 5e-13 prerequisites: ! | pair mliap @@ -31,7 +31,7 @@ init_forces: ! |2 3 6.2372158338858297e-01 2.7149161557212836e-01 -4.8035793806964550e-01 4 -2.0337936615474277e+00 2.9491894607511560e+00 9.8066478014365177e-01 5 -1.9807302026626274e+00 -4.1921845197039964e-01 -3.9514999290884223e-01 - 6 -1.0256636650332082e-01 2.3662295416638282e+00 9.0816298775387960e-01 + 6 -1.0256636650332038e-01 2.3662295416638282e+00 9.0816298775387960e-01 7 -6.0657120592984892e-01 -8.0634286798072863e-01 2.1759740426498744e+00 8 6.0627276316787593e-01 1.0677577347039506e+00 -1.2887262448970753e+00 9 -3.0674852805673963e-01 -2.0605633540913679e+00 -2.5500662803249239e+00 @@ -56,7 +56,7 @@ init_forces: ! |2 28 2.5221087546187970e-01 1.4370172575472946e+00 4.1039332214108297e+00 29 -2.7893073887365909e+00 7.8106446652879402e-01 -8.2039261846997913e-01 30 -1.8694503114341463e+00 7.0812686858707219e-01 -9.1751940639239238e-01 - 31 -7.0985766256762606e-01 8.6963471463259756e-01 -7.5188557225015407e-01 + 31 -7.0985766256762606e-01 8.6963471463259845e-01 -7.5188557225015407e-01 32 -2.4089849337056686e+00 4.0992982351371343e-01 -1.1381600041412354e-01 33 4.3597028481189950e+00 -2.6773596435480469e+00 3.1791467867699659e+00 34 5.1607419486495609e-01 1.3141798772668656e-01 8.7023229642897881e-02 diff --git a/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml b/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml index 06ee4441bb..1eef3f085b 100644 --- a/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml +++ b/unittest/force-styles/tests/manybody-pair-nb3b_harmonic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:31 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:17 2021 epsilon: 1e-12 prerequisites: ! | pair nb3b/harmonic diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml index 9f06a83959..c06d51d907 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:31 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:17 2021 epsilon: 4e-12 prerequisites: ! | pair polymorphic diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml index 568363e7dd..b45c0e4295 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:31 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:17 2021 epsilon: 1e-11 prerequisites: ! | pair polymorphic diff --git a/unittest/force-styles/tests/manybody-pair-rebo.yaml b/unittest/force-styles/tests/manybody-pair-rebo.yaml index 0d8a7fa11a..cba66272c3 100644 --- a/unittest/force-styles/tests/manybody-pair-rebo.yaml +++ b/unittest/force-styles/tests/manybody-pair-rebo.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:31 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:18 2021 epsilon: 1e-07 prerequisites: ! | pair rebo diff --git a/unittest/force-styles/tests/manybody-pair-snap.yaml b/unittest/force-styles/tests/manybody-pair-snap.yaml index 3624630ae8..139d1b94d0 100644 --- a/unittest/force-styles/tests/manybody-pair-snap.yaml +++ b/unittest/force-styles/tests/manybody-pair-snap.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:31 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:18 2021 epsilon: 5e-13 prerequisites: ! | pair snap @@ -19,7 +19,7 @@ natoms: 64 init_vdwl: -473.569864629026 init_coul: 0 init_stress: ! |2- - 3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184845e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00 + 3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184823e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00 init_forces: ! |2 1 -3.7538180163781538e+00 8.8612947043788708e+00 6.7712977816732263e+00 2 -7.6696525239232596e+00 -3.7674335682223203e-01 -5.7958054718422760e+00 @@ -27,7 +27,7 @@ init_forces: ! |2 4 -4.7103509354198474e+00 9.2783458784125941e+00 4.3108702582741429e+00 5 -2.0331946400488916e+00 -2.9593716047756180e+00 -1.6136351145373196e+00 6 1.8086748683348572e+00 4.6479727629048675e+00 3.0425695895915184e-01 - 7 -3.0573043543220644e+00 -4.0575899915120281e+00 1.5283788878527900e+00 + 7 -3.0573043543220644e+00 -4.0575899915120264e+00 1.5283788878527900e+00 8 2.7148403621334427e-01 1.3063473238306007e+00 -1.1268098385676173e+00 9 5.2043326273129953e-01 -2.9340446386399996e+00 -7.6461969078455834e+00 10 -6.2786875145099508e-01 5.6606570005199308e-02 -5.3746300485699576e+00 @@ -63,11 +63,11 @@ init_forces: ! |2 40 9.5193696695210637e+00 -7.0213638399035432e+00 -1.5692669012530696e+00 41 2.4000089474497699e-01 1.0045144396502914e+00 -2.3032449685213630e+00 42 -9.4741999244791426e+00 -6.3134658287662750e+00 -3.6928028439517893e+00 - 43 2.7218639962411773e-01 -1.3813634477251096e+01 5.5147832931992202e-01 + 43 2.7218639962411728e-01 -1.3813634477251096e+01 5.5147832931992291e-01 44 8.0196107396135208e+00 -8.1793730426384545e+00 3.5131695854462590e+00 45 -1.8910274064701343e-01 3.9137627573846219e+00 -7.4450993876429399e+00 46 -3.5282857552811575e+00 -5.1713579630178099e+00 1.2477491203990510e+01 - 47 5.1131478665605341e+00 2.3800985688973468e+00 5.1348001359881987e+00 + 47 5.1131478665605341e+00 2.3800985688973459e+00 5.1348001359881970e+00 48 2.1755560727357057e+00 2.9996491762493216e+00 -9.9575511910097214e-01 49 -2.3978299788760209e+00 -1.2283692236805253e+01 -8.3755937565454435e+00 50 3.6161933080447888e+00 5.6291551969069182e+00 -6.9709721613230968e-01 diff --git a/unittest/force-styles/tests/manybody-pair-snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml index f441535138..39d2abd804 100644 --- a/unittest/force-styles/tests/manybody-pair-snap_chem.yaml +++ b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:18 2021 epsilon: 5e-13 prerequisites: ! | pair snap @@ -28,7 +28,7 @@ init_forces: ! |2 3 6.2372158338858297e-01 2.7149161557212836e-01 -4.8035793806964550e-01 4 -2.0337936615474277e+00 2.9491894607511560e+00 9.8066478014365177e-01 5 -1.9807302026626274e+00 -4.1921845197039964e-01 -3.9514999290884223e-01 - 6 -1.0256636650332082e-01 2.3662295416638282e+00 9.0816298775387960e-01 + 6 -1.0256636650332038e-01 2.3662295416638282e+00 9.0816298775387960e-01 7 -6.0657120592984892e-01 -8.0634286798072863e-01 2.1759740426498744e+00 8 6.0627276316787593e-01 1.0677577347039506e+00 -1.2887262448970753e+00 9 -3.0674852805673963e-01 -2.0605633540913679e+00 -2.5500662803249239e+00 @@ -53,7 +53,7 @@ init_forces: ! |2 28 2.5221087546187970e-01 1.4370172575472946e+00 4.1039332214108297e+00 29 -2.7893073887365909e+00 7.8106446652879402e-01 -8.2039261846997913e-01 30 -1.8694503114341463e+00 7.0812686858707219e-01 -9.1751940639239238e-01 - 31 -7.0985766256762606e-01 8.6963471463259756e-01 -7.5188557225015407e-01 + 31 -7.0985766256762606e-01 8.6963471463259845e-01 -7.5188557225015407e-01 32 -2.4089849337056686e+00 4.0992982351371343e-01 -1.1381600041412354e-01 33 4.3597028481189950e+00 -2.6773596435480469e+00 3.1791467867699659e+00 34 5.1607419486495609e-01 1.3141798772668656e-01 8.7023229642897881e-02 diff --git a/unittest/force-styles/tests/manybody-pair-sw-multi.yaml b/unittest/force-styles/tests/manybody-pair-sw-multi.yaml index 3816e43dd0..a1be280af9 100644 --- a/unittest/force-styles/tests/manybody-pair-sw-multi.yaml +++ b/unittest/force-styles/tests/manybody-pair-sw-multi.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:19 2021 epsilon: 2e-08 prerequisites: ! | pair sw diff --git a/unittest/force-styles/tests/manybody-pair-sw.yaml b/unittest/force-styles/tests/manybody-pair-sw.yaml index 8a5bb3bf1a..92ac300c40 100644 --- a/unittest/force-styles/tests/manybody-pair-sw.yaml +++ b/unittest/force-styles/tests/manybody-pair-sw.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:19 2021 epsilon: 1e-10 prerequisites: ! | pair sw diff --git a/unittest/force-styles/tests/manybody-pair-tersoff.yaml b/unittest/force-styles/tests/manybody-pair-tersoff.yaml index 1b8af70661..366810b84e 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-13 prerequisites: ! | pair tersoff @@ -17,139 +17,139 @@ natoms: 64 init_vdwl: -163.150573313048 init_coul: 0 init_stress: ! |- - -5.4897530176832697e+02 -5.4663450719170669e+02 -5.6139257517016426e+02 -1.4199304590474418e+01 -1.3994570965097115e+01 5.4389605871425246e+01 + -5.4897530176832686e+02 -5.4663450719170669e+02 -5.6139257517016438e+02 -1.4199304590474304e+01 -1.3994570965097115e+01 5.4389605871425204e+01 init_forces: ! |2 - 1 -8.1912892931149894e+00 7.5887354282236608e-01 -1.2625078865710950e+00 + 1 -8.1912892931149894e+00 7.5887354282236519e-01 -1.2625078865710941e+00 2 2.9602498712671452e+00 -1.0588320544842651e+01 1.1519772530615358e+00 - 3 1.9949098978773105e-01 3.3201790603073089e+00 -1.2360541799328186e+00 - 4 7.6414578298653435e-01 4.0213523942979013e-01 9.4797175075936373e+00 + 3 1.9949098978772928e-01 3.3201790603073089e+00 -1.2360541799328195e+00 + 4 7.6414578298653524e-01 4.0213523942979190e-01 9.4797175075936355e+00 5 4.1945116087801502e+00 4.0211675202040693e+00 6.4807220477828054e+00 - 6 6.6450126498528483e+00 -3.3655099236048991e+00 2.4183675473801021e+00 - 7 -4.5091473605325696e+00 -7.7672528121795326e+00 -5.4811778043718888e+00 - 8 -3.4780857052968415e+00 -4.5196373264239198e-01 -3.4348484485387509e-01 - 9 -1.3829126879378810e+01 3.3400779631917277e-01 8.3332691135051706e-01 - 10 -4.6448721480660096e+00 2.1918975237587448e+00 -4.2071718234681317e+00 - 11 2.7312864224296671e+00 4.0287946263367500e+00 8.9204658499239251e+00 + 6 6.6450126498528475e+00 -3.3655099236048982e+00 2.4183675473801003e+00 + 7 -4.5091473605325678e+00 -7.7672528121795308e+00 -5.4811778043718888e+00 + 8 -3.4780857052968406e+00 -4.5196373264239553e-01 -3.4348484485387243e-01 + 9 -1.3829126879378810e+01 3.3400779631917366e-01 8.3332691135051618e-01 + 10 -4.6448721480660113e+00 2.1918975237587466e+00 -4.2071718234681317e+00 + 11 2.7312864224296662e+00 4.0287946263367500e+00 8.9204658499239251e+00 12 7.8751891700625904e+00 -7.7186307214801797e+00 -5.2791439019701114e+00 - 13 -1.5858309992357273e+00 -2.3812819396093934e+00 1.2460555338797787e+00 - 14 6.2686278379542264e+00 2.5996877962621214e+00 -7.3065539727817423e+00 + 13 -1.5858309992357265e+00 -2.3812819396093947e+00 1.2460555338797792e+00 + 14 6.2686278379542255e+00 2.5996877962621214e+00 -7.3065539727817423e+00 15 -4.3326311771962445e-02 -6.0170386352470562e-01 -1.0129825989425537e+01 16 -7.2727057172127685e+00 6.4043826683606628e+00 3.5171698455744105e+00 17 9.5539951969070547e+00 2.6379654076395345e+00 5.0065343169077945e+00 - 18 -3.9214285985710289e+00 -3.3891469739812172e+00 3.2978277630465125e+00 + 18 -3.9214285985710298e+00 -3.3891469739812190e+00 3.2978277630465143e+00 19 5.2752276712922141e-01 -5.0346196994826009e+00 -7.2649963109726121e+00 20 3.3539383489473220e+00 -3.4277977518290026e-01 5.8115196917869794e-01 - 21 -3.2053627402696465e+00 -9.8463742292726408e+00 1.2907611413251274e+00 + 21 -3.2053627402696447e+00 -9.8463742292726408e+00 1.2907611413251265e+00 22 7.4683659037949859e+00 5.0663391168235794e+00 -7.7210795150894302e+00 23 7.0209510094956986e+00 -8.2134652397570367e+00 4.8499600596081835e+00 24 4.1068542205309111e+00 7.3847751157925199e+00 2.2530249788791874e+00 - 25 -3.9317998834815548e+00 -2.5156019711898603e+00 -7.5848748129221573e+00 + 25 -3.9317998834815540e+00 -2.5156019711898585e+00 -7.5848748129221573e+00 26 9.6130868394163904e-01 4.2613891391897135e-01 -6.2159492546416457e+00 27 3.1192079889978230e+00 -6.5362208060545628e+00 1.2268964071865918e+00 - 28 -6.0381257391328775e+00 -5.1923165377355414e+00 2.9595508172547853e+00 + 28 -6.0381257391328775e+00 -5.1923165377355396e+00 2.9595508172547853e+00 29 3.6213632449475486e+00 7.9953345033105618e+00 -2.4577107962677385e+00 - 30 9.3099853021452930e+00 -4.1372759628053686e+00 2.4543788703785023e+00 - 31 7.3989572826939201e+00 -4.1718610802469280e+00 -8.0314138211966313e-01 - 32 7.4385441920429161e+00 4.0458707919489969e+00 -3.4391127020935182e+00 + 30 9.3099853021452930e+00 -4.1372759628053686e+00 2.4543788703785041e+00 + 31 7.3989572826939192e+00 -4.1718610802469271e+00 -8.0314138211966402e-01 + 32 7.4385441920429178e+00 4.0458707919489978e+00 -3.4391127020935190e+00 33 -7.6856588792542304e+00 -5.2818796645272048e+00 4.5261033372808726e+00 34 1.4341383089365500e-02 1.9309480517379565e+00 -5.5943902542352966e+00 - 35 -2.0808410967907274e+00 -1.0280592113229023e+01 5.1428946976574741e-01 - 36 -8.8183779521306405e-01 9.8684615667595459e+00 -4.8109031519057527e-01 + 35 -2.0808410967907278e+00 -1.0280592113229023e+01 5.1428946976574741e-01 + 36 -8.8183779521306316e-01 9.8684615667595441e+00 -4.8109031519057349e-01 37 -2.2686352055426395e+00 2.1331123333755340e+00 5.6453425235790373e+00 - 38 -3.1134845125038391e-01 5.3227665374006232e+00 -2.1683540213154733e+00 + 38 -3.1134845125038391e-01 5.3227665374006232e+00 -2.1683540213154724e+00 39 6.2802359097693028e+00 -4.4534617586305956e+00 8.8595185494148723e+00 40 -2.3301691419577937e+00 -3.2758785270630066e+00 -5.7819201702562930e+00 41 -5.9529127476328636e-01 2.1159296355895192e+00 8.6146423556989973e+00 42 5.9189513497850648e+00 -2.5092333558200637e+00 -5.1879957283630036e+00 43 -3.9541467863883950e-01 1.7167882940314338e+00 1.2472048975129875e+00 - 44 9.0533839182766673e-01 3.1947228611599816e+00 1.2778052286326369e+01 + 44 9.0533839182766673e-01 3.1947228611599812e+00 1.2778052286326369e+01 45 -7.2126726281236007e+00 4.8416302234272584e+00 -4.7112146424964925e+00 46 -7.1816028879383049e+00 6.7619490219881930e+00 3.7606013072495070e+00 47 4.7420508215326551e-01 2.6438079361177045e+00 9.3458736364390571e+00 - 48 -9.3992570471024575e+00 -7.2012852783004933e+00 5.3036194512231303e+00 - 49 -5.5873879559778343e+00 7.7963293184336617e+00 -5.6221041743396887e+00 - 50 6.8601963794059770e+00 -2.4660866715270968e+00 -1.6122667028154534e+00 + 48 -9.3992570471024592e+00 -7.2012852783004915e+00 5.3036194512231321e+00 + 49 -5.5873879559778334e+00 7.7963293184336617e+00 -5.6221041743396896e+00 + 50 6.8601963794059770e+00 -2.4660866715270973e+00 -1.6122667028154529e+00 51 -1.0615369098452508e+01 -1.1947069593051742e+00 -2.4754931735718033e+00 - 52 -1.0276441993468604e+00 1.2386128581162801e+00 2.7418262118600261e+00 - 53 3.0404706830256303e+00 1.2330889276234737e-01 1.0538693274614536e+01 - 54 2.1362122614980152e+00 3.4829232055967774e+00 -1.0358441996855289e+01 + 52 -1.0276441993468604e+00 1.2386128581162805e+00 2.7418262118600252e+00 + 53 3.0404706830256303e+00 1.2330889276234826e-01 1.0538693274614536e+01 + 54 2.1362122614980152e+00 3.4829232055967783e+00 -1.0358441996855289e+01 55 1.1299172592074738e+01 7.6545677558556874e-02 -3.9336839343099766e-01 - 56 -8.4664025172925417e-01 4.2930578794119461e+00 2.5997052919321426e+00 - 57 -3.9059207579783326e+00 1.0936390766210906e+01 2.4937931794373531e+00 - 58 -9.2443531485287878e+00 -2.8306427796695184e+00 4.3004542463117321e+00 - 59 6.4468827293851163e+00 6.7385166803754615e+00 -8.2413070730835223e+00 - 60 -6.2782603157083186e+00 8.1725418209406957e+00 -4.4584633713007520e+00 - 61 -2.3223903213770005e+00 -1.3559332411250972e+01 2.2972608899644109e-01 - 62 3.0202286274163948e+00 -5.8173499219835723e-02 3.7893096308014718e-01 - 63 -6.1967102136017562e+00 -4.9695212866018759e+00 -5.2998409387882619e+00 - 64 5.1027628612149876e+00 5.3292269345077372e+00 -8.7272297575101980e+00 + 56 -8.4664025172925506e-01 4.2930578794119478e+00 2.5997052919321426e+00 + 57 -3.9059207579783344e+00 1.0936390766210904e+01 2.4937931794373522e+00 + 58 -9.2443531485287860e+00 -2.8306427796695193e+00 4.3004542463117339e+00 + 59 6.4468827293851172e+00 6.7385166803754579e+00 -8.2413070730835241e+00 + 60 -6.2782603157083186e+00 8.1725418209406975e+00 -4.4584633713007520e+00 + 61 -2.3223903213769987e+00 -1.3559332411250972e+01 2.2972608899644109e-01 + 62 3.0202286274163956e+00 -5.8173499219836611e-02 3.7893096308014762e-01 + 63 -6.1967102136017562e+00 -4.9695212866018759e+00 -5.2998409387882637e+00 + 64 5.1027628612149876e+00 5.3292269345077354e+00 -8.7272297575101980e+00 run_vdwl: -163.22666341025 run_coul: 0 run_stress: ! |- - -5.4984932084942841e+02 -5.4747825264498317e+02 -5.6218018236834973e+02 -1.3192159297195820e+01 -1.3022347931562763e+01 5.4632816484748133e+01 + -5.4984932084942841e+02 -5.4747825264498306e+02 -5.6218018236834973e+02 -1.3192159297195806e+01 -1.3022347931562834e+01 5.4632816484748162e+01 run_forces: ! |2 - 1 -8.2294707224958152e+00 6.6415559858223139e-01 -1.2477806420252646e+00 + 1 -8.2294707224958170e+00 6.6415559858223139e-01 -1.2477806420252637e+00 2 2.9539163722155473e+00 -1.0567305774620989e+01 1.1661560767930856e+00 - 3 3.3196144058788746e-01 3.1584903320856981e+00 -1.3990995807552162e+00 + 3 3.3196144058788657e-01 3.1584903320856998e+00 -1.3990995807552162e+00 4 9.5391741269238572e-01 3.7826565316552063e-01 9.5055318246309355e+00 5 4.1639673516102560e+00 3.9705390785870254e+00 6.5682616368294298e+00 - 6 6.6727168421938297e+00 -3.6374343121692387e+00 2.7114260395938978e+00 + 6 6.6727168421938305e+00 -3.6374343121692396e+00 2.7114260395938996e+00 7 -4.2186566599771531e+00 -7.5833932377224995e+00 -5.5693511180213600e+00 8 -3.4319560756454162e+00 -3.6671624646345102e-01 -4.2144329130681235e-01 - 9 -1.3812189315006259e+01 3.4080905711091208e-01 8.0596405315020814e-01 + 9 -1.3812189315006256e+01 3.4080905711091386e-01 8.0596405315020725e-01 10 -4.7413720402957606e+00 1.8126358752434710e+00 -4.0849671973917960e+00 - 11 2.8522718591694503e+00 4.0370796861985419e+00 8.7789881157941547e+00 - 12 7.8506807861755989e+00 -7.6881532723047741e+00 -5.2541140686568868e+00 + 11 2.8522718591694511e+00 4.0370796861985419e+00 8.7789881157941547e+00 + 12 7.8506807861755981e+00 -7.6881532723047723e+00 -5.2541140686568850e+00 13 -1.6686186680304886e+00 -2.2717282650628912e+00 1.3414761770932502e+00 - 14 6.2566177844507571e+00 2.6175790060871655e+00 -7.3109911007315738e+00 - 15 -3.5512488500033967e-02 -6.0325420556797837e-01 -1.0115277456055301e+01 - 16 -7.2839584328751013e+00 6.4191562141574678e+00 3.5013328184702615e+00 - 17 9.5592981582460510e+00 2.7178395190361959e+00 5.0809557506572265e+00 - 18 -3.8846765196129365e+00 -3.3430991646140935e+00 3.2802508011790628e+00 - 19 6.2772117004625883e-01 -4.8514804166047600e+00 -7.4198875094560055e+00 + 14 6.2566177844507562e+00 2.6175790060871664e+00 -7.3109911007315747e+00 + 15 -3.5512488500034856e-02 -6.0325420556797837e-01 -1.0115277456055301e+01 + 16 -7.2839584328751013e+00 6.4191562141574661e+00 3.5013328184702623e+00 + 17 9.5592981582460510e+00 2.7178395190361972e+00 5.0809557506572265e+00 + 18 -3.8846765196129374e+00 -3.3430991646140935e+00 3.2802508011790645e+00 + 19 6.2772117004626016e-01 -4.8514804166047609e+00 -7.4198875094560055e+00 20 3.3548741544632952e+00 -3.5511160096009542e-01 5.8901206194143274e-01 - 21 -3.2206639942859443e+00 -9.9286364065253387e+00 1.2785694915312740e+00 + 21 -3.2206639942859443e+00 -9.9286364065253387e+00 1.2785694915312722e+00 22 7.4555159259077692e+00 5.0895617896923415e+00 -7.7346439701625966e+00 23 7.0720409003383446e+00 -8.2326782144613713e+00 4.8999576462066763e+00 - 24 3.8539038122551608e+00 7.6168833469064579e+00 2.3557227019554334e+00 - 25 -3.9459081317767222e+00 -2.5213387528679223e+00 -7.4689143550869241e+00 - 26 1.0113873219042404e+00 1.7546259377383389e-01 -6.2594150246692672e+00 - 27 3.1808032047272534e+00 -6.5432302930946378e+00 1.2618305054207626e+00 + 24 3.8539038122551625e+00 7.6168833469064543e+00 2.3557227019554343e+00 + 25 -3.9459081317767231e+00 -2.5213387528679232e+00 -7.4689143550869241e+00 + 26 1.0113873219042380e+00 1.7546259377383627e-01 -6.2594150246692681e+00 + 27 3.1808032047272525e+00 -6.5432302930946387e+00 1.2618305054207621e+00 28 -5.9931907183582211e+00 -5.1409008301595644e+00 2.9141715145646727e+00 - 29 3.4534555052025291e+00 7.9689185757712870e+00 -2.4166494671841887e+00 + 29 3.4534555052025300e+00 7.9689185757712870e+00 -2.4166494671841887e+00 30 9.3924610414928704e+00 -4.1698024569281982e+00 2.6643218056377420e+00 - 31 7.3358370584994654e+00 -4.1973124834250282e+00 -8.3010194948160221e-01 - 32 7.3943960241283753e+00 4.1542308511930637e+00 -3.4245736585107807e+00 - 33 -7.7194343389815030e+00 -5.3308239041411811e+00 4.5490264110666576e+00 + 31 7.3358370584994672e+00 -4.1973124834250273e+00 -8.3010194948160310e-01 + 32 7.3943960241283788e+00 4.1542308511930646e+00 -3.4245736585107815e+00 + 33 -7.7194343389815030e+00 -5.3308239041411802e+00 4.5490264110666558e+00 34 1.5343802734805889e-01 1.9182082520781198e+00 -5.7227161806870903e+00 - 35 -2.2413415929122471e+00 -1.0393995120476315e+01 4.3417636109408975e-01 - 36 -1.1206820076087858e+00 9.8632654350583895e+00 -7.4143452129578413e-01 + 35 -2.2413415929122462e+00 -1.0393995120476315e+01 4.3417636109408797e-01 + 36 -1.1206820076087867e+00 9.8632654350583895e+00 -7.4143452129578680e-01 37 -2.4246244313823127e+00 2.3044207485791537e+00 5.7890564801142066e+00 - 38 -5.3738487239109523e-01 5.2786062896097778e+00 -2.3626180572048687e+00 + 38 -5.3738487239109523e-01 5.2786062896097770e+00 -2.3626180572048692e+00 39 6.3886523307253746e+00 -4.3399697303274891e+00 9.0181916658118375e+00 - 40 -2.3861586287091283e+00 -3.2836123773823833e+00 -5.5776816127277389e+00 + 40 -2.3861586287091274e+00 -3.2836123773823824e+00 -5.5776816127277389e+00 41 -9.0646450923129307e-01 1.9914992939773488e+00 8.5107451129879834e+00 42 5.9551460186563014e+00 -2.5585603984709628e+00 -5.1987974091154516e+00 43 -4.3599168281165374e-01 1.6712528630262453e+00 1.2816846979773100e+00 - 44 8.4974573425527400e-01 3.0899456980185049e+00 1.2851650659811307e+01 - 45 -7.0442538599183102e+00 5.0586696700089222e+00 -4.6674345194080518e+00 + 44 8.4974573425527311e-01 3.0899456980185040e+00 1.2851650659811305e+01 + 45 -7.0442538599183102e+00 5.0586696700089204e+00 -4.6674345194080518e+00 46 -7.1801875599022162e+00 6.7590934281063877e+00 3.7635120215433013e+00 - 47 5.1317375574659274e-01 2.6779341206371439e+00 9.2741917179814291e+00 - 48 -9.3078567387719691e+00 -7.2851345405527432e+00 5.4021614945753766e+00 + 47 5.1317375574659363e-01 2.6779341206371421e+00 9.2741917179814291e+00 + 48 -9.3078567387719691e+00 -7.2851345405527415e+00 5.4021614945753775e+00 49 -5.5978655116913218e+00 7.7697351691267835e+00 -5.6054496108177165e+00 - 50 6.8944270702912647e+00 -2.4979106397944975e+00 -1.6711196893660549e+00 + 50 6.8944270702912629e+00 -2.4979106397944966e+00 -1.6711196893660563e+00 51 -1.0589443847527470e+01 -1.1433769514195413e+00 -2.5199895713086193e+00 - 52 -1.1738240025250661e+00 1.1071497469678624e+00 2.6529976375043698e+00 - 53 3.0682006246374587e+00 2.0292790278432879e-01 1.0584336521467472e+01 - 54 2.1439346160217654e+00 3.4807655514789477e+00 -1.0404022585935799e+01 + 52 -1.1738240025250657e+00 1.1071497469678633e+00 2.6529976375043685e+00 + 53 3.0682006246374596e+00 2.0292790278432701e-01 1.0584336521467472e+01 + 54 2.1439346160217654e+00 3.4807655514789495e+00 -1.0404022585935797e+01 55 1.1341945870703348e+01 1.1812984132292509e-01 -4.3788684134324690e-01 - 56 -5.0853495208522448e-01 4.3721019098526890e+00 2.6661059733515078e+00 + 56 -5.0853495208522537e-01 4.3721019098526890e+00 2.6661059733515078e+00 57 -3.7840594071371267e+00 1.1089743031131956e+01 2.3884678929613359e+00 58 -9.4268734677328467e+00 -2.7210262550267679e+00 4.3142585606710391e+00 - 59 6.4673603867530671e+00 6.8013230672937857e+00 -8.1798771518830709e+00 + 59 6.4673603867530653e+00 6.8013230672937874e+00 -8.1798771518830709e+00 60 -6.3371704156347120e+00 8.2056355573409814e+00 -4.4997023517211074e+00 - 61 -2.3170606856174616e+00 -1.3658343433246674e+01 1.0623172135206077e-01 + 61 -2.3170606856174598e+00 -1.3658343433246678e+01 1.0623172135206166e-01 62 3.0553926824435198e+00 -1.4425840477553686e-02 3.3505019908623868e-01 - 63 -6.2122003399241823e+00 -5.0242126599414014e+00 -5.3263529941212209e+00 - 64 5.1584253754664209e+00 5.3709530308188809e+00 -8.7534806643756298e+00 + 63 -6.2122003399241823e+00 -5.0242126599414014e+00 -5.3263529941212200e+00 + 64 5.1584253754664191e+00 5.3709530308188800e+00 -8.7534806643756298e+00 ... diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml index 8a9632b88f..92fc41d7e6 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 prerequisites: ! | pair tersoff/mod @@ -17,139 +17,139 @@ natoms: 64 init_vdwl: -271.724273648021 init_coul: 0 init_stress: ! |2- - 4.5327307609410205e+01 4.8520624491107604e+01 4.9902937603449253e+01 -9.5506101395831298e+00 3.2604807162960689e+01 3.7958926469664576e+00 + 4.5327307609410205e+01 4.8520624491107647e+01 4.9902937603449239e+01 -9.5506101395831298e+00 3.2604807162960675e+01 3.7958926469664611e+00 init_forces: ! |2 - 1 -1.1892795399502762e+00 3.4257359265649283e+00 1.7874368716815203e+00 - 2 -2.0954555386253175e+00 -1.7654085262330996e+00 -1.8532577270904687e+00 - 3 1.1876001464899757e+00 1.9242256463464447e-02 -9.0670530051980980e-01 - 4 -2.5214919613545850e+00 3.0505938787742286e+00 8.5556867413215443e-01 - 5 -2.2339471154402837e+00 -4.0007755923806543e-01 1.2555572333857423e-01 - 6 6.9406481651349483e-01 4.0779990387340961e+00 1.5289132846276394e+00 - 7 -8.6448706557168009e-01 -9.4197647582959165e-01 3.4802822970950045e+00 - 8 3.0016862396459665e-01 9.5380838768747189e-01 -1.3651064654046985e+00 - 9 -6.9326758274324463e-01 -2.8733710553178735e+00 -2.4740438488877459e+00 - 10 4.6147807167257193e-02 -2.2738498964512495e+00 -3.1717588361770175e+00 + 1 -1.1892795399502771e+00 3.4257359265649283e+00 1.7874368716815203e+00 + 2 -2.0954555386253193e+00 -1.7654085262330996e+00 -1.8532577270904687e+00 + 3 1.1876001464899755e+00 1.9242256463464447e-02 -9.0670530051980969e-01 + 4 -2.5214919613545845e+00 3.0505938787742286e+00 8.5556867413215532e-01 + 5 -2.2339471154402832e+00 -4.0007755923806521e-01 1.2555572333857401e-01 + 6 6.9406481651349439e-01 4.0779990387340961e+00 1.5289132846276394e+00 + 7 -8.6448706557168098e-01 -9.4197647582959121e-01 3.4802822970950027e+00 + 8 3.0016862396459620e-01 9.5380838768747189e-01 -1.3651064654046985e+00 + 9 -6.9326758274324418e-01 -2.8733710553178735e+00 -2.4740438488877459e+00 + 10 4.6147807167256832e-02 -2.2738498964512490e+00 -3.1717588361770170e+00 11 3.7082399304089573e+00 -4.4335060560642923e+00 3.5780289702018742e+00 - 12 -6.2207601922482070e+00 -4.2728239828918628e+00 -3.8672463790561697e+00 - 13 -1.0545105917528061e+00 5.9534933227328537e+00 -1.2541339268562639e+00 - 14 -1.9555282724792578e+00 4.9515688839071048e+00 7.5550610196808976e-02 + 12 -6.2207601922482070e+00 -4.2728239828918619e+00 -3.8672463790561697e+00 + 13 -1.0545105917528064e+00 5.9534933227328537e+00 -1.2541339268562641e+00 + 14 -1.9555282724792578e+00 4.9515688839071048e+00 7.5550610196808532e-02 15 -4.3678587432815448e+00 5.2039733154082759e+00 -3.8907877292288418e+00 - 16 2.0376392283211429e+00 4.1379151497049238e-02 7.3383531261943142e+00 - 17 2.5868961445484078e+00 3.3855091049241492e+00 -4.3525116836709090e+00 - 18 -2.0691760334270426e-01 1.1174781095513309e-01 3.9956653276596352e+00 - 19 -1.7181968595197383e+00 -3.2977071933364361e+00 -6.7298506096511712e-01 - 20 -6.6869704016886153e+00 6.5629477674615799e-01 8.5744900543906888e-01 - 21 1.9661997284095161e+00 5.8407645448956558e-01 -2.1403769815463689e+00 + 16 2.0376392283211429e+00 4.1379151497046351e-02 7.3383531261943142e+00 + 17 2.5868961445484082e+00 3.3855091049241492e+00 -4.3525116836709090e+00 + 18 -2.0691760334270470e-01 1.1174781095513486e-01 3.9956653276596352e+00 + 19 -1.7181968595197383e+00 -3.2977071933364370e+00 -6.7298506096511712e-01 + 20 -6.6869704016886153e+00 6.5629477674615799e-01 8.5744900543907066e-01 + 21 1.9661997284095161e+00 5.8407645448956558e-01 -2.1403769815463707e+00 22 -6.4806179729927962e+00 5.2609892436594707e+00 -5.8464202950859878e+00 23 2.1953645827992441e+00 3.8674084242261273e+00 1.6173483594542475e+00 - 24 2.5151508371365803e+00 1.4617337639339523e+00 3.4414267080105279e+00 + 24 2.5151508371365794e+00 1.4617337639339514e+00 3.4414267080105279e+00 25 1.0523978389374937e+00 -5.2326428640524392e-02 1.5897502115131033e+00 - 26 5.9916481607206099e-02 -5.7366071373394834e-01 1.3123953222317672e+00 - 27 2.9093832181966754e+00 -5.2366747707677330e-01 1.7866950461283688e+00 + 26 5.9916481607205876e-02 -5.7366071373394922e-01 1.3123953222317677e+00 + 27 2.9093832181966750e+00 -5.2366747707677330e-01 1.7866950461283684e+00 28 8.9638119308977648e-01 1.9996170391979944e+00 4.7622873174925884e+00 - 29 -3.7917232870403828e+00 1.3473159628039733e+00 -1.9274546986124070e+00 - 30 -1.6130847767696728e+00 1.3894366643496951e+00 -1.0830830302555146e+00 - 31 -1.3151578459616253e+00 1.8871395994432212e+00 -2.7011060864608871e-01 - 32 -3.2712791280387576e+00 7.1096851908456316e-01 -1.2734746552927405e+00 - 33 5.2911245069099460e+00 -3.4010540959332545e+00 3.6524180132002586e+00 - 34 7.9555324781102965e-01 -1.0583159648069751e-01 1.3094669311144647e-01 - 35 1.4066245523460819e+00 2.6509737902065122e-02 3.3189083125822232e+00 - 36 -5.9348529189884680e-01 -3.0775310512793967e+00 7.3726020443943635e-02 - 37 -2.1879917887538411e+00 1.8340593401715548e+00 -2.5952825292852095e+00 - 38 -8.4063356882763873e-01 -5.1045205546434858e-01 7.5648910376227496e-01 - 39 3.1966416370423714e+00 -1.7900106360847508e+00 -3.8176153923506142e+00 - 40 5.0170678274997247e+00 -2.4371237670262524e+00 -2.7953264349333442e+00 - 41 -2.2964879304419927e-02 -9.5684782238783939e-01 -8.4045745865603538e-01 - 42 -3.7325596565462327e+00 -1.4944324070127961e+00 -6.6156987915423582e-01 + 29 -3.7917232870403828e+00 1.3473159628039741e+00 -1.9274546986124070e+00 + 30 -1.6130847767696728e+00 1.3894366643496951e+00 -1.0830830302555141e+00 + 31 -1.3151578459616262e+00 1.8871395994432212e+00 -2.7011060864608827e-01 + 32 -3.2712791280387572e+00 7.1096851908456316e-01 -1.2734746552927405e+00 + 33 5.2911245069099460e+00 -3.4010540959332536e+00 3.6524180132002577e+00 + 34 7.9555324781102921e-01 -1.0583159648069751e-01 1.3094669311144647e-01 + 35 1.4066245523460814e+00 2.6509737902064234e-02 3.3189083125822227e+00 + 36 -5.9348529189884658e-01 -3.0775310512793981e+00 7.3726020443945411e-02 + 37 -2.1879917887538411e+00 1.8340593401715548e+00 -2.5952825292852104e+00 + 38 -8.4063356882763829e-01 -5.1045205546434813e-01 7.5648910376227496e-01 + 39 3.1966416370423723e+00 -1.7900106360847508e+00 -3.8176153923506142e+00 + 40 5.0170678274997247e+00 -2.4371237670262533e+00 -2.7953264349333460e+00 + 41 -2.2964879304419927e-02 -9.5684782238784027e-01 -8.4045745865603494e-01 + 42 -3.7325596565462327e+00 -1.4944324070127959e+00 -6.6156987915423582e-01 43 8.2163161790382777e-01 -5.6551284520222911e+00 3.5034152559291865e-01 - 44 3.7094881869229743e+00 -4.0305786490774889e+00 2.4402506192353060e+00 + 44 3.7094881869229743e+00 -4.0305786490774906e+00 2.4402506192353073e+00 45 -2.5415464668779046e+00 2.3561442767971252e+00 -3.3698756670727792e+00 46 -8.0311065526091541e-01 -1.8070192617844101e+00 5.9279212669666430e+00 - 47 3.2198087191803304e+00 2.1050004196645213e+00 1.1081985447058491e+00 + 47 3.2198087191803304e+00 2.1050004196645218e+00 1.1081985447058491e+00 48 1.1757816284297755e+00 -8.0697689137480266e-02 -2.5399512834746130e-01 49 -3.1588233852954701e+00 -5.4636934937363648e+00 -3.0409687849567568e+00 - 50 -2.7634926151772410e-01 3.1171696810177565e+00 -1.2591746592873663e+00 + 50 -2.7634926151772365e-01 3.1171696810177583e+00 -1.2591746592873654e+00 51 -2.7543054752091045e+00 2.8286849763020028e+00 4.2904949083466351e+00 - 52 5.8417676659988604e+00 -6.1620383217354462e+00 5.8373190892393598e+00 - 53 4.3349543609042716e+00 3.8955013047694798e+00 2.4358913852148913e+00 - 54 3.1961654886581594e+00 -3.9231725683375429e+00 -2.8101612958752127e+00 - 55 1.7020114280700853e+00 -3.1207712150229088e+00 -4.5927309465946955e+00 - 56 -7.2812157006377631e-01 2.7705521432161806e-01 -2.4526401278051884e+00 - 57 1.4923040822361899e-03 -1.2901024427293186e+00 -1.9986655014236149e-01 + 52 5.8417676659988595e+00 -6.1620383217354462e+00 5.8373190892393598e+00 + 53 4.3349543609042716e+00 3.8955013047694789e+00 2.4358913852148905e+00 + 54 3.1961654886581568e+00 -3.9231725683375429e+00 -2.8101612958752145e+00 + 55 1.7020114280700847e+00 -3.1207712150229097e+00 -4.5927309465946955e+00 + 56 -7.2812157006377642e-01 2.7705521432161762e-01 -2.4526401278051879e+00 + 57 1.4923040822370781e-03 -1.2901024427293186e+00 -1.9986655014236124e-01 58 2.8839232710488920e+00 -1.4968148916784054e+00 1.9674510279452671e+00 - 59 3.7290396548099460e+00 2.9236672921889606e+00 -3.5739265191731291e+00 + 59 3.7290396548099451e+00 2.9236672921889610e+00 -3.5739265191731291e+00 60 -3.3457486474429414e+00 -5.8722985930097442e+00 -3.2731439760160956e+00 - 61 -1.2066779913281913e+00 1.8517791870265143e+00 -1.1888511310265368e+00 - 62 -3.8148306661769906e+00 3.5439712709911046e+00 -2.7497767002061515e+00 - 63 2.2829467996296287e+00 -4.8025431165588612e+00 -4.2319407270880705e-01 + 61 -1.2066779913281904e+00 1.8517791870265143e+00 -1.1888511310265368e+00 + 62 -3.8148306661769911e+00 3.5439712709911046e+00 -2.7497767002061524e+00 + 63 2.2829467996296282e+00 -4.8025431165588621e+00 -4.2319407270880682e-01 64 3.5261103084670364e+00 3.7869432645771459e+00 5.8249511151439197e+00 run_vdwl: -271.714376157296 run_coul: 0 run_stress: ! |2- - 4.5291635990231477e+01 4.8485451299856685e+01 5.0006323329447035e+01 -9.4533068028372238e+00 3.2503068989512592e+01 4.1820539511498547e+00 + 4.5291635990231427e+01 4.8485451299856578e+01 5.0006323329447021e+01 -9.4533068028372274e+00 3.2503068989512613e+01 4.1820539511499151e+00 run_forces: ! |2 - 1 -1.1918947657502443e+00 3.4182958773698853e+00 1.7904564868842150e+00 - 2 -2.1101687652926926e+00 -1.7881701543699093e+00 -1.8660770235856479e+00 - 3 1.1499789392004458e+00 3.1318049610578491e-02 -8.7836200802514608e-01 - 4 -2.4949798351279822e+00 3.0641251157847087e+00 8.2683039594171026e-01 - 5 -2.2514955577372913e+00 -4.0959315506362448e-01 1.4354742156609368e-01 - 6 7.5853679534759166e-01 4.0830865102857796e+00 1.5648769292874620e+00 - 7 -8.3974616990465334e-01 -9.0802601082320589e-01 3.4467636036274385e+00 - 8 2.8195376164759800e-01 9.4427386634072752e-01 -1.3590398824468315e+00 - 9 -7.2160097669275269e-01 -2.9019044838478889e+00 -2.4980059604350497e+00 - 10 4.0946707887443035e-02 -2.2856155090316705e+00 -3.1155390552923201e+00 - 11 3.6678589716761860e+00 -4.3961534857252671e+00 3.5604440610775301e+00 - 12 -6.2101124027422259e+00 -4.2512126616859591e+00 -3.8486449827950837e+00 + 1 -1.1918947657502448e+00 3.4182958773698857e+00 1.7904564868842154e+00 + 2 -2.1101687652926926e+00 -1.7881701543699076e+00 -1.8660770235856474e+00 + 3 1.1499789392004445e+00 3.1318049610578491e-02 -8.7836200802514564e-01 + 4 -2.4949798351279826e+00 3.0641251157847078e+00 8.2683039594171026e-01 + 5 -2.2514955577372895e+00 -4.0959315506362581e-01 1.4354742156609324e-01 + 6 7.5853679534759078e-01 4.0830865102857796e+00 1.5648769292874620e+00 + 7 -8.3974616990465423e-01 -9.0802601082320589e-01 3.4467636036274385e+00 + 8 2.8195376164759889e-01 9.4427386634072663e-01 -1.3590398824468315e+00 + 9 -7.2160097669275269e-01 -2.9019044838478889e+00 -2.4980059604350489e+00 + 10 4.0946707887443923e-02 -2.2856155090316705e+00 -3.1155390552923201e+00 + 11 3.6678589716761860e+00 -4.3961534857252671e+00 3.5604440610775310e+00 + 12 -6.2101124027422259e+00 -4.2512126616859582e+00 -3.8486449827950837e+00 13 -9.8853767077466992e-01 5.9366458542951044e+00 -1.2068287185409750e+00 - 14 -1.9856773352251442e+00 4.9508535035552041e+00 5.1907087118496981e-02 + 14 -1.9856773352251442e+00 4.9508535035552033e+00 5.1907087118496953e-02 15 -4.3566350756857020e+00 5.1863898887809476e+00 -3.8756259179244021e+00 - 16 2.0353788519326237e+00 4.9821647276246273e-02 7.3076197835948209e+00 - 17 2.5821777365174290e+00 3.3851247640671103e+00 -4.3213301779394921e+00 - 18 -2.4549291837112097e-01 1.4426026229081623e-01 4.0126239996445410e+00 - 19 -1.7493866873732822e+00 -3.3215455049730376e+00 -7.0069547129065646e-01 - 20 -6.6735215110955934e+00 6.2728540195079896e-01 8.3442129036797907e-01 - 21 1.9797928202781567e+00 5.3718467924465130e-01 -2.1771145177620359e+00 - 22 -6.4696423803182013e+00 5.2723915719066845e+00 -5.8592496217440937e+00 - 23 2.2106731851878831e+00 3.8883816150166508e+00 1.6421949314180517e+00 - 24 2.5579366274973339e+00 1.4444516236897618e+00 3.4218792980966635e+00 - 25 1.0528226353682415e+00 -4.4267986387067471e-02 1.5675838196884007e+00 - 26 4.7782006510255645e-02 -5.5784177621066933e-01 1.3207903722617040e+00 + 16 2.0353788519326228e+00 4.9821647276245828e-02 7.3076197835948200e+00 + 17 2.5821777365174308e+00 3.3851247640671112e+00 -4.3213301779394904e+00 + 18 -2.4549291837112097e-01 1.4426026229081668e-01 4.0126239996445410e+00 + 19 -1.7493866873732831e+00 -3.3215455049730380e+00 -7.0069547129065690e-01 + 20 -6.6735215110955934e+00 6.2728540195080029e-01 8.3442129036797907e-01 + 21 1.9797928202781558e+00 5.3718467924465130e-01 -2.1771145177620359e+00 + 22 -6.4696423803182013e+00 5.2723915719066827e+00 -5.8592496217440937e+00 + 23 2.2106731851878840e+00 3.8883816150166508e+00 1.6421949314180517e+00 + 24 2.5579366274973339e+00 1.4444516236897618e+00 3.4218792980966626e+00 + 25 1.0528226353682402e+00 -4.4267986387067471e-02 1.5675838196884007e+00 + 26 4.7782006510255437e-02 -5.5784177621066933e-01 1.3207903722617040e+00 27 2.9299528768616572e+00 -5.5817742720001573e-01 1.7996518882221346e+00 - 28 8.7379771231714676e-01 2.0317378135677844e+00 4.7721250877577734e+00 + 28 8.7379771231714587e-01 2.0317378135677826e+00 4.7721250877577734e+00 29 -3.8000786622703515e+00 1.3577390750496805e+00 -1.9359663581396047e+00 - 30 -1.5906854355814142e+00 1.3662070635843266e+00 -1.0898445148582971e+00 - 31 -1.3025407206366624e+00 1.8964647039008451e+00 -2.7231510761590338e-01 - 32 -3.2539664356372855e+00 7.0262291781245700e-01 -1.2808584386417663e+00 + 30 -1.5906854355814142e+00 1.3662070635843266e+00 -1.0898445148582980e+00 + 31 -1.3025407206366624e+00 1.8964647039008451e+00 -2.7231510761590350e-01 + 32 -3.2539664356372846e+00 7.0262291781245967e-01 -1.2808584386417663e+00 33 5.2596408986294385e+00 -3.3953058274223098e+00 3.6491746999779249e+00 - 34 7.8735440926705569e-01 -1.0710243006169362e-01 1.3509866824790451e-01 + 34 7.8735440926705513e-01 -1.0710243006169096e-01 1.3509866824790473e-01 35 1.4141298152530650e+00 4.1771989288174272e-02 3.3205066097919014e+00 - 36 -6.3852185084977231e-01 -3.0622700956246853e+00 3.1902126855895718e-02 - 37 -2.1733919516706246e+00 1.8125832788926235e+00 -2.6019858688777111e+00 - 38 -8.3098475445602260e-01 -5.0280949345705794e-01 7.6501394520272292e-01 + 36 -6.3852185084977320e-01 -3.0622700956246871e+00 3.1902126855895718e-02 + 37 -2.1733919516706237e+00 1.8125832788926235e+00 -2.6019858688777111e+00 + 38 -8.3098475445602260e-01 -5.0280949345705794e-01 7.6501394520272248e-01 39 3.1780625780963874e+00 -1.7750842543948364e+00 -3.8107959944239802e+00 - 40 5.0673369602955054e+00 -2.4509029256628851e+00 -2.8122569560279724e+00 - 41 5.6629551882703133e-03 -9.2739987121600331e-01 -8.1709612116132346e-01 - 42 -3.7355733454518281e+00 -1.5221840226661405e+00 -6.8301016026751449e-01 - 43 8.0301654497618169e-01 -5.6336103194257454e+00 3.3280891647299216e-01 - 44 3.7216318428447646e+00 -4.0326457789100685e+00 2.4276411371636955e+00 - 45 -2.5652700459411899e+00 2.3203294847645317e+00 -3.3607002709832861e+00 - 46 -8.0753027345817174e-01 -1.7996067872009192e+00 5.9580854692345699e+00 - 47 3.2285845533416833e+00 2.0924103403786667e+00 1.1194723988537161e+00 - 48 1.1688136956540618e+00 -5.6138674270530431e-02 -2.5474998569863627e-01 + 40 5.0673369602955054e+00 -2.4509029256628851e+00 -2.8122569560279720e+00 + 41 5.6629551882703133e-03 -9.2739987121600331e-01 -8.1709612116132257e-01 + 42 -3.7355733454518276e+00 -1.5221840226661396e+00 -6.8301016026751404e-01 + 43 8.0301654497618302e-01 -5.6336103194257490e+00 3.3280891647299349e-01 + 44 3.7216318428447646e+00 -4.0326457789100685e+00 2.4276411371636937e+00 + 45 -2.5652700459411903e+00 2.3203294847645308e+00 -3.3607002709832869e+00 + 46 -8.0753027345817263e-01 -1.7996067872009200e+00 5.9580854692345708e+00 + 47 3.2285845533416824e+00 2.0924103403786631e+00 1.1194723988537136e+00 + 48 1.1688136956540616e+00 -5.6138674270530653e-02 -2.5474998569863505e-01 49 -3.2185678215790032e+00 -5.5312356590367173e+00 -3.1069904590061994e+00 - 50 -2.6356763860242438e-01 3.1036424818659194e+00 -1.2758903391299694e+00 + 50 -2.6356763860242660e-01 3.1036424818659194e+00 -1.2758903391299703e+00 51 -2.8071738968594575e+00 2.8702060905481259e+00 4.3081030715942719e+00 52 5.8453254803952301e+00 -6.1511156037641070e+00 5.8404459278581990e+00 - 53 4.3893496213428964e+00 3.9529682528455976e+00 2.5293461908066792e+00 + 53 4.3893496213428946e+00 3.9529682528455976e+00 2.5293461908066792e+00 54 3.1864812498705710e+00 -3.9263054351164062e+00 -2.7996740328705556e+00 - 55 1.6741928863012809e+00 -3.1118648603332209e+00 -4.5507928276719491e+00 - 56 -7.2755429366074531e-01 2.3638688232901517e-01 -2.4423206268377928e+00 + 55 1.6741928863012800e+00 -3.1118648603332209e+00 -4.5507928276719483e+00 + 56 -7.2755429366074487e-01 2.3638688232901472e-01 -2.4423206268377933e+00 57 -4.6903040027292120e-03 -1.3232888876597855e+00 -2.0467223907307161e-01 - 58 2.8879619252105058e+00 -1.4685560725608242e+00 1.9392897818363348e+00 - 59 3.7559063578984673e+00 2.9520899615521978e+00 -3.5747082183205041e+00 - 60 -3.4120487353432085e+00 -5.9079921317921702e+00 -3.3313655490934537e+00 - 61 -1.1947245972934271e+00 1.8614078819708411e+00 -1.1807010370078419e+00 - 62 -3.8048373658391457e+00 3.5279689971056665e+00 -2.7361781562145961e+00 - 63 2.2871253489947252e+00 -4.8341223399724607e+00 -4.5508414479585668e-01 - 64 3.5904334294349534e+00 3.8516221789447727e+00 5.8638653440476931e+00 + 58 2.8879619252105049e+00 -1.4685560725608238e+00 1.9392897818363339e+00 + 59 3.7559063578984673e+00 2.9520899615521992e+00 -3.5747082183205041e+00 + 60 -3.4120487353432085e+00 -5.9079921317921702e+00 -3.3313655490934528e+00 + 61 -1.1947245972934262e+00 1.8614078819708402e+00 -1.1807010370078419e+00 + 62 -3.8048373658391448e+00 3.5279689971056665e+00 -2.7361781562145961e+00 + 63 2.2871253489947261e+00 -4.8341223399724607e+00 -4.5508414479585757e-01 + 64 3.5904334294349534e+00 3.8516221789447722e+00 5.8638653440476931e+00 ... diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml index 641a8e962d..0243e01df7 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 1e-12 prerequisites: ! | pair tersoff/mod/c @@ -17,139 +17,139 @@ natoms: 64 init_vdwl: -270.221167046491 init_coul: 0 init_stress: ! |2- - 3.7721371080158519e+01 4.0406255097836009e+01 4.5487367411373484e+01 -4.8266606949369901e+00 4.8727889805432568e+01 1.1408515692636302e+01 + 3.7721371080158455e+01 4.0406255097835910e+01 4.5487367411373455e+01 -4.8266606949370061e+00 4.8727889805432582e+01 1.1408515692636255e+01 init_forces: ! |2 - 1 -1.1121702900549253e+00 3.2962355779814700e+00 1.7214327613339293e+00 - 2 -2.6231172245796350e+00 -1.1364993928076723e+00 -2.3817153144708119e+00 + 1 -1.1121702900549244e+00 3.2962355779814692e+00 1.7214327613339284e+00 + 2 -2.6231172245796350e+00 -1.1364993928076714e+00 -2.3817153144708110e+00 3 1.2454687790439651e+00 -2.0768859787664962e-02 -9.0044014975037079e-01 - 4 -2.9108777089667255e+00 3.4825750603217136e+00 1.2609281774155390e+00 - 5 -2.1612651325906471e+00 -4.9869587691769302e-01 1.7250163832481702e-01 + 4 -2.9108777089667255e+00 3.4825750603217136e+00 1.2609281774155381e+00 + 5 -2.1612651325906471e+00 -4.9869587691769279e-01 1.7250163832481635e-01 6 6.2541430916574392e-01 4.1094941300847427e+00 1.7170100483649258e+00 - 7 -7.2171003353241292e-01 -8.7428867981606628e-01 3.1938058862406162e+00 + 7 -7.2171003353241292e-01 -8.7428867981606584e-01 3.1938058862406162e+00 8 3.5140079778346966e-01 9.6087816332530318e-01 -1.2820504415972398e+00 - 9 -8.3063920816990322e-02 -3.7423608933633652e+00 -3.2160720450535623e+00 - 10 -3.1901729169774407e-02 -2.3415669618762114e+00 -3.0883299406012168e+00 + 9 -8.3063920816989878e-02 -3.7423608933633652e+00 -3.2160720450535623e+00 + 10 -3.1901729169775739e-02 -2.3415669618762123e+00 -3.0883299406012199e+00 11 4.1864404556275057e+00 -4.8481896851463224e+00 3.8312060479472567e+00 - 12 -9.6713935862591818e+00 -6.6227112990242984e+00 -4.6446377068123139e+00 - 13 1.9646495165853503e-01 7.9861477095384776e+00 -2.7367062033436418e+00 - 14 -2.7684114622587317e+00 5.5939194639363317e+00 -4.0547714650260891e-01 - 15 -7.2775531579340491e+00 8.3478926291447397e+00 -3.2404980553662845e+00 + 12 -9.6713935862591800e+00 -6.6227112990242967e+00 -4.6446377068123139e+00 + 13 1.9646495165853392e-01 7.9861477095384741e+00 -2.7367062033436427e+00 + 14 -2.7684114622587317e+00 5.5939194639363317e+00 -4.0547714650260802e-01 + 15 -7.2775531579340491e+00 8.3478926291447380e+00 -3.2404980553662854e+00 16 3.2825165212935894e+00 1.4503238718907385e-01 9.9619494807553099e+00 - 17 1.8077787360512412e+00 5.6235488307785566e+00 -6.6752189747857935e+00 + 17 1.8077787360512414e+00 5.6235488307785566e+00 -6.6752189747857917e+00 18 -2.9067694818601864e-01 7.0277766073193071e-01 4.3645591263313168e+00 19 -1.7799419254476889e+00 -3.2770446346967073e+00 -8.1006577744305008e-01 - 20 -9.9453199957259972e+00 -4.4689488447166381e-01 2.9031488756869921e+00 - 21 4.0755651659561503e+00 2.5055927550712744e+00 -3.9295891445176494e+00 - 22 -8.4726851156999654e+00 6.8585462938413606e+00 -7.2078210589983769e+00 - 23 2.5236349600547641e+00 5.0871858657739679e+00 1.6016380934443952e+00 - 24 2.7497519642890418e+00 1.7304732457306626e+00 3.6549891820852740e+00 - 25 1.0225647279133203e+00 4.0532546754561860e-02 1.5536574739628866e+00 - 26 -7.0481851150491104e-01 -1.3637381624788669e+00 2.0613502828213091e+00 - 27 2.8896757936606288e+00 -2.5598906474617455e-01 1.6995818028265111e+00 - 28 7.8372315678940652e-01 2.2486288715348084e+00 5.6768795736306181e+00 - 29 -3.7884290849364386e+00 1.1944698204128446e+00 -1.8602750345964847e+00 - 30 -1.5649995972155133e+00 1.3796901248411295e+00 -1.0422790561923814e+00 - 31 -1.4835767031477887e+00 2.1960643033804708e+00 9.3118779237245430e-02 - 32 -3.2907053780286306e+00 6.2378355508109218e-01 -1.2902338668409254e+00 - 33 6.9062659492175591e+00 -4.6716700051867610e+00 4.5297058615592185e+00 - 34 5.9955487511258954e-01 5.1028650560414057e-02 2.1001425329185341e-01 + 20 -9.9453199957259955e+00 -4.4689488447166381e-01 2.9031488756869921e+00 + 21 4.0755651659561503e+00 2.5055927550712744e+00 -3.9295891445176512e+00 + 22 -8.4726851156999636e+00 6.8585462938413606e+00 -7.2078210589983787e+00 + 23 2.5236349600547636e+00 5.0871858657739679e+00 1.6016380934443961e+00 + 24 2.7497519642890405e+00 1.7304732457306626e+00 3.6549891820852740e+00 + 25 1.0225647279133201e+00 4.0532546754561583e-02 1.5536574739628874e+00 + 26 -7.0481851150491059e-01 -1.3637381624788678e+00 2.0613502828213091e+00 + 27 2.8896757936606292e+00 -2.5598906474617433e-01 1.6995818028265111e+00 + 28 7.8372315678940696e-01 2.2486288715348071e+00 5.6768795736306155e+00 + 29 -3.7884290849364386e+00 1.1944698204128448e+00 -1.8602750345964849e+00 + 30 -1.5649995972155135e+00 1.3796901248411300e+00 -1.0422790561923814e+00 + 31 -1.4835767031477887e+00 2.1960643033804708e+00 9.3118779237246319e-02 + 32 -3.2907053780286306e+00 6.2378355508109395e-01 -1.2902338668409250e+00 + 33 6.9062659492175591e+00 -4.6716700051867592e+00 4.5297058615592203e+00 + 34 5.9955487511258931e-01 5.1028650560414057e-02 2.1001425329185341e-01 35 1.3870533247216423e+00 2.2599941992339145e-01 3.1691771352499218e+00 36 -7.2485340203448956e-01 -2.9468050589090384e+00 1.5881949315158159e-01 - 37 -2.2156632667821259e+00 1.5777720928381880e+00 -2.5373496014392680e+00 - 38 -7.4860652592984511e-01 -7.1078971807313196e-01 6.9730423004496167e-01 + 37 -2.2156632667821272e+00 1.5777720928381878e+00 -2.5373496014392685e+00 + 38 -7.4860652592984489e-01 -7.1078971807313263e-01 6.9730423004496167e-01 39 5.0768954315972890e+00 -7.0255010522737926e-01 -5.9161474934557994e+00 40 5.1068862232776402e+00 -2.6572250807869788e+00 -3.0350555471127509e+00 - 41 -1.5543959327638301e-02 -9.9903820196554505e-01 -7.7550537312763934e-01 + 41 -1.5543959327637413e-02 -9.9903820196554549e-01 -7.7550537312763912e-01 42 -5.8719118783583797e+00 -3.2250092618452633e+00 7.4849260312585963e-01 - 43 2.1153755526140956e+00 -7.5250264265041178e+00 -1.0871022565761495e+00 - 44 6.3180364208751865e+00 -6.7411789158583639e+00 1.1116278345350947e+00 - 45 -2.7247244318737365e+00 2.5615735720407926e+00 -3.7075812268108588e+00 - 46 8.4025894151274122e-02 -2.0180730336203885e+00 7.0249965065180646e+00 + 43 2.1153755526140960e+00 -7.5250264265041196e+00 -1.0871022565761499e+00 + 44 6.3180364208751865e+00 -6.7411789158583639e+00 1.1116278345350958e+00 + 45 -2.7247244318737360e+00 2.5615735720407948e+00 -3.7075812268108592e+00 + 46 8.4025894151274094e-02 -2.0180730336203867e+00 7.0249965065180646e+00 47 3.3265285405418528e+00 2.1536423096918682e+00 1.2451815742139596e+00 - 48 1.2590145861274618e+00 -5.9135053727527920e-02 -4.0063540451436003e-01 + 48 1.2590145861274626e+00 -5.9135053727527920e-02 -4.0063540451435958e-01 49 -3.4072597072209669e+00 -6.1070390605333742e+00 -3.5306063249176431e+00 - 50 -1.2324925097128006e+00 4.1915062662249349e+00 -2.5666620297721936e+00 - 51 -2.3733120960180147e+00 3.4165620256287563e+00 5.0660386533198327e+00 - 52 7.4960119597573005e+00 -7.9932429491872048e+00 7.3092067723825780e+00 - 53 4.8598008110851412e+00 4.5281870222367191e+00 2.4268297257522375e+00 - 54 3.3983704274453550e+00 -4.0220846635515732e+00 -2.4796461202922617e+00 + 50 -1.2324925097128014e+00 4.1915062662249358e+00 -2.5666620297721936e+00 + 51 -2.3733120960180139e+00 3.4165620256287572e+00 5.0660386533198327e+00 + 52 7.4960119597572987e+00 -7.9932429491872066e+00 7.3092067723825780e+00 + 53 4.8598008110851412e+00 4.5281870222367200e+00 2.4268297257522375e+00 + 54 3.3983704274453546e+00 -4.0220846635515732e+00 -2.4796461202922595e+00 55 2.0540824843371199e+00 -4.5011288518162811e+00 -5.8606842068916176e+00 - 56 -8.2057128294593273e-01 8.9531331465382280e-03 -2.4950139723745406e+00 - 57 1.9063253744204015e-01 -1.3950288071553631e+00 -1.8130645334635304e-01 - 58 2.7864038109729163e+00 -1.4751542377211930e+00 1.8723178449480449e+00 + 56 -8.2057128294593296e-01 8.9531331465382280e-03 -2.4950139723745401e+00 + 57 1.9063253744203881e-01 -1.3950288071553631e+00 -1.8130645334635370e-01 + 58 2.7864038109729163e+00 -1.4751542377211939e+00 1.8723178449480449e+00 59 3.9282544607350491e+00 2.9149707637849871e+00 -3.6540900686538595e+00 60 -5.2081470599725392e+00 -8.3618639601252767e+00 -5.4019706110934393e+00 - 61 -8.8016078852763746e-01 2.1182748970403305e+00 -1.4653540228996813e+00 - 62 -4.7911545216150282e+00 4.3378864433672462e+00 -2.6608977921209904e+00 - 63 3.8818660647417813e+00 -6.6892167616182174e+00 6.9165485826786144e-01 - 64 5.1815592623345079e+00 6.0301829566070024e+00 1.0737893845502111e+01 + 61 -8.8016078852763657e-01 2.1182748970403305e+00 -1.4653540228996809e+00 + 62 -4.7911545216150291e+00 4.3378864433672462e+00 -2.6608977921209904e+00 + 63 3.8818660647417804e+00 -6.6892167616182157e+00 6.9165485826786188e-01 + 64 5.1815592623345070e+00 6.0301829566070033e+00 1.0737893845502111e+01 run_vdwl: -270.224607668554 run_coul: 0 run_stress: ! |2- - 3.7674451362255276e+01 4.0326697108038509e+01 4.5577845337707849e+01 -4.6735158236851788e+00 4.8643168908345842e+01 1.1894000727069708e+01 + 3.7674451362255247e+01 4.0326697108038395e+01 4.5577845337707821e+01 -4.6735158236852925e+00 4.8643168908345814e+01 1.1894000727069669e+01 run_forces: ! |2 - 1 -1.1142742666418199e+00 3.2887741993210065e+00 1.7241628867442698e+00 - 2 -2.6148518477021274e+00 -1.1740849208477933e+00 -2.3703008670257626e+00 - 3 1.2089929150716658e+00 -6.7487848951954810e-03 -8.7176891527392342e-01 + 1 -1.1142742666418199e+00 3.2887741993210065e+00 1.7241628867442707e+00 + 2 -2.6148518477021256e+00 -1.1740849208477950e+00 -2.3703008670257635e+00 + 3 1.2089929150716656e+00 -6.7487848951994778e-03 -8.7176891527392297e-01 4 -2.8784378291695250e+00 3.4849640896455774e+00 1.2253751868757390e+00 - 5 -2.1768875283676650e+00 -5.0683280025488298e-01 1.8771971799360698e-01 - 6 6.8363271094370026e-01 4.1188116820530274e+00 1.7510959407143254e+00 - 7 -6.9759680551813874e-01 -8.4290063305126406e-01 3.1663839869782047e+00 + 5 -2.1768875283676659e+00 -5.0683280025488120e-01 1.8771971799360743e-01 + 6 6.8363271094370048e-01 4.1188116820530265e+00 1.7510959407143272e+00 + 7 -6.9759680551813918e-01 -8.4290063305126317e-01 3.1663839869782047e+00 8 3.3563530432502575e-01 9.4980829624164631e-01 -1.2775241043615468e+00 - 9 -1.2090643268521584e-01 -3.7768794974128017e+00 -3.2480515433857793e+00 - 10 -3.9827173027341262e-02 -2.3469800281115409e+00 -3.0340141995027476e+00 - 11 4.1282097269421190e+00 -4.7968097304112458e+00 3.8022999483560960e+00 - 12 -9.6623400503948922e+00 -6.5981540025236161e+00 -4.5946083341882282e+00 - 13 3.0038357850795766e-01 7.9786917485485045e+00 -2.6901638494120639e+00 - 14 -2.8062338737355890e+00 5.6004891316720968e+00 -4.2961390202334887e-01 - 15 -7.2648805745731693e+00 8.3251945285468132e+00 -3.2031777212047521e+00 - 16 3.2631813187452239e+00 1.6950378464586580e-01 9.8836563846805330e+00 - 17 1.7876660581841444e+00 5.6116255374247288e+00 -6.6294360080608064e+00 - 18 -3.3201159487641663e-01 7.3194654839619400e-01 4.3820340292676310e+00 - 19 -1.8206300493373171e+00 -3.3051630706796131e+00 -8.4589712208255907e-01 - 20 -9.8897929988994360e+00 -4.8658336333811736e-01 2.8531210732927477e+00 - 21 4.0736008300140742e+00 2.4398907305541004e+00 -3.9565796667215416e+00 - 22 -8.4440920402106130e+00 6.8547775863267688e+00 -7.2142224018556904e+00 - 23 2.5621567759218009e+00 5.1218946302492041e+00 1.6184144172540929e+00 - 24 2.7919657956955897e+00 1.7126950729205657e+00 3.6356286227515984e+00 - 25 1.0239401894422706e+00 4.9099294217466116e-02 1.5335034952572728e+00 - 26 -7.2866022636019356e-01 -1.3606385629801949e+00 2.0823740177212704e+00 - 27 2.9082225152359640e+00 -2.8957326570201725e-01 1.7118504504699348e+00 - 28 7.5417421527058526e-01 2.2935971057630433e+00 5.6934344720508596e+00 - 29 -3.7987533354094705e+00 1.2044876617925269e+00 -1.8672964369860861e+00 - 30 -1.5427652070949360e+00 1.3593187984081179e+00 -1.0476153051317474e+00 - 31 -1.4767939250923430e+00 2.2127425295346232e+00 9.5875204360308941e-02 - 32 -3.2722890231175139e+00 6.0495488607351211e-01 -1.3043629673763908e+00 - 33 6.8576785534296789e+00 -4.6521173898310870e+00 4.5197885948721925e+00 - 34 5.9268805017826043e-01 5.2042918801102900e-02 2.1374154196651229e-01 - 35 1.3952766836821675e+00 2.4050478171119805e-01 3.1729614847063221e+00 + 9 -1.2090643268521584e-01 -3.7768794974128017e+00 -3.2480515433857784e+00 + 10 -3.9827173027342150e-02 -2.3469800281115409e+00 -3.0340141995027476e+00 + 11 4.1282097269421181e+00 -4.7968097304112458e+00 3.8022999483560960e+00 + 12 -9.6623400503948904e+00 -6.5981540025236161e+00 -4.5946083341882282e+00 + 13 3.0038357850795760e-01 7.9786917485485045e+00 -2.6901638494120652e+00 + 14 -2.8062338737355916e+00 5.6004891316720951e+00 -4.2961390202334976e-01 + 15 -7.2648805745731675e+00 8.3251945285468132e+00 -3.2031777212047516e+00 + 16 3.2631813187452239e+00 1.6950378464586624e-01 9.8836563846805312e+00 + 17 1.7876660581841448e+00 5.6116255374247279e+00 -6.6294360080608064e+00 + 18 -3.3201159487641707e-01 7.3194654839619400e-01 4.3820340292676292e+00 + 19 -1.8206300493373175e+00 -3.3051630706796131e+00 -8.4589712208255996e-01 + 20 -9.8897929988994360e+00 -4.8658336333811736e-01 2.8531210732927481e+00 + 21 4.0736008300140742e+00 2.4398907305541013e+00 -3.9565796667215416e+00 + 22 -8.4440920402106130e+00 6.8547775863267697e+00 -7.2142224018556931e+00 + 23 2.5621567759218000e+00 5.1218946302492059e+00 1.6184144172540931e+00 + 24 2.7919657956955888e+00 1.7126950729205657e+00 3.6356286227515984e+00 + 25 1.0239401894422711e+00 4.9099294217465894e-02 1.5335034952572733e+00 + 26 -7.2866022636019401e-01 -1.3606385629801949e+00 2.0823740177212704e+00 + 27 2.9082225152359640e+00 -2.8957326570201680e-01 1.7118504504699348e+00 + 28 7.5417421527058481e-01 2.2935971057630433e+00 5.6934344720508596e+00 + 29 -3.7987533354094696e+00 1.2044876617925264e+00 -1.8672964369860872e+00 + 30 -1.5427652070949365e+00 1.3593187984081179e+00 -1.0476153051317483e+00 + 31 -1.4767939250923430e+00 2.2127425295346228e+00 9.5875204360308719e-02 + 32 -3.2722890231175139e+00 6.0495488607350856e-01 -1.3043629673763908e+00 + 33 6.8576785534296789e+00 -4.6521173898310879e+00 4.5197885948721925e+00 + 34 5.9268805017825998e-01 5.2042918801104676e-02 2.1374154196651229e-01 + 35 1.3952766836821675e+00 2.4050478171119805e-01 3.1729614847063217e+00 36 -7.6808099170433208e-01 -2.9332921244997023e+00 1.2007998407540929e-01 - 37 -2.2027921686068241e+00 1.5570955346907995e+00 -2.5442808648260775e+00 - 38 -7.3699646633911131e-01 -7.0500791082351566e-01 7.0390215916361343e-01 + 37 -2.2027921686068241e+00 1.5570955346907991e+00 -2.5442808648260775e+00 + 38 -7.3699646633911153e-01 -7.0500791082351588e-01 7.0390215916361343e-01 39 5.0221753494654973e+00 -7.0085036602650153e-01 -5.8773682809836112e+00 - 40 5.1673030874188219e+00 -2.6815680399585395e+00 -3.0626556877439941e+00 - 41 1.0676789878963255e-02 -9.7021367768748157e-01 -7.5310859725548096e-01 - 42 -5.8443700387458337e+00 -3.2279591656528281e+00 6.9962004533636746e-01 - 43 2.0876420381888621e+00 -7.4907210140762883e+00 -1.1070376746626898e+00 - 44 6.3410913871860650e+00 -6.7523901286198313e+00 1.0930045880468786e+00 - 45 -2.7411980429804692e+00 2.5203975506934992e+00 -3.6867197118973793e+00 - 46 7.7708166258764727e-02 -2.0166728039677793e+00 7.0577312583076841e+00 + 40 5.1673030874188202e+00 -2.6815680399585395e+00 -3.0626556877439932e+00 + 41 1.0676789878963699e-02 -9.7021367768748179e-01 -7.5310859725548052e-01 + 42 -5.8443700387458337e+00 -3.2279591656528281e+00 6.9962004533636724e-01 + 43 2.0876420381888625e+00 -7.4907210140762874e+00 -1.1070376746626893e+00 + 44 6.3410913871860650e+00 -6.7523901286198313e+00 1.0930045880468791e+00 + 45 -2.7411980429804701e+00 2.5203975506934992e+00 -3.6867197118973802e+00 + 46 7.7708166258764505e-02 -2.0166728039677788e+00 7.0577312583076841e+00 47 3.3346218642295486e+00 2.1393138094643183e+00 1.2524932605254870e+00 - 48 1.2617182562996003e+00 -2.7597261673746321e-02 -4.0954991698920334e-01 - 49 -3.4857756623633440e+00 -6.2071682527566612e+00 -3.6090400242649121e+00 - 50 -1.2375804366925611e+00 4.1994112212565522e+00 -2.6062770185976762e+00 - 51 -2.4338545743769773e+00 3.4676170215863142e+00 5.0923167347867135e+00 - 52 7.4922597808143800e+00 -7.9644243048257097e+00 7.3057144106772487e+00 - 53 4.9226077604518723e+00 4.6027173886959991e+00 2.5390308924823080e+00 - 54 3.3826824333268939e+00 -4.0188767893934827e+00 -2.4723493073275757e+00 + 48 1.2617182562996008e+00 -2.7597261673747153e-02 -4.0954991698920273e-01 + 49 -3.4857756623633440e+00 -6.2071682527566621e+00 -3.6090400242649121e+00 + 50 -1.2375804366925620e+00 4.1994112212565531e+00 -2.6062770185976776e+00 + 51 -2.4338545743769764e+00 3.4676170215863142e+00 5.0923167347867135e+00 + 52 7.4922597808143800e+00 -7.9644243048257080e+00 7.3057144106772460e+00 + 53 4.9226077604518723e+00 4.6027173886960000e+00 2.5390308924823097e+00 + 54 3.3826824333268939e+00 -4.0188767893934827e+00 -2.4723493073275766e+00 55 2.0072747016085981e+00 -4.4688586229115996e+00 -5.8026217554186506e+00 56 -8.2643969843789811e-01 -3.5785652759206865e-02 -2.4907554185925691e+00 - 57 1.8595428092644131e-01 -1.4292567630963531e+00 -1.8534712150892824e-01 - 58 2.7881040389940166e+00 -1.4502699158114176e+00 1.8440006063741061e+00 + 57 1.8595428092644131e-01 -1.4292567630963526e+00 -1.8534712150892824e-01 + 58 2.7881040389940175e+00 -1.4502699158114176e+00 1.8440006063741061e+00 59 3.9594919422179045e+00 2.9464604530667033e+00 -3.6566709427414494e+00 - 60 -5.3137611446251158e+00 -8.4544236376661512e+00 -5.4988782544210464e+00 - 61 -8.6171618111163240e-01 2.1350195440843511e+00 -1.4658442767416378e+00 + 60 -5.3137611446251176e+00 -8.4544236376661512e+00 -5.4988782544210464e+00 + 61 -8.6171618111163217e-01 2.1350195440843516e+00 -1.4658442767416369e+00 62 -4.7782055505377610e+00 4.3156805938089189e+00 -2.6385037834899929e+00 - 63 3.8910892690837837e+00 -6.7270549290274504e+00 6.5341336803071237e-01 + 63 3.8910892690837824e+00 -6.7270549290274504e+00 6.5341336803071326e-01 64 5.3129893707953428e+00 6.1163287510784619e+00 1.0836913217935809e+01 ... diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml index 795272a848..eec7384351 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Mon Jan 11 03:57:49 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 1e-12 prerequisites: ! | pair tersoff/mod/c diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml index 4cc8e84cba..e40ac3548b 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Mon Jan 11 03:57:49 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 prerequisites: ! | pair tersoff/mod diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml index 2558fbc9f2..9676fe954b 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Mon Jan 11 03:57:49 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-13 prerequisites: ! | pair tersoff diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml index 1a2152a24a..036acc25d1 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 prerequisites: ! | pair tersoff/table diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml index 9f946558ac..a503b6e912 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 prerequisites: ! | pair tersoff/zbl @@ -17,139 +17,139 @@ natoms: 64 init_vdwl: -154.312424904672 init_coul: 0 init_stress: ! |- - -5.4522412416158102e+02 -5.4620277297655377e+02 -5.5815536323162701e+02 -1.7213270572024335e+01 -7.7594128912815306e+00 5.4428966311706318e+01 + -5.4522412416158102e+02 -5.4620277297655366e+02 -5.5815536323162701e+02 -1.7213270572024321e+01 -7.7594128912815021e+00 5.4428966311706304e+01 init_forces: ! |2 - 1 -7.7223891253517722e+00 1.0669552508817124e+00 -9.3076553380222071e-01 + 1 -7.7223891253517714e+00 1.0669552508817128e+00 -9.3076553380222204e-01 2 3.7509929454128033e+00 -1.1608422146949774e+01 5.9829237011901226e-01 - 3 2.6417923119560638e-01 2.2717446840373618e+00 -1.9580554374326651e+00 - 4 1.4187200625138665e+00 5.9303547363431663e-01 1.0375888219204084e+01 - 5 2.8065933831668208e+00 4.1360726535826693e+00 6.5929843993713302e+00 + 3 2.6417923119560460e-01 2.2717446840373601e+00 -1.9580554374326660e+00 + 4 1.4187200625138665e+00 5.9303547363431752e-01 1.0375888219204084e+01 + 5 2.8065933831668213e+00 4.1360726535826702e+00 6.5929843993713302e+00 6 6.5638996551157218e+00 -1.5686673063102741e+00 1.7631493864177592e+00 - 7 -3.5965225360426096e+00 -7.2511307484456236e+00 -3.6830937953307998e+00 - 8 -3.1266026325384808e+00 2.7397841938566925e-01 -1.4637526104090299e+00 - 9 -1.4162689681759806e+01 -6.0833719091296479e-02 6.5862389183669001e-01 - 10 -4.1588593526494853e+00 1.9471124735881842e+00 -4.7275429783999288e+00 - 11 2.3782322441244537e+00 2.8028996002466671e+00 8.3974909855476199e+00 - 12 7.2245884140175605e+00 -7.1545180209348835e+00 -5.6015217582408967e+00 - 13 -1.7339461509015812e+00 -6.2656293614589265e-01 1.4680700372946309e+00 - 14 5.8837298095438388e+00 4.0439697767810125e+00 -7.0902659577335854e+00 + 7 -3.5965225360426079e+00 -7.2511307484456218e+00 -3.6830937953307989e+00 + 8 -3.1266026325384817e+00 2.7397841938566836e-01 -1.4637526104090299e+00 + 9 -1.4162689681759810e+01 -6.0833719091292926e-02 6.5862389183668824e-01 + 10 -4.1588593526494870e+00 1.9471124735881842e+00 -4.7275429783999270e+00 + 11 2.3782322441244528e+00 2.8028996002466675e+00 8.3974909855476181e+00 + 12 7.2245884140175605e+00 -7.1545180209348835e+00 -5.6015217582408985e+00 + 13 -1.7339461509015806e+00 -6.2656293614589487e-01 1.4680700372946296e+00 + 14 5.8837298095438388e+00 4.0439697767810152e+00 -7.0902659577335871e+00 15 -2.6319683461903143e-01 9.5625752411607756e-02 -9.9869806512065207e+00 16 -6.9180189161072780e+00 6.0016649351285860e+00 5.2030407483493528e+00 17 8.7820893390038446e+00 2.7984560892702510e+00 4.7728900338248890e+00 - 18 -3.1913649483034638e+00 -3.4524044281061714e+00 3.7538798176451111e+00 - 19 -6.4128808124179412e-02 -6.0635767184752192e+00 -6.8997640473277917e+00 - 20 3.4388871104450129e+00 -3.8200104001389068e-02 5.1166837878832272e-01 + 18 -3.1913649483034656e+00 -3.4524044281061714e+00 3.7538798176451103e+00 + 19 -6.4128808124179856e-02 -6.0635767184752192e+00 -6.8997640473277917e+00 + 20 3.4388871104450121e+00 -3.8200104001389068e-02 5.1166837878832450e-01 21 -2.4701212056737192e+00 -9.3941282330265476e+00 5.2105099848053948e-01 - 22 5.7383565771653142e+00 4.8828947154874278e+00 -7.9926266338824732e+00 - 23 6.4376905136579818e+00 -7.0439226225786209e+00 4.6084176140211843e+00 - 24 4.8510712718085323e+00 6.8813453271828884e+00 3.7726541864639174e+00 - 25 -3.4489436588305233e+00 -3.5502395499027601e+00 -6.7416968668150439e+00 - 26 5.4873724451387218e-01 8.5331027006887650e-01 -7.0355245447133861e+00 - 27 3.3486790257685142e+00 -7.6427425596683571e+00 6.9823818008918426e-01 - 28 -5.4974820053188704e+00 -5.2192989519390922e+00 2.9981122024503728e+00 - 29 1.8990657601464958e+00 7.9462823825407645e+00 -2.2852349979707096e+00 + 22 5.7383565771653187e+00 4.8828947154874287e+00 -7.9926266338824732e+00 + 23 6.4376905136579818e+00 -7.0439226225786200e+00 4.6084176140211843e+00 + 24 4.8510712718085323e+00 6.8813453271828884e+00 3.7726541864639156e+00 + 25 -3.4489436588305225e+00 -3.5502395499027584e+00 -6.7416968668150439e+00 + 26 5.4873724451387262e-01 8.5331027006887561e-01 -7.0355245447133861e+00 + 27 3.3486790257685124e+00 -7.6427425596683571e+00 6.9823818008918426e-01 + 28 -5.4974820053188695e+00 -5.2192989519390922e+00 2.9981122024503728e+00 + 29 1.8990657601464966e+00 7.9462823825407645e+00 -2.2852349979707087e+00 30 8.5847044839182303e+00 -3.5987773729518682e+00 1.9210111641479415e+00 - 31 7.0252868086935667e+00 -3.4623097800839489e+00 -1.1862906778911682e+00 - 32 6.1729069395305345e+00 3.9913522288972123e+00 -3.3335846601483548e+00 - 33 -7.5775036922654033e+00 -5.9605069713583001e+00 4.1414777448263917e+00 - 34 -9.0946996290491056e-01 1.2572967653270477e+00 -5.2123947596604268e+00 - 35 -1.7413957750584443e+00 -9.7866905973519476e+00 9.2507002642295422e-01 - 36 -1.0604503231041353e+00 8.9118947434778093e+00 -3.2649864820235919e-01 - 37 -2.5316818073756524e+00 2.4727832341958438e+00 5.3238709757802045e+00 - 38 -4.3233426310435874e-01 4.8360652833090603e+00 -1.9586012106375454e+00 - 39 6.6090376159255850e+00 -4.8443063100623718e+00 8.3554827564728651e+00 - 40 -7.6762734626138085e-02 -2.7743904987196446e+00 -6.0821504748439743e+00 + 31 7.0252868086935685e+00 -3.4623097800839489e+00 -1.1862906778911682e+00 + 32 6.1729069395305345e+00 3.9913522288972119e+00 -3.3335846601483548e+00 + 33 -7.5775036922654042e+00 -5.9605069713583001e+00 4.1414777448263909e+00 + 34 -9.0946996290491100e-01 1.2572967653270477e+00 -5.2123947596604276e+00 + 35 -1.7413957750584439e+00 -9.7866905973519476e+00 9.2507002642295466e-01 + 36 -1.0604503231041336e+00 8.9118947434778111e+00 -3.2649864820235830e-01 + 37 -2.5316818073756524e+00 2.4727832341958447e+00 5.3238709757802045e+00 + 38 -4.3233426310435785e-01 4.8360652833090612e+00 -1.9586012106375454e+00 + 39 6.6090376159255877e+00 -4.8443063100623744e+00 8.3554827564728669e+00 + 40 -7.6762734626139861e-02 -2.7743904987196455e+00 -6.0821504748439743e+00 41 -6.1063699317217113e-01 2.7151522550600631e+00 9.2123263221338334e+00 42 6.2163089480270228e+00 -2.7694305062107678e+00 -5.7921208552013903e+00 - 43 -8.7180001448292499e-01 1.7901126742696198e+00 1.5519575254278921e+00 - 44 7.8526164522640796e-01 2.4185951124909324e+00 1.2604481861672642e+01 + 43 -8.7180001448292632e-01 1.7901126742696181e+00 1.5519575254278912e+00 + 44 7.8526164522640973e-01 2.4185951124909324e+00 1.2604481861672646e+01 45 -8.0247682250156345e+00 4.9293205753843372e+00 -6.0682015920462939e+00 46 -7.1949455773882338e+00 6.5987259516018728e+00 5.4937477906872818e+00 - 47 2.1314788601538375e+00 3.3362663032911404e+00 8.4585802162670074e+00 - 48 -8.5076653112250291e+00 -7.1852711589841762e+00 5.5735000792544982e+00 + 47 2.1314788601538401e+00 3.3362663032911439e+00 8.4585802162670092e+00 + 48 -8.5076653112250309e+00 -7.1852711589841753e+00 5.5735000792545000e+00 49 -5.2670245468846746e+00 6.9877705136631088e+00 -5.1191274136784921e+00 - 50 6.7159251463526664e+00 -1.9613746718933034e+00 -1.5344273158709154e+00 + 50 6.7159251463526681e+00 -1.9613746718933052e+00 -1.5344273158709172e+00 51 -1.1727851021662977e+01 -5.1582585170714235e-01 -3.4928360372493388e+00 - 52 -1.1984284285057771e-01 1.1918867317733057e+00 3.9396044306165670e+00 - 53 4.9486726742870886e+00 1.0898234069639925e+00 1.0082593834352190e+01 + 52 -1.1984284285057949e-01 1.1918867317733066e+00 3.9396044306165670e+00 + 53 4.9486726742870886e+00 1.0898234069639943e+00 1.0082593834352192e+01 54 1.9535564702196746e+00 2.2045675779591183e+00 -1.0184339640672373e+01 - 55 1.0985523411199667e+01 3.8088963907017875e-01 -2.0149022524288043e+00 - 56 -1.1393680684316139e+00 3.9820344303361921e+00 5.3281327318845495e-01 + 55 1.0985523411199667e+01 3.8088963907017831e-01 -2.0149022524288047e+00 + 56 -1.1393680684316156e+00 3.9820344303361921e+00 5.3281327318845584e-01 57 -4.0457598988134817e+00 9.3402867028335077e+00 3.6326633592191828e+00 - 58 -9.5259925551691484e+00 -3.0439646719749209e+00 5.4130118641158047e+00 - 59 6.1684616977984712e+00 6.7515296579212762e+00 -8.2182898830145366e+00 + 58 -9.5259925551691467e+00 -3.0439646719749209e+00 5.4130118641158047e+00 + 59 6.1684616977984694e+00 6.7515296579212736e+00 -8.2182898830145419e+00 60 -5.4343710487746817e+00 7.8480050696419266e+00 -4.6430620541349326e+00 - 61 -2.5195325804478843e+00 -1.2692534018971337e+01 -1.0104567253349769e-01 + 61 -2.5195325804478834e+00 -1.2692534018971338e+01 -1.0104567253349681e-01 62 2.6584101684745818e+00 9.8218829465888779e-02 2.4244336018167600e-01 - 63 -5.8030976211176633e+00 -5.8640980265649132e+00 -4.9661385661230621e+00 - 64 5.1854732626889648e+00 5.4062029912491161e+00 -7.4682505070688565e+00 + 63 -5.8030976211176615e+00 -5.8640980265649096e+00 -4.9661385661230604e+00 + 64 5.1854732626889648e+00 5.4062029912491152e+00 -7.4682505070688574e+00 run_vdwl: -154.378489848664 run_coul: 0 run_stress: ! |- - -5.4624007123172817e+02 -5.4721759715152484e+02 -5.5903048343882665e+02 -1.6221103215693379e+01 -6.7886936766953410e+00 5.4672709772731153e+01 + -5.4624007123172805e+02 -5.4721759715152484e+02 -5.5903048343882665e+02 -1.6221103215693166e+01 -6.7886936766953978e+00 5.4672709772731096e+01 run_forces: ! |2 1 -7.7710895302100775e+00 9.8421268919149085e-01 -9.2597011523665484e-01 2 3.7458735949792326e+00 -1.1595362271395059e+01 6.0898696083058723e-01 - 3 3.8507676102829136e-01 2.1249103315545970e+00 -2.1091659350102829e+00 + 3 3.8507676102829136e-01 2.1249103315545970e+00 -2.1091659350102803e+00 4 1.6152778155646761e+00 5.7848628778240530e-01 1.0402974682179648e+01 5 2.7649657757706478e+00 4.0900725936990288e+00 6.6835500029952026e+00 6 6.5865965591105393e+00 -1.8292495063151177e+00 2.0366573729446835e+00 - 7 -3.3307881220012630e+00 -7.0942328484718971e+00 -3.7457028752467059e+00 - 8 -3.0885795093442283e+00 3.4989222472378345e-01 -1.5424167903817163e+00 - 9 -1.4165950829089580e+01 -5.3940768744079381e-02 6.4139844116377986e-01 + 7 -3.3307881220012661e+00 -7.0942328484718979e+00 -3.7457028752467076e+00 + 8 -3.0885795093442283e+00 3.4989222472378523e-01 -1.5424167903817172e+00 + 9 -1.4165950829089580e+01 -5.3940768744078493e-02 6.4139844116377898e-01 10 -4.2375705486574775e+00 1.5885910226589701e+00 -4.6304296857792444e+00 - 11 2.5005727825222128e+00 2.7999710123559614e+00 8.2537716086095188e+00 - 12 7.2068862770841138e+00 -7.1262985150488740e+00 -5.5812834302209096e+00 - 13 -1.8167920176170453e+00 -5.1670781420170431e-01 1.5646880590075538e+00 + 11 2.5005727825222119e+00 2.7999710123559618e+00 8.2537716086095152e+00 + 12 7.2068862770841138e+00 -7.1262985150488749e+00 -5.5812834302209078e+00 + 13 -1.8167920176170453e+00 -5.1670781420170608e-01 1.5646880590075538e+00 14 5.8676882814421871e+00 4.0565941081000698e+00 -7.0973772200470240e+00 - 15 -2.5275560092817706e-01 9.3977172310912849e-02 -9.9716762207694138e+00 - 16 -6.9338836089303175e+00 6.0213296077197844e+00 5.1874273368568140e+00 + 15 -2.5275560092817706e-01 9.3977172310914625e-02 -9.9716762207694121e+00 + 16 -6.9338836089303157e+00 6.0213296077197844e+00 5.1874273368568140e+00 17 8.7953600094300750e+00 2.8793107758462098e+00 4.8499081444476015e+00 - 18 -3.1588600347669251e+00 -3.4138281277311084e+00 3.7471063006923906e+00 + 18 -3.1588600347669233e+00 -3.4138281277311076e+00 3.7471063006923879e+00 19 3.4879085903840451e-02 -5.8773630155039998e+00 -7.0587843966793908e+00 - 20 3.4330211575164440e+00 -4.1371194520657628e-02 5.1329944991954957e-01 + 20 3.4330211575164431e+00 -4.1371194520657628e-02 5.1329944991954957e-01 21 -2.4947379150588445e+00 -9.4894349135054981e+00 5.0364943521040173e-01 - 22 5.7290751903491852e+00 4.9148163326514185e+00 -8.0069424396003779e+00 + 22 5.7290751903491843e+00 4.9148163326514211e+00 -8.0069424396003779e+00 23 6.4733242427884665e+00 -7.0483885816608449e+00 4.6473355322331757e+00 24 4.6479345521550304e+00 7.0925025187318305e+00 3.8525865642161286e+00 - 25 -3.4506424790473402e+00 -3.5399464500402189e+00 -6.6082903939147188e+00 - 26 5.9997061031751253e-01 6.0541226955683836e-01 -7.0861839854969526e+00 - 27 3.4071088271546022e+00 -7.6531751215214143e+00 7.2787548943419222e-01 - 28 -5.4557756543079119e+00 -5.1680412737283516e+00 2.9604843714511313e+00 + 25 -3.4506424790473402e+00 -3.5399464500402189e+00 -6.6082903939147171e+00 + 26 5.9997061031751298e-01 6.0541226955683747e-01 -7.0861839854969526e+00 + 27 3.4071088271546031e+00 -7.6531751215214117e+00 7.2787548943419267e-01 + 28 -5.4557756543079110e+00 -5.1680412737283543e+00 2.9604843714511335e+00 29 1.7085911862656871e+00 7.9153761626366883e+00 -2.2614782999669041e+00 - 30 8.6713923717970722e+00 -3.6245305638916414e+00 2.1225785953759368e+00 - 31 6.9792669132115908e+00 -3.4772972717074135e+00 -1.2101233867541827e+00 + 30 8.6713923717970740e+00 -3.6245305638916427e+00 2.1225785953759382e+00 + 31 6.9792669132115899e+00 -3.4772972717074158e+00 -1.2101233867541819e+00 32 6.1216044738549016e+00 4.1103412878257624e+00 -3.3121730936202827e+00 - 33 -7.6085526931230545e+00 -6.0171298821199670e+00 4.1648313412889255e+00 - 34 -8.0117159692062412e-01 1.2250441373794045e+00 -5.3195806368378307e+00 - 35 -1.8928310703700715e+00 -9.8771124140652624e+00 8.5290010448185205e-01 + 33 -7.6085526931230518e+00 -6.0171298821199679e+00 4.1648313412889264e+00 + 34 -8.0117159692062279e-01 1.2250441373794037e+00 -5.3195806368378324e+00 + 35 -1.8928310703700706e+00 -9.8771124140652606e+00 8.5290010448185027e-01 36 -1.2972038107481758e+00 8.8905397437812486e+00 -5.6974286702164834e-01 - 37 -2.6749889787982033e+00 2.6387889766527675e+00 5.4489977351032781e+00 - 38 -6.4457329686822096e-01 4.7973248360269380e+00 -2.1412759241677901e+00 + 37 -2.6749889787982042e+00 2.6387889766527675e+00 5.4489977351032781e+00 + 38 -6.4457329686822051e-01 4.7973248360269389e+00 -2.1412759241677897e+00 39 6.7111987839588494e+00 -4.7388212995722245e+00 8.5076346108378686e+00 - 40 -1.1502944187229440e-01 -2.7838311317517705e+00 -5.8729430758703129e+00 - 41 -9.1359818351046829e-01 2.6073407276930491e+00 9.1031480730908996e+00 + 40 -1.1502944187229529e-01 -2.7838311317517705e+00 -5.8729430758703129e+00 + 41 -9.1359818351046918e-01 2.6073407276930491e+00 9.1031480730908978e+00 42 6.2516745978205881e+00 -2.8059454405892170e+00 -5.8045100753475420e+00 - 43 -9.0162068561726094e-01 1.7535086383109662e+00 1.5881942260025375e+00 - 44 7.4568957675813063e-01 2.3291210910341831e+00 1.2682491711342710e+01 - 45 -7.8827045512830738e+00 5.1136204143684516e+00 -6.0232742119880056e+00 - 46 -7.1909991859724354e+00 6.5930493717367806e+00 5.4969832160946623e+00 - 47 2.1930190183556797e+00 3.3770787280802130e+00 8.3827321095950467e+00 - 48 -8.4316741550207048e+00 -7.2589166508188452e+00 5.6757900084705000e+00 - 49 -5.2787919951503248e+00 6.9617894250151355e+00 -5.1118372569041028e+00 - 50 6.7549914755953635e+00 -1.9686939048679046e+00 -1.5763956001832360e+00 + 43 -9.0162068561726005e-01 1.7535086383109655e+00 1.5881942260025386e+00 + 44 7.4568957675813063e-01 2.3291210910341849e+00 1.2682491711342710e+01 + 45 -7.8827045512830756e+00 5.1136204143684516e+00 -6.0232742119880056e+00 + 46 -7.1909991859724345e+00 6.5930493717367815e+00 5.4969832160946615e+00 + 47 2.1930190183556797e+00 3.3770787280802104e+00 8.3827321095950467e+00 + 48 -8.4316741550207048e+00 -7.2589166508188434e+00 5.6757900084705000e+00 + 49 -5.2787919951503230e+00 6.9617894250151364e+00 -5.1118372569041028e+00 + 50 6.7549914755953626e+00 -1.9686939048679011e+00 -1.5763956001832342e+00 51 -1.1722835834823451e+01 -4.6090445788619194e-01 -3.5458019581496889e+00 - 52 -2.9146420150158925e-01 1.0390697544380689e+00 3.8461064397951099e+00 - 53 4.9994022968781895e+00 1.1625746423885346e+00 1.0131719546021975e+01 - 54 1.9501032708877051e+00 2.1828284989853479e+00 -1.0229107175251080e+01 - 55 1.1017951893515445e+01 4.0696912545743419e-01 -2.0395244626507556e+00 - 56 -7.9765871790228693e-01 4.0562421889191471e+00 6.1126701396247074e-01 - 57 -3.9071992996955269e+00 9.4745522825635540e+00 3.5315639655021500e+00 + 52 -2.9146420150158747e-01 1.0390697544380672e+00 3.8461064397951104e+00 + 53 4.9994022968781850e+00 1.1625746423885328e+00 1.0131719546021973e+01 + 54 1.9501032708877042e+00 2.1828284989853461e+00 -1.0229107175251080e+01 + 55 1.1017951893515447e+01 4.0696912545743330e-01 -2.0395244626507560e+00 + 56 -7.9765871790228826e-01 4.0562421889191462e+00 6.1126701396247074e-01 + 57 -3.9071992996955269e+00 9.4745522825635557e+00 3.5315639655021500e+00 58 -9.7049015797211631e+00 -2.9167333408943041e+00 5.4251373767880153e+00 - 59 6.2022134360845467e+00 6.8057985261686955e+00 -8.1728610238859503e+00 - 60 -5.4918491605506929e+00 7.8759347682481566e+00 -4.6821853616106752e+00 + 59 6.2022134360845458e+00 6.8057985261686946e+00 -8.1728610238859503e+00 + 60 -5.4918491605506929e+00 7.8759347682481584e+00 -4.6821853616106788e+00 61 -2.4999011490572789e+00 -1.2787139053923346e+01 -2.1638212824307607e-01 - 62 2.6906159661430955e+00 1.3928009268586639e-01 2.0167150507734921e-01 - 63 -5.8283969248223002e+00 -5.9257942363533367e+00 -5.0040717151583411e+00 + 62 2.6906159661430942e+00 1.3928009268586861e-01 2.0167150507734788e-01 + 63 -5.8283969248223002e+00 -5.9257942363533367e+00 -5.0040717151583429e+00 64 5.2440455790444869e+00 5.4539376835505564e+00 -7.4979555890288445e+00 ... diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml index 75dafe7449..7dda923362 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Mon Jan 11 03:57:49 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 5e-11 prerequisites: ! | pair tersoff/zbl diff --git a/unittest/force-styles/tests/manybody-pair-vashishta.yaml b/unittest/force-styles/tests/manybody-pair-vashishta.yaml index 113d7ae840..8f5e6373eb 100644 --- a/unittest/force-styles/tests/manybody-pair-vashishta.yaml +++ b/unittest/force-styles/tests/manybody-pair-vashishta.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 5e-13 prerequisites: ! | pair vashishta diff --git a/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml b/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml index bab37d5c14..466e9ff412 100644 --- a/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml +++ b/unittest/force-styles/tests/manybody-pair-vashishta_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:33 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:09:21 2021 epsilon: 1e-12 prerequisites: ! | pair vashishta/table diff --git a/unittest/force-styles/tests/mol-pair-beck.yaml b/unittest/force-styles/tests/mol-pair-beck.yaml index 160ed57874..ca74372e4c 100644 --- a/unittest/force-styles/tests/mol-pair-beck.yaml +++ b/unittest/force-styles/tests/mol-pair-beck.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:38 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born.yaml b/unittest/force-styles/tests/mol-pair-born.yaml index b6bd2c0484..11011100d1 100644 --- a/unittest/force-styles/tests/mol-pair-born.yaml +++ b/unittest/force-styles/tests/mol-pair-born.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 21 Jul 2020 -date_generated: Fri Jul 31 11:30:59 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:38 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml index 7ced560d68..6280c9a9f3 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 21 Jul 2020 -date_generated: Sat Aug 1 16:17:46 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:38 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_dsf_cs.yaml b/unittest/force-styles/tests/mol-pair-born_coul_dsf_cs.yaml index 5389455593..fa49c094f3 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_dsf_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_dsf_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml index f61926e37a..d46525ad6c 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-born_coul_long_cs.yaml index 0b60d5f627..56de63afb8 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_long_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml index 991dd0ef77..c4c907a1e0 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml index fe6a0faf84..ee9f18f27c 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml index 79dd45154b..32a2b44328 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml index 234e9993c6..797cec95a1 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:39 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-born_coul_wolf_cs.yaml b/unittest/force-styles/tests/mol-pair-born_coul_wolf_cs.yaml index ab13302868..33323ccdd6 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_wolf_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_wolf_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck.yaml b/unittest/force-styles/tests/mol-pair-buck.yaml index 6600c63b4f..6f4cd2474b 100644 --- a/unittest/force-styles/tests/mol-pair-buck.yaml +++ b/unittest/force-styles/tests/mol-pair-buck.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 6e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_cut.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_cut.yaml index 928473176d..d7d72a1dfe 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml index 07606715b8..2791961f69 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 4e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml index f4ee478ef8..4667f63a75 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml index 444f02236d..a3816a6451 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 21 Jul 2020 -date_generated: Sat Aug 1 08:36:45 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml index 24a23bb444..52536b14d4 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml index 5e89b1ddf7..ecdbc8478c 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:40 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml index 800e9fe8c4..fed44214d8 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml index 0cf95ba93b..14624b04e5 100644 --- a/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-09 prerequisites: ! | atom full @@ -32,72 +32,72 @@ pair_coeff: ! | 5 5 127198.698386798 0.207005479340455 37.2289658745028 extract: ! "" natoms: 29 -init_vdwl: 143.844961202964 +init_vdwl: 143.844978614334 init_coul: 225.821815126925 init_stress: ! |2- - 2.6272111873723196e+02 2.4458742404218080e+02 4.2242967619246474e+02 -4.9851077637716458e+01 2.3789370276650072e+01 5.6295168409689467e+01 + 2.6272115366310851e+02 2.4458745276042501e+02 4.2242971713439869e+02 -4.9851077224341211e+01 2.3789370660435189e+01 5.6295145580816097e+01 init_forces: ! |2 - 1 -1.4505624410494478e+00 3.8004146845640946e+01 4.9065031053880901e+01 - 2 2.3385004323266994e+01 1.6548373003634683e+01 -2.9130977751412878e+01 - 3 -1.9512019437951746e+01 -5.0838222458975778e+01 -2.0151694098876884e+01 - 4 -4.2904209818932246e+00 1.1246498890619860e+00 -3.2387274210462231e+00 - 5 -1.8674709846410773e+00 -1.5566490773014534e+00 6.0082552497191397e+00 - 6 -6.9625355347470915e+01 7.3169400283632356e+01 6.3503698624949230e+01 - 7 2.2872748139782947e-02 -2.0565225036292986e+01 -1.2607142869450965e+02 - 8 1.1996695065424641e+00 -1.8715100009380692e+00 3.7423138153540876e+01 - 9 1.2011042893923937e+01 5.3887310332750928e+00 4.7397823880093092e+01 - 10 4.8241827191543997e+01 -6.2511416543000180e+01 -1.8155085286183130e+01 - 11 -2.0864825271762375e+00 -1.9912622313285950e+00 -5.4830247539805992e+00 - 12 1.1616718033393738e+01 3.5495575455578630e+00 -2.2659927233488144e+00 - 13 4.3604500704930667e+00 -1.7673671146127139e+00 -2.5819544454075111e-01 - 14 -2.8754771443668155e+00 7.2404586566233820e-01 -4.7880073941201999e+00 - 15 2.4933061678330612e-01 4.4129067076138435e+00 6.2372609624633168e-01 - 16 4.0308368847826046e+01 -3.2807263621689664e+01 -8.8340531400600753e+01 - 17 -3.8534551365139798e+01 3.0771085961339129e+01 9.2205187827301017e+01 - 18 3.5576850500834917e-01 4.7710862431354206e+00 -7.8576979196455978e+00 - 19 1.9901900021180869e+00 -7.2120494406854874e-01 5.5217488469162515e+00 - 20 -2.9133095976939076e+00 -3.9873825539762580e+00 4.1252912728686368e+00 - 21 -8.8829720545896826e+00 -8.3744024680716311e+00 2.7526234064504237e+01 - 22 -1.5742514391100176e+01 -4.8231234667069982e+00 -2.1626154413397067e+01 - 23 2.4211676287893816e+01 1.3610504586141577e+01 -5.3979045461797428e+00 - 24 5.3565422099278761e+00 -2.4298981889237417e+01 1.3585253788291306e+01 - 25 -2.1457575285633951e+01 1.0104637714343605e+00 -1.7195902085341874e+01 - 26 1.5538242805947316e+01 2.3034633528199404e+01 2.9964006765042197e+00 - 27 4.6260665161027301e+00 -2.6306305085064849e+01 9.9386139884880809e+00 - 28 -2.3342848199176302e+01 7.6603913259359970e+00 -1.5178322120241885e+01 - 29 1.9107789198971762e+01 1.8640339901000139e+01 5.2192425301227203e+00 -run_vdwl: 143.664033848008 -run_coul: 225.788771362758 + 1 -1.4505626034745036e+00 3.8004147184195531e+01 4.9065031148995793e+01 + 2 2.3385004350396244e+01 1.6548373059368291e+01 -2.9130977758085685e+01 + 3 -1.9512020703537843e+01 -5.0838221276192705e+01 -2.0151693376982845e+01 + 4 -4.2904209888378588e+00 1.1246498928035378e+00 -3.2387274227466589e+00 + 5 -1.8674710698629744e+00 -1.5566491115857672e+00 6.0082553420196669e+00 + 6 -6.9625355082065013e+01 7.3169399799559514e+01 6.3503698019226839e+01 + 7 2.2868369509643660e-02 -2.0565222793052861e+01 -1.2607143811848930e+02 + 8 1.1996681428294511e+00 -1.8715118510036990e+00 3.7423149521601651e+01 + 9 1.2011042862979503e+01 5.3887311217158382e+00 4.7397824041093678e+01 + 10 4.8241808301884696e+01 -6.2511419298758931e+01 -1.8155088068620010e+01 + 11 -2.0864824068805468e+00 -1.9912626693428330e+00 -5.4830251319223384e+00 + 12 1.1616736334318013e+01 3.5495698468481334e+00 -2.2660038170498109e+00 + 13 4.3604501552112307e+00 -1.7673670999803819e+00 -2.5819547541081661e-01 + 14 -2.8754771032183997e+00 7.2404590909978195e-01 -4.7880074893069073e+00 + 15 2.4933085503479277e-01 4.4129068756699281e+00 6.2372602282041478e-01 + 16 4.0308375460979065e+01 -3.2807273819944662e+01 -8.8340521147615505e+01 + 17 -3.8534551008005820e+01 3.0771085172025348e+01 9.2205189697673958e+01 + 18 3.5576858779624221e-01 4.7710863658439413e+00 -7.8576980468242379e+00 + 19 1.9901899970750361e+00 -7.2120494775865229e-01 5.5217488427612249e+00 + 20 -2.9133095915866951e+00 -3.9873825487101766e+00 4.1252912739135876e+00 + 21 -8.8829720356918820e+00 -8.3744024885830814e+00 2.7526234045306790e+01 + 22 -1.5742514391939986e+01 -4.8231234673901637e+00 -2.1626154414085931e+01 + 23 2.4211676289077477e+01 1.3610504586446947e+01 -5.3979045459272461e+00 + 24 5.3565422529126572e+00 -2.4298981872347689e+01 1.3585253853834935e+01 + 25 -2.1457575287597841e+01 1.0104637707756350e+00 -1.7195902082789587e+01 + 26 1.5538242811329107e+01 2.3034633531441880e+01 2.9964006799739407e+00 + 27 4.6260665022300582e+00 -2.6306305097469373e+01 9.9386139962313145e+00 + 28 -2.3342848199954272e+01 7.6603913255018758e+00 -1.5178322120320068e+01 + 29 1.9107789199090401e+01 1.8640339900824774e+01 5.2192425307232284e+00 +run_vdwl: 143.664052390025 +run_coul: 225.78877136265 run_stress: ! |2- - 2.6298251505235868e+02 2.4459390353665563e+02 4.2108843574777688e+02 -4.9575317711225544e+01 2.3909358907758179e+01 5.6450588933021592e+01 + 2.6298255053149916e+02 2.4459393805653841e+02 4.2108847711322130e+02 -4.9575323006225169e+01 2.3909358002752519e+01 5.6450569769884474e+01 run_forces: ! |2 - 1 -1.3652720446656716e+00 3.7954572140886413e+01 4.8884538610219984e+01 - 2 2.3313139975676521e+01 1.6527407427439215e+01 -2.8962850556748574e+01 - 3 -1.9564712492477259e+01 -5.0756725254438585e+01 -2.0129969655577696e+01 - 4 -4.2684079132961532e+00 1.1154799200799748e+00 -3.2315050710172626e+00 - 5 -1.8626808257808209e+00 -1.5514191365901677e+00 5.9922525317567326e+00 - 6 -6.9327725793824527e+01 7.2910029709312454e+01 6.2943842478017125e+01 - 7 3.2729296511785085e-02 -2.0499844250721825e+01 -1.2523227297784275e+02 - 8 9.0645129380789513e-01 -1.5931691793865552e+00 3.7347008229957787e+01 - 9 1.1981987334884325e+01 5.2954472303848910e+00 4.7222348781695430e+01 - 10 4.8288299691503205e+01 -6.2566569339379377e+01 -1.8224017564064091e+01 - 11 -2.0738715074249523e+00 -1.9563279663018796e+00 -5.4254319559511295e+00 - 12 1.1610862764961743e+01 3.5316918655662044e+00 -2.3173751221395720e+00 - 13 4.3429255708311079e+00 -1.7528672352564680e+00 -2.5697582206668895e-01 - 14 -2.8597049731416870e+00 7.1516577588292751e-01 -4.7422665041230756e+00 - 15 2.4141777805199607e-01 4.4181497005137018e+00 6.3284863696190541e-01 - 16 4.0232203794586695e+01 -3.2797821300800962e+01 -8.8231810120087630e+01 - 17 -3.8475340336751799e+01 3.0789552016439433e+01 9.2071434975793437e+01 - 18 3.0444737165682245e-01 4.7206637253266726e+00 -7.8186561033362132e+00 - 19 2.0279176824528000e+00 -6.9153978261739135e-01 5.5370947284278174e+00 - 20 -2.8995246410850308e+00 -3.9661906680569294e+00 4.0718950075472362e+00 - 21 -8.9482093919054275e+00 -8.3621998308864107e+00 2.7577075884535351e+01 - 22 -1.5805953773942205e+01 -4.8572145959519402e+00 -2.1662217002199810e+01 - 23 2.4340519096091096e+01 1.3631551507334764e+01 -5.4129063248356344e+00 - 24 5.5331809337240436e+00 -2.4561349924805576e+01 1.3801516502339091e+01 - 25 -2.1784339531775434e+01 1.0179046192128527e+00 -1.7474990059161328e+01 - 26 1.5689568156175840e+01 2.3291559483700894e+01 3.0620904827826170e+00 - 27 4.7026950421097862e+00 -2.6383838671315459e+01 9.9362503961500153e+00 - 28 -2.3442655453950238e+01 7.6899620172100764e+00 -1.5219891622806223e+01 - 29 1.9130052896995540e+01 1.8687939997219068e+01 5.2629392157731738e+00 + 1 -1.3652720834577341e+00 3.7954573432779917e+01 4.8884538769138338e+01 + 2 2.3313140000366758e+01 1.6527407480878715e+01 -2.8962850562818822e+01 + 3 -1.9564718670724936e+01 -5.0756718987621646e+01 -2.0129965484716372e+01 + 4 -4.2684080401728961e+00 1.1154798912797066e+00 -3.2315051383711020e+00 + 5 -1.8626810692630200e+00 -1.5514196446909378e+00 5.9922527671295303e+00 + 6 -6.9327720409994853e+01 7.2910023757618887e+01 6.2943838473388915e+01 + 7 3.2725394906065901e-02 -2.0499842417893980e+01 -1.2523228162779102e+02 + 8 9.0645146796449960e-01 -1.5931711516900440e+00 3.7347017369470542e+01 + 9 1.1981987319613346e+01 5.2954473123148720e+00 4.7222348956569590e+01 + 10 4.8288281212283742e+01 -6.2566570322889454e+01 -1.8224021907990483e+01 + 11 -2.0738715105412719e+00 -1.9563279903586321e+00 -5.4254319984735320e+00 + 12 1.1610878367908992e+01 3.5317032256430076e+00 -2.3173846571471395e+00 + 13 4.3429256472591025e+00 -1.7528672157398184e+00 -2.5697584881970975e-01 + 14 -2.8597049514773167e+00 7.1516578275653253e-01 -4.7422665431420148e+00 + 15 2.4141798790025348e-01 4.4181498659013112e+00 6.3284857350558965e-01 + 16 4.0232210797970701e+01 -3.2797832127730494e+01 -8.8231799256317260e+01 + 17 -3.8475339975415856e+01 3.0789551133759257e+01 9.2071437068448233e+01 + 18 3.0444744501753151e-01 4.7206638357915631e+00 -7.8186562242979116e+00 + 19 2.0279176776152252e+00 -6.9153978564093010e-01 5.5370947240235608e+00 + 20 -2.8995246349425892e+00 -3.9661906625562011e+00 4.0718950082869085e+00 + 21 -8.9482093741669626e+00 -8.3621998525228864e+00 2.7577075866251551e+01 + 22 -1.5805953774649829e+01 -4.8572145967141411e+00 -2.1662217002957558e+01 + 23 2.4340519097230196e+01 1.3631551507602921e+01 -5.4129063246281666e+00 + 24 5.5331809763522193e+00 -2.4561349908059270e+01 1.3801516566834152e+01 + 25 -2.1784339528699515e+01 1.0179046212252338e+00 -1.7474990048927918e+01 + 26 1.5689568160812019e+01 2.3291559486515375e+01 3.0620904858297013e+00 + 27 4.7026950277510515e+00 -2.6383838683693700e+01 9.9362504040370077e+00 + 28 -2.3442655457776933e+01 7.6899620159252651e+00 -1.5219891624415277e+01 + 29 1.9130052900332021e+01 1.8687939997809593e+01 5.2629392179006302e+00 ... diff --git a/unittest/force-styles/tests/mol-pair-buck_long_coul_off.yaml b/unittest/force-styles/tests/mol-pair-buck_long_coul_off.yaml index 1c8ab223e0..475e588687 100644 --- a/unittest/force-styles/tests/mol-pair-buck_long_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_long_coul_off.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_long_cut_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_long_cut_coul_long.yaml index 4c54416a19..d51ff36d84 100644 --- a/unittest/force-styles/tests/mol-pair-buck_long_cut_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_long_cut_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_mdf.yaml b/unittest/force-styles/tests/mol-pair-buck_mdf.yaml index 3eb30c04fb..8f284c910c 100644 --- a/unittest/force-styles/tests/mol-pair-buck_mdf.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_mdf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_long.yaml index d2a027b202..ff11010ebd 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-09 prerequisites: ! | atom full 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 75ea5e64f9..0c4d543e7a 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,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-08 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml index 6618461c9a..c204dd600f 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:41 2021 epsilon: 2e-09 prerequisites: ! | atom full @@ -32,72 +32,72 @@ pair_coeff: ! | 5 5 127198.698386798 0.207005479340455 37.2289658745028 extract: ! "" natoms: 29 -init_vdwl: 143.844961202964 +init_vdwl: 143.844978614334 init_coul: 225.821848735651 init_stress: ! |2- - 2.6272113814088459e+02 2.4458742749392664e+02 4.2242968800359819e+02 -4.9851073478676085e+01 2.3789377934310345e+01 5.6295172388862447e+01 + 2.6272117306676120e+02 2.4458745621217102e+02 4.2242972894553253e+02 -4.9851073065300838e+01 2.3789378318095498e+01 5.6295149559988992e+01 init_forces: ! |2 - 1 -1.4505640619389681e+00 3.8004146585790465e+01 4.9065029691291613e+01 - 2 2.3385003661429913e+01 1.6548372213986102e+01 -2.9130976125306312e+01 - 3 -1.9512019324113055e+01 -5.0838222586853490e+01 -2.0151694230673115e+01 - 4 -4.2904209431208518e+00 1.1246503634939833e+00 -3.2387272414004546e+00 - 5 -1.8674707369894010e+00 -1.5566480505693736e+00 6.0082554357882367e+00 - 6 -6.9625355684493741e+01 7.3169400746899186e+01 6.3503696978944937e+01 - 7 2.2872248567361957e-02 -2.0565224930504840e+01 -1.2607143020067289e+02 - 8 1.1996689487155892e+00 -1.8715105185863312e+00 3.7423140066925569e+01 - 9 1.2011044766358129e+01 5.3887301934646903e+00 4.7397825767121098e+01 - 10 4.8241827321101539e+01 -6.2511416084042395e+01 -1.8155085841912381e+01 - 11 -2.0864825790929138e+00 -1.9912615087658645e+00 -5.4830246849536080e+00 - 12 1.1616718202409702e+01 3.5495574649890029e+00 -2.2659934810669191e+00 - 13 4.3604501526858250e+00 -1.7673672190505618e+00 -2.5819527958372701e-01 - 14 -2.8754772284825929e+00 7.2404565365905771e-01 -4.7880073211012384e+00 - 15 2.4933049942539601e-01 4.4129064128547490e+00 6.2372662613715280e-01 - 16 4.0308369518161520e+01 -3.2807264210996060e+01 -8.8340531374457925e+01 - 17 -3.8534551565160626e+01 3.0771086452493318e+01 9.2205187548985350e+01 - 18 3.5576917908861894e-01 4.7710861153208066e+00 -7.8576990689625514e+00 - 19 1.9901880325227932e+00 -7.2120627904964174e-01 5.5217485955577530e+00 - 20 -2.9133077367100180e+00 -3.9873812719318282e+00 4.1252922604915137e+00 - 21 -8.8829725086789715e+00 -8.3744018341613344e+00 2.7526234717445835e+01 - 22 -1.5742517626454115e+01 -4.8231253812211401e+00 -2.1626156254566173e+01 - 23 2.4211679998537132e+01 1.3610506006094726e+01 -5.3979034250046327e+00 - 24 5.3565423261624705e+00 -2.4298981626126210e+01 1.3585253085343975e+01 - 25 -2.1457576766665820e+01 1.0104626762357114e+00 -1.7195902773892538e+01 - 26 1.5538244602897750e+01 2.3034634692097089e+01 2.9964020454921334e+00 - 27 4.6260663831346509e+00 -2.6306304919818423e+01 9.9386137948272868e+00 - 28 -2.3342851186798200e+01 7.6603903379992113e+00 -1.5178323537904395e+01 - 29 1.9107792107500899e+01 1.8640340506299360e+01 5.2192442271064312e+00 -run_vdwl: 143.664033843465 -run_coul: 225.788807114573 + 1 -1.4505642243640215e+00 3.8004146924345065e+01 4.9065029786406498e+01 + 2 2.3385003688559166e+01 1.6548372269719717e+01 -2.9130976131979111e+01 + 3 -1.9512020589699148e+01 -5.0838221404070403e+01 -2.0151693508779069e+01 + 4 -4.2904209500654860e+00 1.1246503672355344e+00 -3.2387272431008922e+00 + 5 -1.8674708222112977e+00 -1.5566480848536877e+00 6.0082555280887631e+00 + 6 -6.9625355419087825e+01 7.3169400262826329e+01 6.3503696373222517e+01 + 7 2.2867869937221619e-02 -2.0565222687264711e+01 -1.2607143962465263e+02 + 8 1.1996675850025813e+00 -1.8715123686519544e+00 3.7423151434986330e+01 + 9 1.2011044735413689e+01 5.3887302819054357e+00 4.7397825928121676e+01 + 10 4.8241808431442209e+01 -6.2511418839801145e+01 -1.8155088624349265e+01 + 11 -2.0864824587972244e+00 -1.9912619467801009e+00 -5.4830250628953481e+00 + 12 1.1616736503333982e+01 3.5495697662792747e+00 -2.2660045747679183e+00 + 13 4.3604502374039908e+00 -1.7673672044182291e+00 -2.5819531045379251e-01 + 14 -2.8754771873341758e+00 7.2404569709650146e-01 -4.7880074162879485e+00 + 15 2.4933073767688302e-01 4.4129065809108328e+00 6.2372655271123578e-01 + 16 4.0308376131314546e+01 -3.2807274409251065e+01 -8.8340521121472662e+01 + 17 -3.8534551208026642e+01 3.0771085663179537e+01 9.2205189419358319e+01 + 18 3.5576926187651203e-01 4.7710862380293300e+00 -7.8576991961411933e+00 + 19 1.9901880274797432e+00 -7.2120628273974552e-01 5.5217485914027300e+00 + 20 -2.9133077306028037e+00 -3.9873812666657433e+00 4.1252922615364644e+00 + 21 -8.8829724897811690e+00 -8.3744018546727830e+00 2.7526234698248395e+01 + 22 -1.5742517627293919e+01 -4.8231253819043038e+00 -2.1626156255255044e+01 + 23 2.4211679999720808e+01 1.3610506006400097e+01 -5.3979034247521342e+00 + 24 5.3565423691472525e+00 -2.4298981609236485e+01 1.3585253150887608e+01 + 25 -2.1457576768629711e+01 1.0104626755769854e+00 -1.7195902771340254e+01 + 26 1.5538244608279541e+01 2.3034634695339562e+01 2.9964020489618552e+00 + 27 4.6260663692619683e+00 -2.6306304932222957e+01 9.9386138025705169e+00 + 28 -2.3342851187576169e+01 7.6603903375650901e+00 -1.5178323537982580e+01 + 29 1.9107792107619538e+01 1.8640340506123994e+01 5.2192442277069402e+00 +run_vdwl: 143.664052385482 +run_coul: 225.788807113984 run_stress: ! |2- - 2.6298253730875990e+02 2.4459390608852283e+02 4.2108844885702558e+02 -4.9575312662970951e+01 2.3909364645213543e+01 5.6450595032795320e+01 + 2.6298257278765311e+02 2.4459394060869445e+02 4.2108849022194408e+02 -4.9575317957752254e+01 2.3909363739954845e+01 5.6450575869687796e+01 run_forces: ! |2 - 1 -1.3652735543008816e+00 3.7954571133178902e+01 4.8884537377309172e+01 - 2 2.3313139309989094e+01 1.6527406547056287e+01 -2.8962849270283392e+01 - 3 -1.9564712384032376e+01 -5.0756725329741236e+01 -2.0129969747702308e+01 - 4 -4.2684080200768406e+00 1.1154804510128165e+00 -3.2315048619404054e+00 - 5 -1.8626805980022214e+00 -1.5514180174720389e+00 5.9922526428223755e+00 - 6 -6.9327726613063405e+01 7.2910030587436125e+01 6.2943841090264428e+01 - 7 3.2729124302063782e-02 -2.0499844044312820e+01 -1.2523227476685206e+02 - 8 9.0645037724821509e-01 -1.5931699446420091e+00 3.7347010853073435e+01 - 9 1.1981988562945483e+01 5.2954468151255067e+00 4.7222350357045890e+01 - 10 4.8288299835295966e+01 -6.2566569083557049e+01 -1.8224018086894844e+01 - 11 -2.0738716050222630e+00 -1.9563271603792205e+00 -5.4254318756542368e+00 - 12 1.1610864028639977e+01 3.5316916580070092e+00 -2.3173763560781429e+00 - 13 4.3429257276773807e+00 -1.7528673949822231e+00 -2.5697563580528093e-01 - 14 -2.8597051905279471e+00 7.1516550165881965e-01 -4.7422662564667295e+00 - 15 2.4141775499873258e-01 4.4181494329616786e+00 6.3284916283478820e-01 - 16 4.0232204451083376e+01 -3.2797821752234313e+01 -8.8231810184066035e+01 - 17 -3.8475340125721864e+01 3.0789552823136074e+01 9.2071434225822074e+01 - 18 3.0444797968268300e-01 4.7206637648615688e+00 -7.8186573872028138e+00 - 19 2.0279150125912517e+00 -6.9154201326913600e-01 5.5370944385616223e+00 - 20 -2.8995220719101922e+00 -3.9661888702042210e+00 4.0718961555885951e+00 - 21 -8.9482098879923537e+00 -8.3621991830172071e+00 2.7577076547654709e+01 - 22 -1.5805955548410763e+01 -4.8572159943051245e+00 -2.1662218351727955e+01 - 23 2.4340521395832020e+01 1.3631552339738477e+01 -5.4129057423025664e+00 - 24 5.5331810643516564e+00 -2.4561349600827779e+01 1.3801515937783783e+01 - 25 -2.1784341755480526e+01 1.0179032133762751e+00 -1.7474990741497301e+01 - 26 1.5689570822659292e+01 2.3291561154430479e+01 3.0620923138000120e+00 - 27 4.7026946479168608e+00 -2.6383838593099334e+01 9.9362502379539066e+00 - 28 -2.3442657625683115e+01 7.6899612511865811e+00 -1.5219892618907782e+01 - 29 1.9130054885010718e+01 1.8687940308877128e+01 5.2629405428671072e+00 + 1 -1.3652735930906894e+00 3.7954572425088600e+01 4.8884537536228251e+01 + 2 2.3313139334678663e+01 1.6527406600491211e+01 -2.8962849276354000e+01 + 3 -1.9564718562282973e+01 -5.0756719062921292e+01 -2.0129965576839844e+01 + 4 -4.2684081469531368e+00 1.1154804222099293e+00 -3.2315049292955824e+00 + 5 -1.8626808414826610e+00 -1.5514185255808333e+00 5.9922528781941766e+00 + 6 -6.9327721229262110e+01 7.2910024635730380e+01 6.2943837085648937e+01 + 7 3.2725222830676137e-02 -2.0499842211560001e+01 -1.2523228341650837e+02 + 8 9.0645055137852115e-01 -1.5931719167310145e+00 3.7347019992128743e+01 + 9 1.1981988547677094e+01 5.2954468970124511e+00 4.7222350531971742e+01 + 10 4.8288281356087531e+01 -6.2566570067320434e+01 -1.8224022430624395e+01 + 11 -2.0738716081392377e+00 -1.9563271844965389e+00 -5.4254319181514443e+00 + 12 1.1610879631578506e+01 3.5317030183327125e+00 -2.3173858911656642e+00 + 13 4.3429258040952297e+00 -1.7528673754740225e+00 -2.5697566254992021e-01 + 14 -2.8597051688567952e+00 7.1516550852642913e-01 -4.7422662954861217e+00 + 15 2.4141796485202816e-01 4.4181495983415076e+00 6.3284909937970446e-01 + 16 4.0232211454356282e+01 -3.2797832579156953e+01 -8.8231799320354028e+01 + 17 -3.8475339764361301e+01 3.0789551940448018e+01 9.2071436318485866e+01 + 18 3.0444805304334399e-01 4.7206638753263892e+00 -7.8186575081644856e+00 + 19 2.0279150077542512e+00 -6.9154201629216772e-01 5.5370944341575088e+00 + 20 -2.8995220657682923e+00 -3.9661888647039816e+00 4.0718961563281235e+00 + 21 -8.9482098702532671e+00 -8.3621992046533951e+00 2.7577076529370782e+01 + 22 -1.5805955549117563e+01 -4.8572159950668672e+00 -2.1662218352485397e+01 + 23 2.4340521396969667e+01 1.3631552340005888e+01 -5.4129057420952673e+00 + 24 5.5331811069800025e+00 -2.4561349584081412e+01 1.3801516002278914e+01 + 25 -2.1784341752404423e+01 1.0179032153888428e+00 -1.7474990731263802e+01 + 26 1.5689570827295116e+01 2.3291561157244697e+01 3.0620923168469263e+00 + 27 4.7026946335578899e+00 -2.6383838605477855e+01 9.9362502458408990e+00 + 28 -2.3442657629509469e+01 7.6899612499018408e+00 -1.5219892620516704e+01 + 29 1.9130054888347100e+01 1.8687940309467866e+01 5.2629405449944144e+00 ... diff --git a/unittest/force-styles/tests/mol-pair-cosine_squared.yaml b/unittest/force-styles/tests/mol-pair-cosine_squared.yaml index b1d44726c9..ee6faf6235 100644 --- a/unittest/force-styles/tests/mol-pair-cosine_squared.yaml +++ b/unittest/force-styles/tests/mol-pair-cosine_squared.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_cut.yaml b/unittest/force-styles/tests/mol-pair-coul_cut.yaml index 6f5c85343b..921e682a9a 100644 --- a/unittest/force-styles/tests/mol-pair-coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml index 25dfcf21bb..20b467b728 100644 --- a/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_debye.yaml b/unittest/force-styles/tests/mol-pair-coul_debye.yaml index 064ea744c6..a7902442d1 100644 --- a/unittest/force-styles/tests/mol-pair-coul_debye.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_debye.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_diel.yaml b/unittest/force-styles/tests/mol-pair-coul_diel.yaml index 565cd5f7b2..a417ee09bf 100644 --- a/unittest/force-styles/tests/mol-pair-coul_diel.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_diel.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-coul_dsf.yaml index b586a73bb6..9bc59e4431 100644 --- a/unittest/force-styles/tests/mol-pair-coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_dsf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 1e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_long.yaml b/unittest/force-styles/tests/mol-pair-coul_long.yaml index 884599ba7e..9c3c933100 100644 --- a/unittest/force-styles/tests/mol-pair-coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-coul_long_cs.yaml index 164acce939..02426dbdc3 100644 --- a/unittest/force-styles/tests/mol-pair-coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_long_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-coul_long_soft.yaml index c1a6832713..b769aabf93 100644 --- a/unittest/force-styles/tests/mol-pair-coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 epsilon: 3e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_msm.yaml b/unittest/force-styles/tests/mol-pair-coul_msm.yaml index 83e633d42f..83b8550101 100644 --- a/unittest/force-styles/tests/mol-pair-coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml index 05418a2f75..289a3e0e38 100644 --- a/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:12 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_shield.yaml b/unittest/force-styles/tests/mol-pair-coul_shield.yaml index 58e75ad6d1..fa64e7d0cb 100644 --- a/unittest/force-styles/tests/mol-pair-coul_shield.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_shield.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml b/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml index 85a3343367..d08bbf4c86 100644 --- a/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_slater_long.yaml b/unittest/force-styles/tests/mol-pair-coul_slater_long.yaml index 9000f80d0d..b731508901 100644 --- a/unittest/force-styles/tests/mol-pair-coul_slater_long.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_slater_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml b/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml index b2b3509149..5c3c637193 100644 --- a/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_streitz_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml b/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml index ad7aa1ccc1..ec3b354df4 100644 --- a/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_streitz_wolf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:43 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_table.yaml b/unittest/force-styles/tests/mol-pair-coul_table.yaml index aa9ab54062..54baba354c 100644 --- a/unittest/force-styles/tests/mol-pair-coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml index 2691280d70..d5ed5fab83 100644 --- a/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_wolf.yaml b/unittest/force-styles/tests/mol-pair-coul_wolf.yaml index 4918adc093..a48fa7f565 100644 --- a/unittest/force-styles/tests/mol-pair-coul_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_wolf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-coul_wolf_cs.yaml b/unittest/force-styles/tests/mol-pair-coul_wolf_cs.yaml index 50447386bf..32068ba458 100644 --- a/unittest/force-styles/tests/mol-pair-coul_wolf_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_wolf_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-dpd.yaml b/unittest/force-styles/tests/mol-pair-dpd.yaml index 5f747fa0b2..13e9c1b776 100644 --- a/unittest/force-styles/tests/mol-pair-dpd.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml index 43f5136973..d43ac13ba0 100644 --- a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-e3b.yaml b/unittest/force-styles/tests/mol-pair-e3b.yaml index 416f76db20..03d74c2069 100644 --- a/unittest/force-styles/tests/mol-pair-e3b.yaml +++ b/unittest/force-styles/tests/mol-pair-e3b.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-gauss.yaml b/unittest/force-styles/tests/mol-pair-gauss.yaml index c83d82f39f..642f2417c8 100644 --- a/unittest/force-styles/tests/mol-pair-gauss.yaml +++ b/unittest/force-styles/tests/mol-pair-gauss.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-gauss_cut.yaml b/unittest/force-styles/tests/mol-pair-gauss_cut.yaml index ff11a0e41b..c440fc0f1c 100644 --- a/unittest/force-styles/tests/mol-pair-gauss_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-gauss_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml index ce962d5a3b..a264411788 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-hybrid.yaml b/unittest/force-styles/tests/mol-pair-hybrid.yaml index 3630d4bdd6..4f55c09d25 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:13 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lennard_mdf.yaml b/unittest/force-styles/tests/mol-pair-lennard_mdf.yaml index 6ba6c42bb5..4ba3045057 100644 --- a/unittest/force-styles/tests/mol-pair-lennard_mdf.yaml +++ b/unittest/force-styles/tests/mol-pair-lennard_mdf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj96_cut.yaml b/unittest/force-styles/tests/mol-pair-lj96_cut.yaml index 85191fe5ed..94e19d6663 100644 --- a/unittest/force-styles/tests/mol-pair-lj96_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj96_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml index d20b8e2e87..452a1b58d6 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 7e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml index a8333d8d91..91a73b31e3 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long.yaml index 7e377ec89c..c58a4849da 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml index aa9509679c..0d956e0d3e 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm.yaml index 93677fc67e..b3884c3b11 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml index 0c0bc86099..adf0f0b71b 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml index 31eea37ef8..7d64a7c692 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_charmmfsw.yaml b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_charmmfsw.yaml index 5348900e55..4ed8721c7e 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_charmmfsw.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_charmmfsw.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_long.yaml index 898a0759a6..0b95c6c4d0 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml index 2e578773a8..2af3de8273 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2.yaml b/unittest/force-styles/tests/mol-pair-lj_class2.yaml index dfded52103..ba4989e6e2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:14 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut.yaml index 719e42f49d..7855313829 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut_soft.yaml index 0ba6aa7608..8ac23b3583 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_cut_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long.yaml index 0fdcc79f5e..0bae674a35 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_cs.yaml index a8a65171f5..7f88407d20 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_soft.yaml index b18417ceba..673fb46800 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml index 3c31c1bde6..39a9299b25 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table_cs.yaml index 6d4064039e..8d3537b6c2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml index 55368adbb9..75bf587fe9 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml index 6d23998ad5..1d9b911db5 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cubic.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cubic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 30 Nov 2020 -date_generated: Fri Dec 18 22:30:42 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:47 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_cut.yaml index 1a45b3d448..4aff257f62 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut.yaml index d34748446f..23ee5a4b93 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml index bfd5a20a36..2c37fbefe9 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_debye.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_debye.yaml index b460307579..04e9f26025 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_debye.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_debye.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml index e830d17236..109e347449 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_dsf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 8e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long.yaml index b4981269c5..e16d0ac162 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml index 0cd8d0ce00..863b41f597 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:15 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 7.5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml index c3a97c2f2f..acd3ea4ce0 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml index a861ce9a34..937c115a9a 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:48 2021 epsilon: 7e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml index 1c53c025f9..de1ab82c24 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml index 2da0d85562..d5eb9d35a1 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table_cs.yaml index eddedd29da..179900a1f2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table_cs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_wolf.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_wolf.yaml index 47c261986a..28b6525f19 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_wolf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml index 266af00296..77567c0a76 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml index 36e89e8cfa..d57e1df73a 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml index c3097aee6d..d1bed9430b 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:49 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml index 08f12b6476..027c91970e 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml index 22eef49478..77a7f00ad8 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_expand.yaml b/unittest/force-styles/tests/mol-pair-lj_expand.yaml index cc94bc7213..7f7a73df55 100644 --- a/unittest/force-styles/tests/mol-pair-lj_expand.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_expand.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_expand_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_expand_coul_long.yaml index e177df874b..9f4b5fa97c 100644 --- a/unittest/force-styles/tests/mol-pair-lj_expand_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_expand_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:16 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml index 2ca2d354a7..27ceae8a05 100644 --- a/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 2e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_gromacs.yaml b/unittest/force-styles/tests/mol-pair-lj_gromacs.yaml index ecf6b8f0f8..174c94829d 100644 --- a/unittest/force-styles/tests/mol-pair-lj_gromacs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_gromacs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_gromacs_coul_gromacs.yaml b/unittest/force-styles/tests/mol-pair-lj_gromacs_coul_gromacs.yaml index 75d1943339..c1a87514f1 100644 --- a/unittest/force-styles/tests/mol-pair-lj_gromacs_coul_gromacs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_gromacs_coul_gromacs.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml index caa7d765b5..483d54a326 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 2.5e-09 prerequisites: ! | atom full @@ -27,72 +27,72 @@ extract: ! | sigma 2 cut_coul 0 natoms: 29 -init_vdwl: 749.373775521848 +init_vdwl: 749.373800441949 init_coul: 225.821815126925 init_stress: ! |2- - 2.1566619777740902e+03 2.1561339369037219e+03 4.6267173221155736e+03 -7.5508635166800991e+02 1.8219495486319847e+01 6.7619475900149655e+02 + 2.1566620277629813e+03 2.1561339780157969e+03 4.6267173807038052e+03 -7.5508635107101691e+02 1.8219496027762062e+01 6.7619472632626719e+02 init_forces: ! |2 - 1 -2.0622981429393807e+01 2.6956534558011725e+02 3.3304204925517143e+02 - 2 1.5804318302709490e+02 1.2736090910218131e+02 -1.8761883353245216e+02 - 3 -1.3527896432508211e+02 -3.8712541491749789e+02 -1.4567430834698106e+02 - 4 -7.9525168436030773e+00 2.1530554166296176e+00 -5.8369678142768118e+00 - 5 -3.0584210326688970e+00 -3.3883621918483655e+00 1.2083104660267935e+01 - 6 -8.3040950136399044e+02 9.6005842246557552e+02 1.1483426903619145e+03 - 7 5.8117176187526780e+01 -3.3519934567641707e+02 -1.7141478166388797e+03 - 8 1.4294493171390297e+02 -1.0474128177423346e+02 4.0227521160525629e+02 - 9 8.0782715664878268e+01 7.9461644781068358e+01 3.5173834803878833e+02 - 10 5.3094739039340072e+02 -6.1005894329030184e+02 -1.8379453583600960e+02 - 11 -3.2540352897717737e+00 -4.8803819809385027e+00 -1.0223100643333725e+01 - 12 2.0391732170892919e+01 1.0150596216961747e+01 -6.4978637469860816e+00 - 13 8.0251516080555430e+00 -3.2176927494765719e+00 -3.2683209992541434e-01 - 14 -4.4396727557663969e+00 1.0430005884558371e+00 -8.8469672403790529e+00 - 15 1.4998024458760750e-01 8.2845477274856112e+00 2.0021371706680275e+00 - 16 4.6253004030953110e+02 -3.3139195670429746e+02 -1.1873816589319622e+03 - 17 -4.5576220588835747e+02 3.2170885473451676e+02 1.1992075674372097e+03 - 18 3.5638625258145490e-01 4.7708005940782092e+00 -7.8562962420657412e+00 - 19 1.9902577614639423e+00 -7.2127770268183056e-01 5.5221988819092536e+00 - 20 -2.9135477975119137e+00 -3.9876270289423439e+00 4.1253800349019452e+00 - 21 -6.9663077752668514e+01 -7.7247842870041893e+01 2.1698923839494989e+02 - 22 -1.0627534004387260e+02 -2.6762806431184490e+01 -1.6366217211268523e+02 - 23 1.7552279743617564e+02 1.0442576746894673e+02 -5.2822891559610461e+01 - 24 3.5025338162767611e+01 -2.0265091634797420e+02 1.0716856771722603e+02 - 25 -1.4546282924538690e+02 2.0973208751614084e+01 -1.2144531001524807e+02 - 26 1.0987377305379422e+02 1.8142227933955789e+02 1.3660221686848063e+01 - 27 4.9787264851761520e+01 -2.1702378491087205e+02 8.7171908546104049e+01 - 28 -1.7608392919959783e+02 7.3301696261828440e+01 -1.1852448703320457e+02 - 29 1.2668890412925685e+02 1.4371750554769054e+02 3.1331418002784233e+01 -run_vdwl: 719.707445870818 -run_coul: 225.904237287787 + 1 -2.0622981661660933e+01 2.6956534606458871e+02 3.3304204939116363e+02 + 2 1.5804318306601883e+02 1.2736090918213843e+02 -1.8761883354202345e+02 + 3 -1.3527896613660067e+02 -3.8712541322474209e+02 -1.4567430731367753e+02 + 4 -7.9525168535595512e+00 2.1530554219898832e+00 -5.8369678167150498e+00 + 5 -3.0584211548599773e+00 -3.3883622409374414e+00 1.2083104792629799e+01 + 6 -8.3040950098401379e+02 9.6005842177261275e+02 1.1483426894944605e+03 + 7 5.8117169924759708e+01 -3.3519934246802160e+02 -1.7141478301179534e+03 + 8 1.4294492975961728e+02 -1.0474128441953674e+02 4.0227522786700177e+02 + 9 8.0782715620485192e+01 7.9461644907945399e+01 3.5173834826976304e+02 + 10 5.3094736334968877e+02 -6.1005894723647111e+02 -1.8379453981847473e+02 + 11 -3.2540351174731903e+00 -4.8803826086618827e+00 -1.0223101185000280e+01 + 12 2.0391758367278634e+01 1.0150613828433194e+01 -6.4978796273378174e+00 + 13 8.0251517295680532e+00 -3.2176927284900541e+00 -3.2683214420263229e-01 + 14 -4.4396726967568014e+00 1.0430006507669409e+00 -8.8469673769189328e+00 + 15 1.4998058602555447e-01 8.2845479683942465e+00 2.0021370654547277e+00 + 16 4.6253004977709497e+02 -3.3139197130445098e+02 -1.1873816442531520e+03 + 17 -4.5576220537745553e+02 3.2170885360525574e+02 1.1992075701133558e+03 + 18 3.5638637100685411e-01 4.7708007696323129e+00 -7.8562964240005906e+00 + 19 1.9902577541873943e+00 -7.2127770801066615e-01 5.5221988759400071e+00 + 20 -2.9135477887099177e+00 -3.9876270213526297e+00 4.1253800364116655e+00 + 21 -6.9663077725625229e+01 -7.7247842899394058e+01 2.1698923836747846e+02 + 22 -1.0627534004508448e+02 -2.6762806432167704e+01 -1.6366217211367643e+02 + 23 1.7552279743788071e+02 1.0442576746938796e+02 -5.2822891559245299e+01 + 24 3.5025338224251065e+01 -2.0265091632381331e+02 1.0716856781097904e+02 + 25 -1.4546282924824158e+02 2.0973208750647458e+01 -1.2144531001161199e+02 + 26 1.0987377306154728e+02 1.8142227934422800e+02 1.3660221691842844e+01 + 27 4.9787264831917881e+01 -2.1702378492861621e+02 8.7171908557180572e+01 + 28 -1.7608392920071728e+02 7.3301696261204825e+01 -1.1852448703331862e+02 + 29 1.2668890412943080e+02 1.4371750554744025e+02 3.1331418003647308e+01 +run_vdwl: 719.707466157291 +run_coul: 225.904237287566 run_stress: ! |2- - 2.1107536793307468e+03 2.1122379201857452e+03 4.3599324498565293e+03 -7.3409238214538516e+02 3.5359613445860141e+01 6.3752279062951925e+02 + 2.1107537188662236e+03 2.1122379542510184e+03 4.3599324983027345e+03 -7.3409237546545421e+02 3.5359612031240225e+01 6.3752276727918104e+02 run_forces: ! |2 - 1 -1.7610671323869674e+01 2.6644632319809125e+02 3.2393635185737048e+02 - 2 1.5276958689054419e+02 1.2310601845342437e+02 -1.8097797853205338e+02 - 3 -1.3352437924496681e+02 -3.7931520927920576e+02 -1.4290253280020417e+02 - 4 -7.9210454699422739e+00 2.1479068853687990e+00 -5.8262866027728446e+00 - 5 -3.0436142186020652e+00 -3.3598700412150313e+00 1.2037071546308955e+01 - 6 -8.0541518106738181e+02 9.1789632182348248e+02 1.0248061101238054e+03 - 7 5.5711025014807248e+01 -3.1035014369487737e+02 -1.5712639984017087e+03 - 8 1.3310087453577813e+02 -9.6225162152811720e+01 3.9090026703160601e+02 - 9 7.8393574070627366e+01 7.6654576853511799e+01 3.4092264679070774e+02 - 10 5.2097956066949666e+02 -5.9878732018277447e+02 -1.8147991237770523e+02 - 11 -3.2607667066270936e+00 -4.8312582714797552e+00 -1.0171800769012659e+01 - 12 2.0370356353863581e+01 1.0143689941206798e+01 -6.6267466555479961e+00 - 13 7.9794514497078781e+00 -3.1830746501709997e+00 -3.2644127587370575e-01 - 14 -4.4037331584323880e+00 1.0233682011991643e+00 -8.7298909905895190e+00 - 15 1.3154168744955988e-01 8.2984798374513744e+00 2.0213779317532383e+00 - 16 4.3411491239178514e+02 -3.1229545621436057e+02 -1.1118126613117161e+03 - 17 -4.2721103677584034e+02 3.0241089748456909e+02 1.1238250106811154e+03 - 18 3.0045457761221517e-01 4.7293875917389530e+00 -7.8044958131791784e+00 - 19 2.0270210763586318e+00 -7.0015059579377714e-01 5.5349995515760559e+00 - 20 -2.8986405349039099e+00 -3.9674896299813454e+00 4.0696696823518108e+00 - 21 -6.8658022402852936e+01 -7.5474151287218916e+01 2.1302465879802361e+02 - 22 -1.0464809690544206e+02 -2.6524463281118258e+01 -1.6069148016249562e+02 - 23 1.7288793881586659e+02 1.0241548772353890e+02 -5.1825425141802349e+01 - 24 3.6621512242007107e+01 -2.0125837141004371e+02 1.0765962820446694e+02 - 25 -1.4622310926571268e+02 2.0851692216922846e+01 -1.2215078336950006e+02 - 26 1.0903616825360248e+02 1.8015275208029206e+02 1.3874388664482883e+01 - 27 4.8836594023392919e+01 -2.1313610883088290e+02 8.5044672096502211e+01 - 28 -1.7278645223316221e+02 7.1874824697301463e+01 -1.1608941518893110e+02 - 29 1.2434417725483669e+02 1.4125650253383503e+02 3.1022996433022094e+01 + 1 -1.7610671215147516e+01 2.6644632521711065e+02 3.2393635216495608e+02 + 2 1.5276958690674471e+02 1.2310601849305402e+02 -1.8097797853684457e+02 + 3 -1.3352438109375441e+02 -3.7931520752883262e+02 -1.4290253169413955e+02 + 4 -7.9210457144807673e+00 2.1479067658962112e+00 -5.8262867707772656e+00 + 5 -3.0436146111746609e+00 -3.3598708486321578e+00 1.2037071927910159e+01 + 6 -8.0541518022246134e+02 9.1789632032195846e+02 1.0248061088552281e+03 + 7 5.5711018458020682e+01 -3.1035014038624917e+02 -1.5712640121585557e+03 + 8 1.3310087649542288e+02 -9.6225164941492508e+01 3.9090028139588929e+02 + 9 7.8393574096452653e+01 7.6654576917241798e+01 3.4092264700067278e+02 + 10 5.2097953975583994e+02 -5.9878733321714390e+02 -1.8147990705795451e+02 + 11 -3.2607666278858591e+00 -4.8312585741314322e+00 -1.0171801101420801e+01 + 12 2.0370378822259379e+01 1.0143707538480376e+01 -6.6267605135464889e+00 + 13 7.9794514942654207e+00 -3.1830746441047428e+00 -3.2644128910532161e-01 + 14 -4.4037331178676657e+00 1.0233682060578044e+00 -8.7298910570923951e+00 + 15 1.3154197296741404e-01 8.2984800089639776e+00 2.0213778453832680e+00 + 16 4.3411491585315781e+02 -3.1229546158366014e+02 -1.1118126563874712e+03 + 17 -4.2721103632201573e+02 3.0241089632715619e+02 1.1238250137043428e+03 + 18 3.0045467379022872e-01 4.7293877280888514e+00 -7.8044959748020570e+00 + 19 2.0270210691150932e+00 -7.0015060136201190e-01 5.5349995459560830e+00 + 20 -2.8986405261351393e+00 -3.9674896221724638e+00 4.0696696835467474e+00 + 21 -6.8658022376548189e+01 -7.5474151318419402e+01 2.1302465876840716e+02 + 22 -1.0464809690829846e+02 -2.6524463283005797e+01 -1.6069148016429543e+02 + 23 1.7288793881938844e+02 1.0241548772466190e+02 -5.1825425140716725e+01 + 24 3.6621512295722965e+01 -2.0125837138502857e+02 1.0765962828843737e+02 + 25 -1.4622310926187339e+02 2.0851692219024567e+01 -1.2215078335595025e+02 + 26 1.0903616826048172e+02 1.8015275208444928e+02 1.3874388668825373e+01 + 27 4.8836594003434030e+01 -2.1313610884810515e+02 8.5044672108300603e+01 + 28 -1.7278645223634851e+02 7.1874824696100561e+01 -1.1608941518998317e+02 + 29 1.2434417725692825e+02 1.4125650253409549e+02 3.1022996434798799e+01 ... diff --git a/unittest/force-styles/tests/mol-pair-lj_long_coul_off.yaml b/unittest/force-styles/tests/mol-pair-lj_long_coul_off.yaml index 25043b3ff8..b120893757 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_coul_off.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_coul_off.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:50 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_long_cut_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_cut_coul_long.yaml index 64af0de1a7..ff512d3e09 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_cut_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_cut_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:51 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_long_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_cut_tip4p_long.yaml index 123706c3dc..9227228855 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_cut_tip4p_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:51 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml index f4920d8699..a6572ed66c 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:51 2021 epsilon: 2.5e-09 prerequisites: ! | atom full @@ -35,72 +35,72 @@ extract: ! | typeA 0 typeB 0 natoms: 29 -init_vdwl: 584.670359070893 +init_vdwl: 584.670383161636 init_coul: 220.904555359383 init_stress: ! |2- - 1.4179907518567816e+03 1.6981521081440758e+03 3.8247897795492727e+03 -1.0685165979600738e+03 -2.2301723603317933e+02 7.0678975460957838e+02 + 1.4179908002675882e+03 1.6981521472771331e+03 3.8247898365498668e+03 -1.0685165973996445e+03 -2.2301723469314501e+02 7.0678972133134016e+02 init_forces: ! |2 - 1 1.3731384454971254e+02 3.9920027816333527e+02 1.4671535385944733e+02 + 1 1.3731384428493124e+02 3.9920027854840805e+02 1.4671535403601737e+02 2 -1.9557407939667784e-01 -2.8434279090485344e+00 -1.2037666274486341e+00 - 3 -1.4543663227279740e+02 -3.8854700219617757e+02 -1.3922266560344775e+02 + 3 -1.4543663403399540e+02 -3.8854700044105419e+02 -1.3922266457674954e+02 4 -7.9314978889013857e-02 1.6212643266693107e-02 -2.3663785465653561e-01 5 -5.4637120859630939e-01 6.5600989679059629e-01 -6.8980117595427104e-02 - 6 -8.3044669735263210e+02 9.6003930511175383e+02 1.1483694862004249e+03 - 7 5.8135902001138916e+01 -3.3519692557212892e+02 -1.7141558244033672e+03 - 8 2.2222306113041898e+02 -1.9487724475012371e+01 7.5254097093507573e+02 + 6 -8.3044669697571760e+02 9.6003930443804529e+02 1.1483694854778580e+03 + 7 5.8135895738828381e+01 -3.3519692236360072e+02 -1.7141558378818368e+03 + 8 2.2222305975187425e+02 -1.9487727502660320e+01 7.5254098660516138e+02 9 1.5618105874324246e+00 -5.8578891996706437e+00 1.3701350515471384e+00 - 10 5.2854811448198768e+02 -6.1591055679501983e+02 -1.9340281827813200e+02 + 10 5.2854808750532732e+02 -6.1591056046926769e+02 -1.9340282225226667e+02 11 -9.3766462457826905e-01 1.0563563299185068e+00 -5.5775022539970631e-01 - 12 2.4920320953166684e+01 1.6044685842922149e+01 -1.2382365264982791e+01 + 12 2.4920347090319872e+01 1.6044703403776545e+01 -1.2382381138510288e+01 13 -7.5720425159299595e-02 3.8772041103398963e-02 -1.8346431648817585e-01 14 -1.0557020156519512e+00 3.6717714938726143e-01 -1.0728817695848940e-01 15 3.5162907632314466e-01 -1.9165325094615621e-01 -1.0148660141104417e+00 - 16 4.6235899435670046e+02 -3.3129450503702833e+02 -1.1872104992473003e+03 - 17 -4.5562419635435378e+02 3.2174933490465634e+02 1.1991777262209341e+03 - 18 3.5327026427352259e-01 4.7616025960598627e+00 -7.8715619141435136e+00 + 16 4.6235900379292781e+02 -3.3129451959604160e+02 -1.1872104846434017e+03 + 17 -4.5562419584375363e+02 3.2174933377566850e+02 1.1991777288967187e+03 + 18 3.5327038190601634e-01 4.7616027705645072e+00 -7.8715620952516669e+00 19 1.9911596893384120e+00 -7.2195675725850206e-01 5.5334689749229105e+00 20 -2.9127135301570397e+00 -4.0021946638596519e+00 4.1375019377447915e+00 - 21 1.5193591883077349e+00 3.2144199030879488e+00 -6.7582252414360386e+00 + 21 1.5193592132463749e+00 3.2144198763444218e+00 -6.7582252673322518e+00 22 4.4657588078956723e+00 1.0585032152255676e+00 5.8268290139589860e+00 23 -6.2938601634201303e+00 -3.9616631352879410e+00 1.3192732707154482e+00 - 24 -1.0905447870604845e+00 6.8024490469623906e+00 -3.6841666676664224e+00 + 24 -1.0905447268336337e+00 6.8024490705444629e+00 -3.6841665762708744e+00 25 4.9746167445264264e+00 -5.2361422570157790e-01 3.9262159421100877e+00 26 -4.3769290854851999e+00 -6.4816134554785325e+00 -8.1534775153570904e-01 - 27 -1.5292288622987564e+00 7.3670370982215285e+00 -2.7248017460341405e+00 + 27 -1.5292288824966420e+00 7.3670370809055621e+00 -2.7248017347638211e+00 28 6.4035032875423159e+00 -2.1779017025677483e+00 4.1727109672631357e+00 29 -4.5201953782892055e+00 -5.1735155675050022e+00 -1.4886429234413563e+00 -run_vdwl: 557.056017138723 -run_coul: 220.913884393424 +run_vdwl: 557.056030477029 +run_coul: 220.91388439321 run_stress: ! |2- - 1.3775223471877366e+03 1.6566887898319319e+03 3.5747571933396416e+03 -1.0386782468208169e+03 -2.0694914366906673e+02 6.6732653084085644e+02 + 1.3775223750599193e+03 1.6566888200245039e+03 3.5747572154246241e+03 -1.0386782389667430e+03 -2.0694915325068987e+02 6.6732651501863484e+02 run_forces: ! |2 - 1 1.3484812659843513e+02 3.9092060800918989e+02 1.4373313137859998e+02 - 2 -2.0271633707648873e-01 -2.8298288761987318e+00 -1.1989313018491383e+00 - 3 -1.4342324899553293e+02 -3.7982436667370501e+02 -1.3597762688785588e+02 - 4 -8.2852639177138657e-02 1.8300393504026149e-02 -2.3762389449071866e-01 - 5 -5.4791673482209124e-01 6.5614563469546494e-01 -6.3941396753216292e-02 - 6 -8.0227486127425436e+02 9.1496525291694797e+02 1.0264249576311956e+03 - 7 5.5771543379925383e+01 -3.1037336716922317e+02 -1.5711704568990347e+03 - 8 2.0819248601410811e+02 -1.2101254710546570e+01 7.2875382950845608e+02 - 9 1.5634160487619546e+00 -5.8771942139639481e+00 1.3776856877372210e+00 - 10 5.1715704548744839e+02 -6.0329365711832054e+02 -1.9113877357061190e+02 - 11 -9.4002639920539743e-01 1.0582108303494102e+00 -5.6167252694801739e-01 - 12 2.4863919762583155e+01 1.6062852620618131e+01 -1.2360597545829215e+01 - 13 -7.5840697095099607e-02 4.0077788679094964e-02 -1.8559573885370806e-01 - 14 -1.0625298052267247e+00 3.6955553581650585e-01 -1.0916767712595477e-01 - 15 3.5311739865286279e-01 -1.9448880340077307e-01 -1.0191647907359309e+00 - 16 4.3394626492285823e+02 -3.1219926534478418e+02 -1.1116473917803178e+03 - 17 -4.2707030325761536e+02 3.0243865908364359e+02 1.1237993806924117e+03 - 18 3.0368395429039413e-01 4.7171895570379352e+00 -7.8295029342293025e+00 - 19 2.0270801847492161e+00 -6.9918333164961344e-01 5.5492247587141375e+00 - 20 -2.8995874776604742e+00 -3.9821844731531963e+00 4.0840163265138711e+00 - 21 1.5208456305724503e+00 3.1993262189952332e+00 -6.7421856947959524e+00 - 22 4.4874876087857585e+00 1.0719243021957119e+00 5.8233438927252603e+00 - 23 -6.3183698445588599e+00 -3.9593735948248070e+00 1.3084674471345548e+00 - 24 -1.1079755165485650e+00 6.8112748041127560e+00 -3.6957336981034130e+00 - 25 5.0093760593232943e+00 -5.0836369921098123e-01 3.9583976051674381e+00 - 26 -4.3931344945010125e+00 -6.5025659801859046e+00 -8.3304413261264720e-01 - 27 -1.5441431471578715e+00 7.3753658554767467e+00 -2.7159697179439259e+00 - 28 6.4199810218638094e+00 -2.1795392395617279e+00 4.1762085294330520e+00 - 29 -4.5208674519252963e+00 -5.1801103225337508e+00 -1.5012632699978348e+00 + 1 1.3484812617575406e+02 3.9092060908116656e+02 1.4373313186999439e+02 + 2 -2.0271633709568476e-01 -2.8298288761956423e+00 -1.1989313018422760e+00 + 3 -1.4342325174055713e+02 -3.7982436396313489e+02 -1.3597762518906373e+02 + 4 -8.2852639170312839e-02 1.8300393499842461e-02 -2.3762389449286375e-01 + 5 -5.4791673481254732e-01 6.5614563468856779e-01 -6.3941396758903993e-02 + 6 -8.0227485954791541e+02 9.1496525050525736e+02 1.0264249558300917e+03 + 7 5.5771542735465069e+01 -3.1037336726230455e+02 -1.5711704577668092e+03 + 8 2.0819248556765424e+02 -1.2101254281688147e+01 7.2875382923317329e+02 + 9 1.5634160486512318e+00 -5.8771942140939055e+00 1.3776856876345804e+00 + 10 5.1715702524063988e+02 -6.0329367024604721e+02 -1.9113876792726958e+02 + 11 -9.4002639917994568e-01 1.0582108302448794e+00 -5.6167252695046399e-01 + 12 2.4863938867166016e+01 1.6062869875084793e+01 -1.2360609625898560e+01 + 13 -7.5840697146929953e-02 4.0077788713113287e-02 -1.8559573885665315e-01 + 14 -1.0625298051164564e+00 3.6955553582007694e-01 -1.0916767715816915e-01 + 15 3.5311739874004949e-01 -1.9448880341844976e-01 -1.0191647907497523e+00 + 16 4.3394626801693568e+02 -3.1219927017642323e+02 -1.1116473874381600e+03 + 17 -4.2707030283376542e+02 3.0243865797177557e+02 1.1237993836385187e+03 + 18 3.0368404844222568e-01 4.7171896888581095e+00 -7.8295030918480828e+00 + 19 2.0270801847430087e+00 -6.9918333167659397e-01 5.5492247587169610e+00 + 20 -2.8995874776653414e+00 -3.9821844731834624e+00 4.0840163265257070e+00 + 21 1.5208456586487951e+00 3.1993261879629271e+00 -6.7421857269435987e+00 + 22 4.4874876087889790e+00 1.0719243022009861e+00 5.8233438927261929e+00 + 23 -6.3183698445659342e+00 -3.9593735948101023e+00 1.3084674471388333e+00 + 24 -1.1079754642593542e+00 6.8112748289396237e+00 -3.6957336164134316e+00 + 25 5.0093760593140946e+00 -5.0836369922018387e-01 3.9583976051551146e+00 + 26 -4.3931344945026183e+00 -6.5025659801902629e+00 -8.3304413261248733e-01 + 27 -1.5441431651250583e+00 7.3753658402581390e+00 -2.7159697072843967e+00 + 28 6.4199810218643059e+00 -2.1795392395603654e+00 4.1762085294336435e+00 + 29 -4.5208674519292567e+00 -5.1801103225235723e+00 -1.5012632699970143e+00 ... diff --git a/unittest/force-styles/tests/mol-pair-lj_mdf.yaml b/unittest/force-styles/tests/mol-pair-lj_mdf.yaml index 47f8b5ca0c..3dc4b08e81 100644 --- a/unittest/force-styles/tests/mol-pair-lj_mdf.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_mdf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk.yaml index dbaf863ae4..6a705107fe 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_long.yaml index 53097bb236..52871422b1 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:17 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm.yaml index 8c3a199e3a..4df3f42891 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml index 6c97aa9d81..f9e55e3fea 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml index 24ffccc296..914cd9077e 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_smooth.yaml b/unittest/force-styles/tests/mol-pair-lj_smooth.yaml index 0171513b43..ea17c7d5b0 100644 --- a/unittest/force-styles/tests/mol-pair-lj_smooth.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_smooth.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_smooth_linear.yaml b/unittest/force-styles/tests/mol-pair-lj_smooth_linear.yaml index ccd05990b4..1726804d29 100644 --- a/unittest/force-styles/tests/mol-pair-lj_smooth_linear.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_smooth_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:53 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_table_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_table_coul_long.yaml index a7be6a954d..9b2e520fb5 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:53 2021 epsilon: 2.5e-09 prerequisites: ! | atom full 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 22af7a5357..4f21995ed5 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,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:53 2021 epsilon: 2e-08 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml index d3cfee2672..d9c02422cb 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:18 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:53 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_long.yaml index 8dc5a53716..7eab70a542 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:54 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml index 9ba1ea7802..8274c80cdc 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_tip4p_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:54 2021 epsilon: 2.5e-09 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-mie_cut.yaml b/unittest/force-styles/tests/mol-pair-mie_cut.yaml index 286d201e38..ec36aa2349 100644 --- a/unittest/force-styles/tests/mol-pair-mie_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-mie_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-morse.yaml b/unittest/force-styles/tests/mol-pair-morse.yaml index 06449cec6d..12a2ab2132 100644 --- a/unittest/force-styles/tests/mol-pair-morse.yaml +++ b/unittest/force-styles/tests/mol-pair-morse.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml b/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml index e933b47a0b..a4264cef44 100644 --- a/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml +++ b/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-morse_soft.yaml b/unittest/force-styles/tests/mol-pair-morse_soft.yaml index d57e3a155f..2c385f7a80 100644 --- a/unittest/force-styles/tests/mol-pair-morse_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-morse_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-nm_cut.yaml b/unittest/force-styles/tests/mol-pair-nm_cut.yaml index b05678514d..861a92dbdd 100644 --- a/unittest/force-styles/tests/mol-pair-nm_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-nm_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-nm_cut_coul_cut.yaml b/unittest/force-styles/tests/mol-pair-nm_cut_coul_cut.yaml index 0161426c61..1e8330ec06 100644 --- a/unittest/force-styles/tests/mol-pair-nm_cut_coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-nm_cut_coul_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-nm_cut_coul_long.yaml b/unittest/force-styles/tests/mol-pair-nm_cut_coul_long.yaml index e8739a7340..fc190d1aea 100644 --- a/unittest/force-styles/tests/mol-pair-nm_cut_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-nm_cut_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:55 2021 epsilon: 7.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml b/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml index 128309d349..adaa3904a2 100644 --- a/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-python_hybrid.yaml b/unittest/force-styles/tests/mol-pair-python_hybrid.yaml index 189a321fe9..663e3efa2d 100644 --- a/unittest/force-styles/tests/mol-pair-python_hybrid.yaml +++ b/unittest/force-styles/tests/mol-pair-python_hybrid.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-python_lj.yaml b/unittest/force-styles/tests/mol-pair-python_lj.yaml index 614741a0a2..ac4fcd9207 100644 --- a/unittest/force-styles/tests/mol-pair-python_lj.yaml +++ b/unittest/force-styles/tests/mol-pair-python_lj.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-soft.yaml b/unittest/force-styles/tests/mol-pair-soft.yaml index 7a8a5322ee..b9c049cc18 100644 --- a/unittest/force-styles/tests/mol-pair-soft.yaml +++ b/unittest/force-styles/tests/mol-pair-soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-table.yaml b/unittest/force-styles/tests/mol-pair-table.yaml index 8d70bac4ab..2d0ff80bd3 100644 --- a/unittest/force-styles/tests/mol-pair-table.yaml +++ b/unittest/force-styles/tests/mol-pair-table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml index 0394b0b363..8174c5b905 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 21 Jul 2020 -date_generated: Thu Aug 6 16:52:44 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 7.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml index 9ee6b51077..d09ccd2a68 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml index 704294440f..88a80c7e19 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_long_soft.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 1e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-tip4p_table.yaml index 24376bc9b3..1417873385 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 2.5e-13 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-ufm.yaml b/unittest/force-styles/tests/mol-pair-ufm.yaml index 494f1cb5b7..e94703032c 100644 --- a/unittest/force-styles/tests/mol-pair-ufm.yaml +++ b/unittest/force-styles/tests/mol-pair-ufm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-wf_cut.yaml b/unittest/force-styles/tests/mol-pair-wf_cut.yaml index 359c6d7006..0b689fd219 100644 --- a/unittest/force-styles/tests/mol-pair-wf_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-wf_cut.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Dec 2020 -date_generated: Thu Jan 28 03:47:32 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-yukawa.yaml b/unittest/force-styles/tests/mol-pair-yukawa.yaml index 209afc79bd..9a0882a1ce 100644 --- a/unittest/force-styles/tests/mol-pair-yukawa.yaml +++ b/unittest/force-styles/tests/mol-pair-yukawa.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 5e-14 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-zbl.yaml b/unittest/force-styles/tests/mol-pair-zbl.yaml index 465ae3059e..113072816e 100644 --- a/unittest/force-styles/tests/mol-pair-zbl.yaml +++ b/unittest/force-styles/tests/mol-pair-zbl.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:20 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 1e-12 prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-zero.yaml b/unittest/force-styles/tests/mol-pair-zero.yaml index d243cab958..04bffa3b05 100644 --- a/unittest/force-styles/tests/mol-pair-zero.yaml +++ b/unittest/force-styles/tests/mol-pair-zero.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:21 202 +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:57 2021 epsilon: 1e-14 prerequisites: ! | atom full From f797d9cb2e4619167e354d2f0cce15e35fd479d5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Feb 2021 10:36:38 -0500 Subject: [PATCH 021/370] must always set pair_modify table (and table/disp) explicitly for long-range styles --- unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml | 1 + unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml b/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml index 14624b04e5..df11a0547c 100644 --- a/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_long_coul_long.yaml @@ -9,6 +9,7 @@ prerequisites: ! | pre_commands: ! "" post_commands: ! | pair_modify table 0 + pair_modify table/disp 0 kspace_style ewald/disp 1.0e-6 kspace_modify gewald 0.3 kspace_modify compute no diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml index c204dd600f..39fae48cb4 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml @@ -9,6 +9,7 @@ prerequisites: ! | pre_commands: ! "" post_commands: ! | pair_modify table 16 + pair_modify table/disp 16 kspace_style ewald/disp 1.0e-6 kspace_modify gewald 0.3 kspace_modify compute no diff --git a/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml index 483d54a326..5c083caeac 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_coul_long.yaml @@ -10,6 +10,7 @@ pre_commands: ! "" post_commands: ! | pair_modify mix arithmetic pair_modify table 0 + pair_modify table/disp 0 kspace_style ewald/disp 1.0e-6 kspace_modify gewald 0.3 kspace_modify compute no diff --git a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml index a6572ed66c..25ac675244 100644 --- a/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_long_tip4p_long.yaml @@ -12,6 +12,7 @@ pre_commands: ! | post_commands: ! | pair_modify mix arithmetic pair_modify table 0 + pair_modify table/disp 0 kspace_style pppm/disp/tip4p 1.0e-5 kspace_modify gewald 0.3 kspace_modify force/disp/real 0.001 From a6f32e472dbc97c01a534c081f2662fbb95f7f4b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Feb 2021 10:39:03 -0500 Subject: [PATCH 022/370] add explanation why we set pair_modify table only in the lammps_init() --- unittest/force-styles/test_pair_style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 4e1ad8d0e3..f25923a01b 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -123,6 +123,11 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new for (auto &pair_coeff : cfg.pair_coeff) { command("pair_coeff " + pair_coeff); } + + // set this here explicitly to a setting different + // from the default, so we can spot YAML files for + // long-range interactions that do not include these + // settings. they will fail after restart or read data. command("pair_modify table 0"); command("pair_modify table/disp 0"); From 121774dde33924fcf8c3350d4ba8359d770fe980 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Feb 2021 10:58:04 -0500 Subject: [PATCH 023/370] adjust epsilon for one test --- unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml index 39fae48cb4..643786eb0d 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 -epsilon: 2e-09 +epsilon: 8e-07 prerequisites: ! | atom full pair buck/long/coul/long From dfeee1f19be3c6ac3d86401acead974d1beafb9c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Feb 2021 15:42:32 -0500 Subject: [PATCH 024/370] run neighbor list on CPU for hybrid pair styles --- unittest/force-styles/test_pair_style.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index f25923a01b..61815ec5f4 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -814,10 +814,17 @@ TEST(PairStyle, omp) TEST(PairStyle, gpu) { if (!LAMMPS::is_installed_pkg("GPU")) GTEST_SKIP(); - const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"}; + const char *args_neigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"}; + const char *args_noneigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu", "-pk", "gpu", "0", "neigh", "no"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); + char **argv = (char **)args_neigh; + int argc = sizeof(args_neigh) / sizeof(char *); + + // cannot use GPU neighbor list with hybrid pair style (yet) + if (test_config.pair_style.substr(0, 6) == "hybrid") { + argv = (char **)args_noneigh; + argc = sizeof(args_noneigh) / sizeof(char *); + } ::testing::internal::CaptureStdout(); LAMMPS *lmp = init_lammps(argc, argv, test_config, false); From 74713be4a26ab2123f6e79f4fd27989c6c0a9161 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 18:44:30 -0500 Subject: [PATCH 025/370] add new key to YAML files: skip_tests --- unittest/force-styles/test_angle_style.cpp | 14 ++++++++++++ unittest/force-styles/test_bond_style.cpp | 16 ++++++++++++++ unittest/force-styles/test_config.h | 3 +++ unittest/force-styles/test_config_reader.cpp | 11 ++++++++++ unittest/force-styles/test_config_reader.h | 1 + unittest/force-styles/test_dihedral_style.cpp | 4 ++++ unittest/force-styles/test_fix_timestep.cpp | 12 ++++++++++ unittest/force-styles/test_improper_style.cpp | 12 ++++++++++ unittest/force-styles/test_pair_style.cpp | 22 +++++++++++++++++++ 9 files changed, 95 insertions(+) diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index bf5cb34e7f..ff391127bd 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -341,6 +349,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(AngleStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -567,6 +577,8 @@ TEST(AngleStyle, plain) TEST(AngleStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -740,6 +752,8 @@ TEST(AngleStyle, omp) TEST(AngleStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index d6a6e9c82d..94d2344c03 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -341,6 +349,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(BondStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -567,6 +577,8 @@ TEST(BondStyle, plain) TEST(BondStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -739,6 +751,8 @@ TEST(BondStyle, omp) TEST(BondStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -995,6 +1009,8 @@ TEST(BondStyle, single) TEST(BondStyle, extract) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; diff --git a/unittest/force-styles/test_config.h b/unittest/force-styles/test_config.h index baf3a5f29a..0417b306cb 100644 --- a/unittest/force-styles/test_config.h +++ b/unittest/force-styles/test_config.h @@ -14,6 +14,7 @@ #ifndef TEST_CONFIG_H #define TEST_CONFIG_H +#include #include #include #include @@ -32,6 +33,7 @@ public: std::string date_generated; std::string basename; double epsilon; + std::set skip_tests; std::vector> prerequisites; std::vector pre_commands; std::vector post_commands; @@ -74,6 +76,7 @@ public: init_vdwl(0), run_vdwl(0), init_coul(0), run_coul(0), init_stress({0, 0, 0, 0, 0, 0}), run_stress({0, 0, 0, 0, 0, 0}), global_scalar(0) { + skip_tests.clear(); prerequisites.clear(); pre_commands.clear(); post_commands.clear(); diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index 4ef3692f56..ed7ddf50a1 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -15,6 +15,7 @@ #include "test_config.h" #include "yaml.h" #include "yaml_reader.h" +#include "utils.h" #include #include @@ -25,11 +26,14 @@ #include #include +using LAMMPS_NS::utils::split_words; + TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(config) { consumers["lammps_version"] = &TestConfigReader::lammps_version; consumers["date_generated"] = &TestConfigReader::date_generated; consumers["epsilon"] = &TestConfigReader::epsilon; + consumers["skip_tests"] = &TestConfigReader::skip_tests; consumers["prerequisites"] = &TestConfigReader::prerequisites; consumers["pre_commands"] = &TestConfigReader::pre_commands; consumers["post_commands"] = &TestConfigReader::post_commands; @@ -66,6 +70,13 @@ TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(co consumers["equilibrium"] = &TestConfigReader::equilibrium; } +void TestConfigReader::skip_tests(const yaml_event_t &event) +{ + config.skip_tests.clear(); + for (auto &word : split_words((char *)event.data.scalar.value)) + config.skip_tests.insert(word); +} + void TestConfigReader::prerequisites(const yaml_event_t &event) { config.prerequisites.clear(); diff --git a/unittest/force-styles/test_config_reader.h b/unittest/force-styles/test_config_reader.h index 840228da3a..f82a2b7a15 100644 --- a/unittest/force-styles/test_config_reader.h +++ b/unittest/force-styles/test_config_reader.h @@ -23,6 +23,7 @@ class TestConfigReader : public YamlReader { public: TestConfigReader(TestConfig &config); + void skip_tests(const yaml_event_t &event); void prerequisites(const yaml_event_t &event); void pre_commands(const yaml_event_t &event); void post_commands(const yaml_event_t &event); diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index a27c50afb7..f8ad0a60eb 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -344,6 +344,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(DihedralStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -570,6 +572,8 @@ TEST(DihedralStyle, plain) TEST(DihedralStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 2680367c88..3fa2e78813 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -204,6 +204,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -287,6 +295,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(FixTimestep, plain) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -729,6 +739,8 @@ TEST(FixTimestep, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index b13b571546..9e38c03cd1 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -335,6 +343,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(ImproperStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -561,6 +571,8 @@ TEST(ImproperStyle, plain) TEST(ImproperStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 61815ec5f4..0e61bacfbd 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -255,6 +255,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -350,6 +358,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(PairStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -632,6 +642,8 @@ TEST(PairStyle, plain) TEST(PairStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -814,6 +826,8 @@ TEST(PairStyle, omp) TEST(PairStyle, gpu) { if (!LAMMPS::is_installed_pkg("GPU")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args_neigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"}; const char *args_noneigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu", "-pk", "gpu", "0", "neigh", "no"}; @@ -933,6 +947,8 @@ TEST(PairStyle, gpu) TEST(PairStyle, intel) { if (!LAMMPS::is_installed_pkg("USER-INTEL")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "intel", "0", "mode", "double", "omp", "4", "lrt", "no", "-sf", "intel"}; @@ -1073,6 +1089,8 @@ TEST(PairStyle, intel) TEST(PairStyle, opt) { if (!LAMMPS::is_installed_pkg("OPT")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "opt"}; char **argv = (char **)args; @@ -1178,6 +1196,8 @@ TEST(PairStyle, opt) TEST(PairStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -1435,6 +1455,8 @@ TEST(PairStyle, single) TEST(PairStyle, extract) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; From 205b45423c205f76399036bd3e695d21432d8d5e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 20:07:19 -0500 Subject: [PATCH 026/370] combine repetitive code into convenience function --- unittest/force-styles/test_angle_style.cpp | 45 +--------------- unittest/force-styles/test_bond_style.cpp | 45 +--------------- unittest/force-styles/test_dihedral_style.cpp | 37 +------------ unittest/force-styles/test_fix_timestep.cpp | 45 +--------------- unittest/force-styles/test_improper_style.cpp | 45 +--------------- unittest/force-styles/test_main.cpp | 52 +++++++++++++++++++ unittest/force-styles/test_main.h | 9 +++- unittest/force-styles/test_pair_style.cpp | 45 +--------------- 8 files changed, 71 insertions(+), 252 deletions(-) diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index ff391127bd..05646a93a9 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -235,48 +234,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // skip tests - block.clear(); - for (auto &skip_tests : config.skip_tests) { - if (block.empty()) block = skip_tests; - else block += " " + skip_tests; - } - writer.emit("skip_tests", block); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // angle_style writer.emit("angle_style", config.angle_style); diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index 94d2344c03..f3aab53b12 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -235,48 +234,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // skip tests - block.clear(); - for (auto &skip_tests : config.skip_tests) { - if (block.empty()) block = skip_tests; - else block += " " + skip_tests; - } - writer.emit("skip_tests", block); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // bond_style writer.emit("bond_style", config.bond_style); diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index f8ad0a60eb..95f64d7896 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -244,40 +243,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // dihedral_style writer.emit("dihedral_style", config.dihedral_style); diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 3fa2e78813..6ba3f7f6d7 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -193,48 +192,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) std::string block(""); YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // skip tests - block.clear(); - for (auto &skip_tests : config.skip_tests) { - if (block.empty()) block = skip_tests; - else block += " " + skip_tests; - } - writer.emit("skip_tests", block); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // natoms writer.emit("natoms", natoms); diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index 9e38c03cd1..2e61a1e0cb 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -235,48 +234,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // skip tests - block.clear(); - for (auto &skip_tests : config.skip_tests) { - if (block.empty()) block = skip_tests; - else block += " " + skip_tests; - } - writer.emit("skip_tests", block); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // improper_style writer.emit("improper_style", config.improper_style); diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 69a2b96822..e26eb6a8fb 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -16,16 +16,19 @@ #include "test_config.h" #include "test_config_reader.h" #include "utils.h" +#include "yaml_writer.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include #include +#include #include #include #include using LAMMPS_NS::utils::split_words; +using LAMMPS_NS::utils::trim; // common read_yaml_file function bool read_yaml_file(const char *infile, TestConfig &config) @@ -37,6 +40,55 @@ bool read_yaml_file(const char *infile, TestConfig &config) return true; } +// write out common header items for yaml files +void write_yaml_header(YamlWriter *writer, + TestConfig *cfg, + const char *version) +{ + // lammps_version + writer->emit("lammps_version", version); + + // date_generated + std::time_t now = time(NULL); + std::string block = trim(ctime(&now)); + writer->emit("date_generated", block); + + // epsilon + writer->emit("epsilon", cfg->epsilon); + + // skip tests + block.clear(); + for (auto &skip : cfg->skip_tests) { + if (block.empty()) block = skip; + else block += " " + skip; + } + writer->emit("skip_tests", block); + + // prerequisites + block.clear(); + for (auto &prerequisite : cfg->prerequisites) { + block += prerequisite.first + " " + prerequisite.second + "\n"; + } + writer->emit_block("prerequisites", block); + + // pre_commands + block.clear(); + for (auto &command : cfg->pre_commands) { + block += command + "\n"; + } + writer->emit_block("pre_commands", block); + + // post_commands + block.clear(); + for (auto &command : cfg->post_commands) { + block += command + "\n"; + } + writer->emit_block("post_commands", block); + + // input_file + writer->emit("input_file", cfg->input_file); +} + // need to be defined in unit test body extern void generate_yaml_file(const char *, const TestConfig &); diff --git a/unittest/force-styles/test_main.h b/unittest/force-styles/test_main.h index ee0be2a637..0f30467f6b 100644 --- a/unittest/force-styles/test_main.h +++ b/unittest/force-styles/test_main.h @@ -22,6 +22,10 @@ extern bool print_stats; extern bool verbose; extern std::string INPUT_FOLDER; +// convenience method to write out common entries +void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, + const char *version); + #define EXPECT_FP_LE_WITH_EPS(val1, val2, eps) \ do { \ const double diff = fabs(val1 - val2); \ @@ -31,10 +35,11 @@ extern std::string INPUT_FOLDER; EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \ } while (0); -#endif - #if defined _WIN32 static const char PATH_SEP = '\\'; #else static const char PATH_SEP = '/'; #endif + +#endif + diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 0e61bacfbd..6a99fb72cd 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -244,48 +243,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) YamlWriter writer(outfile); - // lammps_version - writer.emit("lammps_version", lmp->version); - - // date_generated - std::time_t now = time(NULL); - block = utils::trim(ctime(&now)); - writer.emit("date_generated", block); - - // epsilon - writer.emit("epsilon", config.epsilon); - - // skip tests - block.clear(); - for (auto &skip_tests : config.skip_tests) { - if (block.empty()) block = skip_tests; - else block += " " + skip_tests; - } - writer.emit("skip_tests", block); - - // prerequisites - block.clear(); - for (auto &prerequisite : config.prerequisites) { - block += prerequisite.first + " " + prerequisite.second + "\n"; - } - writer.emit_block("prerequisites", block); - - // pre_commands - block.clear(); - for (auto &command : config.pre_commands) { - block += command + "\n"; - } - writer.emit_block("pre_commands", block); - - // post_commands - block.clear(); - for (auto &command : config.post_commands) { - block += command + "\n"; - } - writer.emit_block("post_commands", block); - - // input_file - writer.emit("input_file", config.input_file); + // write yaml header + write_yaml_header(&writer, &test_config, lmp->version); // pair_style writer.emit("pair_style", config.pair_style); From 5629947d89065b2ac4015457e9a3c6d271a8f81b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 21:43:38 -0500 Subject: [PATCH 027/370] add skip test entries for tests failing to run for GPU or USER-INTEL --- unittest/force-styles/tests/kspace-pppm_ad.yaml | 1 + unittest/force-styles/tests/kspace-pppm_disp.yaml | 1 + unittest/force-styles/tests/kspace-pppm_disp_ad.yaml | 1 + unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml | 1 + unittest/force-styles/tests/kspace-pppm_disp_only.yaml | 1 + unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml | 1 + unittest/force-styles/tests/manybody-pair-rebo.yaml | 1 + .../force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml | 1 + unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml | 1 + unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml | 1 + unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml | 1 + unittest/force-styles/tests/mol-pair-dpd.yaml | 1 + unittest/force-styles/tests/mol-pair-dpd_tstat.yaml | 1 + unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml | 1 + unittest/force-styles/tests/mol-pair-hybrid.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_class2.yaml | 1 + 16 files changed, 16 insertions(+) diff --git a/unittest/force-styles/tests/kspace-pppm_ad.yaml b/unittest/force-styles/tests/kspace-pppm_ad.yaml index 3f77eb99c5..5eb711c089 100644 --- a/unittest/force-styles/tests/kspace-pppm_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_ad.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:29 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_disp.yaml b/unittest/force-styles/tests/kspace-pppm_disp.yaml index 8c528baf76..e7693c8980 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:30 2021 epsilon: 2.5e-13 +skip_tests: intel prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml b/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml index 4ef71d7333..11285b1a23 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_ad.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 +skip_tests: intel prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml b/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml index 203eceb209..81380966d8 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_ad_only.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 +skip_tests: intel prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_disp_only.yaml b/unittest/force-styles/tests/kspace-pppm_disp_only.yaml index f0243c8da1..3450805f27 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_only.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_only.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:31 2021 epsilon: 2.5e-13 +skip_tests: intel prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml b/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml index 79951aab2f..047a623995 100644 --- a/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml +++ b/unittest/force-styles/tests/kspace-pppm_disp_tip4p.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:32 2021 epsilon: 2.5e-13 +skip_tests: intel prerequisites: ! | atom full pair lj/long/tip4p/long diff --git a/unittest/force-styles/tests/manybody-pair-rebo.yaml b/unittest/force-styles/tests/manybody-pair-rebo.yaml index cba66272c3..2e07aad8d6 100644 --- a/unittest/force-styles/tests/manybody-pair-rebo.yaml +++ b/unittest/force-styles/tests/manybody-pair-rebo.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:18 2021 epsilon: 1e-07 +skip_tests: intel prerequisites: ! | pair rebo pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml index eec7384351..a630f67ef8 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_c_shift.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 1e-12 +skip_tests: intel prerequisites: ! | pair tersoff/mod/c pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml index e40ac3548b..a9390a4fd3 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_mod_shift.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 +skip_tests: gpu intel prerequisites: ! | pair tersoff/mod pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml index 9676fe954b..9808d348a7 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_shift.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-13 +skip_tests: gpu intel prerequisites: ! | pair tersoff pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml index 7dda923362..69b63cf259 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl_shift.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:21 2021 epsilon: 5e-11 +skip_tests: gpu intel prerequisites: ! | pair tersoff/zbl pre_commands: ! | diff --git a/unittest/force-styles/tests/mol-pair-dpd.yaml b/unittest/force-styles/tests/mol-pair-dpd.yaml index 13e9c1b776..4964a74e2a 100644 --- a/unittest/force-styles/tests/mol-pair-dpd.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 +skip_tests: gpu intel prerequisites: ! | atom full pair dpd diff --git a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml index d43ac13ba0..0348c0d601 100644 --- a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 +skip_tests: gpu intel prerequisites: ! | atom full pair dpd/tstat diff --git a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml index a264411788..0967d5727b 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-hybrid.yaml b/unittest/force-styles/tests/mol-pair-hybrid.yaml index 4f55c09d25..95bec97279 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:45 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-lj_class2.yaml b/unittest/force-styles/tests/mol-pair-lj_class2.yaml index ba4989e6e2..779bb4def2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/class2 From 6fa3e6d23e8632478ae93b4b01ee4d1d07132ed0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 21:44:41 -0500 Subject: [PATCH 028/370] remove hardcoded checks for incompatible styles. use skip_tests keyword instead --- unittest/force-styles/test_pair_style.cpp | 26 ----------------------- 1 file changed, 26 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 6a99fb72cd..79f832c0ef 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -627,14 +627,6 @@ TEST(PairStyle, omp) EXPECT_THAT(output, StartsWith("LAMMPS (")); EXPECT_THAT(output, HasSubstr("Loop time")); - if (utils::strmatch(test_config.pair_style, "^dpd")) { - std::cerr << "Skipping pair style " << lmp->force->pair_style << "\n"; - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - GTEST_SKIP(); - } - // abort if running in parallel and not all atoms are local const int nlocal = lmp->atom->nlocal; ASSERT_EQ(lmp->atom->natoms, nlocal); @@ -930,24 +922,6 @@ TEST(PairStyle, intel) GTEST_SKIP(); } - if ((test_config.pair_style == "rebo") - || utils::strmatch(test_config.pair_style, "^dpd") - || utils::strmatch(test_config.pair_style, "^tersoff.* shift ")) { - std::cerr << "Skipping pair style " << lmp->force->pair_style << "\n"; - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - GTEST_SKIP(); - } - - if (lmp->force->kspace && utils::strmatch(lmp->force->kspace_style, "^pppm/disp/intel")) { - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - std::cerr << "Skipping kspace style pppm/disp/intel\n"; - GTEST_SKIP(); - } - // relax error a bit for USER-INTEL package double epsilon = 7.5 * test_config.epsilon; // relax test precision when using pppm and single precision FFTs From fb57d86364a1d5d5eac1456f9a90ae6e13e8e1fa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 21:45:36 -0500 Subject: [PATCH 029/370] dpd and dpd/tsat may only run with 1 thread due to use of per-thread pRNG --- unittest/force-styles/test_pair_style.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 79f832c0ef..56dee46ad2 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -606,6 +606,9 @@ TEST(PairStyle, omp) const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; + // cannot run dpd styles with more than 1 thread due to using multiple pRNGs + if (utils::strmatch(test_config.pair_style, "^dpd")) args[8] = "1"; + char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); @@ -904,6 +907,9 @@ TEST(PairStyle, intel) "-pk", "intel", "0", "mode", "double", "omp", "4", "lrt", "no", "-sf", "intel"}; + // cannot use more than 1 thread for dpd styles due to pRNG + if (utils::strmatch(test_config.pair_style, "^dpd")) args[12] = "1"; + char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); From e02ad44b8bf49e661e8a27130ec3a3ddc9b34c95 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 22:04:55 -0500 Subject: [PATCH 030/370] GPU package does not support tabulated long-range coulomb --- unittest/force-styles/test_pair_style.cpp | 8 ----- .../tests/mol-pair-born_coul_msm_table.yaml | 33 ++++++++++--------- .../tests/mol-pair-buck_coul_msm_table.yaml | 1 + .../tests/mol-pair-buck_coul_table.yaml | 1 + .../tests/mol-pair-buck_table_coul_table.yaml | 1 + .../tests/mol-pair-coul_msm_table.yaml | 1 + .../tests/mol-pair-coul_table.yaml | 1 + .../mol-pair-lj_charmm_coul_msm_table.yaml | 1 + .../tests/mol-pair-lj_charmm_coul_table.yaml | 1 + .../mol-pair-lj_charmmfsw_coul_table.yaml | 1 + .../tests/mol-pair-lj_class2_coul_table.yaml | 1 + .../tests/mol-pair-lj_cut_coul_msm.yaml | 1 + .../tests/mol-pair-lj_cut_coul_msm_table.yaml | 1 + .../tests/mol-pair-lj_cut_coul_table.yaml | 1 + .../tests/mol-pair-lj_expand_coul_table.yaml | 1 + .../tests/mol-pair-lj_sdk_coul_msm_table.yaml | 1 + .../tests/mol-pair-lj_sdk_coul_table.yaml | 1 + .../tests/mol-pair-lj_table_coul_table.yaml | 1 + .../tests/mol-pair-nm_cut_coul_table.yaml | 1 + 19 files changed, 34 insertions(+), 24 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 56dee46ad2..38a1e015a6 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -816,14 +816,6 @@ TEST(PairStyle, gpu) const int nlocal = lmp->atom->nlocal; ASSERT_EQ(lmp->atom->natoms, nlocal); - // skip over tests using tabulated coulomb - if ((lmp->force->pair->ncoultablebits > 0) || (lmp->force->pair->ndisptablebits > 0)) { - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - GTEST_SKIP(); - } - // relax error a bit for GPU package double epsilon = 7.5 * test_config.epsilon; // relax test precision when using pppm and single precision FFTs diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml index ee9f18f27c..ecbcdea3ee 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:39 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair born/coul/msm @@ -15,22 +16,22 @@ post_commands: ! | kspace_modify pressure/scalar no # required for USER-OMP with msm input_file: in.fourmol pair_style: born/coul/msm 12.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml index 52536b14d4..06e7a38c18 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:40 2021 epsilon: 2e-13 +skip_tests: gpu prerequisites: ! | atom full pair buck/coul/msm diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml index ecdbc8478c..1875a657f4 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:40 2021 epsilon: 5e-12 +skip_tests: gpu prerequisites: ! | atom full pair buck/coul/long diff --git a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml index 643786eb0d..49ddaab6d9 100644 --- a/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_table_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 epsilon: 8e-07 +skip_tests: gpu prerequisites: ! | atom full pair buck/long/coul/long diff --git a/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml index 289a3e0e38..e07fd6e639 100644 --- a/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:43 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/msm diff --git a/unittest/force-styles/tests/mol-pair-coul_table.yaml b/unittest/force-styles/tests/mol-pair-coul_table.yaml index 54baba354c..6f1077f19b 100644 --- a/unittest/force-styles/tests/mol-pair-coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml index adf0f0b71b..0755c7e3a6 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:46 2021 epsilon: 1e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/charmm/coul/msm diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml index 7d64a7c692..17a06d99f3 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/charmm/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml index 2af3de8273..b0dbfacfd9 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmmfsw_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/charmmfsw/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml index 39a9299b25..9c442b3ac5 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:47 2021 epsilon: 5e-12 +skip_tests: gpu prerequisites: ! | atom full pair lj/class2/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml index 937c115a9a..2bb831e66b 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:48 2021 epsilon: 7e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/coul/msm diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml index de1ab82c24..ccb0da249f 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 epsilon: 1e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/coul/msm diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml index d5eb9d35a1..fe0bd28d96 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 epsilon: 5e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml index 27ceae8a05..e5f31de755 100644 --- a/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_expand_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:50 2021 epsilon: 2e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/expand/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml index f9e55e3fea..4f95ee2e34 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_msm_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/sdk/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml index 914cd9077e..09bb65a0cf 100644 --- a/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_sdk_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:52 2021 epsilon: 5e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/sdk/coul/long diff --git a/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml b/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml index d9c02422cb..c02f9a31dd 100644 --- a/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_table_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:53 2021 epsilon: 2.5e-09 +skip_tests: gpu prerequisites: ! | atom full pair lj/long/coul/long diff --git a/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml b/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml index adaa3904a2..1c796c067a 100644 --- a/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml +++ b/unittest/force-styles/tests/mol-pair-nm_cut_coul_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:56 2021 epsilon: 5e-12 +skip_tests: gpu prerequisites: ! | atom full pair nm/cut/coul/long From 6c7de1cbd0924b2d14750ce05c7e351500002ba1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 22:14:35 -0500 Subject: [PATCH 031/370] no support for pppm on GPU (yet) with nozforce or triclinic cell --- unittest/force-styles/tests/kspace-pppm_nozforce.yaml | 1 + unittest/force-styles/tests/kspace-pppm_tri.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/unittest/force-styles/tests/kspace-pppm_nozforce.yaml b/unittest/force-styles/tests/kspace-pppm_nozforce.yaml index 7442e862e9..32bd592a3c 100644 --- a/unittest/force-styles/tests/kspace-pppm_nozforce.yaml +++ b/unittest/force-styles/tests/kspace-pppm_nozforce.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:32 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/long diff --git a/unittest/force-styles/tests/kspace-pppm_tri.yaml b/unittest/force-styles/tests/kspace-pppm_tri.yaml index dbcbe44e52..60099f24ee 100644 --- a/unittest/force-styles/tests/kspace-pppm_tri.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tri.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:34 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/long From 7b49b39a935ed521c3a97693723e37d799c30a25 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 22:28:23 -0500 Subject: [PATCH 032/370] fix typo --- unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml index ecbcdea3ee..d7461e8c9e 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml @@ -19,7 +19,7 @@ pair_style: born/coul/msm 12.0 pair_coeff: ! | 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 - 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 From 92dd89f9e6ec2d1e668f96788e96b4da777d9456 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 22:41:13 -0500 Subject: [PATCH 033/370] skip a few more tests that crash with the GPU package (/w OpenCL) --- unittest/force-styles/tests/manybody-pair-tersoff.yaml | 1 + unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml | 1 + unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml | 1 + 5 files changed, 5 insertions(+) diff --git a/unittest/force-styles/tests/manybody-pair-tersoff.yaml b/unittest/force-styles/tests/manybody-pair-tersoff.yaml index 366810b84e..7626e4e5de 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-13 +skip_tests: gpu prerequisites: ! | pair tersoff pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml index a503b6e912..a8d668ac3b 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff_zbl.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:20 2021 epsilon: 5e-11 +skip_tests: gpu prerequisites: ! | pair tersoff/zbl pre_commands: ! | diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml index 452a1b58d6..db8265a6b2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:45 2021 epsilon: 7e-14 +skip_tests: gpu prerequisites: ! | atom full pair lj/charmm/coul/charmm diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml index d1bed9430b..2e76bdcb57 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 epsilon: 1e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/tip4p/long diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml index 77a7f00ad8..f8c3e70c6f 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_table.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:50 2021 epsilon: 5e-13 +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/tip4p/long From cf5614e7d755df64c9585e9d6d845212e4d4de49 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Mar 2021 22:44:24 -0500 Subject: [PATCH 034/370] change precision handling so we can on the GPU also run with mixed and single precision --- unittest/force-styles/test_pair_style.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 38a1e015a6..274f8f251f 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -816,11 +816,16 @@ TEST(PairStyle, gpu) const int nlocal = lmp->atom->nlocal; ASSERT_EQ(lmp->atom->natoms, nlocal); - // relax error a bit for GPU package - double epsilon = 7.5 * test_config.epsilon; - // relax test precision when using pppm and single precision FFTs + // relax error for GPU package depending on precision setting + double epsilon = test_config.epsilon; + if (Info::has_accelerator_feature("GPU","precision","double")) + epsilon *= 7.5; + else if (Info::has_accelerator_feature("GPU","precision","mixed")) + epsilon *= 5.0e8; + else epsilon *= 1.0e10; + // relax test precision when using pppm and single precision FFTs, but only when also running with double precision #if defined(FFT_SINGLE) - if (lmp->force->kspace && lmp->force->kspace->compute_flag) + if (lmp->force->kspace && lmp->force->kspace->compute_flag && Info::has_accelerator_feature("GPU","precision","double")) if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8; #endif const std::vector &f_ref = test_config.init_forces; From 73de926f09fa7c3024fae4d325a4bb9d26ade34c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Feb 2021 15:50:58 -0500 Subject: [PATCH 035/370] safer detection and load of lammps shared library --- python/lammps/core.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index e13bf9585b..eaf78dfa0c 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -121,18 +121,16 @@ class lammps(object): lib_ext = ".so" if not self.lib: - try: - if not name: - self.lib = CDLL(join(modpath,"liblammps" + lib_ext),RTLD_GLOBAL) + if name: + libpath = join(modpath,"liblammps_%s" % name + lib_ext) + else: + libpath = join(modpath,"liblammps" + lib_ext) + if not os.path.isfile(libpath): + if name: + libpath = "liblammps_%s" % name + lib_ext else: - self.lib = CDLL(join(modpath,"liblammps_%s" % name + lib_ext), - RTLD_GLOBAL) - except: - if not name: - self.lib = CDLL("liblammps" + lib_ext,RTLD_GLOBAL) - else: - self.lib = CDLL("liblammps_%s" % name + lib_ext,RTLD_GLOBAL) - + libpath = "liblammps" + lib_ext + self.lib = CDLL(libpath,RTLD_GLOBAL) # declare all argument and return types for all library methods here. # exceptions are where the arguments depend on certain conditions and From 27a81ffc867bbbd198c81276d405bd729e27e645 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 9 Mar 2021 15:34:48 -0500 Subject: [PATCH 036/370] add initial version of a plugin loader interface (for pair styles) --- src/input.cpp | 10 ++++++ src/input.h | 1 + src/lammpsplugin.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++ src/lammpsplugin.h | 44 +++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 src/lammpsplugin.cpp create mode 100644 src/lammpsplugin.h diff --git a/src/input.cpp b/src/input.cpp index df5cf0efbe..57ce64815d 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -29,6 +29,7 @@ #include "group.h" #include "improper.h" #include "kspace.h" +#include "lammpsplugin.h" #include "memory.h" #include "min.h" #include "modify.h" @@ -714,6 +715,7 @@ int Input::execute_command() else if (!strcmp(command,"include")) include(); else if (!strcmp(command,"jump")) jump(); else if (!strcmp(command,"label")) label(); + else if (!strcmp(command,"load_plugin")) load_plugin(); else if (!strcmp(command,"log")) log(); else if (!strcmp(command,"next")) next_command(); else if (!strcmp(command,"partition")) partition(); @@ -1029,6 +1031,14 @@ void Input::label() /* ---------------------------------------------------------------------- */ +void Input::load_plugin() +{ + if (narg != 1) error->all(FLERR,"Illegal load_plugin command"); + lammpsplugin_load(arg[0],lmp); +} + +/* ---------------------------------------------------------------------- */ + void Input::log() { if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal log command"); diff --git a/src/input.h b/src/input.h index a86b10a686..3b7b6d79c7 100644 --- a/src/input.h +++ b/src/input.h @@ -79,6 +79,7 @@ class Input : protected Pointers { void include(); void jump(); void label(); + void load_plugin(); void log(); void next_command(); void partition(); diff --git a/src/lammpsplugin.cpp b/src/lammpsplugin.cpp new file mode 100644 index 0000000000..d3d409de41 --- /dev/null +++ b/src/lammpsplugin.cpp @@ -0,0 +1,76 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "lammpsplugin.h" + +#include "error.h" +#include "force.h" +#include "lammps.h" +#include "modify.h" + + +#ifdef _WIN32 +#include +#else +#include +#endif + +namespace LAMMPS_NS +{ + + void lammpsplugin_load(const char *file, void *ptr) + { + LAMMPS *lmp = (LAMMPS *)ptr; +#if defined(WIN32) + utils::logmsg(lmp,"Loading of plugins not supported on Windows yet\n"); +#else + void *dso = dlopen(file,RTLD_NOW); + if (dso == nullptr) { + utils::logmesg(lmp,fmt::format("Loading of plugin from file {} failed: " + "{}", file, utils::getsyserror())); + return; + } + + void *initfunc = dlsym(dso,"lammpsplugin_init"); + if (initfunc == nullptr) { + dlclose(dso); + utils::logmesg(lmp,fmt::format("Symbol lookup failure in file {}",file)); + return; + } + ((lammpsplugin_initfunc)(initfunc))(ptr); +#endif + } + + void lammpsplugin_register(lammpsplugin_t *plugin, void *ptr) + { + LAMMPS *lmp = (LAMMPS *)ptr; + + if (plugin == nullptr) return; + if (plugin->version) + utils::logmesg(lmp,fmt::format("Loading: {}\n compiled for LAMMPS " + "version {} loaded into LAMMPS " + "version {}\n", plugin->info, + plugin->version, lmp->version)); + std::string pstyle = plugin->style; + if (pstyle == "pair") { + (*(lmp->force->pair_map))[plugin->name] = + (LAMMPS_NS::Force::PairCreator)plugin->creator; + } else { + utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " + "yet implemented\n", pstyle)); + } + } +} + + + diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h new file mode 100644 index 0000000000..9784c456ee --- /dev/null +++ b/src/lammpsplugin.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_LAMMPSPLUGIN_H +#define LMP_LAMMPSPLUGIN_H + +#ifdef __cplusplus +extern "C" { +#endif + + typedef void *(lammpsplugin_factory)(void *); + typedef void (*lammpsplugin_initfunc)(void *); + + typedef struct { + const char *version; + const char *style; + const char *name; + const char *info; + lammpsplugin_factory *creator; + } lammpsplugin_t; + + void lammpsplugin_init(void *); + +#ifdef __cplusplus +} +#endif + +namespace LAMMPS_NS +{ + extern void lammpsplugin_load(const char *, void *); + extern void lammpsplugin_register(lammpsplugin_t *, void *); +} + +#endif From f0381b48ca95068b6c4ee222240607c4bf14f036 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 9 Mar 2021 15:50:27 -0500 Subject: [PATCH 037/370] add example for loading a pair style --- examples/plugins/Makefile | 17 ++ examples/plugins/morse2plugin.cpp | 29 +++ examples/plugins/pair_morse2.cpp | 359 ++++++++++++++++++++++++++++++ examples/plugins/pair_morse2.h | 70 ++++++ 4 files changed, 475 insertions(+) create mode 100644 examples/plugins/Makefile create mode 100644 examples/plugins/morse2plugin.cpp create mode 100644 examples/plugins/pair_morse2.cpp create mode 100644 examples/plugins/pair_morse2.h diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile new file mode 100644 index 0000000000..0c4365dfd8 --- /dev/null +++ b/examples/plugins/Makefile @@ -0,0 +1,17 @@ +CXX=mpicxx +CXXFLAGS=-I../../src -Wall -O3 -fPIC +LD=$(CXX) -shared -rdynamic + +morse2plugin.so: morse2plugin.o pair_morse2.o + $(LD) -o $@ $^ + +.cpp.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + +pair_morse2.o: pair_morse2.cpp pair_morse2.h +morse2plugin.o: morse2plugin.cpp pair_morse2.h + +clean: + rm -f *~ *.so *.o log.lammps + + diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp new file mode 100644 index 0000000000..bb21f3da95 --- /dev/null +++ b/examples/plugins/morse2plugin.cpp @@ -0,0 +1,29 @@ + +#include "lammpsplugin.h" + +#include "lammps.h" +#include "version.h" + +#include + +#include "pair_morse2.h" + +using namespace LAMMPS_NS; + +static Pair *morse2creator(LAMMPS *lmp) +{ + return new PairMorse2(lmp); +} + +static lammpsplugin_t plugin; +void lammpsplugin_init(void *lmp) +{ + memset(&plugin,0,sizeof(lammpsplugin_t)); + plugin.version = LAMMPS_VERSION; + plugin.style = "pair"; + plugin.name = "morse2"; + plugin.info = "Morse2 variant pair style v1.0 by Axel Kohlmeyer"; + plugin.creator = (lammpsplugin_factory *) &morse2creator; + + lammpsplugin_register(&plugin, (LAMMPS *)lmp); +} diff --git a/examples/plugins/pair_morse2.cpp b/examples/plugins/pair_morse2.cpp new file mode 100644 index 0000000000..a235ad297c --- /dev/null +++ b/examples/plugins/pair_morse2.cpp @@ -0,0 +1,359 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "pair_morse2.h" + +#include +#include +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairMorse2::PairMorse2(LAMMPS *lmp) : Pair(lmp) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairMorse2::~PairMorse2() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(d0); + memory->destroy(alpha); + memory->destroy(r0); + memory->destroy(morse1); + memory->destroy(offset); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairMorse2::compute(int eflag, int vflag) +{ + int i,j,ii,jj,inum,jnum,itype,jtype; + double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; + double rsq,r,dr,dexp,factor_lj; + int *ilist,*jlist,*numneigh,**firstneigh; + + evdwl = 0.0; + ev_init(eflag,vflag); + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + int newton_pair = force->newton_pair; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + dr = r - r0[itype][jtype]; + dexp = exp(-alpha[itype][jtype] * dr); + fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (eflag) { + evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - + offset[itype][jtype]; + evdwl *= factor_lj; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair, + evdwl,0.0,fpair,delx,dely,delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairMorse2::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + + memory->create(cut,n+1,n+1,"pair:cut"); + memory->create(d0,n+1,n+1,"pair:d0"); + memory->create(alpha,n+1,n+1,"pair:alpha"); + memory->create(r0,n+1,n+1,"pair:r0"); + memory->create(morse1,n+1,n+1,"pair:morse1"); + memory->create(offset,n+1,n+1,"pair:offset"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairMorse2::settings(int narg, char **arg) +{ + if (narg != 1) error->all(FLERR,"Illegal pair_style command"); + + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) + if (setflag[i][j]) cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairMorse2::coeff(int narg, char **arg) +{ + if (narg < 5 || narg > 6) + error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + + double d0_one = utils::numeric(FLERR,arg[2],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); + + double cut_one = cut_global; + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + d0[i][j] = d0_one; + alpha[i][j] = alpha_one; + r0[i][j] = r0_one; + cut[i][j] = cut_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairMorse2::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + + morse1[i][j] = 2.0*d0[i][j]*alpha[i][j]; + + if (offset_flag) { + double alpha_dr = -alpha[i][j] * (cut[i][j] - r0[i][j]); + offset[i][j] = d0[i][j] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr)); + } else offset[i][j] = 0.0; + + d0[j][i] = d0[i][j]; + alpha[j][i] = alpha[i][j]; + r0[j][i] = r0[i][j]; + morse1[j][i] = morse1[i][j]; + offset[j][i] = offset[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairMorse2::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&d0[i][j],sizeof(double),1,fp); + fwrite(&alpha[i][j],sizeof(double),1,fp); + fwrite(&r0[i][j],sizeof(double),1,fp); + fwrite(&cut[i][j],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairMorse2::read_restart(FILE *fp) +{ + read_restart_settings(fp); + + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + } + MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairMorse2::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&offset_flag,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairMorse2::read_restart_settings(FILE *fp) +{ + if (comm->me == 0) { + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&offset_flag,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairMorse2::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d %g %g %g\n",i,d0[i][i],alpha[i][i],r0[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairMorse2::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g %g %g %g\n", + i,j,d0[i][j],alpha[i][j],r0[i][j],cut[i][j]); +} + +/* ---------------------------------------------------------------------- */ + +double PairMorse2::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, + double /*factor_coul*/, double factor_lj, + double &fforce) +{ + double r,dr,dexp,phi; + + r = sqrt(rsq); + dr = r - r0[itype][jtype]; + dexp = exp(-alpha[itype][jtype] * dr); + fforce = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r; + + phi = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - offset[itype][jtype]; + return factor_lj*phi; +} + +/* ---------------------------------------------------------------------- */ + +void *PairMorse2::extract(const char *str, int &dim) +{ + dim = 2; + if (strcmp(str,"d0") == 0) return (void *) d0; + if (strcmp(str,"r0") == 0) return (void *) r0; + if (strcmp(str,"alpha") == 0) return (void *) alpha; + return nullptr; +} diff --git a/examples/plugins/pair_morse2.h b/examples/plugins/pair_morse2.h new file mode 100644 index 0000000000..c20f381c63 --- /dev/null +++ b/examples/plugins/pair_morse2.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_PAIR_MORSE2_H +#define LMP_PAIR_MORSE2_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairMorse2 : public Pair { + public: + PairMorse2(class LAMMPS *); + virtual ~PairMorse2(); + virtual void compute(int, int); + + void settings(int, char **); + void coeff(int, char **); + double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void write_data(FILE *); + void write_data_all(FILE *); + double single(int, int, int, int, double, double, double, double &); + void *extract(const char *, int &); + + protected: + double cut_global; + double **cut; + double **d0,**alpha,**r0; + double **morse1; + double **offset; + + virtual void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +*/ From fb39ceaaeb3fbfa6ed9c84a8974bf4fb466e5fe2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 9 Mar 2021 16:00:14 -0500 Subject: [PATCH 038/370] fix whitespace and typo --- src/lammpsplugin.cpp | 7 ++----- src/lammpsplugin.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lammpsplugin.cpp b/src/lammpsplugin.cpp index d3d409de41..744203cd5e 100644 --- a/src/lammpsplugin.cpp +++ b/src/lammpsplugin.cpp @@ -27,12 +27,12 @@ namespace LAMMPS_NS { - + void lammpsplugin_load(const char *file, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; #if defined(WIN32) - utils::logmsg(lmp,"Loading of plugins not supported on Windows yet\n"); + utils::logmesg(lmp,"Loading of plugins not supported on Windows yet\n"); #else void *dso = dlopen(file,RTLD_NOW); if (dso == nullptr) { @@ -71,6 +71,3 @@ namespace LAMMPS_NS } } } - - - diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 9784c456ee..13076cc86f 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -18,7 +18,7 @@ extern "C" { #endif - typedef void *(lammpsplugin_factory)(void *); + typedef void *(lammpsplugin_factory)(void *); typedef void (*lammpsplugin_initfunc)(void *); typedef struct { From f68a7094ad5fe72c8e6caa18ce6276d76d4cdda1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 9 Mar 2021 18:44:51 -0500 Subject: [PATCH 039/370] include /omp variant into plugin example --- examples/plugins/Makefile | 9 +- examples/plugins/morse2plugin.cpp | 13 ++- examples/plugins/pair_morse2_omp.cpp | 160 +++++++++++++++++++++++++++ examples/plugins/pair_morse2_omp.h | 41 +++++++ 4 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 examples/plugins/pair_morse2_omp.cpp create mode 100644 examples/plugins/pair_morse2_omp.h diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index 0c4365dfd8..2f563f924e 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -1,15 +1,16 @@ CXX=mpicxx -CXXFLAGS=-I../../src -Wall -O3 -fPIC -LD=$(CXX) -shared -rdynamic +CXXFLAGS=-I../../src -Wall -O3 -fPIC -I../../src/USER-OMP -fopenmp +LD=$(CXX) -shared -rdynamic -fopenmp -morse2plugin.so: morse2plugin.o pair_morse2.o +morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o $(LD) -o $@ $^ .cpp.o: $(CXX) -o $@ $(CXXFLAGS) -c $< pair_morse2.o: pair_morse2.cpp pair_morse2.h -morse2plugin.o: morse2plugin.cpp pair_morse2.h +pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h +morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h clean: rm -f *~ *.so *.o log.lammps diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index bb21f3da95..fbb0882a92 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -7,6 +7,7 @@ #include #include "pair_morse2.h" +#include "pair_morse2_omp.h" using namespace LAMMPS_NS; @@ -15,6 +16,11 @@ static Pair *morse2creator(LAMMPS *lmp) return new PairMorse2(lmp); } +static Pair *morse2ompcreator(LAMMPS *lmp) +{ + return new PairMorse2OMP(lmp); +} + static lammpsplugin_t plugin; void lammpsplugin_init(void *lmp) { @@ -24,6 +30,11 @@ void lammpsplugin_init(void *lmp) plugin.name = "morse2"; plugin.info = "Morse2 variant pair style v1.0 by Axel Kohlmeyer"; plugin.creator = (lammpsplugin_factory *) &morse2creator; - + lammpsplugin_register(&plugin, (LAMMPS *)lmp); + + plugin.style = "pair"; + plugin.name = "morse2/omp"; + plugin.info = "Morse2 variant pair style for OpenMP v1.0 by Axel Kohlmeyer"; + plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; lammpsplugin_register(&plugin, (LAMMPS *)lmp); } diff --git a/examples/plugins/pair_morse2_omp.cpp b/examples/plugins/pair_morse2_omp.cpp new file mode 100644 index 0000000000..14438c764b --- /dev/null +++ b/examples/plugins/pair_morse2_omp.cpp @@ -0,0 +1,160 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#include "pair_morse2_omp.h" + +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neigh_list.h" +#include "suffix.h" + +#include + +#include "omp_compat.h" +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairMorse2OMP::PairMorse2OMP(LAMMPS *lmp) : + PairMorse2(lmp), ThrOMP(lmp, THR_PAIR) +{ + suffix_flag |= Suffix::OMP; + respa_enable = 0; +} + +/* ---------------------------------------------------------------------- */ + +void PairMorse2OMP::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); + + const int nall = atom->nlocal + atom->nghost; + const int nthreads = comm->nthreads; + const int inum = list->inum; + +#if defined(_OPENMP) +#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag,vflag) +#endif + { + int ifrom, ito, tid; + + loop_setup_thr(ifrom, ito, tid, inum, nthreads); + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::START); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); + + if (evflag) { + if (eflag) { + if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr); + else eval<1,1,0>(ifrom, ito, thr); + } else { + if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr); + else eval<1,0,0>(ifrom, ito, thr); + } + } else { + if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr); + else eval<0,0,0>(ifrom, ito, thr); + } + + thr->timer(Timer::PAIR); + reduce_thr(this, eflag, vflag, thr); + } // end of omp parallel region +} + +template +void PairMorse2OMP::eval(int iifrom, int iito, ThrData * const thr) +{ + int i,j,ii,jj,jnum,itype,jtype; + double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; + double rsq,r,dr,dexp,factor_lj; + int *ilist,*jlist,*numneigh,**firstneigh; + + evdwl = 0.0; + + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const int * _noalias const type = atom->type; + const int nlocal = atom->nlocal; + const double * _noalias const special_lj = force->special_lj; + double fxtmp,fytmp,fztmp; + + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = iifrom; ii < iito; ++ii) { + + i = ilist[ii]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + fxtmp=fytmp=fztmp=0.0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + dr = r - r0[itype][jtype]; + dexp = exp(-alpha[itype][jtype] * dr); + fpair = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + if (NEWTON_PAIR || j < nlocal) { + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; + } + + if (EFLAG) { + evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - + offset[itype][jtype]; + evdwl *= factor_lj; + } + + if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, + evdwl,0.0,fpair,delx,dely,delz,thr); + } + } + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + } +} + +/* ---------------------------------------------------------------------- */ + +double PairMorse2OMP::memory_usage() +{ + double bytes = memory_usage_thr(); + bytes += PairMorse2::memory_usage(); + + return bytes; +} diff --git a/examples/plugins/pair_morse2_omp.h b/examples/plugins/pair_morse2_omp.h new file mode 100644 index 0000000000..c5ed7b5765 --- /dev/null +++ b/examples/plugins/pair_morse2_omp.h @@ -0,0 +1,41 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#ifndef LMP_PAIR_MORSE2_OMP_H +#define LMP_PAIR_MORSE2_OMP_H + +#include "pair_morse2.h" +#include "thr_omp.h" + +namespace LAMMPS_NS { + +class PairMorse2OMP : public PairMorse2, public ThrOMP { + + public: + PairMorse2OMP(class LAMMPS *); + + virtual void compute(int, int); + virtual double memory_usage(); + + private: + template + void eval(int ifrom, int ito, ThrData * const thr); +}; + +} + +#endif From 592490be4ed469afc3b752edd5a684a80f195d10 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 10 Mar 2021 09:50:28 -0500 Subject: [PATCH 040/370] add unload/list commands --- src/input.cpp | 36 +++++++++++++++++++++++++--------- src/input.h | 2 +- src/lammpsplugin.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++- src/lammpsplugin.h | 24 ++++++++++++++++------- 4 files changed, 90 insertions(+), 18 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 57ce64815d..07e3c417f6 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -715,10 +715,10 @@ int Input::execute_command() else if (!strcmp(command,"include")) include(); else if (!strcmp(command,"jump")) jump(); else if (!strcmp(command,"label")) label(); - else if (!strcmp(command,"load_plugin")) load_plugin(); else if (!strcmp(command,"log")) log(); else if (!strcmp(command,"next")) next_command(); else if (!strcmp(command,"partition")) partition(); + else if (!strcmp(command,"plugin")) plugin(); else if (!strcmp(command,"print")) print(); else if (!strcmp(command,"python")) python(); else if (!strcmp(command,"quit")) quit(); @@ -1031,14 +1031,6 @@ void Input::label() /* ---------------------------------------------------------------------- */ -void Input::load_plugin() -{ - if (narg != 1) error->all(FLERR,"Illegal load_plugin command"); - lammpsplugin_load(arg[0],lmp); -} - -/* ---------------------------------------------------------------------- */ - void Input::log() { if ((narg < 1) || (narg > 2)) error->all(FLERR,"Illegal log command"); @@ -1107,6 +1099,32 @@ void Input::partition() /* ---------------------------------------------------------------------- */ +void Input::plugin() +{ + if (narg < 1) error->all(FLERR,"Illegal plugin command"); + std::string cmd = arg[0]; + if (cmd == "load") { + if (narg < 2) error->all(FLERR,"Illegal plugin load command"); + for (int i=1; i < narg; ++i) + lammpsplugin_load(arg[i],lmp); + } else if (cmd == "unload") { + if (narg != 3) error->all(FLERR,"Illegal plugin unload command"); + lammpsplugin_unload(arg[1],arg[2],lmp); + } else if (cmd == "list") { + if (comm->me == 0) { + int num = lammpsplugin_get_num_plugins(); + utils::logmesg(lmp,"Currently loaded plugins\n"); + for (int i=0; i < num; ++i) { + auto entry = lammpsplugin_info(i); + utils::logmesg(lmp,fmt::format("{:4}: {} style plugin {}\n", + i+1,entry->style,entry->name)); + } + } + } else error->all(FLERR,"Illegal plugin command"); +} + +/* ---------------------------------------------------------------------- */ + void Input::print() { if (narg < 1) error->all(FLERR,"Illegal print command"); diff --git a/src/input.h b/src/input.h index 3b7b6d79c7..809a7a5f94 100644 --- a/src/input.h +++ b/src/input.h @@ -79,10 +79,10 @@ class Input : protected Pointers { void include(); void jump(); void label(); - void load_plugin(); void log(); void next_command(); void partition(); + void plugin(); void print(); void python(); void quit(); diff --git a/src/lammpsplugin.cpp b/src/lammpsplugin.cpp index 744203cd5e..3086b829c0 100644 --- a/src/lammpsplugin.cpp +++ b/src/lammpsplugin.cpp @@ -18,6 +18,7 @@ #include "lammps.h" #include "modify.h" +#include #ifdef _WIN32 #include @@ -27,6 +28,7 @@ namespace LAMMPS_NS { + static std::vector pluginlist; void lammpsplugin_load(const char *file, void *ptr) { @@ -34,7 +36,7 @@ namespace LAMMPS_NS #if defined(WIN32) utils::logmesg(lmp,"Loading of plugins not supported on Windows yet\n"); #else - void *dso = dlopen(file,RTLD_NOW); + void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { utils::logmesg(lmp,fmt::format("Loading of plugin from file {} failed: " "{}", file, utils::getsyserror())); @@ -48,6 +50,7 @@ namespace LAMMPS_NS return; } ((lammpsplugin_initfunc)(initfunc))(ptr); +// dlclose(dso); #endif } @@ -61,6 +64,12 @@ namespace LAMMPS_NS "version {} loaded into LAMMPS " "version {}\n", plugin->info, plugin->version, lmp->version)); + lammpsplugin_entry_t entry; + entry.style = plugin->style; + entry.name = plugin->name; + entry.handle = nullptr; + pluginlist.push_back(entry); + std::string pstyle = plugin->style; if (pstyle == "pair") { (*(lmp->force->pair_map))[plugin->name] = @@ -68,6 +77,41 @@ namespace LAMMPS_NS } else { utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " "yet implemented\n", pstyle)); + pluginlist.pop_back(); + } + } + + int lammpsplugin_get_num_plugins() + { + return pluginlist.size(); + } + + const lammpsplugin_entry_t *lammpsplugin_info(int idx) + { + if ((idx < 0) || idx >= pluginlist.size()) return nullptr; + + return &pluginlist[idx]; + } + + int lammpsplugin_find(const char *style, const char *name) + { + for (int i=0; i < pluginlist.size(); ++i) { + if ((strcmp(style,pluginlist[i].style) == 0) + && (strcmp(name,pluginlist[i].name) == 0)) + return i; + } + return -1; + } + + void lammpsplugin_unload(const char *style, const char *name, void *ptr) + { + LAMMPS *lmp = (LAMMPS *)ptr; + std::string pstyle = style; + if (pstyle == "pair") { + auto found = lmp->force->pair_map->find(name); + if (found != lmp->force->pair_map->end()) { + lmp->force->pair_map->erase(found); + } } } } diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 13076cc86f..36c442aa5e 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -14,9 +14,9 @@ #ifndef LMP_LAMMPSPLUGIN_H #define LMP_LAMMPSPLUGIN_H -#ifdef __cplusplus +// C style API and data structures required for dynamic loading + extern "C" { -#endif typedef void *(lammpsplugin_factory)(void *); typedef void (*lammpsplugin_initfunc)(void *); @@ -29,16 +29,26 @@ extern "C" { lammpsplugin_factory *creator; } lammpsplugin_t; - void lammpsplugin_init(void *); + typedef struct { + const char *style; + const char *name; + const void *handle; + } lammpsplugin_entry_t; -#ifdef __cplusplus + // prototype for initializer function required + // to load a plugin; uses C bindings + + void lammpsplugin_init(void *); } -#endif namespace LAMMPS_NS { - extern void lammpsplugin_load(const char *, void *); - extern void lammpsplugin_register(lammpsplugin_t *, void *); + extern void lammpsplugin_load(const char *, void *); + extern void lammpsplugin_register(lammpsplugin_t *, void *); + extern int lammpsplugin_get_num_plugins(); + extern const lammpsplugin_entry_t *lammpsplugin_info(int); + extern int lammpsplugin_find(const char *, const char *); + extern void lammpsplugin_unload(const char *, const char *, void *); } #endif From 8e1ccb6123e4d1800ad0f4eac27ec22aa1ce870d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 07:26:57 -0500 Subject: [PATCH 041/370] next iteration: rename functions/files, split header, store dso handle --- examples/plugins/morse2plugin.cpp | 12 +++++++----- src/input.cpp | 10 +++++----- src/lammpsplugin.h | 24 ++++++----------------- src/{lammpsplugin.cpp => plugin.cpp} | 27 ++++++++++++-------------- src/plugin.h | 29 ++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 43 deletions(-) rename src/{lammpsplugin.cpp => plugin.cpp} (81%) create mode 100644 src/plugin.h diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index fbb0882a92..d7290edfb0 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -22,19 +22,21 @@ static Pair *morse2ompcreator(LAMMPS *lmp) } static lammpsplugin_t plugin; -void lammpsplugin_init(void *lmp) +extern "C" void lammpsplugin_init(void *lmp, void *handle, lammpsplugin_regfunc register_plugin) { memset(&plugin,0,sizeof(lammpsplugin_t)); plugin.version = LAMMPS_VERSION; plugin.style = "pair"; plugin.name = "morse2"; - plugin.info = "Morse2 variant pair style v1.0 by Axel Kohlmeyer"; + plugin.info = "Morse2 variant pair style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; plugin.creator = (lammpsplugin_factory *) &morse2creator; - lammpsplugin_register(&plugin, (LAMMPS *)lmp); + plugin.handle = handle; + register_plugin(&plugin,lmp); plugin.style = "pair"; plugin.name = "morse2/omp"; - plugin.info = "Morse2 variant pair style for OpenMP v1.0 by Axel Kohlmeyer"; + plugin.info = "Morse2 variant pair style for OpenMP v1.0"; plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; - lammpsplugin_register(&plugin, (LAMMPS *)lmp); + register_plugin(&plugin,lmp); } diff --git a/src/input.cpp b/src/input.cpp index 07e3c417f6..73a73cd369 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -29,13 +29,13 @@ #include "group.h" #include "improper.h" #include "kspace.h" -#include "lammpsplugin.h" #include "memory.h" #include "min.h" #include "modify.h" #include "neighbor.h" #include "output.h" #include "pair.h" +#include "plugin.h" #include "special.h" #include "style_command.h" #include "thermo.h" @@ -1106,16 +1106,16 @@ void Input::plugin() if (cmd == "load") { if (narg < 2) error->all(FLERR,"Illegal plugin load command"); for (int i=1; i < narg; ++i) - lammpsplugin_load(arg[i],lmp); + plugin_load(arg[i],lmp); } else if (cmd == "unload") { if (narg != 3) error->all(FLERR,"Illegal plugin unload command"); - lammpsplugin_unload(arg[1],arg[2],lmp); + plugin_unload(arg[1],arg[2],lmp); } else if (cmd == "list") { if (comm->me == 0) { - int num = lammpsplugin_get_num_plugins(); + int num = plugin_get_num_plugins(); utils::logmesg(lmp,"Currently loaded plugins\n"); for (int i=0; i < num; ++i) { - auto entry = lammpsplugin_info(i); + auto entry = plugin_info(i); utils::logmesg(lmp,fmt::format("{:4}: {} style plugin {}\n", i+1,entry->style,entry->name)); } diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 36c442aa5e..6cdf67e09b 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -14,41 +14,29 @@ #ifndef LMP_LAMMPSPLUGIN_H #define LMP_LAMMPSPLUGIN_H -// C style API and data structures required for dynamic loading +// C style API and data structure required for dynamic loading extern "C" { typedef void *(lammpsplugin_factory)(void *); - typedef void (*lammpsplugin_initfunc)(void *); typedef struct { const char *version; const char *style; const char *name; const char *info; + const char *author; lammpsplugin_factory *creator; + void *handle; } lammpsplugin_t; - typedef struct { - const char *style; - const char *name; - const void *handle; - } lammpsplugin_entry_t; + typedef void (*lammpsplugin_regfunc)(lammpsplugin_t *, void *); + typedef void (*lammpsplugin_initfunc)(void *, void *, lammpsplugin_regfunc); // prototype for initializer function required // to load a plugin; uses C bindings - void lammpsplugin_init(void *); -} - -namespace LAMMPS_NS -{ - extern void lammpsplugin_load(const char *, void *); - extern void lammpsplugin_register(lammpsplugin_t *, void *); - extern int lammpsplugin_get_num_plugins(); - extern const lammpsplugin_entry_t *lammpsplugin_info(int); - extern int lammpsplugin_find(const char *, const char *); - extern void lammpsplugin_unload(const char *, const char *, void *); + void lammpsplugin_init(void *, void *, lammpsplugin_regfunc); } #endif diff --git a/src/lammpsplugin.cpp b/src/plugin.cpp similarity index 81% rename from src/lammpsplugin.cpp rename to src/plugin.cpp index 3086b829c0..f81c453afb 100644 --- a/src/lammpsplugin.cpp +++ b/src/plugin.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "lammpsplugin.h" +#include "plugin.h" #include "error.h" #include "force.h" @@ -28,9 +28,9 @@ namespace LAMMPS_NS { - static std::vector pluginlist; + static std::vector pluginlist; - void lammpsplugin_load(const char *file, void *ptr) + void plugin_load(const char *file, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; #if defined(WIN32) @@ -46,15 +46,15 @@ namespace LAMMPS_NS void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { dlclose(dso); - utils::logmesg(lmp,fmt::format("Symbol lookup failure in file {}",file)); + utils::logmesg(lmp,fmt::format("Symbol lookup failure in file {}\n",file)); return; } - ((lammpsplugin_initfunc)(initfunc))(ptr); + ((lammpsplugin_initfunc)(initfunc))(ptr,dso,&plugin_register); // dlclose(dso); #endif } - void lammpsplugin_register(lammpsplugin_t *plugin, void *ptr) + void plugin_register(lammpsplugin_t *plugin, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; @@ -64,11 +64,8 @@ namespace LAMMPS_NS "version {} loaded into LAMMPS " "version {}\n", plugin->info, plugin->version, lmp->version)); - lammpsplugin_entry_t entry; - entry.style = plugin->style; - entry.name = plugin->name; - entry.handle = nullptr; - pluginlist.push_back(entry); + + pluginlist.push_back(*plugin); std::string pstyle = plugin->style; if (pstyle == "pair") { @@ -81,19 +78,19 @@ namespace LAMMPS_NS } } - int lammpsplugin_get_num_plugins() + int plugin_get_num_plugins() { return pluginlist.size(); } - const lammpsplugin_entry_t *lammpsplugin_info(int idx) + const lammpsplugin_t *plugin_info(int idx) { if ((idx < 0) || idx >= pluginlist.size()) return nullptr; return &pluginlist[idx]; } - int lammpsplugin_find(const char *style, const char *name) + int plugin_find(const char *style, const char *name) { for (int i=0; i < pluginlist.size(); ++i) { if ((strcmp(style,pluginlist[i].style) == 0) @@ -103,7 +100,7 @@ namespace LAMMPS_NS return -1; } - void lammpsplugin_unload(const char *style, const char *name, void *ptr) + void plugin_unload(const char *style, const char *name, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; std::string pstyle = style; diff --git a/src/plugin.h b/src/plugin.h new file mode 100644 index 0000000000..546ab2a644 --- /dev/null +++ b/src/plugin.h @@ -0,0 +1,29 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_PLUGIN_H +#define LMP_PLUGIN_H + +#include "lammpsplugin.h" + +namespace LAMMPS_NS +{ + void plugin_load(const char *, void *); + void plugin_register(lammpsplugin_t *, void *); + int plugin_get_num_plugins(); + const lammpsplugin_t *plugin_info(int); + int plugin_find(const char *, const char *); + void plugin_unload(const char *, const char *, void *); +} + +#endif From ffda7fcc04f926821ccd87dbe7cd7a51ad5f13a7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 14:02:21 -0500 Subject: [PATCH 042/370] simpler interfaces --- examples/plugins/morse2plugin.cpp | 32 ++++++++++++++++--------------- src/lammpsplugin.h | 4 ++-- src/plugin.cpp | 27 +++++++++++++++++++------- src/plugin.h | 5 +++-- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index d7290edfb0..cfb6689cae 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -22,21 +22,23 @@ static Pair *morse2ompcreator(LAMMPS *lmp) } static lammpsplugin_t plugin; -extern "C" void lammpsplugin_init(void *lmp, void *handle, lammpsplugin_regfunc register_plugin) +extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) { - memset(&plugin,0,sizeof(lammpsplugin_t)); - plugin.version = LAMMPS_VERSION; - plugin.style = "pair"; - plugin.name = "morse2"; - plugin.info = "Morse2 variant pair style v1.0"; - plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator = (lammpsplugin_factory *) &morse2creator; - plugin.handle = handle; - register_plugin(&plugin,lmp); + // register plain morse2 pair style + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + memset(&plugin,0,sizeof(lammpsplugin_t)); + plugin.version = LAMMPS_VERSION; + plugin.style = "pair"; + plugin.name = "morse2"; + plugin.info = "Morse2 variant pair style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator = (lammpsplugin_factory *) &morse2creator; + plugin.handle = handle; + register_plugin(&plugin,lmp); - plugin.style = "pair"; - plugin.name = "morse2/omp"; - plugin.info = "Morse2 variant pair style for OpenMP v1.0"; - plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; - register_plugin(&plugin,lmp); + // also register morse2/omp pair style. only need to update changed fields + plugin.name = "morse2/omp"; + plugin.info = "Morse2 variant pair style for OpenMP v1.0"; + plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; + register_plugin(&plugin,lmp); } diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 6cdf67e09b..34a0b60811 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -31,12 +31,12 @@ extern "C" { } lammpsplugin_t; typedef void (*lammpsplugin_regfunc)(lammpsplugin_t *, void *); - typedef void (*lammpsplugin_initfunc)(void *, void *, lammpsplugin_regfunc); + typedef void (*lammpsplugin_initfunc)(void *, void *, void *); // prototype for initializer function required // to load a plugin; uses C bindings - void lammpsplugin_init(void *, void *, lammpsplugin_regfunc); + void lammpsplugin_init(void *, void *, void *); } #endif diff --git a/src/plugin.cpp b/src/plugin.cpp index f81c453afb..e978d90059 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -18,6 +18,7 @@ #include "lammps.h" #include "modify.h" +#include #include #ifdef _WIN32 @@ -28,14 +29,20 @@ namespace LAMMPS_NS { + // store list of plugin information data for loaded styles static std::vector pluginlist; + // map of dso handles + static std::map dso_refcounter; - void plugin_load(const char *file, void *ptr) + // load DSO and call included registration function + void plugin_load(const char *file, LAMMPS *lmp) { - LAMMPS *lmp = (LAMMPS *)ptr; #if defined(WIN32) utils::logmesg(lmp,"Loading of plugins not supported on Windows yet\n"); #else + + // open DSO from given path + void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { utils::logmesg(lmp,fmt::format("Loading of plugin from file {} failed: " @@ -43,17 +50,23 @@ namespace LAMMPS_NS return; } + // look up lammpsplugin_init() function in DSO. must have C bindings. + void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { dlclose(dso); utils::logmesg(lmp,fmt::format("Symbol lookup failure in file {}\n",file)); return; } - ((lammpsplugin_initfunc)(initfunc))(ptr,dso,&plugin_register); -// dlclose(dso); + + // call initializer function loaded from DSO and pass pointer to LAMMPS instance, + // the DSO handle (for reference counting) and plugin registration function pointer + + ((lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, (void *)&plugin_register); #endif } + // register new style from plugin with LAMMPS void plugin_register(lammpsplugin_t *plugin, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; @@ -99,10 +112,10 @@ namespace LAMMPS_NS } return -1; } - - void plugin_unload(const char *style, const char *name, void *ptr) + + // remove plugin from given style table + void plugin_unload(const char *style, const char *name, LAMMPS *lmp) { - LAMMPS *lmp = (LAMMPS *)ptr; std::string pstyle = style; if (pstyle == "pair") { auto found = lmp->force->pair_map->find(name); diff --git a/src/plugin.h b/src/plugin.h index 546ab2a644..051382ac27 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -18,12 +18,13 @@ namespace LAMMPS_NS { - void plugin_load(const char *, void *); + class LAMMPS; + void plugin_load(const char *, LAMMPS *); void plugin_register(lammpsplugin_t *, void *); int plugin_get_num_plugins(); const lammpsplugin_t *plugin_info(int); int plugin_find(const char *, const char *); - void plugin_unload(const char *, const char *, void *); + void plugin_unload(const char *, const char *, LAMMPS *); } #endif From c78ddb29ddf72dc148e1615c02a6af1c30f0ac9d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 16:57:37 -0500 Subject: [PATCH 043/370] implement reference counting and means to close unused DSO. Must delete pair style when plugin version is in use --- src/input.cpp | 2 +- src/plugin.cpp | 80 ++++++++++++++++++++++++++++++++++++++++---------- src/plugin.h | 3 +- 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 73a73cd369..6d1564ecb6 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1115,7 +1115,7 @@ void Input::plugin() int num = plugin_get_num_plugins(); utils::logmesg(lmp,"Currently loaded plugins\n"); for (int i=0; i < num; ++i) { - auto entry = plugin_info(i); + auto entry = plugin_get_info(i); utils::logmesg(lmp,fmt::format("{:4}: {} style plugin {}\n", i+1,entry->style,entry->name)); } diff --git a/src/plugin.cpp b/src/plugin.cpp index e978d90059..a3126b8acd 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -17,9 +17,10 @@ #include "force.h" #include "lammps.h" #include "modify.h" +#include "pair.h" #include -#include +#include #ifdef _WIN32 #include @@ -30,7 +31,7 @@ namespace LAMMPS_NS { // store list of plugin information data for loaded styles - static std::vector pluginlist; + static std::list pluginlist; // map of dso handles static std::map dso_refcounter; @@ -72,13 +73,18 @@ namespace LAMMPS_NS LAMMPS *lmp = (LAMMPS *)ptr; if (plugin == nullptr) return; - if (plugin->version) - utils::logmesg(lmp,fmt::format("Loading: {}\n compiled for LAMMPS " - "version {} loaded into LAMMPS " - "version {}\n", plugin->info, + utils::logmesg(lmp,fmt::format("Loading plugin: {} by {}\n", + plugin->info, plugin->author)); + if ((plugin->version) && (strcmp(plugin->version,lmp->version) != 0)) + utils::logmesg(lmp,fmt::format(" compiled for LAMMPS version {} " + "loaded into LAMMPS version {}\n", plugin->version, lmp->version)); - pluginlist.push_back(*plugin); + if (dso_refcounter.find(plugin->handle) != dso_refcounter.end()) { + ++ dso_refcounter[plugin->handle]; + } else { + dso_refcounter[plugin->handle] = 1; + } std::string pstyle = plugin->style; if (pstyle == "pair") { @@ -96,32 +102,76 @@ namespace LAMMPS_NS return pluginlist.size(); } - const lammpsplugin_t *plugin_info(int idx) + const lammpsplugin_t *plugin_get_info(int idx) { - if ((idx < 0) || idx >= pluginlist.size()) return nullptr; - - return &pluginlist[idx]; + int i=0; + for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { + if (i == idx) return &(*p); + ++i; + } + return nullptr; } int plugin_find(const char *style, const char *name) { - for (int i=0; i < pluginlist.size(); ++i) { - if ((strcmp(style,pluginlist[i].style) == 0) - && (strcmp(name,pluginlist[i].name) == 0)) + int i=0; + for (auto entry : pluginlist) { + if ((strcmp(style,entry.style) == 0) + && (strcmp(name,entry.name) == 0)) return i; + ++i; } return -1; } - // remove plugin from given style table + void plugin_erase(const char *style, const char *name) + { + fmt::print("Erasing {} style {} from list with {} plugins\n", + style, name, pluginlist.size()); + for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { + if ((strcmp(style,p->style) == 0) + && (strcmp(name,p->name) == 0)) { + pluginlist.erase(p); + return; + } + } + } + + // remove plugin from given style table and plugin list. + // close dso handle if this is the last plugin from that dso. void plugin_unload(const char *style, const char *name, LAMMPS *lmp) { + int idx = plugin_find(style,name); + if (idx < 0) + lmp->error->all(FLERR,fmt::format("{} style {} is not loaded from " + "a plugin", style, name)); + auto plugin = plugin_get_info(idx); + void *handle = plugin->handle; + utils::logmesg(lmp,fmt::format("Unloading {} style {}\n",style,name)); + plugin_erase(style,name); + std::string pstyle = style; if (pstyle == "pair") { auto found = lmp->force->pair_map->find(name); if (found != lmp->force->pair_map->end()) { lmp->force->pair_map->erase(found); } + + // must delete pair style instance if in use + if (lmp->force->pair_style) { + if (utils::strmatch(lmp->force->pair_style,"^hybrid")) { + if (lmp->force->pair_match(name,1,1) != nullptr) + lmp->force->create_pair("none",0); + } else { + if (strcmp(lmp->force->pair_style,name) == 0) + lmp->force->create_pair("none",0); + } + } + } + + -- dso_refcounter[handle]; + if (dso_refcounter[handle] == 0) { + dlclose(handle); } } } diff --git a/src/plugin.h b/src/plugin.h index 051382ac27..172b2f0c37 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -22,8 +22,9 @@ namespace LAMMPS_NS void plugin_load(const char *, LAMMPS *); void plugin_register(lammpsplugin_t *, void *); int plugin_get_num_plugins(); - const lammpsplugin_t *plugin_info(int); + const lammpsplugin_t *plugin_get_info(int); int plugin_find(const char *, const char *); + void plugin_erase(const char *, const char *); void plugin_unload(const char *, const char *, LAMMPS *); } From b8ae2f5c6f3a4f4e53e19695733c696eb1e631d1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 17:41:08 -0500 Subject: [PATCH 044/370] add comments, extra checks, have output only on MPI rank 0 --- src/plugin.cpp | 123 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 86 insertions(+), 37 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index a3126b8acd..1b9db01780 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -13,6 +13,7 @@ #include "plugin.h" +#include "comm.h" #include "error.h" #include "force.h" #include "lammps.h" @@ -38,16 +39,18 @@ namespace LAMMPS_NS // load DSO and call included registration function void plugin_load(const char *file, LAMMPS *lmp) { + int me = lmp->comm->me; #if defined(WIN32) - utils::logmesg(lmp,"Loading of plugins not supported on Windows yet\n"); + lmp->error->all(FLERR,"Loading of plugins on Windows not yet supported\n"); #else - // open DSO from given path + // open DSO file from given path load symbols globally void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { - utils::logmesg(lmp,fmt::format("Loading of plugin from file {} failed: " - "{}", file, utils::getsyserror())); + if (me == 0) + utils::logmesg(lmp,fmt::format("Open of plugin file {} failed: {}", + file,utils::getsyserror())); return; } @@ -56,30 +59,44 @@ namespace LAMMPS_NS void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { dlclose(dso); - utils::logmesg(lmp,fmt::format("Symbol lookup failure in file {}\n",file)); + if (me == 0) + utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " + "file {}\n",file)); return; } - // call initializer function loaded from DSO and pass pointer to LAMMPS instance, - // the DSO handle (for reference counting) and plugin registration function pointer + // call initializer function loaded from DSO and pass a pointer + // to the LAMMPS instance, the DSO handle (for reference counting) + // and plugin registration function pointer - ((lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, (void *)&plugin_register); + ((lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, + (void *)&plugin_register); #endif } - // register new style from plugin with LAMMPS + // register a new style from a plugin with LAMMPS + // this is the callback function that is called from within + // the plugin initializer function. all plugin information + // is taken from the lammpsplugin_t struct. + void plugin_register(lammpsplugin_t *plugin, void *ptr) { LAMMPS *lmp = (LAMMPS *)ptr; + int me = lmp->comm->me; if (plugin == nullptr) return; - utils::logmesg(lmp,fmt::format("Loading plugin: {} by {}\n", - plugin->info, plugin->author)); - if ((plugin->version) && (strcmp(plugin->version,lmp->version) != 0)) - utils::logmesg(lmp,fmt::format(" compiled for LAMMPS version {} " - "loaded into LAMMPS version {}\n", - plugin->version, lmp->version)); + if (me == 0) { + utils::logmesg(lmp,fmt::format("Loading plugin: {} by {}\n", + plugin->info, plugin->author)); + // print version info only if the versions of host and plugin don't match + if ((plugin->version) && (strcmp(plugin->version,lmp->version) != 0)) + utils::logmesg(lmp,fmt::format(" compiled for LAMMPS version {} " + "loaded into LAMMPS version {}\n", + plugin->version, lmp->version)); + } + pluginlist.push_back(*plugin); + if (dso_refcounter.find(plugin->handle) != dso_refcounter.end()) { ++ dso_refcounter[plugin->handle]; } else { @@ -88,8 +105,15 @@ namespace LAMMPS_NS std::string pstyle = plugin->style; if (pstyle == "pair") { - (*(lmp->force->pair_map))[plugin->name] = - (LAMMPS_NS::Force::PairCreator)plugin->creator; + auto pair_map = lmp->force->pair_map; + if (pair_map->find(plugin->name) != pair_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in pair " + "style {} from plugin", + plugin->name)); + } + + (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator; } else { utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " "yet implemented\n", pstyle)); @@ -97,20 +121,14 @@ namespace LAMMPS_NS } } + // number of styles loaded from plugin files + int plugin_get_num_plugins() { return pluginlist.size(); } - const lammpsplugin_t *plugin_get_info(int idx) - { - int i=0; - for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { - if (i == idx) return &(*p); - ++i; - } - return nullptr; - } + // return position index in list of given plugin of given style int plugin_find(const char *style, const char *name) { @@ -124,10 +142,22 @@ namespace LAMMPS_NS return -1; } + // get pointer to plugin initializer struct at position idx + + const lammpsplugin_t *plugin_get_info(int idx) + { + int i=0; + for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { + if (i == idx) return &(*p); + ++i; + } + return nullptr; + } + + // remove plugin of given name and style from internal lists + void plugin_erase(const char *style, const char *name) { - fmt::print("Erasing {} style {} from list with {} plugins\n", - style, name, pluginlist.size()); for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { if ((strcmp(style,p->style) == 0) && (strcmp(name,p->name) == 0)) { @@ -138,26 +168,43 @@ namespace LAMMPS_NS } // remove plugin from given style table and plugin list. - // close dso handle if this is the last plugin from that dso. + // optionally close the DSO handle if last plugin from that DSO + // must delete style instance if style is currently active. + void plugin_unload(const char *style, const char *name, LAMMPS *lmp) { + int me = lmp->comm->me; + + // ignore unload request if not loaded from a plugin int idx = plugin_find(style,name); - if (idx < 0) - lmp->error->all(FLERR,fmt::format("{} style {} is not loaded from " - "a plugin", style, name)); - auto plugin = plugin_get_info(idx); - void *handle = plugin->handle; - utils::logmesg(lmp,fmt::format("Unloading {} style {}\n",style,name)); + if (idx < 0) { + if (me == 0) + utils::logmesg(lmp,fmt::format("Ignoring unload of {} style {}: not " + "loaded from a plugin", style, name)); + return; + } + + // copy of DSO handle for later + void *handle = plugin_get_info(idx)->handle; + + // remove selected plugin from list of plugins + + if (me == 0) + utils::logmesg(lmp,fmt::format("Unloading {} style {}\n",style,name)); plugin_erase(style,name); + // remove style of given name from corresponding map + // must delete style instance if currently active so + // we can close the DSO handle if the last reference is gone. + std::string pstyle = style; if (pstyle == "pair") { auto found = lmp->force->pair_map->find(name); - if (found != lmp->force->pair_map->end()) { + if (found != lmp->force->pair_map->end()) lmp->force->pair_map->erase(found); - } // must delete pair style instance if in use + if (lmp->force->pair_style) { if (utils::strmatch(lmp->force->pair_style,"^hybrid")) { if (lmp->force->pair_match(name,1,1) != nullptr) @@ -169,6 +216,8 @@ namespace LAMMPS_NS } } + // if reference count is down to zero, close DSO handle. + -- dso_refcounter[handle]; if (dso_refcounter[handle] == 0) { dlclose(handle); From ee8246f590979e561562fdc621d9598d7004bd53 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 17:44:05 -0500 Subject: [PATCH 045/370] recover compilation on windows --- src/plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index 1b9db01780..19a5c1b754 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -58,7 +58,9 @@ namespace LAMMPS_NS void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { +#ifndef WIN32 dlclose(dso); +#endif if (me == 0) utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " "file {}\n",file)); From 3ec9f2fd5e0b72a942a91ca7ad78807c51b04279 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 17:44:11 -0500 Subject: [PATCH 046/370] whitespace --- src/plugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 19a5c1b754..7e7bd6e86f 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -33,7 +33,7 @@ namespace LAMMPS_NS { // store list of plugin information data for loaded styles static std::list pluginlist; - // map of dso handles + // map of dso handles static std::map dso_refcounter; // load DSO and call included registration function @@ -45,7 +45,7 @@ namespace LAMMPS_NS #else // open DSO file from given path load symbols globally - + void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { if (me == 0) @@ -125,7 +125,7 @@ namespace LAMMPS_NS // number of styles loaded from plugin files - int plugin_get_num_plugins() + int plugin_get_num_plugins() { return pluginlist.size(); } @@ -210,7 +210,7 @@ namespace LAMMPS_NS if (lmp->force->pair_style) { if (utils::strmatch(lmp->force->pair_style,"^hybrid")) { if (lmp->force->pair_match(name,1,1) != nullptr) - lmp->force->create_pair("none",0); + lmp->force->create_pair("none",0); } else { if (strcmp(lmp->force->pair_style,name) == 0) lmp->force->create_pair("none",0); From c61de8740c65c8f9555cc08ac6d23fc281a52d4e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 19:33:07 -0500 Subject: [PATCH 047/370] add preliminary documentation for plugin command and about how to write plugins --- doc/src/Commands_all.rst | 1 + doc/src/Developer.rst | 1 + doc/src/Developer_plugins.rst | 98 +++++++++++++++++++++++++++++++++++ doc/src/commands_list.rst | 1 + 4 files changed, 101 insertions(+) create mode 100644 doc/src/Developer_plugins.rst diff --git a/doc/src/Commands_all.rst b/doc/src/Commands_all.rst index 132425948e..b43fd0ed56 100644 --- a/doc/src/Commands_all.rst +++ b/doc/src/Commands_all.rst @@ -86,6 +86,7 @@ An alphabetic list of all general LAMMPS commands. * :doc:`pair_style ` * :doc:`pair_write ` * :doc:`partition ` + * :doc:`plugin ` * :doc:`prd ` * :doc:`print ` * :doc:`processors ` diff --git a/doc/src/Developer.rst b/doc/src/Developer.rst index 3a0c03b7ea..f54bc4152f 100644 --- a/doc/src/Developer.rst +++ b/doc/src/Developer.rst @@ -14,6 +14,7 @@ of time and requests from the LAMMPS user community. Developer_flow Developer_write Developer_notes + Developer_plugins Developer_unittest Classes Developer_utils diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst new file mode 100644 index 0000000000..ffbcf8a667 --- /dev/null +++ b/doc/src/Developer_plugins.rst @@ -0,0 +1,98 @@ +Writing plugins +--------------- + +Plugins provide a mechanism to add functionality to a LAMMPS executable +without recompiling LAMMPS. This uses the operating system's +capability to load dynamic shared object (DSO) files in a way similar +shared libraries and then references specific functions those DSOs. +Any DSO file with plugins has to include an initialization function +with a specific name that has to follow specific rules. When loading +the DSO, this function is called and will then register the contained +plugin(s) with LAMMPS. + +From the programmer perspective this can work because of the object +oriented design where all pair style commands are derived from the class +Pair, all fix style commands from the class Fix and so on and only +functions from those base classes are called directly. When a +:doc:`pair_style` command or :doc:`fix` command is issued a new +instance of such a derived class is created. This is done by a +so-called factory function which is mapped to the style name. Thus +when, for example, the LAMMPS processes the command +``pair_style lj/cut 2.5``, LAMMPS will look up the factory function +for creating the ``PairLJCut`` class and then execute it. The return +value of that function is a ``Pair *`` pointer and the pointer will +be assigned to the location for the currently active pair style. + +A plugin thus has to implement such a factory function and register it +with LAMMPS so that it gets added to the map of available styles of +the given category. To register a plugin with LAMMPS an initialization +function has to be called that follows specific rules explained below. + + +As an example, for a hypothetical pair style "morse2" implemented in a +class ``PairMorse2`` in the files ``pair_morse2.h`` and +``pair_morse2.cpp`` the file with the factory function and initialization +function would look like this: + +.. code-block:: C++ + + #include "lammpsplugin.h" + #include "version.h" + #include "pair_morse2.h" + + using namespace LAMMPS_NS; + + static Pair *morse2creator(LAMMPS *lmp) + { + return new PairMorse2(lmp); + } + + extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) + { + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + lammpsplugin_t plugin; + + plugin.version = LAMMPS_VERSION; + plugin.style = "pair"; + plugin.name = "morse2"; + plugin.info = "Morse2 variant pair style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator = (lammpsplugin_factory *) &morse2creator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); + } + +The factory function in this example is called ``morse2creator()``. It +receives a pointer to the LAMMPS class as argument and returns a +pointer to the allocated class instance derived from the ``Pair`` class. +This function may be declared static to avoid clashes with other plugins. +The name of the derived class, ``PairMorse2``, must be unique inside +the entire LAMMPS executable. + +The initialization function **must** be called ``lammpsplugin_init``, it +**must** have C bindings and it takes three void pointers as arguments. +The first is a pointer to the LAMMPS class that calls it and it needs to +be passed to the registration function. The second argument is a +pointer to the internal handle of the DSO file, this needs to added to +the plugin info struct, so that the DSO can be close and unloaded when +all its contained plugins are unloaded. The third argument is a +function pointer to the registration function and needs to be stored +in a variable of ``lammpsplugin_regfunc`` type. + +To register a plugin a struct of the ``lammpsplugin_t`` needs to be filled +with relevant info: current LAMMPS version string, kind of style, name of +style, info string, author string, pointer to factory function, DSO handle. +The the registration function is called with a pointer to the address of +this struct and the pointer of the LAMMPS class. The registration function +will then add the factory function of the plugin style to the respective +style map under the provided name. It will also make a copy of the struct +in a list of all loaded plugins and update the reference counter for loaded +plugins from this specific DSO file. + +The pair style itself (i.e. the PairMorse2 class in this example) can be +written just like any other pair style that is included in LAMMPS. For +a plugin, the use of the ``PairStyle`` macro in the section encapsulated +by ``#ifdef PAIR_CLASS`` is not needed, since the mapping of the class +name to the style name is done by the plugin registration function with +the information from the ``lammpsplugin_t`` struct. It may be included +in case the new code is intended to be later included in LAMMPS directly. diff --git a/doc/src/commands_list.rst b/doc/src/commands_list.rst index 2ec20ac220..e30d5c52dc 100644 --- a/doc/src/commands_list.rst +++ b/doc/src/commands_list.rst @@ -77,6 +77,7 @@ Commands pair_style pair_write partition + plugin prd print processors From dfe4f7a49d353a22c1c9cd56f2027e0b3a9d9ef3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 19:33:50 -0500 Subject: [PATCH 048/370] small tweaks and simplify --- examples/plugins/morse2plugin.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index cfb6689cae..286aa30c35 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -1,7 +1,6 @@ #include "lammpsplugin.h" -#include "lammps.h" #include "version.h" #include @@ -21,12 +20,12 @@ static Pair *morse2ompcreator(LAMMPS *lmp) return new PairMorse2OMP(lmp); } -static lammpsplugin_t plugin; extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) { - // register plain morse2 pair style + lammpsplugin_t plugin; lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; - memset(&plugin,0,sizeof(lammpsplugin_t)); + + // register plain morse2 pair style plugin.version = LAMMPS_VERSION; plugin.style = "pair"; plugin.name = "morse2"; @@ -34,11 +33,11 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; plugin.creator = (lammpsplugin_factory *) &morse2creator; plugin.handle = handle; - register_plugin(&plugin,lmp); + (*register_plugin)(&plugin,lmp); // also register morse2/omp pair style. only need to update changed fields plugin.name = "morse2/omp"; plugin.info = "Morse2 variant pair style for OpenMP v1.0"; plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; - register_plugin(&plugin,lmp); + (*register_plugin)(&plugin,lmp); } From b252946fba664c51e92a508b49a96ffd0ace0717 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 19:34:13 -0500 Subject: [PATCH 049/370] now fix windows compile for real --- src/plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index 7e7bd6e86f..07e3c60dd0 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -222,7 +222,9 @@ namespace LAMMPS_NS -- dso_refcounter[handle]; if (dso_refcounter[handle] == 0) { +#ifndef WIN32 dlclose(handle); +#endif } } } From f982d98574269cd4e04db9616664f1758b1cb83d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 19:34:28 -0500 Subject: [PATCH 050/370] small tweaks --- examples/plugins/Makefile | 2 +- src/plugin.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index 2f563f924e..5d60ae8651 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -1,5 +1,5 @@ CXX=mpicxx -CXXFLAGS=-I../../src -Wall -O3 -fPIC -I../../src/USER-OMP -fopenmp +CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp LD=$(CXX) -shared -rdynamic -fopenmp morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o diff --git a/src/plugin.cpp b/src/plugin.cpp index 07e3c60dd0..f2499e6528 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -58,9 +58,8 @@ namespace LAMMPS_NS void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { -#ifndef WIN32 dlclose(dso); -#endif + if (me == 0) utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " "file {}\n",file)); @@ -182,7 +181,7 @@ namespace LAMMPS_NS if (idx < 0) { if (me == 0) utils::logmesg(lmp,fmt::format("Ignoring unload of {} style {}: not " - "loaded from a plugin", style, name)); + "loaded from a plugin\n", style, name)); return; } From 9209cbba92a9a271b8642a86b766b4e507f9d2ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 21:19:04 -0500 Subject: [PATCH 051/370] add support for loading plugins for fixes --- doc/src/Developer_plugins.rst | 41 ++++++- examples/plugins/Makefile | 8 ++ examples/plugins/fix_nve2.cpp | 171 ++++++++++++++++++++++++++++++ examples/plugins/fix_nve2.h | 58 ++++++++++ examples/plugins/morse2plugin.cpp | 5 +- examples/plugins/nve2plugin.cpp | 30 ++++++ src/lammpsplugin.h | 6 +- src/plugin.cpp | 14 ++- 8 files changed, 325 insertions(+), 8 deletions(-) create mode 100644 examples/plugins/fix_nve2.cpp create mode 100644 examples/plugins/fix_nve2.h create mode 100644 examples/plugins/nve2plugin.cpp diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst index ffbcf8a667..59402165d1 100644 --- a/doc/src/Developer_plugins.rst +++ b/doc/src/Developer_plugins.rst @@ -57,17 +57,54 @@ function would look like this: plugin.name = "morse2"; plugin.info = "Morse2 variant pair style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator = (lammpsplugin_factory *) &morse2creator; + plugin.creator1 = (lammpsplugin_factory1 *) &morse2creator; + plugin.creator2 = nullptr; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } The factory function in this example is called ``morse2creator()``. It -receives a pointer to the LAMMPS class as argument and returns a +receives a pointer to the LAMMPS class as only argument and thus has to +be assigned to the *creator1* member of the plugin struct and cast to the +``lammpsplugin_factory1`` pointer type. It returns a pointer to the allocated class instance derived from the ``Pair`` class. This function may be declared static to avoid clashes with other plugins. The name of the derived class, ``PairMorse2``, must be unique inside the entire LAMMPS executable. +If the factory function would be for a fix or compute, which take three +arguments (a pointer to the LAMMPS class, the number of arguments and the +list of argument strings), then the pointer type is ``lammpsplugin_factory2`` +and it must be assigned to the *creator2* member of the plugin struct. +Below is an example for that: + +.. code-block:: C++ + + #include "lammpsplugin.h" + #include "version.h" + #include "fix_nve2.h" + + using namespace LAMMPS_NS; + + static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv) + { + return new FixNVE2(lmp,argc,argv); + } + + extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) + { + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + lammpsplugin_t plugin; + + plugin.version = LAMMPS_VERSION; + plugin.style = "fix"; + plugin.name = "nve2"; + plugin.info = "NVE2 variant fix style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator1 = nullptr; + plugin.creator2 = (lammpsplugin_factory2 *) &nve2creator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); + } The initialization function **must** be called ``lammpsplugin_init``, it **must** have C bindings and it takes three void pointers as arguments. diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index 5d60ae8651..c8ec554d5d 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -2,9 +2,14 @@ CXX=mpicxx CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp LD=$(CXX) -shared -rdynamic -fopenmp +default: morse2plugin.so nve2plugin.so + morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o $(LD) -o $@ $^ +nve2plugin.so: nve2plugin.o fix_nve2.o + $(LD) -o $@ $^ + .cpp.o: $(CXX) -o $@ $(CXXFLAGS) -c $< @@ -12,6 +17,9 @@ pair_morse2.o: pair_morse2.cpp pair_morse2.h pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h +fix_nve2.o: fix_nve2.cpp fix_nve2.h +nve2plugin.o: nve2plugin.cpp fix_nve2.h + clean: rm -f *~ *.so *.o log.lammps diff --git a/examples/plugins/fix_nve2.cpp b/examples/plugins/fix_nve2.cpp new file mode 100644 index 0000000000..bb6f53b810 --- /dev/null +++ b/examples/plugins/fix_nve2.cpp @@ -0,0 +1,171 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "fix_nve2.h" +#include +#include "atom.h" +#include "force.h" +#include "update.h" +#include "respa.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixNVE2::FixNVE2(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (strcmp(style,"nve/sphere") != 0 && narg < 3) + error->all(FLERR,"Illegal fix nve command"); + + dynamic_group_allow = 1; + time_integrate = 1; +} + +/* ---------------------------------------------------------------------- */ + +int FixNVE2::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + mask |= INITIAL_INTEGRATE_RESPA; + mask |= FINAL_INTEGRATE_RESPA; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixNVE2::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; + + if (strstr(update->integrate_style,"respa")) + step_respa = ((Respa *) update->integrate)->step; +} + +/* ---------------------------------------------------------------------- + allow for both per-type and per-atom mass +------------------------------------------------------------------------- */ + +void FixNVE2::initial_integrate(int /*vflag*/) +{ + double dtfm; + + // update v and x of atoms in group + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + x[i][0] += dtv * v[i][0]; + x[i][1] += dtv * v[i][1]; + x[i][2] += dtv * v[i][2]; + } + + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + x[i][0] += dtv * v[i][0]; + x[i][1] += dtv * v[i][1]; + x[i][2] += dtv * v[i][2]; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixNVE2::final_integrate() +{ + double dtfm; + + // update v of atoms in group + + double **v = atom->v; + double **f = atom->f; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } + + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixNVE2::initial_integrate_respa(int vflag, int ilevel, int /*iloop*/) +{ + dtv = step_respa[ilevel]; + dtf = 0.5 * step_respa[ilevel] * force->ftm2v; + + // innermost level - NVE update of v and x + // all other levels - NVE update of v + + if (ilevel == 0) initial_integrate(vflag); + else final_integrate(); +} + +/* ---------------------------------------------------------------------- */ + +void FixNVE2::final_integrate_respa(int ilevel, int /*iloop*/) +{ + dtf = 0.5 * step_respa[ilevel] * force->ftm2v; + final_integrate(); +} + +/* ---------------------------------------------------------------------- */ + +void FixNVE2::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +} diff --git a/examples/plugins/fix_nve2.h b/examples/plugins/fix_nve2.h new file mode 100644 index 0000000000..f1b2244128 --- /dev/null +++ b/examples/plugins/fix_nve2.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(nve2,FixNVE2) + +#else + +#ifndef LMP_FIX_NVE2_H +#define LMP_FIX_NVE2_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixNVE2 : public Fix { + public: + FixNVE2(class LAMMPS *, int, char **); + virtual ~FixNVE2() {} + int setmask(); + virtual void init(); + virtual void initial_integrate(int); + virtual void final_integrate(); + virtual void initial_integrate_respa(int, int, int); + virtual void final_integrate_respa(int, int); + virtual void reset_dt(); + + protected: + double dtv,dtf; + double *step_respa; + int mass_require; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +*/ diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index 286aa30c35..7151e35cd2 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -31,13 +31,14 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.name = "morse2"; plugin.info = "Morse2 variant pair style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator = (lammpsplugin_factory *) &morse2creator; + plugin.creator1 = (lammpsplugin_factory1 *) &morse2creator; + plugin.creator2 = nullptr; plugin.handle = handle; (*register_plugin)(&plugin,lmp); // also register morse2/omp pair style. only need to update changed fields plugin.name = "morse2/omp"; plugin.info = "Morse2 variant pair style for OpenMP v1.0"; - plugin.creator = (lammpsplugin_factory *) &morse2ompcreator; + plugin.creator1 = (lammpsplugin_factory1 *) &morse2ompcreator; (*register_plugin)(&plugin,lmp); } diff --git a/examples/plugins/nve2plugin.cpp b/examples/plugins/nve2plugin.cpp new file mode 100644 index 0000000000..9c9ce3d8d2 --- /dev/null +++ b/examples/plugins/nve2plugin.cpp @@ -0,0 +1,30 @@ + +#include "lammpsplugin.h" + +#include "version.h" + +#include + +#include "fix_nve2.h" + +using namespace LAMMPS_NS; + +static Fix *nve2creator(LAMMPS *lmp, int argc, char **argv) +{ + return new FixNVE2(lmp, argc, argv); +} + +extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) +{ + lammpsplugin_t plugin; + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + + plugin.version = LAMMPS_VERSION; + plugin.style = "fix"; + plugin.name = "nve2"; + plugin.info = "NVE2 variant fix style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator2 = (lammpsplugin_factory2 *) &nve2creator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); +} diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 34a0b60811..958235fdaa 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -18,7 +18,8 @@ extern "C" { - typedef void *(lammpsplugin_factory)(void *); + typedef void *(lammpsplugin_factory1)(void *); + typedef void *(lammpsplugin_factory2)(void *, int, char **); typedef struct { const char *version; @@ -26,7 +27,8 @@ extern "C" { const char *name; const char *info; const char *author; - lammpsplugin_factory *creator; + lammpsplugin_factory1 *creator1; + lammpsplugin_factory2 *creator2; void *handle; } lammpsplugin_t; diff --git a/src/plugin.cpp b/src/plugin.cpp index f2499e6528..7a42734bd9 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -114,10 +114,20 @@ namespace LAMMPS_NS plugin->name)); } - (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator; + (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator1; + } else if (pstyle == "fix") { + auto fix_map = lmp->modify->fix_map; + if (fix_map->find(plugin->name) != fix_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in fix " + "style {} from plugin", + plugin->name)); + } + + (*fix_map)[plugin->name] = (Modify::FixCreator)plugin->creator2; } else { utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " - "yet implemented\n", pstyle)); + "yet implemented\n",pstyle)); pluginlist.pop_back(); } } From 3d1c6b30af02a2e375be66de98180d6609bf6fab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 21:19:29 -0500 Subject: [PATCH 052/370] refuse to load a plugin over an existing plugin for the same style --- src/plugin.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 7a42734bd9..d2ea0943ad 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -86,14 +86,25 @@ namespace LAMMPS_NS int me = lmp->comm->me; if (plugin == nullptr) return; + + // ignore load request if same plugin already loaded + int idx = plugin_find(plugin->style,plugin->name); + if (idx >= 0) { + if (me == 0) + utils::logmesg(lmp,fmt::format("Ignoring load of {} style {}: must " + "unload existing {} plugin first\n", + plugin->style,plugin->name,plugin->name)); + return; + } + if (me == 0) { utils::logmesg(lmp,fmt::format("Loading plugin: {} by {}\n", - plugin->info, plugin->author)); + plugin->info,plugin->author)); // print version info only if the versions of host and plugin don't match if ((plugin->version) && (strcmp(plugin->version,lmp->version) != 0)) utils::logmesg(lmp,fmt::format(" compiled for LAMMPS version {} " "loaded into LAMMPS version {}\n", - plugin->version, lmp->version)); + plugin->version,lmp->version)); } pluginlist.push_back(*plugin); @@ -191,7 +202,7 @@ namespace LAMMPS_NS if (idx < 0) { if (me == 0) utils::logmesg(lmp,fmt::format("Ignoring unload of {} style {}: not " - "loaded from a plugin\n", style, name)); + "loaded from a plugin\n",style,name)); return; } From 620dd09509b9ec7cbecbe1c0acc971e242617f19 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 21:36:14 -0500 Subject: [PATCH 053/370] delete active fixes when unloading fix style plugin --- src/plugin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index d2ea0943ad..0eece6793e 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -236,6 +236,10 @@ namespace LAMMPS_NS lmp->force->create_pair("none",0); } } + } else if (pstyle == "fix") { + for (int ifix = lmp->modify->find_fix_by_style(name); + ifix >= 0; ifix = lmp->modify->find_fix_by_style(name)) + lmp->modify->delete_fix(ifix); } // if reference count is down to zero, close DSO handle. From 347db1458daa89f5ec9ef743d32c625f2b3aaf1e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 22:34:23 -0500 Subject: [PATCH 054/370] always link with libdl.so/.a or equivalent except on windows --- cmake/CMakeLists.txt | 5 +++++ cmake/Modules/Packages/USER-MOLFILE.cmake | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 06600d02c4..7081d6aa80 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -240,6 +240,11 @@ if(BUILD_OMP) target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX) endif() +# link with -ldl or equivalent for plugin loading; except on Windows +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS}) +endif() + # Compiler specific features for testing if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF) diff --git a/cmake/Modules/Packages/USER-MOLFILE.cmake b/cmake/Modules/Packages/USER-MOLFILE.cmake index 4d414acead..427f0ed6fa 100644 --- a/cmake/Modules/Packages/USER-MOLFILE.cmake +++ b/cmake/Modules/Packages/USER-MOLFILE.cmake @@ -2,8 +2,4 @@ set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}") add_library(molfile INTERFACE) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) -# no need to link with -ldl on windows -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) -endif() target_link_libraries(lammps PRIVATE molfile) From 256c478a6bae76c044efb7c262e858b547f3c286 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 22:34:47 -0500 Subject: [PATCH 055/370] reorder functions and make header and implemention order consistent --- src/plugin.cpp | 132 +++++++++++++++++++++++++++---------------------- src/plugin.h | 11 +++-- 2 files changed, 80 insertions(+), 63 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 0eece6793e..85870952e9 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -31,9 +31,10 @@ namespace LAMMPS_NS { - // store list of plugin information data for loaded styles + // list of plugin information data for loaded styles static std::list pluginlist; - // map of dso handles + + // map for counting references to dso handles static std::map dso_refcounter; // load DSO and call included registration function @@ -44,7 +45,7 @@ namespace LAMMPS_NS lmp->error->all(FLERR,"Loading of plugins on Windows not yet supported\n"); #else - // open DSO file from given path load symbols globally + // open DSO file from given path; load symbols globally void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { @@ -54,7 +55,8 @@ namespace LAMMPS_NS return; } - // look up lammpsplugin_init() function in DSO. must have C bindings. + // look up lammpsplugin_init() function in DSO + // function must have C bindings so there is no name mangling void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { @@ -70,15 +72,17 @@ namespace LAMMPS_NS // to the LAMMPS instance, the DSO handle (for reference counting) // and plugin registration function pointer - ((lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, - (void *)&plugin_register); + (*(lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, + (void *)&plugin_register); #endif } - // register a new style from a plugin with LAMMPS - // this is the callback function that is called from within - // the plugin initializer function. all plugin information - // is taken from the lammpsplugin_t struct. + /* -------------------------------------------------------------------- + register a new style from a plugin with LAMMPS + this is the callback function that is called from within + the plugin initializer function. all plugin information + is taken from the lammpsplugin_t struct. + -------------------------------------------------------------------- */ void plugin_register(lammpsplugin_t *plugin, void *ptr) { @@ -143,55 +147,11 @@ namespace LAMMPS_NS } } - // number of styles loaded from plugin files - - int plugin_get_num_plugins() - { - return pluginlist.size(); - } - - // return position index in list of given plugin of given style - - int plugin_find(const char *style, const char *name) - { - int i=0; - for (auto entry : pluginlist) { - if ((strcmp(style,entry.style) == 0) - && (strcmp(name,entry.name) == 0)) - return i; - ++i; - } - return -1; - } - - // get pointer to plugin initializer struct at position idx - - const lammpsplugin_t *plugin_get_info(int idx) - { - int i=0; - for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { - if (i == idx) return &(*p); - ++i; - } - return nullptr; - } - - // remove plugin of given name and style from internal lists - - void plugin_erase(const char *style, const char *name) - { - for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { - if ((strcmp(style,p->style) == 0) - && (strcmp(name,p->name) == 0)) { - pluginlist.erase(p); - return; - } - } - } - - // remove plugin from given style table and plugin list. - // optionally close the DSO handle if last plugin from that DSO - // must delete style instance if style is currently active. + /* -------------------------------------------------------------------- + remove plugin from given style table and plugin list + optionally close the DSO handle if it is the last plugin from that DSO + must also delete style instances if style is currently active + -------------------------------------------------------------------- */ void plugin_unload(const char *style, const char *name, LAMMPS *lmp) { @@ -251,4 +211,58 @@ namespace LAMMPS_NS #endif } } + + /* -------------------------------------------------------------------- + remove plugin of given name and style from internal lists + -------------------------------------------------------------------- */ + + void plugin_erase(const char *style, const char *name) + { + for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { + if ((strcmp(style,p->style) == 0) + && (strcmp(name,p->name) == 0)) { + pluginlist.erase(p); + return; + } + } + } + + /* -------------------------------------------------------------------- + number of styles loaded from plugin files + -------------------------------------------------------------------- */ + + int plugin_get_num_plugins() + { + return pluginlist.size(); + } + + /* -------------------------------------------------------------------- + return position index in list of given plugin of given style + -------------------------------------------------------------------- */ + + int plugin_find(const char *style, const char *name) + { + int i=0; + for (auto entry : pluginlist) { + if ((strcmp(style,entry.style) == 0) + && (strcmp(name,entry.name) == 0)) + return i; + ++i; + } + return -1; + } + + /* -------------------------------------------------------------------- + get pointer to plugin initializer struct at position idx + -------------------------------------------------------------------- */ + + const lammpsplugin_t *plugin_get_info(int idx) + { + int i=0; + for (auto p=pluginlist.begin(); p != pluginlist.end(); ++p) { + if (i == idx) return &(*p); + ++i; + } + return nullptr; + } } diff --git a/src/plugin.h b/src/plugin.h index 172b2f0c37..32a5a280a1 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -19,13 +19,16 @@ namespace LAMMPS_NS { class LAMMPS; + void plugin_load(const char *, LAMMPS *); void plugin_register(lammpsplugin_t *, void *); - int plugin_get_num_plugins(); - const lammpsplugin_t *plugin_get_info(int); - int plugin_find(const char *, const char *); - void plugin_erase(const char *, const char *); + void plugin_unload(const char *, const char *, LAMMPS *); + void plugin_erase(const char *, const char *); + + int plugin_get_num_plugins(); + int plugin_find(const char *, const char *); + const lammpsplugin_t *plugin_get_info(int); } #endif From 83583c465eb6f2b88d7eb12befb8b65e5065e508 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 22:58:22 -0500 Subject: [PATCH 056/370] add support for command plugins with example --- examples/plugins/Makefile | 8 +++-- examples/plugins/helloplugin.cpp | 49 +++++++++++++++++++++++++++++++ examples/plugins/morse2plugin.cpp | 1 + examples/plugins/nve2plugin.cpp | 2 ++ src/lammpsplugin.h | 2 ++ src/plugin.cpp | 15 ++++++++-- 6 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 examples/plugins/helloplugin.cpp diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index c8ec554d5d..bf6bc804be 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -2,7 +2,10 @@ CXX=mpicxx CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp LD=$(CXX) -shared -rdynamic -fopenmp -default: morse2plugin.so nve2plugin.so +default: morse2plugin.so nve2plugin.so helloplugin.so + +helloplugin.so: helloplugin.o + $(LD) -o $@ $^ morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o $(LD) -o $@ $^ @@ -13,6 +16,8 @@ nve2plugin.so: nve2plugin.o fix_nve2.o .cpp.o: $(CXX) -o $@ $(CXXFLAGS) -c $< +helloplugin.o: helloplugin.cpp + pair_morse2.o: pair_morse2.cpp pair_morse2.h pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h @@ -23,4 +28,3 @@ nve2plugin.o: nve2plugin.cpp fix_nve2.h clean: rm -f *~ *.so *.o log.lammps - diff --git a/examples/plugins/helloplugin.cpp b/examples/plugins/helloplugin.cpp new file mode 100644 index 0000000000..1c9d0c2779 --- /dev/null +++ b/examples/plugins/helloplugin.cpp @@ -0,0 +1,49 @@ + +#include "lammpsplugin.h" + +#include "comm.h" +#include "error.h" +#include "pointers.h" +#include "version.h" + +#include + +namespace LAMMPS_NS { + class Hello : protected Pointers { + public: + Hello(class LAMMPS *lmp) : Pointers(lmp) {}; + void command(int, char **); + }; +} + +using namespace LAMMPS_NS; + +void Hello::command(int argc, char **argv) +{ + if (argc != 1) error->all(FLERR,"Illegal hello command"); + if (comm->me == 0) + utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0])); +} + +static void hellocreator(LAMMPS *lmp, int argc, char **argv) +{ + Hello hello(lmp); + hello.command(argc,argv); +} + +extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) +{ + lammpsplugin_t plugin; + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + + plugin.version = LAMMPS_VERSION; + plugin.style = "command"; + plugin.name = "hello"; + plugin.info = "Hello world command v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator1 = nullptr; + plugin.creator2 = nullptr; + plugin.creator3 = (lammpsplugin_factory3 *) &hellocreator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); +} diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index 7151e35cd2..dfc341e0c0 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -33,6 +33,7 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; plugin.creator1 = (lammpsplugin_factory1 *) &morse2creator; plugin.creator2 = nullptr; + plugin.creator3 = nullptr; plugin.handle = handle; (*register_plugin)(&plugin,lmp); diff --git a/examples/plugins/nve2plugin.cpp b/examples/plugins/nve2plugin.cpp index 9c9ce3d8d2..785ec8dbe1 100644 --- a/examples/plugins/nve2plugin.cpp +++ b/examples/plugins/nve2plugin.cpp @@ -24,7 +24,9 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.name = "nve2"; plugin.info = "NVE2 variant fix style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator1 = nullptr; plugin.creator2 = (lammpsplugin_factory2 *) &nve2creator; + plugin.creator3 = nullptr; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 958235fdaa..3de2bcdcdf 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -20,6 +20,7 @@ extern "C" { typedef void *(lammpsplugin_factory1)(void *); typedef void *(lammpsplugin_factory2)(void *, int, char **); + typedef void (lammpsplugin_factory3)(void *, int, char **); typedef struct { const char *version; @@ -29,6 +30,7 @@ extern "C" { const char *author; lammpsplugin_factory1 *creator1; lammpsplugin_factory2 *creator2; + lammpsplugin_factory3 *creator3; void *handle; } lammpsplugin_t; diff --git a/src/plugin.cpp b/src/plugin.cpp index 85870952e9..ea1c46b705 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -15,6 +15,7 @@ #include "comm.h" #include "error.h" +#include "input.h" #include "force.h" #include "lammps.h" #include "modify.h" @@ -128,8 +129,8 @@ namespace LAMMPS_NS "style {} from plugin", plugin->name)); } - (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator1; + } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; if (fix_map->find(plugin->name) != fix_map->end()) { @@ -138,8 +139,18 @@ namespace LAMMPS_NS "style {} from plugin", plugin->name)); } - (*fix_map)[plugin->name] = (Modify::FixCreator)plugin->creator2; + + } else if (pstyle == "command") { + auto command_map = lmp->input->command_map; + if (command_map->find(plugin->name) != command_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in fix " + "style {} from plugin", + plugin->name)); + } + (*command_map)[plugin->name] = (Input::CommandCreator)plugin->creator3; + } else { utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " "yet implemented\n",pstyle)); From dde00ab344340ffbf29fb5eb34462f1a8439319e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 23:10:26 -0500 Subject: [PATCH 057/370] add plugin command documentation --- doc/src/plugin.rst | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 doc/src/plugin.rst diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst new file mode 100644 index 0000000000..42d53aabe3 --- /dev/null +++ b/doc/src/plugin.rst @@ -0,0 +1,76 @@ +.. index:: plugin + +plugin command +============== + +Syntax +"""""" + +.. parsed-literal:: + + plugin command args + +* command = *load* or *unload* or *list* +* args = list of arguments for a particular plugin command + + .. parsed-literal:: + + *load* file = load plugin(s) from shared object in *file* + *unload* style name = unload plugin *name* of style *style* + *list* = print a list of currently loaded plugins + +Examples +"""""""" + +.. code-block:: LAMMPS + + plugin load morse2plugin.so + plugin unload pair morse2/omp + plugin list + +Description +""""""""""" + +The plugin command allows to load (and unload) additional styles and +commands into a LAMMPS binary from so-called dynamic shared object (DSO) +files. This enables to add new functionality to an existing LAMMPS +binary without having to recompile and link the entire executable. + +The *load* command will load and initialize all plugins contained in the +plugin DSO with the given filename. A message with information the +plugin style and name and more will be printed. Individual DSO files +may contain multiple plugins. More details about how to write and +compile the plugin DSO is given in programmer's guide part of the manual +under :doc:`Developer_plugins`. + +The *unload* command will remove the given style or the given name from +the list of available styles. If the plugin style is currently in use, +that style instance will be deleted. + +The *list* command will print a list of the loaded plugins and their +styles and names. + + +Restrictions +"""""""""""" + +Plugins are currently not available on Windows. + +Plugins are dependent on the LAMMPS binary interface (ABI) +and particularly the MPI library used. So they are not guaranteed +to work when the plugin was compiled with a different MPI library +or different compilation settings or a different LAMMPS version. +If there is a mismatch the *plugin* command may fail to load the +plugin(s) or data corruption or crashes may happen. + + +Related commands +"""""""""""""""" + +none + + +Default +""""""" + +none From 524c62994eba5be3c1786ffaab32fc8d3edf9226 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 23:12:00 -0500 Subject: [PATCH 058/370] update docs --- doc/src/plugin.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index 42d53aabe3..25a55565b9 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -17,6 +17,7 @@ Syntax *load* file = load plugin(s) from shared object in *file* *unload* style name = unload plugin *name* of style *style* + *style* = *pair* or *fix* or *command* *list* = print a list of currently loaded plugins Examples @@ -26,6 +27,7 @@ Examples plugin load morse2plugin.so plugin unload pair morse2/omp + plugin unload command hello plugin list Description From d95d5f19547a88dc595922f5254c4b308ec643ac Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 23:52:35 -0500 Subject: [PATCH 059/370] store different factory variants in a union --- examples/plugins/helloplugin.cpp | 4 +--- examples/plugins/morse2plugin.cpp | 6 ++---- examples/plugins/nve2plugin.cpp | 4 +--- src/lammpsplugin.h | 8 +++++--- src/plugin.cpp | 6 +++--- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/plugins/helloplugin.cpp b/examples/plugins/helloplugin.cpp index 1c9d0c2779..11f2cfb891 100644 --- a/examples/plugins/helloplugin.cpp +++ b/examples/plugins/helloplugin.cpp @@ -41,9 +41,7 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.name = "hello"; plugin.info = "Hello world command v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator1 = nullptr; - plugin.creator2 = nullptr; - plugin.creator3 = (lammpsplugin_factory3 *) &hellocreator; + plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } diff --git a/examples/plugins/morse2plugin.cpp b/examples/plugins/morse2plugin.cpp index dfc341e0c0..a4151dcc3d 100644 --- a/examples/plugins/morse2plugin.cpp +++ b/examples/plugins/morse2plugin.cpp @@ -31,15 +31,13 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.name = "morse2"; plugin.info = "Morse2 variant pair style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator1 = (lammpsplugin_factory1 *) &morse2creator; - plugin.creator2 = nullptr; - plugin.creator3 = nullptr; + plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator; plugin.handle = handle; (*register_plugin)(&plugin,lmp); // also register morse2/omp pair style. only need to update changed fields plugin.name = "morse2/omp"; plugin.info = "Morse2 variant pair style for OpenMP v1.0"; - plugin.creator1 = (lammpsplugin_factory1 *) &morse2ompcreator; + plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2ompcreator; (*register_plugin)(&plugin,lmp); } diff --git a/examples/plugins/nve2plugin.cpp b/examples/plugins/nve2plugin.cpp index 785ec8dbe1..d17db1dfc7 100644 --- a/examples/plugins/nve2plugin.cpp +++ b/examples/plugins/nve2plugin.cpp @@ -24,9 +24,7 @@ extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) plugin.name = "nve2"; plugin.info = "NVE2 variant fix style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator1 = nullptr; - plugin.creator2 = (lammpsplugin_factory2 *) &nve2creator; - plugin.creator3 = nullptr; + plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } diff --git a/src/lammpsplugin.h b/src/lammpsplugin.h index 3de2bcdcdf..1baed9799d 100644 --- a/src/lammpsplugin.h +++ b/src/lammpsplugin.h @@ -28,9 +28,11 @@ extern "C" { const char *name; const char *info; const char *author; - lammpsplugin_factory1 *creator1; - lammpsplugin_factory2 *creator2; - lammpsplugin_factory3 *creator3; + union { + lammpsplugin_factory1 *v1; + lammpsplugin_factory2 *v2; + lammpsplugin_factory3 *v3; + } creator; void *handle; } lammpsplugin_t; diff --git a/src/plugin.cpp b/src/plugin.cpp index ea1c46b705..a95fde5b73 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -129,7 +129,7 @@ namespace LAMMPS_NS "style {} from plugin", plugin->name)); } - (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator1; + (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator.v1; } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; @@ -139,7 +139,7 @@ namespace LAMMPS_NS "style {} from plugin", plugin->name)); } - (*fix_map)[plugin->name] = (Modify::FixCreator)plugin->creator2; + (*fix_map)[plugin->name] = (Modify::FixCreator)plugin->creator.v2; } else if (pstyle == "command") { auto command_map = lmp->input->command_map; @@ -149,7 +149,7 @@ namespace LAMMPS_NS "style {} from plugin", plugin->name)); } - (*command_map)[plugin->name] = (Input::CommandCreator)plugin->creator3; + (*command_map)[plugin->name] = (Input::CommandCreator)plugin->creator.v3; } else { utils::logmesg(lmp,fmt::format("Loading plugin for {} styles not " From 930c0fca30fc24a3180d0ded815b8716063e5af4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Mar 2021 23:59:23 -0500 Subject: [PATCH 060/370] must link with -ldl --- src/MAKE/Makefile.mpi | 2 +- src/MAKE/Makefile.serial | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MAKE/Makefile.mpi b/src/MAKE/Makefile.mpi index db134de68a..c66e66c217 100644 --- a/src/MAKE/Makefile.mpi +++ b/src/MAKE/Makefile.mpi @@ -13,7 +13,7 @@ DEPFLAGS = -M LINK = mpicxx LINKFLAGS = -g -O3 -LIB = +LIB = -ldl SIZE = size ARCHIVE = ar diff --git a/src/MAKE/Makefile.serial b/src/MAKE/Makefile.serial index a0b2959c4b..daf04cc5b0 100644 --- a/src/MAKE/Makefile.serial +++ b/src/MAKE/Makefile.serial @@ -13,7 +13,7 @@ DEPFLAGS = -M LINK = g++ LINKFLAGS = -g -O -LIB = +LIB = -ldl SIZE = size ARCHIVE = ar From a2bcd7fe68f0501733da98c9f941bae9f514b4f5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 00:07:52 -0500 Subject: [PATCH 061/370] programmer documentation update --- doc/src/Developer_plugins.rst | 64 +++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst index 59402165d1..192c57ccbb 100644 --- a/doc/src/Developer_plugins.rst +++ b/doc/src/Developer_plugins.rst @@ -57,15 +57,14 @@ function would look like this: plugin.name = "morse2"; plugin.info = "Morse2 variant pair style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator1 = (lammpsplugin_factory1 *) &morse2creator; - plugin.creator2 = nullptr; + plugin.creator.v1 = (lammpsplugin_factory1 *) &morse2creator; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } The factory function in this example is called ``morse2creator()``. It receives a pointer to the LAMMPS class as only argument and thus has to -be assigned to the *creator1* member of the plugin struct and cast to the +be assigned to the *creator.v1* member of the plugin struct and cast to the ``lammpsplugin_factory1`` pointer type. It returns a pointer to the allocated class instance derived from the ``Pair`` class. This function may be declared static to avoid clashes with other plugins. @@ -74,7 +73,7 @@ the entire LAMMPS executable. If the factory function would be for a fix or compute, which take three arguments (a pointer to the LAMMPS class, the number of arguments and the list of argument strings), then the pointer type is ``lammpsplugin_factory2`` -and it must be assigned to the *creator2* member of the plugin struct. +and it must be assigned to the *creator.v2* member of the plugin struct. Below is an example for that: .. code-block:: C++ @@ -100,12 +99,65 @@ Below is an example for that: plugin.name = "nve2"; plugin.info = "NVE2 variant fix style v1.0"; plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; - plugin.creator1 = nullptr; - plugin.creator2 = (lammpsplugin_factory2 *) &nve2creator; + plugin.creator.v2 = (lammpsplugin_factory2 *) &nve2creator; plugin.handle = handle; (*register_plugin)(&plugin,lmp); } +For command styles there is a third variant of factory function as +demonstrated in the following example, which also shows that the +implementation of the plugin class may also be within the same +file as the plugin interface code: + +.. code-block:: C++ + + #include "lammpsplugin.h" + + #include "comm.h" + #include "error.h" + #include "pointers.h" + #include "version.h" + + #include + + namespace LAMMPS_NS { + class Hello : protected Pointers { + public: + Hello(class LAMMPS *lmp) : Pointers(lmp) {}; + void command(int, char **); + }; + } + + using namespace LAMMPS_NS; + + void Hello::command(int argc, char **argv) + { + if (argc != 1) error->all(FLERR,"Illegal hello command"); + if (comm->me == 0) + utils::logmesg(lmp,fmt::format("Hello, {}!\n",argv[0])); + } + + static void hellocreator(LAMMPS *lmp, int argc, char **argv) + { + Hello hello(lmp); + hello.command(argc,argv); + } + + extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) + { + lammpsplugin_t plugin; + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + + plugin.version = LAMMPS_VERSION; + plugin.style = "command"; + plugin.name = "hello"; + plugin.info = "Hello world command v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator.v3 = (lammpsplugin_factory3 *) &hellocreator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); + } + The initialization function **must** be called ``lammpsplugin_init``, it **must** have C bindings and it takes three void pointers as arguments. The first is a pointer to the LAMMPS class that calls it and it needs to From c3f6fb914ff9ff287482f805e97663c6a356e2df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 11:43:37 -0500 Subject: [PATCH 062/370] add CMake build environment demo for plugins --- examples/plugins/CMakeLists.txt | 56 +++++++++++++++ examples/plugins/LAMMPSInterfaceCXX.cmake | 86 +++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 examples/plugins/CMakeLists.txt create mode 100644 examples/plugins/LAMMPSInterfaceCXX.cmake diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt new file mode 100644 index 0000000000..2fb8ca746f --- /dev/null +++ b/examples/plugins/CMakeLists.txt @@ -0,0 +1,56 @@ +########################################## +# CMake build system for plugin examples. +# The is meant to be used as a template for plugins that are +# distributed independent from the LAMMPS package. +########################################## + +cmake_minimum_required(VERSION 3.10) + +# enforce out-of-source build +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. " + "Please remove CMakeCache.txt and CMakeFiles first.") +endif() + +project(plugins VERSION 1.0 LANGUAGES CXX) + +# NOTE: the next line should be commented out when used outside of the LAMMPS package +get_filename_component(LAMMPS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../src ABSOLUTE) +set(LAMMPS_HEADER_DIR ${LAMMPS_SOURCE_DIR} CACHE PATH "Location of LAMMPS headers") +if(NOT LAMMPS_HEADER_DIR) + message(FATAL_ERROR "Must set LAMMPS_HEADER_DIR") +endif() + +# by default, install into $HOME/.local (not /usr/local), +# so that no root access (and sudo) is needed +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE) +endif() + +# C++11 is required +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# bail out on windows +if(CMAKE_SYSTEM_NAME STREQUAL Windows) + message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows") +endif() + +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) +include(CheckIncludeFileCXX) +include(LAMMPSInterfaceCXX) + +########################## +# building the plugins + +add_library(morse2plugin MODULE morse2plugin.cpp pair_morse2.cpp pair_morse2_omp.cpp) +target_include_directories(morse2plugin PRIVATE "${LAMMPS_HEADER_DIR}/USER-OMP") +target_link_libraries(morse2plugin PRIVATE lammps) + +add_library(nve2plugin MODULE nve2plugin.cpp fix_nve2.cpp) +target_link_libraries(nve2plugin PRIVATE lammps) + +add_library(helloplugin MODULE helloplugin.cpp) +target_link_libraries(helloplugin PRIVATE lammps) + +set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES PREFIX "") diff --git a/examples/plugins/LAMMPSInterfaceCXX.cmake b/examples/plugins/LAMMPSInterfaceCXX.cmake new file mode 100644 index 0000000000..02f9159319 --- /dev/null +++ b/examples/plugins/LAMMPSInterfaceCXX.cmake @@ -0,0 +1,86 @@ +# Cmake script code to define the LAMMPS C++ interface +# settings required for building LAMMPS plugins + +################################################################################ +# helper function +function(validate_option name values) + string(TOLOWER ${${name}} needle_lower) + string(TOUPPER ${${name}} needle_upper) + list(FIND ${values} ${needle_lower} IDX_LOWER) + list(FIND ${values} ${needle_upper} IDX_UPPER) + if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0) + list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}}) + message(FATAL_ERROR "\n########################################################################\n" + "Invalid value '${${name}}' for option ${name}\n" + "\n" + "Possible values are:\n" + "${POSSIBLE_VALUE_LIST}" + "########################################################################") + endif() +endfunction(validate_option) + +################################################################################# +# LAMMPS C++ interface. We only need the header related parts. +add_library(lammps INTERFACE) +target_include_directories(lammps INTERFACE ${LAMMPS_HEADER_DIR}) + +################################################################################ +# MPI configuration +if(NOT CMAKE_CROSSCOMPILING) + set(MPI_CXX_SKIP_MPICXX TRUE) + find_package(MPI QUIET) + option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) +else() + option(BUILD_MPI "Build MPI version" OFF) +endif() + +if(BUILD_MPI) + find_package(MPI REQUIRED) + option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) + if(LAMMPS_LONGLONG_TO_LONG) + target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG) + endif() + target_link_libraries(lammps INTERFACE MPI::MPI_CXX) +else() + target_include_directories(lammps INTERFACE "${LAMMPS_SOURCE_DIR}/STUBS") +endif() + +set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)") +set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall) +set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES}) +validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES) +string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES) +target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES}) + +################################################################################ +# detect if we may enable OpenMP support by default +set(BUILD_OMP_DEFAULT OFF) +find_package(OpenMP QUIET) +if(OpenMP_FOUND) + check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) + if(HAVE_OMP_H_INCLUDE) + set(BUILD_OMP_DEFAULT ON) + endif() +endif() + +option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT}) + +if(BUILD_OMP) + find_package(OpenMP REQUIRED) + check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE) + if(NOT HAVE_OMP_H_INCLUDE) + message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support") + endif() + + if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) + # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. + # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe. + target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4) + else() + target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3) + endif() + target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX) +endif() From 7b4e14317685278c5e62217aaffddd5bdb2773cb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 14:29:40 -0500 Subject: [PATCH 063/370] support building plugins on MacOS (tested on version 11.0 aka Big Sur) --- examples/plugins/CMakeLists.txt | 10 +++++++++- examples/plugins/Makefile | 2 +- examples/plugins/Makefile.macos | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 examples/plugins/Makefile.macos diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 2fb8ca746f..74a1cd4e3b 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -53,4 +53,12 @@ target_link_libraries(nve2plugin PRIVATE lammps) add_library(helloplugin MODULE helloplugin.cpp) target_link_libraries(helloplugin PRIVATE lammps) -set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES PREFIX "") +set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES + PREFIX "" + LINK_FLAGS "-rdynamic") + +# MacOS seems to need this +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES + LINK_FLAGS "-Wl,-undefined,dynamic_lookup") +endif() diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index bf6bc804be..dbb0023991 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -26,5 +26,5 @@ fix_nve2.o: fix_nve2.cpp fix_nve2.h nve2plugin.o: nve2plugin.cpp fix_nve2.h clean: - rm -f *~ *.so *.o log.lammps + rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles diff --git a/examples/plugins/Makefile.macos b/examples/plugins/Makefile.macos new file mode 100644 index 0000000000..2490418a09 --- /dev/null +++ b/examples/plugins/Makefile.macos @@ -0,0 +1,30 @@ +CXX=mpicxx +CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP +LD=$(CXX) -bundle -rdynamic -Wl,-undefined,dynamic_lookup + +default: morse2plugin.dylib nve2plugin.dylib helloplugin.dylib + +helloplugin.dylib: helloplugin.o + $(LD) -o $@ $^ + +morse2plugin.dylib: morse2plugin.o pair_morse2.o pair_morse2_omp.o + $(LD) -o $@ $^ + +nve2plugin.dylib: nve2plugin.o fix_nve2.o + $(LD) -o $@ $^ + +.cpp.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + +helloplugin.o: helloplugin.cpp + +pair_morse2.o: pair_morse2.cpp pair_morse2.h +pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h +morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h + +fix_nve2.o: fix_nve2.cpp fix_nve2.h +nve2plugin.o: nve2plugin.cpp fix_nve2.h + +clean: + rm -rf *~ *.dylib *.dylib *.o log.lammps CMakeCache.txt CMakeFiles + From 4b1924fad10322d5173d982115bcdb42252a9477 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 14:29:59 -0500 Subject: [PATCH 064/370] add missing check --- src/plugin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index a95fde5b73..68b9978353 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -207,10 +207,16 @@ namespace LAMMPS_NS lmp->force->create_pair("none",0); } } + } else if (pstyle == "fix") { for (int ifix = lmp->modify->find_fix_by_style(name); ifix >= 0; ifix = lmp->modify->find_fix_by_style(name)) lmp->modify->delete_fix(ifix); + + } else if (pstyle == "command") { + auto command_map = lmp->input->command_map; + auto cmd = command_map->find(name); + if (cmd != command_map->end()) command_map->erase(name); } // if reference count is down to zero, close DSO handle. From 1c222286e22e699068a0021221d9c8b1090681e2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 14:30:08 -0500 Subject: [PATCH 065/370] correct output --- src/plugin.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 68b9978353..f9bd36f875 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -51,8 +51,7 @@ namespace LAMMPS_NS void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { if (me == 0) - utils::logmesg(lmp,fmt::format("Open of plugin file {} failed: {}", - file,utils::getsyserror())); + utils::logmesg(lmp,fmt::format("Open of file {} failed\n",file)); return; } @@ -145,7 +144,7 @@ namespace LAMMPS_NS auto command_map = lmp->input->command_map; if (command_map->find(plugin->name) != command_map->end()) { if (lmp->comm->me == 0) - lmp->error->warning(FLERR,fmt::format("Overriding built-in fix " + lmp->error->warning(FLERR,fmt::format("Overriding built-in command " "style {} from plugin", plugin->name)); } From 98013a1528ab55d9209eff6de4d604574d7bd57e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 15:32:50 -0500 Subject: [PATCH 066/370] add draft version of unit test (will have to be improved for MacOS) --- unittest/commands/CMakeLists.txt | 19 +++++++++++++++++++ unittest/commands/test_simple_commands.cpp | 9 +++++++++ 2 files changed, 28 insertions(+) diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index 7a804820cb..0fb0c8088e 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -1,5 +1,24 @@ +# build LAMMPS plugins, but not on Windows +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + ExternalProject_Add(plugins + SOURCE_DIR "${LAMMPS_DIR}/examples/plugins" + BINARY_DIR "${CMAKE_BINARY_DIR}/plugins" + CMAKE_ARGS ${CMAKE_REQUEST_PIC} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_INSTALL_PREFIX= + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + BUILD_BYPRODUCTS /morse2plugin${CMAKE_STATIC_LIBRARY_SUFFIX} + /nve2plugin${CMAKE_STATIC_LIBRARY_SUFFIX} + /helloplugin${CMAKE_STATIC_LIBRARY_SUFFIX} + INSTALL_COMMAND "" + TEST_COMMAND "") +endif() + add_executable(test_simple_commands test_simple_commands.cpp) +add_dependencies(test_simple_commands plugins) target_link_libraries(test_simple_commands PRIVATE lammps GTest::GMock GTest::GTest) add_test(NAME SimpleCommands COMMAND test_simple_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 4fce58c668..09f81b8f71 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -344,6 +344,15 @@ TEST_F(SimpleCommandsTest, Units) TEST_FAILURE(".*ERROR: Illegal units command.*", lmp->input->one("units unknown");); } +TEST_F(SimpleCommandsTest, Plugin) +{ + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin load plugins/helloplugin.so"); + auto text = ::testing::internal::GetCapturedStdout(); + + ASSERT_THAT(text, MatchesRegex(".*Loading plugin: Hello world command.*")); +} + TEST_F(SimpleCommandsTest, Shell) { if (!verbose) ::testing::internal::CaptureStdout(); From 93bbaef5473b3ad126b28865e50b8081c7245aeb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 17:28:22 -0500 Subject: [PATCH 067/370] add unit tests for plugin command --- unittest/commands/test_simple_commands.cpp | 66 +++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 09f81b8f71..08fe53a6b9 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -346,11 +346,73 @@ TEST_F(SimpleCommandsTest, Units) TEST_F(SimpleCommandsTest, Plugin) { +#if defined(__APPLE__) + std::string loadfmt("plugin load plugins/{}plugin.dylib"); +#else + std::string loadfmt("plugin load plugins/{}plugin.so"); +#endif ::testing::internal::CaptureStdout(); - lmp->input->one("plugin load plugins/helloplugin.so"); + lmp->input->one(fmt::format(loadfmt, "hello")); auto text = ::testing::internal::GetCapturedStdout(); - + if (verbose) std::cout << text; ASSERT_THAT(text, MatchesRegex(".*Loading plugin: Hello world command.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one(fmt::format(loadfmt, "xxx")); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Open of file plugins/xxx.* failed.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one(fmt::format(loadfmt, "nve2")); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Loading plugin: NVE2 variant fix style.*")); + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin list"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*1: command style plugin hello" + ".*2: fix style plugin nve2.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one(fmt::format(loadfmt, "hello")); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Ignoring load of command style hello: " + "must unload existing hello plugin.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin unload command hello"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Unloading command style hello.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin unload pair nve2"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of pair style nve2: " + "not loaded from a plugin.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin unload fix nve2"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Unloading fix style nve2.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin unload fix nve"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of fix style nve: " + "not loaded from a plugin.*")); + + ::testing::internal::CaptureStdout(); + lmp->input->one("plugin list"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*Currently loaded plugins.*")); } TEST_F(SimpleCommandsTest, Shell) From b2085f56d6478552110fcdcc5f16921b30a885b4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 18:35:39 -0500 Subject: [PATCH 068/370] install compiled plugins into the current working directory of the tester --- unittest/commands/CMakeLists.txt | 15 ++++++++++----- unittest/commands/test_simple_commands.cpp | 6 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index 0fb0c8088e..6c68bfb274 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -3,17 +3,22 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ExternalProject_Add(plugins SOURCE_DIR "${LAMMPS_DIR}/examples/plugins" - BINARY_DIR "${CMAKE_BINARY_DIR}/plugins" + BINARY_DIR ${CMAKE_BINARY_DIR}/build-plugins + INSTALL_DIR ${CMAKE_BINARY_DIR} CMAKE_ARGS ${CMAKE_REQUEST_PIC} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /morse2plugin${CMAKE_STATIC_LIBRARY_SUFFIX} - /nve2plugin${CMAKE_STATIC_LIBRARY_SUFFIX} - /helloplugin${CMAKE_STATIC_LIBRARY_SUFFIX} - INSTALL_COMMAND "" + BUILD_BYPRODUCTS /morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} + /nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} + /helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX} + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different + /morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} + /nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} + /helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_CURRENT_BINARY_DIR} TEST_COMMAND "") endif() diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 08fe53a6b9..0e26734dfb 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -347,9 +347,9 @@ TEST_F(SimpleCommandsTest, Units) TEST_F(SimpleCommandsTest, Plugin) { #if defined(__APPLE__) - std::string loadfmt("plugin load plugins/{}plugin.dylib"); + std::string loadfmt("plugin load {}plugin.dylib"); #else - std::string loadfmt("plugin load plugins/{}plugin.so"); + std::string loadfmt("plugin load {}plugin.so"); #endif ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "hello")); @@ -361,7 +361,7 @@ TEST_F(SimpleCommandsTest, Plugin) lmp->input->one(fmt::format(loadfmt, "xxx")); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*Open of file plugins/xxx.* failed.*")); + ASSERT_THAT(text, MatchesRegex(".*Open of file xxx.* failed.*")); ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "nve2")); From 3e90b1971a9f9890be584c47db12c2d922de5b37 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 22:21:11 -0500 Subject: [PATCH 069/370] add preliminary support for compiling/loading plugins on windows --- doc/src/plugin.rst | 3 ++ examples/plugins/CMakeLists.txt | 14 +++----- examples/plugins/Makefile.serial | 30 ++++++++++++++++ src/MAKE/Makefile.mpi | 2 +- src/MAKE/Makefile.serial | 2 +- src/plugin.cpp | 59 ++++++++++++++++++++++++-------- 6 files changed, 85 insertions(+), 25 deletions(-) create mode 100644 examples/plugins/Makefile.serial diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index 25a55565b9..a75e39ccae 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -58,6 +58,9 @@ Restrictions Plugins are currently not available on Windows. +For the loading of plugins to work, the LAMMPS library must be +:ref:`compiled as a shared library `. + Plugins are dependent on the LAMMPS binary interface (ABI) and particularly the MPI library used. So they are not guaranteed to work when the plugin was compiled with a different MPI library diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 74a1cd4e3b..2db2c041fd 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -31,11 +31,6 @@ endif() set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# bail out on windows -if(CMAKE_SYSTEM_NAME STREQUAL Windows) - message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows") -endif() - set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) include(CheckIncludeFileCXX) include(LAMMPSInterfaceCXX) @@ -53,12 +48,13 @@ target_link_libraries(nve2plugin PRIVATE lammps) add_library(helloplugin MODULE helloplugin.cpp) target_link_libraries(helloplugin PRIVATE lammps) -set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES - PREFIX "" - LINK_FLAGS "-rdynamic") +set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES PREFIX "") -# MacOS seems to need this if(CMAKE_SYSTEM_NAME STREQUAL Darwin) set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") +elseif(CMAKE_SYSTEM_NAME STREQUAL Windows) + set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-Wl,--undefined") +else() + set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-rdynamic") endif() diff --git a/examples/plugins/Makefile.serial b/examples/plugins/Makefile.serial new file mode 100644 index 0000000000..feb58bd9b3 --- /dev/null +++ b/examples/plugins/Makefile.serial @@ -0,0 +1,30 @@ +CXX=g++ +CXXFLAGS=-I../../src -I../../src/STUBS -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp +LD=$(CXX) -shared -rdynamic -fopenmp + +default: morse2plugin.so nve2plugin.so helloplugin.so + +helloplugin.so: helloplugin.o + $(LD) -o $@ $^ + +morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o + $(LD) -o $@ $^ + +nve2plugin.so: nve2plugin.o fix_nve2.o + $(LD) -o $@ $^ + +.cpp.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + +helloplugin.o: helloplugin.cpp + +pair_morse2.o: pair_morse2.cpp pair_morse2.h +pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h +morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h + +fix_nve2.o: fix_nve2.cpp fix_nve2.h +nve2plugin.o: nve2plugin.cpp fix_nve2.h + +clean: + rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles + diff --git a/src/MAKE/Makefile.mpi b/src/MAKE/Makefile.mpi index c66e66c217..68e79e9e8e 100644 --- a/src/MAKE/Makefile.mpi +++ b/src/MAKE/Makefile.mpi @@ -18,7 +18,7 @@ SIZE = size ARCHIVE = ar ARFLAGS = -rc -SHLIBFLAGS = -shared +SHLIBFLAGS = -shared -rdynamic # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL diff --git a/src/MAKE/Makefile.serial b/src/MAKE/Makefile.serial index daf04cc5b0..8b4e2e5982 100644 --- a/src/MAKE/Makefile.serial +++ b/src/MAKE/Makefile.serial @@ -18,7 +18,7 @@ SIZE = size ARCHIVE = ar ARFLAGS = -rc -SHLIBFLAGS = -shared +SHLIBFLAGS = -shared -rdynamic # --------------------------------------------------------------------- # LAMMPS-specific settings, all OPTIONAL diff --git a/src/plugin.cpp b/src/plugin.cpp index f9bd36f875..2c4f2da396 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -24,12 +24,49 @@ #include #include -#ifdef _WIN32 +#if defined(_WIN32) #include #else #include #endif +#if defined(_WIN32) + +// open a shared object file +static void *my_dlopen(const char *fname) { + return (void *)LoadLibrary(fname); +} + +// resolve a symbol in shared object +static void *my_dlsym(void *h, const char *sym) { + return (void *)GetProcAddress((HINSTANCE)h, sym); +} + +// close a shared object +static int my_dlclose(void *h) { + /* FreeLibrary returns nonzero on success */ + return !FreeLibrary((HINSTANCE)h); +} + +#else + +// open a shared object file +static void *my_dlopen(const char *fname) { + return dlopen(fname, RTLD_NOW|RTLD_GLOBAL); +} + +// resolve a symbol in shared object +static void *my_dlsym(void *h, const char *sym) { + return dlsym(h, sym); +} + +// close a shared object +static int my_dlclose(void *h) { + return dlclose(h); +} + +#endif + namespace LAMMPS_NS { // list of plugin information data for loaded styles @@ -42,13 +79,11 @@ namespace LAMMPS_NS void plugin_load(const char *file, LAMMPS *lmp) { int me = lmp->comm->me; -#if defined(WIN32) - lmp->error->all(FLERR,"Loading of plugins on Windows not yet supported\n"); -#else // open DSO file from given path; load symbols globally - - void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); + + void *dso = my_dlopen(file); + if (dso == nullptr) { if (me == 0) utils::logmesg(lmp,fmt::format("Open of file {} failed\n",file)); @@ -58,9 +93,10 @@ namespace LAMMPS_NS // look up lammpsplugin_init() function in DSO // function must have C bindings so there is no name mangling - void *initfunc = dlsym(dso,"lammpsplugin_init"); + void *initfunc = my_dlsym(dso,"lammpsplugin_init"); + if (initfunc == nullptr) { - dlclose(dso); + my_dlclose(dso); if (me == 0) utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " @@ -74,7 +110,6 @@ namespace LAMMPS_NS (*(lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, (void *)&plugin_register); -#endif } /* -------------------------------------------------------------------- @@ -221,11 +256,7 @@ namespace LAMMPS_NS // if reference count is down to zero, close DSO handle. -- dso_refcounter[handle]; - if (dso_refcounter[handle] == 0) { -#ifndef WIN32 - dlclose(handle); -#endif - } + if (dso_refcounter[handle] == 0) my_dlclose(handle); } /* -------------------------------------------------------------------- From d05137455c660e2c801ebffddc36ca9eaf51b8d2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 22:21:24 -0500 Subject: [PATCH 070/370] ignore build folders --- examples/plugins/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 examples/plugins/.gitignore diff --git a/examples/plugins/.gitignore b/examples/plugins/.gitignore new file mode 100644 index 0000000000..0ec9e7f982 --- /dev/null +++ b/examples/plugins/.gitignore @@ -0,0 +1 @@ +/build* From 4ae7f84c2ac0552c3f123e6e9f02911b526ed6b9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Mar 2021 22:27:38 -0500 Subject: [PATCH 071/370] whitespace --- src/plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 2c4f2da396..73fcfd947e 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -81,9 +81,9 @@ namespace LAMMPS_NS int me = lmp->comm->me; // open DSO file from given path; load symbols globally - + void *dso = my_dlopen(file); - + if (dso == nullptr) { if (me == 0) utils::logmesg(lmp,fmt::format("Open of file {} failed\n",file)); From e3d9c3126b12c081598b3ac36e5497edca8f12bd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 10:25:44 -0500 Subject: [PATCH 072/370] revert back to not supporting loading plugins on windows --- examples/plugins/CMakeLists.txt | 14 +++++--- src/plugin.cpp | 57 ++++++++------------------------- 2 files changed, 22 insertions(+), 49 deletions(-) diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 2db2c041fd..74a1cd4e3b 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -31,6 +31,11 @@ endif() set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# bail out on windows +if(CMAKE_SYSTEM_NAME STREQUAL Windows) + message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows") +endif() + set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) include(CheckIncludeFileCXX) include(LAMMPSInterfaceCXX) @@ -48,13 +53,12 @@ target_link_libraries(nve2plugin PRIVATE lammps) add_library(helloplugin MODULE helloplugin.cpp) target_link_libraries(helloplugin PRIVATE lammps) -set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES PREFIX "") +set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES + PREFIX "" + LINK_FLAGS "-rdynamic") +# MacOS seems to need this if(CMAKE_SYSTEM_NAME STREQUAL Darwin) set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") -elseif(CMAKE_SYSTEM_NAME STREQUAL Windows) - set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-Wl,--undefined") -else() - set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES LINK_FLAGS "-rdynamic") endif() diff --git a/src/plugin.cpp b/src/plugin.cpp index 73fcfd947e..d654535f56 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -24,49 +24,12 @@ #include #include -#if defined(_WIN32) +#ifdef _WIN32 #include #else #include #endif -#if defined(_WIN32) - -// open a shared object file -static void *my_dlopen(const char *fname) { - return (void *)LoadLibrary(fname); -} - -// resolve a symbol in shared object -static void *my_dlsym(void *h, const char *sym) { - return (void *)GetProcAddress((HINSTANCE)h, sym); -} - -// close a shared object -static int my_dlclose(void *h) { - /* FreeLibrary returns nonzero on success */ - return !FreeLibrary((HINSTANCE)h); -} - -#else - -// open a shared object file -static void *my_dlopen(const char *fname) { - return dlopen(fname, RTLD_NOW|RTLD_GLOBAL); -} - -// resolve a symbol in shared object -static void *my_dlsym(void *h, const char *sym) { - return dlsym(h, sym); -} - -// close a shared object -static int my_dlclose(void *h) { - return dlclose(h); -} - -#endif - namespace LAMMPS_NS { // list of plugin information data for loaded styles @@ -79,11 +42,13 @@ namespace LAMMPS_NS void plugin_load(const char *file, LAMMPS *lmp) { int me = lmp->comm->me; +#if defined(WIN32) + lmp->error->all(FLERR,"Loading of plugins on Windows is not supported\n"); +#else // open DSO file from given path; load symbols globally - void *dso = my_dlopen(file); - + void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { if (me == 0) utils::logmesg(lmp,fmt::format("Open of file {} failed\n",file)); @@ -93,10 +58,9 @@ namespace LAMMPS_NS // look up lammpsplugin_init() function in DSO // function must have C bindings so there is no name mangling - void *initfunc = my_dlsym(dso,"lammpsplugin_init"); - + void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { - my_dlclose(dso); + dlclose(dso); if (me == 0) utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " @@ -110,6 +74,7 @@ namespace LAMMPS_NS (*(lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, (void *)&plugin_register); +#endif } /* -------------------------------------------------------------------- @@ -256,7 +221,11 @@ namespace LAMMPS_NS // if reference count is down to zero, close DSO handle. -- dso_refcounter[handle]; - if (dso_refcounter[handle] == 0) my_dlclose(handle); + if (dso_refcounter[handle] == 0) { +#ifndef WIN32 + dlclose(handle); +#endif + } } /* -------------------------------------------------------------------- From 76cff1ed1ec1ce562ed58d4c3f2e0aa483d18444 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:17:20 -0500 Subject: [PATCH 073/370] add library interface for introspection of loaded plugins --- src/library.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ src/library.h | 3 +++ 2 files changed, 57 insertions(+) diff --git a/src/library.cpp b/src/library.cpp index 2a7bbf07b3..ae3212d6f3 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -38,6 +38,7 @@ #include "neighbor.h" #include "region.h" #include "output.h" +#include "plugin.h" #include "thermo.h" #include "timer.h" #include "universe.h" @@ -4581,6 +4582,59 @@ int lammps_id_name(void *handle, const char *category, int idx, return 0; } +/* ---------------------------------------------------------------------- */ + +/** Count the number of loaded plugins + * +\verbatim embed:rst +This function counts how many plugins are currently loaded. + +.. versionadded:: 10Mar2021 + +\endverbatim + * + * \return number of loaded plugins + */ +int lammps_plugin_count() +{ + return plugin_get_num_plugins(); +} + +/* ---------------------------------------------------------------------- */ + +/** Look up the info of a loaded plugin by its index in the list of plugins + * +\verbatim embed:rst +This function copies the name of the *style* plugin with the index +*idx* into the provided C-style string buffer. The length of the buffer +must be provided as *buf_size* argument. If the name of the style +exceeds the length of the buffer, it will be truncated accordingly. +If the index is out of range, the function returns 0 and *buffer* is +set to an empty string, otherwise 1. + +.. versionadded:: 10Mar2021 + +\endverbatim + * + * \param idx index of the plugin in the list all or *style* plugins + * \param stylebuf string buffer to copy the style of the plugin to + * \param namebuf string buffer to copy the name of the plugin to + * \param buf_size size of the provided string buffers + * \return 1 if successful, otherwise 0 + */ +int lammps_plugin_name(int idx, char *stylebuf, char *namebuf, int buf_size) +{ + stylebuf[0] = namebuf[0] = '\0'; + + const lammpsplugin_t *plugin = plugin_get_info(idx); + if (plugin) { + strncpy(stylebuf,plugin->style,buf_size); + strncpy(namebuf,plugin->name,buf_size); + return 1; + } + return 0; +} + // ---------------------------------------------------------------------- // utility functions // ---------------------------------------------------------------------- diff --git a/src/library.h b/src/library.h index d98bf426b3..11cd72388a 100644 --- a/src/library.h +++ b/src/library.h @@ -205,6 +205,9 @@ int lammps_has_id(void *, const char *, const char *); int lammps_id_count(void *, const char *); int lammps_id_name(void *, const char *, int, char *, int); +int lammps_plugin_count(); +int lammps_plugin_name(int, char *, char *, int); + /* ---------------------------------------------------------------------- * Utility functions * ---------------------------------------------------------------------- */ From dd94bac0c8b3b61cb1805d703f189b78958a2f3d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:17:45 -0500 Subject: [PATCH 074/370] better error message when trying to unload an unsupported plugin style --- src/plugin.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index d654535f56..fb3186c69e 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -167,6 +167,16 @@ namespace LAMMPS_NS { int me = lmp->comm->me; + // ignore unload request from unsupported style categories + if ((strcmp(style,"pair") != 0) + && (strcmp(style,"fix") != 0) + && (strcmp(style,"command") != 0)) { + if (me == 0) + utils::logmesg(lmp,fmt::format("Ignoring unload: {} is not a " + "supported plugin style\n",style)); + return; + } + // ignore unload request if not loaded from a plugin int idx = plugin_find(style,name); if (idx < 0) { From 79d438e090e9b72ac6db2d04403005bad3086645 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:18:07 -0500 Subject: [PATCH 075/370] add support for plugin command to LAMMPS shell --- tools/lammps-shell/lammps-shell.cpp | 66 ++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/tools/lammps-shell/lammps-shell.cpp b/tools/lammps-shell/lammps-shell.cpp index 7ace6d6819..8153c1bcfa 100644 --- a/tools/lammps-shell/lammps-shell.cpp +++ b/tools/lammps-shell/lammps-shell.cpp @@ -128,6 +128,7 @@ const char *cmdlist[] = {"clear", "pair_modify", "pair_style", "pair_write", + "plugin", "processors", "region", "reset_timestep", @@ -347,6 +348,59 @@ static char *variable_expand_generator(const char *text, int state) return nullptr; } +static char *plugin_generator(const char *text, int state) +{ + const char *subcmd[] = {"load", "unload", "list", NULL}; + const char *sub; + static std::size_t idx, len; + if (!state) idx = 0; + len = strlen(text); + + while ((sub = subcmd[idx]) != NULL) { + ++idx; + if (strncmp(text,sub,len) == 0) + return dupstring(sub); + } + return nullptr; +} + +static char *plugin_style_generator(const char *text, int state) +{ + const char *styles[] = {"pair", "fix", "command", NULL}; + const char *s; + static std::size_t idx, len; + if (!state) idx = 0; + len = strlen(text); + while ((s = styles[idx]) != NULL) { + ++idx; + if (strncmp(text,s,len) == 0) + return dupstring(s); + } + return nullptr; +} + +static char *plugin_name_generator(const char *text, int state) +{ + auto words = utils::split_words(text); + if (words.size() < 4) return nullptr; + + static std::size_t idx, len; + if (!state) idx = 0; + len = words[3].size(); + int nmax = lammps_plugin_count(); + + while (idx < nmax) { + char style[buflen], name[buflen]; + lammps_plugin_name(idx, style, name, buflen); + ++idx; + if (words[2] == style) { + if (strncmp(name, words[3].c_str(), len) == 0) + return dupstring(name); + } + } + return nullptr; +} + static char *atom_generator(const char *text, int state) { return style_generator(text, state); @@ -477,14 +531,21 @@ static char **cmd_completion(const char *text, int start, int) matches = rl_completion_matches(text, dump_id_generator); } else if (words[0] == "fix_modify") { matches = rl_completion_matches(text, fix_id_generator); + } else if (words[0] == "plugin") { + matches = rl_completion_matches(text, plugin_generator); } } else if (words.size() == 2) { // expand third word // these commands have a group name as 3rd word - if ((words[0] == "fix") || (words[0] == "compute") || (words[0] == "dump")) { + if ((words[0] == "fix") + || (words[0] == "compute") + || (words[0] == "dump")) { matches = rl_completion_matches(text, group_generator); } else if (words[0] == "region") { matches = rl_completion_matches(text, region_generator); + // plugin style is the third word + } else if ((words[0] == "plugin") && (words[1] == "unload")) { + matches = rl_completion_matches(text, plugin_style_generator); } } else if (words.size() == 3) { // expand fourth word @@ -495,6 +556,9 @@ static char **cmd_completion(const char *text, int start, int) matches = rl_completion_matches(text, compute_generator); } else if (words[0] == "dump") { matches = rl_completion_matches(text, dump_generator); + // plugin name is the fourth word + } else if ((words[0] == "plugin") && (words[1] == "unload")) { + matches = rl_completion_matches(rl_line_buffer, plugin_name_generator); } } } From 88760fa648a69352bd333e6b06c412acb17eec08 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:40:04 -0500 Subject: [PATCH 076/370] add plugin clear command to unload all loaded plugins --- doc/src/plugin.rst | 18 ++++++++++++------ src/input.cpp | 2 ++ src/plugin.cpp | 12 ++++++++++++ src/plugin.h | 1 + tools/lammps-shell/lammps-shell.cpp | 2 +- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index a75e39ccae..e8a5f67e3c 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -10,7 +10,7 @@ Syntax plugin command args -* command = *load* or *unload* or *list* +* command = *load* or *unload* or *list* or *clear* * args = list of arguments for a particular plugin command .. parsed-literal:: @@ -19,6 +19,7 @@ Syntax *unload* style name = unload plugin *name* of style *style* *style* = *pair* or *fix* or *command* *list* = print a list of currently loaded plugins + *clear* = unload all currently loaded plugins Examples """""""" @@ -29,6 +30,7 @@ Examples plugin unload pair morse2/omp plugin unload command hello plugin list + plugin clear Description """"""""""" @@ -52,21 +54,25 @@ that style instance will be deleted. The *list* command will print a list of the loaded plugins and their styles and names. +The *clear* command will unload all currently loaded plugins. + Restrictions """""""""""" -Plugins are currently not available on Windows. +Plugins are not available on Windows. -For the loading of plugins to work, the LAMMPS library must be -:ref:`compiled as a shared library `. +For the loading of plugins to work the LAMMPS library must be +:ref:`compiled as a shared library `. If plugins +access functions or classes from a package, LAMMPS must have +been compiled with that package included. Plugins are dependent on the LAMMPS binary interface (ABI) and particularly the MPI library used. So they are not guaranteed to work when the plugin was compiled with a different MPI library or different compilation settings or a different LAMMPS version. -If there is a mismatch the *plugin* command may fail to load the -plugin(s) or data corruption or crashes may happen. +There are no checks, so if there is a mismatch the plugin object +will either not load or data corruption and crashes may happen. Related commands diff --git a/src/input.cpp b/src/input.cpp index 6d1564ecb6..1df60f5298 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1110,6 +1110,8 @@ void Input::plugin() } else if (cmd == "unload") { if (narg != 3) error->all(FLERR,"Illegal plugin unload command"); plugin_unload(arg[1],arg[2],lmp); + } else if (cmd == "clear") { + plugin_clear(lmp); } else if (cmd == "list") { if (comm->me == 0) { int num = plugin_get_num_plugins(); diff --git a/src/plugin.cpp b/src/plugin.cpp index fb3186c69e..99b1b086c5 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -238,6 +238,18 @@ namespace LAMMPS_NS } } + /* -------------------------------------------------------------------- + unload all loaded plugins + -------------------------------------------------------------------- */ + + void plugin_clear(LAMMPS *lmp) + { + while (pluginlist.size() > 0) { + auto p = pluginlist.begin(); + plugin_unload(p->style,p->name,lmp); + } + } + /* -------------------------------------------------------------------- remove plugin of given name and style from internal lists -------------------------------------------------------------------- */ diff --git a/src/plugin.h b/src/plugin.h index 32a5a280a1..90952224a6 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -25,6 +25,7 @@ namespace LAMMPS_NS void plugin_unload(const char *, const char *, LAMMPS *); void plugin_erase(const char *, const char *); + void plugin_clear(LAMMPS *); int plugin_get_num_plugins(); int plugin_find(const char *, const char *); diff --git a/tools/lammps-shell/lammps-shell.cpp b/tools/lammps-shell/lammps-shell.cpp index 8153c1bcfa..6c8873093f 100644 --- a/tools/lammps-shell/lammps-shell.cpp +++ b/tools/lammps-shell/lammps-shell.cpp @@ -350,7 +350,7 @@ static char *variable_expand_generator(const char *text, int state) static char *plugin_generator(const char *text, int state) { - const char *subcmd[] = {"load", "unload", "list", NULL}; + const char *subcmd[] = {"load", "unload", "list", "clear", NULL}; const char *sub; static std::size_t idx, len; if (!state) idx = 0; From 10189760c68799d957e29c389c06ceb6242e5822 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:40:49 -0500 Subject: [PATCH 077/370] fix issue of not removing unloaded plugins from fix map --- src/plugin.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 99b1b086c5..2d18da64ce 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -186,7 +186,7 @@ namespace LAMMPS_NS return; } - // copy of DSO handle for later + // make copy of DSO handle for later use void *handle = plugin_get_info(idx)->handle; // remove selected plugin from list of plugins @@ -201,6 +201,7 @@ namespace LAMMPS_NS std::string pstyle = style; if (pstyle == "pair") { + auto found = lmp->force->pair_map->find(name); if (found != lmp->force->pair_map->end()) lmp->force->pair_map->erase(found); @@ -218,14 +219,20 @@ namespace LAMMPS_NS } } else if (pstyle == "fix") { + + auto fix_map = lmp->modify->fix_map; + auto found = fix_map->find(name); + if (found != fix_map->end()) fix_map->erase(name); + for (int ifix = lmp->modify->find_fix_by_style(name); ifix >= 0; ifix = lmp->modify->find_fix_by_style(name)) lmp->modify->delete_fix(ifix); } else if (pstyle == "command") { + auto command_map = lmp->input->command_map; - auto cmd = command_map->find(name); - if (cmd != command_map->end()) command_map->erase(name); + auto found = command_map->find(name); + if (found != command_map->end()) command_map->erase(name); } // if reference count is down to zero, close DSO handle. From 98fa3661f382c423748f296e246417f5b4d0698e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 12:41:01 -0500 Subject: [PATCH 078/370] silence compiler warning --- src/library.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index ae3212d6f3..3fed6ba8cd 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -988,12 +988,12 @@ to then decide how to cast the (void*) pointer and access the data. \endverbatim * - * \param handle pointer to a previously created LAMMPS instance + * \param handle pointer to a previously created LAMMPS instance (unused) * \param name string with the name of the extracted property * \return integer constant encoding the data type of the property * or -1 if not found. */ -int lammps_extract_global_datatype(void *handle, const char *name) +int lammps_extract_global_datatype(void * /*handle*/, const char *name) { if (strcmp(name,"dt") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"ntimestep") == 0) return LAMMPS_BIGINT; From 15e30ed44da6d9147f08fedc44e5770df4c93da8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Mar 2021 18:41:36 -0500 Subject: [PATCH 079/370] report dynamic linker error messages on failures --- src/plugin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 2d18da64ce..e252ce67e1 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -48,23 +48,26 @@ namespace LAMMPS_NS // open DSO file from given path; load symbols globally + dlerror(); void *dso = dlopen(file,RTLD_NOW|RTLD_GLOBAL); if (dso == nullptr) { if (me == 0) - utils::logmesg(lmp,fmt::format("Open of file {} failed\n",file)); + utils::logmesg(lmp,fmt::format("Open of file {} failed: {}\n", + file,dlerror())); return; } // look up lammpsplugin_init() function in DSO // function must have C bindings so there is no name mangling + dlerror(); void *initfunc = dlsym(dso,"lammpsplugin_init"); if (initfunc == nullptr) { dlclose(dso); if (me == 0) utils::logmesg(lmp,fmt::format("Plugin symbol lookup failure in " - "file {}\n",file)); + "file {}: {}\n",file,dlerror())); return; } From 11d2b488c1ae18d3d2aaf83ed49025c4b4a0f174 Mon Sep 17 00:00:00 2001 From: Stephen Sanderson Date: Tue, 16 Mar 2021 16:51:10 +1000 Subject: [PATCH 080/370] Fixed incorrect scaling of cdof for 'norm all' --- src/fix_ave_chunk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 3b612aeb73..359e3ba588 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -881,7 +881,7 @@ void FixAveChunk::end_of_step() if (count_sum[m] > 0.0) for (j = 0; j < nvalues; j++) { if (which[j] == ArgInfo::TEMPERATURE) { - values_sum[m][j] *= mvv2e / ((cdof + adof*count_sum[m]) * boltz); + values_sum[m][j] *= mvv2e/((repeat*cdof + adof*count_sum[m])*boltz); } else if (which[j] == ArgInfo::DENSITY_NUMBER) { if (volflag == SCALAR) values_sum[m][j] /= chunk_volume_scalar; else values_sum[m][j] /= chunk_volume_vec[m]; From 22fdfa27b57fbcdbc9d8e6045df7567491eb3d5e Mon Sep 17 00:00:00 2001 From: Stephen Sanderson Date: Wed, 17 Mar 2021 09:01:35 +1000 Subject: [PATCH 081/370] Updated documentation to clarify the treatment of temperature using norm all --- doc/src/fix_ave_chunk.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/src/fix_ave_chunk.rst b/doc/src/fix_ave_chunk.rst index d2dbaa320a..ce7fcd1fca 100644 --- a/doc/src/fix_ave_chunk.rst +++ b/doc/src/fix_ave_chunk.rst @@ -307,7 +307,9 @@ atoms in the chunk. The averaged output value for the chunk on the average over atoms across the entire *Nfreq* timescale. For the *density/number* and *density/mass* values, the volume (bin volume or system volume) used in the final normalization will be the volume at -the final *Nfreq* timestep. +the final *Nfreq* timestep. For the *temp* values, degrees of freedom and +kinetic energy are summed separately across the entire *Nfreq* timescale, and +the output value is calculated by dividing those two sums. If the *norm* setting is *sample*\ , the chunk value is summed over atoms for each sample, as is the count, and an "average sample value" From 11894f83b9b705eb152a0525e7bd5c04834aac7d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 19:50:45 -0400 Subject: [PATCH 082/370] clarify and fix grammar issues --- doc/src/Developer_plugins.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst index 192c57ccbb..7275c12605 100644 --- a/doc/src/Developer_plugins.rst +++ b/doc/src/Developer_plugins.rst @@ -162,17 +162,20 @@ The initialization function **must** be called ``lammpsplugin_init``, it **must** have C bindings and it takes three void pointers as arguments. The first is a pointer to the LAMMPS class that calls it and it needs to be passed to the registration function. The second argument is a -pointer to the internal handle of the DSO file, this needs to added to -the plugin info struct, so that the DSO can be close and unloaded when -all its contained plugins are unloaded. The third argument is a +pointer to the internal handle of the DSO file, this needs to be added +to the plugin info struct, so that the DSO can be closed and unloaded +when all its contained plugins are unloaded. The third argument is a function pointer to the registration function and needs to be stored -in a variable of ``lammpsplugin_regfunc`` type. +in a variable of ``lammpsplugin_regfunc`` type and then called with a +pointer to the ``lammpsplugin_`` struct and the pointer to the LAMMPS +instance as arguments to register a single plugin. There may be multiple +calls to multiple plugins in the same initialization function. To register a plugin a struct of the ``lammpsplugin_t`` needs to be filled with relevant info: current LAMMPS version string, kind of style, name of -style, info string, author string, pointer to factory function, DSO handle. -The the registration function is called with a pointer to the address of -this struct and the pointer of the LAMMPS class. The registration function +style, info string, author string, pointer to factory function, and the +DSO handle. The registration function is called with a pointer to the address +of this struct and the pointer of the LAMMPS class. The registration function will then add the factory function of the plugin style to the respective style map under the provided name. It will also make a copy of the struct in a list of all loaded plugins and update the reference counter for loaded From 125ae33ccfa4aa97212607bab3487fb4193d015e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 22:43:13 -0400 Subject: [PATCH 083/370] convert plugin functionality into a package --- cmake/CMakeLists.txt | 19 +++++-- cmake/presets/most.cmake | 2 +- lib/README | 20 ++++--- lib/plugin/README | 16 ++++++ src/.gitignore | 4 ++ src/MAKE/Makefile.mpi | 2 +- src/MAKE/Makefile.serial | 2 +- src/Makefile | 2 +- src/PLUGIN/Install.sh | 64 ++++++++++++++++++++++ src/PLUGIN/README | 12 ++++ src/{ => PLUGIN}/plugin.cpp | 49 +++++++++++++++++ src/{ => PLUGIN}/plugin.h | 15 ++++- src/input.cpp | 30 ---------- src/library.cpp | 8 +++ unittest/commands/CMakeLists.txt | 2 +- unittest/commands/test_simple_commands.cpp | 2 + 16 files changed, 198 insertions(+), 51 deletions(-) create mode 100644 lib/plugin/README create mode 100755 src/PLUGIN/Install.sh create mode 100644 src/PLUGIN/README rename src/{ => PLUGIN}/plugin.cpp (87%) rename src/{ => PLUGIN}/plugin.h (84%) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7081d6aa80..f05c7f97eb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -113,7 +113,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF) set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS - QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI + PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF @@ -240,11 +240,6 @@ if(BUILD_OMP) target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX) endif() -# link with -ldl or equivalent for plugin loading; except on Windows -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS}) -endif() - # Compiler specific features for testing if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF) @@ -538,6 +533,18 @@ foreach(PKG_WITH_INCL CORESHELL QEQ USER-OMP USER-SDPD KOKKOS OPT USER-INTEL GPU endif() endforeach() +if(PKG_PLUGIN) + if(BUILD_SHARED_LIBS) + target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN) + else() + message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled") + endif() + # link with -ldl or equivalent for plugin loading; except on Windows + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS}) + endif() +endif() + ###################################################################### # the windows version of LAMMPS requires a couple extra libraries # and the MPI library - if use - has to be linked right before those diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index bddefc077b..5dc58b735b 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -4,7 +4,7 @@ set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI - POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI + PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION diff --git a/lib/README b/lib/README index d89490e202..26c3fad9e0 100644 --- a/lib/README +++ b/lib/README @@ -19,12 +19,12 @@ atc atomistic-to-continuum methods, USER-ATC package from Reese Jones, Jeremy Templeton, Jon Zimmerman (Sandia) awpmd antisymmetrized wave packet molecular dynamics, AWPMD package from Ilya Valuev (JIHT RAS) -colvars collective variable module (Metadynamics, ABF and more) +colvars collective variable module (Metadynamics, ABF and more) from Giacomo Fiorin and Jerome Henin (ICMS, Temple U) compress hook to system lib for performing I/O compression, COMPRESS pkg - from Axel Kohlmeyer (Temple U) -gpu general GPU routines, GPU package - from Mike Brown (ORNL) + from Axel Kohlmeyer (Temple U) +gpu general GPU routines, GPU package + from Mike Brown (ORNL) h5md ch5md library for output of MD data in HDF5 format from Pierre de Buyl (KU Leuven) kim hooks to the KIM library, used by KIM package @@ -32,26 +32,28 @@ kim hooks to the KIM library, used by KIM package kokkos Kokkos package for GPU and many-core acceleration from Kokkos development team (Sandia) linalg set of BLAS and LAPACK routines needed by USER-ATC package - from Axel Kohlmeyer (Temple U) + from Axel Kohlmeyer (Temple U) message client/server communication library via MPI, sockets, files - from Steve Plimpton (Sandia) + from Steve Plimpton (Sandia) molfile hooks to VMD molfile plugins, used by the USER-MOLFILE package from Axel Kohlmeyer (Temple U) and the VMD development team mscg hooks to the MSCG library, used by fix_mscg command from Jacob Wagner and Greg Voth group (U Chicago) netcdf hooks to a NetCDF library installed on your system from Lars Pastewka (Karlsruhe Institute of Technology) -poems POEMS rigid-body integration package, POEMS package +plugin settings to load styles into LAMMPS from plugins + from Axel Kohlmeyer (Temple U) +poems POEMS rigid-body integration package, POEMS package from Rudranarayan Mukherjee (RPI) python hooks to the system Python library, used by the PYTHON package from the LAMMPS development team -qmmm quantum mechanics/molecular mechanics coupling interface +qmmm quantum mechanics/molecular mechanics coupling interface from Axel Kohlmeyer (Temple U) quip interface to QUIP/libAtoms framework, USER-QUIP package from Albert Bartok-Partay and Gabor Csanyi (U Cambridge) smd hooks to Eigen library, used by USER-SMD package from Georg Ganzenmueller (Ernst Mach Institute, Germany) voronoi hooks to the Voro++ library, used by compute voronoi/atom command - from Daniel Schwen (LANL) + from Daniel Schwen (LANL) vtk hooks to the VTK library, used by dump custom/vtk command from Richard Berger (JKU) diff --git a/lib/plugin/README b/lib/plugin/README new file mode 100644 index 0000000000..15abea011d --- /dev/null +++ b/lib/plugin/README @@ -0,0 +1,16 @@ +This directory has a Makefile.lammps file with settings that allows +LAMMPS to dynamically link LAMMPS plugins. More details about this +are in the manual. + +In order to be able to dynamically load and execute the plugins from +inside LAMMPS, you need to link with a system library containing functions +like dlopen(), dlsym() and so on for dynamic linking of executable code +into an executable. This library is defined by setting the plugin_SYSLIB +variable in the Makefile.lammps file in this dir. For this mechanism +to work, LAMMPS must be built as a shared library (i.e. with mode=shared). + +For Linux and most current unix-like operating systems, this can be +kept at the default setting of "-ldl" (on some platforms this library +is called "-ldld"). The Windows platform is currently not supported. + +See the header of Makefile.lammps for more info. diff --git a/src/.gitignore b/src/.gitignore index 45ec71e485..6fa3aef513 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -172,6 +172,10 @@ /pair_lj_charmmfsw_coul_long.cpp /pair_lj_charmmfsw_coul_long.h +/plugin.cpp +/plugin.h +/lammpsplugin.h + /atom_vec_spin.cpp /atom_vec_spin.h /compute_spin.cpp diff --git a/src/MAKE/Makefile.mpi b/src/MAKE/Makefile.mpi index 68e79e9e8e..9776b0153e 100644 --- a/src/MAKE/Makefile.mpi +++ b/src/MAKE/Makefile.mpi @@ -13,7 +13,7 @@ DEPFLAGS = -M LINK = mpicxx LINKFLAGS = -g -O3 -LIB = -ldl +LIB = SIZE = size ARCHIVE = ar diff --git a/src/MAKE/Makefile.serial b/src/MAKE/Makefile.serial index 8b4e2e5982..0f5952f317 100644 --- a/src/MAKE/Makefile.serial +++ b/src/MAKE/Makefile.serial @@ -13,7 +13,7 @@ DEPFLAGS = -M LINK = g++ LINKFLAGS = -g -O -LIB = -ldl +LIB = SIZE = size ARCHIVE = ar diff --git a/src/Makefile b/src/Makefile index 679cbe7b97..a63c49e344 100644 --- a/src/Makefile +++ b/src/Makefile @@ -48,7 +48,7 @@ endif PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \ granular kim kokkos kspace latte manybody mc message misc \ - mliap molecule mpiio mscg opt peri poems \ + mliap molecule mpiio mscg opt peri plugin poems \ python qeq replica rigid shock snap spin srd voronoi PACKUSER = user-adios user-atc user-awpmd user-bocs user-cgdna user-cgsdk user-colvars \ diff --git a/src/PLUGIN/Install.sh b/src/PLUGIN/Install.sh new file mode 100755 index 0000000000..0df642193e --- /dev/null +++ b/src/PLUGIN/Install.sh @@ -0,0 +1,64 @@ +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +mode=$1 + +# enforce using portable C locale +LC_ALL=C +export LC_ALL + +# arg1 = file, arg2 = file it depends on + +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} + +# all package files with no dependencies + +for file in *.cpp *.h; do + test -f ${file} && action $file +done + +# edit 2 Makefile.package files to include/exclude package info + +if (test $1 = 1) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*plugin[^ \t]* //' ../Makefile.package + sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(plugin_SYSINC) |' ../Makefile.package + sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(plugin_SYSLIB) |' ../Makefile.package + sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(plugin_SYSPATH) |' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*plugin.*$/d' ../Makefile.package.settings + # multiline form needed for BSD sed on Macs + sed -i -e '4 i \ +include ..\/..\/lib\/plugin\/Makefile.lammps +' ../Makefile.package.settings + fi + +elif (test $1 = 0) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*plugin[^ \t]* //' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*plugin.*$/d' ../Makefile.package.settings + fi + +fi diff --git a/src/PLUGIN/README b/src/PLUGIN/README new file mode 100644 index 0000000000..4515428e35 --- /dev/null +++ b/src/PLUGIN/README @@ -0,0 +1,12 @@ +This package provides a plugin command that can load LAMMPS +styles linked into shared object files into a LAMMPS binary +at run time without having to recompile and relink LAMMPS. +For more details please see the LAMMPS manual. + +To be able to dynamically load and execute the plugins from inside +LAMMPS, you need to link with an appropriate system library, which +is done using the settings in lib/plugin/Makefile.lammps. See +that file and the lib/plugin/README file for more details. + +The person who created this package is Axel Kohlmeyer at Temple U +(akohlmey at gmail.com). Contact him directly if you have questions. diff --git a/src/plugin.cpp b/src/PLUGIN/plugin.cpp similarity index 87% rename from src/plugin.cpp rename to src/PLUGIN/plugin.cpp index e252ce67e1..1449d0d90f 100644 --- a/src/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -38,9 +38,53 @@ namespace LAMMPS_NS // map for counting references to dso handles static std::map dso_refcounter; + +/* ---------------------------------------------------------------------- */ + + Plugin::Plugin(LAMMPS *lmp) : Pointers(lmp) {} + +/* ---------------------------------------------------------------------- */ + + void Plugin::command(int narg, char **arg) + { + if (narg < 1) error->all(FLERR,"Illegal plugin command"); + +#if defined(LMP_PLUGIN) + std::string cmd = arg[0]; + if (cmd == "load") { + if (narg < 2) error->all(FLERR,"Illegal plugin load command"); + for (int i=1; i < narg; ++i) + plugin_load(arg[i],lmp); + + } else if (cmd == "unload") { + if (narg != 3) error->all(FLERR,"Illegal plugin unload command"); + plugin_unload(arg[1],arg[2],lmp); + + } else if (cmd == "clear") { + plugin_clear(lmp); + + } else if (cmd == "list") { + if (comm->me == 0) { + int num = plugin_get_num_plugins(); + utils::logmesg(lmp,"Currently loaded plugins\n"); + for (int i=0; i < num; ++i) { + auto entry = plugin_get_info(i); + utils::logmesg(lmp,fmt::format("{:4}: {} style plugin {}\n", + i+1,entry->style,entry->name)); + } + } + } else error->all(FLERR,"Illegal plugin command"); +#else + if (comm->me == 0) + error->warning(FLERR,"Ignoring plugin command. LAMMPS must be built as " + "a shared library for it to work."); +#endif + } + // load DSO and call included registration function void plugin_load(const char *file, LAMMPS *lmp) { +#if defined(LMP_PLUGIN) int me = lmp->comm->me; #if defined(WIN32) lmp->error->all(FLERR,"Loading of plugins on Windows is not supported\n"); @@ -77,6 +121,7 @@ namespace LAMMPS_NS (*(lammpsplugin_initfunc)(initfunc))((void *)lmp, dso, (void *)&plugin_register); +#endif #endif } @@ -89,6 +134,7 @@ namespace LAMMPS_NS void plugin_register(lammpsplugin_t *plugin, void *ptr) { +#if defined(LMP_PLUGIN) LAMMPS *lmp = (LAMMPS *)ptr; int me = lmp->comm->me; @@ -158,6 +204,7 @@ namespace LAMMPS_NS "yet implemented\n",pstyle)); pluginlist.pop_back(); } +#endif } /* -------------------------------------------------------------------- @@ -168,6 +215,7 @@ namespace LAMMPS_NS void plugin_unload(const char *style, const char *name, LAMMPS *lmp) { +#if defined(LMP_PLUGIN) int me = lmp->comm->me; // ignore unload request from unsupported style categories @@ -246,6 +294,7 @@ namespace LAMMPS_NS dlclose(handle); #endif } +#endif } /* -------------------------------------------------------------------- diff --git a/src/plugin.h b/src/PLUGIN/plugin.h similarity index 84% rename from src/plugin.h rename to src/PLUGIN/plugin.h index 90952224a6..946b08db1a 100644 --- a/src/plugin.h +++ b/src/PLUGIN/plugin.h @@ -11,14 +11,26 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#ifdef COMMAND_CLASS + +CommandStyle(plugin,Plugin) + +#else + #ifndef LMP_PLUGIN_H #define LMP_PLUGIN_H #include "lammpsplugin.h" +#include "pointers.h" namespace LAMMPS_NS { - class LAMMPS; + + class Plugin : protected Pointers { + public: + Plugin(class LAMMPS *); + void command(int, char **); + }; void plugin_load(const char *, LAMMPS *); void plugin_register(lammpsplugin_t *, void *); @@ -33,3 +45,4 @@ namespace LAMMPS_NS } #endif +#endif diff --git a/src/input.cpp b/src/input.cpp index 9979bb7705..eeb211a6d1 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -35,7 +35,6 @@ #include "neighbor.h" #include "output.h" #include "pair.h" -#include "plugin.h" #include "special.h" #include "style_command.h" #include "thermo.h" @@ -718,7 +717,6 @@ int Input::execute_command() else if (!strcmp(command,"log")) log(); else if (!strcmp(command,"next")) next_command(); else if (!strcmp(command,"partition")) partition(); - else if (!strcmp(command,"plugin")) plugin(); else if (!strcmp(command,"print")) print(); else if (!strcmp(command,"python")) python(); else if (!strcmp(command,"quit")) quit(); @@ -1097,34 +1095,6 @@ void Input::partition() /* ---------------------------------------------------------------------- */ -void Input::plugin() -{ - if (narg < 1) error->all(FLERR,"Illegal plugin command"); - std::string cmd = arg[0]; - if (cmd == "load") { - if (narg < 2) error->all(FLERR,"Illegal plugin load command"); - for (int i=1; i < narg; ++i) - plugin_load(arg[i],lmp); - } else if (cmd == "unload") { - if (narg != 3) error->all(FLERR,"Illegal plugin unload command"); - plugin_unload(arg[1],arg[2],lmp); - } else if (cmd == "clear") { - plugin_clear(lmp); - } else if (cmd == "list") { - if (comm->me == 0) { - int num = plugin_get_num_plugins(); - utils::logmesg(lmp,"Currently loaded plugins\n"); - for (int i=0; i < num; ++i) { - auto entry = plugin_get_info(i); - utils::logmesg(lmp,fmt::format("{:4}: {} style plugin {}\n", - i+1,entry->style,entry->name)); - } - } - } else error->all(FLERR,"Illegal plugin command"); -} - -/* ---------------------------------------------------------------------- */ - void Input::print() { if (narg < 1) error->all(FLERR,"Illegal print command"); diff --git a/src/library.cpp b/src/library.cpp index 68ce180107..414d0f9f3a 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -38,7 +38,9 @@ #include "neighbor.h" #include "region.h" #include "output.h" +#if defined(LMP_PLUGIN) #include "plugin.h" +#endif #include "thermo.h" #include "timer.h" #include "universe.h" @@ -4590,7 +4592,11 @@ This function counts how many plugins are currently loaded. */ int lammps_plugin_count() { +#if defined(LMP_PLUGIN) return plugin_get_num_plugins(); +#else + return 0; +#endif } /* ---------------------------------------------------------------------- */ @@ -4617,6 +4623,7 @@ set to an empty string, otherwise 1. */ int lammps_plugin_name(int idx, char *stylebuf, char *namebuf, int buf_size) { +#if defined(LMP_PLUGIN) stylebuf[0] = namebuf[0] = '\0'; const lammpsplugin_t *plugin = plugin_get_info(idx); @@ -4625,6 +4632,7 @@ int lammps_plugin_name(int idx, char *stylebuf, char *namebuf, int buf_size) strncpy(namebuf,plugin->name,buf_size); return 1; } +#endif return 0; } diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index 50f85475d3..6fae0c2463 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -1,6 +1,6 @@ # build LAMMPS plugins, but not on Windows -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND PKG_PLUGIN) ExternalProject_Add(plugins SOURCE_DIR "${LAMMPS_DIR}/examples/plugins" BINARY_DIR ${CMAKE_BINARY_DIR}/build-plugins diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 448224f730..d98146d4f3 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -367,6 +367,7 @@ TEST_F(SimpleCommandsTest, Units) TEST_FAILURE(".*ERROR: Illegal units command.*", lmp->input->one("units unknown");); } +#if defined(LMP_PLUGIN) TEST_F(SimpleCommandsTest, Plugin) { #if defined(__APPLE__) @@ -437,6 +438,7 @@ TEST_F(SimpleCommandsTest, Plugin) if (verbose) std::cout << text; ASSERT_THAT(text, MatchesRegex(".*Currently loaded plugins.*")); } +#endif TEST_F(SimpleCommandsTest, Shell) { From 28e986c266580f87d1f100f22e309ea7f2d60c1e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 23:25:46 -0400 Subject: [PATCH 084/370] add python module support for plugins --- python/lammps/core.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/python/lammps/core.py b/python/lammps/core.py index eaf78dfa0c..e75647fe44 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -264,6 +264,9 @@ class lammps(object): self.lib.lammps_id_name.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_int] + self.lib.lammps_plugin_count.argtypes = [ ] + self.lib.lammps_plugin_name.argtypes = [c_int, c_char_p, c_char_p, c_int] + self.lib.lammps_version.argtypes = [c_void_p] self.lib.lammps_get_os_info.argtypes = [c_char_p, c_int] @@ -1594,6 +1597,29 @@ class lammps(object): # ------------------------------------------------------------------------- + def available_plugins(self, category): + """Returns a list of plugins available for a given category + + This is a wrapper around the functions :cpp:func:`lammps_plugin_count()` + and :cpp:func:`lammps_plugin_name()` of the library interface. + + .. versionadded:: 10Mar2021 + + :return: list of style/name pairs of loaded plugins + :rtype: list + """ + + available_plugins = [] + num = self.lib.lammps_plugin_count(self.lmp) + sty = create_string_buffer(100) + nam = create_string_buffer(100) + for idx in range(num): + self.lib.lammps_plugin_name(idx, sty, nam, 100) + available_plugins.append([sty.value.decode(), nam.value.decode()]) + return available_plugins + + # ------------------------------------------------------------------------- + def set_fix_external_callback(self, fix_name, callback, caller=None): import numpy as np From 78126c5eb3f9f9cd961901301f435c0fdef7fed7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 23:32:08 -0400 Subject: [PATCH 085/370] fix cmake unit test issue --- unittest/commands/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index 6fae0c2463..a658c8a25d 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -23,7 +23,9 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND PKG_PLUGIN) endif() add_executable(test_simple_commands test_simple_commands.cpp) -add_dependencies(test_simple_commands plugins) +if(PKG_PLUGIN) + add_dependencies(test_simple_commands plugins) +endif() target_link_libraries(test_simple_commands PRIVATE lammps GTest::GMock GTest::GTest) add_test(NAME SimpleCommands COMMAND test_simple_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) From 2a6fcee5e00b70dafa49b5992507a1eaa721f797 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 23:42:06 -0400 Subject: [PATCH 086/370] add missing file (was ignored by default) --- lib/plugin/Makefile.lammps | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/plugin/Makefile.lammps diff --git a/lib/plugin/Makefile.lammps b/lib/plugin/Makefile.lammps new file mode 100644 index 0000000000..87f4f8a771 --- /dev/null +++ b/lib/plugin/Makefile.lammps @@ -0,0 +1,16 @@ +# This file contains the hooks to build and link LAMMPS so it can load plugins +# +# The plugin_SYSINC and plugin_SYSPATH variables do not typically need +# to be set. If the dl library is not in a place the linker can find +# it, specify its directory via the plugin_SYSPATH variable, e.g. +# -Ldir. + +# ----------------------------------------------------------- + +# Settings that the LAMMPS build will import when this package is installed + +ifeq ($(mode),shared) +plugin_SYSINC = -DLMP_PLUGIN +endif +plugin_SYSLIB = -ldl +plugin_SYSPATH = From ddc77be911e2f61967a1db4685be1c405015d32e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 23:52:44 -0400 Subject: [PATCH 087/370] update docs for converting the plugin feature to a package --- doc/src/Packages_details.rst | 23 +++++++++++++++++++++++ doc/src/plugin.rst | 5 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index e858593c4c..301e6bfd4a 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -50,6 +50,7 @@ page gives those details. * :ref:`MSCG ` * :ref:`OPT ` * :ref:`PERI ` + * :ref:`PLUGIN ` * :ref:`POEMS ` * :ref:`PYTHON ` * :ref:`QEQ ` @@ -843,6 +844,28 @@ Foster (UTSA). ---------- +.. _PKG-PLUGIN: + +PLUGIN package +-------------- + +**Contents:** + +A :doc:`plugin ` command that can load and unload several +kind of styles in LAMMPS from shared object files at runtime without +having to recompile and relink LAMMPS. + +**Authors:** Axel Kohlmeyer (Temple U) + +**Supporting info:** + +* src/PLUGIN: filenames -> commands +* :doc:`plugin command ` +* :doc:`Information on writing plugins ` +* examples/plugin + +---------- + .. _PKG-POEMS: POEMS package diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index e8a5f67e3c..48638bf97a 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -60,7 +60,10 @@ The *clear* command will unload all currently loaded plugins. Restrictions """""""""""" -Plugins are not available on Windows. +The *plugin* command is part of the PLUGIN package. It is +only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` doc page for +more info. Plugins are not available on Windows. For the loading of plugins to work the LAMMPS library must be :ref:`compiled as a shared library `. If plugins From 9b29b1594bd35f32a1d728e6c8d32a355c324665 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 14:40:41 -0400 Subject: [PATCH 088/370] add support for bond/angle/dihedral/improper plugins --- examples/plugins/CMakeLists.txt | 8 +- examples/plugins/Makefile | 28 +--- examples/plugins/Makefile.common | 36 ++++ examples/plugins/Makefile.macos | 30 +--- examples/plugins/Makefile.serial | 28 +--- examples/plugins/angle_zero2.cpp | 152 +++++++++++++++++ examples/plugins/angle_zero2.h | 57 +++++++ examples/plugins/bond_zero2.cpp | 161 ++++++++++++++++++ examples/plugins/bond_zero2.h | 58 +++++++ examples/plugins/dihedral_zero2.cpp | 121 ++++++++++++++ examples/plugins/dihedral_zero2.h | 57 +++++++ examples/plugins/improper_zero2.cpp | 122 ++++++++++++++ examples/plugins/improper_zero2.h | 53 ++++++ examples/plugins/pair_zero2.cpp | 247 ++++++++++++++++++++++++++++ examples/plugins/pair_zero2.h | 77 +++++++++ examples/plugins/zero2plugin.cpp | 78 +++++++++ src/PLUGIN/plugin.cpp | 94 ++++++++++- 17 files changed, 1323 insertions(+), 84 deletions(-) create mode 100644 examples/plugins/Makefile.common create mode 100644 examples/plugins/angle_zero2.cpp create mode 100644 examples/plugins/angle_zero2.h create mode 100644 examples/plugins/bond_zero2.cpp create mode 100644 examples/plugins/bond_zero2.h create mode 100644 examples/plugins/dihedral_zero2.cpp create mode 100644 examples/plugins/dihedral_zero2.h create mode 100644 examples/plugins/improper_zero2.cpp create mode 100644 examples/plugins/improper_zero2.h create mode 100644 examples/plugins/pair_zero2.cpp create mode 100644 examples/plugins/pair_zero2.h create mode 100644 examples/plugins/zero2plugin.cpp diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 74a1cd4e3b..6e29676530 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -53,12 +53,16 @@ target_link_libraries(nve2plugin PRIVATE lammps) add_library(helloplugin MODULE helloplugin.cpp) target_link_libraries(helloplugin PRIVATE lammps) -set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES +add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp + angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp) +target_link_libraries(zero2plugin PRIVATE lammps) + +set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES PREFIX "" LINK_FLAGS "-rdynamic") # MacOS seems to need this if(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set_target_properties(morse2plugin nve2plugin helloplugin PROPERTIES + set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") endif() diff --git a/examples/plugins/Makefile b/examples/plugins/Makefile index dbb0023991..f4d8b41086 100644 --- a/examples/plugins/Makefile +++ b/examples/plugins/Makefile @@ -1,30 +1,6 @@ CXX=mpicxx CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp LD=$(CXX) -shared -rdynamic -fopenmp +DSOEXT=.so -default: morse2plugin.so nve2plugin.so helloplugin.so - -helloplugin.so: helloplugin.o - $(LD) -o $@ $^ - -morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o - $(LD) -o $@ $^ - -nve2plugin.so: nve2plugin.o fix_nve2.o - $(LD) -o $@ $^ - -.cpp.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - -helloplugin.o: helloplugin.cpp - -pair_morse2.o: pair_morse2.cpp pair_morse2.h -pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h -morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h - -fix_nve2.o: fix_nve2.cpp fix_nve2.h -nve2plugin.o: nve2plugin.cpp fix_nve2.h - -clean: - rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles - +include Makefile.common diff --git a/examples/plugins/Makefile.common b/examples/plugins/Makefile.common new file mode 100644 index 0000000000..e78fa13feb --- /dev/null +++ b/examples/plugins/Makefile.common @@ -0,0 +1,36 @@ +default: morse2plugin$(DSOEXT) nve2plugin$(DSOEXT) helloplugin$(DSOEXT) zero2plugin$(DSOEXT) + +helloplugin$(DSOEXT): helloplugin.o + $(LD) -o $@ $^ + +morse2plugin$(DSOEXT): morse2plugin.o pair_morse2.o pair_morse2_omp.o + $(LD) -o $@ $^ + +nve2plugin$(DSOEXT): nve2plugin.o fix_nve2.o + $(LD) -o $@ $^ + +zero2plugin$(DSOEXT): zero2plugin.o pair_zero2.o bond_zero2.o angle_zero2.o dihedral_zero2.o improper_zero2.o + $(LD) -o $@ $^ + +.cpp.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + +helloplugin.o: helloplugin.cpp + +pair_morse2.o: pair_morse2.cpp pair_morse2.h +pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h +morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h + +fix_nve2.o: fix_nve2.cpp fix_nve2.h +nve2plugin.o: nve2plugin.cpp fix_nve2.h + +pair_zero2.o: pair_zero2.cpp pair_zero2.h +bond_zero2.o: bond_zero2.cpp bond_zero2.h +angle_zero2.o: angle_zero2.cpp angle_zero2.h +dihedral_zero2.o: dihedral_zero2.cpp dihedral_zero2.h +improper_zero2.o: improper_zero2.cpp improper_zero2.h +zero2plugin.o: zero2plugin.cpp pair_zero2.h bond_zero2.h angle_zero2.h dihedral_zero2.h + +clean: + rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles + diff --git a/examples/plugins/Makefile.macos b/examples/plugins/Makefile.macos index 2490418a09..a7c20ff90f 100644 --- a/examples/plugins/Makefile.macos +++ b/examples/plugins/Makefile.macos @@ -1,30 +1,6 @@ CXX=mpicxx -CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP +CXXFLAGS=-I../../src -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP LD=$(CXX) -bundle -rdynamic -Wl,-undefined,dynamic_lookup +DSOEXT=.dylib -default: morse2plugin.dylib nve2plugin.dylib helloplugin.dylib - -helloplugin.dylib: helloplugin.o - $(LD) -o $@ $^ - -morse2plugin.dylib: morse2plugin.o pair_morse2.o pair_morse2_omp.o - $(LD) -o $@ $^ - -nve2plugin.dylib: nve2plugin.o fix_nve2.o - $(LD) -o $@ $^ - -.cpp.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - -helloplugin.o: helloplugin.cpp - -pair_morse2.o: pair_morse2.cpp pair_morse2.h -pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h -morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h - -fix_nve2.o: fix_nve2.cpp fix_nve2.h -nve2plugin.o: nve2plugin.cpp fix_nve2.h - -clean: - rm -rf *~ *.dylib *.dylib *.o log.lammps CMakeCache.txt CMakeFiles - +include Makefile.common diff --git a/examples/plugins/Makefile.serial b/examples/plugins/Makefile.serial index feb58bd9b3..ecc7631a05 100644 --- a/examples/plugins/Makefile.serial +++ b/examples/plugins/Makefile.serial @@ -1,30 +1,6 @@ CXX=g++ CXXFLAGS=-I../../src -I../../src/STUBS -Wall -Wextra -O3 -fPIC -I../../src/USER-OMP -fopenmp LD=$(CXX) -shared -rdynamic -fopenmp +DSOEXT=.so -default: morse2plugin.so nve2plugin.so helloplugin.so - -helloplugin.so: helloplugin.o - $(LD) -o $@ $^ - -morse2plugin.so: morse2plugin.o pair_morse2.o pair_morse2_omp.o - $(LD) -o $@ $^ - -nve2plugin.so: nve2plugin.o fix_nve2.o - $(LD) -o $@ $^ - -.cpp.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - -helloplugin.o: helloplugin.cpp - -pair_morse2.o: pair_morse2.cpp pair_morse2.h -pair_morse2_omp.o: pair_morse2_omp.cpp pair_morse2_omp.h pair_morse2.h -morse2plugin.o: morse2plugin.cpp pair_morse2.h pair_morse2_omp.h - -fix_nve2.o: fix_nve2.cpp fix_nve2.h -nve2plugin.o: nve2plugin.cpp fix_nve2.h - -clean: - rm -rf *~ *.so *.dylib *.o log.lammps CMakeCache.txt CMakeFiles - +include Makefile.common diff --git a/examples/plugins/angle_zero2.cpp b/examples/plugins/angle_zero2.cpp new file mode 100644 index 0000000000..c0d01f14a5 --- /dev/null +++ b/examples/plugins/angle_zero2.cpp @@ -0,0 +1,152 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Carsten Svaneborg (SDU) +------------------------------------------------------------------------- */ + +#include "angle_zero2.h" + +#include "atom.h" +#include "comm.h" +#include "math_const.h" +#include "memory.h" +#include "error.h" + +#include + +using namespace LAMMPS_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- */ + +AngleZero2::AngleZero2(LAMMPS *lmp) : Angle(lmp), coeffflag(1) {} + +/* ---------------------------------------------------------------------- */ + +AngleZero2::~AngleZero2() +{ + if (allocated && !copymode) { + memory->destroy(setflag); + memory->destroy(theta0); + } +} + +/* ---------------------------------------------------------------------- */ + +void AngleZero2::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); +} + +/* ---------------------------------------------------------------------- */ + +void AngleZero2::settings(int narg, char **arg) +{ + if ((narg != 0) && (narg != 1)) + error->all(FLERR,"Illegal angle_style command"); + + if (narg == 1) { + if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0; + else error->all(FLERR,"Illegal angle_style command"); + } +} + +/* ---------------------------------------------------------------------- */ + +void AngleZero2::allocate() +{ + allocated = 1; + int n = atom->nangletypes; + + memory->create(theta0,n+1,"angle:theta0"); + memory->create(setflag,n+1,"angle:setflag"); + for (int i = 1; i <= n; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void AngleZero2::coeff(int narg, char **arg) +{ + if ((narg < 1) || (coeffflag && narg > 2)) + error->all(FLERR,"Incorrect args for angle coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi; + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); + + double theta0_one = 0.0; + if (coeffflag && (narg == 2)) + theta0_one = utils::numeric(FLERR,arg[1],false,lmp); + + // convert theta0 from degrees to radians + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + setflag[i] = 1; + theta0[i] = theta0_one/180.0 * MY_PI; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for angle coefficients"); +} + +/* ---------------------------------------------------------------------- */ + +double AngleZero2::equilibrium_angle(int i) +{ + return theta0[i]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void AngleZero2::write_restart(FILE *fp) { + fwrite(&theta0[1],sizeof(double),atom->nangletypes,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void AngleZero2::read_restart(FILE *fp) +{ + allocate(); + + if (comm->me == 0) { + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + } + MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); + + for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1; +} +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void AngleZero2::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->nangletypes; i++) + fprintf(fp,"%d %g\n",i,theta0[i]/MY_PI*180.0); +} + +/* ---------------------------------------------------------------------- */ + +double AngleZero2::single(int /*type*/, int /*i1*/, int /*i2*/, int /*i3*/) +{ + return 0.0; +} diff --git a/examples/plugins/angle_zero2.h b/examples/plugins/angle_zero2.h new file mode 100644 index 0000000000..15a16b197f --- /dev/null +++ b/examples/plugins/angle_zero2.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_ANGLE_ZERO2_H +#define LMP_ANGLE_ZERO2_H + +#include "angle.h" + +namespace LAMMPS_NS { + +class AngleZero2 : public Angle { + public: + AngleZero2(class LAMMPS *); + virtual ~AngleZero2(); + virtual void compute(int, int); + virtual void coeff(int, char **); + virtual void settings(int, char **); + + double equilibrium_angle(int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_data(FILE *); + + double single(int, int, int, int); + + protected: + double *theta0; + int coeffflag; + + void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +UNDOCUMENTED + +E: Incorrect args for angle coefficients + +Self-explanatory. Check the input script or data file. + +*/ diff --git a/examples/plugins/bond_zero2.cpp b/examples/plugins/bond_zero2.cpp new file mode 100644 index 0000000000..b015a60ed3 --- /dev/null +++ b/examples/plugins/bond_zero2.cpp @@ -0,0 +1,161 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Carsten Svaneborg (SDU) +------------------------------------------------------------------------- */ + +#include "bond_zero2.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +BondZero2::BondZero2(LAMMPS *lmp) : Bond(lmp), coeffflag(1) {} + +/* ---------------------------------------------------------------------- */ + +BondZero2::~BondZero2() +{ + if (allocated && !copymode) { + memory->destroy(setflag); + memory->destroy(r0); + } +} + +/* ---------------------------------------------------------------------- */ + +void BondZero2::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); +} + +/* ---------------------------------------------------------------------- */ + +void BondZero2::settings(int narg, char **arg) +{ + if ((narg != 0) && (narg != 1)) + error->all(FLERR,"Illegal bond_style command"); + + if (narg == 1) { + if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0; + else error->all(FLERR,"Illegal bond_style command"); + } +} + +/* ---------------------------------------------------------------------- */ + +void BondZero2::allocate() +{ + allocated = 1; + int n = atom->nbondtypes; + + memory->create(r0,n+1,"bond:r0"); + memory->create(setflag,n+1,"bond:setflag"); + for (int i = 1; i <= n; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void BondZero2::coeff(int narg, char **arg) +{ + if ((narg < 1) || (coeffflag && narg > 2)) + error->all(FLERR,"Incorrect args for bond coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi; + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); + + double r0_one = 0.0; + if (coeffflag && (narg == 2)) + r0_one = utils::numeric(FLERR,arg[1],false,lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + setflag[i] = 1; + r0[i] = r0_one; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for bond coefficients"); +} + +/* ---------------------------------------------------------------------- + return an equilbrium bond length +------------------------------------------------------------------------- */ + +double BondZero2::equilibrium_distance(int i) +{ + return r0[i]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void BondZero2::write_restart(FILE *fp) { + fwrite(&r0[1],sizeof(double),atom->nbondtypes,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void BondZero2::read_restart(FILE *fp) +{ + allocate(); + + if (comm->me == 0) { + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + } + MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); + + for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void BondZero2::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->nbondtypes; i++) + fprintf(fp,"%d %g\n",i,r0[i]); +} + +/* ---------------------------------------------------------------------- */ + +double BondZero2::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/, + double & /*fforce*/) +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- */ + +void *BondZero2::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str,"r0")==0) return (void*) r0; + return nullptr; +} diff --git a/examples/plugins/bond_zero2.h b/examples/plugins/bond_zero2.h new file mode 100644 index 0000000000..37609561a7 --- /dev/null +++ b/examples/plugins/bond_zero2.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_BOND_ZERO2_H +#define LMP_BOND_ZERO2_H + +#include "bond.h" + +namespace LAMMPS_NS { + +class BondZero2 : public Bond { + public: + BondZero2(class LAMMPS *); + virtual ~BondZero2(); + virtual void compute(int, int); + virtual void settings(int, char **); + + void coeff(int, char **); + double equilibrium_distance(int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_data(FILE *); + + double single(int, double, int, int, double &); + virtual void *extract(const char *, int &); + + protected: + double *r0; + int coeffflag; + + virtual void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +UNDOCUMENTED + +E: Incorrect args for bond coefficients + +Self-explanatory. Check the input script or data file. + +*/ diff --git a/examples/plugins/dihedral_zero2.cpp b/examples/plugins/dihedral_zero2.cpp new file mode 100644 index 0000000000..00d9817c96 --- /dev/null +++ b/examples/plugins/dihedral_zero2.cpp @@ -0,0 +1,121 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Carsten Svaneborg (SDU) +------------------------------------------------------------------------- */ + +#include "dihedral_zero2.h" + +#include "atom.h" +#include "error.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +DihedralZero2::DihedralZero2(LAMMPS *lmp) : Dihedral(lmp), coeffflag(1) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +DihedralZero2::~DihedralZero2() +{ + if (allocated && !copymode) { + memory->destroy(setflag); + } +} + +/* ---------------------------------------------------------------------- */ + +void DihedralZero2::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); +} + +/* ---------------------------------------------------------------------- */ + +void DihedralZero2::settings(int narg, char **arg) +{ + if ((narg != 0) && (narg != 1)) + error->all(FLERR,"Illegal dihedral_style command"); + + if (narg == 1) { + if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0; + else error->all(FLERR,"Illegal dihedral_style command"); + } +} + +/* ---------------------------------------------------------------------- */ + +void DihedralZero2::allocate() +{ + allocated = 1; + int n = atom->ndihedraltypes; + + memory->create(setflag,n+1,"dihedral:setflag"); + for (int i = 1; i <= n; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void DihedralZero2::coeff(int narg, char **arg) +{ + if ((narg < 1) || (coeffflag && narg > 1)) + error->all(FLERR,"Incorrect args for dihedral coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi; + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + setflag[i] = 1; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients"); +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void DihedralZero2::write_restart(FILE * /*fp*/) {} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void DihedralZero2::read_restart(FILE * /*fp*/) +{ + allocate(); + for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void DihedralZero2::write_data(FILE *fp) { + for (int i = 1; i <= atom->ndihedraltypes; i++) + fprintf(fp,"%d\n",i); +} diff --git a/examples/plugins/dihedral_zero2.h b/examples/plugins/dihedral_zero2.h new file mode 100644 index 0000000000..510e384340 --- /dev/null +++ b/examples/plugins/dihedral_zero2.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. + + Identical to dihedral harmonic, except if all k's are zero the + force loop is skipped. + +------------------------------------------------------------------------- */ + +#ifndef LMP_DIHEDRAL_ZERO2_H +#define LMP_DIHEDRAL_ZERO2_H + +#include "dihedral.h" + +namespace LAMMPS_NS { + +class DihedralZero2 : public Dihedral { + public: + DihedralZero2(class LAMMPS *); + virtual ~DihedralZero2(); + virtual void compute(int, int); + virtual void coeff(int, char **); + virtual void settings(int, char **); + + void write_restart(FILE *); + void read_restart(FILE *); + void write_data(FILE *); + + protected: + int coeffflag; + + virtual void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +UNDOCUMENTED + +E: Incorrect args for dihedral coefficients + +UNDOCUMENTED + +*/ diff --git a/examples/plugins/improper_zero2.cpp b/examples/plugins/improper_zero2.cpp new file mode 100644 index 0000000000..2370b32a02 --- /dev/null +++ b/examples/plugins/improper_zero2.cpp @@ -0,0 +1,122 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Carsten Svaneborg (SDU) +------------------------------------------------------------------------- */ + +#include "improper_zero2.h" + +#include "atom.h" +#include "error.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ImproperZero2::ImproperZero2(LAMMPS *lmp) : Improper(lmp), coeffflag(1) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +ImproperZero2::~ImproperZero2() +{ + if (allocated && !copymode) { + memory->destroy(setflag); + } +} + +/* ---------------------------------------------------------------------- */ + +void ImproperZero2::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); +} + +/* ---------------------------------------------------------------------- */ + +void ImproperZero2::settings(int narg, char **arg) +{ + if ((narg != 0) && (narg != 1)) + error->all(FLERR,"Illegal improper_style command"); + + if (narg == 1) { + if (strcmp("nocoeff",arg[0]) == 0) coeffflag=0; + else error->all(FLERR,"Illegal improper_style command"); + } +} + +/* ---------------------------------------------------------------------- */ + +void ImproperZero2::allocate() +{ + allocated = 1; + int n = atom->nimpropertypes; + + memory->create(setflag,n+1,"improper:setflag"); + for (int i = 1; i <= n; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void ImproperZero2::coeff(int narg, char **arg) +{ + if ((narg < 1) || (coeffflag && narg > 1)) + error->all(FLERR,"Incorrect args for improper coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi; + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + setflag[i] = 1; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for improper coefficients"); +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void ImproperZero2::write_restart(FILE * /*fp*/) {} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void ImproperZero2::read_restart(FILE * /*fp*/) +{ + allocate(); + for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void ImproperZero2::write_data(FILE *fp) { + for (int i = 1; i <= atom->nimpropertypes; i++) + fprintf(fp,"%d\n",i); +} + diff --git a/examples/plugins/improper_zero2.h b/examples/plugins/improper_zero2.h new file mode 100644 index 0000000000..64dd94920a --- /dev/null +++ b/examples/plugins/improper_zero2.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_IMPROPER_ZERO2_H +#define LMP_IMPROPER_ZERO2_H + +#include "improper.h" + +namespace LAMMPS_NS { + +class ImproperZero2 : public Improper { + public: + ImproperZero2(class LAMMPS *); + virtual ~ImproperZero2(); + virtual void compute(int, int); + virtual void coeff(int, char **); + virtual void settings(int, char **); + + void write_restart(FILE *); + void read_restart(FILE *); + void write_data(FILE *); + + protected: + int coeffflag; + + virtual void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +UNDOCUMENTED + +E: Incorrect args for improper coefficients + +Self-explanatory. Check the input script or data file. + +*/ diff --git a/examples/plugins/pair_zero2.cpp b/examples/plugins/pair_zero2.cpp new file mode 100644 index 0000000000..d8e23c902d --- /dev/null +++ b/examples/plugins/pair_zero2.cpp @@ -0,0 +1,247 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Carsten Svaneborg (SDU) +------------------------------------------------------------------------- */ + +#include "pair_zero2.h" + +#include "atom.h" +#include "comm.h" +#include "memory.h" +#include "error.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairZero2::PairZero2(LAMMPS *lmp) : Pair(lmp) { + coeffflag=1; + writedata=1; + single_enable=1; + respa_enable=1; +} + +/* ---------------------------------------------------------------------- */ + +PairZero2::~PairZero2() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cut); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairZero2::compute(int eflag, int vflag) +{ + ev_init(eflag,vflag); + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- */ + +void PairZero2::compute_outer(int eflag, int vflag) +{ + ev_init(eflag,vflag); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairZero2::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(cut,n+1,n+1,"pair:cut"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairZero2::settings(int narg, char **arg) +{ + if ((narg != 1) && (narg != 2)) + error->all(FLERR,"Illegal pair_style command"); + + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) { + if (strcmp("nocoeff",arg[1]) == 0) coeffflag=0; + else error->all(FLERR,"Illegal pair_style command"); + } + + // reset cutoffs that have been explicitly set + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i+1; j <= atom->ntypes; j++) + cut[i][j] = cut_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairZero2::coeff(int narg, char **arg) +{ + if ((narg < 2) || (coeffflag && narg > 3)) + error->all(FLERR,"Incorrect args for pair coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + + double cut_one = cut_global; + if (coeffflag && (narg == 3)) cut_one = utils::numeric(FLERR,arg[2],false,lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + cut[i][j] = cut_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairZero2::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + cut[i][j] = mix_distance(cut[i][i],cut[j][j]); + } + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZero2::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&cut[i][j],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZero2::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + } + MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZero2::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&coeffflag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZero2::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&coeffflag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairZero2::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d\n",i); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairZero2::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g\n",i,j,cut[i][j]); +} + +/* ---------------------------------------------------------------------- */ + +double PairZero2::single(int /*i*/, int /*j*/, int /* itype */, int /* jtype */, + double /* rsq */, double /*factor_coul*/, + double /* factor_lj */, double &fforce) +{ + fforce = 0.0; + return 0.0; +} + diff --git a/examples/plugins/pair_zero2.h b/examples/plugins/pair_zero2.h new file mode 100644 index 0000000000..39aa160913 --- /dev/null +++ b/examples/plugins/pair_zero2.h @@ -0,0 +1,77 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. + + Pair zero is a dummy pair interaction useful for requiring a + force cutoff distance in the absence of pair-interactions or + with hybrid/overlay if a larger force cutoff distance is required. + + This can be used in conjunction with bond/create to create bonds + that are longer than the cutoff of a given force field, or to + calculate radial distribution functions for models without + pair interactions. + +------------------------------------------------------------------------- */ + +#ifndef LMP_PAIR_ZERO2_H +#define LMP_PAIR_ZERO2_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairZero2 : public Pair { + public: + PairZero2(class LAMMPS *); + virtual ~PairZero2(); + virtual void compute(int, int); + virtual void compute_outer(int, int); + void settings(int, char **); + void coeff(int, char **); + double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void write_data(FILE *); + void write_data_all(FILE *); + double single(int, int, int, int, double, double, double, double &); + + protected: + double cut_global; + double **cut; + int coeffflag; + + virtual void allocate(); +}; + +} + +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +U: Pair cutoff < Respa interior cutoff + +One or more pairwise cutoffs are too short to use with the specified +rRESPA cutoffs. + +*/ diff --git a/examples/plugins/zero2plugin.cpp b/examples/plugins/zero2plugin.cpp new file mode 100644 index 0000000000..f181eae781 --- /dev/null +++ b/examples/plugins/zero2plugin.cpp @@ -0,0 +1,78 @@ + +#include "lammpsplugin.h" +#include "version.h" + +#include + +#include "pair_zero2.h" +#include "bond_zero2.h" +#include "angle_zero2.h" +#include "dihedral_zero2.h" +#include "improper_zero2.h" + +using namespace LAMMPS_NS; + +static Pair *pairzerocreator(LAMMPS *lmp) +{ + return new PairZero2(lmp); +} + +static Bond *bondzerocreator(LAMMPS *lmp) +{ + return new BondZero2(lmp); +} + +static Angle *anglezerocreator(LAMMPS *lmp) +{ + return new AngleZero2(lmp); +} + +static Dihedral *dihedralzerocreator(LAMMPS *lmp) +{ + return new DihedralZero2(lmp); +} + +static Improper *improperzerocreator(LAMMPS *lmp) +{ + return new ImproperZero2(lmp); +} + +extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) +{ + lammpsplugin_t plugin; + lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; + + // register zero2 pair style + plugin.version = LAMMPS_VERSION; + plugin.style = "pair"; + plugin.name = "zero2"; + plugin.info = "Zero2 variant pair style v1.0"; + plugin.author = "Axel Kohlmeyer (akohlmey@gmail.com)"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &pairzerocreator; + plugin.handle = handle; + (*register_plugin)(&plugin,lmp); + + // register zero2 bond style + plugin.style = "bond"; + plugin.info = "Zero2 variant bond style v1.0"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &bondzerocreator; + (*register_plugin)(&plugin,lmp); + + // register zero2 angle style + plugin.style = "angle"; + plugin.info = "Zero2 variant angle style v1.0"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &anglezerocreator; + (*register_plugin)(&plugin,lmp); + + // register zero2 dihedral style + plugin.style = "dihedral"; + plugin.info = "Zero2 variant dihedral style v1.0"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &dihedralzerocreator; + (*register_plugin)(&plugin,lmp); + + // register zero2 improper style + plugin.style = "improper"; + plugin.info = "Zero2 variant improper style v1.0"; + plugin.creator.v1 = (lammpsplugin_factory1 *) &improperzerocreator; + (*register_plugin)(&plugin,lmp); +} diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 1449d0d90f..91d22b2897 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -19,7 +19,6 @@ #include "force.h" #include "lammps.h" #include "modify.h" -#include "pair.h" #include #include @@ -179,6 +178,46 @@ namespace LAMMPS_NS } (*pair_map)[plugin->name] = (Force::PairCreator)plugin->creator.v1; + } else if (pstyle == "bond") { + auto bond_map = lmp->force->bond_map; + if (bond_map->find(plugin->name) != bond_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in bond " + "style {} from plugin", + plugin->name)); + } + (*bond_map)[plugin->name] = (Force::BondCreator)plugin->creator.v1; + + } else if (pstyle == "angle") { + auto angle_map = lmp->force->angle_map; + if (angle_map->find(plugin->name) != angle_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in angle " + "style {} from plugin", + plugin->name)); + } + (*angle_map)[plugin->name] = (Force::AngleCreator)plugin->creator.v1; + + } else if (pstyle == "dihedral") { + auto dihedral_map = lmp->force->dihedral_map; + if (dihedral_map->find(plugin->name) != dihedral_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in dihedral " + "style {} from plugin", + plugin->name)); + } + (*dihedral_map)[plugin->name] = (Force::DihedralCreator)plugin->creator.v1; + + } else if (pstyle == "improper") { + auto improper_map = lmp->force->improper_map; + if (improper_map->find(plugin->name) != improper_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in improper " + "style {} from plugin", + plugin->name)); + } + (*improper_map)[plugin->name] = (Force::ImproperCreator)plugin->creator.v1; + } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; if (fix_map->find(plugin->name) != fix_map->end()) { @@ -219,8 +258,9 @@ namespace LAMMPS_NS int me = lmp->comm->me; // ignore unload request from unsupported style categories - if ((strcmp(style,"pair") != 0) - && (strcmp(style,"fix") != 0) + if ((strcmp(style,"pair") != 0) && (strcmp(style,"bond") != 0) + && (strcmp(style,"angle") != 0) && (strcmp(style,"dihedral") != 0) + && (strcmp(style,"improper") != 0) && (strcmp(style,"fix") != 0) && (strcmp(style,"command") != 0)) { if (me == 0) utils::logmesg(lmp,fmt::format("Ignoring unload: {} is not a " @@ -269,6 +309,54 @@ namespace LAMMPS_NS } } + } else if (pstyle == "bond") { + + auto found = lmp->force->bond_map->find(name); + if (found != lmp->force->bond_map->end()) + lmp->force->bond_map->erase(found); + + // must delete bond style instance if in use + + if ((lmp->force->bond_style != nullptr) + && (lmp->force->bond_match(name) != nullptr)) + lmp->force->create_bond("none",0); + + } else if (pstyle == "angle") { + + auto found = lmp->force->angle_map->find(name); + if (found != lmp->force->angle_map->end()) + lmp->force->angle_map->erase(found); + + // must delete angle style instance if in use + + if ((lmp->force->angle_style != nullptr) + && (lmp->force->angle_match(name) != nullptr)) + lmp->force->create_angle("none",0); + + } else if (pstyle == "dihedral") { + + auto found = lmp->force->dihedral_map->find(name); + if (found != lmp->force->dihedral_map->end()) + lmp->force->dihedral_map->erase(found); + + // must delete dihedral style instance if in use + + if ((lmp->force->dihedral_style) + && (lmp->force->dihedral_match(name) != nullptr)) + lmp->force->create_dihedral("none",0); + + } else if (pstyle == "improper") { + + auto found = lmp->force->improper_map->find(name); + if (found != lmp->force->improper_map->end()) + lmp->force->improper_map->erase(found); + + // must delete improper style instance if in use + + if ((lmp->force->improper_style != nullptr) + && (lmp->force->improper_match(name) != nullptr)) + lmp->force->create_improper("none",0); + } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; From fbb3bb14af47b7c893ede7cb4dd39f33826946be Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 17:08:49 -0400 Subject: [PATCH 089/370] synchronize interface to managing computes in Modify with that of fixes - add find_compute_by_style() - add delete_compute(int) --- src/modify.cpp | 21 ++++++++++++++++++++- src/modify.h | 11 +++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/modify.cpp b/src/modify.cpp index 2c0fd434d6..9cb90fc36f 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1326,7 +1326,12 @@ void Modify::delete_compute(const std::string &id) { int icompute = find_compute(id); if (icompute < 0) error->all(FLERR,"Could not find compute ID to delete"); - delete compute[icompute]; + delete_compute(icompute); +} + +void Modify::delete_compute(int icompute) +{ + if (compute[icompute]) delete compute[icompute]; // move other Computes down in list one slot @@ -1347,6 +1352,20 @@ int Modify::find_compute(const std::string &id) return -1; } +/* ---------------------------------------------------------------------- + find a compute by style + return index of compute or -1 if not found +------------------------------------------------------------------------- */ + +int Modify::find_compute_by_style(const char *style) +{ + int icompute; + for (icompute = 0; icompute < ncompute; icompute++) + if (utils::strmatch(compute[icompute]->style,style)) break; + if (icompute == ncompute) return -1; + return icompute; +} + /* ---------------------------------------------------------------------- clear invoked flag of all computes called everywhere that computes are used, before computes are invoked diff --git a/src/modify.h b/src/modify.h index ba8efd6525..0f4f7e32d2 100644 --- a/src/modify.h +++ b/src/modify.h @@ -109,21 +109,24 @@ class Modify : protected Pointers { void delete_fix(int); int find_fix(const std::string &); int find_fix_by_style(const char *); - int check_package(const char *); - int check_rigid_group_overlap(int); - int check_rigid_region_overlap(int, class Region *); - int check_rigid_list_overlap(int *); void add_compute(int, char **, int trysuffix=1); void add_compute(const std::string &, int trysuffix=1); void modify_compute(int, char **); void delete_compute(const std::string &); + void delete_compute(int); int find_compute(const std::string &); + int find_compute_by_style(const char *); void clearstep_compute(); void addstep_compute(bigint); void addstep_compute_all(bigint); + int check_package(const char *); + int check_rigid_group_overlap(int); + int check_rigid_region_overlap(int, class Region *); + int check_rigid_list_overlap(int *); + void write_restart(FILE *); int read_restart(FILE *); void restart_deallocate(int); From b2309f624606a56682282ab48b9b81a154e51eb4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 17:09:08 -0400 Subject: [PATCH 090/370] add support for computes --- src/PLUGIN/plugin.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 91d22b2897..255202b86b 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -218,6 +218,16 @@ namespace LAMMPS_NS } (*improper_map)[plugin->name] = (Force::ImproperCreator)plugin->creator.v1; + } else if (pstyle == "compute") { + auto compute_map = lmp->modify->compute_map; + if (compute_map->find(plugin->name) != compute_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in compute " + "style {} from plugin", + plugin->name)); + } + (*compute_map)[plugin->name] = (Modify::ComputeCreator)plugin->creator.v2; + } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; if (fix_map->find(plugin->name) != fix_map->end()) { @@ -260,7 +270,8 @@ namespace LAMMPS_NS // ignore unload request from unsupported style categories if ((strcmp(style,"pair") != 0) && (strcmp(style,"bond") != 0) && (strcmp(style,"angle") != 0) && (strcmp(style,"dihedral") != 0) - && (strcmp(style,"improper") != 0) && (strcmp(style,"fix") != 0) + && (strcmp(style,"improper") != 0) && (strcmp(style,"compute") != 0) + && (strcmp(style,"fix") != 0) && (strcmp(style,"command") != 0)) { if (me == 0) utils::logmesg(lmp,fmt::format("Ignoring unload: {} is not a " @@ -357,6 +368,16 @@ namespace LAMMPS_NS && (lmp->force->improper_match(name) != nullptr)) lmp->force->create_improper("none",0); + } else if (pstyle == "compute") { + + auto compute_map = lmp->modify->compute_map; + auto found = compute_map->find(name); + if (found != compute_map->end()) compute_map->erase(name); + + for (int icompute = lmp->modify->find_compute_by_style(name); + icompute >= 0; icompute = lmp->modify->find_compute_by_style(name)) + lmp->modify->delete_compute(icompute); + } else if (pstyle == "fix") { auto fix_map = lmp->modify->fix_map; From 03793d5e4dba32bcce433f32c585dc916e7c4147 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 17:23:25 -0400 Subject: [PATCH 091/370] simplify --- src/modify.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/modify.cpp b/src/modify.cpp index 9cb90fc36f..80cf2667fe 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1099,11 +1099,9 @@ int Modify::find_fix(const std::string &id) int Modify::find_fix_by_style(const char *style) { - int ifix; - for (ifix = 0; ifix < nfix; ifix++) - if (utils::strmatch(fix[ifix]->style,style)) break; - if (ifix == nfix) return -1; - return ifix; + for (int ifix = 0; ifix < nfix; ifix++) + if (utils::strmatch(fix[ifix]->style,style)) return ifix; + return -1; } /* ---------------------------------------------------------------------- @@ -1359,11 +1357,9 @@ int Modify::find_compute(const std::string &id) int Modify::find_compute_by_style(const char *style) { - int icompute; - for (icompute = 0; icompute < ncompute; icompute++) - if (utils::strmatch(compute[icompute]->style,style)) break; - if (icompute == ncompute) return -1; - return icompute; + for (int icompute = 0; icompute < ncompute; icompute++) + if (utils::strmatch(compute[icompute]->style,style)) return icompute; + return -1; } /* ---------------------------------------------------------------------- From 023d42b5bb90a289c16fbcfefba9dd42063f7635 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 18:03:12 -0400 Subject: [PATCH 092/370] add support for region style plugins --- src/PLUGIN/plugin.cpp | 23 ++++++++++++++++++++++- src/domain.cpp | 24 +++++++++++++++++++++++- src/domain.h | 2 ++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 255202b86b..b52e1a1959 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -14,6 +14,7 @@ #include "plugin.h" #include "comm.h" +#include "domain.h" #include "error.h" #include "input.h" #include "force.h" @@ -238,6 +239,16 @@ namespace LAMMPS_NS } (*fix_map)[plugin->name] = (Modify::FixCreator)plugin->creator.v2; + } else if (pstyle == "region") { + auto region_map = lmp->domain->region_map; + if (region_map->find(plugin->name) != region_map->end()) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,fmt::format("Overriding built-in region " + "style {} from plugin", + plugin->name)); + } + (*region_map)[plugin->name] = (Domain::RegionCreator)plugin->creator.v2; + } else if (pstyle == "command") { auto command_map = lmp->input->command_map; if (command_map->find(plugin->name) != command_map->end()) { @@ -271,7 +282,7 @@ namespace LAMMPS_NS if ((strcmp(style,"pair") != 0) && (strcmp(style,"bond") != 0) && (strcmp(style,"angle") != 0) && (strcmp(style,"dihedral") != 0) && (strcmp(style,"improper") != 0) && (strcmp(style,"compute") != 0) - && (strcmp(style,"fix") != 0) + && (strcmp(style,"fix") != 0) && (strcmp(style,"region") != 0) && (strcmp(style,"command") != 0)) { if (me == 0) utils::logmesg(lmp,fmt::format("Ignoring unload: {} is not a " @@ -388,6 +399,16 @@ namespace LAMMPS_NS ifix >= 0; ifix = lmp->modify->find_fix_by_style(name)) lmp->modify->delete_fix(ifix); + } else if (pstyle == "region") { + + auto region_map = lmp->domain->region_map; + auto found = region_map->find(name); + if (found != region_map->end()) region_map->erase(name); + + for (int iregion = lmp->domain->find_region_by_style(name); + iregion >= 0; iregion = lmp->domain->find_region_by_style(name)) + lmp->domain->delete_region(iregion); + } else if (pstyle == "command") { auto command_map = lmp->input->command_map; diff --git a/src/domain.cpp b/src/domain.cpp index c6dee63221..abf0d70079 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1816,8 +1816,18 @@ void Domain::delete_region(int narg, char **arg) int iregion = find_region(arg[0]); if (iregion == -1) error->all(FLERR,"Delete region ID does not exist"); + delete_region(iregion); +} + +void Domain::delete_region(int iregion) +{ + if ((iregion < 0) || (iregion >= nregion)) return; + + // delete and move other Regions down in list one slot + delete regions[iregion]; - regions[iregion] = regions[nregion-1]; + for (int i = iregion+1; iregion < nregion; ++i) + regions[i-1] = regions[i]; nregion--; } @@ -1833,6 +1843,18 @@ int Domain::find_region(const std::string &name) return -1; } +/* ---------------------------------------------------------------------- + return region index if name matches existing region style + return -1 if no such region +------------------------------------------------------------------------- */ + +int Domain::find_region_by_style(const std::string &name) +{ + for (int iregion = 0; iregion < nregion; iregion++) + if (name == regions[iregion]->style) return iregion; + return -1; +} + /* ---------------------------------------------------------------------- (re)set boundary settings flag = 0, called from the input script diff --git a/src/domain.h b/src/domain.h index 99349edb5d..5009a67d28 100644 --- a/src/domain.h +++ b/src/domain.h @@ -130,7 +130,9 @@ class Domain : protected Pointers { void set_lattice(int, char **); void add_region(int, char **); void delete_region(int, char **); + void delete_region(int); int find_region(const std::string &); + int find_region_by_style(const std::string &); void set_boundary(int, char **, int); void set_box(int, char **); void print_box(const std::string &); From a5ce7c1ac9e6758c0d3606913f4d54c71d635f09 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 18:03:26 -0400 Subject: [PATCH 093/370] better checks for valid data --- src/modify.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modify.cpp b/src/modify.cpp index 80cf2667fe..79a0ecd41f 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1069,10 +1069,12 @@ void Modify::delete_fix(const std::string &id) void Modify::delete_fix(int ifix) { - if (fix[ifix]) delete fix[ifix]; - atom->update_callback(ifix); + if ((ifix < 0) || (ifix >= nfix)) return; - // move other Fixes and fmask down in list one slot + // delete instance and move other Fixes and fmask down in list one slot + + delete fix[ifix]; + atom->update_callback(ifix); for (int i = ifix+1; i < nfix; i++) fix[i-1] = fix[i]; for (int i = ifix+1; i < nfix; i++) fmask[i-1] = fmask[i]; @@ -1329,10 +1331,11 @@ void Modify::delete_compute(const std::string &id) void Modify::delete_compute(int icompute) { - if (compute[icompute]) delete compute[icompute]; + if ((icompute < 0) || (icompute >= ncompute)) return; - // move other Computes down in list one slot + // delete and move other Computes down in list one slot + delete compute[icompute]; for (int i = icompute+1; i < ncompute; i++) compute[i-1] = compute[i]; ncompute--; } From 024a9600b15df903b614978bf655f56c06e63a26 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 18 Mar 2021 18:04:13 -0400 Subject: [PATCH 094/370] update docs --- doc/src/Developer_plugins.rst | 120 +++++++++++++++----- doc/src/plugin.rst | 2 +- doc/utils/sphinx-config/false_positives.txt | 1 + 3 files changed, 96 insertions(+), 27 deletions(-) diff --git a/doc/src/Developer_plugins.rst b/doc/src/Developer_plugins.rst index 7275c12605..68f1f1387c 100644 --- a/doc/src/Developer_plugins.rst +++ b/doc/src/Developer_plugins.rst @@ -2,36 +2,95 @@ Writing plugins --------------- Plugins provide a mechanism to add functionality to a LAMMPS executable -without recompiling LAMMPS. This uses the operating system's -capability to load dynamic shared object (DSO) files in a way similar -shared libraries and then references specific functions those DSOs. -Any DSO file with plugins has to include an initialization function -with a specific name that has to follow specific rules. When loading -the DSO, this function is called and will then register the contained -plugin(s) with LAMMPS. +without recompiling LAMMPS. The functionality for this and the +:doc:`plugin command ` are implemented in the +:ref:`PLUGIN package ` which must be installed to use plugins. + +Plugins use the operating system's capability to load dynamic shared +object (DSO) files in a way similar shared libraries and then reference +specific functions in those DSOs. Any DSO file with plugins has to include +an initialization function with a specific name, "lammpsplugin_init", that +has to follow specific rules described below. When loading the DSO with +the "plugin" command, this function is looked up and called and will then +register the contained plugin(s) with LAMMPS. From the programmer perspective this can work because of the object -oriented design where all pair style commands are derived from the class -Pair, all fix style commands from the class Fix and so on and only -functions from those base classes are called directly. When a -:doc:`pair_style` command or :doc:`fix` command is issued a new -instance of such a derived class is created. This is done by a -so-called factory function which is mapped to the style name. Thus -when, for example, the LAMMPS processes the command -``pair_style lj/cut 2.5``, LAMMPS will look up the factory function -for creating the ``PairLJCut`` class and then execute it. The return -value of that function is a ``Pair *`` pointer and the pointer will -be assigned to the location for the currently active pair style. +oriented design of LAMMPS where all pair style commands are derived from +the class Pair, all fix style commands from the class Fix and so on and +usually only functions present in those base classes are called +directly. When a :doc:`pair_style` command or :doc:`fix` command is +issued a new instance of such a derived class is created. This is done +by a so-called factory function which is mapped to the style name. Thus +when, for example, the LAMMPS processes the command ``pair_style lj/cut +2.5``, LAMMPS will look up the factory function for creating the +``PairLJCut`` class and then execute it. The return value of that +function is a ``Pair *`` pointer and the pointer will be assigned to the +location for the currently active pair style. -A plugin thus has to implement such a factory function and register it -with LAMMPS so that it gets added to the map of available styles of -the given category. To register a plugin with LAMMPS an initialization -function has to be called that follows specific rules explained below. +A DSO file with a plugin thus has to implement such a factory function +and register it with LAMMPS so that it gets added to the map of available +styles of the given category. To register a plugin with LAMMPS an +initialization function has to be present in the DSO file called +``lammpsplugin_init`` which is called with three ``void *`` arguments: +a pointer to the current LAMMPS instance, a pointer to the opened DSO +handle, and a pointer to the registration function. The registration +function takes two arguments: a pointer to a ``lammpsplugin_t`` struct +with information about the plugin and a pointer to the current LAMMPS +instance. Please see below for an example of how the registration is +done. +Members of ``lammpsplugin_t`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -As an example, for a hypothetical pair style "morse2" implemented in a -class ``PairMorse2`` in the files ``pair_morse2.h`` and -``pair_morse2.cpp`` the file with the factory function and initialization +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Member + - Description + * - version + - LAMMPS Version string the plugin was compiled for + * - style + - Style of the plugin (pair, bond, fix, command, etc.) + * - name + - Name of the plugin style + * - info + - String with information about the plugin + * - author + - String with the name and email of the author + * - creator.v1 + - Pointer to factory function for pair, bond, angle, dihedral, or improper styles + * - creator.v2 + - Pointer to factory function for compute, fix, or region styles + * - creator.v3 + - Pointer to factory function for command styles + * - handle + - Pointer to the open DSO file handle + +Only one of the three alternate creator entries can be used at a time +and which of those is determined by the style of plugin. The "creator.v1" +element is for factory functions of supported styles computing forces (i.e. +pair, bond, angle, dihedral, or improper styles) and the function takes +as single argument the pointer to the LAMMPS instance. The factory function +is cast to the ``lammpsplugin_factory1`` type before assignment. The +"creator.v2" element is for factory functions creating an instance of +a fix, compute, or region style and takes three arguments: a pointer to +the LAMMPS instance, an integer with the length of the argument list and +a ``char **`` pointer to the list of arguments. The factory function pointer +needs to be cast to the ``lammpsplugin_factory2`` type before assignment. +The "creator.v3" element takes the same arguments as "creator.v3" but is +specific to creating command styles: the factory function has to instantiate +the command style locally passing the LAMMPS pointer as argument and then +call its "command" member function with the number and list of arguments. +The factory function pointer needs to be cast to the +``lammpsplugin_factory3`` type before assignment. + +Pair style example +^^^^^^^^^^^^^^^^^^ + +As an example, a hypothetical pair style plugin "morse2" implemented in +a class ``PairMorse2`` in the files ``pair_morse2.h`` and +``pair_morse2.cpp`` with the factory function and initialization function would look like this: .. code-block:: C++ @@ -70,6 +129,10 @@ pointer to the allocated class instance derived from the ``Pair`` class. This function may be declared static to avoid clashes with other plugins. The name of the derived class, ``PairMorse2``, must be unique inside the entire LAMMPS executable. + +Fix style example +^^^^^^^^^^^^^^^^^ + If the factory function would be for a fix or compute, which take three arguments (a pointer to the LAMMPS class, the number of arguments and the list of argument strings), then the pointer type is ``lammpsplugin_factory2`` @@ -104,6 +167,8 @@ Below is an example for that: (*register_plugin)(&plugin,lmp); } +Command style example +^^^^^^^^^^^^^^^^^^^^^ For command styles there is a third variant of factory function as demonstrated in the following example, which also shows that the implementation of the plugin class may also be within the same @@ -158,6 +223,9 @@ file as the plugin interface code: (*register_plugin)(&plugin,lmp); } +Additional Details +^^^^^^^^^^^^^^^^^^ + The initialization function **must** be called ``lammpsplugin_init``, it **must** have C bindings and it takes three void pointers as arguments. The first is a pointer to the LAMMPS class that calls it and it needs to @@ -167,7 +235,7 @@ to the plugin info struct, so that the DSO can be closed and unloaded when all its contained plugins are unloaded. The third argument is a function pointer to the registration function and needs to be stored in a variable of ``lammpsplugin_regfunc`` type and then called with a -pointer to the ``lammpsplugin_`` struct and the pointer to the LAMMPS +pointer to the ``lammpsplugin_t`` struct and the pointer to the LAMMPS instance as arguments to register a single plugin. There may be multiple calls to multiple plugins in the same initialization function. diff --git a/doc/src/plugin.rst b/doc/src/plugin.rst index 48638bf97a..02228636bc 100644 --- a/doc/src/plugin.rst +++ b/doc/src/plugin.rst @@ -17,7 +17,7 @@ Syntax *load* file = load plugin(s) from shared object in *file* *unload* style name = unload plugin *name* of style *style* - *style* = *pair* or *fix* or *command* + *style* = *pair* or *bond* or *angle* or *dihedral* or *improper* or *compute* or *fix* or *region* or *command* *list* = print a list of currently loaded plugins *clear* = unload all currently loaded plugins diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 1d66028621..38a6971f4c 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1588,6 +1588,7 @@ lammps Lammps LAMMPS lammpsplot +lammpsplugin Lampis Lamoureux Lanczos From b8f606357842967f84e7dad3c10b871d3fc66e42 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 10:47:49 -0400 Subject: [PATCH 095/370] correct documentation of angle style cosine/periodic --- doc/src/angle_cosine_periodic.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index 71c2caa3f0..61b6407eb9 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -32,7 +32,7 @@ center: .. math:: - E = C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right] + E = 2.0*C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right] where :math:`C`, :math:`B` and :math:`n` are coefficients defined for each angle type. @@ -47,10 +47,9 @@ or :doc:`read_restart ` commands: * :math:`B` = 1 or -1 * :math:`n` = 1, 2, 3, 4, 5 or 6 for periodicity -Note that the prefactor :math:`C` is specified and not the overall force +Note that the prefactor :math:`C` is specified as coefficient and not the overall force constant :math:`K = \frac{C}{n^2}`. When :math:`B = 1`, it leads to a minimum for the -linear geometry. When :math:`B = -1`, it leads to a maximum for the linear -geometry. +linear geometry. When :math:`B = -1`, it leads to a maximum for the linear geometry. ---------- From e8c8ceaf81a0bc7621a6f033545ddcfd1d41bb80 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 11:28:22 -0400 Subject: [PATCH 096/370] correct attribution of angle style cosine/squared with DREIDING --- doc/src/Howto_bioFF.rst | 1 + doc/src/angle_cosine_periodic.rst | 7 ++----- doc/src/angle_cosine_squared.rst | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/src/Howto_bioFF.rst b/doc/src/Howto_bioFF.rst index bac1b566e1..9bffe5d4c9 100644 --- a/doc/src/Howto_bioFF.rst +++ b/doc/src/Howto_bioFF.rst @@ -91,6 +91,7 @@ documentation for the formula it computes. * :doc:`bond_style ` harmonic * :doc:`bond_style ` morse +* :doc:`angle_style ` cosine/squared * :doc:`angle_style ` harmonic * :doc:`angle_style ` cosine * :doc:`angle_style ` cosine/periodic diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index 61b6407eb9..ec2426154d 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -24,9 +24,8 @@ Examples Description """"""""""" -The *cosine/periodic* angle style uses the following potential, which -is commonly used in the :doc:`DREIDING ` force field, -particularly for organometallic systems where :math:`n` = 4 might be used +The *cosine/periodic* angle style uses the following potential, which may be +particularly used for organometallic systems where :math:`n` = 4 might be used for an octahedral complex and :math:`n` = 3 might be used for a trigonal center: @@ -36,8 +35,6 @@ center: where :math:`C`, :math:`B` and :math:`n` are coefficients defined for each angle type. -See :ref:`(Mayo) ` for a description of the DREIDING force field - The following coefficients must be defined for each angle type via the :doc:`angle_coeff ` command as in the example above, or in the data file or restart files read by the :doc:`read_data ` diff --git a/doc/src/angle_cosine_squared.rst b/doc/src/angle_cosine_squared.rst index 4a6a1debe9..d674eb61d8 100644 --- a/doc/src/angle_cosine_squared.rst +++ b/doc/src/angle_cosine_squared.rst @@ -30,8 +30,11 @@ The *cosine/squared* angle style uses the potential E = K [\cos(\theta) - \cos(\theta_0)]^2 -where :math:`\theta_0` is the equilibrium value of the angle, and :math:`K` is a -prefactor. Note that the usual 1/2 factor is included in :math:`K`. +, which is commonly used in the :doc:`DREIDING ` force field, +where :math:`\theta_0` is the equilibrium value of the angle, and :math:`K` +is a prefactor. Note that the usual 1/2 factor is included in :math:`K`. + +See :ref:`(Mayo) ` for a description of the DREIDING force field. The following coefficients must be defined for each angle type via the :doc:`angle_coeff ` command as in the example above, or in @@ -66,3 +69,10 @@ Default """"""" none + +---------- + +.. _cosine-Mayo: + +**(Mayo)** Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909 +(1990). From aabfe40ad3341d0676a875ccbee3c2443748126b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 15:10:45 -0400 Subject: [PATCH 097/370] add missing 1/n**2 term to pair style cosine/periodic energy function --- doc/src/angle_cosine_periodic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index ec2426154d..5e13c98cfc 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -31,7 +31,7 @@ center: .. math:: - E = 2.0*C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right] + E = \frac{2.0}{n^2} * C \left[ 1 - B(-1)^n\cos\left( n\theta\right) \right] where :math:`C`, :math:`B` and :math:`n` are coefficients defined for each angle type. From 58744f0a4926a0d9a1991da4718837eb48dff463 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 15:32:24 -0400 Subject: [PATCH 098/370] correct expression for K --- doc/src/angle_cosine_periodic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index 5e13c98cfc..8c60ac1ebb 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -45,7 +45,7 @@ or :doc:`read_restart ` commands: * :math:`n` = 1, 2, 3, 4, 5 or 6 for periodicity Note that the prefactor :math:`C` is specified as coefficient and not the overall force -constant :math:`K = \frac{C}{n^2}`. When :math:`B = 1`, it leads to a minimum for the +constant :math:`K = \frac{2 C}{n^2}`. When :math:`B = 1`, it leads to a minimum for the linear geometry. When :math:`B = -1`, it leads to a maximum for the linear geometry. ---------- From 56121a524c97ca1606be03ac9243e4b47026412d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 16:26:50 -0400 Subject: [PATCH 099/370] correct equilibrium angle computation for angle style cosine/periodic if b < 0 --- src/MOLECULE/angle_cosine_periodic.cpp | 4 ++-- unittest/force-styles/tests/angle-cosine_periodic.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index f72a196b41..0df103c333 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -222,9 +222,9 @@ void AngleCosinePeriodic::coeff(int narg, char **arg) /* ---------------------------------------------------------------------- */ -double AngleCosinePeriodic::equilibrium_angle(int /*i*/) +double AngleCosinePeriodic::equilibrium_angle(int i) { - return MY_PI; + return MY_PI*(1.0 - (b[i]>0)?0.0:1.0/static_cast(multiplicity[i])); } /* ---------------------------------------------------------------------- diff --git a/unittest/force-styles/tests/angle-cosine_periodic.yaml b/unittest/force-styles/tests/angle-cosine_periodic.yaml index 814c837dcd..d8fba5c6ee 100644 --- a/unittest/force-styles/tests/angle-cosine_periodic.yaml +++ b/unittest/force-styles/tests/angle-cosine_periodic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:34 202 +lammps_version: 10 Mar 2021 +date_generated: Mon Mar 22 16:25:49 202 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -14,7 +14,7 @@ angle_coeff: ! | 2 45.0 1 2 3 50.0 -1 3 4 100.0 -1 4 -equilibrium: 4 3.141592653589793 3.141592653589793 3.141592653589793 3.141592653589793 +equilibrium: 4 1.5707963267948966 1.5707963267948966 0 0 extract: ! "" natoms: 29 init_energy: 946.676664091363 From ca1496e02848265aa0930002479f996fa4c8f3e1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 21:36:25 -0400 Subject: [PATCH 100/370] simplify --- src/KIM/pair_kim.cpp | 49 ++++++++----------- src/USER-MANIFOLD/fix_manifoldforce.cpp | 18 +++---- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 20 +++----- src/USER-MISC/dihedral_table.cpp | 6 +-- 4 files changed, 34 insertions(+), 59 deletions(-) diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 1b709a65c2..cf6374ab2d 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -477,12 +477,10 @@ void PairKIM::coeff(int narg, char **arg) if (paramname == str_name_str) break; } - if (param_index >= numberOfParameters) { - auto msg = fmt::format("Wrong argument for pair coefficients.\n" - "This Model does not have the requested " - "'{}' parameter", paramname); - error->all(FLERR,msg); - } + if (param_index >= numberOfParameters) + error->all(FLERR,fmt::format("Wrong argument for pair coefficients.\n" + "This Model does not have the requested " + "'{}' parameter", paramname)); // Get the index_range for the requested parameter int nlbound(0); @@ -492,12 +490,10 @@ void PairKIM::coeff(int narg, char **arg) std::string argtostr(arg[i++]); // Check to see if the indices range contains only integer numbers & : - if (argtostr.find_first_not_of("0123456789:") != std::string::npos) { - auto msg = fmt::format("Illegal index_range.\nExpected integer " - "parameter(s) instead of '{}' in " - "index_range", argtostr); - error->all(FLERR,msg); - } + if (argtostr.find_first_not_of("0123456789:") != std::string::npos) + error->all(FLERR,fmt::format("Illegal index_range.\nExpected integer" + " parameter(s) instead of '{}' in " + "index_range", argtostr)); std::string::size_type npos = argtostr.find(':'); if (npos != std::string::npos) { @@ -507,21 +503,17 @@ void PairKIM::coeff(int narg, char **arg) nubound = atoi(words[1].c_str()); if (nubound < 1 || nubound > extent || - nlbound < 1 || nlbound > nubound) { - auto msg = fmt::format("Illegal index_range '{}-{}' for '{}' " - "parameter with the extent of '{}'", - nlbound, nubound, paramname, extent); - error->all(FLERR,msg); - } + nlbound < 1 || nlbound > nubound) + error->all(FLERR,fmt::format("Illegal index_range '{}-{}' for '{}' " + "parameter with the extent of '{}'", + nlbound, nubound, paramname, extent)); } else { nlbound = atoi(argtostr.c_str()); - if (nlbound < 1 || nlbound > extent) { - auto msg = fmt::format("Illegal index '{}' for '{}' parameter " - "with the extent of '{}'", nlbound, - paramname, extent); - error->all(FLERR,msg); - } + if (nlbound < 1 || nlbound > extent) + error->all(FLERR,fmt::format("Illegal index '{}' for '{}' parameter " + "with the extent of '{}'", nlbound, + paramname, extent)); nubound = nlbound; } @@ -551,11 +543,10 @@ void PairKIM::coeff(int narg, char **arg) } else error->all(FLERR,"Wrong parameter type to update"); } else { - auto msg = fmt::format("Wrong number of variable values for pair " - "coefficients.\n'{}' values are requested " - "for '{}' parameter", nubound - nlbound + 1, - paramname); - error->all(FLERR,msg); + error->all(FLERR,fmt::format("Wrong number of variable values for pair " + "coefficients.\n'{}' values are requested " + "for '{}' parameter", nubound - nlbound + 1, + paramname)); } } diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index d389b9787e..26d209e7a9 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -58,22 +58,16 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : ptr_m = create_manifold(m_name,lmp,narg,arg); // Construct manifold from factory: - if (!ptr_m) { - char msg[2048]; - snprintf(msg,2048,"Manifold pointer for manifold '%s' was NULL for some reason", arg[3]); - error->all(FLERR,msg); - } - + if (!ptr_m) + error->all(FLERR,fmt::format("Manifold pointer for manifold '{}' " + "was NULL for some reason", arg[3])); // After constructing the manifold, you can safely make // room for the parameters nvars = ptr_m->nparams(); - if (narg < nvars+4) { - char msg[2048]; - sprintf(msg,"Manifold %s needs at least %d argument(s)!", - m_name, nvars); - error->all(FLERR,msg); - } + if (narg < nvars+4) + error->all(FLERR,fmt::format("Manifold {} needs at least {} " + "argument(s)!", m_name, nvars)); ptr_m->params = new double[nvars]; if (ptr_m->params == nullptr) { diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index 5d5bdea156..a45d62a588 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -95,9 +95,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, max_iter = utils::numeric( FLERR, arg[4] ,false,lmp); ptr_m = create_manifold(arg[5], lmp, narg, arg); - if (!ptr_m) { - error->all(FLERR,"Error creating manifold pointer"); - } + if (!ptr_m) error->all(FLERR,"Error creating manifold pointer"); nvars = ptr_m->nparams(); tstrs = new char*[nvars]; @@ -105,17 +103,13 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, tstyle = new int[nvars]; is_var = new int[nvars]; - if (!tstrs || !tvars || !tstyle || !is_var) { + if (!tstrs || !tvars || !tstyle || !is_var) error->all(FLERR, "Error creating manifold arg arrays"); - } // Check if you have enough args: - if (6 + nvars > narg) { - char msg[2048]; - sprintf(msg, "Not enough args for manifold %s, %d expected but got %d\n", - ptr_m->id(), nvars, narg - 6); - error->all(FLERR, msg); - } + if (6 + nvars > narg) + error->all(FLERR,fmt::format("Not enough args for manifold {}, {} expected " + "but got {}\n",ptr_m->id(),nvars, narg - 6)); // Loop over manifold args: for (int i = 0; i < nvars; ++i) { int len = 0, offset = 0; @@ -154,9 +148,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, } argi += 2; } else if (error_on_unknown_keyword) { - char msg[2048]; - sprintf(msg,"Error parsing arg \"%s\".\n", arg[argi]); - error->all(FLERR, msg); + error->all(FLERR,fmt::format("Error parsing arg \"{}\".\n",arg[argi])); } else { argi += 1; } diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 30e6192275..a81037cad6 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -1183,10 +1183,8 @@ void DihedralTable::spline_table(Table *tb) } } // for (int i=0; ininput; i++) - if ((num_disagreements > tb->ninput/2) && (num_disagreements > 2)) { - std::string msg("Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n"); - error->all(FLERR, msg); - } + if ((num_disagreements > tb->ninput/2) && (num_disagreements > 2)) + error->all(FLERR,"Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n"); } // check for consistency if (! tb->f_unspecified) From 4b076e01bec603acb1b7eac8343a669eecaf38ea Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Mar 2021 21:36:33 -0400 Subject: [PATCH 101/370] silence compiler warning --- src/fix_property_atom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 56add7a0d1..6ce5b6360b 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -227,7 +227,7 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, try { ValueTokenizer values(buf); - if (values.count() != nvalue+1) + if ((int)values.count() != nvalue+1) error->all(FLERR,fmt::format("Incorrect format in {} section " "of data file: {}",keyword,buf)); From 875327117bd4e9d76d39e3548013d2c47b9e5956 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 07:36:12 -0400 Subject: [PATCH 102/370] add unit test for dihedral styles table and table/cut --- .../tests/dihedral-table_cut_linear.yaml | 86 + .../tests/dihedral-table_cut_spline.yaml | 86 + .../tests/dihedral-table_linear.yaml | 86 + .../tests/dihedral-table_spline.yaml | 86 + .../force-styles/tests/harmonic_dihedral.txt | 3621 +++++++++++++++++ 5 files changed, 3965 insertions(+) create mode 100644 unittest/force-styles/tests/dihedral-table_cut_linear.yaml create mode 100644 unittest/force-styles/tests/dihedral-table_cut_spline.yaml create mode 100644 unittest/force-styles/tests/dihedral-table_linear.yaml create mode 100644 unittest/force-styles/tests/dihedral-table_spline.yaml create mode 100644 unittest/force-styles/tests/harmonic_dihedral.txt diff --git a/unittest/force-styles/tests/dihedral-table_cut_linear.yaml b/unittest/force-styles/tests/dihedral-table_cut_linear.yaml new file mode 100644 index 0000000000..c34c6269de --- /dev/null +++ b/unittest/force-styles/tests/dihedral-table_cut_linear.yaml @@ -0,0 +1,86 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Tue Mar 23 08:05:02 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + dihedral table/cut +pre_commands: ! "" +post_commands: ! "" +input_file: in.fourmol +dihedral_style: table/cut linear 3600 +dihedral_coeff: ! | + 1 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_1 + 2 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_2 + 3 aat 0.50 175 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_3 + 4 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_4 + 5 aat 0.25 170 175 ${input_dir}/harmonic_dihedral.txt HARMONIC_5 +extract: ! "" +natoms: 29 +init_energy: 552.225725624496 +init_stress: ! |- + -7.4008882268909986e+01 1.3648518393804071e+02 -6.2476301669130748e+01 3.4620215707793108e+01 1.3017899329318067e+02 1.9706621502063012e+02 +init_forces: ! |2 + 1 -8.1198888996808620e+01 7.1073378215839497e+01 -1.1918247546822441e+02 + 2 3.8575810899979956e+01 -1.9920126773772417e+01 1.8847596663648414e+01 + 3 1.0913741754895571e+02 -7.1292512160682776e+01 7.5572753355603993e+01 + 4 -4.7848742793736733e+01 -7.5245295675494663e+00 6.4464643610526949e+01 + 5 -1.5539692023725792e+01 5.7172364237479494e+00 -1.3226941634858840e+00 + 6 -1.1355716924924745e+02 -8.6143836335725510e+01 -5.7299648623432482e+00 + 7 4.1372375526613887e+01 4.5139121695653614e+01 -7.4310043691848229e+00 + 8 2.1399043677828325e+02 1.8625470581545247e+02 -3.3675100353189755e+00 + 9 5.2653582674682809e+01 5.6583201775589529e+01 -2.5669664860295835e+01 + 10 -4.7984520275438535e+02 -5.1382692638722949e+02 -1.3749287390453020e+02 + 11 1.6539670687119863e+02 1.4091972117987351e+02 -1.2657881071783035e+02 + 12 3.4200742496423310e+01 1.2794076077133660e+02 2.3610219433759886e+02 + 13 1.8270592580559917e+00 4.1997746033241778e+00 8.8146411631557697e+00 + 14 1.8694466162959706e+01 -2.6013807510038696e+01 -9.2498849040619788e+00 + 15 -6.2869548680867373e+00 2.1284514172388507e+00 -6.4318098210331209e+00 + 16 -1.0694908795819050e+02 -5.9251517113768401e+01 1.0405679351593225e+01 + 17 1.7537714042702788e+02 1.4401690395071051e+02 2.8249184624181581e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_energy: 549.782031215547 +run_stress: ! |- + -7.5056949042919044e+01 1.3698944188847955e+02 -6.1932492845560127e+01 3.3581673544215263e+01 1.2888596290133776e+02 1.9565093507759894e+02 +run_forces: ! |2 + 1 -8.1850261118769851e+01 7.1565857666082792e+01 -1.1998194154132169e+02 + 2 3.8942730288029111e+01 -2.0139091742218607e+01 1.9096837462073495e+01 + 3 1.0933304895917627e+02 -7.1974713700542679e+01 7.7222647280784500e+01 + 4 -4.7578796179763913e+01 -7.4260553823873163e+00 6.4056709071407184e+01 + 5 -1.5573770424692153e+01 5.7360778752676689e+00 -1.3292716784107659e+00 + 6 -1.1205401245818740e+02 -8.3930835846975214e+01 -6.4629873083122060e+00 + 7 4.1368235883807785e+01 4.5098977123947911e+01 -7.4207495093494247e+00 + 8 2.1112963982593271e+02 1.8319846795829790e+02 -4.5077247269703236e+00 + 9 5.2596180125216748e+01 5.6303309547815658e+01 -2.5556604563933746e+01 + 10 -4.8079664429997507e+02 -5.1197713825609452e+02 -1.3418905325289452e+02 + 11 1.6804796981040414e+02 1.4157399298542791e+02 -1.2667138198231208e+02 + 12 3.3945852325507303e+01 1.2661718822016165e+02 2.3437614824953252e+02 + 13 1.8225699822433148e+00 4.1983174055270061e+00 8.8273571873798709e+00 + 14 1.8256498023781354e+01 -2.5354302062650923e+01 -8.9739201991677255e+00 + 15 -6.2761226111239754e+00 2.1261045368019413e+00 -6.4368032911012207e+00 + 16 -1.0841619930894663e+02 -6.1089982213467948e+01 9.6877249595793860e+00 + 17 1.7710308117736014e+02 1.4547382588500676e+02 2.8263013843016775e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +... diff --git a/unittest/force-styles/tests/dihedral-table_cut_spline.yaml b/unittest/force-styles/tests/dihedral-table_cut_spline.yaml new file mode 100644 index 0000000000..9148e0a80d --- /dev/null +++ b/unittest/force-styles/tests/dihedral-table_cut_spline.yaml @@ -0,0 +1,86 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Tue Mar 23 08:06:45 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + dihedral table/cut +pre_commands: ! "" +post_commands: ! "" +input_file: in.fourmol +dihedral_style: table/cut spline 3600 +dihedral_coeff: ! | + 1 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_1 + 2 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_2 + 3 aat 0.50 175 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_3 + 4 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_4 + 5 aat 0.25 170 175 ${input_dir}/harmonic_dihedral.txt HARMONIC_5 +extract: ! "" +natoms: 29 +init_energy: 552.218725263499 +init_stress: ! |- + -7.4019824552159534e+01 1.3649499111894895e+02 -6.2475166566789284e+01 3.4617375151088808e+01 1.3019745657214429e+02 1.9709007795400348e+02 +init_forces: ! |2 + 1 -8.1213286444115909e+01 7.1080525227994045e+01 -1.1918872501604099e+02 + 2 3.8585732128399350e+01 -1.9925249987601369e+01 1.8852444035804549e+01 + 3 1.0914957240045973e+02 -7.1293677289031876e+01 7.5564572526931997e+01 + 4 -4.7856039321211888e+01 -7.5256880640368262e+00 6.4474469548287303e+01 + 5 -1.5540068306011690e+01 5.7173997377718440e+00 -1.3227187051350375e+00 + 6 -1.1356202282295826e+02 -8.6148464023143134e+01 -5.7287967059654719e+00 + 7 4.1373182001548223e+01 4.5140001882310173e+01 -7.4311492797065428e+00 + 8 2.1400860040790070e+02 1.8627156816363441e+02 -3.3695416437372394e+00 + 9 5.2656207239745335e+01 5.6586006420025306e+01 -2.5670940543260770e+01 + 10 -4.7989294342864497e+02 -5.1388484267202580e+02 -1.3749831844924219e+02 + 11 1.6541995228367492e+02 1.4093778373411678e+02 -1.2659553837843652e+02 + 12 3.4200230035629019e+01 1.2795430859179336e+02 2.3612094879489862e+02 + 13 1.8271828366360419e+00 4.2000586675545639e+00 8.8152373675940172e+00 + 14 1.8695088969660507e+01 -2.6014674160815950e+01 -9.2501930642549315e+00 + 15 -6.2873518284233292e+00 2.1285858083405422e+00 -6.4322159275576647e+00 + 16 -1.0696654386912348e+02 -5.9261377200437906e+01 1.0407194734343612e+01 + 17 1.7540250771683571e+02 1.4403773516355190e+02 2.8253270705477313e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_energy: 549.770211120194 +run_stress: ! |- + -7.5054671721636595e+01 1.3699895801893166e+02 -6.1944286297295179e+01 3.3587137063275613e+01 1.2891678447538322e+02 1.9568224888755336e+02 +run_forces: ! |2 + 1 -8.1862157367941563e+01 7.1571534225465314e+01 -1.1998648925690665e+02 + 2 3.8950856557592253e+01 -2.0143295233943885e+01 1.9100831488650599e+01 + 3 1.0934424273562679e+02 -7.1974764063434151e+01 7.7213177208305225e+01 + 4 -4.7585717040630072e+01 -7.4272048534134285e+00 6.4066017644735453e+01 + 5 -1.5574231365780285e+01 5.7363230482123928e+00 -1.3292888747698781e+00 + 6 -1.1207625383797915e+02 -8.3953260935523502e+01 -6.4560404254467478e+00 + 7 4.1369305653963607e+01 4.5100137884474947e+01 -7.4209393875477607e+00 + 8 2.1117769556228862e+02 1.8324468258252551e+02 -4.5178766251241402e+00 + 9 5.2599757474211380e+01 5.6307064747883963e+01 -2.5558323416528047e+01 + 10 -4.8085705384233728e+02 -5.1205238742034794e+02 -1.3420522978505346e+02 + 11 1.6806394787511115e+02 1.4159239612328381e+02 -1.2668631632096621e+02 + 12 3.3951439786882119e+01 1.2663190154365350e+02 2.3440594816333368e+02 + 13 1.8227069769227078e+00 4.1986314416593373e+00 8.8280212719479678e+00 + 14 1.8256647570003278e+01 -2.5354504765353397e+01 -8.9739916559242712e+00 + 15 -6.2764595167862440e+00 2.1262187967343880e+00 -6.4371500960467092e+00 + 16 -1.0842617323615015e+02 -6.1092389588080550e+01 9.6917320121684938e+00 + 17 1.7712144601500279e+02 1.4548891646620359e+02 2.8265918055172548e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +... diff --git a/unittest/force-styles/tests/dihedral-table_linear.yaml b/unittest/force-styles/tests/dihedral-table_linear.yaml new file mode 100644 index 0000000000..7e2a7d55c1 --- /dev/null +++ b/unittest/force-styles/tests/dihedral-table_linear.yaml @@ -0,0 +1,86 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Mon Mar 22 21:19:05 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + dihedral table +pre_commands: ! "" +post_commands: ! "" +input_file: in.fourmol +dihedral_style: table linear 3600 +dihedral_coeff: ! | + 1 ${input_dir}/harmonic_dihedral.txt HARMONIC_1 + 2 ${input_dir}/harmonic_dihedral.txt HARMONIC_2 + 3 ${input_dir}/harmonic_dihedral.txt HARMONIC_3 + 4 ${input_dir}/harmonic_dihedral.txt HARMONIC_4 + 5 ${input_dir}/harmonic_dihedral.txt HARMONIC_5 +extract: ! "" +natoms: 29 +init_energy: 789.184256783584 +init_stress: ! |- + -1.6165501104216639e+02 -7.4114380315441565e+01 2.3576939135760787e+02 -2.3488521541598647e+02 3.4341737187983938e+02 -1.5959461001900144e+02 +init_forces: ! |2 + 1 -2.1498835469576278e+01 4.0242705861631180e+01 -9.0007821437717382e+01 + 2 -8.2018888113291979e+00 4.2353656629457461e+00 -4.0073270940910781e+00 + 3 9.1203773212580060e+01 -1.3765900530865244e+02 8.1977349479812418e+01 + 4 -4.8195100042546727e+01 -8.0451084249021534e+00 6.4747111681716376e+01 + 5 -6.2251242080533295e+01 2.2803637398534534e+01 -5.3285420895267421e+00 + 6 9.1265646559106216e+01 1.3743040689865262e+02 -3.9343488033831335e+01 + 7 -4.7432736093120091e+01 -5.1202947877496094e+01 8.4096202947719512e+00 + 8 2.2566883016909227e+02 1.6219571012359663e+02 5.7664673263129927e+01 + 9 -2.0799357954651114e+00 5.0308583175017674e+00 -7.5442843674616533e-01 + 10 -4.0472227269030174e+02 -4.7265020465440665e+02 -9.9994880868353093e+01 + 11 3.9893735247972799e+01 2.0808487532188158e+02 -1.3663466833430391e+02 + 12 6.2491147091194719e+01 7.0245646325825419e+01 1.9568453298435855e+02 + 13 2.9232948128895806e+01 6.7196393653186874e+01 1.4103425861049234e+02 + 14 7.2097046578806413e+01 -1.0032480603588586e+02 -3.5673090473056490e+01 + 15 -1.0059127788938771e+02 3.4055222675821568e+01 -1.0290895713652986e+02 + 16 -9.2256978542416007e+01 -1.2565565388894508e+02 -6.3113527034307076e+01 + 17 1.7537714042702783e+02 1.4401690395071046e+02 2.8249184624181567e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_energy: 786.199103735512 +run_stress: ! |- + -1.5979555001643004e+02 -7.4781079673606996e+01 2.3457662969003690e+02 -2.3349637150864024e+02 3.4159374485946643e+02 -1.5956254217954015e+02 +run_forces: ! |2 + 1 -2.2291107377203105e+01 4.0666970718627333e+01 -9.0497211256380396e+01 + 2 -7.6875363073287559e+00 3.9737486142840055e+00 -3.7620801734312614e+00 + 3 9.2103819928191996e+01 -1.3743335232167533e+02 8.2431881459386020e+01 + 4 -4.8290666517219691e+01 -8.1170776132331781e+00 6.4779991104261541e+01 + 5 -6.2246983418905813e+01 2.2813785810311227e+01 -5.3751809499241965e+00 + 6 9.1087481738151070e+01 1.3760819705271160e+02 -3.9500650484032505e+01 + 7 -4.6891554381909977e+01 -5.0621074446115216e+01 8.3775716071879351e+00 + 8 2.2268693398316259e+02 1.5891760123847899e+02 5.7199245600838793e+01 + 9 -1.3435027007714808e+00 5.5949363550589339e+00 -1.0517595721340651e+00 + 10 -4.0565110153193677e+02 -4.7084401363160805e+02 -9.7618847422734831e+01 + 11 4.2251495153612957e+01 2.0872309038043886e+02 -1.3675117078222070e+02 + 12 6.2352820175292266e+01 6.8729440749361473e+01 1.9366789701210121e+02 + 13 2.9032540154457664e+01 6.7387205615336427e+01 1.4127076790322786e+02 + 14 7.1580926568596425e+01 -9.9385928393915108e+01 -3.5110636800452511e+01 + 15 -1.0011174024358218e+02 3.3796455380232061e+01 -1.0280446675457922e+02 + 16 -9.3357186802666320e+01 -1.2692958041908989e+02 -6.3465822450651899e+01 + 17 1.7677536158005910e+02 1.4511959491079591e+02 2.8210471959538260e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +... diff --git a/unittest/force-styles/tests/dihedral-table_spline.yaml b/unittest/force-styles/tests/dihedral-table_spline.yaml new file mode 100644 index 0000000000..90aab98fba --- /dev/null +++ b/unittest/force-styles/tests/dihedral-table_spline.yaml @@ -0,0 +1,86 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Mon Mar 22 21:19:05 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + dihedral table +pre_commands: ! "" +post_commands: ! "" +input_file: in.fourmol +dihedral_style: table spline 3600 +dihedral_coeff: ! | + 1 ${input_dir}/harmonic_dihedral.txt HARMONIC_1 + 2 ${input_dir}/harmonic_dihedral.txt HARMONIC_2 + 3 ${input_dir}/harmonic_dihedral.txt HARMONIC_3 + 4 ${input_dir}/harmonic_dihedral.txt HARMONIC_4 + 5 ${input_dir}/harmonic_dihedral.txt HARMONIC_5 +extract: ! "" +natoms: 29 +init_energy: 789.17395865366 +init_stress: ! |- + -1.6167160198618581e+02 -7.4120077515581954e+01 2.3579167950176785e+02 -2.3490764576822448e+02 3.4342184840668585e+02 -1.5962456212434762e+02 +init_forces: ! |2 + 1 -2.1511698354927645e+01 4.0249060385771472e+01 -9.0013321064696271e+01 + 2 -8.1931699818042816e+00 4.2308633547530370e+00 -4.0030671970615401e+00 + 3 9.1213724085941266e+01 -1.3766351443388791e+02 8.1969246814730084e+01 + 4 -4.8202572709944334e+01 -8.0465316616826055e+00 6.4757081268568328e+01 + 5 -6.2252471687916213e+01 2.2804485237535822e+01 -5.3285277358374286e+00 + 6 9.1271091175285207e+01 1.3743691094855717e+02 -3.9344000146381845e+01 + 7 -4.7435622491834799e+01 -5.1206081227011012e+01 8.4101355534202042e+00 + 8 2.2568717307036252e+02 1.6221073791401761e+02 5.7667169771245945e+01 + 9 -2.0794865262354030e+00 5.0314964866185363e+00 -7.5468527912272698e-01 + 10 -4.0476567716026062e+02 -4.7270660864081441e+02 -9.9999223852109083e+01 + 11 3.9909170153607846e+01 2.0810704891869841e+02 -1.3665197982219311e+02 + 12 6.2493704712199360e+01 7.0253447706808217e+01 1.9569964315907762e+02 + 13 2.9234925386176613e+01 6.7200938680873065e+01 1.4104379788150430e+02 + 14 7.2099736473223771e+01 -1.0032854908984555e+02 -3.5674421413108355e+01 + 15 -1.0059762925477315e+02 3.4057372933448626e+01 -1.0291545484092256e+02 + 16 -9.2273704605935819e+01 -1.2566881267739232e+02 -6.3115663802590909e+01 + 17 1.7540250771683569e+02 1.4403773516355182e+02 2.8253270705477295e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_energy: 786.186636054773 +run_stress: ! |- + -1.5982910389343505e+02 -7.4774149450379937e+01 2.3460325334381506e+02 -2.3353349487854388e+02 3.4161194489304893e+02 -1.5958869300328692e+02 +run_forces: ! |2 + 1 -2.2302877568136338e+01 4.0672550148970281e+01 -9.0501596555606994e+01 + 2 -7.6795596366469354e+00 3.9696255711631245e+00 -3.7581781934774909e+00 + 3 9.2113037896352481e+01 -1.3743858578373496e+02 8.2424527928857074e+01 + 4 -4.8297128431903225e+01 -8.1171172458509702e+00 6.4789088257516795e+01 + 5 -6.2249945655197145e+01 2.2813353706915890e+01 -5.3758960971523750e+00 + 6 9.1082266941280153e+01 1.3760435384789912e+02 -3.9497610389853719e+01 + 7 -4.6896901941201634e+01 -5.0626903993409201e+01 8.3785409954385486e+00 + 8 2.2272760597411565e+02 1.5895499661752211e+02 5.7194518486415930e+01 + 9 -1.3424389468966993e+00 5.5961120653727576e+00 -1.0522843110369067e+00 + 10 -4.0569661746613480e+02 -4.7090645573337184e+02 -9.7628440089732422e+01 + 11 4.2260633619776542e+01 2.0874271121537350e+02 -1.3676519708069108e+02 + 12 6.2351939732772273e+01 6.8740733319529681e+01 1.9368291661547465e+02 + 13 2.9034913906341565e+01 6.7392732862315881e+01 1.4128237934676201e+02 + 14 7.1584708176938221e+01 -9.9391162142709391e+01 -3.5112483055478720e+01 + 15 -1.0011391207749671e+02 3.3797184006896543e+01 -1.0280672266200776e+02 + 16 -9.3370883891440556e+01 -1.2693997492906119e+02 -6.3467168010540369e+01 + 17 1.7679515936747723e+02 1.4513584646617855e+02 2.8213604815112788e+01 + 18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 + 29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +... diff --git a/unittest/force-styles/tests/harmonic_dihedral.txt b/unittest/force-styles/tests/harmonic_dihedral.txt new file mode 100644 index 0000000000..3f99f1663c --- /dev/null +++ b/unittest/force-styles/tests/harmonic_dihedral.txt @@ -0,0 +1,3621 @@ +# UNITS: real Dihedral table + +HARMONIC_1 +N 720 RADIANS + +0 0.0 150.0 -0.0 +1 0.008726646259971648 149.98857713672933 2.6178609655925102 +2 0.017453292519943295 149.95431202643218 5.234924505375115 +3 0.02617993877991494 149.89721510659302 7.850393436441557 +4 0.03490658503988659 149.81730376948678 10.463471061618776 +5 0.04363323129985824 149.71460235688093 13.073361412148756 +6 0.05235987755982988 149.58914215262052 15.679269490147995 +7 0.061086523819801536 149.44096137309916 18.280401510772094 +8 0.06981317007977318 149.27010515561776 20.875965144009786 +9 0.07853981633974483 149.07662554463536 23.46516975603466 +10 0.08726646259971647 148.86058147591564 26.047226650039544 +11 0.09599310885968812 148.62203875857477 28.62134930648175 +12 0.10471975511965977 148.36107005503544 31.186753622663918 +13 0.11344640137963141 148.07775485889266 33.74265815157973 +14 0.12217304763960307 147.77217947069977 36.288284339950145 +15 0.1308996938995747 147.44443697168012 38.82285676537811 +16 0.13962634015954636 147.0946271953739 41.34560337254987 +17 0.148352986419518 146.72285669722766 43.85575570841053 +18 0.15707963267948966 146.32923872213652 46.35254915624214 +19 0.16580627893946132 145.91389316994875 48.83522316857347 +20 0.17453292519943295 145.47694655894313 51.3030214988503 +21 0.1832595714594046 145.01853198729015 53.755192431795045 +22 0.19198621771937624 144.53878909250906 56.19098901238682 +23 0.20071286397934787 144.03786400893304 58.60966927339109 +24 0.20943951023931953 143.51590932319507 61.01049646137005 +25 0.2181661564992912 142.97308402774874 63.392739261104914 +26 0.22689280275926282 142.40955347243755 65.75567201836158 +27 0.23561944901923448 141.82548931412762 68.09857496093201 +28 0.24434609527920614 141.2210694644195 70.42073441788365 +29 0.2530727415391778 140.5964780354547 72.7214430369506 +30 0.2617993877991494 139.95190528383287 75.0 +31 0.27052603405912107 139.2875475526584 77.25571123650813 +32 0.2792526803190927 138.60360721173197 79.48788963498072 +33 0.28797932657906433 137.9002925959068 81.69585525225406 +34 0.296705972839036 137.17781794162812 83.87893552061203 +35 0.30543261909900765 136.4364033216744 86.03646545265696 +36 0.3141592653589793 135.67627457812105 88.16778784387098 +37 0.32288591161895097 134.89766325354694 90.27225347280722 +38 0.33161255787892263 134.10080652050416 92.34922129884876 +39 0.3403392041388943 133.28594710927283 94.3980586574756 +40 0.3490658503988659 132.45333323392336 96.41814145298089 +41 0.35779249665883756 131.6032185167079 98.40885434857609 +42 0.3665191429188092 130.73586191080454 100.36959095382873 +43 0.3752457891787809 129.85152762143775 102.29975400937477 +44 0.3839724354387525 128.95048502539885 104.19875556884958 +45 0.39269908169872414 128.03300858899107 106.06601717798215 +46 0.40142572795869574 127.09937778442483 107.90097005079764 +47 0.41015237421866746 126.14987700468738 109.70305524287555 +48 0.41887902047863906 125.18479547691435 111.47172382160912 +49 0.42760566673861067 124.20442717428804 113.20643703341575 +50 0.4363323129985824 123.20907072649044 114.90666646784672 +51 0.445058959258554 122.19902932873782 116.57189421854562 +52 0.45378560551852565 121.17461064942438 118.2016130410083 +53 0.4625122517784973 120.13612673640364 119.79532650709392 +54 0.47123889803846897 119.0838939219355 121.35254915624212 +55 0.4799655442984406 118.01823272632845 122.87280664334878 +56 0.4886921905584123 116.93946776030603 124.35563588325626 +57 0.4974188368183839 115.84792762612705 125.80058519181361 +58 0.5061454830783556 114.74394481749034 127.2072144234639 +59 0.5148721293383272 113.62785561825407 128.57509510531682 +60 0.5235987755982988 112.50000000000001 129.90381056766577 +61 0.5323254218582705 111.36072151847529 131.19295607090933 +62 0.5410520681182421 110.21036720894179 132.44213892883906 +63 0.5497787143782138 109.049287480466 133.6509786282552 +64 0.5585053606381855 107.87783600918081 134.81910694487505 +65 0.5672320068981571 106.69636963055244 135.94616805549754 +66 0.5759586531581287 105.50524823068503 137.03181864639012 +67 0.5846852994181004 104.30483463669552 138.07572801786608 +68 0.593411945678072 103.09549450619338 139.07757818501813 +69 0.6021385919380438 101.8775962158975 140.0370639745803 +70 0.6108652381980153 100.65151074942517 140.95389311788625 +71 0.619591884457987 99.41761158428675 141.82778633989753 +72 0.6283185307179586 98.17627457812105 142.65847744427305 +73 0.6370451769779303 96.92787785420526 143.4457133944553 +74 0.6457718232379019 95.67280168627494 144.1892543907478 +75 0.6544984694978736 94.41142838268905 144.88887394336024 +76 0.6632251157578453 93.14414216997507 145.54435894139948 +77 0.6719517620178168 91.87132907578986 146.15550971778526 +78 0.6806784082777886 90.59337681133194 146.72214011007085 +79 0.6894050545377601 89.31067465324087 147.24407751714958 +80 0.6981317007977318 88.02361332501977 147.72116295183122 +81 0.7068583470577035 86.73258487801732 148.15325108927067 +82 0.7155849933176751 85.43798257200493 148.54021031123557 +83 0.7243116395776468 84.14020075538608 148.8819227461983 +84 0.7330382858376184 82.83963474507401 149.17828430524102 +85 0.74176493209759 81.53668070607438 149.4292047137618 +86 0.7504915783575618 80.23173553080939 149.63460753897365 +87 0.7592182246175333 78.92519671822077 149.7944302131861 +88 0.767944870877505 77.61746225268757 149.90862405286435 +89 0.7766715171374766 76.30893048279626 149.97715427345867 +90 0.7853981633974483 75.0 150.00000000000003 +91 0.7941248096574199 73.69106951720374 149.97715427345867 +92 0.8028514559173915 72.38253774731243 149.90862405286435 +93 0.8115781021773633 71.07480328177923 149.7944302131861 +94 0.8203047484373349 69.76826446919061 149.63460753897365 +95 0.8290313946973066 68.46331929392565 149.42920471376186 +96 0.8377580409572781 67.16036525492602 149.17828430524102 +97 0.8464846872172498 65.85979924461398 148.88192274619828 +98 0.8552113334772213 64.56201742799509 148.5402103112355 +99 0.8639379797371932 63.267415121982644 148.15325108927067 +100 0.8726646259971648 61.97638667498025 147.72116295183125 +101 0.8813912722571364 60.68932534675913 147.24407751714958 +102 0.890117918517108 59.40662318866806 146.72214011007085 +103 0.8988445647770796 58.128670924210134 146.15550971778535 +104 0.9075712110370513 56.85585783002493 145.54435894139948 +105 0.9162978572970231 55.58857161731093 144.8888739433602 +106 0.9250245035569946 54.327198313725084 144.1892543907479 +107 0.9337511498169663 53.07212214579476 143.44571339445528 +108 0.9424777960769379 51.82372542187894 142.65847744427305 +109 0.9512044423369095 50.58238841571326 141.8277863398975 +110 0.9599310885968813 49.34848925057483 140.95389311788625 +111 0.9686577348568529 48.12240378410246 140.03706397458024 +112 0.9773843811168246 46.90450549380659 139.07757818501813 +113 0.9861110273767961 45.69516536330446 138.07572801786603 +114 0.9948376736367678 44.49475176931499 137.03181864639015 +115 1.0035643198967394 43.30363036944755 135.94616805549754 +116 1.0122909661567112 42.122163990819196 134.81910694487505 +117 1.0210176124166828 40.95071251953399 133.6509786282552 +118 1.0297442586766543 39.78963279105821 132.44213892883906 +119 1.038470904936626 38.639278481524734 131.1929560709094 +120 1.0471975511965976 37.50000000000001 129.9038105676658 +121 1.0559241974565694 36.37214438174595 128.57509510531682 +122 1.064650843716541 35.25605518250966 127.20721442346392 +123 1.0733774899765127 34.15207237387297 125.80058519181362 +124 1.0821041362364843 33.06053223969398 124.35563588325626 +125 1.0908307824964558 31.98176727367156 122.87280664334881 +126 1.0995574287564276 30.916106078064505 121.35254915624212 +127 1.1082840750163994 29.863873263596364 119.7953265070939 +128 1.117010721276371 28.82538935057562 118.2016130410083 +129 1.1257373675363425 27.800970671262213 116.57189421854565 +130 1.1344640137963142 26.79092927350954 114.90666646784672 +131 1.1431906600562858 25.79557282571197 113.20643703341578 +132 1.1519173063162573 24.815204523085658 111.47172382160916 +133 1.160643952576229 23.850122995312606 109.70305524287556 +134 1.1693705988362009 22.900622215575172 107.90097005079764 +135 1.1780972450961724 21.96699141100894 106.06601717798215 +136 1.186823891356144 21.04951497460116 104.19875556884962 +137 1.1955505376161157 20.148472378562207 102.2997540093748 +138 1.2042771838760875 19.264138089195423 100.36959095382869 +139 1.213003830136059 18.396781483292106 98.40885434857609 +140 1.2217304763960306 17.546666766076648 96.41814145298093 +141 1.2304571226560024 16.714052890727167 94.3980586574756 +142 1.239183768915974 15.899193479495866 92.34922129884875 +143 1.2479104151759455 15.102336746453046 90.27225347280728 +144 1.2566370614359172 14.323725421878933 88.16778784387098 +145 1.265363707695889 13.563596678325606 86.03646545265688 +146 1.2740903539558606 12.82218205837187 83.87893552061203 +147 1.2828170002158321 12.099707404093204 81.69585525225413 +148 1.2915436464758039 11.396392788268045 79.48788963498072 +149 1.3002702927357754 10.712452447341583 77.25571123650812 +150 1.3089969389957472 10.048094716167096 74.99999999999999 +151 1.3177235852557188 9.40352196454532 72.72144303695057 +152 1.3264502315156905 8.778930535580475 70.4207344178836 +153 1.335176877775662 8.174510685872416 68.09857496093207 +154 1.3439035240356336 7.590446527562489 65.75567201836162 +155 1.3526301702956054 7.026915972251246 63.392739261104914 +156 1.3613568165555772 6.484090676804918 61.01049646136999 +157 1.3700834628155487 5.962135991066964 58.60966927339109 +158 1.3788101090755203 5.461210907490943 56.19098901238681 +159 1.3875367553354918 4.981468012709886 53.755192431795116 +160 1.3962634015954636 4.523053441056868 51.30302149885036 +161 1.4049900478554354 4.086106830051229 48.83522316857348 +162 1.413716694115407 3.6707612778634853 46.35254915624214 +163 1.4224433403753785 3.2771433027723424 43.85575570841059 +164 1.4311699866353502 2.9053728046260745 41.34560337254987 +165 1.4398966328953218 2.5555630283198685 38.82285676537818 +166 1.4486232791552935 2.227820529300248 36.288284339950145 +167 1.457349925415265 1.9222451411073482 33.742658151579796 +168 1.4660765716752369 1.6389299449645818 31.186753622663918 +169 1.4748032179352084 1.37796124142521 28.62134930648175 +170 1.48352986419518 1.1394185240843986 26.047226650039608 +171 1.4922565104551517 0.9233744553646506 23.46516975603466 +172 1.5009831567151235 0.7298948443822312 20.875965144009783 +173 1.509709802975095 0.5590386269008513 18.280401510772162 +174 1.5184364492350666 0.4108578473795116 15.67926949014806 +175 1.5271630954950384 0.28539764311909244 13.073361412148754 +176 1.53588974175501 0.1826962305131935 10.463471061618844 +177 1.5446163880149815 0.10278489340696251 7.8503934364416255 +178 1.5533430342749532 0.04568797356781784 5.234924505375181 +179 1.562069680534925 0.011422863270654782 2.6178609655925094 +180 1.5707963267948966 0.0 -0.0 +181 1.579522973054868 0.011422863270654782 -2.617860965592476 +182 1.5882496193148399 0.04568797356781784 -5.234924505375147 +183 1.5969762655748114 0.10278489340696251 -7.850393436441525 +184 1.605702911834783 0.1826962305131935 -10.46347106161871 +185 1.6144295580947547 0.28539764311905913 -13.073361412148694 +186 1.6231562043547265 0.4108578473795116 -15.679269490148027 +187 1.6318828506146983 0.5590386269008513 -18.280401510772162 +188 1.6406094968746698 0.7298948443822312 -20.875965144009815 +189 1.6493361431346414 0.9233744553646506 -23.465169756034594 +190 1.6580627893946132 1.1394185240843901 -26.047226650039576 +191 1.6667894356545847 1.3779612414251936 -28.621349306481722 +192 1.6755160819145563 1.6389299449645818 -31.186753622663844 +193 1.684242728174528 1.9222451411073398 -33.74265815157973 +194 1.6929693744344996 2.227820529300248 -36.28828433995011 +195 1.7016960206944711 2.55556302831986 -38.82285676537804 +196 1.7104226669544427 2.905372804626066 -41.34560337254981 +197 1.7191493132144147 3.277143302772334 -43.85575570841053 +198 1.7278759594743864 3.6707612778634853 -46.352549156242176 +199 1.736602605734358 4.086106830051237 -48.835223168573506 +200 1.7453292519943295 4.5230534410568595 -51.3030214988503 +201 1.7540558982543013 4.981468012709877 -53.75519243179504 +202 1.7627825445142729 5.461210907490943 -56.19098901238681 +203 1.7715091907742444 5.962135991066956 -58.60966927339103 +204 1.780235837034216 6.484090676804918 -61.01049646136999 +205 1.7889624832941877 7.026915972251246 -63.392739261104914 +206 1.7976891295541593 7.590446527562456 -65.75567201836158 +207 1.8064157758141308 8.174510685872374 -68.09857496093194 +208 1.8151424220741026 8.778930535580475 -70.4207344178836 +209 1.8238690683340746 9.403521964545345 -72.7214430369506 +210 1.8325957145940461 10.048094716167096 -75.00000000000003 +211 1.8413223608540177 10.712452447341583 -77.25571123650812 +212 1.8500490071139892 11.396392788268045 -79.48788963498072 +213 1.858775653373961 12.099707404093197 -81.69585525225406 +214 1.8675022996339325 12.822182058371862 -83.878935520612 +215 1.876228945893904 13.563596678325606 -86.03646545265688 +216 1.8849555921538759 14.323725421878933 -88.16778784387095 +217 1.8936822384138474 15.10233674645303 -90.2722534728072 +218 1.902408884673819 15.899193479495825 -92.3492212988487 +219 1.9111355309337907 16.714052890727167 -94.3980586574756 +220 1.9198621771937625 17.54666676607664 -96.41814145298088 +221 1.9285888234537343 18.396781483292106 -98.40885434857609 +222 1.9373154697137058 19.26413808919543 -100.36959095382875 +223 1.9460421159736774 20.1484723785622 -102.29975400937475 +224 1.9547687622336491 21.04951497460116 -104.1987555688496 +225 1.9634954084936207 21.96699141100894 -106.06601717798213 +226 1.9722220547535922 22.900622215575172 -107.90097005079764 +227 1.980948701013564 23.850122995312606 -109.70305524287556 +228 1.9896753472735356 24.815204523085633 -111.47172382160907 +229 1.9984019935335071 25.795572825711936 -113.20643703341574 +230 2.007128639793479 26.790929273509523 -114.90666646784666 +231 2.015855286053451 27.80097067126222 -116.57189421854568 +232 2.0245819323134224 28.82538935057565 -118.20161304100832 +233 2.033308578573394 29.86387326359639 -119.79532650709392 +234 2.0420352248333655 30.916106078064505 -121.35254915624212 +235 2.050761871093337 31.981767273671505 -122.87280664334871 +236 2.0594885173533086 33.06053223969395 -124.35563588325621 +237 2.0682151636132806 34.15207237387297 -125.80058519181362 +238 2.076941809873252 35.256055182509634 -127.20721442346387 +239 2.0856684561332237 36.37214438174592 -128.57509510531682 +240 2.0943951023931953 37.49999999999996 -129.90381056766577 +241 2.103121748653167 38.63927848152465 -131.1929560709093 +242 2.111848394913139 39.789632791058196 -132.44213892883903 +243 2.1205750411731104 40.95071251953399 -133.6509786282552 +244 2.129301687433082 42.122163990819175 -134.81910694487502 +245 2.138028333693054 43.30363036944755 -135.94616805549754 +246 2.1467549799530254 44.49475176931498 -137.03181864639012 +247 2.155481626212997 45.69516536330446 -138.07572801786603 +248 2.1642082724729685 46.90450549380659 -139.07757818501813 +249 2.17293491873294 48.12240378410241 -140.03706397458024 +250 2.1816615649929116 49.34848925057481 -140.95389311788622 +251 2.1903882112528836 50.58238841571323 -141.82778633989756 +252 2.199114857512855 51.82372542187893 -142.65847744427302 +253 2.2078415037728267 53.07212214579472 -143.4457133944553 +254 2.2165681500327987 54.32719831372507 -144.18925439074786 +255 2.2252947962927703 55.58857161731093 -144.8888739433602 +256 2.234021442552742 56.85585783002492 -145.54435894139948 +257 2.2427480888127134 58.12867092421011 -146.1555097177853 +258 2.251474735072685 59.40662318866803 -146.72214011007085 +259 2.260201381332657 60.68932534675916 -147.24407751714955 +260 2.2689280275926285 61.97638667498025 -147.72116295183125 +261 2.2776546738526 63.267415121982665 -148.15325108927064 +262 2.2863813201125716 64.56201742799506 -148.5402103112355 +263 2.295107966372543 65.85979924461391 -148.88192274619828 +264 2.3038346126325147 67.16036525492594 -149.17828430524096 +265 2.3125612588924866 68.46331929392564 -149.42920471376186 +266 2.321287905152458 69.76826446919057 -149.63460753897365 +267 2.33001455141243 71.07480328177923 -149.79443021318605 +268 2.3387411976724017 72.38253774731245 -149.90862405286435 +269 2.3474678439323733 73.69106951720374 -149.97715427345867 +270 2.356194490192345 75.0 -150.00000000000003 +271 2.3649211364523164 76.30893048279623 -149.9771542734587 +272 2.373647782712288 77.61746225268753 -149.90862405286435 +273 2.3823744289722595 78.92519671822072 -149.7944302131861 +274 2.3911010752322315 80.23173553080939 -149.63460753897365 +275 2.399827721492203 81.53668070607432 -149.4292047137618 +276 2.408554367752175 82.83963474507404 -149.17828430524096 +277 2.4172810140121466 84.14020075538606 -148.88192274619826 +278 2.426007660272118 85.43798257200491 -148.54021031123554 +279 2.4347343065320897 86.73258487801728 -148.15325108927067 +280 2.443460952792061 88.02361332501974 -147.72116295183122 +281 2.4521875990520328 89.31067465324081 -147.2440775171496 +282 2.4609142453120048 90.59337681133195 -146.72214011007082 +283 2.4696408915719763 91.87132907578984 -146.1555097177853 +284 2.478367537831948 93.14414216997505 -145.54435894139948 +285 2.4870941840919194 94.41142838268902 -144.88887394336027 +286 2.495820830351891 95.6728016862749 -144.18925439074783 +287 2.504547476611863 96.92787785420526 -143.4457133944553 +288 2.5132741228718345 98.17627457812102 -142.65847744427307 +289 2.522000769131806 99.41761158428673 -141.8277863398975 +290 2.530727415391778 100.65151074942517 -140.95389311788625 +291 2.5394540616517496 101.87759621589754 -140.03706397458026 +292 2.548180707911721 103.09549450619336 -139.07757818501813 +293 2.5569073541716927 104.30483463669552 -138.07572801786608 +294 2.5656340004316642 105.50524823068496 -137.03181864639018 +295 2.574360646691636 106.69636963055241 -135.94616805549754 +296 2.5830872929516078 107.87783600918081 -134.81910694487505 +297 2.5918139392115793 109.049287480466 -133.6509786282552 +298 2.600540585471551 110.21036720894179 -132.44213892883906 +299 2.609267231731523 111.36072151847529 -131.19295607090933 +300 2.6179938779914944 112.5 -129.9038105676658 +301 2.626720524251466 113.62785561825406 -128.57509510531682 +302 2.6354471705114375 114.74394481749033 -127.20721442346392 +303 2.644173816771409 115.84792762612699 -125.80058519181361 +304 2.652900463031381 116.93946776030603 -124.35563588325626 +305 2.6616271092913526 118.01823272632845 -122.87280664334877 +306 2.670353755551324 119.0838939219355 -121.35254915624212 +307 2.6790804018112957 120.13612673640358 -119.79532650709396 +308 2.6878070480712672 121.17461064942432 -118.20161304100833 +309 2.696533694331239 122.19902932873775 -116.57189421854568 +310 2.705260340591211 123.20907072649044 -114.90666646784672 +311 2.7139869868511823 124.20442717428801 -113.20643703341584 +312 2.7227136331111543 125.18479547691437 -111.47172382160912 +313 2.731440279371126 126.14987700468738 -109.70305524287555 +314 2.7401669256310974 127.09937778442479 -107.90097005079768 +315 2.748893571891069 128.03300858899107 -106.06601717798215 +316 2.7576202181510405 128.95048502539882 -104.19875556884965 +317 2.766346864411012 129.85152762143775 -102.29975400937484 +318 2.7750735106709836 130.73586191080452 -100.36959095382883 +319 2.7838001569309556 131.6032185167079 -98.40885434857609 +320 2.792526803190927 132.45333323392333 -96.41814145298096 +321 2.801253449450899 133.28594710927283 -94.39805865747559 +322 2.8099800957108707 134.10080652050416 -92.3492212988487 +323 2.8187067419708423 134.89766325354694 -90.27225347280722 +324 2.827433388230814 135.67627457812105 -88.16778784387098 +325 2.8361600344907854 136.4364033216744 -86.03646545265696 +326 2.844886680750757 137.1778179416281 -83.87893552061209 +327 2.853613327010729 137.9002925959068 -81.69585525225406 +328 2.8623399732707004 138.60360721173197 -79.48788963498072 +329 2.871066619530672 139.2875475526584 -77.25571123650819 +330 2.8797932657906435 139.95190528383287 -75.00000000000006 +331 2.888519912050615 140.59647803545465 -72.72144303695065 +332 2.897246558310587 141.22106946441951 -70.42073441788365 +333 2.9059732045705586 141.8254893141276 -68.09857496093207 +334 2.91469985083053 142.40955347243752 -65.75567201836171 +335 2.923426497090502 142.97308402774874 -63.392739261104914 +336 2.9321531433504737 143.51590932319507 -61.01049646137005 +337 2.9408797896104453 144.037864008933 -58.60966927339108 +338 2.949606435870417 144.53878909250906 -56.19098901238686 +339 2.9583330821303884 145.01853198729012 -53.755192431795116 +340 2.96705972839036 145.47694655894313 -51.30302149885043 +341 2.975786374650332 145.91389316994875 -48.83522316857347 +342 2.9845130209103035 146.3292387221365 -46.35254915624214 +343 2.993239667170275 146.72285669722766 -43.85575570841059 +344 3.001966313430247 147.0946271953739 -41.34560337254987 +345 3.0106929596902186 147.44443697168012 -38.82285676537812 +346 3.01941960595019 147.7721794706997 -36.2882843399502 +347 3.0281462522101616 148.07775485889266 -33.7426581515798 +348 3.036872898470133 148.3610700550354 -31.186753622663986 +349 3.045599544730105 148.6220387585748 -28.62134930648169 +350 3.0543261909900767 148.86058147591564 -26.047226650039544 +351 3.0630528372500483 149.07662554463533 -23.465169756034662 +352 3.07177948351002 149.27010515561776 -20.87596514400992 +353 3.0805061297699914 149.44096137309913 -18.28040151077223 +354 3.089232776029963 149.58914215262047 -15.679269490148123 +355 3.097959422289935 149.71460235688093 -13.073361412148758 +356 3.1066860685499065 149.81730376948684 -10.463471061618847 +357 3.1154127148098785 149.89721510659302 -7.8503934364414905 +358 3.12413936106985 149.95431202643218 -5.234924505375115 +359 3.1328660073298216 149.98857713672936 -2.6178609655925102 +360 3.141592653589793 150.0 -6.661338147750939e-14 +361 3.1503192998497647 149.98857713672936 2.617860965592477 +362 3.159045946109736 149.95431202643218 5.234924505375048 +363 3.1677725923697078 149.89721510659302 7.850393436441458 +364 3.1764992386296798 149.81730376948684 10.463471061618781 +365 3.1852258848896513 149.71460235688093 13.073361412148692 +366 3.193952531149623 149.58914215262047 15.679269490147922 +367 3.2026791774095944 149.44096137309916 18.280401510771995 +368 3.211405823669566 149.27010515561778 20.87596514400969 +369 3.2201324699295375 149.07662554463536 23.465169756034463 +370 3.2288591161895095 148.86058147591564 26.04722665003948 +371 3.237585762449481 148.6220387585748 28.621349306481626 +372 3.246312408709453 148.36107005503544 31.186753622663918 +373 3.255039054969425 148.07775485889266 33.74265815157987 +374 3.2637657012293966 147.7721794706997 36.28828433995024 +375 3.272492347489368 147.44443697168012 38.822856765378184 +376 3.2812189937493397 147.09462719537387 41.34560337254989 +377 3.2899456400093112 146.72285669722766 43.85575570841053 +378 3.2986722862692828 146.32923872213652 46.35254915624208 +379 3.3073989325292543 145.91389316994875 48.835223168573435 +380 3.3161255787892263 145.47694655894313 51.303021498850356 +381 3.324852225049198 145.01853198729012 53.755192431795045 +382 3.3335788713091694 144.53878909250906 56.19098901238679 +383 3.342305517569141 144.03786400893304 58.60966927339103 +384 3.3510321638291125 143.5159093231951 61.010496461369975 +385 3.359758810089084 142.9730840277488 63.392739261104815 +386 3.368485456349056 142.40955347243752 65.75567201836161 +387 3.3772121026090276 141.8254893141276 68.09857496093198 +388 3.385938748868999 141.22106946441951 70.42073441788355 +389 3.3946653951289707 140.5964780354547 72.72144303695046 +390 3.4033920413889422 139.9519052838329 74.99999999999987 +391 3.412118687648914 139.28754755265848 77.255711236508 +392 3.4208453339088853 138.603607211732 79.4878896349806 +393 3.4295719801688573 137.90029259590685 81.695855252254 +394 3.4382986264288293 137.17781794162812 83.87893552061205 +395 3.447025272688801 136.4364033216744 86.03646545265688 +396 3.455751918948773 135.67627457812102 88.16778784387103 +397 3.4644785652087444 134.89766325354697 90.27225347280731 +398 3.473205211468716 134.10080652050414 92.34922129884875 +399 3.4819318577286875 133.28594710927283 94.39805865747563 +400 3.490658503988659 132.45333323392336 96.41814145298089 +401 3.4993851502486306 131.6032185167079 98.40885434857603 +402 3.5081117965086026 130.73586191080454 100.36959095382879 +403 3.516838442768574 129.85152762143775 102.29975400937477 +404 3.5255650890285457 128.95048502539885 104.19875556884958 +405 3.5342917352885173 128.0330085889911 106.0660171779821 +406 3.543018381548489 127.09937778442482 107.90097005079764 +407 3.5517450278084604 126.1498770046874 109.70305524287551 +408 3.560471674068432 125.18479547691442 111.47172382160905 +409 3.569198320328404 124.20442717428803 113.20643703341578 +410 3.5779249665883754 123.20907072649047 114.90666646784665 +411 3.586651612848347 122.19902932873785 116.57189421854555 +412 3.5953782591083185 121.1746106494244 118.2016130410082 +413 3.60410490536829 120.13612673640367 119.79532650709385 +414 3.6128315516282616 119.08389392193554 121.352549156242 +415 3.6215581978882336 118.01823272632849 122.87280664334872 +416 3.630284844148205 116.93946776030603 124.3556358832562 +417 3.639011490408177 115.84792762612705 125.8005851918136 +418 3.647738136668149 114.74394481749033 127.20721442346394 +419 3.6564647829281207 113.62785561825403 128.57509510531688 +420 3.6651914291880923 112.49999999999999 129.90381056766583 +421 3.673918075448064 111.36072151847527 131.1929560709094 +422 3.6826447217080354 110.21036720894182 132.44213892883903 +423 3.691371367968007 109.04928748046603 133.65097862825513 +424 3.7000980142279785 107.87783600918083 134.81910694487502 +425 3.7088246604879505 106.69636963055244 135.94616805549748 +426 3.717551306747922 105.50524823068501 137.03181864639012 +427 3.7262779530078936 104.30483463669553 138.07572801786603 +428 3.735004599267865 103.09549450619343 139.07757818501807 +429 3.7437312455278366 101.87759621589755 140.0370639745802 +430 3.752457891787808 100.6515107494252 140.95389311788622 +431 3.76118453804778 99.41761158428673 141.8277863398975 +432 3.7699111843077517 98.17627457812105 142.65847744427302 +433 3.7786378305677233 96.92787785420528 143.4457133944553 +434 3.787364476827695 95.67280168627497 144.18925439074778 +435 3.7960911230876664 94.41142838268912 144.88887394336015 +436 3.804817769347638 93.14414216997514 145.5443589413994 +437 3.8135444156076095 91.87132907578996 146.15550971778526 +438 3.8222710618675815 90.593376811332 146.7221401100708 +439 3.8309977081275535 89.31067465324085 147.2440775171496 +440 3.839724354387525 88.0236133250198 147.7211629518312 +441 3.848451000647497 86.73258487801728 148.15325108927067 +442 3.8571776469074686 85.43798257200487 148.54021031123554 +443 3.86590429316744 84.14020075538605 148.88192274619828 +444 3.8746309394274117 82.83963474507401 149.17828430524102 +445 3.883357585687383 81.53668070607439 149.42920471376183 +446 3.8920842319473548 80.2317355308094 149.6346075389736 +447 3.9008108782073267 78.92519671822077 149.79443021318605 +448 3.9095375244672983 77.61746225268755 149.90862405286435 +449 3.91826417072727 76.30893048279626 149.97715427345867 +450 3.9269908169872414 75.00000000000001 150.0 +451 3.935717463247213 73.69106951720377 149.97715427345867 +452 3.9444441095071845 72.38253774731248 149.90862405286435 +453 3.953170755767156 71.07480328177928 149.7944302131861 +454 3.961897402027128 69.76826446919061 149.63460753897365 +455 3.9706240482870996 68.46331929392566 149.4292047137618 +456 3.979350694547071 67.16036525492603 149.17828430524102 +457 3.9880773408070427 65.859799244614 148.88192274619828 +458 3.9968039870670142 64.56201742799516 148.54021031123554 +459 4.005530633326986 63.267415121982765 148.15325108927067 +460 4.014257279586958 61.97638667498026 147.72116295183122 +461 4.022983925846929 60.68932534675927 147.2440775171496 +462 4.031710572106902 59.406623188667986 146.7221401100708 +463 4.040437218366873 58.128670924210155 146.1555097177853 +464 4.049163864626845 56.855857830024895 145.54435894139945 +465 4.057890510886816 55.588571617311 144.88887394336027 +466 4.066617157146788 54.32719831372507 144.1892543907478 +467 4.07534380340676 53.07212214579471 143.4457133944553 +468 4.084070449666731 51.823725421878954 142.65847744427305 +469 4.092797095926703 50.58238841571321 141.8277863398975 +470 4.101523742186674 49.348489250574886 140.95389311788625 +471 4.110250388446646 48.12240378410246 140.03706397458024 +472 4.118977034706617 46.90450549380667 139.07757818501815 +473 4.127703680966589 45.6951653633045 138.07572801786608 +474 4.136430327226561 44.49475176931497 137.03181864639012 +475 4.145156973486532 43.30363036944761 135.94616805549754 +476 4.153883619746504 42.122163990819196 134.81910694487505 +477 4.162610266006475 40.95071251953409 133.65097862825527 +478 4.171336912266447 39.789632791058246 132.44213892883909 +479 4.1800635585264185 38.63927848152484 131.19295607090947 +480 4.1887902047863905 37.50000000000006 129.90381056766583 +481 4.1975168510463625 36.372144381745954 128.57509510531685 +482 4.206243497306334 35.256055182509705 127.20721442346402 +483 4.214970143566306 34.152072373873 125.80058519181364 +484 4.223696789826278 33.06053223969398 124.35563588325626 +485 4.23242343608625 31.981767273671498 122.87280664334867 +486 4.241150082346221 30.91610607806453 121.35254915624213 +487 4.249876728606193 29.863873263596364 119.7953265070939 +488 4.258603374866164 28.82538935057567 118.20161304100833 +489 4.267330021126136 27.800970671262203 116.57189421854561 +490 4.276056667386108 26.790929273509516 114.90666646784662 +491 4.284783313646079 25.795572825711986 113.20643703341585 +492 4.293509959906051 24.81520452308564 111.47172382160912 +493 4.302236606166022 23.850122995312663 109.70305524287565 +494 4.310963252425994 22.900622215575222 107.9009700507977 +495 4.319689898685965 21.966991411008998 106.06601717798223 +496 4.328416544945937 21.04951497460117 104.19875556884968 +497 4.337143191205909 20.1484723785622 102.29975400937475 +498 4.34586983746588 19.264138089195466 100.36959095382882 +499 4.354596483725852 18.396781483292106 98.40885434857611 +500 4.363323129985823 17.546666766076697 96.41814145298106 +501 4.372049776245795 16.714052890727224 94.39805865747572 +502 4.380776422505767 15.899193479495866 92.34922129884875 +503 4.389503068765738 15.102336746453087 90.27225347280735 +504 4.39822971502571 14.32372542187894 88.16778784387103 +505 4.4069563612856815 13.56359667832569 86.03646545265705 +506 4.4156830075456535 12.822182058371911 83.87893552061213 +507 4.4244096538056255 12.099707404093197 81.69585525225406 +508 4.4331363000655974 11.39639278826802 79.48788963498065 +509 4.4418629463255686 10.712452447341592 77.25571123650819 +510 4.4505895925855405 10.048094716167089 74.99999999999997 +511 4.4593162388455125 9.40352196454527 72.72144303695045 +512 4.468042885105484 8.778930535580484 70.42073441788365 +513 4.476769531365456 8.174510685872399 68.09857496093193 +514 4.485496177625427 7.590446527562506 65.75567201836171 +515 4.494222823885399 7.026915972251246 63.392739261104914 +516 4.50294947014537 6.484090676804969 61.010496461370174 +517 4.511676116405342 5.962135991066997 58.60966927339108 +518 4.520402762665314 5.461210907490935 56.190989012386744 +519 4.529129408925285 4.981468012709886 53.755192431795116 +520 4.537856055185257 4.5230534410568595 51.3030214988503 +521 4.546582701445228 4.0861068300512615 48.83522316857363 +522 4.5553093477052 3.6707612778634853 46.35254915624218 +523 4.564035993965171 3.277143302772351 43.85575570841071 +524 4.572762640225143 2.9053728046261 41.34560337255 +525 4.581489286485115 2.5555630283198685 38.82285676537811 +526 4.590215932745086 2.2278205293002977 36.28828433995034 +527 4.598942579005058 1.9222451411073482 33.74265815157983 +528 4.607669225265029 1.638929944964615 31.18675362266411 +529 4.616395871525002 1.3779612414251852 28.621349306481587 +530 4.625122517784973 1.1394185240843901 26.047226650039576 +531 4.633849164044945 0.9233744553646506 23.465169756034562 +532 4.642575810304916 0.7298948443822395 20.875965144009914 +533 4.651302456564888 0.5590386269008513 18.280401510772094 +534 4.66002910282486 0.41085784737950326 15.679269490147892 +535 4.6687557490848315 0.28539764311909244 13.073361412148756 +536 4.6774823953448035 0.1826962305131935 10.463471061618746 +537 4.686209041604775 0.10278489340696251 7.85039343644169 +538 4.694935687864747 0.04568797356781784 5.234924505375147 +539 4.703662334124718 0.011422863270654782 2.617860965592676 +540 4.71238898038469 0.0 6.661338147750939e-14 +541 4.721115626644662 0.011422863270654782 -2.617860965592576 +542 4.729842272904633 0.04568797356781784 -5.234924505375048 +543 4.738568919164605 0.10278489340696251 -7.850393436441557 +544 4.747295565424576 0.18269623051318518 -10.463471061618645 +545 4.756022211684548 0.28539764311909244 -13.073361412148623 +546 4.764748857944519 0.41085784737950326 -15.679269490147792 +547 4.773475504204491 0.559038626900818 -18.280401510771966 +548 4.782202150464463 0.7298948443822312 -20.875965144009783 +549 4.790928796724434 0.9233744553646422 -23.465169756034463 +550 4.799655442984406 1.1394185240843901 -26.047226650039473 +551 4.808382089244377 1.3779612414251852 -28.621349306481488 +552 4.81710873550435 1.6389299449646066 -31.186753622664042 +553 4.825835381764321 1.9222451411073398 -33.74265815157973 +554 4.834562028024293 2.2278205293002893 -36.2882843399502 +555 4.843288674284264 2.55556302831986 -38.82285676537804 +556 4.852015320544236 2.9053728046260745 -41.34560337254987 +557 4.860741966804208 3.2771433027723424 -43.85575570841059 +558 4.869468613064179 3.670761277863477 -46.35254915624208 +559 4.878195259324151 4.0861068300512535 -48.835223168573535 +560 4.886921905584122 4.5230534410568515 -51.303021498850235 +561 4.895648551844094 4.981468012709886 -53.755192431795045 +562 4.9043751981040655 5.461210907490926 -56.190989012386616 +563 4.9131018443640375 5.962135991066956 -58.60966927339103 +564 4.9218284906240095 6.484090676804927 -61.01049646137005 +565 4.930555136883981 7.0269159722512295 -63.39273926110477 +566 4.939281783143953 7.590446527562489 -65.75567201836157 +567 4.948008429403924 8.174510685872367 -68.09857496093187 +568 4.956735075663896 8.778930535580468 -70.42073441788351 +569 4.965461721923867 9.403521964545252 -72.72144303695033 +570 4.974188368183839 10.04809471616708 -74.99999999999987 +571 4.982915014443811 10.712452447341583 -77.2557112365081 +572 4.991641660703782 11.396392788268003 -79.48788963498053 +573 5.000368306963754 12.099707404093172 -81.695855252254 +574 5.009094953223726 12.82218205837187 -83.87893552061203 +575 5.017821599483698 13.56359667832564 -86.03646545265698 +576 5.026548245743669 14.323725421878924 -88.16778784387093 +577 5.035274892003641 15.102336746453046 -90.27225347280728 +578 5.044001538263612 15.899193479495816 -92.34922129884863 +579 5.052728184523584 16.714052890727192 -94.39805865747559 +580 5.061454830783556 17.546666766076648 -96.41814145298093 +581 5.070181477043527 18.39678148329208 -98.40885434857604 +582 5.078908123303499 19.26413808919545 -100.36959095382879 +583 5.08763476956347 20.14847237856215 -102.2997540093747 +584 5.096361415823442 21.049514974601152 -104.19875556884958 +585 5.105088062083414 21.966991411008973 -106.06601717798219 +586 5.113814708343385 22.900622215575172 -107.90097005079764 +587 5.122541354603357 23.850122995312606 -109.70305524287556 +588 5.1312680008633285 24.815204523085566 -111.47172382160905 +589 5.1399946471233005 25.795572825711947 -113.20643703341577 +590 5.148721293383272 26.790929273509473 -114.90666646784659 +591 5.1574479396432436 27.800970671262153 -116.57189421854555 +592 5.1661745859032155 28.82538935057562 -118.2016130410083 +593 5.174901232163187 29.863873263596314 -119.79532650709385 +594 5.183627878423159 30.916106078064505 -121.3525491562421 +595 5.19235452468313 31.981767273671448 -122.87280664334864 +596 5.201081170943102 33.060532239693934 -124.35563588325614 +597 5.209807817203074 34.15207237387296 -125.8005851918136 +598 5.218534463463046 35.25605518250966 -127.20721442346392 +599 5.227261109723017 36.37214438174587 -128.5750951053168 +600 5.235987755982989 37.50000000000001 -129.9038105676658 +601 5.244714402242961 38.63927848152477 -131.19295607090945 +602 5.253441048502932 39.789632791058196 -132.44213892883903 +603 5.262167694762904 40.95071251953401 -133.65097862825525 +604 5.270894341022875 42.12216399081916 -134.819106944875 +605 5.279620987282847 43.30363036944755 -135.94616805549754 +606 5.288347633542818 44.494751769314924 -137.03181864639006 +607 5.29707427980279 45.69516536330446 -138.07572801786603 +608 5.305800926062762 46.90450549380662 -139.07757818501813 +609 5.314527572322733 48.12240378410243 -140.0370639745802 +610 5.323254218582705 49.34848925057485 -140.95389311788622 +611 5.331980864842676 50.58238841571318 -141.82778633989747 +612 5.340707511102648 51.823725421878905 -142.65847744427302 +613 5.349434157362619 53.07212214579462 -143.44571339445523 +614 5.358160803622591 54.32719831372502 -144.18925439074778 +615 5.366887449882563 55.588571617310926 -144.8888739433602 +616 5.3756140961425345 56.85585783002482 -145.5443589413994 +617 5.3843407424025065 58.128670924210084 -146.15550971778526 +618 5.393067388662478 59.40662318866794 -146.7221401100708 +619 5.4017940349224505 60.68932534675921 -147.24407751714963 +620 5.410520681182422 61.97638667498021 -147.7211629518312 +621 5.419247327442394 63.26741512198272 -148.15325108927067 +622 5.427973973702365 64.56201742799503 -148.5402103112355 +623 5.436700619962337 65.85979924461398 -148.88192274619828 +624 5.445427266222309 67.16036525492603 -149.17828430524102 +625 5.45415391248228 68.46331929392561 -149.42920471376183 +626 5.462880558742252 69.76826446919063 -149.63460753897363 +627 5.471607205002223 71.07480328177917 -149.79443021318605 +628 5.480333851262195 72.38253774731241 -149.90862405286435 +629 5.489060497522166 73.69106951720363 -149.97715427345867 +630 5.497787143782138 74.99999999999999 -150.0 +631 5.50651379004211 76.30893048279628 -149.9771542734587 +632 5.515240436302081 77.61746225268752 -149.90862405286435 +633 5.523967082562053 78.92519671822077 -149.79443021318605 +634 5.532693728822024 80.23173553080932 -149.63460753897365 +635 5.541420375081996 81.53668070607432 -149.42920471376186 +636 5.550147021341967 82.83963474507388 -149.178284305241 +637 5.558873667601939 84.14020075538599 -148.88192274619834 +638 5.567600313861911 85.43798257200487 -148.54021031123554 +639 5.576326960121882 86.73258487801724 -148.1532510892707 +640 5.585053606381854 88.02361332501974 -147.72116295183122 +641 5.593780252641825 89.31067465324075 -147.24407751714966 +642 5.602506898901798 90.593376811332 -146.7221401100708 +643 5.611233545161769 91.87132907578986 -146.15550971778526 +644 5.619960191421741 93.14414216997508 -145.54435894139945 +645 5.6286868376817125 94.41142838268901 -144.88887394336027 +646 5.6374134839416845 95.67280168627494 -144.1892543907478 +647 5.6461401302016565 96.92787785420532 -143.44571339445528 +648 5.654866776461628 98.17627457812104 -142.65847744427305 +649 5.6635934227216 99.41761158428677 -141.82778633989747 +650 5.672320068981571 100.65151074942507 -140.95389311788628 +651 5.681046715241543 101.87759621589748 -140.03706397458026 +652 5.689773361501514 103.09549450619333 -139.07757818501815 +653 5.698500007761486 104.3048346366955 -138.07572801786608 +654 5.707226654021458 105.50524823068503 -137.03181864639012 +655 5.715953300281429 106.69636963055238 -135.94616805549754 +656 5.724679946541401 107.87783600918078 -134.81910694487505 +657 5.733406592801372 109.0492874804659 -133.6509786282553 +658 5.742133239061344 110.21036720894176 -132.44213892883909 +659 5.750859885321315 111.36072151847516 -131.19295607090953 +660 5.759586531581287 112.49999999999993 -129.9038105676659 +661 5.768313177841259 113.62785561825406 -128.57509510531688 +662 5.77703982410123 114.74394481749029 -127.20721442346401 +663 5.785766470361202 115.84792762612697 -125.80058519181367 +664 5.794493116621174 116.93946776030603 -124.35563588325626 +665 5.803219762881146 118.01823272632849 -122.87280664334872 +666 5.811946409141117 119.08389392193547 -121.35254915624215 +667 5.820673055401089 120.13612673640364 -119.79532650709392 +668 5.82939970166106 121.1746106494243 -118.20161304100837 +669 5.838126347921032 122.1990293287378 -116.57189421854565 +670 5.846852994181004 123.20907072649047 -114.90666646784665 +671 5.8555796404409755 124.20442717428801 -113.20643703341587 +672 5.8643062867009474 125.18479547691437 -111.47172382160912 +673 5.8730329329609186 126.14987700468733 -109.70305524287569 +674 5.8817595792208905 127.09937778442479 -107.90097005079771 +675 5.890486225480862 128.03300858899098 -106.06601717798225 +676 5.899212871740834 128.9504850253988 -104.19875556884968 +677 5.907939518000806 129.85152762143775 -102.29975400937477 +678 5.916666164260777 130.73586191080452 -100.36959095382883 +679 5.925392810520749 131.60321851670787 -98.40885434857616 +680 5.93411945678072 132.45333323392327 -96.41814145298109 +681 5.942846103040692 133.28594710927274 -94.39805865747569 +682 5.951572749300664 134.10080652050416 -92.34922129884876 +683 5.960299395560635 134.8976632535469 -90.2722534728074 +684 5.969026041820607 135.67627457812102 -88.167787843871 +685 5.977752688080578 136.43640332167433 -86.03646545265713 +686 5.98647933434055 137.17781794162806 -83.87893552061215 +687 5.995205980600522 137.9002925959068 -81.69585525225406 +688 6.003932626860494 138.60360721173197 -79.48788963498065 +689 6.012659273120465 139.2875475526584 -77.2557112365082 +690 6.021385919380437 139.95190528383287 -75.0 +691 6.030112565640409 140.59647803545474 -72.72144303695046 +692 6.03883921190038 141.2210694644195 -70.42073441788365 +693 6.047565858160352 141.82548931412762 -68.09857496093197 +694 6.056292504420323 142.40955347243752 -65.75567201836171 +695 6.065019150680295 142.97308402774874 -63.392739261104914 +696 6.073745796940266 143.51590932319505 -61.01049646137018 +697 6.082472443200238 144.03786400893304 -58.60966927339113 +698 6.09119908946021 144.5387890925091 -56.19098901238675 +699 6.0999257357201815 145.01853198729012 -53.75519243179515 +700 6.1086523819801535 145.47694655894313 -51.303021498850335 +701 6.117379028240125 145.91389316994875 -48.83522316857368 +702 6.126105674500097 146.32923872213652 -46.35254915624221 +703 6.134832320760068 146.72285669722766 -43.85575570841071 +704 6.14355896702004 147.0946271953739 -41.34560337255001 +705 6.152285613280012 147.44443697168012 -38.82285676537814 +706 6.161012259539983 147.77217947069974 -36.288284339950344 +707 6.169738905799955 148.07775485889266 -33.74265815157983 +708 6.178465552059926 148.36107005503538 -31.186753622664142 +709 6.187192198319899 148.6220387585748 -28.621349306481626 +710 6.19591884457987 148.8605814759156 -26.04722665003961 +711 6.204645490839842 149.07662554463536 -23.465169756034562 +712 6.213372137099813 149.27010515561776 -20.87596514400992 +713 6.222098783359785 149.44096137309916 -18.280401510772126 +714 6.230825429619757 149.58914215262047 -15.679269490147922 +715 6.239552075879728 149.71460235688093 -13.07336141214879 +716 6.2482787221397 149.81730376948678 -10.463471061618744 +717 6.257005368399671 149.89721510659302 -7.85039343644169 +718 6.265732014659643 149.95431202643218 -5.234924505375147 +719 6.274458660919614 149.98857713672933 -2.61786096559271 + +HARMONIC_2 +N 720 RADIANS + +0 0.0 0.0 -0.0 +1 0.008726646259971648 0.027412784140690705 -6.2819094064501355 +2 0.017453292519943295 0.10961773830790611 -12.55616527394248 +3 0.02617993877991494 0.24651470842771694 -18.81512338817758 +4 0.03490658503988659 0.4379369066293687 -25.051158172811725 +5 0.04363323129985824 0.6836511144506341 -31.25667198004754 +6 0.05235987755982988 0.983357966978734 -37.424104347196625 +7 0.061086523819801536 1.3366923175801637 -43.54594120794012 +8 0.06981317007977318 1.7432236827756546 -49.61472404705978 +9 0.07853981633974483 2.2024567667180763 -55.62305898749062 +10 0.08726646259971647 2.713832064634096 -61.56362579862038 +11 0.09599310885968812 3.276726544494581 -67.42918681486422 +12 0.10471975511965977 3.890454406082966 -73.21259575364407 +13 0.11344640137963141 4.554267916537463 -78.90680642203391 +14 0.12217304763960307 5.267358321348265 -84.50488130146033 +15 0.1308996938995747 6.028856829700248 -90.00000000000001 +16 0.13962634015954636 6.837835672960817 -95.38546756197688 +17 0.148352986419518 7.693309235023127 -100.65472262473446 +18 0.15707963267948966 8.594235253127374 -105.80134541264522 +19 0.16580627893946132 9.539516087697514 -110.81906555861842 +20 0.17453292519943295 10.528000059645974 -115.70176974357709 +21 0.1832595714594046 11.558482853517255 -120.44350914459449 +22 0.19198621771937624 12.629708984760681 -125.03850668261958 +23 0.20071286397934787 13.740373329345113 -129.48116406095727 +24 0.20943951023931953 14.889122713851378 -133.76606858593104 +25 0.2181661564992912 16.074557564105724 -137.88799976141604 +26 0.22689280275926282 17.295233610345345 -141.84193564920994 +27 0.23561944901923448 18.549663646838678 -145.6230589874906 +28 0.24434609527920614 19.836319343816424 -149.2267630599075 +29 0.2530727415391778 21.15363310950578 -152.64865730815677 +30 0.2617993877991494 22.50000000000001 -155.88457268119893 +31 0.27052603405912107 23.87377967463492 -158.93056671460687 +32 0.2792526803190927 25.273298394491498 -161.78292833385004 +33 0.28797932657906433 26.696851061588994 -164.43818237566816 +34 0.296705972839036 28.142703296283962 -166.8930938220218 +35 0.30543261909900765 29.60909355034492 -169.14467174146358 +36 0.3141592653589793 31.094235253127366 -171.19017293312768 +37 0.32288591161895097 32.59631898823504 -173.0271052688973 +38 0.33161255787892263 34.11351469801494 -174.65323072967948 +39 0.3403392041388943 35.64397391320081 -176.06656813208505 +40 0.3490658503988659 37.185832004988114 -177.26539554219747 +41 0.35779249665883756 38.73721045679706 -178.24825237348261 +42 0.3665191429188092 40.29621915295561 -179.01394116628916 +43 0.3752457891787809 41.86095868151437 -179.56152904676833 +44 0.3839724354387525 43.42952264838744 -179.89034886343723 +45 0.39269908169872414 45.00000000000002 -180.00000000000003 +46 0.40142572795869574 46.57047735161251 -179.8903488634373 +47 0.41015237421866746 48.139041318485646 -179.56152904676833 +48 0.41887902047863906 49.70378084704442 -179.0139411662891 +49 0.42760566673861067 51.262789543202935 -178.24825237348256 +50 0.4363323129985824 52.81416799501187 -177.26539554219747 +51 0.445058959258554 54.35602608679914 -176.0665681320851 +52 0.45378560551852565 55.88648530198504 -174.6532307296794 +53 0.4625122517784973 57.40368101176496 -173.02710526889746 +54 0.47123889803846897 58.905764746872634 -171.19017293312766 +55 0.4799655442984406 60.3909064496551 -169.14467174146353 +56 0.4886921905584123 61.85729670371604 -166.89309382202177 +57 0.4974188368183839 63.303148938411006 -164.43818237566816 +58 0.5061454830783556 64.7267016055085 -161.78292833385 +59 0.5148721293383272 66.12622032536507 -158.93056671460687 +60 0.5235987755982988 67.49999999999999 -155.88457268119902 +61 0.5323254218582705 68.8463668904942 -152.64865730815671 +62 0.5410520681182421 70.16368065618362 -149.22676305990743 +63 0.5497787143782138 71.4503363531613 -145.6230589874906 +64 0.5585053606381855 72.70476638965464 -141.84193564920994 +65 0.5672320068981571 73.9254424358943 -137.887999761416 +66 0.5759586531581287 75.11087728614861 -133.76606858593098 +67 0.5846852994181004 76.2596266706549 -129.4811640609572 +68 0.593411945678072 77.37029101523932 -125.03850668261944 +69 0.6021385919380438 78.44151714648277 -120.4435091445944 +70 0.6108652381980153 79.47199994035401 -115.70176974357716 +71 0.619591884457987 80.4604839123025 -110.81906555861849 +72 0.6283185307179586 81.40576474687263 -105.80134541264516 +73 0.6370451769779303 82.30669076497688 -100.65472262473438 +74 0.6457718232379019 83.16216432703916 -95.38546756197684 +75 0.6544984694978736 83.97114317029974 -89.99999999999999 +76 0.6632251157578453 84.73264167865172 -84.50488130146033 +77 0.6719517620178168 85.4457320834625 -78.90680642203387 +78 0.6806784082777886 86.10954559391705 -73.21259575364402 +79 0.6894050545377601 86.72327345550543 -67.42918681486411 +80 0.6981317007977318 87.2861679353659 -61.56362579862036 +81 0.7068583470577035 87.79754323328191 -55.62305898749052 +82 0.7155849933176751 88.25677631722436 -49.61472404705994 +83 0.7243116395776468 88.66330768241984 -43.545941207940224 +84 0.7330382858376184 89.01664203302126 -37.42410434719666 +85 0.74176493209759 89.31634888554936 -31.256671980047535 +86 0.7504915783575618 89.56206309337068 -25.051158172811732 +87 0.7592182246175333 89.7534852915723 -18.815123388177597 +88 0.767944870877505 89.89038226169208 -12.556165273942534 +89 0.7766715171374766 89.97258721585929 -6.281909406450126 +90 0.7853981633974483 90.0 -0.0 +91 0.7941248096574199 89.97258721585929 6.281909406450126 +92 0.8028514559173915 89.89038226169208 12.556165273942534 +93 0.8115781021773633 89.7534852915723 18.815123388177597 +94 0.8203047484373349 89.56206309337068 25.051158172811732 +95 0.8290313946973066 89.31634888554937 31.256671980047386 +96 0.8377580409572781 89.01664203302127 37.42410434719654 +97 0.8464846872172498 88.66330768241984 43.54594120794002 +98 0.8552113334772213 88.25677631722434 49.61472404705979 +99 0.8639379797371932 87.79754323328191 55.62305898749072 +100 0.8726646259971648 87.2861679353659 61.56362579862031 +101 0.8813912722571364 86.72327345550542 67.42918681486421 +102 0.890117918517108 86.10954559391705 73.21259575364402 +103 0.8988445647770796 85.44573208346254 78.90680642203387 +104 0.9075712110370513 84.73264167865172 84.50488130146033 +105 0.9162978572970231 83.97114317029973 90.00000000000004 +106 0.9250245035569946 83.1621643270392 95.38546756197682 +107 0.9337511498169663 82.30669076497686 100.65472262473436 +108 0.9424777960769379 81.40576474687263 105.80134541264516 +109 0.9512044423369095 80.4604839123025 110.81906555861842 +110 0.9599310885968813 79.47199994035401 115.70176974357716 +111 0.9686577348568529 78.44151714648272 120.44350914459453 +112 0.9773843811168246 77.3702910152393 125.03850668261954 +113 0.9861110273767961 76.25962667065488 129.48116406095718 +114 0.9948376736367678 75.11087728614864 133.76606858593098 +115 1.0035643198967394 73.9254424358943 137.887999761416 +116 1.0122909661567112 72.70476638965464 141.84193564920994 +117 1.0210176124166828 71.4503363531613 145.6230589874906 +118 1.0297442586766543 70.16368065618362 149.22676305990743 +119 1.038470904936626 68.84636689049425 152.64865730815666 +120 1.0471975511965976 67.5 155.8845726811989 +121 1.0559241974565694 66.12622032536508 158.93056671460678 +122 1.064650843716541 64.72670160550852 161.78292833384995 +123 1.0733774899765127 63.30314893841102 164.43818237566816 +124 1.0821041362364843 61.85729670371604 166.89309382202177 +125 1.0908307824964558 60.39090644965513 169.14467174146347 +126 1.0995574287564276 58.905764746872634 171.19017293312766 +127 1.1082840750163994 57.40368101176494 173.02710526889743 +128 1.117010721276371 55.88648530198504 174.6532307296794 +129 1.1257373675363425 54.35602608679919 176.06656813208497 +130 1.1344640137963142 52.814167995011864 177.2653955421975 +131 1.1431906600562858 51.262789543202956 178.24825237348256 +132 1.1519173063162573 49.70378084704444 179.01394116628916 +133 1.160643952576229 48.13904131848563 179.56152904676836 +134 1.1693705988362009 46.57047735161251 179.8903488634373 +135 1.1780972450961724 45.00000000000002 180.00000000000003 +136 1.186823891356144 43.42952264838747 179.89034886343728 +137 1.1955505376161157 41.86095868151437 179.56152904676838 +138 1.2042771838760875 40.296219152955565 179.0139411662892 +139 1.213003830136059 38.73721045679706 178.24825237348261 +140 1.2217304763960306 37.18583200498815 177.26539554219755 +141 1.2304571226560024 35.64397391320081 176.06656813208505 +142 1.239183768915974 34.11351469801496 174.65323072967934 +143 1.2479104151759455 32.59631898823506 173.02710526889743 +144 1.2566370614359172 31.094235253127366 171.19017293312768 +145 1.265363707695889 29.609093550344895 169.14467174146347 +146 1.2740903539558606 28.142703296283962 166.8930938220218 +147 1.2828170002158321 26.696851061589022 164.43818237566828 +148 1.2915436464758039 25.273298394491498 161.78292833385004 +149 1.3002702927357754 23.873779674634918 158.9305667146068 +150 1.3089969389957472 22.499999999999996 155.88457268119896 +151 1.3177235852557188 21.15363310950579 152.64865730815671 +152 1.3264502315156905 19.836319343816385 149.22676305990748 +153 1.335176877775662 18.549663646838727 145.62305898749062 +154 1.3439035240356336 17.295233610345395 141.84193564920997 +155 1.3526301702956054 16.074557564105724 137.88799976141604 +156 1.3613568165555772 14.889122713851354 133.7660685859309 +157 1.3700834628155487 13.740373329345113 129.48116406095727 +158 1.3788101090755203 12.629708984760697 125.03850668261954 +159 1.3875367553354918 11.558482853517294 120.4435091445946 +160 1.3962634015954636 10.528000059645994 115.7017697435772 +161 1.4049900478554354 9.5395160876975 110.81906555861845 +162 1.413716694115407 8.594235253127374 105.80134541264522 +163 1.4224433403753785 7.693309235023142 100.6547226247346 +164 1.4311699866353502 6.837835672960817 95.38546756197688 +165 1.4398966328953218 6.028856829700258 90.00000000000016 +166 1.4486232791552935 5.267358321348265 84.50488130146033 +167 1.457349925415265 4.5542679165374835 78.90680642203405 +168 1.4660765716752369 3.890454406082966 73.21259575364407 +169 1.4748032179352084 3.276726544494581 67.42918681486422 +170 1.48352986419518 2.713832064634131 61.5636257986205 +171 1.4922565104551517 2.2024567667180763 55.62305898749062 +172 1.5009831567151235 1.7432236827756498 49.61472404705977 +173 1.509709802975095 1.3366923175801686 43.545941207940274 +174 1.5184364492350666 0.983357966978759 37.424104347196774 +175 1.5271630954950384 0.6836511144506491 31.25667198004752 +176 1.53588974175501 0.4379369066293537 25.051158172811895 +177 1.5446163880149815 0.24651470842770196 18.815123388177746 +178 1.5533430342749532 0.10961773830790611 12.55616527394264 +179 1.562069680534925 0.027412784140690705 6.281909406450135 +180 1.5707963267948966 0.0 -0.0 +181 1.579522973054868 0.027412784140690705 -6.281909406450055 +182 1.5882496193148399 0.10961773830790611 -12.55616527394256 +183 1.5969762655748114 0.24651470842769696 -18.815123388177504 +184 1.605702911834783 0.4379369066293487 -25.051158172811576 +185 1.6144295580947547 0.6836511144506091 -31.2566719800474 +186 1.6231562043547265 0.983357966978754 -37.42410434719669 +187 1.6318828506146983 1.3366923175801686 -43.545941207940274 +188 1.6406094968746698 1.7432236827756546 -49.61472404705985 +189 1.6493361431346414 2.202456766718066 -55.62305898749046 +190 1.6580627893946132 2.7138320646341207 -61.56362579862043 +191 1.6667894356545847 3.276726544494561 -67.42918681486417 +192 1.6755160819145563 3.890454406082956 -73.2125957536439 +193 1.684242728174528 4.554267916537463 -78.90680642203391 +194 1.6929693744344996 5.267358321348261 -84.50488130146024 +195 1.7016960206944711 6.028856829700228 -89.99999999999987 +196 1.7104226669544427 6.837835672960802 -95.38546756197677 +197 1.7191493132144147 7.693309235023127 -100.65472262473446 +198 1.7278759594743864 8.594235253127385 -105.8013454126453 +199 1.736602605734358 9.539516087697509 -110.81906555861852 +200 1.7453292519943295 10.528000059645974 -115.70176974357709 +201 1.7540558982543013 11.558482853517269 -120.44350914459446 +202 1.7627825445142729 12.629708984760697 -125.03850668261954 +203 1.7715091907742444 13.740373329345093 -129.48116406095713 +204 1.780235837034216 14.889122713851354 -133.7660685859309 +205 1.7889624832941877 16.074557564105724 -137.88799976141604 +206 1.7976891295541593 17.295233610345345 -141.84193564920994 +207 1.8064157758141308 18.54966364683865 -145.62305898749042 +208 1.8151424220741026 19.836319343816385 -149.22676305990748 +209 1.8238690683340746 21.15363310950582 -152.6486573081567 +210 1.8325957145940461 22.50000000000001 -155.88457268119905 +211 1.8413223608540177 23.873779674634918 -158.9305667146068 +212 1.8500490071139892 25.273298394491498 -161.78292833385004 +213 1.858775653373961 26.696851061588987 -164.43818237566813 +214 1.8675022996339325 28.14270329628394 -166.89309382202174 +215 1.876228945893904 29.609093550344895 -169.14467174146347 +216 1.8849555921538759 31.09423525312735 -171.19017293312763 +217 1.8936822384138474 32.59631898823501 -173.02710526889732 +218 1.902408884673819 34.11351469801491 -174.6532307296794 +219 1.9111355309337907 35.64397391320081 -176.06656813208505 +220 1.9198621771937625 37.185832004988114 -177.2653955421974 +221 1.9285888234537343 38.73721045679706 -178.24825237348261 +222 1.9373154697137058 40.2962191529556 -179.01394116628924 +223 1.9460421159736774 41.86095868151434 -179.56152904676836 +224 1.9547687622336491 43.42952264838746 -179.89034886343725 +225 1.9634954084936207 45.0 -180.0 +226 1.9722220547535922 46.57047735161251 -179.8903488634373 +227 1.980948701013564 48.13904131848563 -179.56152904676836 +228 1.9896753472735356 49.70378084704437 -179.0139411662891 +229 1.9984019935335071 51.262789543202906 -178.24825237348261 +230 2.007128639793479 52.814167995011836 -177.2653955421975 +231 2.015855286053451 54.35602608679921 -176.06656813208497 +232 2.0245819323134224 55.88648530198507 -174.65323072967934 +233 2.033308578573394 57.40368101176497 -173.02710526889737 +234 2.0420352248333655 58.905764746872634 -171.19017293312766 +235 2.050761871093337 60.39090644965504 -169.14467174146355 +236 2.0594885173533086 61.857296703715996 -166.89309382202183 +237 2.0682151636132806 63.30314893841102 -164.43818237566816 +238 2.076941809873252 64.72670160550847 -161.78292833385 +239 2.0856684561332237 66.12622032536507 -158.93056671460687 +240 2.0943951023931953 67.49999999999996 -155.8845726811991 +241 2.103121748653167 68.84636689049415 -152.6486573081569 +242 2.111848394913139 70.1636806561836 -149.22676305990746 +243 2.1205750411731104 71.4503363531613 -145.6230589874906 +244 2.129301687433082 72.7047663896546 -141.84193564920994 +245 2.138028333693054 73.9254424358943 -137.887999761416 +246 2.1467549799530254 75.11087728614862 -133.76606858593098 +247 2.155481626212997 76.25962667065488 -129.48116406095718 +248 2.1642082724729685 77.3702910152393 -125.03850668261954 +249 2.17293491873294 78.4415171464827 -120.44350914459473 +250 2.1816615649929116 79.47199994035397 -115.70176974357719 +251 2.1903882112528836 80.4604839123025 -110.81906555861858 +252 2.199114857512855 81.40576474687262 -105.8013454126452 +253 2.2078415037728267 82.30669076497685 -100.65472262473452 +254 2.2165681500327987 83.16216432703918 -95.38546756197684 +255 2.2252947962927703 83.97114317029973 -90.00000000000004 +256 2.234021442552742 84.73264167865172 -84.50488130146036 +257 2.2427480888127134 85.44573208346253 -78.90680642203401 +258 2.251474735072685 86.10954559391705 -73.21259575364415 +259 2.260201381332657 86.72327345550542 -67.42918681486404 +260 2.2689280275926285 87.2861679353659 -61.56362579862031 +261 2.2776546738526 87.7975432332819 -55.62305898749065 +262 2.2863813201125716 88.25677631722434 -49.61472404706005 +263 2.295107966372543 88.66330768241983 -43.545941207940366 +264 2.3038346126325147 89.01664203302124 -37.42410434719695 +265 2.3125612588924866 89.31634888554939 -31.256671980047425 +266 2.321287905152458 89.56206309337068 -25.051158172811952 +267 2.33001455141243 89.75348529157229 -18.815123388177536 +268 2.3387411976724017 89.8903822616921 -12.556165273942474 +269 2.3474678439323733 89.97258721585929 -6.281909406450126 +270 2.356194490192345 90.0 -0.0 +271 2.3649211364523164 89.97258721585932 6.281909406449996 +272 2.373647782712288 89.8903822616921 12.556165273942385 +273 2.3823744289722595 89.7534852915723 18.815123388177277 +274 2.3911010752322315 89.56206309337068 25.051158172811732 +275 2.399827721492203 89.31634888554936 31.256671980047305 +276 2.408554367752175 89.01664203302124 37.424104347196824 +277 2.4172810140121466 88.66330768241981 43.545941207940174 +278 2.426007660272118 88.25677631722435 49.61472404705985 +279 2.4347343065320897 87.79754323328193 55.62305898749038 +280 2.443460952792061 87.2861679353659 61.56362579862025 +281 2.4521875990520328 86.72327345550545 67.42918681486397 +282 2.4609142453120048 86.10954559391703 73.21259575364407 +283 2.4696408915719763 85.44573208346253 78.90680642203377 +284 2.478367537831948 84.73264167865173 84.50488130146026 +285 2.4870941840919194 83.97114317029977 89.99999999999989 +286 2.495820830351891 83.16216432703918 95.38546756197668 +287 2.504547476611863 82.30669076497688 100.65472262473438 +288 2.5132741228718345 81.40576474687268 105.80134541264506 +289 2.522000769131806 80.4604839123025 110.81906555861842 +290 2.530727415391778 79.47199994035401 115.70176974357716 +291 2.5394540616517496 78.44151714648274 120.4435091445945 +292 2.548180707911721 77.37029101523933 125.03850668261934 +293 2.5569073541716927 76.2596266706549 129.4811640609572 +294 2.5656340004316642 75.11087728614866 133.76606858593075 +295 2.574360646691636 73.92544243589431 137.88799976141587 +296 2.5830872929516078 72.70476638965462 141.84193564920997 +297 2.5918139392115793 71.4503363531613 145.6230589874906 +298 2.600540585471551 70.16368065618362 149.22676305990743 +299 2.609267231731523 68.8463668904942 152.64865730815671 +300 2.6179938779914944 67.5 155.8845726811989 +301 2.626720524251466 66.12622032536508 158.93056671460678 +302 2.6354471705114375 64.72670160550852 161.78292833384995 +303 2.644173816771409 63.303148938411034 164.43818237566802 +304 2.652900463031381 61.85729670371604 166.89309382202177 +305 2.6616271092913526 60.3909064496551 169.1446717414635 +306 2.670353755551324 58.905764746872634 171.19017293312766 +307 2.6790804018112957 57.403681011765 173.0271052688973 +308 2.6878070480712672 55.886485301985104 174.65323072967925 +309 2.696533694331239 54.35602608679924 176.06656813208485 +310 2.705260340591211 52.81416799501187 177.26539554219747 +311 2.7139869868511823 51.26278954320299 178.24825237348256 +312 2.7227136331111543 49.7037808470444 179.0139411662892 +313 2.731440279371126 48.139041318485646 179.56152904676833 +314 2.7401669256310974 46.57047735161255 179.89034886343723 +315 2.748893571891069 45.00000000000002 180.00000000000003 +316 2.7576202181510405 43.42952264838749 179.8903488634373 +317 2.766346864411012 41.860958681514404 179.56152904676838 +318 2.7750735106709836 40.29621915295568 179.01394116628921 +319 2.7838001569309556 38.73721045679706 178.24825237348261 +320 2.792526803190927 37.18583200498818 177.26539554219747 +321 2.801253449450899 35.643973913200824 176.06656813208494 +322 2.8099800957108707 34.11351469801493 174.65323072967934 +323 2.8187067419708423 32.59631898823504 173.0271052688973 +324 2.827433388230814 31.09423525312738 171.19017293312766 +325 2.8361600344907854 29.60909355034492 169.14467174146358 +326 2.844886680750757 28.14270329628401 166.89309382202177 +327 2.853613327010729 26.696851061588994 164.43818237566816 +328 2.8623399732707004 25.273298394491498 161.78292833385004 +329 2.871066619530672 23.873779674634946 158.93056671460693 +330 2.8797932657906435 22.50000000000005 155.88457268119896 +331 2.888519912050615 21.15363310950582 152.64865730815686 +332 2.897246558310587 19.836319343816406 149.22676305990757 +333 2.9059732045705586 18.549663646838713 145.62305898749065 +334 2.91469985083053 17.295233610345413 141.84193564921014 +335 2.923426497090502 16.074557564105724 137.88799976141604 +336 2.9321531433504737 14.889122713851378 133.76606858593104 +337 2.9408797896104453 13.740373329345143 129.48116406095718 +338 2.949606435870417 12.629708984760711 125.03850668261964 +339 2.9583330821303884 11.558482853517294 120.4435091445946 +340 2.96705972839036 10.528000059646029 115.70176974357733 +341 2.975786374650332 9.539516087697514 110.81906555861842 +342 2.9845130209103035 8.594235253127394 105.8013454126452 +343 2.993239667170275 7.693309235023142 100.6547226247346 +344 3.001966313430247 6.837835672960817 95.38546756197688 +345 3.0106929596902186 6.028856829700268 90.0 +346 3.01941960595019 5.2673583213483255 84.50488130146043 +347 3.0281462522101616 4.5542679165374835 78.90680642203407 +348 3.036872898470133 3.890454406082986 73.21259575364422 +349 3.045599544730105 3.276726544494551 67.4291868148641 +350 3.0543261909900767 2.713832064634096 61.56362579862038 +351 3.0630528372500483 2.202456766718096 55.62305898749061 +352 3.07177948351002 1.7432236827756697 49.614724047060086 +353 3.0805061297699914 1.3366923175801788 43.54594120794044 +354 3.089232776029963 0.983357966978784 37.42410434719691 +355 3.097959422289935 0.6836511144506341 31.256671980047546 +356 3.1066860685499065 0.4379369066293337 25.051158172811903 +357 3.1154127148098785 0.24651470842769696 18.81512338817742 +358 3.12413936106985 0.10961773830790611 12.55616527394248 +359 3.1328660073298216 0.02741278414067072 6.281909406450137 +360 3.141592653589793 0.0 1.5987211554602254e-13 +361 3.1503192998497647 0.02741278414067072 -6.281909406450057 +362 3.159045946109736 0.10961773830790611 -12.55616527394232 +363 3.1677725923697078 0.24651470842769696 -18.815123388177344 +364 3.1764992386296798 0.4379369066293287 -25.051158172811743 +365 3.1852258848896513 0.6836511144506291 -31.256671980047386 +366 3.193952531149623 0.983357966978764 -37.42410434719644 +367 3.2026791774095944 1.3366923175801537 -43.54594120793988 +368 3.211405823669566 1.7432236827755998 -49.61472404705958 +369 3.2201324699295375 2.202456766718046 -55.62305898749016 +370 3.2288591161895095 2.713832064634091 -61.563625798620215 +371 3.237585762449481 3.276726544494546 -67.42918681486394 +372 3.246312408709453 3.890454406082966 -73.21259575364407 +373 3.255039054969425 4.554267916537493 -78.90680642203421 +374 3.2637657012293966 5.2673583213483255 -84.5048813014605 +375 3.272492347489368 6.028856829700283 -90.00000000000016 +376 3.2812189937493397 6.837835672960862 -95.3854675619769 +377 3.2899456400093112 7.693309235023127 -100.65472262473446 +378 3.2986722862692828 8.594235253127355 -105.80134541264509 +379 3.3073989325292543 9.539516087697505 -110.81906555861835 +380 3.3161255787892263 10.52800005964601 -115.70176974357719 +381 3.324852225049198 11.558482853517274 -120.44350914459449 +382 3.3335788713091694 12.629708984760672 -125.0385066826195 +383 3.342305517569141 13.740373329345093 -129.48116406095713 +384 3.3510321638291125 14.889122713851329 -133.7660685859309 +385 3.359758810089084 16.074557564105664 -137.88799976141587 +386 3.368485456349056 17.295233610345388 -141.84193564920992 +387 3.3772121026090276 18.5496636468387 -145.62305898749045 +388 3.385938748868999 19.83631934381636 -149.22676305990737 +389 3.3946653951289707 21.15363310950572 -152.64865730815654 +390 3.4033920413889422 22.49999999999994 -155.88457268119873 +391 3.412118687648914 23.873779674634825 -158.93056671460673 +392 3.4208453339088853 25.273298394491427 -161.78292833384987 +393 3.4295719801688573 26.696851061588944 -164.43818237566813 +394 3.4382986264288293 28.142703296283972 -166.89309382202177 +395 3.447025272688801 29.60909355034489 -169.14467174146347 +396 3.455751918948773 31.094235253127415 -171.19017293312766 +397 3.4644785652087444 32.59631898823507 -173.02710526889751 +398 3.473205211468716 34.11351469801496 -174.65323072967934 +399 3.4819318577286875 35.64397391320084 -176.06656813208502 +400 3.490658503988659 37.185832004988114 -177.26539554219747 +401 3.4993851502486306 38.73721045679703 -178.24825237348256 +402 3.5081117965086026 40.29621915295563 -179.01394116628924 +403 3.516838442768574 41.86095868151437 -179.56152904676833 +404 3.5255650890285457 43.42952264838744 -179.89034886343723 +405 3.5342917352885173 44.99999999999997 -180.00000000000003 +406 3.543018381548489 46.570477351612524 -179.89034886343723 +407 3.5517450278084604 48.139041318485596 -179.5615290467683 +408 3.560471674068432 49.70378084704433 -179.01394116628924 +409 3.569198320328404 51.262789543202956 -178.24825237348256 +410 3.5779249665883754 52.814167995011836 -177.2653955421974 +411 3.586651612848347 54.356026086799105 -176.06656813208502 +412 3.5953782591083185 55.88648530198498 -174.65323072967934 +413 3.60410490536829 57.40368101176488 -173.02710526889746 +414 3.6128315516282616 58.90576474687254 -171.19017293312768 +415 3.6215581978882336 60.39090644965505 -169.14467174146355 +416 3.630284844148205 61.857296703715996 -166.89309382202174 +417 3.639011490408177 63.303148938411 -164.43818237566816 +418 3.647738136668149 64.72670160550854 -161.78292833384995 +419 3.6564647829281207 66.12622032536513 -158.93056671460678 +420 3.6651914291880923 67.50000000000001 -155.8845726811989 +421 3.673918075448064 68.84636689049422 -152.6486573081567 +422 3.6826447217080354 70.1636806561836 -149.22676305990754 +423 3.691371367968007 71.45033635316125 -145.6230589874906 +424 3.7000980142279785 72.7047663896546 -141.84193564920994 +425 3.7088246604879505 73.92544243589428 -137.88799976141595 +426 3.717551306747922 75.11087728614862 -133.76606858593098 +427 3.7262779530078936 76.25962667065488 -129.48116406095718 +428 3.735004599267865 77.37029101523927 -125.03850668261958 +429 3.7437312455278366 78.44151714648271 -120.44350914459456 +430 3.752457891787808 79.47199994035397 -115.70176974357719 +431 3.76118453804778 80.4604839123025 -110.81906555861842 +432 3.7699111843077517 81.40576474687262 -105.8013454126452 +433 3.7786378305677233 82.30669076497685 -100.65472262473452 +434 3.787364476827695 83.16216432703914 -95.38546756197704 +435 3.7960911230876664 83.97114317029968 -90.0000000000002 +436 3.804817769347638 84.73264167865166 -84.50488130146057 +437 3.8135444156076095 85.44573208346247 -78.90680642203438 +438 3.8222710618675815 86.109545593917 -73.21259575364421 +439 3.8309977081275535 86.72327345550543 -67.42918681486408 +440 3.839724354387525 87.28616793536585 -61.563625798620386 +441 3.848451000647497 87.79754323328193 -55.62305898749028 +442 3.8571776469074686 88.25677631722435 -49.61472404705969 +443 3.86590429316744 88.66330768241984 -43.545941207940146 +444 3.8746309394274117 89.01664203302126 -37.42410434719666 +445 3.883357585687383 89.31634888554936 -31.256671980047603 +446 3.8920842319473548 89.56206309337064 -25.051158172811835 +447 3.9008108782073267 89.75348529157229 -18.815123388177536 +448 3.9095375244672983 89.8903822616921 -12.556165273942474 +449 3.91826417072727 89.97258721585929 -6.281909406450126 +450 3.9269908169872414 90.0 -4.9960036108132044e-14 +451 3.935717463247213 89.97258721585929 6.281909406449996 +452 3.9444441095071845 89.8903822616921 12.556165273942264 +453 3.953170755767156 89.7534852915723 18.815123388177277 +454 3.961897402027128 89.56206309337068 25.051158172811732 +455 3.9706240482870996 89.31634888554936 31.256671980047305 +456 3.979350694547071 89.01664203302126 37.42410434719644 +457 3.9880773408070427 88.66330768241984 43.545941207939904 +458 3.9968039870670142 88.25677631722436 49.61472404705954 +459 4.005530633326986 87.79754323328193 55.62305898749019 +460 4.014257279586958 87.2861679353659 61.56362579862025 +461 4.022983925846929 86.72327345550546 67.42918681486357 +462 4.031710572106902 86.10954559391699 73.21259575364432 +463 4.040437218366873 85.44573208346253 78.90680642203384 +464 4.049163864626845 84.73264167865169 84.50488130146046 +465 4.057890510886816 83.97114317029977 89.99999999999977 +466 4.066617157146788 83.16216432703916 95.38546756197688 +467 4.07534380340676 82.30669076497685 100.6547226247346 +468 4.084070449666731 81.40576474687265 105.80134541264509 +469 4.092797095926703 80.46048391230246 110.81906555861863 +470 4.101523742186674 79.47199994035402 115.7017697435769 +471 4.110250388446646 78.44151714648272 120.44350914459453 +472 4.118977034706617 77.37029101523936 125.03850668261924 +473 4.127703680966589 76.25962667065491 129.48116406095713 +474 4.136430327226561 75.11087728614861 133.76606858593098 +475 4.145156973486532 73.92544243589433 137.8879997614158 +476 4.153883619746504 72.70476638965462 141.84193564920997 +477 4.162610266006475 71.45033635316139 145.6230589874902 +478 4.171336912266447 70.16368065618366 149.22676305990734 +479 4.1800635585264185 68.84636689049435 152.64865730815634 +480 4.1887902047863905 67.50000000000006 155.88457268119873 +481 4.1975168510463625 66.1262203253651 158.93056671460678 +482 4.206243497306334 64.72670160550861 161.7829283338499 +483 4.214970143566306 63.30314893841105 164.4381823756681 +484 4.223696789826278 61.85729670371604 166.89309382202177 +485 4.23242343608625 60.39090644965502 169.14467174146355 +486 4.241150082346221 58.905764746872656 171.19017293312763 +487 4.249876728606193 57.40368101176494 173.02710526889743 +488 4.258603374866164 55.886485301985104 174.65323072967925 +489 4.267330021126136 54.35602608679916 176.0665681320849 +490 4.276056667386108 52.8141679950118 177.26539554219744 +491 4.284783313646079 51.26278954320299 178.24825237348261 +492 4.293509959906051 49.7037808470444 179.0139411662892 +493 4.302236606166022 48.13904131848572 179.56152904676833 +494 4.310963252425994 46.570477351612574 179.89034886343723 +495 4.319689898685965 45.0000000000001 179.99999999999997 +496 4.328416544945937 43.4295226483875 179.89034886343734 +497 4.337143191205909 41.86095868151434 179.56152904676836 +498 4.34586983746588 40.29621915295566 179.01394116628924 +499 4.354596483725852 38.73721045679708 178.24825237348264 +500 4.363323129985823 37.18583200498824 177.26539554219758 +501 4.372049776245795 35.64397391320091 176.06656813208505 +502 4.380776422505767 34.11351469801496 174.65323072967934 +503 4.389503068765738 32.596318988235126 173.02710526889743 +504 4.39822971502571 31.094235253127383 171.19017293312774 +505 4.4069563612856815 29.60909355034503 169.14467174146358 +506 4.4156830075456535 28.142703296284033 166.89309382202183 +507 4.4244096538056255 26.696851061588987 164.43818237566813 +508 4.4331363000655974 25.273298394491455 161.78292833384998 +509 4.4418629463255686 23.873779674634946 158.93056671460693 +510 4.4505895925855405 22.49999999999998 155.8845726811989 +511 4.4593162388455125 21.153633109505705 152.64865730815654 +512 4.468042885105484 19.836319343816406 149.22676305990757 +513 4.476769531365456 18.54966364683867 145.62305898749034 +514 4.485496177625427 17.29523361034543 141.8419356492101 +515 4.494222823885399 16.074557564105724 137.88799976141604 +516 4.50294947014537 14.88912271385146 133.76606858593118 +517 4.511676116405342 13.740373329345143 129.48116406095718 +518 4.520402762665314 12.629708984760681 125.0385066826194 +519 4.529129408925285 11.558482853517294 120.4435091445946 +520 4.537856055185257 10.528000059645974 115.70176974357709 +521 4.546582701445228 9.53951608769756 110.81906555861873 +522 4.5553093477052 8.594235253127385 105.80134541264532 +523 4.564035993965171 7.693309235023177 100.65472262473489 +524 4.572762640225143 6.837835672960867 95.38546756197717 +525 4.581489286485115 6.028856829700248 90.00000000000001 +526 4.590215932745086 5.267358321348356 84.50488130146071 +527 4.598942579005058 4.5542679165374835 78.90680642203414 +528 4.607669225265029 3.890454406083026 73.2125957536445 +529 4.616395871525002 3.2767265444945357 67.42918681486387 +530 4.625122517784973 2.7138320646341207 61.56362579862043 +531 4.633849164044945 2.2024567667180612 55.62305898749039 +532 4.642575810304916 1.7432236827756697 49.61472404706008 +533 4.651302456564888 1.3366923175801637 43.54594120794012 +534 4.66002910282486 0.983357966978739 37.42410434719637 +535 4.6687557490848315 0.6836511144506541 31.256671980047525 +536 4.6774823953448035 0.4379369066293487 25.051158172811657 +537 4.686209041604775 0.24651470842770196 18.8151233881779 +538 4.694935687864747 0.10961773830790611 12.55616527394256 +539 4.703662334124718 0.0274127841406957 6.281909406450534 +540 4.71238898038469 0.0 1.5987211554602254e-13 +541 4.721115626644662 0.0274127841406957 -6.2819094064502945 +542 4.729842272904633 0.10961773830790611 -12.55616527394232 +543 4.738568919164605 0.24651470842769696 -18.81512338817758 +544 4.747295565424576 0.4379369066293437 -25.05115817281142 +545 4.756022211684548 0.6836511144506391 -31.25667198004721 +546 4.764748857944519 0.983357966978729 -37.424104347196135 +547 4.773475504204491 1.3366923175801138 -43.54594120793983 +548 4.782202150464463 1.7432236827756498 -49.61472404705977 +549 4.790928796724434 2.202456766718046 -55.62305898749016 +550 4.799655442984406 2.7138320646341105 -61.5636257986202 +551 4.808382089244377 3.276726544494521 -67.42918681486363 +552 4.81710873550435 3.890454406083011 -73.21259575364434 +553 4.825835381764321 4.554267916537463 -78.90680642203391 +554 4.834562028024293 5.2673583213483255 -84.50488130146043 +555 4.843288674284264 6.028856829700228 -89.99999999999987 +556 4.852015320544236 6.837835672960817 -95.38546756197688 +557 4.860741966804208 7.693309235023142 -100.6547226247346 +558 4.869468613064179 8.594235253127355 -105.80134541264509 +559 4.878195259324151 9.539516087697534 -110.81906555861855 +560 4.886921905584122 10.528000059645954 -115.70176974357695 +561 4.895648551844094 11.558482853517274 -120.44350914459449 +562 4.9043751981040655 12.629708984760637 -125.03850668261913 +563 4.9131018443640375 13.740373329345093 -129.48116406095713 +564 4.9218284906240095 14.889122713851384 -133.76606858593104 +565 4.930555136883981 16.074557564105667 -137.88799976141578 +566 4.939281783143953 17.29523361034537 -141.84193564920983 +567 4.948008429403924 18.549663646838617 -145.6230589874903 +568 4.956735075663896 19.83631934381635 -149.2267630599073 +569 4.965461721923867 21.153633109505655 -152.64865730815634 +570 4.974188368183839 22.49999999999994 -155.88457268119873 +571 4.982915014443811 23.87377967463491 -158.93056671460675 +572 4.991641660703782 25.273298394491402 -161.78292833384975 +573 5.000368306963754 26.696851061588944 -164.43818237566813 +574 5.009094953223726 28.142703296283962 -166.8930938220218 +575 5.017821599483698 29.60909355034495 -169.14467174146358 +576 5.026548245743669 31.094235253127334 -171.1901729331276 +577 5.035274892003641 32.59631898823506 -173.02710526889743 +578 5.044001538263612 34.11351469801487 -174.65323072967925 +579 5.052728184523584 35.643973913200824 -176.06656813208494 +580 5.061454830783556 37.18583200498815 -177.26539554219755 +581 5.070181477043527 38.737210456797015 -178.24825237348261 +582 5.078908123303499 40.29621915295563 -179.01394116628924 +583 5.08763476956347 41.860958681514276 -179.5615290467684 +584 5.096361415823442 43.42952264838744 -179.89034886343723 +585 5.105088062083414 45.00000000000006 -179.99999999999997 +586 5.113814708343385 46.57047735161251 -179.8903488634373 +587 5.122541354603357 48.13904131848563 -179.56152904676836 +588 5.1312680008633285 49.70378084704432 -179.0139411662893 +589 5.1399946471233005 51.26278954320292 -178.24825237348261 +590 5.148721293383272 52.81416799501175 -177.26539554219755 +591 5.1574479396432436 54.356026086799105 -176.06656813208502 +592 5.1661745859032155 55.88648530198504 -174.6532307296794 +593 5.174901232163187 57.40368101176488 -173.02710526889751 +594 5.183627878423159 58.90576474687263 -171.19017293312766 +595 5.19235452468313 60.39090644965496 -169.14467174146367 +596 5.201081170943102 61.85729670371596 -166.89309382202183 +597 5.209807817203074 63.303148938411 -164.43818237566816 +598 5.218534463463046 64.72670160550852 -161.78292833384995 +599 5.227261109723017 66.12622032536501 -158.930566714607 +600 5.235987755982989 67.5 -155.8845726811989 +601 5.244714402242961 68.8463668904943 -152.64865730815657 +602 5.253441048502932 70.1636806561836 -149.22676305990746 +603 5.262167694762904 71.45033635316135 -145.62305898749048 +604 5.270894341022875 72.70476638965457 -141.84193564921003 +605 5.279620987282847 73.9254424358943 -137.887999761416 +606 5.288347633542818 75.11087728614855 -133.7660685859312 +607 5.29707427980279 76.25962667065488 -129.48116406095718 +608 5.305800926062762 77.37029101523932 -125.03850668261944 +609 5.314527572322733 78.4415171464827 -120.44350914459464 +610 5.323254218582705 79.471999940354 -115.70176974357703 +611 5.331980864842676 80.46048391230242 -110.81906555861873 +612 5.340707511102648 81.4057647468726 -105.80134541264532 +613 5.349434157362619 82.30669076497678 -100.65472262473489 +614 5.358160803622591 83.16216432703912 -95.38546756197704 +615 5.366887449882563 83.97114317029971 -90.00000000000004 +616 5.3756140961425345 84.73264167865163 -84.5048813014608 +617 5.3843407424025065 85.44573208346249 -78.90680642203407 +618 5.393067388662478 86.10954559391698 -73.21259575364451 +619 5.4017940349224505 86.72327345550548 -67.42918681486384 +620 5.410520681182422 87.28616793536587 -61.56362579862045 +621 5.419247327442394 87.79754323328193 -55.62305898749038 +622 5.427973973702365 88.25677631722434 -49.61472404706012 +623 5.436700619962337 88.66330768241984 -43.54594120794002 +624 5.445427266222309 89.01664203302126 -37.42410434719644 +625 5.45415391248228 89.31634888554936 -31.256671980047603 +626 5.462880558742252 89.56206309337067 -25.051158172811675 +627 5.471607205002223 89.75348529157228 -18.815123388177824 +628 5.480333851262195 89.8903822616921 -12.556165273942614 +629 5.489060497522166 89.97258721585928 -6.281909406450685 +630 5.497787143782138 90.0 -4.9960036108132044e-14 +631 5.50651379004211 89.97258721585932 6.281909406450335 +632 5.515240436302081 89.8903822616921 12.556165273942264 +633 5.523967082562053 89.75348529157229 18.815123388177536 +634 5.532693728822024 89.56206309337068 25.051158172811373 +635 5.541420375081996 89.31634888554937 31.256671980047276 +636 5.550147021341967 89.01664203302127 37.42410434719605 +637 5.558873667601939 88.66330768241987 43.54594120793987 +638 5.567600313861911 88.25677631722435 49.61472404705969 +639 5.576326960121882 87.79754323328196 55.62305898749017 +640 5.585053606381854 87.2861679353659 61.56362579862025 +641 5.593780252641825 86.7232734555055 67.42918681486367 +642 5.602506898901798 86.10954559391699 73.21259575364432 +643 5.611233545161769 85.4457320834625 78.90680642203387 +644 5.619960191421741 84.7326416786517 84.5048813014604 +645 5.6286868376817125 83.97114317029977 89.99999999999977 +646 5.6374134839416845 83.16216432703916 95.38546756197684 +647 5.6461401302016565 82.30669076497684 100.65472262473475 +648 5.654866776461628 81.40576474687265 105.80134541264509 +649 5.6635934227216 80.46048391230246 110.81906555861855 +650 5.672320068981571 79.47199994035407 115.7017697435767 +651 5.681046715241543 78.44151714648275 120.44350914459432 +652 5.689773361501514 77.37029101523936 125.03850668261924 +653 5.698500007761486 76.25962667065491 129.48116406095713 +654 5.707226654021458 75.11087728614861 133.76606858593098 +655 5.715953300281429 73.92544243589433 137.8879997614158 +656 5.724679946541401 72.70476638965464 141.84193564920983 +657 5.733406592801372 71.45033635316142 145.6230589874902 +658 5.742133239061344 70.16368065618366 149.22676305990734 +659 5.750859885321315 68.84636689049437 152.6486573081564 +660 5.759586531581287 67.50000000000009 155.88457268119876 +661 5.768313177841259 66.12622032536511 158.93056671460684 +662 5.77703982410123 64.72670160550861 161.7829283338498 +663 5.785766470361202 63.303148938411084 164.43818237566802 +664 5.794493116621174 61.85729670371604 166.89309382202177 +665 5.803219762881146 60.39090644965505 169.14467174146355 +666 5.811946409141117 58.905764746872656 171.1901729331276 +667 5.820673055401089 57.40368101176496 173.02710526889746 +668 5.82939970166106 55.88648530198513 174.65323072967922 +669 5.838126347921032 54.35602608679919 176.06656813208497 +670 5.846852994181004 52.814167995011836 177.2653955421974 +671 5.8555796404409755 51.262789543203006 178.24825237348267 +672 5.8643062867009474 49.7037808470444 179.0139411662892 +673 5.8730329329609186 48.13904131848573 179.56152904676833 +674 5.8817595792208905 46.57047735161256 179.8903488634373 +675 5.890486225480862 45.00000000000012 179.99999999999991 +676 5.899212871740834 43.42952264838752 179.89034886343725 +677 5.907939518000806 41.86095868151437 179.56152904676833 +678 5.916666164260777 40.29621915295568 179.01394116628921 +679 5.925392810520749 38.7372104567971 178.24825237348273 +680 5.93411945678072 37.18583200498828 177.26539554219755 +681 5.942846103040692 35.64397391320092 176.066568132085 +682 5.951572749300664 34.11351469801494 174.65323072967948 +683 5.960299395560635 32.59631898823515 173.02710526889757 +684 5.969026041820607 31.094235253127408 171.19017293312766 +685 5.977752688080578 29.60909355034503 169.1446717414638 +686 5.98647933434055 28.14270329628406 166.89309382202183 +687 5.995205980600522 26.696851061588994 164.43818237566816 +688 6.003932626860494 25.273298394491466 161.78292833384992 +689 6.012659273120465 23.873779674634957 158.93056671460695 +690 6.021385919380437 22.50000000000001 155.88457268119893 +691 6.030112565640409 21.15363310950571 152.64865730815654 +692 6.03883921190038 19.836319343816424 149.2267630599075 +693 6.047565858160352 18.54966364683867 145.6230589874905 +694 6.056292504420323 17.295233610345413 141.84193564921014 +695 6.065019150680295 16.074557564105724 137.88799976141604 +696 6.073745796940266 14.889122713851425 133.7660685859313 +697 6.082472443200238 13.740373329345124 129.48116406095735 +698 6.09119908946021 12.629708984760661 125.03850668261943 +699 6.0999257357201815 11.558482853517308 120.44350914459469 +700 6.1086523819801535 10.528000059645985 115.70176974357715 +701 6.117379028240125 9.539516087697574 110.81906555861885 +702 6.126105674500097 8.594235253127385 105.80134541264536 +703 6.134832320760068 7.693309235023177 100.65472262473489 +704 6.14355896702004 6.837835672960847 95.38546756197718 +705 6.152285613280012 6.028856829700253 90.00000000000009 +706 6.161012259539983 5.267358321348316 84.50488130146077 +707 6.169738905799955 4.5542679165374835 78.90680642203414 +708 6.178465552059926 3.8904544060830357 73.21259575364456 +709 6.187192198319899 3.276726544494546 67.42918681486394 +710 6.19591884457987 2.7138320646341105 61.56362579862053 +711 6.204645490839842 2.2024567667180612 55.62305898749039 +712 6.213372137099813 1.7432236827756697 49.614724047060086 +713 6.222098783359785 1.3366923175801637 43.545941207940196 +714 6.230825429619757 0.983357966978764 37.42410434719644 +715 6.239552075879728 0.6836511144506341 31.25667198004762 +716 6.2482787221397 0.4379369066293687 25.051158172811643 +717 6.257005368399671 0.24651470842772694 18.8151233881779 +718 6.265732014659643 0.10961773830790611 12.55616527394256 +719 6.274458660919614 0.0274127841406957 6.281909406450615 + +HARMONIC_3 +N 720 RADIANS + +0 0.0 0.0 -0.0 +1 0.008726646259971648 0.008529071242088904 -1.9546695209757408 +2 0.017453292519943295 0.03411368693063732 -3.9087436306800853 +3 0.02617993877991494 0.07674605374387777 -5.861627099209696 +4 0.03490658503988659 0.13641318544986358 -7.81272505934202 +5 0.04363323129985824 0.21309690686224325 -9.761443187737738 +6 0.05235987755982988 0.30677385937668955 -11.70718788597717 +7 0.061086523819801536 0.41741550808596894 -13.649366461376497 +8 0.06981317007977318 0.544988150472066 -15.587387307527308 +9 0.07853981633974483 0.6894529266722724 -17.520660084505877 +10 0.08726646259971647 0.8507658313163322 -19.448595898696194 +11 0.09599310885968812 1.0288777269308236 -21.37060748217304 +12 0.10471975511965977 1.2237343589068876 -23.28610937158906 +13 0.11344640137963141 1.4352763720268138 -25.194518086512865 +14 0.12217304763960307 1.663439328544185 -27.095252307162777 +15 0.1308996938995747 1.9081537278121683 -28.987733051482323 +16 0.13962634015954636 2.1693450274541357 -30.8713838515039 +17 0.148352986419518 2.4469336660700094 -32.745630928946525 +18 0.15707963267948966 2.7408350874714023 -34.609903369994136 +19 0.16580627893946132 3.050959766438263 -36.463633299201526 +20 0.17453292519943295 3.377213235989122 -38.30625605247489 +21 0.1832595714594046 3.719496116156696 -40.137210349073634 +22 0.19198621771937624 4.077704144259892 -41.95593846258216 +23 0.20071286397934787 4.451728206663333 -43.76188639079868 +24 0.20943951023931953 4.841454372014345 -45.554504024489646 +25 0.2181661564992912 5.246763925947597 -47.33324531495834 +26 0.22689280275926282 5.6675334072466335 -49.09756844037665 +27 0.23561944901923448 6.103634645451379 -50.846935970829236 +28 0.24434609527920614 6.554934799900107 -52.580815032019785 +29 0.2530727415391778 7.021296400193826 -54.29867746758978 +30 0.2617993877991494 7.502577388071445 -56.0 +31 0.27052603405912107 7.9986311606817155 -57.68426438992608 +32 0.2792526803190927 8.50930661524014 -59.35095759411894 +33 0.28797932657906433 9.034448195056253 -60.999571921683035 +34 0.296705972839036 9.573895936917662 -62.62960518872365 +35 0.30543261909900765 10.12748551981646 -64.2405608713172 +36 0.3141592653589793 10.695048315002936 -65.831948256757 +37 0.32288591161895097 11.276411437351614 -67.40328259302939 +38 0.33161255787892263 11.871397798023555 -68.95408523647374 +39 0.3403392041388943 12.479826158409617 -70.48388379758178 +40 0.3490658503988659 13.101511185337225 -71.99221228489239 +41 0.35779249665883756 13.736263507524773 -73.47861124693682 +42 0.3665191429188092 14.383889773265935 -74.94262791219212 +43 0.3752457891787809 15.04419270932646 -76.38381632699983 +44 0.3839724354387525 15.716971181035527 -77.80173749140768 +45 0.39269908169872414 16.402020253553342 -79.19595949289334 +46 0.40142572795869574 17.09913125429613 -80.5660576379289 +47 0.41015237421866746 17.80809183650009 -81.91161458134708 +48 0.41887902047863906 18.528686043903953 -83.23222045346814 +49 0.42760566673861067 19.2606943765316 -84.52747298495044 +50 0.4363323129985824 20.003893857553802 -85.79697762932555 +51 0.445058959258554 20.75805810120908 -87.04034768318073 +52 0.45378560551852565 21.522957381763128 -88.25720440395287 +53 0.4625122517784973 22.29835870348529 -89.4471771252968 +54 0.47123889803846897 23.0840258716215 -90.60990336999411 +55 0.4799655442984406 23.87971956434142 -91.7450289603671 +56 0.4886921905584123 24.685197405638167 -92.85220812616467 +57 0.4974188368183839 25.50021403915848 -93.93110360988749 +58 0.5061454830783556 26.32452120294053 -94.9813867695197 +59 0.5148721293383272 27.157867805036954 -96.00273767863655 +60 0.5235987755982988 27.999999999999986 -96.99484522385711 +61 0.5323254218582705 28.85066126620511 -97.9574071996123 +62 0.5410520681182421 29.70959248399013 -98.89013040019982 +63 0.5497787143782138 30.576532014585375 -99.79273070909721 +64 0.5585053606381855 31.451215779811665 -100.66493318550671 +65 0.5672320068981571 32.33337734252084 -101.50647214810483 +66 0.5759586531581287 33.22274798775518 -102.31709125597129 +67 0.5846852994181004 34.119056804600675 -103.09654358667333 +68 0.593411945678072 35.022030768708944 -103.84459171148019 +69 0.6021385919380438 35.9313948254632 -104.5610077676866 +70 0.6108652381980153 36.84687197376254 -105.24557352802174 +71 0.619591884457987 37.76818335039923 -105.89808046712349 +72 0.6283185307179586 38.69504831500294 -106.51832982505721 +73 0.6370451769779303 39.627184535526744 -107.10613266785997 +74 0.6457718232379019 40.564308074248046 -107.66130994509169 +75 0.6544984694978736 41.50613347425884 -108.18369254437565 +76 0.6632251157578453 42.45237384641862 -108.6731213429116 +77 0.6719517620178168 43.40274095674357 -109.12944725594632 +78 0.6806784082777886 44.35694531420548 -109.55253128218624 +79 0.6894050545377601 45.31469625891349 -109.94224454613835 +80 0.6981317007977318 46.2757020506519 -110.29846833736731 +81 0.7068583470577035 47.23966995774707 -110.62109414665542 +82 0.7155849933176751 48.206306346236325 -110.9100236990559 +83 0.7243116395776468 49.175316769311735 -111.16516898382807 +84 0.7330382858376184 50.146406057011404 -111.38645228124662 +85 0.74176493209759 51.11927840613113 -111.57380618627549 +86 0.7504915783575618 52.093637470328986 -111.72717362910032 +87 0.7592182246175333 53.06918645039515 -111.84650789251228 +88 0.767944870877505 54.04562818465995 -111.93177262613871 +89 0.7766715171374766 55.02266523951213 -111.9829418575158 +90 0.7853981633974483 56.0 -112.00000000000003 +91 0.7941248096574199 56.97733476048787 -111.9829418575158 +92 0.8028514559173915 57.95437181534005 -111.93177262613871 +93 0.8115781021773633 58.93081354960485 -111.84650789251228 +94 0.8203047484373349 59.906362529671014 -111.72717362910032 +95 0.8290313946973066 60.88072159386884 -111.57380618627552 +96 0.8377580409572781 61.853593942988574 -111.38645228124662 +97 0.8464846872172498 62.82468323068823 -111.16516898382807 +98 0.8552113334772213 63.79369365376366 -110.91002369905586 +99 0.8639379797371932 64.76033004225296 -110.62109414665544 +100 0.8726646259971648 65.72429794934808 -110.29846833736732 +101 0.8813912722571364 66.68530374108651 -109.94224454613835 +102 0.890117918517108 67.64305468579451 -109.55253128218624 +103 0.8988445647770796 68.59725904325643 -109.12944725594639 +104 0.9075712110370513 69.54762615358139 -108.6731213429116 +105 0.9162978572970231 70.49386652574117 -108.18369254437563 +106 0.9250245035569946 71.43569192575194 -107.66130994509176 +107 0.9337511498169663 72.37281546447325 -107.10613266785994 +108 0.9424777960769379 73.30495168499706 -106.51832982505721 +109 0.9512044423369095 74.23181664960076 -105.89808046712348 +110 0.9599310885968813 75.15312802623745 -105.24557352802174 +111 0.9686577348568529 76.06860517453683 -104.56100776768659 +112 0.9773843811168246 76.97796923129108 -103.84459171148019 +113 0.9861110273767961 77.88094319539934 -103.0965435866733 +114 0.9948376736367678 78.77725201224482 -102.31709125597132 +115 1.0035643198967394 79.66662265747917 -101.50647214810483 +116 1.0122909661567112 80.54878422018834 -100.66493318550671 +117 1.0210176124166828 81.42346798541462 -99.79273070909721 +118 1.0297442586766543 82.29040751600986 -98.89013040019982 +119 1.038470904936626 83.14933873379486 -97.95740719961235 +120 1.0471975511965976 84.0 -96.99484522385713 +121 1.0559241974565694 84.84213219496303 -96.00273767863656 +122 1.064650843716541 85.67547879705945 -94.98138676951973 +123 1.0733774899765127 86.4997859608415 -93.9311036098875 +124 1.0821041362364843 87.31480259436184 -92.85220812616467 +125 1.0908307824964558 88.12028043565857 -91.74502896036711 +126 1.0995574287564276 88.91597412837851 -90.60990336999411 +127 1.1082840750163994 89.70164129651471 -89.44717712529679 +128 1.117010721276371 90.47704261823687 -88.25720440395287 +129 1.1257373675363425 91.24194189879088 -87.04034768318076 +130 1.1344640137963142 91.99610614244621 -85.79697762932555 +131 1.1431906600562858 92.7393056234684 -84.52747298495045 +132 1.1519173063162573 93.47131395609604 -83.23222045346817 +133 1.160643952576229 94.19190816349992 -81.9116145813471 +134 1.1693705988362009 94.90086874570387 -80.5660576379289 +135 1.1780972450961724 95.59797974644665 -79.19595949289334 +136 1.186823891356144 96.28302881896445 -77.80173749140772 +137 1.1955505376161157 96.95580729067356 -76.38381632699983 +138 1.2042771838760875 97.6161102267341 -74.94262791219208 +139 1.213003830136059 98.26373649247523 -73.47861124693682 +140 1.2217304763960306 98.89848881466276 -71.99221228489243 +141 1.2304571226560024 99.52017384159038 -70.48388379758178 +142 1.239183768915974 100.12860220197642 -68.95408523647373 +143 1.2479104151759455 100.7235885626484 -67.40328259302943 +144 1.2566370614359172 101.30495168499706 -65.831948256757 +145 1.265363707695889 101.87251448018355 -64.24056087131714 +146 1.2740903539558606 102.42610406308233 -62.62960518872365 +147 1.2828170002158321 102.96555180494374 -60.999571921683085 +148 1.2915436464758039 103.49069338475987 -59.35095759411894 +149 1.3002702927357754 104.00136883931827 -57.684264389926064 +150 1.3089969389957472 104.49742261192857 -55.99999999999999 +151 1.3177235852557188 104.97870359980617 -54.29867746758976 +152 1.3264502315156905 105.44506520009992 -52.58081503201974 +153 1.335176877775662 105.89636535454859 -50.84693597082927 +154 1.3439035240356336 106.33246659275335 -49.09756844037668 +155 1.3526301702956054 106.75323607405241 -47.33324531495834 +156 1.3613568165555772 107.15854562798566 -45.55450402448959 +157 1.3700834628155487 107.54827179333667 -43.76188639079868 +158 1.3788101090755203 107.92229585574009 -41.955938462582154 +159 1.3875367553354918 108.2805038838433 -40.13721034907368 +160 1.3962634015954636 108.62278676401087 -38.306256052474936 +161 1.4049900478554354 108.94904023356175 -36.46363329920153 +162 1.413716694115407 109.2591649125286 -34.609903369994136 +163 1.4224433403753785 109.55306633392999 -32.745630928946575 +164 1.4311699866353502 109.83065497254586 -30.8713838515039 +165 1.4398966328953218 110.09184627218784 -28.987733051482373 +166 1.4486232791552935 110.33656067145583 -27.095252307162777 +167 1.457349925415265 110.56472362797318 -25.194518086512915 +168 1.4660765716752369 110.77626564109312 -23.28610937158906 +169 1.4748032179352084 110.97112227306917 -21.37060748217304 +170 1.48352986419518 111.14923416868365 -19.44859589869624 +171 1.4922565104551517 111.31054707332773 -17.520660084505877 +172 1.5009831567151235 111.45501184952792 -15.587387307527305 +173 1.509709802975095 111.58258449191403 -13.649366461376546 +174 1.5184364492350666 111.6932261406233 -11.707187885977218 +175 1.5271630954950384 111.78690309313774 -9.761443187737736 +176 1.53588974175501 111.86358681455015 -7.812725059342069 +177 1.5446163880149815 111.92325394625612 -5.861627099209747 +178 1.5533430342749532 111.96588631306938 -3.908743630680135 +179 1.562069680534925 111.9914709287579 -1.9546695209757405 +180 1.5707963267948966 112.0 -0.0 +181 1.579522973054868 111.9914709287579 1.9546695209757157 +182 1.5882496193148399 111.96588631306938 3.90874363068011 +183 1.5969762655748114 111.92325394625612 5.861627099209672 +184 1.605702911834783 111.86358681455015 7.81272505934197 +185 1.6144295580947547 111.78690309313777 9.761443187737692 +186 1.6231562043547265 111.6932261406233 11.707187885977193 +187 1.6318828506146983 111.58258449191403 13.649366461376546 +188 1.6406094968746698 111.45501184952792 15.58738730752733 +189 1.6493361431346414 111.31054707332773 17.520660084505828 +190 1.6580627893946132 111.14923416868365 19.448595898696215 +191 1.6667894356545847 110.9711222730692 21.370607482173018 +192 1.6755160819145563 110.77626564109312 23.286109371589003 +193 1.684242728174528 110.56472362797318 25.194518086512865 +194 1.6929693744344996 110.33656067145583 27.09525230716275 +195 1.7016960206944711 110.09184627218784 28.987733051482273 +196 1.7104226669544427 109.83065497254587 30.871383851503857 +197 1.7191493132144147 109.55306633392999 32.745630928946525 +198 1.7278759594743864 109.2591649125286 34.60990336999416 +199 1.736602605734358 108.94904023356175 36.46363329920155 +200 1.7453292519943295 108.62278676401087 38.30625605247489 +201 1.7540558982543013 108.2805038838433 40.13721034907363 +202 1.7627825445142729 107.92229585574009 41.955938462582154 +203 1.7715091907742444 107.54827179333667 43.76188639079863 +204 1.780235837034216 107.15854562798566 45.55450402448959 +205 1.7889624832941877 106.75323607405241 47.33324531495834 +206 1.7976891295541593 106.33246659275336 49.09756844037665 +207 1.8064157758141308 105.89636535454862 50.84693597082918 +208 1.8151424220741026 105.44506520009992 52.58081503201974 +209 1.8238690683340746 104.97870359980615 54.29867746758978 +210 1.8325957145940461 104.49742261192857 56.00000000000003 +211 1.8413223608540177 104.00136883931827 57.684264389926064 +212 1.8500490071139892 103.49069338475987 59.35095759411894 +213 1.858775653373961 102.96555180494374 60.999571921683035 +214 1.8675022996339325 102.42610406308235 62.62960518872363 +215 1.876228945893904 101.87251448018355 64.24056087131714 +216 1.8849555921538759 101.30495168499706 65.83194825675697 +217 1.8936822384138474 100.7235885626484 67.40328259302937 +218 1.902408884673819 100.12860220197645 68.9540852364737 +219 1.9111355309337907 99.52017384159038 70.48388379758178 +220 1.9198621771937625 98.89848881466277 71.99221228489239 +221 1.9285888234537343 98.26373649247523 73.47861124693682 +222 1.9373154697137058 97.61611022673408 74.94262791219214 +223 1.9460421159736774 96.95580729067356 76.38381632699982 +224 1.9547687622336491 96.28302881896445 77.8017374914077 +225 1.9634954084936207 95.59797974644665 79.19595949289332 +226 1.9722220547535922 94.90086874570387 80.5660576379289 +227 1.980948701013564 94.19190816349992 81.9116145813471 +228 1.9896753472735356 93.47131395609605 83.2322204534681 +229 1.9984019935335071 92.73930562346843 84.52747298495042 +230 2.007128639793479 91.99610614244622 85.79697762932551 +231 2.015855286053451 91.24194189879087 87.04034768318078 +232 2.0245819323134224 90.47704261823685 88.25720440395288 +233 2.033308578573394 89.7016412965147 89.4471771252968 +234 2.0420352248333655 88.91597412837851 90.60990336999411 +235 2.050761871093337 88.1202804356586 91.74502896036704 +236 2.0594885173533086 87.31480259436185 92.85220812616464 +237 2.0682151636132806 86.4997859608415 93.9311036098875 +238 2.076941809873252 85.67547879705947 94.98138676951969 +239 2.0856684561332237 84.84213219496304 96.00273767863655 +240 2.0943951023931953 84.00000000000003 96.99484522385711 +241 2.103121748653167 83.14933873379493 97.95740719961229 +242 2.111848394913139 82.29040751600988 98.8901304001998 +243 2.1205750411731104 81.42346798541462 99.79273070909721 +244 2.129301687433082 80.54878422018835 100.66493318550667 +245 2.138028333693054 79.66662265747917 101.50647214810483 +246 2.1467549799530254 78.77725201224482 102.31709125597129 +247 2.155481626212997 77.88094319539934 103.0965435866733 +248 2.1642082724729685 76.97796923129108 103.84459171148019 +249 2.17293491873294 76.06860517453687 104.56100776768658 +250 2.1816615649929116 75.15312802623748 105.24557352802171 +251 2.1903882112528836 74.23181664960079 105.89808046712349 +252 2.199114857512855 73.30495168499706 106.51832982505718 +253 2.2078415037728267 72.37281546447328 107.10613266785995 +254 2.2165681500327987 71.43569192575195 107.66130994509173 +255 2.2252947962927703 70.49386652574117 108.18369254437563 +256 2.234021442552742 69.5476261535814 108.67312134291161 +257 2.2427480888127134 68.59725904325646 109.12944725594636 +258 2.251474735072685 67.64305468579454 109.55253128218624 +259 2.260201381332657 66.68530374108649 109.94224454613834 +260 2.2689280275926285 65.72429794934808 110.29846833736732 +261 2.2776546738526 64.76033004225295 110.62109414665542 +262 2.2863813201125716 63.7936936537637 110.91002369905586 +263 2.295107966372543 62.82468323068828 111.16516898382807 +264 2.3038346126325147 61.85359394298864 111.38645228124659 +265 2.3125612588924866 60.880721593868856 111.57380618627553 +266 2.321287905152458 59.906362529671036 111.72717362910032 +267 2.33001455141243 58.93081354960485 111.84650789251225 +268 2.3387411976724017 57.95437181534004 111.93177262613872 +269 2.3474678439323733 56.97733476048787 111.9829418575158 +270 2.356194490192345 56.0 112.00000000000003 +271 2.3649211364523164 55.02266523951215 111.98294185751584 +272 2.373647782712288 54.045628184659975 111.93177262613872 +273 2.3823744289722595 53.0691864503952 111.84650789251228 +274 2.3911010752322315 52.093637470328986 111.72717362910032 +275 2.399827721492203 51.119278406131166 111.57380618627549 +276 2.408554367752175 50.14640605701138 111.38645228124659 +277 2.4172810140121466 49.17531676931174 111.16516898382804 +278 2.426007660272118 48.20630634623634 110.91002369905588 +279 2.4347343065320897 47.2396699577471 110.62109414665544 +280 2.443460952792061 46.27570205065193 110.29846833736731 +281 2.4521875990520328 45.31469625891353 109.94224454613838 +282 2.4609142453120048 44.356945314205475 109.55253128218622 +283 2.4696408915719763 43.40274095674358 109.12944725594636 +284 2.478367537831948 42.452373846418624 108.67312134291161 +285 2.4870941840919194 41.50613347425886 108.18369254437567 +286 2.495820830351891 40.56430807424808 107.66130994509172 +287 2.504547476611863 39.627184535526744 107.10613266785997 +288 2.5132741228718345 38.695048315002964 106.51832982505724 +289 2.522000769131806 37.76818335039924 105.89808046712348 +290 2.530727415391778 36.84687197376254 105.24557352802174 +291 2.5394540616517496 35.93139482546318 104.56100776768659 +292 2.548180707911721 35.02203076870896 103.8445917114802 +293 2.5569073541716927 34.119056804600675 103.09654358667333 +294 2.5656340004316642 33.22274798775523 102.31709125597133 +295 2.574360646691636 32.33337734252086 101.50647214810482 +296 2.5830872929516078 31.451215779811665 100.6649331855067 +297 2.5918139392115793 30.576532014585375 99.79273070909721 +298 2.600540585471551 29.70959248399013 98.89013040019982 +299 2.609267231731523 28.85066126620511 97.9574071996123 +300 2.6179938779914944 28.000000000000007 96.99484522385713 +301 2.626720524251466 27.15786780503697 96.00273767863656 +302 2.6354471705114375 26.324521202940552 94.98138676951973 +303 2.644173816771409 25.500214039158514 93.93110360988749 +304 2.652900463031381 24.685197405638167 92.85220812616467 +305 2.6616271092913526 23.87971956434142 91.74502896036708 +306 2.670353755551324 23.0840258716215 90.60990336999411 +307 2.6790804018112957 22.29835870348532 89.44717712529682 +308 2.6878070480712672 21.522957381763167 88.2572044039529 +309 2.696533694331239 20.75805810120915 87.04034768318078 +310 2.705260340591211 20.003893857553802 85.79697762932555 +311 2.7139869868511823 19.260694376531625 84.52747298495049 +312 2.7227136331111543 18.528686043903946 83.23222045346814 +313 2.731440279371126 17.80809183650009 81.91161458134708 +314 2.7401669256310974 17.09913125429616 80.56605763792894 +315 2.748893571891069 16.402020253553342 79.19595949289334 +316 2.7576202181510405 15.71697118103554 77.80173749140775 +317 2.766346864411012 15.044192709326467 76.38381632699988 +318 2.7750735106709836 14.383889773265967 74.9426279121922 +319 2.7838001569309556 13.736263507524773 73.47861124693682 +320 2.792526803190927 13.10151118533725 71.99221228489245 +321 2.801253449450899 12.479826158409637 70.48388379758177 +322 2.8099800957108707 11.871397798023567 68.9540852364737 +323 2.8187067419708423 11.276411437351614 67.40328259302939 +324 2.827433388230814 10.695048315002955 65.831948256757 +325 2.8361600344907854 10.12748551981646 64.2405608713172 +326 2.844886680750757 9.573895936917687 62.62960518872369 +327 2.853613327010729 9.034448195056253 60.999571921683035 +328 2.8623399732707004 8.50930661524014 59.35095759411894 +329 2.871066619530672 7.998631160681722 57.68426438992611 +330 2.8797932657906435 7.5025773880714635 56.000000000000036 +331 2.888519912050615 7.021296400193845 54.29867746758981 +332 2.897246558310587 6.554934799900095 52.580815032019785 +333 2.9059732045705586 6.103634645451398 50.84693597082927 +334 2.91469985083053 5.667533407246658 49.09756844037675 +335 2.923426497090502 5.246763925947597 47.33324531495834 +336 2.9321531433504737 4.841454372014345 45.554504024489646 +337 2.9408797896104453 4.451728206663358 43.761886390798665 +338 2.949606435870417 4.0777041442599105 41.95593846258219 +339 2.9583330821303884 3.719496116156715 40.13721034907368 +340 2.96705972839036 3.3772132359891405 38.306256052474986 +341 2.975786374650332 3.050959766438263 36.463633299201526 +342 2.9845130209103035 2.7408350874714147 34.609903369994136 +343 2.993239667170275 2.4469336660700156 32.745630928946575 +344 3.001966313430247 2.1693450274541357 30.8713838515039 +345 3.0106929596902186 1.9081537278121807 28.98773305148233 +346 3.01941960595019 1.6634393285442162 27.09525230716282 +347 3.0281462522101616 1.43527637202682 25.194518086512918 +348 3.036872898470133 1.2237343589068939 23.28610937158911 +349 3.045599544730105 1.0288777269308111 21.370607482172996 +350 3.0543261909900767 0.8507658313163322 19.448595898696194 +351 3.0630528372500483 0.6894529266722849 17.52066008450588 +352 3.07177948351002 0.5449881504720722 15.587387307527408 +353 3.0805061297699914 0.41741550808597516 13.649366461376596 +354 3.089232776029963 0.3067738593767144 11.707187885977264 +355 3.097959422289935 0.21309690686224325 9.76144318773774 +356 3.1066860685499065 0.13641318544983871 7.812725059342073 +357 3.1154127148098785 0.07674605374386534 5.861627099209646 +358 3.12413936106985 0.03411368693063732 3.9087436306800853 +359 3.1328660073298216 0.00852907124207647 1.9546695209757408 +360 3.141592653589793 0.0 4.973799150320701e-14 +361 3.1503192998497647 0.00852907124207647 -1.954669520975716 +362 3.159045946109736 0.03411368693063732 -3.9087436306800356 +363 3.1677725923697078 0.07674605374386534 -5.861627099209621 +364 3.1764992386296798 0.13641318544983871 -7.812725059342023 +365 3.1852258848896513 0.21309690686224325 -9.76144318773769 +366 3.193952531149623 0.3067738593767082 -11.707187885977115 +367 3.2026791774095944 0.41741550808596894 -13.649366461376422 +368 3.211405823669566 0.5449881504720411 -15.587387307527235 +369 3.2201324699295375 0.6894529266722662 -17.52066008450573 +370 3.2288591161895095 0.8507658313163322 -19.448595898696144 +371 3.237585762449481 1.0288777269308111 -21.370607482172947 +372 3.246312408709453 1.2237343589068876 -23.28610937158906 +373 3.255039054969425 1.43527637202682 -25.194518086512968 +374 3.2637657012293966 1.6634393285442162 -27.095252307162845 +375 3.272492347489368 1.9081537278121807 -28.98773305148238 +376 3.2812189937493397 2.1693450274541606 -30.871383851503918 +377 3.2899456400093112 2.4469336660700094 -32.745630928946525 +378 3.2986722862692828 2.740835087471396 -34.609903369994086 +379 3.3073989325292543 3.050959766438263 -36.463633299201504 +380 3.3161255787892263 3.3772132359891405 -38.306256052474936 +381 3.324852225049198 3.719496116156715 -40.137210349073634 +382 3.3335788713091694 4.077704144259892 -41.95593846258213 +383 3.342305517569141 4.451728206663327 -43.76188639079863 +384 3.3510321638291125 4.841454372014327 -45.55450402448958 +385 3.359758810089084 5.246763925947579 -47.33324531495826 +386 3.368485456349056 5.667533407246658 -49.09756844037666 +387 3.3772121026090276 6.103634645451398 -50.846935970829215 +388 3.385938748868999 6.554934799900082 -52.580815032019714 +389 3.3946653951289707 7.021296400193814 -54.298677467589684 +390 3.4033920413889422 7.50257738807142 -55.9999999999999 +391 3.412118687648914 7.998631160681678 -57.68426438992598 +392 3.4208453339088853 8.509306615240115 -59.35095759411885 +393 3.4295719801688573 9.034448195056235 -60.999571921683 +394 3.4382986264288293 9.573895936917669 -62.629605188723666 +395 3.447025272688801 10.127485519816453 -64.24056087131714 +396 3.455751918948773 10.695048315002968 -65.83194825675703 +397 3.4644785652087444 11.276411437351609 -67.40328259302946 +398 3.473205211468716 11.87139779802358 -68.95408523647373 +399 3.4819318577286875 12.479826158409637 -70.4838837975818 +400 3.490658503988659 13.101511185337225 -71.99221228489239 +401 3.4993851502486306 13.736263507524761 -73.47861124693677 +402 3.5081117965086026 14.383889773265935 -74.94262791219217 +403 3.516838442768574 15.04419270932646 -76.38381632699983 +404 3.5255650890285457 15.716971181035527 -77.80173749140768 +405 3.5342917352885173 16.402020253553324 -79.19595949289331 +406 3.543018381548489 17.09913125429614 -80.5660576379289 +407 3.5517450278084604 17.808091836500072 -81.91161458134704 +408 3.560471674068432 18.528686043903903 -83.23222045346809 +409 3.569198320328404 19.260694376531603 -84.52747298495045 +410 3.5779249665883754 20.00389385755379 -85.7969776293255 +411 3.586651612848347 20.758058101209073 -87.04034768318068 +412 3.5953782591083185 21.522957381763117 -88.25720440395278 +413 3.60410490536829 22.29835870348526 -89.44717712529673 +414 3.6128315516282616 23.084025871621467 -90.60990336999403 +415 3.6215581978882336 23.879719564341396 -91.74502896036705 +416 3.630284844148205 24.68519740563816 -92.85220812616463 +417 3.639011490408177 25.50021403915848 -93.93110360988749 +418 3.647738136668149 26.324521202940552 -94.98138676951974 +419 3.6564647829281207 27.157867805036986 -96.0027376786366 +420 3.6651914291880923 28.000000000000014 -96.99484522385714 +421 3.673918075448064 28.85066126620513 -97.95740719961233 +422 3.6826447217080354 29.709592483990107 -98.89013040019981 +423 3.691371367968007 30.576532014585357 -99.79273070909716 +424 3.7000980142279785 31.451215779811655 -100.66493318550667 +425 3.7088246604879505 32.33337734252085 -101.50647214810479 +426 3.717551306747922 33.222747987755184 -102.31709125597129 +427 3.7262779530078936 34.11905680460067 -103.0965435866733 +428 3.735004599267865 35.02203076870891 -103.84459171148016 +429 3.7437312455278366 35.93139482546316 -104.56100776768656 +430 3.752457891787808 36.846871973762525 -105.24557352802171 +431 3.76118453804778 37.76818335039924 -105.89808046712348 +432 3.7699111843077517 38.695048315002936 -106.51832982505718 +433 3.7786378305677233 39.62718453552673 -107.10613266785995 +434 3.787364476827695 40.56430807424802 -107.66130994509167 +435 3.7960911230876664 41.506133474258796 -108.18369254437559 +436 3.804817769347638 42.45237384641857 -108.67312134291156 +437 3.8135444156076095 43.402740956743486 -109.12944725594632 +438 3.8222710618675815 44.35694531420544 -109.5525312821862 +439 3.8309977081275535 45.3146962589135 -109.94224454613837 +440 3.839724354387525 46.275702050651894 -110.29846833736728 +441 3.848451000647497 47.23966995774711 -110.62109414665542 +442 3.8571776469074686 48.20630634623636 -110.91002369905587 +443 3.86590429316744 49.17531676931175 -111.16516898382807 +444 3.8746309394274117 50.146406057011404 -111.38645228124662 +445 3.883357585687383 51.119278406131116 -111.5738061862755 +446 3.8920842319473548 52.09363747032898 -111.72717362910029 +447 3.9008108782073267 53.06918645039516 -111.84650789251225 +448 3.9095375244672983 54.04562818465996 -111.93177262613872 +449 3.91826417072727 55.02266523951213 -111.9829418575158 +450 3.9269908169872414 55.999999999999986 -112.0 +451 3.935717463247213 56.97733476048785 -111.9829418575158 +452 3.9444441095071845 57.95437181534001 -111.93177262613872 +453 3.953170755767156 58.9308135496048 -111.84650789251228 +454 3.961897402027128 59.906362529671014 -111.72717362910032 +455 3.9706240482870996 60.88072159386883 -111.57380618627549 +456 3.979350694547071 61.85359394298856 -111.38645228124662 +457 3.9880773408070427 62.82468323068822 -111.16516898382807 +458 3.9968039870670142 63.79369365376361 -110.91002369905588 +459 4.005530633326986 64.76033004225287 -110.62109414665542 +460 4.014257279586958 65.72429794934807 -110.29846833736731 +461 4.022983925846929 66.68530374108641 -109.94224454613837 +462 4.031710572106902 67.64305468579457 -109.5525312821862 +463 4.040437218366873 68.59725904325641 -109.12944725594635 +464 4.049163864626845 69.5476261535814 -108.67312134291159 +465 4.057890510886816 70.49386652574113 -108.18369254437566 +466 4.066617157146788 71.43569192575195 -107.6613099450917 +467 4.07534380340676 72.37281546447329 -107.10613266785995 +468 4.084070449666731 73.30495168499705 -106.51832982505721 +469 4.092797095926703 74.2318166496008 -105.89808046712346 +470 4.101523742186674 75.15312802623743 -105.24557352802174 +471 4.110250388446646 76.06860517453683 -104.56100776768659 +472 4.118977034706617 76.97796923129101 -103.84459171148023 +473 4.127703680966589 77.88094319539931 -103.09654358667335 +474 4.136430327226561 78.77725201224482 -102.31709125597129 +475 4.145156973486532 79.66662265747911 -101.50647214810483 +476 4.153883619746504 80.54878422018834 -100.6649331855067 +477 4.162610266006475 81.42346798541455 -99.79273070909727 +478 4.171336912266447 82.29040751600985 -98.89013040019985 +479 4.1800635585264185 83.14933873379479 -97.9574071996124 +480 4.1887902047863905 83.99999999999994 -96.99484522385715 +481 4.1975168510463625 84.84213219496301 -96.00273767863658 +482 4.206243497306334 85.67547879705941 -94.9813867695198 +483 4.214970143566306 86.49978596084149 -93.93110360988751 +484 4.223696789826278 87.31480259436184 -92.85220812616467 +485 4.23242343608625 88.12028043565861 -91.74502896036701 +486 4.241150082346221 88.91597412837848 -90.60990336999413 +487 4.249876728606193 89.70164129651471 -89.44717712529679 +488 4.258603374866164 90.47704261823684 -88.2572044039529 +489 4.267330021126136 91.24194189879088 -87.04034768318071 +490 4.276056667386108 91.99610614244622 -85.79697762932548 +491 4.284783313646079 92.73930562346838 -84.5274729849505 +492 4.293509959906051 93.47131395609605 -83.23222045346814 +493 4.302236606166022 94.19190816349987 -81.91161458134715 +494 4.310963252425994 94.90086874570383 -80.56605763792895 +495 4.319689898685965 95.59797974644661 -79.19595949289341 +496 4.328416544945937 96.28302881896445 -77.80173749140775 +497 4.337143191205909 96.95580729067356 -76.38381632699982 +498 4.34586983746588 97.61611022673405 -74.94262791219218 +499 4.354596483725852 98.26373649247523 -73.47861124693682 +500 4.363323129985823 98.89848881466274 -71.99221228489252 +501 4.372049776245795 99.52017384159035 -70.48388379758187 +502 4.380776422505767 100.12860220197642 -68.95408523647373 +503 4.389503068765738 100.72358856264836 -67.40328259302949 +504 4.39822971502571 101.30495168499706 -65.83194825675703 +505 4.4069563612856815 101.87251448018348 -64.24056087131727 +506 4.4156830075456535 102.4261040630823 -62.62960518872373 +507 4.4244096538056255 102.96555180494374 -60.999571921683035 +508 4.4331363000655974 103.49069338475988 -59.35095759411889 +509 4.4418629463255686 104.00136883931827 -57.68426438992611 +510 4.4505895925855405 104.49742261192857 -55.99999999999997 +511 4.4593162388455125 104.9787035998062 -54.29867746758967 +512 4.468042885105484 105.44506520009992 -52.580815032019785 +513 4.476769531365456 105.8963653545486 -50.846935970829165 +514 4.485496177625427 106.33246659275333 -49.09756844037674 +515 4.494222823885399 106.75323607405241 -47.33324531495834 +516 4.50294947014537 107.15854562798562 -45.55450402448973 +517 4.511676116405342 107.54827179333664 -43.761886390798665 +518 4.520402762665314 107.92229585574009 -41.955938462582104 +519 4.529129408925285 108.2805038838433 -40.13721034907368 +520 4.537856055185257 108.62278676401087 -38.30625605247489 +521 4.546582701445228 108.94904023356173 -36.463633299201646 +522 4.5553093477052 109.2591649125286 -34.609903369994164 +523 4.564035993965171 109.55306633392998 -32.74563092894667 +524 4.572762640225143 109.83065497254584 -30.871383851504 +525 4.581489286485115 110.09184627218784 -28.987733051482323 +526 4.590215932745086 110.33656067145577 -27.09525230716292 +527 4.598942579005058 110.56472362797318 -25.19451808651294 +528 4.607669225265029 110.77626564109309 -23.286109371589202 +529 4.616395871525002 110.9711222730692 -21.370607482172918 +530 4.625122517784973 111.14923416868365 -19.448595898696215 +531 4.633849164044945 111.31054707332773 -17.520660084505806 +532 4.642575810304916 111.45501184952792 -15.587387307527404 +533 4.651302456564888 111.58258449191403 -13.649366461376497 +534 4.66002910282486 111.69322614062331 -11.707187885977092 +535 4.6687557490848315 111.78690309313774 -9.761443187737738 +536 4.6774823953448035 111.86358681455015 -7.812725059341997 +537 4.686209041604775 111.92325394625612 -5.861627099209795 +538 4.694935687864747 111.96588631306938 -3.90874363068011 +539 4.703662334124718 111.9914709287579 -1.9546695209758649 +540 4.71238898038469 112.0 -4.973799150320701e-14 +541 4.721115626644662 111.9914709287579 1.9546695209757903 +542 4.729842272904633 111.96588631306938 3.9087436306800356 +543 4.738568919164605 111.92325394625612 5.861627099209696 +544 4.747295565424576 111.86358681455016 7.812725059341922 +545 4.756022211684548 111.78690309313774 9.761443187737639 +546 4.764748857944519 111.69322614062331 11.707187885977017 +547 4.773475504204491 111.58258449191406 13.649366461376403 +548 4.782202150464463 111.45501184952792 15.587387307527305 +549 4.790928796724434 111.31054707332774 17.52066008450573 +550 4.799655442984406 111.14923416868365 19.44859589869614 +551 4.808382089244377 110.9711222730692 21.370607482172844 +552 4.81710873550435 110.77626564109309 23.286109371589152 +553 4.825835381764321 110.56472362797318 25.194518086512865 +554 4.834562028024293 110.33656067145579 27.09525230716282 +555 4.843288674284264 110.09184627218784 28.987733051482273 +556 4.852015320544236 109.83065497254586 30.8713838515039 +557 4.860741966804208 109.55306633392999 32.745630928946575 +558 4.869468613064179 109.2591649125286 34.609903369994086 +559 4.878195259324151 108.94904023356173 36.463633299201575 +560 4.886921905584122 108.62278676401088 38.306256052474836 +561 4.895648551844094 108.2805038838433 40.137210349073634 +562 4.9043751981040655 107.9222958557401 41.95593846258201 +563 4.9131018443640375 107.54827179333667 43.76188639079863 +564 4.9218284906240095 107.15854562798566 45.554504024489646 +565 4.930555136883981 106.75323607405241 47.33324531495823 +566 4.939281783143953 106.33246659275335 49.09756844037664 +567 4.948008429403924 105.89636535454864 50.84693597082913 +568 4.956735075663896 105.44506520009992 52.580815032019686 +569 4.965461721923867 104.97870359980621 54.298677467589584 +570 4.974188368183839 104.49742261192857 55.9999999999999 +571 4.982915014443811 104.00136883931827 57.68426438992606 +572 4.991641660703782 103.4906933847599 59.350957594118796 +573 5.000368306963754 102.96555180494377 60.999571921683 +574 5.009094953223726 102.42610406308233 62.62960518872365 +575 5.017821599483698 101.87251448018353 64.24056087131721 +576 5.026548245743669 101.30495168499706 65.83194825675696 +577 5.035274892003641 100.7235885626484 67.40328259302943 +578 5.044001538263612 100.12860220197646 68.95408523647365 +579 5.052728184523584 99.52017384159038 70.48388379758177 +580 5.061454830783556 98.89848881466276 71.99221228489243 +581 5.070181477043527 98.26373649247523 73.47861124693678 +582 5.078908123303499 97.61611022673407 74.94262791219217 +583 5.08763476956347 96.95580729067359 76.38381632699976 +584 5.096361415823442 96.28302881896447 77.80173749140768 +585 5.105088062083414 95.59797974644664 79.19595949289337 +586 5.113814708343385 94.90086874570387 80.5660576379289 +587 5.122541354603357 94.19190816349992 81.9116145813471 +588 5.1312680008633285 93.47131395609611 83.23222045346809 +589 5.1399946471233005 92.73930562346841 84.52747298495044 +590 5.148721293383272 91.99610614244627 85.79697762932545 +591 5.1574479396432436 91.24194189879093 87.04034768318068 +592 5.1661745859032155 90.47704261823687 88.25720440395287 +593 5.174901232163187 89.70164129651475 89.44717712529673 +594 5.183627878423159 88.91597412837851 90.6099033699941 +595 5.19235452468313 88.12028043565866 91.74502896036698 +596 5.201081170943102 87.31480259436185 92.85220812616458 +597 5.209807817203074 86.49978596084152 93.93110360988749 +598 5.218534463463046 85.67547879705945 94.98138676951973 +599 5.227261109723017 84.84213219496309 96.00273767863654 +600 5.235987755982989 84.0 96.99484522385713 +601 5.244714402242961 83.14933873379483 97.95740719961239 +602 5.253441048502932 82.29040751600988 98.8901304001998 +603 5.262167694762904 81.4234679854146 99.79273070909724 +604 5.270894341022875 80.54878422018837 100.66493318550665 +605 5.279620987282847 79.66662265747917 101.50647214810483 +606 5.288347633542818 78.77725201224486 102.31709125597125 +607 5.29707427980279 77.88094319539934 103.0965435866733 +608 5.305800926062762 76.97796923129106 103.84459171148019 +609 5.314527572322733 76.06860517453686 104.56100776768656 +610 5.323254218582705 75.15312802623744 105.24557352802172 +611 5.331980864842676 74.23181664960083 105.89808046712344 +612 5.340707511102648 73.30495168499708 106.51832982505718 +613 5.349434157362619 72.37281546447335 107.10613266785991 +614 5.358160803622591 71.43569192575198 107.66130994509166 +615 5.366887449882563 70.49386652574117 108.18369254437562 +616 5.3756140961425345 69.54762615358148 108.67312134291154 +617 5.3843407424025065 68.59725904325647 109.12944725594632 +618 5.393067388662478 67.6430546857946 109.55253128218618 +619 5.4017940349224505 66.68530374108646 109.9422445461384 +620 5.410520681182422 65.72429794934811 110.2984683373673 +621 5.419247327442394 64.76033004225289 110.62109414665544 +622 5.427973973702365 63.7936936537637 110.91002369905586 +623 5.436700619962337 62.82468323068823 111.16516898382807 +624 5.445427266222309 61.85359394298856 111.38645228124662 +625 5.45415391248228 60.880721593868884 111.5738061862755 +626 5.462880558742252 59.906362529671 111.7271736291003 +627 5.471607205002223 58.930813549604885 111.84650789251225 +628 5.480333851262195 57.95437181534007 111.93177262613872 +629 5.489060497522166 56.977334760487956 111.9829418575158 +630 5.497787143782138 56.000000000000014 112.0 +631 5.50651379004211 55.0226652395121 111.98294185751584 +632 5.515240436302081 54.04562818465999 111.93177262613872 +633 5.523967082562053 53.06918645039516 111.84650789251225 +634 5.532693728822024 52.09363747032904 111.72717362910034 +635 5.541420375081996 51.11927840613117 111.57380618627552 +636 5.550147021341967 50.146406057011504 111.3864522812466 +637 5.558873667601939 49.17531676931179 111.16516898382808 +638 5.567600313861911 48.20630634623636 110.91002369905587 +639 5.576326960121882 47.239669957747125 110.62109414665545 +640 5.585053606381854 46.27570205065193 110.29846833736731 +641 5.593780252641825 45.31469625891358 109.94224454613841 +642 5.602506898901798 44.35694531420543 109.5525312821862 +643 5.611233545161769 43.40274095674357 109.12944725594632 +644 5.619960191421741 42.4523738464186 108.6731213429116 +645 5.6286868376817125 41.506133474258874 108.18369254437566 +646 5.6374134839416845 40.564308074248046 107.66130994509169 +647 5.6461401302016565 39.627184535526695 107.10613266785994 +648 5.654866776461628 38.69504831500296 106.51832982505721 +649 5.6635934227216 37.76818335039921 105.89808046712345 +650 5.672320068981571 36.84687197376262 105.24557352802175 +651 5.681046715241543 35.93139482546321 104.56100776768659 +652 5.689773361501514 35.02203076870898 103.84459171148023 +653 5.698500007761486 34.11905680460069 103.09654358667335 +654 5.707226654021458 33.22274798775518 102.31709125597129 +655 5.715953300281429 32.33337734252088 101.50647214810483 +656 5.724679946541401 31.451215779811676 100.6649331855067 +657 5.733406592801372 30.576532014585457 99.7927307090973 +658 5.742133239061344 29.709592483990157 98.89013040019985 +659 5.750859885321315 28.850661266205215 97.95740719961245 +660 5.759586531581287 28.00000000000005 96.99484522385718 +661 5.768313177841259 27.15786780503697 96.0027376786366 +662 5.77703982410123 26.324521202940595 94.98138676951979 +663 5.785766470361202 25.50021403915853 93.93110360988754 +664 5.794493116621174 24.685197405638167 92.85220812616467 +665 5.803219762881146 23.879719564341396 91.74502896036705 +666 5.811946409141117 23.084025871621517 90.60990336999414 +667 5.820673055401089 22.29835870348529 89.4471771252968 +668 5.82939970166106 21.522957381763185 88.25720440395291 +669 5.838126347921032 20.75805810120912 87.04034768318076 +670 5.846852994181004 20.00389385755379 85.7969776293255 +671 5.8555796404409755 19.260694376531617 84.52747298495052 +672 5.8643062867009474 18.528686043903946 83.23222045346814 +673 5.8730329329609186 17.80809183650013 81.91161458134718 +674 5.8817595792208905 17.099131254296154 80.56605763792896 +675 5.890486225480862 16.402020253553403 79.19595949289342 +676 5.899212871740834 15.716971181035557 77.80173749140775 +677 5.907939518000806 15.04419270932646 76.38381632699983 +678 5.916666164260777 14.383889773265967 74.9426279121922 +679 5.925392810520749 13.736263507524779 73.47861124693686 +680 5.93411945678072 13.101511185337287 71.99221228489255 +681 5.942846103040692 12.479826158409672 70.48388379758185 +682 5.951572749300664 11.871397798023555 68.95408523647374 +683 5.960299395560635 11.276411437351639 67.40328259302953 +684 5.969026041820607 10.695048315002968 65.83194825675702 +685 5.977752688080578 10.127485519816496 64.24056087131731 +686 5.98647933434055 9.573895936917706 62.629605188723744 +687 5.995205980600522 9.034448195056253 60.999571921683035 +688 6.003932626860494 8.509306615240135 59.35095759411889 +689 6.012659273120465 7.998631160681722 57.68426438992613 +690 6.021385919380437 7.502577388071445 56.0 +691 6.030112565640409 7.021296400193801 54.29867746758968 +692 6.03883921190038 6.554934799900107 52.580815032019785 +693 6.047565858160352 6.103634645451379 50.84693597082921 +694 6.056292504420323 5.667533407246658 49.09756844037675 +695 6.065019150680295 5.246763925947597 47.33324531495834 +696 6.073745796940266 4.8414543720143515 45.55450402448974 +697 6.082472443200238 4.451728206663333 43.76188639079871 +698 6.09119908946021 4.077704144259886 41.95593846258211 +699 6.0999257357201815 3.719496116156721 40.13721034907371 +700 6.1086523819801535 3.377213235989122 38.306256052474914 +701 6.117379028240125 3.0509597664382753 36.46363329920168 +702 6.126105674500097 2.7408350874714023 34.609903369994186 +703 6.134832320760068 2.446933666070022 32.74563092894667 +704 6.14355896702004 2.169345027454142 30.871383851504007 +705 6.152285613280012 1.9081537278121683 28.987733051482348 +706 6.161012259539983 1.6634393285441975 27.095252307162927 +707 6.169738905799955 1.43527637202682 25.19451808651294 +708 6.178465552059926 1.2237343589069125 23.286109371589227 +709 6.187192198319899 1.0288777269308111 21.370607482172947 +710 6.19591884457987 0.8507658313163384 19.448595898696244 +711 6.204645490839842 0.6894529266722724 17.520660084505806 +712 6.213372137099813 0.5449881504720722 15.587387307527408 +713 6.222098783359785 0.41741550808596894 13.649366461376522 +714 6.230825429619757 0.3067738593767082 11.707187885977115 +715 6.239552075879728 0.21309690686224325 9.761443187737763 +716 6.2482787221397 0.13641318544986358 7.812725059341995 +717 6.257005368399671 0.07674605374388399 5.861627099209795 +718 6.265732014659643 0.03411368693063732 3.90874363068011 +719 6.274458660919614 0.008529071242088904 1.95466952097589 + +HARMONIC_4 +N 720 RADIANS + +0 0.0 46.0 -0.0 +1 0.008726646259971648 45.999124230475935 0.2007103164625992 +2 0.017453292519943295 45.996496988597 0.4014053480575184 +3 0.02617993877991494 45.99211847443782 0.6020698110810813 +4 0.03490658503988659 45.985989021439195 0.8026884241575211 +5 0.04363323129985824 45.97810909638273 1.0032459094027302 +6 0.05235987755982988 45.9684792993552 1.2037269935877062 +7 0.061086523819801536 45.95710036370294 1.404116409301706 +8 0.06981317007977318 45.943973155975954 1.6043988961148796 +9 0.07853981633974483 45.929098675861944 1.804559201740436 +10 0.08726646259971647 45.91247805611015 2.004582083196137 +11 0.09599310885968812 45.89411256244511 2.204452307965154 +12 0.10471975511965977 45.874003593470285 2.4041546551560313 +13 0.11344640137963141 45.85215268056152 2.6036739166618528 +14 0.12217304763960307 45.828561487750406 2.802994898318391 +15 0.1308996938995747 45.80323181159764 3.002102421061186 +16 0.13962634015954636 45.77616558105612 3.200981322081504 +17 0.148352986419518 45.74736485732409 3.399616455981045 +18 0.15707963267948966 45.71683183368817 3.5979926959253117 +19 0.16580627893946132 45.684568835356316 3.796094934795584 +20 0.17453292519943295 45.65057831928079 3.993908086339397 +21 0.1832595714594046 45.61486287397096 4.191417086319392 +22 0.19198621771937624 45.57742521929627 4.388606893660532 +23 0.20071286397934787 45.538268206279085 4.585462491595536 +24 0.20943951023931953 45.49739481687753 4.781968888808466 +25 0.2181661564992912 45.454808163758464 4.978111120576366 +26 0.22689280275926282 45.410511490060415 5.173874249908891 +27 0.23561944901923448 45.36450816914657 5.369243368685822 +28 0.24434609527920614 45.31680170434792 5.564203598792361 +29 0.2530727415391778 45.267395728696485 5.758740093252156 +30 0.2617993877991494 45.21629400464857 5.952838037357978 +31 0.27052603405912107 45.163500423798325 6.146482649799909 +32 0.2792526803190927 45.109019006581335 6.33965918379098 +33 0.28797932657906433 45.05285390196844 6.532352928190221 +34 0.296705972839036 44.99500938714982 6.724549208622946 +35 0.30543261909900765 44.93548986720921 6.916233388598285 +36 0.3141592653589793 44.874299874788534 7.107390870623791 +37 0.32288591161895097 44.811444069742585 7.298007097317118 +38 0.33161255787892263 44.74692723878429 7.488067552514604 +39 0.3403392041388943 44.68075429512011 7.677557762376729 +40 0.3490658503988659 44.61293027807589 7.866463296490379 +41 0.35779249665883756 44.54346035271315 8.054769768967752 +42 0.3665191429188092 44.472349809435634 8.242462839541908 +43 0.3752457891787809 44.39960406358656 8.429528214658838 +44 0.3839724354387525 44.32522865503611 8.615951648565975 +45 0.39269908169872414 44.249229247759594 8.801718944397068 +46 0.40142572795869574 44.17161162940613 8.986815955253293 +47 0.41015237421866746 44.09238171085785 9.171228585280662 +48 0.41887902047863906 44.011545525779816 9.354942790743404 +49 0.42760566673861067 43.92910923016049 9.537944581093495 +50 0.4363323129985824 43.84507910184295 9.720220020036088 +51 0.445058959258554 43.7594615400468 9.901755226590785 +52 0.45378560551852565 43.672263064880845 10.08253637614878 +53 0.4625122517784973 43.58349031684658 10.262549701525602 +54 0.47123889803846897 43.49315005633246 10.441781494009577 +55 0.4799655442984406 43.401249163099095 10.620218104405781 +56 0.4886921905584123 43.30779463575532 10.797845944075487 +57 0.4974188368183839 43.2127935912252 10.974651485970993 +58 0.5061454830783556 43.1162532642061 11.150621265665752 +59 0.5148721293383272 43.018181006617695 11.325741882379742 +60 0.5235987755982988 42.918584287042094 11.499999999999998 +61 0.5323254218582705 42.81747069015509 11.673382348096192 +62 0.5410520681182421 42.71484791614858 11.845875722931249 +63 0.5497787143782138 42.61072378014412 12.017466988466825 +64 0.5585053606381855 42.50510621159779 12.188143077363716 +65 0.5672320068981571 42.39800325369637 12.357890991976952 +66 0.5759586531581287 42.28942306274475 12.52669780534562 +67 0.5846852994181004 42.179373907544864 12.69455066217734 +68 0.593411945678072 42.06786416876596 12.861436779827178 +69 0.6021385919380438 41.954902338306354 13.027343449271157 +70 0.6108652381980153 41.840497018646815 13.192258036074058 +71 0.619591884457987 41.724656922195344 13.356167981351614 +72 0.6283185307179586 41.60739087062379 13.519060802726882 +73 0.6370451769779303 41.488707794195996 13.680924095280849 +74 0.6457718232379019 41.368616731087734 13.84174553249711 +75 0.6544984694978736 41.247126826698405 14.001512867200574 +76 0.6632251157578453 41.1242473329546 14.16021393249014 +77 0.6719517620178168 40.99998760760552 14.317836642665249 +78 0.6806784082777886 40.87435711351033 14.474368994146262 +79 0.6894050545377601 40.74736541791756 14.629799066388571 +80 0.6981317007977318 40.61902219173649 14.784115022790406 +81 0.7068583470577035 40.48933720880071 14.937305111594224 +82 0.7155849933176751 40.35832034512376 15.089357666781668 +83 0.7243116395776468 40.225981578147056 15.240261108961963 +84 0.7330382858376184 40.09233098598007 15.390003946253739 +85 0.74176493209759 39.95737874663285 15.538574775160184 +86 0.7504915783575618 39.82113513724092 15.685962281437467 +87 0.7592182246175333 39.68361053328261 15.832155240956343 +88 0.767944870877505 39.544815407788974 15.977142520556937 +89 0.7766715171374766 39.40476033054617 16.12091307889657 +90 0.7853981633974483 39.26345596729059 16.263455967290593 +91 0.7941248096574199 39.12091307889657 16.404760330546175 +92 0.8028514559173915 38.97714252055694 16.544815407788974 +93 0.8115781021773633 38.83215524095634 16.683610533282614 +94 0.8203047484373349 38.68596228143747 16.82113513724092 +95 0.8290313946973066 38.538574775160185 16.957378746632852 +96 0.8377580409572781 38.39000394625374 17.092330985980066 +97 0.8464846872172498 38.24026110896197 17.225981578147046 +98 0.8552113334772213 38.089357666781666 17.358320345123754 +99 0.8639379797371932 37.93730511159422 17.489337208800716 +100 0.8726646259971648 37.78411502279041 17.619022191736494 +101 0.8813912722571364 37.62979906638857 17.74736541791756 +102 0.890117918517108 37.47436899414626 17.87435711351033 +103 0.8988445647770796 37.317836642665256 17.99998760760552 +104 0.9075712110370513 37.16021393249014 18.124247332954603 +105 0.9162978572970231 37.00151286720057 18.24712682669841 +106 0.9250245035569946 36.841745532497114 18.368616731087734 +107 0.9337511498169663 36.680924095280844 18.488707794195996 +108 0.9424777960769379 36.519060802726884 18.607390870623792 +109 0.9512044423369095 36.35616798135162 18.72465692219534 +110 0.9599310885968813 36.19225803607406 18.840497018646815 +111 0.9686577348568529 36.02734344927116 18.95490233830636 +112 0.9773843811168246 35.86143677982717 19.06786416876596 +113 0.9861110273767961 35.694550662177335 19.179373907544868 +114 0.9948376736367678 35.52669780534563 19.289423062744753 +115 1.0035643198967394 35.35789099197695 19.398003253696373 +116 1.0122909661567112 35.18814307736372 19.5051062115978 +117 1.0210176124166828 35.01746698846682 19.610723780144124 +118 1.0297442586766543 34.84587572293125 19.71484791614858 +119 1.038470904936626 34.673382348096204 19.81747069015509 +120 1.0471975511965976 34.5 19.918584287042087 +121 1.0559241974565694 34.325741882379745 20.01818100661769 +122 1.064650843716541 34.150621265665755 20.1162532642061 +123 1.0733774899765127 33.974651485970995 20.212793591225203 +124 1.0821041362364843 33.79784594407549 20.30779463575532 +125 1.0908307824964558 33.62021810440579 20.401249163099095 +126 1.0995574287564276 33.441781494009575 20.49315005633246 +127 1.1082840750163994 33.2625497015256 20.58349031684658 +128 1.117010721276371 33.08253637614878 20.67226306488084 +129 1.1257373675363425 32.901755226590794 20.759461540046793 +130 1.1344640137963142 32.72022002003609 20.845079101842952 +131 1.1431906600562858 32.5379445810935 20.929109230160492 +132 1.1519173063162573 32.35494279074341 21.011545525779816 +133 1.160643952576229 32.171228585280666 21.092381710857854 +134 1.1693705988362009 31.98681595525329 21.17161162940613 +135 1.1780972450961724 31.801718944397066 21.249229247759594 +136 1.186823891356144 31.61595164856598 21.32522865503611 +137 1.1955505376161157 31.429528214658838 21.399604063586565 +138 1.2042771838760875 31.2424628395419 21.47234980943564 +139 1.213003830136059 31.054769768967752 21.543460352713144 +140 1.2217304763960306 30.866463296490384 21.612930278075893 +141 1.2304571226560024 30.67755776237673 21.680754295120106 +142 1.239183768915974 30.488067552514604 21.746927238784284 +143 1.2479104151759455 30.29800709731712 21.811444069742585 +144 1.2566370614359172 30.107390870623792 21.874299874788534 +145 1.265363707695889 29.91623338859828 21.93548986720922 +146 1.2740903539558606 29.724549208622946 21.995009387149818 +147 1.2828170002158321 29.532352928190225 22.05285390196844 +148 1.2915436464758039 29.339659183790978 22.109019006581335 +149 1.3002702927357754 29.146482649799907 22.16350042379833 +150 1.3089969389957472 28.952838037357978 22.21629400464857 +151 1.3177235852557188 28.758740093252154 22.267395728696478 +152 1.3264502315156905 28.564203598792353 22.31680170434792 +153 1.335176877775662 28.369243368685826 22.36450816914656 +154 1.3439035240356336 28.1738742499089 22.410511490060408 +155 1.3526301702956054 27.978111120576365 22.454808163758468 +156 1.3613568165555772 27.78196888880846 22.49739481687753 +157 1.3700834628155487 27.585462491595536 22.538268206279085 +158 1.3788101090755203 27.38860689366053 22.57742521929627 +159 1.3875367553354918 27.191417086319397 22.614862873970953 +160 1.3962634015954636 26.993908086339403 22.650578319280786 +161 1.4049900478554354 26.796094934795583 22.684568835356323 +162 1.413716694115407 26.597992695925313 22.71683183368817 +163 1.4224433403753785 26.39961645598105 22.747364857324087 +164 1.4311699866353502 26.200981322081503 22.77616558105612 +165 1.4398966328953218 26.002102421061192 22.80323181159764 +166 1.4486232791552935 25.802994898318392 22.82856148775041 +167 1.457349925415265 25.603673916661858 22.852152680561513 +168 1.4660765716752369 25.40415465515603 22.874003593470285 +169 1.4748032179352084 25.204452307965155 22.894112562445113 +170 1.48352986419518 25.00458208319614 22.912478056110146 +171 1.4922565104551517 24.804559201740435 22.929098675861944 +172 1.5009831567151235 24.60439889611488 22.943973155975957 +173 1.509709802975095 24.40411640930171 22.95710036370294 +174 1.5184364492350666 24.20372699358771 22.9684792993552 +175 1.5271630954950384 24.00324590940273 22.978109096382727 +176 1.53588974175501 23.802688424157527 22.9859890214392 +177 1.5446163880149815 23.602069811081087 22.992118474437817 +178 1.5533430342749532 23.401405348057523 22.996496988597 +179 1.562069680534925 23.200710316462597 22.99912423047594 +180 1.5707963267948966 23.0 23.0 +181 1.579522973054868 22.799289683537403 22.99912423047594 +182 1.5882496193148399 22.59859465194248 22.996496988597 +183 1.5969762655748114 22.39793018891892 22.992118474437817 +184 1.605702911834783 22.197311575842484 22.9859890214392 +185 1.6144295580947547 21.996754090597275 22.97810909638273 +186 1.6231562043547265 21.796273006412292 22.9684792993552 +187 1.6318828506146983 21.59588359069829 22.95710036370294 +188 1.6406094968746698 21.395601103885117 22.943973155975957 +189 1.6493361431346414 21.19544079825957 22.929098675861944 +190 1.6580627893946132 20.99541791680386 22.912478056110146 +191 1.6667894356545847 20.795547692034848 22.894112562445113 +192 1.6755160819145563 20.595845344843973 22.874003593470285 +193 1.684242728174528 20.396326083338145 22.852152680561513 +194 1.6929693744344996 20.19700510168161 22.82856148775041 +195 1.7016960206944711 19.99789757893882 22.80323181159764 +196 1.7104226669544427 19.7990186779185 22.77616558105612 +197 1.7191493132144147 19.600383544018953 22.747364857324087 +198 1.7278759594743864 19.402007304074687 22.71683183368817 +199 1.736602605734358 19.203905065204413 22.684568835356323 +200 1.7453292519943295 19.006091913660605 22.650578319280786 +201 1.7540558982543013 18.808582913680606 22.614862873970953 +202 1.7627825445142729 18.61139310633947 22.57742521929627 +203 1.7715091907742444 18.414537508404468 22.538268206279085 +204 1.780235837034216 18.21803111119154 22.49739481687753 +205 1.7889624832941877 18.021888879423635 22.454808163758468 +206 1.7976891295541593 17.82612575009111 22.410511490060415 +207 1.8064157758141308 17.630756631314185 22.364508169146568 +208 1.8151424220741026 17.435796401207647 22.31680170434792 +209 1.8238690683340746 17.241259906747842 22.267395728696474 +210 1.8325957145940461 17.047161962642022 22.21629400464857 +211 1.8413223608540177 16.853517350200093 22.16350042379833 +212 1.8500490071139892 16.660340816209022 22.109019006581335 +213 1.858775653373961 16.46764707180978 22.05285390196844 +214 1.8675022996339325 16.275450791377057 21.995009387149818 +215 1.876228945893904 16.08376661140172 21.93548986720922 +216 1.8849555921538759 15.892609129376211 21.874299874788534 +217 1.8936822384138474 15.701992902682884 21.811444069742585 +218 1.902408884673819 15.511932447485401 21.74692723878429 +219 1.9111355309337907 15.322442237623271 21.680754295120106 +220 1.9198621771937625 15.133536703509622 21.612930278075893 +221 1.9285888234537343 14.945230231032248 21.543460352713144 +222 1.9373154697137058 14.757537160458094 21.47234980943564 +223 1.9460421159736774 14.570471785341164 21.399604063586565 +224 1.9547687622336491 14.384048351434023 21.32522865503611 +225 1.9634954084936207 14.198281055602934 21.249229247759594 +226 1.9722220547535922 14.013184044746707 21.17161162940613 +227 1.980948701013564 13.828771414719338 21.092381710857854 +228 1.9896753472735356 13.645057209256601 21.01154552577982 +229 1.9984019935335071 13.462055418906505 20.929109230160496 +230 2.007128639793479 13.279779979963916 20.845079101842952 +231 2.015855286053451 13.098244773409206 20.759461540046793 +232 2.0245819323134224 12.917463623851214 20.672263064880838 +233 2.033308578573394 12.737450298474398 20.583490316846575 +234 2.0420352248333655 12.558218505990425 20.49315005633246 +235 2.050761871093337 12.379781895594226 20.401249163099102 +236 2.0594885173533086 12.202154055924519 20.30779463575532 +237 2.0682151636132806 12.025348514029005 20.212793591225203 +238 2.076941809873252 11.849378734334248 20.1162532642061 +239 2.0856684561332237 11.674258117620258 20.01818100661769 +240 2.0943951023931953 11.500000000000005 19.918584287042094 +241 2.103121748653167 11.326617651903813 19.817470690155098 +242 2.111848394913139 11.154124277068755 19.71484791614858 +243 2.1205750411731104 10.982533011533175 19.610723780144124 +244 2.129301687433082 10.81185692263629 19.5051062115978 +245 2.138028333693054 10.642109008023048 19.398003253696373 +246 2.1467549799530254 10.473302194654377 19.289423062744753 +247 2.155481626212997 10.305449337822662 19.179373907544868 +248 2.1642082724729685 10.138563220172824 19.06786416876596 +249 2.17293491873294 9.972656550728853 18.954902338306365 +250 2.1816615649929116 9.807741963925945 18.840497018646815 +251 2.1903882112528836 9.643832018648386 18.724656922195344 +252 2.199114857512855 9.48093919727312 18.607390870623792 +253 2.2078415037728267 9.319075904719153 18.488707794196 +254 2.2165681500327987 9.158254467502887 18.368616731087734 +255 2.2252947962927703 8.998487132799427 18.24712682669841 +256 2.234021442552742 8.83978606750986 18.124247332954607 +257 2.2427480888127134 8.682163357334751 17.999987607605522 +258 2.251474735072685 8.52563100585374 17.87435711351033 +259 2.260201381332657 8.370200933611429 17.747365417917553 +260 2.2689280275926285 8.215884977209592 17.619022191736494 +261 2.2776546738526 8.062694888405778 17.489337208800713 +262 2.2863813201125716 7.9106423332183375 17.358320345123758 +263 2.295107966372543 7.759738891038043 17.225981578147053 +264 2.3038346126325147 7.6099960537462685 17.092330985980073 +265 2.3125612588924866 7.461425224839812 16.957378746632855 +266 2.321287905152458 7.314037718562537 16.821135137240926 +267 2.33001455141243 7.167844759043658 16.683610533282614 +268 2.3387411976724017 7.0228574794430605 16.544815407788974 +269 2.3474678439323733 6.879086921103429 16.404760330546175 +270 2.356194490192345 6.736544032709406 16.263455967290593 +271 2.3649211364523164 6.595239669453827 16.120913078896574 +272 2.373647782712288 6.455184592211028 15.977142520556942 +273 2.3823744289722595 6.316389466717392 15.83215524095635 +274 2.3911010752322315 6.178864862759079 15.685962281437467 +275 2.399827721492203 6.042621253367151 15.538574775160189 +276 2.408554367752175 5.9076690140199295 15.390003946253735 +277 2.4172810140121466 5.774018421852952 15.24026110896196 +278 2.426007660272118 5.641679654876244 15.089357666781668 +279 2.4347343065320897 5.510662791199291 14.93730511159423 +280 2.443460952792061 5.380977808263508 14.784115022790408 +281 2.4521875990520328 5.252634582082445 14.629799066388577 +282 2.4609142453120048 5.125642886489669 14.47436899414626 +283 2.4696408915719763 5.000012392394482 14.317836642665254 +284 2.478367537831948 4.875752667045396 14.160213932490143 +285 2.4870941840919194 4.752873173301594 14.00151286720058 +286 2.495820830351891 4.63138326891227 13.841745532497114 +287 2.504547476611863 4.511292205804002 13.680924095280849 +288 2.5132741228718345 4.392609129376211 13.519060802726887 +289 2.522000769131806 4.27534307780466 13.356167981351614 +290 2.530727415391778 4.159502981353186 13.192258036074058 +291 2.5394540616517496 4.045097661693639 13.027343449271156 +292 2.548180707911721 3.9321358312340453 12.861436779827182 +293 2.5569073541716927 3.820626092455131 12.69455066217734 +294 2.5656340004316642 3.7105769372552517 12.52669780534563 +295 2.574360646691636 3.6019967463036338 12.357890991976955 +296 2.5830872929516078 3.494893788402203 12.188143077363712 +297 2.5918139392115793 3.3892762198558772 12.017466988466825 +298 2.600540585471551 3.2851520838514188 11.845875722931249 +299 2.609267231731523 3.182529309844906 11.673382348096192 +300 2.6179938779914944 3.081415712957912 11.5 +301 2.626720524251466 2.9818189933823094 11.325741882379743 +302 2.6354471705114375 2.8837467357939004 11.150621265665755 +303 2.644173816771409 2.7872064087748014 10.974651485970996 +304 2.652900463031381 2.6922053642446793 10.797845944075487 +305 2.6616271092913526 2.5987508369009005 10.62021810440578 +306 2.670353755551324 2.506849943667538 10.441781494009577 +307 2.6790804018112957 2.4165096831534276 10.262549701525607 +308 2.6878070480712672 2.3277369351191632 10.082536376148786 +309 2.696533694331239 2.240538459953213 9.901755226590796 +310 2.705260340591211 2.1549208981570516 9.720220020036088 +311 2.7139869868511823 2.070890769839511 9.537944581093504 +312 2.7227136331111543 1.98845447422018 9.354942790743404 +313 2.731440279371126 1.9076182891421496 9.171228585280662 +314 2.7401669256310974 1.828388370593874 8.986815955253299 +315 2.748893571891069 1.750770752240405 8.801718944397068 +316 2.7576202181510405 1.6747713449638892 8.615951648565982 +317 2.766346864411012 1.6003959364134372 8.429528214658843 +318 2.7750735106709836 1.5276501905643651 8.242462839541917 +319 2.7838001569309556 1.456539647286856 8.054769768967752 +320 2.792526803190927 1.3870697219241088 7.866463296490386 +321 2.801253449450899 1.3192457048798987 7.677557762376729 +322 2.8099800957108707 1.2530727612157126 7.4880675525146 +323 2.8187067419708423 1.1885559302574182 7.298007097317118 +324 2.827433388230814 1.125700125211469 7.107390870623792 +325 2.8361600344907854 1.0645101327907804 6.916233388598285 +326 2.844886680750757 1.0049906128501875 6.724549208622951 +327 2.853613327010729 0.9471460980315598 6.532352928190221 +328 2.8623399732707004 0.8909809934186654 6.33965918379098 +329 2.871066619530672 0.8364995762016721 6.146482649799912 +330 2.8797932657906435 0.7837059953514339 5.952838037357982 +331 2.888519912050615 0.7326042713035219 5.758740093252159 +332 2.897246558310587 0.6831982956520811 5.56420359879236 +333 2.9059732045705586 0.6354918308534366 5.369243368685828 +334 2.91469985083053 0.5894885099395893 5.173874249908903 +335 2.923426497090502 0.5451918362415327 4.978111120576366 +336 2.9321531433504737 0.5026051831224692 4.781968888808466 +337 2.9408797896104453 0.461731793720922 4.585462491595536 +338 2.949606435870417 0.42257478070372856 4.388606893660535 +339 2.9583330821303884 0.3851371260290464 4.191417086319397 +340 2.96705972839036 0.34942168071921553 3.993908086339407 +341 2.975786374650332 0.3154311646436795 3.796094934795584 +342 2.9845130209103035 0.28316816631183384 3.5979926959253126 +343 2.993239667170275 0.252635142675913 3.3996164559810502 +344 3.001966313430247 0.22383441894388167 3.200981322081504 +345 3.0106929596902186 0.1967681884023612 3.0021024210611866 +346 3.01941960595019 0.17143851224959694 2.802994898318396 +347 3.0281462522101616 0.14784731943848595 2.6036739166618585 +348 3.036872898470133 0.12599640652971433 2.4041546551560367 +349 3.045599544730105 0.10588743755488639 2.2044523079651492 +350 3.0543261909900767 0.0875219438898499 2.004582083196137 +351 3.0630528372500483 0.07090132413805683 1.8045592017404362 +352 3.07177948351002 0.056026844024043454 1.6043988961148898 +353 3.0805061297699914 0.04289963629706084 1.4041164093017162 +354 3.089232776029963 0.03152070064480439 1.2037269935877162 +355 3.097959422289935 0.02189090361727064 1.0032459094027304 +356 3.1066860685499065 0.014010978560797471 0.8026884241575263 +357 3.1154127148098785 0.007881525562183023 0.602069811081076 +358 3.12413936106985 0.0035030114030007997 0.4014053480575184 +359 3.1328660073298216 0.0008757695240573238 0.20071031646259918 +360 3.141592653589793 0.0 5.10702591327572e-15 +361 3.1503192998497647 0.0008757695240573238 -0.20071031646259663 +362 3.159045946109736 0.0035030114030007997 -0.40140534805751327 +363 3.1677725923697078 0.007881525562183023 -0.6020698110810735 +364 3.1764992386296798 0.014010978560797471 -0.8026884241575212 +365 3.1852258848896513 0.02189090361727064 -1.0032459094027253 +366 3.193952531149623 0.03152070064480439 -1.2037269935877009 +367 3.2026791774095944 0.04289963629706084 -1.4041164093016985 +368 3.211405823669566 0.05602684402403835 -1.604398896114872 +369 3.2201324699295375 0.07090132413805428 -1.8045592017404206 +370 3.2288591161895095 0.0875219438898499 -2.004582083196132 +371 3.237585762449481 0.10588743755488639 -2.2044523079651444 +372 3.246312408709453 0.12599640652971433 -2.4041546551560313 +373 3.255039054969425 0.14784731943848595 -2.6036739166618634 +374 3.2637657012293966 0.17143851224959694 -2.8029948983183988 +375 3.272492347489368 0.1967681884023612 -3.002102421061192 +376 3.2812189937493397 0.22383441894388678 -3.200981322081507 +377 3.2899456400093112 0.252635142675913 -3.399616455981045 +378 3.2986722862692828 0.2831681663118313 -3.597992695925307 +379 3.3073989325292543 0.3154311646436795 -3.7960949347955815 +380 3.3161255787892263 0.34942168071921553 -3.993908086339402 +381 3.324852225049198 0.3851371260290464 -4.191417086319392 +382 3.3335788713091694 0.422574780703726 -4.388606893660529 +383 3.342305517569141 0.4617317937209169 -4.585462491595532 +384 3.3510321638291125 0.5026051831224666 -4.781968888808459 +385 3.359758810089084 0.5451918362415301 -4.978111120576358 +386 3.368485456349056 0.5894885099395919 -5.173874249908894 +387 3.3772121026090276 0.6354918308534392 -5.369243368685822 +388 3.385938748868999 0.6831982956520811 -5.564203598792352 +389 3.3946653951289707 0.7326042713035193 -5.758740093252145 +390 3.4033920413889422 0.7837059953514288 -5.952838037357967 +391 3.412118687648914 0.836499576201667 -6.146482649799897 +392 3.4208453339088853 0.8909809934186629 -6.339659183790969 +393 3.4295719801688573 0.9471460980315572 -6.532352928190216 +394 3.4382986264288293 1.004990612850185 -6.724549208622947 +395 3.447025272688801 1.0645101327907804 -6.916233388598279 +396 3.455751918948773 1.1257001252114713 -7.107390870623797 +397 3.4644785652087444 1.1885559302574156 -7.298007097317124 +398 3.473205211468716 1.253072761215715 -7.488067552514604 +399 3.4819318577286875 1.3192457048798987 -7.677557762376732 +400 3.490658503988659 1.3870697219241062 -7.866463296490379 +401 3.4993851502486306 1.456539647286856 -8.054769768967747 +402 3.5081117965086026 1.5276501905643598 -8.242462839541911 +403 3.516838442768574 1.6003959364134372 -8.429528214658838 +404 3.5255650890285457 1.6747713449638892 -8.615951648565975 +405 3.5342917352885173 1.7507707522404026 -8.801718944397061 +406 3.543018381548489 1.8283883705938715 -8.986815955253293 +407 3.5517450278084604 1.907618289142147 -9.171228585280657 +408 3.560471674068432 1.988454474220175 -9.354942790743396 +409 3.569198320328404 2.0708907698395085 -9.537944581093498 +410 3.5779249665883754 2.1549208981570516 -9.720220020036084 +411 3.586651612848347 2.240538459953203 -9.90175522659078 +412 3.5953782591083185 2.327736935119158 -10.082536376148772 +413 3.60410490536829 2.41650968315342 -10.262549701525593 +414 3.6128315516282616 2.506849943667536 -10.441781494009565 +415 3.6215581978882336 2.598750836900898 -10.620218104405774 +416 3.630284844148205 2.6922053642446793 -10.797845944075481 +417 3.639011490408177 2.787206408774796 -10.974651485970991 +418 3.647738136668149 2.8837467357939004 -11.150621265665759 +419 3.6564647829281207 2.9818189933823094 -11.325741882379749 +420 3.6651914291880923 3.081415712957912 -11.500000000000002 +421 3.673918075448064 3.1825293098449086 -11.673382348096197 +422 3.6826447217080354 3.2851520838514165 -11.845875722931245 +423 3.691371367968007 3.3892762198558772 -12.017466988466817 +424 3.7000980142279785 3.494893788402203 -12.18814307736371 +425 3.7088246604879505 3.601996746303631 -12.35789099197695 +426 3.717551306747922 3.710576937255247 -12.526697805345623 +427 3.7262779530078936 3.820626092455131 -12.694550662177338 +428 3.735004599267865 3.93213583123404 -12.861436779827173 +429 3.7437312455278366 4.045097661693639 -13.02734344927115 +430 3.752457891787808 4.159502981353186 -13.192258036074055 +431 3.76118453804778 4.27534307780466 -13.356167981351614 +432 3.7699111843077517 4.392609129376209 -13.51906080272688 +433 3.7786378305677233 4.511292205804 -13.680924095280847 +434 3.787364476827695 4.631383268912263 -13.841745532497105 +435 3.7960911230876664 4.752873173301588 -14.001512867200566 +436 3.804817769347638 4.875752667045391 -14.16021393249013 +437 3.8135444156076095 5.00001239239447 -14.317836642665238 +438 3.8222710618675815 5.125642886489667 -14.474368994146255 +439 3.8309977081275535 5.252634582082442 -14.629799066388573 +440 3.839724354387525 5.380977808263506 -14.784115022790402 +441 3.848451000647497 5.510662791199294 -14.93730511159423 +442 3.8571776469074686 5.641679654876249 -15.08935766678167 +443 3.86590429316744 5.774018421852952 -15.240261108961963 +444 3.8746309394274117 5.907669014019932 -15.390003946253739 +445 3.883357585687383 6.042621253367144 -15.538574775160184 +446 3.8920842319473548 6.178864862759079 -15.685962281437462 +447 3.9008108782073267 6.316389466717387 -15.832155240956343 +448 3.9095375244672983 6.455184592211025 -15.977142520556939 +449 3.91826417072727 6.595239669453827 -16.12091307889657 +450 3.9269908169872414 6.736544032709406 -16.263455967290593 +451 3.935717463247213 6.8790869211034265 -16.40476033054617 +452 3.9444441095071845 7.022857479443055 -16.54481540778897 +453 3.953170755767156 7.16784475904365 -16.683610533282607 +454 3.961897402027128 7.314037718562533 -16.82113513724092 +455 3.9706240482870996 7.461425224839812 -16.95737874663285 +456 3.979350694547071 7.609996053746255 -17.092330985980063 +457 3.9880773408070427 7.759738891038032 -17.225981578147042 +458 3.9968039870670142 7.910642333218325 -17.358320345123747 +459 4.005530633326986 8.062694888405769 -17.489337208800706 +460 4.014257279586958 8.215884977209592 -17.61902219173649 +461 4.022983925846929 8.370200933611416 -17.747365417917546 +462 4.031710572106902 8.525631005853748 -17.874357113510335 +463 4.040437218366873 8.682163357334748 -17.99998760760552 +464 4.049163864626845 8.839786067509865 -18.124247332954607 +465 4.057890510886816 8.99848713279942 -18.247126826698405 +466 4.066617157146788 9.15825446750289 -18.368616731087734 +467 4.07534380340676 9.319075904719156 -18.488707794196003 +468 4.084070449666731 9.480939197273115 -18.60739087062379 +469 4.092797095926703 9.643832018648391 -18.724656922195344 +470 4.101523742186674 9.807741963925936 -18.840497018646808 +471 4.110250388446646 9.972656550728848 -18.95490233830636 +472 4.118977034706617 10.138563220172813 -19.06786416876595 +473 4.127703680966589 10.305449337822658 -19.179373907544868 +474 4.136430327226561 10.47330219465438 -19.289423062744753 +475 4.145156973486532 10.642109008023043 -19.398003253696363 +476 4.153883619746504 10.811856922636288 -19.5051062115978 +477 4.162610266006475 10.982533011533162 -19.610723780144113 +478 4.171336912266447 11.154124277068746 -19.714847916148578 +479 4.1800635585264185 11.326617651903788 -19.81747069015508 +480 4.1887902047863905 11.499999999999993 -19.918584287042084 +481 4.1975168510463625 11.674258117620255 -20.01818100661769 +482 4.206243497306334 11.849378734334234 -20.116253264206097 +483 4.214970143566306 12.025348514029004 -20.2127935912252 +484 4.223696789826278 12.202154055924513 -20.30779463575532 +485 4.23242343608625 12.379781895594231 -20.401249163099102 +486 4.241150082346221 12.55821850599042 -20.49315005633246 +487 4.249876728606193 12.737450298474398 -20.58349031684658 +488 4.258603374866164 12.917463623851214 -20.672263064880838 +489 4.267330021126136 13.098244773409215 -20.759461540046793 +490 4.276056667386108 13.279779979963921 -20.845079101842952 +491 4.284783313646079 13.462055418906496 -20.929109230160492 +492 4.293509959906051 13.645057209256596 -21.01154552577982 +493 4.302236606166022 13.828771414719327 -21.092381710857847 +494 4.310963252425994 14.013184044746701 -21.171611629406126 +495 4.319689898685965 14.198281055602923 -21.24922924775959 +496 4.328416544945937 14.384048351434018 -21.32522865503611 +497 4.337143191205909 14.570471785341164 -21.399604063586565 +498 4.34586983746588 14.757537160458083 -21.472349809435638 +499 4.354596483725852 14.945230231032248 -21.543460352713144 +500 4.363323129985823 15.133536703509606 -21.61293027807589 +501 4.372049776245795 15.32244223762326 -21.6807542951201 +502 4.380776422505767 15.511932447485396 -21.746927238784284 +503 4.389503068765738 15.701992902682871 -21.811444069742578 +504 4.39822971502571 15.892609129376206 -21.874299874788534 +505 4.4069563612856815 16.083766611401707 -21.935489867209213 +506 4.4156830075456535 16.275450791377043 -21.995009387149814 +507 4.4244096538056255 16.46764707180978 -22.05285390196844 +508 4.4331363000655974 16.660340816209025 -22.109019006581338 +509 4.4418629463255686 16.853517350200086 -22.16350042379833 +510 4.4505895925855405 17.047161962642026 -22.21629400464857 +511 4.4593162388455125 17.241259906747857 -22.267395728696485 +512 4.468042885105484 17.43579640120764 -22.31680170434792 +513 4.476769531365456 17.630756631314185 -22.36450816914656 +514 4.485496177625427 17.826125750091098 -22.410511490060408 +515 4.494222823885399 18.021888879423635 -22.454808163758468 +516 4.50294947014537 18.218031111191525 -22.497394816877527 +517 4.511676116405342 18.414537508404464 -22.538268206279078 +518 4.520402762665314 18.611393106339474 -22.57742521929627 +519 4.529129408925285 18.808582913680603 -22.614862873970953 +520 4.537856055185257 19.006091913660605 -22.650578319280786 +521 4.546582701445228 19.203905065204403 -22.68456883535632 +522 4.5553093477052 19.402007304074687 -22.71683183368817 +523 4.564035993965171 19.60038354401894 -22.747364857324087 +524 4.572762640225143 19.799018677918486 -22.776165581056116 +525 4.581489286485115 19.997897578938815 -22.80323181159764 +526 4.590215932745086 20.197005101681594 -22.828561487750402 +527 4.598942579005058 20.39632608333814 -22.852152680561513 +528 4.607669225265029 20.595845344843955 -22.874003593470285 +529 4.616395871525002 20.79554769203486 -22.894112562445113 +530 4.625122517784973 20.99541791680386 -22.912478056110146 +531 4.633849164044945 21.195440798259572 -22.929098675861944 +532 4.642575810304916 21.39560110388511 -22.943973155975957 +533 4.651302456564888 21.595883590698293 -22.95710036370294 +534 4.66002910282486 21.796273006412303 -22.9684792993552 +535 4.6687557490848315 21.99675409059727 -22.978109096382727 +536 4.6774823953448035 22.19731157584248 -22.9859890214392 +537 4.686209041604775 22.39793018891891 -22.992118474437817 +538 4.694935687864747 22.59859465194248 -22.996496988597 +539 4.703662334124718 22.79928968353739 -22.99912423047594 +540 4.71238898038469 22.999999999999996 -23.0 +541 4.721115626644662 23.200710316462605 -22.99912423047594 +542 4.729842272904633 23.401405348057512 -22.996496988597 +543 4.738568919164605 23.60206981108108 -22.992118474437817 +544 4.747295565424576 23.802688424157513 -22.9859890214392 +545 4.756022211684548 24.00324590940272 -22.978109096382727 +546 4.764748857944519 24.20372699358769 -22.9684792993552 +547 4.773475504204491 24.404116409301697 -22.957100363702946 +548 4.782202150464463 24.60439889611488 -22.943973155975957 +549 4.790928796724434 24.80455920174042 -22.929098675861944 +550 4.799655442984406 25.004582083196134 -22.912478056110146 +551 4.808382089244377 25.204452307965134 -22.894112562445113 +552 4.81710873550435 25.40415465515604 -22.874003593470285 +553 4.825835381764321 25.603673916661855 -22.852152680561513 +554 4.834562028024293 25.802994898318396 -22.828561487750402 +555 4.843288674284264 26.00210242106118 -22.80323181159764 +556 4.852015320544236 26.200981322081503 -22.77616558105612 +557 4.860741966804208 26.39961645598105 -22.747364857324087 +558 4.869468613064179 26.597992695925306 -22.71683183368817 +559 4.878195259324151 26.79609493479559 -22.68456883535632 +560 4.886921905584122 26.993908086339392 -22.650578319280786 +561 4.895648551844094 27.191417086319394 -22.614862873970953 +562 4.9043751981040655 27.388606893660516 -22.57742521929627 +563 4.9131018443640375 27.585462491595532 -22.538268206279085 +564 4.9218284906240095 27.781968888808468 -22.49739481687753 +565 4.930555136883981 27.978111120576354 -22.454808163758468 +566 4.939281783143953 28.17387424990889 -22.410511490060408 +567 4.948008429403924 28.36924336868581 -22.364508169146568 +568 4.956735075663896 28.56420359879235 -22.31680170434792 +569 4.965461721923867 28.758740093252133 -22.267395728696485 +570 4.974188368183839 28.952838037357967 -22.21629400464857 +571 4.982915014443811 29.146482649799907 -22.16350042379833 +572 4.991641660703782 29.339659183790964 -22.109019006581338 +573 5.000368306963754 29.532352928190214 -22.052853901968444 +574 5.009094953223726 29.724549208622946 -21.995009387149818 +575 5.017821599483698 29.91623338859829 -21.935489867209217 +576 5.026548245743669 30.107390870623785 -21.874299874788534 +577 5.035274892003641 30.29800709731712 -21.811444069742585 +578 5.044001538263612 30.488067552514593 -21.74692723878429 +579 5.052728184523584 30.67755776237673 -21.680754295120103 +580 5.061454830783556 30.866463296490384 -21.612930278075893 +581 5.070181477043527 31.05476976896775 -21.543460352713147 +582 5.078908123303499 31.24246283954191 -21.47234980943564 +583 5.08763476956347 31.429528214658827 -21.39960406358657 +584 5.096361415823442 31.615951648565975 -21.32522865503611 +585 5.105088062083414 31.80171894439707 -21.249229247759594 +586 5.113814708343385 31.98681595525329 -21.17161162940613 +587 5.122541354603357 32.171228585280666 -21.092381710857854 +588 5.1312680008633285 32.354942790743394 -21.011545525779827 +589 5.1399946471233005 32.53794458109349 -20.929109230160496 +590 5.148721293383272 32.72022002003607 -20.845079101842956 +591 5.1574479396432436 32.90175522659078 -20.759461540046797 +592 5.1661745859032155 33.08253637614878 -20.67226306488084 +593 5.174901232163187 33.26254970152559 -20.583490316846582 +594 5.183627878423159 33.441781494009575 -20.49315005633246 +595 5.19235452468313 33.620218104405765 -20.401249163099106 +596 5.201081170943102 33.797845944075476 -20.30779463575532 +597 5.209807817203074 33.974651485970995 -20.212793591225203 +598 5.218534463463046 34.150621265665755 -20.1162532642061 +599 5.227261109723017 34.32574188237974 -20.0181810066177 +600 5.235987755982989 34.5 -19.918584287042087 +601 5.244714402242961 34.673382348096204 -19.81747069015509 +602 5.253441048502932 34.84587572293125 -19.71484791614858 +603 5.262167694762904 35.017466988466836 -19.61072378014412 +604 5.270894341022875 35.188143077363705 -19.5051062115978 +605 5.279620987282847 35.35789099197695 -19.398003253696373 +606 5.288347633542818 35.52669780534561 -19.28942306274476 +607 5.29707427980279 35.694550662177335 -19.179373907544868 +608 5.305800926062762 35.86143677982718 -19.067864168765958 +609 5.314527572322733 36.02734344927114 -18.954902338306365 +610 5.323254218582705 36.19225803607406 -18.840497018646808 +611 5.331980864842676 36.356167981351604 -18.724656922195347 +612 5.340707511102648 36.51906080272688 -18.607390870623792 +613 5.349434157362619 36.68092409528084 -18.488707794196007 +614 5.358160803622591 36.84174553249711 -18.368616731087737 +615 5.366887449882563 37.00151286720057 -18.24712682669841 +616 5.3756140961425345 37.16021393249013 -18.124247332954614 +617 5.3843407424025065 37.31783664266524 -17.999987607605522 +618 5.393067388662478 37.474368994146246 -17.874357113510342 +619 5.4017940349224505 37.62979906638858 -17.747365417917553 +620 5.410520681182422 37.7841150227904 -17.619022191736498 +621 5.419247327442394 37.93730511159423 -17.48933720880071 +622 5.427973973702365 38.08935766678166 -17.35832034512376 +623 5.436700619962337 38.24026110896197 -17.225981578147046 +624 5.445427266222309 38.39000394625374 -17.092330985980063 +625 5.45415391248228 38.538574775160185 -16.957378746632855 +626 5.462880558742252 38.68596228143747 -16.82113513724092 +627 5.471607205002223 38.83215524095633 -16.683610533282618 +628 5.480333851262195 38.97714252055694 -16.544815407788978 +629 5.489060497522166 39.12091307889656 -16.404760330546186 +630 5.497787143782138 39.26345596729059 -16.263455967290593 +631 5.50651379004211 39.40476033054618 -16.120913078896567 +632 5.515240436302081 39.54481540778897 -15.977142520556944 +633 5.523967082562053 39.68361053328261 -15.832155240956343 +634 5.532693728822024 39.821135137240915 -15.685962281437476 +635 5.541420375081996 39.95737874663285 -15.53857477516019 +636 5.550147021341967 40.092330985980055 -15.390003946253753 +637 5.558873667601939 40.22598157814704 -15.24026110896197 +638 5.567600313861911 40.35832034512375 -15.08935766678167 +639 5.576326960121882 40.489337208800706 -14.937305111594235 +640 5.585053606381854 40.61902219173649 -14.784115022790408 +641 5.593780252641825 40.74736541791755 -14.629799066388586 +642 5.602506898901798 40.874357113510335 -14.474368994146252 +643 5.611233545161769 40.99998760760552 -14.317836642665249 +644 5.619960191421741 41.1242473329546 -14.160213932490137 +645 5.6286868376817125 41.247126826698405 -14.00151286720058 +646 5.6374134839416845 41.368616731087734 -13.84174553249711 +647 5.6461401302016565 41.488707794196 -13.680924095280842 +648 5.654866776461628 41.60739087062379 -13.519060802726885 +649 5.6635934227216 41.724656922195344 -13.356167981351609 +650 5.672320068981571 41.8404970186468 -13.192258036074069 +651 5.681046715241543 41.954902338306354 -13.027343449271157 +652 5.689773361501514 42.06786416876595 -12.861436779827187 +653 5.698500007761486 42.179373907544864 -12.694550662177342 +654 5.707226654021458 42.28942306274475 -12.52669780534562 +655 5.715953300281429 42.39800325369636 -12.357890991976957 +656 5.724679946541401 42.50510621159779 -12.188143077363716 +657 5.733406592801372 42.61072378014411 -12.01746698846684 +658 5.742133239061344 42.71484791614858 -11.845875722931254 +659 5.750859885321315 42.81747069015508 -11.673382348096215 +660 5.759586531581287 42.91858428704208 -11.50000000000001 +661 5.768313177841259 43.018181006617695 -11.325741882379747 +662 5.77703982410123 43.116253264206094 -11.150621265665766 +663 5.785766470361202 43.2127935912252 -10.974651485971002 +664 5.794493116621174 43.30779463575532 -10.797845944075487 +665 5.803219762881146 43.4012491630991 -10.620218104405774 +666 5.811946409141117 43.49315005633246 -10.44178149400958 +667 5.820673055401089 43.58349031684658 -10.262549701525602 +668 5.82939970166106 43.67226306488084 -10.082536376148791 +669 5.838126347921032 43.75946154004679 -9.90175522659079 +670 5.846852994181004 43.84507910184295 -9.720220020036084 +671 5.8555796404409755 43.92910923016049 -9.537944581093505 +672 5.8643062867009474 44.011545525779816 -9.354942790743404 +673 5.8730329329609186 44.09238171085785 -9.171228585280675 +674 5.8817595792208905 44.17161162940613 -8.986815955253299 +675 5.890486225480862 44.24922924775959 -8.801718944397077 +676 5.899212871740834 44.32522865503611 -8.615951648565984 +677 5.907939518000806 44.39960406358656 -8.429528214658838 +678 5.916666164260777 44.472349809435634 -8.242462839541917 +679 5.925392810520749 44.54346035271315 -8.054769768967757 +680 5.93411945678072 44.612930278075886 -7.866463296490398 +681 5.942846103040692 44.680754295120096 -7.67755776237674 +682 5.951572749300664 44.74692723878429 -7.488067552514604 +683 5.960299395560635 44.811444069742585 -7.298007097317133 +684 5.969026041820607 44.87429987478853 -7.107390870623795 +685 5.977752688080578 44.93548986720921 -6.916233388598299 +686 5.98647933434055 44.99500938714981 -6.724549208622957 +687 5.995205980600522 45.05285390196844 -6.532352928190221 +688 6.003932626860494 45.109019006581335 -6.339659183790975 +689 6.012659273120465 45.163500423798325 -6.146482649799914 +690 6.021385919380437 45.21629400464857 -5.952838037357978 +691 6.030112565640409 45.267395728696485 -5.758740093252144 +692 6.03883921190038 45.31680170434792 -5.564203598792361 +693 6.047565858160352 45.36450816914657 -5.36924336868582 +694 6.056292504420323 45.410511490060415 -5.173874249908903 +695 6.065019150680295 45.454808163758464 -4.978111120576366 +696 6.073745796940266 45.49739481687753 -4.781968888808477 +697 6.082472443200238 45.538268206279085 -4.585462491595539 +698 6.09119908946021 45.57742521929627 -4.388606893660526 +699 6.0999257357201815 45.61486287397096 -4.1914170863194 +700 6.1086523819801535 45.65057831928079 -3.9939080863393994 +701 6.117379028240125 45.684568835356316 -3.7960949347956 +702 6.126105674500097 45.71683183368817 -3.597992695925317 +703 6.134832320760068 45.74736485732409 -3.3996164559810604 +704 6.14355896702004 45.77616558105612 -3.2009813220815153 +705 6.152285613280012 45.80323181159764 -3.002102421061189 +706 6.161012259539983 45.828561487750406 -2.8029948983184063 +707 6.169738905799955 45.85215268056152 -2.6036739166618608 +708 6.178465552059926 45.87400359347028 -2.404154655156049 +709 6.187192198319899 45.894112562445116 -2.2044523079651444 +710 6.19591884457987 45.91247805611015 -2.0045820831961425 +711 6.204645490839842 45.929098675861944 -1.8045592017404282 +712 6.213372137099813 45.943973155975954 -1.6043988961148898 +713 6.222098783359785 45.95710036370294 -1.4041164093017087 +714 6.230825429619757 45.968479299355195 -1.2037269935877009 +715 6.239552075879728 45.97810909638273 -1.0032459094027328 +716 6.2482787221397 45.985989021439195 -0.8026884241575185 +717 6.257005368399671 45.99211847443782 -0.6020698110810915 +718 6.265732014659643 45.996496988597 -0.4014053480575209 +719 6.274458660919614 45.999124230475935 -0.20071031646261453 + +HARMONIC_5 +N 720 RADIANS + +0 0.0 0.0 -0.0 +1 0.008726646259971648 0.006510825464412062 -1.4920860535487603 +2 0.017453292519943295 0.02603883966309506 -2.9831495058477806 +3 0.02617993877991494 0.058570659070575015 -4.472168456487151 +4 0.03490658503988659 0.10408398800281804 -5.958122406256236 +5 0.04363323129985824 0.16254763389760063 -7.439992956542959 +6 0.05235987755982988 0.23392152869238025 -8.916764507293145 +7 0.061086523819801536 0.3181567562848644 -10.387424953052388 +8 0.06981317007977318 0.415195586057694 -11.850966376612265 +9 0.07853981633974483 0.5249715124441391 -13.306385739786627 +10 0.08726646259971647 0.6474093005076936 -14.752685570843681 +11 0.09599310885968812 0.7824250375043362 -16.188874648123605 +12 0.10471975511965977 0.929926190392085 -17.61396867937201 +13 0.11344640137963141 1.0898116692486035 -19.026990976324935 +14 0.12217304763960307 1.2619718965531606 -20.42697312408211 +15 0.1308996938995747 1.4462888822855477 -21.81295564481012 +16 0.13962634015954636 1.6426363047905794 -23.183988655320608 +17 0.148352986419518 1.8508795973526482 -24.53913251807283 +18 0.15707963267948966 2.070876040421012 -25.877458485154182 +19 0.16580627893946132 2.30247485942266 -27.198049334797663 +20 0.17453292519943295 2.5455173280956602 -28.5 +21 0.1832595714594046 2.799836877272244 -29.78241818880909 +22 0.19198621771937624 3.065259209036937 -31.044424995856556 +23 0.20071286397934787 3.3416024161816975 -32.28515550471548 +24 0.20943951023931953 3.628677106875996 -33.503759380670985 +25 0.2181661564992912 3.92628653446653 -34.699401453497074 +26 0.22689280275926282 4.234226732317545 -35.87126228984072 +27 0.23561944901923448 4.552286653599402 -37.018538754820476 +28 0.24434609527920614 4.880248315929518 -38.14044456245493 +29 0.2530727415391778 5.217886950766533 -39.23621081454401 +30 0.2617993877991494 5.5649711574556004 -40.30508652763321 +31 0.27052603405912107 5.921263061818676 -41.3463391477004 +32 0.2792526803190927 6.286518479181689 -42.35925505221146 +33 0.28797932657906433 6.660487081726511 -43.343140039201764 +34 0.296705972839036 7.042912570053088 -44.29731980304736 +35 0.30543261909900765 7.43353284883431 -45.221140396600426 +36 0.3141592653589793 7.832080206443008 -46.11396867937202 +37 0.32288591161895097 8.238281498428181 -46.97519275145486 +38 0.33161255787892263 8.651858334714479 -47.804222372889186 +39 0.3403392041388943 9.072527270396964 -48.60048936818326 +40 0.3490658503988659 9.499999999999996 -49.363448015713004 +41 0.35779249665883756 9.933983555067444 -50.09257542173202 +42 0.3665191429188092 10.374180504948619 -50.78737187873696 +43 0.3752457891787809 10.820289160642394 -51.44736120794205 +44 0.3839724354387525 11.272003781559789 -52.072091085628244 +45 0.39269908169872414 11.729014785063297 -52.661133353143356 +46 0.40142572795869574 12.191008958639282 -53.2140843103405 +47 0.41015237421866746 12.657669674558354 -53.73056499225416 +48 0.41887902047863906 13.128677106876003 -54.21022142882373 +49 0.42760566673861067 13.60370845062547 -54.652724887486976 +50 0.4363323129985824 14.08243814305211 -55.057772098476896 +51 0.445058959258554 14.564538086737787 -55.425085462667575 +52 0.45378560551852565 15.049677874462569 -55.75441324182693 +53 0.4625122517784973 15.537525015649193 -56.04552973114542 +54 0.47123889803846897 16.02774516423561 -56.29823541392285 +55 0.4799655442984406 16.520002347819023 -56.5123570983072 +56 0.4886921905584123 17.01395919791458 -56.68774803599159 +57 0.4974188368183839 17.509277181170944 -56.8242880227883 +58 0.5061454830783556 18.00561683138407 -56.9218834810107 +59 0.5148721293383272 18.502637982150404 -56.980467523606755 +60 0.5235987755982988 18.999999999999993 -57.0 +61 0.5323254218582705 19.497362017849582 -56.980467523606755 +62 0.5410520681182421 19.99438316861594 -56.9218834810107 +63 0.5497787143782138 20.490722818829056 -56.824288022788316 +64 0.5585053606381855 20.98604080208542 -56.68774803599158 +65 0.5672320068981571 21.479997652180987 -56.512357098307206 +66 0.5759586531581287 21.972254835764378 -56.298235413922846 +67 0.5846852994181004 22.462474984350806 -56.04552973114542 +68 0.593411945678072 22.950322125537433 -55.75441324182692 +69 0.6021385919380438 23.43546191326221 -55.42508546266756 +70 0.6108652381980153 23.91756185694789 -55.0577720984769 +71 0.619591884457987 24.39629154937453 -54.652724887487004 +72 0.6283185307179586 24.871322893124002 -54.21022142882376 +73 0.6370451769779303 25.342330325441647 -53.73056499225416 +74 0.6457718232379019 25.808991041360706 -53.21408431034048 +75 0.6544984694978736 26.270985214936708 -52.66113335314334 +76 0.6632251157578453 26.727996218440204 -52.07209108562825 +77 0.6719517620178168 27.17971083935761 -51.44736120794204 +78 0.6806784082777886 27.625819495051392 -50.78737187873697 +79 0.6894050545377601 28.066016444932558 -50.092575421732015 +80 0.6981317007977318 28.5 -49.363448015713004 +81 0.7068583470577035 28.92747272960303 -48.600489368183254 +82 0.7155849933176751 29.348141665285514 -47.804222372889186 +83 0.7243116395776468 29.761718501571824 -46.9751927514549 +84 0.7330382858376184 30.167919793556994 -46.11396867937201 +85 0.74176493209759 30.56646715116569 -45.22114039660041 +86 0.7504915783575618 30.957087429946917 -44.29731980304733 +87 0.7592182246175333 31.339512918273492 -43.343140039201764 +88 0.767944870877505 31.713481520818306 -42.35925505221146 +89 0.7766715171374766 32.07873693818132 -41.34633914770038 +90 0.7853981633974483 32.435028842544405 -40.305086527633215 +91 0.7941248096574199 32.78211304923346 -39.23621081454397 +92 0.8028514559173915 33.119751684070486 -38.14044456245491 +93 0.8115781021773633 33.44771334640059 -37.018538754820476 +94 0.8203047484373349 33.76577326768245 -35.87126228984075 +95 0.8290313946973066 34.073713465533466 -34.699401453497096 +96 0.8377580409572781 34.371322893123995 -33.503759380671 +97 0.8464846872172498 34.658397583818285 -32.2851555047155 +98 0.8552113334772213 34.93474079096305 -31.044424995856545 +99 0.8639379797371932 35.200163122727766 -29.782418188809064 +100 0.8726646259971648 35.45448267190434 -28.500000000000025 +101 0.8813912722571364 35.69752514057734 -27.198049334797666 +102 0.890117918517108 35.92912395957899 -25.877458485154172 +103 0.8988445647770796 36.149120402647355 -24.539132518072854 +104 0.9075712110370513 36.357363695209415 -23.18398865532062 +105 0.9162978572970231 36.55371111771445 -21.8129556448101 +106 0.9250245035569946 36.73802810344684 -20.426973124082153 +107 0.9337511498169663 36.91018833075138 -19.026990976324942 +108 0.9424777960769379 37.07007380960792 -17.613968679372 +109 0.9512044423369095 37.21757496249566 -16.188874648123598 +110 0.9599310885968813 37.3525906994923 -14.752685570843665 +111 0.9686577348568529 37.47502848755586 -13.30638573978659 +112 0.9773843811168246 37.58480441394231 -11.850966376612277 +113 0.9861110273767961 37.681843243715136 -10.3874249530524 +114 0.9948376736367678 37.76607847130762 -8.916764507293173 +115 1.0035643198967394 37.8374523661024 -7.4399929565429685 +116 1.0122909661567112 37.895916011997194 -5.958122406256257 +117 1.0210176124166828 37.94142934092944 -4.472168456487164 +118 1.0297442586766543 37.9739611603369 -2.9831495058478152 +119 1.038470904936626 37.99348917453559 -1.4920860535487916 +120 1.0471975511965976 37.99999999999999 -6.328271240363392e-15 +121 1.0559241974565694 37.99348917453558 1.4920860535487601 +122 1.064650843716541 37.9739611603369 2.983149505847755 +123 1.0733774899765127 37.94142934092943 4.472168456487155 +124 1.0821041362364843 37.895916011997194 5.95812240625626 +125 1.0908307824964558 37.8374523661024 7.439992956542908 +126 1.0995574287564276 37.766078471307615 8.916764507293164 +127 1.1082840750163994 37.681843243715136 10.387424953052426 +128 1.117010721276371 37.58480441394231 11.850966376612291 +129 1.1257373675363425 37.47502848755585 13.306385739786583 +130 1.1344640137963142 37.3525906994923 14.752685570843688 +131 1.1431906600562858 37.21757496249566 16.188874648123573 +132 1.1519173063162573 37.07007380960792 17.613968679371972 +133 1.160643952576229 36.91018833075139 19.026990976324946 +134 1.1693705988362009 36.73802810344684 20.426973124082156 +135 1.1780972450961724 36.55371111771445 21.812955644810103 +136 1.186823891356144 36.35736369520942 23.183988655320608 +137 1.1955505376161157 36.149120402647355 24.53913251807282 +138 1.2042771838760875 35.92912395957898 25.87745848515419 +139 1.213003830136059 35.69752514057734 27.198049334797666 +140 1.2217304763960306 35.454482671904344 28.499999999999993 +141 1.2304571226560024 35.20016312272775 29.782418188809107 +142 1.239183768915974 34.934740790963055 31.04442499585653 +143 1.2479104151759455 34.6583975838183 32.28515550471546 +144 1.2566370614359172 34.371322893124 33.50375938067097 +145 1.265363707695889 34.073713465533466 34.69940145349708 +146 1.2740903539558606 33.76577326768245 35.871262289840736 +147 1.2828170002158321 33.4477133464006 37.01853875482045 +148 1.2915436464758039 33.119751684070486 38.14044456245494 +149 1.3002702927357754 32.782113049233466 39.23621081454397 +150 1.3089969389957472 32.435028842544405 40.305086527633215 +151 1.3177235852557188 32.07873693818133 41.34633914770039 +152 1.3264502315156905 31.713481520818302 42.35925505221147 +153 1.335176877775662 31.3395129182735 43.34314003920175 +154 1.3439035240356336 30.957087429946913 44.29731980304732 +155 1.3526301702956054 30.566467151165693 45.22114039660041 +156 1.3613568165555772 30.167919793556987 46.11396867937202 +157 1.3700834628155487 29.761718501571828 46.975192751454905 +158 1.3788101090755203 29.348141665285517 47.80422237288917 +159 1.3875367553354918 28.92747272960304 48.600489368183226 +160 1.3962634015954636 28.500000000000007 49.363448015713004 +161 1.4049900478554354 28.066016444932558 50.092575421732036 +162 1.413716694115407 27.625819495051395 50.78737187873696 +163 1.4224433403753785 27.17971083935762 51.447361207942045 +164 1.4311699866353502 26.727996218440204 52.07209108562826 +165 1.4398966328953218 26.27098521493672 52.661133353143356 +166 1.4486232791552935 25.808991041360706 53.21408431034052 +167 1.457349925415265 25.342330325441655 53.73056499225417 +168 1.4660765716752369 24.871322893124002 54.21022142882374 +169 1.4748032179352084 24.396291549374535 54.65272488748699 +170 1.48352986419518 23.917561856947902 55.05777209847689 +171 1.4922565104551517 23.43546191326221 55.42508546266758 +172 1.5009831567151235 22.95032212553742 55.75441324182692 +173 1.509709802975095 22.462474984350813 56.04552973114541 +174 1.5184364492350666 21.972254835764392 56.298235413922846 +175 1.5271630954950384 21.479997652180984 56.512357098307184 +176 1.53588974175501 20.986040802085427 56.68774803599157 +177 1.5446163880149815 20.490722818829063 56.824288022788295 +178 1.5533430342749532 19.99438316861594 56.92188348101071 +179 1.562069680534925 19.49736201784959 56.98046752360676 +180 1.5707963267948966 19.0 57.0 +181 1.579522973054868 18.502637982150418 56.98046752360676 +182 1.5882496193148399 18.005616831384067 56.92188348101071 +183 1.5969762655748114 17.509277181170955 56.824288022788295 +184 1.605702911834783 17.0139591979146 56.68774803599157 +185 1.6144295580947547 16.520002347819023 56.51235709830721 +186 1.6231562043547265 16.02774516423561 56.298235413922846 +187 1.6318828506146983 15.53752501564919 56.04552973114541 +188 1.6406094968746698 15.049677874462574 55.75441324182692 +189 1.6493361431346414 14.564538086737803 55.425085462667596 +190 1.6580627893946132 14.082438143052102 55.057772098476896 +191 1.6667894356545847 13.60370845062547 54.65272488748701 +192 1.6755160819145563 13.128677106876012 54.21022142882375 +193 1.684242728174528 12.657669674558354 53.730564992254195 +194 1.6929693744344996 12.191008958639303 53.214084310340525 +195 1.7016960206944711 11.729014785063306 52.66113335314337 +196 1.7104226669544427 11.272003781559807 52.07209108562828 +197 1.7191493132144147 10.82028916064239 51.44736120794205 +198 1.7278759594743864 10.3741805049486 50.787371878736955 +199 1.736602605734358 9.933983555067439 50.09257542173203 +200 1.7453292519943295 9.5 49.36344801571302 +201 1.7540558982543013 9.072527270396973 48.60048936818325 +202 1.7627825445142729 8.651858334714483 47.80422237288917 +203 1.7715091907742444 8.238281498428183 46.97519275145491 +204 1.780235837034216 7.832080206443017 46.11396867937202 +205 1.7889624832941877 7.433532848834307 45.22114039660041 +206 1.7976891295541593 7.042912570053092 44.297319803047365 +207 1.8064157758141308 6.660487081726523 43.34314003920181 +208 1.8151424220741026 6.286518479181698 42.35925505221147 +209 1.8238690683340746 5.921263061818669 41.346339147700355 +210 1.8325957145940461 5.56497115745559 40.30508652763321 +211 1.8413223608540177 5.2178869507665375 39.23621081454397 +212 1.8500490071139892 4.880248315929514 38.14044456245494 +213 1.858775653373961 4.552286653599414 37.01853875482047 +214 1.8675022996339325 4.234226732317555 35.87126228984075 +215 1.876228945893904 3.926286534466536 34.69940145349708 +216 1.8849555921538759 3.6286771068760006 33.503759380670985 +217 1.8936822384138474 3.3416024161817104 32.28515550471549 +218 1.902408884673819 3.0652592090369453 31.04442499585658 +219 1.9111355309337907 2.7998368772722464 29.782418188809107 +220 1.9198621771937625 2.545517328095671 28.500000000000014 +221 1.9285888234537343 2.30247485942266 27.198049334797666 +222 1.9373154697137058 2.070876040421008 25.877458485154165 +223 1.9460421159736774 1.8508795973526502 24.53913251807284 +224 1.9547687622336491 1.6426363047905814 23.18398865532062 +225 1.9634954084936207 1.446288882285552 21.812955644810113 +226 1.9722220547535922 1.2619718965531648 20.426973124082156 +227 1.980948701013564 1.089811669248612 19.026990976324946 +228 1.9896753472735356 0.9299261903920935 17.613968679372025 +229 1.9984019935335071 0.7824250375043404 16.188874648123623 +230 2.007128639793479 0.6474093005077042 14.752685570843717 +231 2.015855286053451 0.5249715124441412 13.306385739786565 +232 2.0245819323134224 0.4151955860576919 11.850966376612254 +233 2.033308578573394 0.3181567562848644 10.387424953052395 +234 2.0420352248333655 0.23392152869238236 8.916764507293164 +235 2.050761871093337 0.16254763389760696 7.439992956542993 +236 2.0594885173533086 0.10408398800280749 5.958122406256298 +237 2.0682151636132806 0.05857065907056658 4.472168456487155 +238 2.076941809873252 0.026038839663103497 2.9831495058478055 +239 2.0856684561332237 0.006510825464414172 1.4920860535487885 +240 2.0943951023931953 -4.218847493575595e-15 4.746203430272544e-14 +241 2.103121748653167 0.006510825464405734 -1.4920860535486842 +242 2.111848394913139 0.026038839663101387 -2.983149505847796 +243 2.1205750411731104 0.05857065907056236 -4.472168456487164 +244 2.129301687433082 0.10408398800281171 -5.958122406256223 +245 2.138028333693054 0.16254763389759852 -7.4399929565429685 +246 2.1467549799530254 0.23392152869238236 -8.916764507293156 +247 2.155481626212997 0.3181567562848644 -10.3874249530524 +248 2.1642082724729685 0.4151955860576919 -11.850966376612277 +249 2.17293491873294 0.524971512444137 -13.306385739786535 +250 2.1816615649929116 0.6474093005077021 -14.752685570843635 +251 2.1903882112528836 0.7824250375043257 -16.188874648123583 +252 2.199114857512855 0.9299261903920829 -17.613968679371986 +253 2.2078415037728267 1.08981166924861 -19.026990976324914 +254 2.2165681500327987 1.2619718965531668 -20.426973124082135 +255 2.2252947962927703 1.446288882285552 -21.8129556448101 +256 2.234021442552742 1.6426363047905814 -23.18398865532062 +257 2.2427480888127134 1.8508795973526437 -24.539132518072815 +258 2.251474735072685 2.0708760404210036 -25.87745848515415 +259 2.260201381332657 2.3024748594226683 -27.198049334797687 +260 2.2689280275926285 2.5455173280956647 -28.500000000000025 +261 2.2776546738526 2.7998368772722424 -29.782418188809057 +262 2.2863813201125716 3.065259209036937 -31.0444249958565 +263 2.295107966372543 3.3416024161816953 -32.28515550471543 +264 2.3038346126325147 3.6286771068759878 -33.503759380670914 +265 2.3125612588924866 3.92628653446653 -34.699401453497096 +266 2.321287905152458 4.234226732317542 -35.871262289840715 +267 2.33001455141243 4.552286653599419 -37.018538754820476 +268 2.3387411976724017 4.880248315929514 -38.14044456245494 +269 2.3474678439323733 5.217886950766541 -39.23621081454397 +270 2.356194490192345 5.564971157455594 -40.305086527633215 +271 2.3649211364523164 5.921263061818663 -41.34633914770037 +272 2.373647782712288 6.286518479181683 -42.359255052211445 +273 2.3823744289722595 6.660487081726489 -43.343140039201714 +274 2.3911010752322315 7.042912570053083 -44.29731980304733 +275 2.399827721492203 7.433532848834301 -45.221140396600376 +276 2.408554367752175 7.832080206443023 -46.11396867937202 +277 2.4172810140121466 8.238281498428181 -46.97519275145488 +278 2.426007660272118 8.651858334714486 -47.80422237288917 +279 2.4347343065320897 9.072527270396957 -48.60048936818324 +280 2.443460952792061 9.499999999999991 -49.36344801571299 +281 2.4521875990520328 9.933983555067424 -50.092575421732015 +282 2.4609142453120048 10.374180504948615 -50.78737187873697 +283 2.4696408915719763 10.82028916064238 -51.44736120794204 +284 2.478367537831948 11.272003781559789 -52.072091085628244 +285 2.4870941840919194 11.729014785063281 -52.66113335314334 +286 2.495820830351891 12.19100895863928 -53.21408431034047 +287 2.504547476611863 12.657669674558353 -53.73056499225416 +288 2.5132741228718345 13.128677106875985 -54.21022142882376 +289 2.522000769131806 13.603708450625465 -54.65272488748699 +290 2.530727415391778 14.08243814305211 -55.0577720984769 +291 2.5394540616517496 14.5645380867378 -55.42508546266757 +292 2.548180707911721 15.049677874462558 -55.75441324182691 +293 2.5569073541716927 15.537525015649193 -56.04552973114542 +294 2.5656340004316642 16.02774516423559 -56.298235413922846 +295 2.574360646691636 16.520002347819002 -56.51235709830719 +296 2.5830872929516078 17.013959197914588 -56.687748035991575 +297 2.5918139392115793 17.509277181170944 -56.824288022788316 +298 2.600540585471551 18.00561683138406 -56.9218834810107 +299 2.609267231731523 18.50263798215042 -56.980467523606755 +300 2.6179938779914944 18.999999999999996 -56.999999999999986 +301 2.626720524251466 19.49736201784959 -56.98046752360675 +302 2.6354471705114375 19.99438316861592 -56.9218834810107 +303 2.644173816771409 20.49072281882904 -56.824288022788274 +304 2.652900463031381 20.98604080208542 -56.68774803599159 +305 2.6616271092913526 21.47999765218098 -56.51235709830719 +306 2.670353755551324 21.97225483576439 -56.29823541392285 +307 2.6790804018112957 22.462474984350784 -56.04552973114541 +308 2.6878070480712672 22.950322125537408 -55.754413241826924 +309 2.696533694331239 23.435461913262177 -55.42508546266756 +310 2.705260340591211 23.91756185694789 -55.057772098476896 +311 2.7139869868511823 24.396291549374514 -54.652724887487004 +312 2.7227136331111543 24.871322893124002 -54.21022142882374 +313 2.731440279371126 25.342330325441647 -53.73056499225416 +314 2.7401669256310974 25.808991041360702 -53.2140843103405 +315 2.748893571891069 26.2709852149367 -52.661133353143356 +316 2.7576202181510405 26.7279962184402 -52.07209108562829 +317 2.766346864411012 27.179710839357597 -51.44736120794207 +318 2.7750735106709836 27.625819495051363 -50.787371878737005 +319 2.7838001569309556 28.066016444932558 -50.09257542173202 +320 2.792526803190927 28.499999999999986 -49.36344801571302 +321 2.801253449450899 28.92747272960303 -48.60048936818324 +322 2.8099800957108707 29.34814166528552 -47.804222372889164 +323 2.8187067419708423 29.76171850157182 -46.97519275145486 +324 2.827433388230814 30.167919793556987 -46.113968679372014 +325 2.8361600344907854 30.56646715116569 -45.221140396600426 +326 2.844886680750757 30.9570874299469 -44.29731980304736 +327 2.853613327010729 31.33951291827349 -43.343140039201764 +328 2.8623399732707004 31.71348152081831 -42.35925505221146 +329 2.871066619530672 32.078736938181315 -41.346339147700434 +330 2.8797932657906435 32.435028842544384 -40.30508652763322 +331 2.888519912050615 32.78211304923345 -39.23621081454402 +332 2.897246558310587 33.119751684070486 -38.14044456245494 +333 2.9059732045705586 33.44771334640059 -37.0185387548205 +334 2.91469985083053 33.76577326768244 -35.871262289840786 +335 2.923426497090502 34.07371346553347 -34.699401453497074 +336 2.9321531433504737 34.371322893124 -33.503759380670985 +337 2.9408797896104453 34.65839758381829 -32.28515550471547 +338 2.949606435870417 34.934740790963055 -31.044424995856577 +339 2.9583330821303884 35.200163122727744 -29.78241818880912 +340 2.96705972839036 35.45448267190432 -28.500000000000064 +341 2.975786374650332 35.69752514057734 -27.198049334797663 +342 2.9845130209103035 35.92912395957898 -25.877458485154182 +343 2.993239667170275 36.14912040264735 -24.53913251807287 +344 3.001966313430247 36.35736369520942 -23.183988655320608 +345 3.0106929596902186 36.55371111771444 -21.812955644810117 +346 3.01941960595019 36.73802810344682 -20.426973124082142 +347 3.0281462522101616 36.910188330751396 -19.02699097632497 +348 3.036872898470133 37.07007380960791 -17.61396867937205 +349 3.045599544730105 37.217574962495675 -16.188874648123573 +350 3.0543261909900767 37.3525906994923 -14.752685570843681 +351 3.0630528372500483 37.47502848755585 -13.306385739786627 +352 3.07177948351002 37.5848044139423 -11.850966376612341 +353 3.0805061297699914 37.68184324371513 -10.387424953052465 +354 3.089232776029963 37.76607847130761 -8.916764507293214 +355 3.097959422289935 37.8374523661024 -7.439992956542961 +356 3.1066860685499065 37.895916011997194 -5.958122406256279 +357 3.1154127148098785 37.94142934092943 -4.472168456487114 +358 3.12413936106985 37.973961160336906 -2.9831495058477806 +359 3.1328660073298216 37.9934891745356 -1.4920860535487606 +360 3.141592653589793 38.0 -3.7969627442180354e-14 +361 3.1503192998497647 37.9934891745356 1.4920860535487415 +362 3.159045946109736 37.973961160336906 2.9831495058477424 +363 3.1677725923697078 37.94142934092943 4.472168456487095 +364 3.1764992386296798 37.895916011997194 5.958122406256241 +365 3.1852258848896513 37.8374523661024 7.439992956542923 +366 3.193952531149623 37.76607847130761 8.916764507293102 +367 3.2026791774095944 37.68184324371514 10.387424953052331 +368 3.211405823669566 37.58480441394232 11.850966376612213 +369 3.2201324699295375 37.47502848755587 13.306385739786519 +370 3.2288591161895095 37.3525906994923 14.752685570843644 +371 3.237585762449481 37.217574962495675 16.188874648123534 +372 3.246312408709453 37.07007380960791 17.61396867937201 +373 3.255039054969425 36.910188330751396 19.02699097632501 +374 3.2637657012293966 36.73802810344682 20.42697312408216 +375 3.272492347489368 36.55371111771444 21.812955644810156 +376 3.2812189937493397 36.35736369520941 23.18398865532062 +377 3.2899456400093112 36.149120402647355 24.53913251807283 +378 3.2986722862692828 35.929123959578995 25.877458485154147 +379 3.3073989325292543 35.69752514057734 27.19804933479764 +380 3.3161255787892263 35.45448267190433 28.500000000000025 +381 3.324852225049198 35.200163122727744 29.78241818880909 +382 3.3335788713091694 34.93474079096306 31.044424995856538 +383 3.342305517569141 34.65839758381831 32.285155504715455 +384 3.3510321638291125 34.37132289312402 33.50375938067094 +385 3.359758810089084 34.07371346553349 34.699401453497025 +386 3.368485456349056 33.76577326768244 35.87126228984072 +387 3.3772121026090276 33.44771334640059 37.01853875482045 +388 3.385938748868999 33.1197516840705 38.14044456245489 +389 3.3946653951289707 32.78211304923348 39.23621081454393 +390 3.4033920413889422 32.43502884254442 40.305086527633144 +391 3.412118687648914 32.07873693818135 41.34633914770035 +392 3.4208453339088853 31.71348152081833 42.35925505221141 +393 3.4295719801688573 31.339512918273503 43.34314003920174 +394 3.4382986264288293 30.95708742994691 44.29731980304736 +395 3.447025272688801 30.566467151165696 45.22114039660039 +396 3.455751918948773 30.167919793556976 46.11396867937202 +397 3.4644785652087444 29.761718501571814 46.97519275145493 +398 3.473205211468716 29.348141665285514 47.804222372889164 +399 3.4819318577286875 28.92747272960303 48.60048936818326 +400 3.490658503988659 28.500000000000004 49.363448015713004 +401 3.4993851502486306 28.06601644493257 50.09257542173199 +402 3.5081117965086026 27.62581949505138 50.78737187873699 +403 3.516838442768574 27.179710839357604 51.44736120794205 +404 3.5255650890285457 26.72799621844021 52.072091085628244 +405 3.5342917352885173 26.270985214936715 52.66113335314334 +406 3.543018381548489 25.80899104136071 53.214084310340496 +407 3.5517450278084604 25.342330325441658 53.730564992254145 +408 3.560471674068432 24.871322893124027 54.21022142882373 +409 3.569198320328404 24.396291549374524 54.65272488748699 +410 3.5779249665883754 23.917561856947902 55.05777209847688 +411 3.586651612848347 23.435461913262223 55.42508546266754 +412 3.5953782591083185 22.950322125537447 55.75441324182689 +413 3.60410490536829 22.462474984350827 56.04552973114539 +414 3.6128315516282616 21.972254835764414 56.29823541392282 +415 3.6215581978882336 21.479997652180998 56.51235709830719 +416 3.630284844148205 20.98604080208543 56.687748035991554 +417 3.639011490408177 20.49072281882906 56.82428802278828 +418 3.647738136668149 19.994383168615915 56.92188348101071 +419 3.6564647829281207 19.497362017849575 56.98046752360676 +420 3.6651914291880923 18.999999999999993 57.0 +421 3.673918075448064 18.502637982150407 56.98046752360676 +422 3.6826447217080354 18.00561683138407 56.92188348101071 +423 3.691371367968007 17.50927718117096 56.82428802278828 +424 3.7000980142279785 17.01395919791459 56.68774803599157 +425 3.7088246604879505 16.520002347819013 56.512357098307184 +426 3.717551306747922 16.027745164235615 56.29823541392285 +427 3.7262779530078936 15.5375250156492 56.04552973114541 +428 3.735004599267865 15.04967787446258 55.754413241826924 +429 3.7437312455278366 14.564538086737812 55.42508546266756 +430 3.752457891787808 14.082438143052123 55.057772098476896 +431 3.76118453804778 13.603708450625465 54.65272488748699 +432 3.7699111843077517 13.128677106876005 54.21022142882375 +433 3.7786378305677233 12.657669674558363 53.730564992254166 +434 3.787364476827695 12.191008958639312 53.2140843103405 +435 3.7960911230876664 11.72901478506332 52.66113335314334 +436 3.804817769347638 11.272003781559823 52.07209108562826 +437 3.8135444156076095 10.820289160642425 51.447361207942116 +438 3.8222710618675815 10.37418050494863 50.78737187873697 +439 3.8309977081275535 9.933983555067435 50.092575421732015 +440 3.839724354387525 9.500000000000004 49.363448015713 +441 3.848451000647497 9.072527270396956 48.60048936818322 +442 3.8571776469074686 8.651858334714477 47.804222372889136 +443 3.86590429316744 8.238281498428174 46.975192751454884 +444 3.8746309394274117 7.832080206443008 46.11396867937201 +445 3.883357585687383 7.433532848834316 45.221140396600426 +446 3.8920842319473548 7.042912570053096 44.29731980304733 +447 3.9008108782073267 6.660487081726508 43.34314003920174 +448 3.9095375244672983 6.286518479181689 42.35925505221146 +449 3.91826417072727 5.921263061818676 41.34633914770038 +450 3.9269908169872414 5.5649711574556004 40.305086527633215 +451 3.935717463247213 5.21788695076655 39.236210814543995 +452 3.9444441095071845 4.880248315929524 38.140444562454974 +453 3.953170755767156 4.552286653599431 37.01853875482053 +454 3.961897402027128 4.234226732317555 35.87126228984075 +455 3.9706240482870996 3.9262865344665423 34.699401453497096 +456 3.979350694547071 3.628677106876011 33.50375938067101 +457 3.9880773408070427 3.3416024161817184 32.28515550471551 +458 3.9968039870670142 3.06525920903696 31.044424995856602 +459 4.005530633326986 2.7998368772722655 29.78241818880915 +460 4.014257279586958 2.545517328095671 28.500000000000025 +461 4.022983925846929 2.3024748594226874 27.19804933479779 +462 4.031710572106902 2.0708760404210036 25.877458485154097 +463 4.040437218366873 1.8508795973526522 24.53913251807284 +464 4.049163864626845 1.6426363047905814 23.183988655320576 +465 4.057890510886816 1.4462888822855604 21.81295564481017 +466 4.066617157146788 1.261971896553169 20.426973124082114 +467 4.07534380340676 1.0898116692486055 19.026990976324896 +468 4.084070449666731 0.929926190392085 17.613968679372025 +469 4.092797095926703 0.7824250375043278 16.188874648123548 +470 4.101523742186674 0.6474093005077105 14.752685570843724 +471 4.110250388446646 0.5249715124441433 13.30638573978659 +472 4.118977034706617 0.41519558605770035 11.850966376612366 +473 4.127703680966589 0.3181567562848623 10.387424953052445 +474 4.136430327226561 0.23392152869238447 8.91676450729314 +475 4.145156973486532 0.16254763389760907 7.439992956543022 +476 4.153883619746504 0.10408398800280749 5.9581224062562415 +477 4.162610266006475 0.058570659070575015 4.472168456487284 +478 4.171336912266447 0.026038839663099278 2.983149505847856 +479 4.1800635585264185 0.006510825464416281 1.492086053548912 +480 4.1887902047863905 4.218847493575595e-15 6.961098364399732e-14 +481 4.1975168510463625 0.006510825464414172 -1.4920860535487472 +482 4.206243497306334 0.02603883966308873 -2.9831495058476825 +483 4.214970143566306 0.05857065907056658 -4.472168456487126 +484 4.223696789826278 0.10408398800280327 -5.95812240625626 +485 4.23242343608625 0.16254763389761118 -7.439992956543012 +486 4.241150082346221 0.23392152869238236 -8.91676450729314 +487 4.249876728606193 0.3181567562848644 -10.387424953052426 +488 4.258603374866164 0.4151955860576919 -11.850966376612229 +489 4.267330021126136 0.5249715124441539 -13.306385739786606 +490 4.276056667386108 0.6474093005077126 -14.75268557084374 +491 4.284783313646079 0.7824250375043278 -16.188874648123548 +492 4.293509959906051 0.929926190392085 -17.613968679372004 +493 4.302236606166022 1.0898116692486055 -19.02699097632487 +494 4.310963252425994 1.2619718965531648 -20.426973124082096 +495 4.319689898685965 1.4462888822855435 -21.812955644810025 +496 4.328416544945937 1.642636304790571 -23.18398865532059 +497 4.337143191205909 1.8508795973526502 -24.53913251807284 +498 4.34586983746588 2.070876040420999 -25.87745848515411 +499 4.354596483725852 2.302474859422656 -27.198049334797663 +500 4.363323129985823 2.5455173280956456 -28.499999999999915 +501 4.372049776245795 2.799836877272236 -29.78241818880902 +502 4.380776422505767 3.0652592090369453 -31.04442499585653 +503 4.389503068765738 3.341602416181689 -32.2851555047154 +504 4.39822971502571 3.62867710687599 -33.50375938067096 +505 4.4069563612856815 3.9262865344665148 -34.699401453496975 +506 4.4156830075456535 4.234226732317538 -35.87126228984067 +507 4.4244096538056255 4.552286653599414 -37.01853875482047 +508 4.4331363000655974 4.8802483159295225 -38.140444562454974 +509 4.4418629463255686 5.217886950766524 -39.23621081454396 +510 4.4505895925855405 5.564971157455602 -40.30508652763322 +511 4.4593162388455125 5.9212630618186886 -41.346339147700455 +512 4.468042885105484 6.286518479181689 -42.359255052211466 +513 4.476769531365456 6.660487081726528 -43.343140039201785 +514 4.485496177625427 7.042912570053074 -44.2973198030473 +515 4.494222823885399 7.433532848834307 -45.22114039660041 +516 4.50294947014537 7.8320802064429875 -46.113968679371936 +517 4.511676116405342 8.238281498428176 -46.97519275145486 +518 4.520402762665314 8.651858334714497 -47.80422237288918 +519 4.529129408925285 9.07252727039696 -48.600489368183226 +520 4.537856055185257 9.5 -49.36344801571302 +521 4.546582701445228 9.933983555067417 -50.092575421731986 +522 4.5553093477052 10.3741805049486 -50.787371878736955 +523 4.564035993965171 10.820289160642355 -51.44736120794202 +524 4.572762640225143 11.272003781559773 -52.07209108562822 +525 4.581489286485115 11.729014785063294 -52.661133353143356 +526 4.590215932745086 12.191008958639264 -53.21408431034045 +527 4.598942579005058 12.657669674558337 -53.73056499225417 +528 4.607669225265029 13.12867710687596 -54.2102214288237 +529 4.616395871525002 13.603708450625495 -54.65272488748703 +530 4.625122517784973 14.082438143052102 -55.057772098476896 +531 4.633849164044945 14.56453808673781 -55.425085462667596 +532 4.642575810304916 15.049677874462555 -55.75441324182691 +533 4.651302456564888 15.537525015649203 -56.04552973114541 +534 4.66002910282486 16.027745164235636 -56.29823541392285 +535 4.6687557490848315 16.520002347819013 -56.512357098307184 +536 4.6774823953448035 17.013959197914595 -56.68774803599157 +537 4.686209041604775 17.509277181170923 -56.824288022788295 +538 4.694935687864747 18.005616831384067 -56.92188348101071 +539 4.703662334124718 18.502637982150382 -56.98046752360676 +540 4.71238898038469 18.999999999999986 -57.0 +541 4.721115626644662 19.497362017849596 -56.98046752360676 +542 4.729842272904633 19.994383168615915 -56.92188348101071 +543 4.738568919164605 20.490722818829052 -56.824288022788295 +544 4.747295565424576 20.986040802085387 -56.687748035991575 +545 4.756022211684548 21.47999765218096 -56.51235709830719 +546 4.764748857944519 21.972254835764343 -56.29823541392286 +547 4.773475504204491 22.462474984350774 -56.04552973114545 +548 4.782202150464463 22.95032212553742 -55.75441324182692 +549 4.790928796724434 23.43546191326217 -55.4250854626676 +550 4.799655442984406 23.91756185694788 -55.057772098476896 +551 4.808382089244377 24.396291549374485 -54.65272488748704 +552 4.81710873550435 24.871322893124027 -54.210221428823715 +553 4.825835381764321 25.342330325441647 -53.730564992254195 +554 4.834562028024293 25.808991041360713 -53.21408431034047 +555 4.843288674284264 26.270985214936694 -52.66113335314337 +556 4.852015320544236 26.727996218440204 -52.07209108562826 +557 4.860741966804208 27.17971083935762 -51.447361207942045 +558 4.869468613064179 27.62581949505138 -50.78737187873697 +559 4.878195259324151 28.06601644493257 -50.092575421732015 +560 4.886921905584122 28.499999999999986 -49.36344801571303 +561 4.895648551844094 28.92747272960303 -48.60048936818324 +562 4.9043751981040655 29.34814166528548 -47.804222372889214 +563 4.9131018443640375 29.761718501571814 -46.97519275145491 +564 4.9218284906240095 30.167919793556994 -46.11396867937201 +565 4.930555136883981 30.566467151165668 -45.221140396600454 +566 4.939281783143953 30.9570874299469 -44.29731980304733 +567 4.948008429403924 31.339512918273467 -43.34314003920183 +568 4.956735075663896 31.71348152081829 -42.359255052211495 +569 4.965461721923867 32.078736938181294 -41.34633914770049 +570 4.974188368183839 32.435028842544384 -40.30508652763325 +571 4.982915014443811 32.78211304923346 -39.23621081454397 +572 4.991641660703782 33.11975168407046 -38.140444562455 +573 5.000368306963754 33.44771334640058 -37.018538754820504 +574 5.009094953223726 33.76577326768245 -35.871262289840736 +575 5.017821599483698 34.07371346553348 -34.69940145349704 +576 5.026548245743669 34.371322893123995 -33.50375938067099 +577 5.035274892003641 34.6583975838183 -32.28515550471546 +578 5.044001538263612 34.93474079096304 -31.044424995856605 +579 5.052728184523584 35.200163122727744 -29.782418188809082 +580 5.061454830783556 35.454482671904344 -28.499999999999993 +581 5.070181477043527 35.69752514057733 -27.19804933479771 +582 5.078908123303499 35.929123959578995 -25.87745848515414 +583 5.08763476956347 36.14912040264735 -24.539132518072904 +584 5.096361415823442 36.357363695209415 -23.18398865532063 +585 5.105088062083414 36.55371111771445 -21.812955644810067 +586 5.113814708343385 36.73802810344684 -20.426973124082156 +587 5.122541354603357 36.91018833075139 -19.026990976324946 +588 5.1312680008633285 37.07007380960791 -17.613968679372093 +589 5.1399946471233005 37.21757496249566 -16.18887464812361 +590 5.148721293383272 37.35259069949229 -14.752685570843791 +591 5.1574479396432436 37.475028487555846 -13.30638573978667 +592 5.1661745859032155 37.58480441394231 -11.850966376612291 +593 5.174901232163187 37.68184324371513 -10.387424953052491 +594 5.183627878423159 37.766078471307615 -8.91676450729317 +595 5.19235452468313 37.83745236610239 -7.439992956543076 +596 5.201081170943102 37.89591601199719 -5.95812240625633 +597 5.209807817203074 37.94142934092943 -4.472168456487173 +598 5.218534463463046 37.9739611603369 -2.983149505847755 +599 5.227261109723017 37.99348917453559 -1.4920860535488485 +600 5.235987755982989 37.99999999999999 6.328271240363392e-15 +601 5.244714402242961 37.9934891745356 1.492086053548836 +602 5.253441048502932 37.9739611603369 2.983149505847796 +603 5.262167694762904 37.94142934092943 4.472168456487202 +604 5.270894341022875 37.89591601199719 5.958122406256194 +605 5.279620987282847 37.8374523661024 7.4399929565429685 +606 5.288347633542818 37.766078471307615 8.916764507293072 +607 5.29707427980279 37.681843243715136 10.3874249530524 +608 5.305800926062762 37.58480441394231 11.850966376612302 +609 5.314527572322733 37.47502848755586 13.306385739786547 +610 5.323254218582705 37.35259069949229 14.752685570843678 +611 5.331980864842676 37.217574962495675 16.188874648123505 +612 5.340707511102648 37.070073809607926 17.61396867937196 +613 5.349434157362619 36.9101883307514 19.026990976324807 +614 5.358160803622591 36.73802810344683 20.426973124082057 +615 5.366887449882563 36.55371111771444 21.81295564481008 +616 5.3756140961425345 36.35736369520943 23.183988655320487 +617 5.3843407424025065 36.149120402647355 24.53913251807278 +618 5.393067388662478 35.929123959579 25.877458485154047 +619 5.4017940349224505 35.69752514057733 27.198049334797766 +620 5.410520681182422 35.45448267190434 28.499999999999986 +621 5.419247327442394 35.200163122727744 29.782418188809125 +622 5.427973973702365 34.93474079096306 31.044424995856488 +623 5.436700619962337 34.658397583818285 32.2851555047155 +624 5.445427266222309 34.37132289312399 33.50375938067101 +625 5.45415391248228 34.07371346553348 34.69940145349705 +626 5.462880558742252 33.76577326768244 35.87126228984075 +627 5.471607205002223 33.4477133464006 37.01853875482042 +628 5.480333851262195 33.11975168407049 38.14044456245491 +629 5.489060497522166 32.78211304923349 39.23621081454388 +630 5.497787143782138 32.435028842544405 40.30508652763319 +631 5.50651379004211 32.078736938181315 41.346339147700434 +632 5.515240436302081 31.713481520818323 42.359255052211424 +633 5.523967082562053 31.339512918273492 43.34314003920174 +634 5.532693728822024 30.957087429946938 44.29731980304728 +635 5.541420375081996 30.566467151165703 45.221140396600376 +636 5.550147021341967 30.167919793557026 46.1139686793719 +637 5.558873667601939 29.76171850157185 46.97519275145485 +638 5.567600313861911 29.34814166528552 47.804222372889136 +639 5.576326960121882 28.927472729603057 48.60048936818322 +640 5.585053606381854 28.500000000000007 49.36344801571299 +641 5.593780252641825 28.0660164449326 50.09257542173198 +642 5.602506898901798 27.625819495051363 50.78737187873699 +643 5.611233545161769 27.17971083935761 51.44736120794204 +644 5.619960191421741 26.7279962184402 52.07209108562825 +645 5.6286868376817125 26.270985214936722 52.66113335314332 +646 5.6374134839416845 25.808991041360706 53.21408431034048 +647 5.6461401302016565 25.342330325441623 53.7305649922542 +648 5.654866776461628 24.87132289312401 54.21022142882374 +649 5.6635934227216 24.396291549374517 54.652724887487 +650 5.672320068981571 23.917561856947923 55.057772098476846 +651 5.681046715241543 23.435461913262213 55.42508546266754 +652 5.689773361501514 22.950322125537454 55.754413241826896 +653 5.698500007761486 22.462474984350816 56.04552973114541 +654 5.707226654021458 21.972254835764378 56.298235413922846 +655 5.715953300281429 21.479997652181005 56.51235709830717 +656 5.724679946541401 20.98604080208542 56.68774803599157 +657 5.733406592801372 20.490722818829102 56.82428802278828 +658 5.742133239061344 19.99438316861595 56.9218834810107 +659 5.750859885321315 19.49736201784964 56.98046752360678 +660 5.759586531581287 19.00000000000003 57.0 +661 5.768313177841259 18.502637982150418 56.98046752360678 +662 5.77703982410123 18.00561683138411 56.92188348101071 +663 5.785766470361202 17.509277181170972 56.8242880227883 +664 5.794493116621174 17.01395919791458 56.68774803599159 +665 5.803219762881146 16.520002347819005 56.51235709830719 +666 5.811946409141117 16.027745164235622 56.29823541392285 +667 5.820673055401089 15.537525015649193 56.04552973114542 +668 5.82939970166106 15.049677874462601 55.754413241826924 +669 5.838126347921032 14.564538086737805 55.42508546266756 +670 5.846852994181004 14.082438143052098 55.05777209847688 +671 5.8555796404409755 13.603708450625486 54.65272488748703 +672 5.8643062867009474 13.128677106875998 54.21022142882374 +673 5.8730329329609186 12.657669674558383 53.7305649922542 +674 5.8817595792208905 12.1910089586393 53.21408431034052 +675 5.890486225480862 11.729014785063333 52.66113335314337 +676 5.899212871740834 11.272003781559814 52.07209108562829 +677 5.907939518000806 10.820289160642394 51.44736120794205 +678 5.916666164260777 10.374180504948637 50.787371878737005 +679 5.925392810520749 9.933983555067451 50.092575421732064 +680 5.93411945678072 9.50000000000004 49.363448015713075 +681 5.942846103040692 9.072527270396998 48.60048936818327 +682 5.951572749300664 8.651858334714479 47.804222372889186 +683 5.960299395560635 8.238281498428206 46.97519275145497 +684 5.969026041820607 7.832080206443023 46.11396867937202 +685 5.977752688080578 7.4335328488343375 45.22114039660051 +686 5.98647933434055 7.042912570053117 44.297319803047394 +687 5.995205980600522 6.660487081726511 43.343140039201764 +688 6.003932626860494 6.286518479181683 42.359255052211424 +689 6.012659273120465 5.921263061818684 41.346339147700434 +690 6.021385919380437 5.5649711574556004 40.30508652763321 +691 6.030112565640409 5.217886950766516 39.23621081454393 +692 6.03883921190038 4.880248315929518 38.14044456245493 +693 6.047565858160352 4.5522866535994 37.01853875482045 +694 6.056292504420323 4.234226732317561 35.871262289840786 +695 6.065019150680295 3.92628653446653 34.699401453497074 +696 6.073745796940266 3.628677106876007 33.50375938067105 +697 6.082472443200238 3.3416024161816997 32.28515550471551 +698 6.09119908946021 3.0652592090369324 31.04442499585652 +699 6.0999257357201815 2.799836877272261 29.78241818880914 +700 6.1086523819801535 2.5455173280956624 28.500000000000014 +701 6.117379028240125 2.3024748594226727 27.198049334797776 +702 6.126105674500097 2.0708760404210143 25.877458485154218 +703 6.134832320760068 1.8508795973526586 24.53913251807294 +704 6.14355896702004 1.6426363047905856 23.183988655320686 +705 6.152285613280012 1.4462888822855477 21.81295564481014 +706 6.161012259539983 1.2619718965531712 20.42697312408222 +707 6.169738905799955 1.0898116692486077 19.02699097632499 +708 6.178465552059926 0.9299261903921019 17.61396867937214 +709 6.187192198319899 0.7824250375043278 16.188874648123534 +710 6.19591884457987 0.6474093005076978 14.75268557084372 +711 6.204645490839842 0.524971512444137 13.306385739786574 +712 6.213372137099813 0.41519558605769824 11.850966376612341 +713 6.222098783359785 0.3181567562848644 10.387424953052408 +714 6.230825429619757 0.2339215286923887 8.916764507293102 +715 6.239552075879728 0.16254763389760063 7.439992956542977 +716 6.2482787221397 0.10408398800281804 5.9581224062562175 +717 6.257005368399671 0.058570659070577125 4.4721684564872275 +718 6.265732014659643 0.02603883966309506 2.9831495058477993 +719 6.274458660919614 0.006510825464412062 1.4920860535488742 From b7296b6d0b456bb1f7520934b2c45a36cfbd3fb0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 13:49:37 -0400 Subject: [PATCH 103/370] consolidate documentation for dihedral styles table and table/cut into one file --- doc/src/Commands_bond.rst | 2 +- doc/src/dihedral_style.rst | 2 +- doc/src/dihedral_table.rst | 89 ++++++++++--- doc/src/dihedral_table_cut.rst | 229 --------------------------------- 4 files changed, 72 insertions(+), 250 deletions(-) delete mode 100644 doc/src/dihedral_table_cut.rst diff --git a/doc/src/Commands_bond.rst b/doc/src/Commands_bond.rst index a826228219..70a021849d 100644 --- a/doc/src/Commands_bond.rst +++ b/doc/src/Commands_bond.rst @@ -126,7 +126,7 @@ OPT. * :doc:`quadratic (o) ` * :doc:`spherical ` * :doc:`table (o) ` - * :doc:`table/cut ` + * :doc:`table/cut ` .. _improper: diff --git a/doc/src/dihedral_style.rst b/doc/src/dihedral_style.rst index bf3cf4902a..4301824b40 100644 --- a/doc/src/dihedral_style.rst +++ b/doc/src/dihedral_style.rst @@ -113,7 +113,7 @@ more of (g,i,k,o,t) to indicate which accelerated styles exist. * :doc:`quadratic ` - dihedral with quadratic term in angle * :doc:`spherical ` - dihedral which includes angle terms to avoid singularities * :doc:`table ` - tabulated dihedral -* :doc:`table/cut ` - tabulated dihedral with analytic cutoff +* :doc:`table/cut ` - tabulated dihedral with analytic cutoff ---------- diff --git a/doc/src/dihedral_table.rst b/doc/src/dihedral_table.rst index ff3e61baee..f1b14065fd 100644 --- a/doc/src/dihedral_table.rst +++ b/doc/src/dihedral_table.rst @@ -1,19 +1,24 @@ .. index:: dihedral_style table .. index:: dihedral_style table/omp +.. index:: dihedral_style table/cut dihedral_style table command ============================ Accelerator Variants: *table/omp* +dihedral_style table/cut command +================================ + Syntax """""" .. code-block:: LAMMPS - dihedral_style table style Ntable + dihedral_style style interp Ntable -* style = *linear* or *spline* = method of interpolation +* style = *table* or *table/cut* +* interp = *linear* or *spline* = method of interpolation * Ntable = size of the internal lookup table Examples @@ -26,13 +31,21 @@ Examples dihedral_coeff 1 file.table DIH_TABLE1 dihedral_coeff 2 file.table DIH_TABLE2 + dihedral_style table/cut spline 400 + dihedral_style table/cut linear 1000 + dihedral_coeff 1 aat 1.0 177 180 file.table DIH_TABLE1 + dihedral_coeff 2 aat 0.5 170 180 file.table DIH_TABLE2 + Description """"""""""" -The *table* dihedral style creates interpolation tables of length -*Ntable* from dihedral potential and derivative values listed in a -file(s) as a function of the dihedral angle "phi". The files are read -by the :doc:`dihedral_coeff ` command. +The *table* and *table/cut* dihedral styles create interpolation tables +of length *Ntable* from dihedral potential and derivative values listed +in a file(s) as a function of the dihedral angle "phi". The files are +read by the :doc:`dihedral_coeff ` command. For +dihedral style *table/cut* additionally an analytic cutoff that is +quadratic in the bond-angle (theta) is applied in order to regularize +the dihedral interaction. The interpolation tables are created by fitting cubic splines to the file values and interpolating energy and derivative values at each of @@ -51,16 +64,53 @@ interpolated table. For a given dihedral angle (phi), the appropriate coefficients are chosen from this list, and a cubic polynomial is used to compute the energy and the derivative at this angle. -The following coefficients must be defined for each dihedral type via -the :doc:`dihedral_coeff ` command as in the example -above. +For dihedral style *table* the following coefficients must be defined +for each dihedral type via the :doc:`dihedral_coeff ` +command as in the example above. * filename * keyword -The filename specifies a file containing tabulated energy and -derivative values. The keyword specifies a section of the file. The -format of this file is described below. +The filename specifies a file containing tabulated energy and derivative +values. The keyword specifies which section of the file to read. The +format of this file is the same for both dihedral styles and described +below. + +For dihedral style *table/cut* the following coefficients must be +defined for each dihedral type via the :doc:`dihedral_coeff +` command as in the example above. + +* style (aat) +* cutoff prefactor +* cutoff angle1 +* cutoff angle2 +* filename +* keyword + +The cutoff dihedral style uses a tabulated dihedral interaction with a +cutoff function: + +.. math:: + + f(\theta) & = K \qquad\qquad\qquad\qquad\qquad\qquad \theta < \theta_1 \\ + f(\theta) & = K \left(1-\frac{(\theta - \theta_1)^2}{(\theta_2 - \theta_1)^2}\right) \qquad \theta_1 < \theta < \theta_2 + +The cutoff specifies an prefactor to the cutoff function. While this +value would ordinarily equal 1 there may be situations where the value +should change. + +The cutoff :math:`\theta_1` specifies the angle (in degrees) below which +the dihedral interaction is unmodified, i.e. the cutoff function is 1. + +The cutoff function is applied between :math:`\theta_1` and +:math:`\theta_2`, which is the angle at which the cutoff function drops +to zero. The value of zero effectively "turns off" the dihedral +interaction. + +The filename specifies a file containing tabulated energy and derivative +values. The keyword specifies which section of the file to read. The +format of this file is the same for both dihedral styles and described +below. ---------- @@ -182,18 +232,19 @@ that matches the specified keyword. Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -This dihedral style writes the settings for the "dihedral_style table" -command to :doc:`binary restart files `, so a dihedral_style -command does not need to specified in an input script that reads a -restart file. However, the coefficient information is not stored in -the restart file, since it is tabulated in the potential files. Thus, +These dihedral styles write the settings for the "dihedral_style table" +or "dihedral_style table/cut" command to :doc:`binary restart files +`, so a dihedral_style command does not need to specified in an +input script that reads a restart file. However, the coefficient +information loaded from the table file(s) is not stored in the restart +file, since it is tabulated in the potential files. Thus, suitable dihedral_coeff commands do need to be specified in the restart input -script. +script after reading the restart file. Restrictions """""""""""" -This dihedral style can only be used if LAMMPS was built with the +These dihedral styles can only be used if LAMMPS was built with the USER-MISC package. See the :doc:`Build package ` doc page for more info. diff --git a/doc/src/dihedral_table_cut.rst b/doc/src/dihedral_table_cut.rst deleted file mode 100644 index a29844da19..0000000000 --- a/doc/src/dihedral_table_cut.rst +++ /dev/null @@ -1,229 +0,0 @@ -.. index:: dihedral_style table/cut - -dihedral_style table/cut command -================================ - -Syntax -"""""" - -.. code-block:: LAMMPS - - dihedral_style table/cut style Ntable - -* style = *linear* or *spline* = method of interpolation -* Ntable = size of the internal lookup table - -Examples -"""""""" - -.. code-block:: LAMMPS - - dihedral_style table/cut spline 400 - dihedral_style table/cut linear 1000 - dihedral_coeff 1 aat 1.0 177 180 file.table DIH_TABLE1 - dihedral_coeff 2 aat 0.5 170 180 file.table DIH_TABLE2 - -Description -""""""""""" - -The *table/cut* dihedral style creates interpolation tables of length -*Ntable* from dihedral potential and derivative values listed in a -file(s) as a function of the dihedral angle "phi". In addition, an -analytic cutoff that is quadratic in the bond-angle (theta) is applied -in order to regularize the dihedral interaction. The dihedral table -files are read by the :doc:`dihedral_coeff ` command. - -The interpolation tables are created by fitting cubic splines to the -file values and interpolating energy and derivative values at each of -*Ntable* dihedral angles. During a simulation, these tables are used -to interpolate energy and force values on individual atoms as -needed. The interpolation is done in one of 2 styles: *linear* or -*spline*\ . - -For the *linear* style, the dihedral angle (phi) is used to find 2 -surrounding table values from which an energy or its derivative is -computed by linear interpolation. - -For the *spline* style, cubic spline coefficients are computed and -stored at each of the *Ntable* evenly-spaced values in the -interpolated table. For a given dihedral angle (phi), the appropriate -coefficients are chosen from this list, and a cubic polynomial is used -to compute the energy and the derivative at this angle. - -The following coefficients must be defined for each dihedral type via -the :doc:`dihedral_coeff ` command as in the example -above. - -* style (aat) -* cutoff prefactor -* cutoff angle1 -* cutoff angle2 -* filename -* keyword - -The cutoff dihedral style uses a tabulated dihedral interaction with a -cutoff function: - -.. math:: - - f(\theta) & = K \qquad\qquad\qquad\qquad\qquad\qquad \theta < \theta_1 \\ - f(\theta) & = K \left(1-\frac{(\theta - \theta_1)^2}{(\theta_2 - \theta_1)^2}\right) \qquad \theta_1 < \theta < \theta_2 - -The cutoff specifies an prefactor to the cutoff function. While this value -would ordinarily equal 1 there may be situations where the value should change. - -The cutoff :math:`\theta_1` specifies the angle (in degrees) below which the dihedral -interaction is unmodified, i.e. the cutoff function is 1. - -The cutoff function is applied between :math:`\theta_1` and :math:`\theta_2`, which is -the angle at which the cutoff function drops to zero. The value of zero effectively -"turns off" the dihedral interaction. - -The filename specifies a file containing tabulated energy and -derivative values. The keyword specifies a section of the file. The -format of this file is described below. - ----------- - -The format of a tabulated file is as follows (without the -parenthesized comments). It can begin with one or more comment -or blank lines. - -.. parsed-literal:: - - # Table of the potential and its negative derivative - - DIH_TABLE1 (keyword is the first text on line) - N 30 DEGREES (N, NOF, DEGREES, RADIANS, CHECKU/F) - (blank line) - 1 -168.0 -1.40351172223 0.0423346818422 - 2 -156.0 -1.70447981034 0.00811786522531 - 3 -144.0 -1.62956100432 -0.0184129719987 - ... - 30 180.0 -0.707106781187 0.0719306095245 - - # Example 2: table of the potential. Forces omitted - - DIH_TABLE2 - N 30 NOF CHECKU testU.dat CHECKF testF.dat - - 1 -168.0 -1.40351172223 - 2 -156.0 -1.70447981034 - 3 -144.0 -1.62956100432 - ... - 30 180.0 -0.707106781187 - -A section begins with a non-blank line whose first character is not a -"#"; blank lines or lines starting with "#" can be used as comments -between sections. The first line begins with a keyword which -identifies the section. The line can contain additional text, but the -initial text must match the argument specified in the -:doc:`dihedral_coeff ` command. The next line lists (in -any order) one or more parameters for the table. Each parameter is a -keyword followed by one or more numeric values. - -Following a blank line, the next N lines list the tabulated values. On -each line, the first value is the index from 1 to N, the second value is -the angle value, the third value is the energy (in energy units), and -the fourth is -dE/d(phi) also in energy units). The third term is the -energy of the 4-atom configuration for the specified angle. The fourth -term (when present) is the negative derivative of the energy with -respect to the angle (in degrees, or radians depending on whether the -user selected DEGREES or RADIANS). Thus the units of the last term -are still energy, not force. The dihedral angle values must increase -from one line to the next. - -Dihedral table splines are cyclic. There is no discontinuity at 180 -degrees (or at any other angle). Although in the examples above, the -angles range from -180 to 180 degrees, in general, the first angle in -the list can have any value (positive, zero, or negative). However -the *range* of angles represented in the table must be *strictly* less -than 360 degrees (2pi radians) to avoid angle overlap. (You may not -supply entries in the table for both 180 and -180, for example.) If -the user's table covers only a narrow range of dihedral angles, -strange numerical behavior can occur in the large remaining gap. - -**Parameters:** - -The parameter "N" is required and its value is the number of table -entries that follow. Note that this may be different than the N -specified in the :doc:`dihedral_style table ` command. -Let *Ntable* is the number of table entries requested dihedral_style -command, and let *Nfile* be the parameter following "N" in the -tabulated file ("30" in the sparse example above). What LAMMPS does -is a preliminary interpolation by creating splines using the *Nfile* -tabulated values as nodal points. It uses these to interpolate as -needed to generate energy and derivative values at *Ntable* different -points (which are evenly spaced over a 360 degree range, even if the -angles in the file are not). The resulting tables of length *Ntable* -are then used as described above, when computing energy and force for -individual dihedral angles and their atoms. This means that if you -want the interpolation tables of length *Ntable* to match exactly what -is in the tabulated file (with effectively nopreliminary -interpolation), you should set *Ntable* = *Nfile*\ . To insure the -nodal points in the user's file are aligned with the interpolated -table entries, the angles in the table should be integer multiples of -360/\ *Ntable* degrees, or 2\*PI/\ *Ntable* radians (depending on your -choice of angle units). - -The optional "NOF" keyword allows the user to omit the forces -(negative energy derivatives) from the table file (normally located in -the fourth column). In their place, forces will be calculated -automatically by differentiating the potential energy function -indicated by the third column of the table (using either linear or -spline interpolation). - -The optional "DEGREES" keyword allows the user to specify angles in -degrees instead of radians (default). - -The optional "RADIANS" keyword allows the user to specify angles in -radians instead of degrees. (Note: This changes the way the forces -are scaled in the fourth column of the data file.) - -The optional "CHECKU" keyword is followed by a filename. This allows -the user to save all of the *Ntable* different entries in the -interpolated energy table to a file to make sure that the interpolated -function agrees with the user's expectations. (Note: You can -temporarily increase the *Ntable* parameter to a high value for this -purpose. "\ *Ntable*\ " is explained above.) - -The optional "CHECKF" keyword is analogous to the "CHECKU" keyword. -It is followed by a filename, and it allows the user to check the -interpolated force table. This option is available even if the user -selected the "NOF" option. - -Note that one file can contain many sections, each with a tabulated -potential. LAMMPS reads the file section by section until it finds one -that matches the specified keyword. - -Restart, fix_modify, output, run start/stop, minimize info -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -This dihedral style writes the settings for the "dihedral_style table/cut" -command to :doc:`binary restart files `, so a dihedral_style -command does not need to specified in an input script that reads a -restart file. However, the coefficient information is not stored in -the restart file, since it is tabulated in the potential files. Thus, -dihedral_coeff commands do need to be specified in the restart input -script. - -Restrictions -"""""""""""" - -This dihedral style can only be used if LAMMPS was built with the -USER-MISC package. See the :doc:`Build package ` doc -page for more info. - -Related commands -"""""""""""""""" - -:doc:`dihedral_coeff `, :doc:`dihedral_style table ` - -Default -""""""" - -none - -.. _dihedralcut-Salerno: - -**(Salerno)** Salerno, Bernstein, J Chem Theory Comput, --, ---- (2018). From 08d4fec1429e197494a895446f18b20198b7c32f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 14:38:54 -0400 Subject: [PATCH 104/370] add framework for testing the variable command --- unittest/commands/CMakeLists.txt | 4 + unittest/commands/test_variables.cpp | 185 +++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 unittest/commands/test_variables.cpp diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index ee0e89d7e9..b2b8a3b130 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -11,6 +11,10 @@ add_executable(test_groups test_groups.cpp) target_link_libraries(test_groups PRIVATE lammps GTest::GMock GTest::GTest) add_test(NAME Groups COMMAND test_groups WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_executable(test_variables test_variables.cpp) +target_link_libraries(test_variables PRIVATE lammps GTest::GMock GTest::GTest) +add_test(NAME Variables COMMAND test_variables WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_executable(test_kim_commands test_kim_commands.cpp) if(KIM_EXTRA_UNITTESTS) if(CURL_FOUND) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp new file mode 100644 index 0000000000..32d4a7fa13 --- /dev/null +++ b/unittest/commands/test_variables.cpp @@ -0,0 +1,185 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "lammps.h" + +#include "atom.h" +#include "domain.h" +#include "group.h" +#include "info.h" +#include "input.h" +#include "region.h" +#include "variable.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include +#include + +// whether to print verbose output (i.e. not capturing LAMMPS screen output). +bool verbose = false; + +#if defined(OMPI_MAJOR_VERSION) +const bool have_openmpi = true; +#else +const bool have_openmpi = false; +#endif + +using LAMMPS_NS::utils::split_words; + +namespace LAMMPS_NS { +using ::testing::ExitedWithCode; +using ::testing::MatchesRegex; +using ::testing::StrEq; + +#define TEST_FAILURE(errmsg, ...) \ + if (Info::has_exceptions()) { \ + ::testing::internal::CaptureStdout(); \ + ASSERT_ANY_THROW({__VA_ARGS__}); \ + auto mesg = ::testing::internal::GetCapturedStdout(); \ + if (verbose) std::cout << mesg; \ + ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ + } else { \ + if (!have_openmpi) { \ + ::testing::internal::CaptureStdout(); \ + ASSERT_DEATH({__VA_ARGS__}, ""); \ + auto mesg = ::testing::internal::GetCapturedStdout(); \ + if (verbose) std::cout << mesg; \ + ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ + } \ + } + +class VariableTest : public ::testing::Test { +protected: + LAMMPS *lmp; + Group *group; + Domain *domain; + Variable *variable; + + void SetUp() override + { + const char *args[] = {"VariableTest", "-log", "none", "-echo", "screen", "-nocite"}; + char **argv = (char **)args; + int argc = sizeof(args) / sizeof(char *); + if (!verbose) ::testing::internal::CaptureStdout(); + lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + if (!verbose) ::testing::internal::GetCapturedStdout(); + group = lmp->group; + domain = lmp->domain; + variable = lmp->input->variable; + } + + void TearDown() override + { + if (!verbose) ::testing::internal::CaptureStdout(); + delete lmp; + if (!verbose) ::testing::internal::GetCapturedStdout(); + std::cout.flush(); + } + + void command(const std::string &cmd) { lmp->input->one(cmd); } + + void atomic_system() + { + if (!verbose) ::testing::internal::CaptureStdout(); + command("units real"); + command("lattice sc 1.0 origin 0.125 0.125 0.125"); + command("region box block -2 2 -2 2 -2 2"); + command("create_box 8 box"); + command("create_atoms 1 box"); + command("mass * 1.0"); + command("region left block -2.0 -1.0 INF INF INF INF"); + command("region right block 0.5 2.0 INF INF INF INF"); + command("region top block INF INF -2.0 -1.0 INF INF"); + command("set region left type 2"); + command("set region right type 3"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + } + + void molecular_system() + { + if (!verbose) ::testing::internal::CaptureStdout(); + command("fix props all property/atom mol rmass q"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + atomic_system(); + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable molid atom floor(id/4)+1"); + command("variable charge atom 2.0*sin(PI/32*id)"); + command("set atom * mol v_molid"); + command("set atom * charge v_charge"); + command("set type 1 mass 0.5"); + command("set type 2*4 mass 2.0"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + } +}; + +TEST_F(VariableTest, NoBox) +{ + ASSERT_EQ(variable->nvar, 0); + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable one index 1"); + command("variable two equal 2"); + command("variable three string three"); + command("variable four loop 4"); + command("variable five loop 100 pad"); + command("variable six world one"); + command("variable seven format two \"%5.2f\""); + command("variable eight getenv HOME"); + command("variable dummy index 0"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(variable->nvar, 9); + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable dummy delete"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(variable->nvar, 8); + + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable");); +} + +TEST_F(VariableTest, AtomicSystem) +{ + atomic_system(); + + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable id atom id"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(variable->nvar, 1); +} +} // namespace LAMMPS_NS + +int main(int argc, char **argv) +{ + MPI_Init(&argc, &argv); + ::testing::InitGoogleMock(&argc, argv); + + if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + std::cout << "Warning: using OpenMPI without exceptions. " + "Death tests will be skipped\n"; + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } + + if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; + + int rv = RUN_ALL_TESTS(); + MPI_Finalize(); + return rv; +} From 16c08516a7947c377ca550a734e8bbc36bc9117c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 16:14:40 -0400 Subject: [PATCH 105/370] test definition of more different variable styles --- unittest/commands/test_variables.cpp | 86 ++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 32d4a7fa13..85108da4da 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -75,8 +75,8 @@ protected: if (!verbose) ::testing::internal::CaptureStdout(); lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); if (!verbose) ::testing::internal::GetCapturedStdout(); - group = lmp->group; - domain = lmp->domain; + group = lmp->group; + domain = lmp->domain; variable = lmp->input->variable; } @@ -86,6 +86,8 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); std::cout.flush(); + unlink("test_variable.file"); + unlink("test_variable.atomfile"); } void command(const std::string &cmd) { lmp->input->one(cmd); } @@ -122,39 +124,87 @@ protected: command("set type 2*4 mass 2.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void file_vars() + { + FILE *fp = fopen("test_variable.file", "w"); + fputs("# test file for file style variable\n\n\none\n two \n\n" + "three # with comment\nfour ! with non-comment\n" + "# comments only\n five\n#END\n", + fp); + fclose(fp); + fp = fopen("test_variable.atomfile", "w"); + + fputs("# test file for atomfile style variable\n\n" + "4 # four lines\n4 0.5 #with comment\n" + "2 -0.5 \n3 1.5\n1 -1.5\n\n" + "2\n10 1.0 # test\n13 1.0\n\n######\n" + "4\n1 4.0 # test\n2 3.0\n3 2.0\n4 1.0\n#END\n", + fp); + fclose(fp); + } }; -TEST_F(VariableTest, NoBox) +TEST_F(VariableTest, CreateDelete) { + file_vars(); ASSERT_EQ(variable->nvar, 0); if (!verbose) ::testing::internal::CaptureStdout(); - command("variable one index 1"); - command("variable two equal 2"); - command("variable three string three"); - command("variable four loop 4"); - command("variable five loop 100 pad"); - command("variable six world one"); - command("variable seven format two \"%5.2f\""); - command("variable eight getenv HOME"); - command("variable dummy index 0"); + command("variable one index 1 2 3 4"); + command("variable two equal 1"); + command("variable two equal 2"); + command("variable three string four"); + command("variable three string three"); + command("variable four1 loop 4"); + command("variable four2 loop 2 4"); + command("variable five1 loop 100 pad"); + command("variable five2 loop 100 200 pad"); + command("variable six world one"); + command("variable seven format two \"%5.2f\""); + command("variable eight getenv PWD"); + command("variable eight getenv HOME"); + command("variable nine file test_variable.file"); + command("variable dummy index 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 9); + ASSERT_EQ(variable->nvar, 12); if (!verbose) ::testing::internal::CaptureStdout(); - command("variable dummy delete"); + command("variable dummy delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 8); - + ASSERT_EQ(variable->nvar, 11); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable");); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index");); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy delete xxx");); + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable two string xxx");); + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable two getenv xxx");); + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable one equal 2");); + TEST_FAILURE(".*ERROR: Cannot use atomfile-style variable unless an atom map exists.*", + command("variable ten atomfile test_variable.atomfile");); + TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", + command("variable nine1 file test_variable.xxx");); } TEST_F(VariableTest, AtomicSystem) { + command("atom_modify map array"); atomic_system(); + file_vars(); if (!verbose) ::testing::internal::CaptureStdout(); - command("variable id atom id"); + command("variable one index 1 2 3 4"); + command("variable id atom type"); + command("variable id atom id"); + command("variable ten atomfile test_variable.atomfile"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 1); + ASSERT_EQ(variable->nvar, 3); + + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable one atom x");); + TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", + command("variable ten1 atomfile test_variable.xxx");); } } // namespace LAMMPS_NS From 014f9ad527fa5231e0b7bc1b9b10118bbdbadcfa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 16:47:04 -0400 Subject: [PATCH 106/370] simplify Variable::parse_args() by using Tokenizer class --- src/variable.cpp | 33 +++++---------------------------- src/variable.h | 1 - 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 1af4a4728a..6766a67a9a 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4708,42 +4708,19 @@ double Variable::constant(char *word) int Variable::parse_args(char *str, char **args) { - char *ptrnext; int narg = 0; - char *ptr = str; + Tokenizer values(str,","); - while (ptr && narg < MAXFUNCARG) { - ptrnext = find_next_comma(ptr); - if (ptrnext) *ptrnext = '\0'; - args[narg] = utils::strdup(ptr); + while (values.has_next() && narg < MAXFUNCARG) { + args[narg] = utils::strdup(values.next()); narg++; - ptr = ptrnext; - if (ptr) ptr++; } - if (ptr) error->all(FLERR,"Too many args in variable function"); + if (values.has_next()) + error->all(FLERR,"Too many args in variable function"); return narg; } - -/* ---------------------------------------------------------------------- - find next comma in str - skip commas inside one or more nested parenthesis - only return ptr to comma at level 0, else nullptr if not found -------------------------------------------------------------------------- */ - -char *Variable::find_next_comma(char *str) -{ - int level = 0; - for (char *p = str; *p; ++p) { - if ('(' == *p) level++; - else if (')' == *p) level--; - else if (',' == *p && !level) return p; - } - return nullptr; -} - - /* ---------------------------------------------------------------------- helper routine for printing variable name with error message ------------------------------------------------------------------------- */ diff --git a/src/variable.h b/src/variable.h index 2519bc7ac9..cb74e71b51 100644 --- a/src/variable.h +++ b/src/variable.h @@ -125,7 +125,6 @@ class Variable : protected Pointers { int is_constant(char *); double constant(char *); int parse_args(char *, char **); - char *find_next_comma(char *); void print_var_error(const std::string &, int, const std::string &, int, int global=1); void print_tree(Tree *, int); From 1ebb600829360140e3b0d72ffa08e1b938d56196 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 16:47:40 -0400 Subject: [PATCH 107/370] add tests for expressions and functions --- unittest/commands/test_variables.cpp | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 85108da4da..5a77c75a6c 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -18,6 +18,7 @@ #include "group.h" #include "info.h" #include "input.h" +#include "math_const.h" #include "region.h" #include "variable.h" @@ -37,6 +38,7 @@ const bool have_openmpi = false; #endif using LAMMPS_NS::utils::split_words; +using LAMMPS_NS::MathConst::MY_PI; namespace LAMMPS_NS { using ::testing::ExitedWithCode; @@ -206,6 +208,40 @@ TEST_F(VariableTest, AtomicSystem) TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", command("variable ten1 atomfile test_variable.xxx");); } + +TEST_F(VariableTest, Expressions) +{ + ASSERT_EQ(variable->nvar, 0); + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable one index 1"); + command("variable two equal 2"); + command("variable three equal v_one+v_two"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(variable->nvar, 3); + + int ivar = variable->find("one"); + ASSERT_FALSE(variable->equalstyle(ivar)); + ivar = variable->find("two"); + ASSERT_TRUE(variable->equalstyle(ivar)); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),2.0); + ivar = variable->find("three"); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),3.0); +} + +TEST_F(VariableTest, Functions) +{ + file_vars(); + ASSERT_EQ(variable->nvar, 0); + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable one index 1"); + command("variable two equal PI"); + command("variable three equal atan2(v_one,1)"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(variable->nvar, 3); + + int ivar = variable->find("three"); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),0.25*MY_PI); +} } // namespace LAMMPS_NS int main(int argc, char **argv) From 1efd72eb58cd0b61a7d265847b0c908d06432300 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 16:55:05 -0400 Subject: [PATCH 108/370] a couple more expressions and functions --- unittest/commands/test_variables.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 5a77c75a6c..8c0a24bc0d 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -215,9 +215,10 @@ TEST_F(VariableTest, Expressions) if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal 2"); - command("variable three equal v_one+v_two"); + command("variable three equal v_one+v_two"); + command("variable four equal PI"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 3); + ASSERT_EQ(variable->nvar, 4); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); @@ -226,6 +227,8 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),2.0); ivar = variable->find("three"); ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),3.0); + ivar = variable->find("four"); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),MY_PI); } TEST_F(VariableTest, Functions) @@ -234,12 +237,15 @@ TEST_F(VariableTest, Functions) ASSERT_EQ(variable->nvar, 0); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); - command("variable two equal PI"); + command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(variable->nvar, 3); - int ivar = variable->find("three"); + int ivar = variable->find("two"); + ASSERT_GT(variable->compute_equal(ivar),0.99); + ASSERT_LT(variable->compute_equal(ivar),2.01); + ivar = variable->find("three"); ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),0.25*MY_PI); } } // namespace LAMMPS_NS From 346c36e227d152f8bd22d88a83341fdeaaef8eef Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 17:48:47 -0400 Subject: [PATCH 109/370] replace redundant functions to handle constants with (unordered) map --- src/variable.cpp | 60 ++++++++++------------------ src/variable.h | 2 - unittest/commands/test_variables.cpp | 12 +++++- 3 files changed, 32 insertions(+), 42 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 6766a67a9a..eb1deaae15 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include using namespace LAMMPS_NS; @@ -76,6 +77,20 @@ enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE}; #define BIG 1.0e20 +// constants for variable expressions. customize by adding new items. +// if needed (cf. 'version') initialize in Variable class constructor. + +static std::unordered_map constants = { + {"PI", MY_PI }, + {"version", -1 }, + {"yes", 1 }, + {"no", 0 }, + {"on", 1 }, + {"off", 0 }, + {"true", 1 }, + {"false", 0 } +}; + /* ---------------------------------------------------------------------- */ Variable::Variable(LAMMPS *lmp) : Pointers(lmp) @@ -98,6 +113,10 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp) randomequal = nullptr; randomatom = nullptr; + // override initializer since LAMMPS class needs to be instantiated + + constants["version"] = lmp->num_ver; + // customize by assigning a precedence level precedence[DONE] = 0; @@ -2093,8 +2112,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) // constant // ---------------- - } else if (is_constant(word)) { - value1 = constant(word); + } else if (constants.find(word) != constants.end()) { + value1 = constants[word]; if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; @@ -4663,43 +4682,6 @@ void Variable::atom_vector(char *word, Tree **tree, } } -/* ---------------------------------------------------------------------- - check if word matches a constant - return 1 if yes, else 0 - customize by adding a constant: PI, version -------------------------------------------------------------------------- */ - -int Variable::is_constant(char *word) -{ - if (strcmp(word,"PI") == 0) return 1; - if (strcmp(word,"version") == 0) return 1; - if (strcmp(word,"yes") == 0) return 1; - if (strcmp(word,"no") == 0) return 1; - if (strcmp(word,"on") == 0) return 1; - if (strcmp(word,"off") == 0) return 1; - if (strcmp(word,"true") == 0) return 1; - if (strcmp(word,"false") == 0) return 1; - return 0; -} - -/* ---------------------------------------------------------------------- - process a constant in formula - customize by adding a constant: PI, version -------------------------------------------------------------------------- */ - -double Variable::constant(char *word) -{ - if (strcmp(word,"PI") == 0) return MY_PI; - if (strcmp(word,"version") == 0) return lmp->num_ver; - if (strcmp(word,"yes") == 0) return 1.0; - if (strcmp(word,"no") == 0) return 0.0; - if (strcmp(word,"on") == 0) return 1.0; - if (strcmp(word,"off") == 0) return 0.0; - if (strcmp(word,"true") == 0) return 1.0; - if (strcmp(word,"false") == 0) return 0.0; - return 0.0; -} - /* ---------------------------------------------------------------------- parse string for comma-separated args store copy of each arg in args array diff --git a/src/variable.h b/src/variable.h index cb74e71b51..5dc8748936 100644 --- a/src/variable.h +++ b/src/variable.h @@ -122,8 +122,6 @@ class Variable : protected Pointers { Tree **, Tree **, int &, double *, int &); int is_atom_vector(char *); void atom_vector(char *, Tree **, Tree **, int &); - int is_constant(char *); - double constant(char *); int parse_args(char *, char **); void print_var_error(const std::string &, int, const std::string &, int, int global=1); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 8c0a24bc0d..cc20ea2b96 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -211,14 +211,17 @@ TEST_F(VariableTest, AtomicSystem) TEST_F(VariableTest, Expressions) { + atomic_system(); ASSERT_EQ(variable->nvar, 0); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal 2"); command("variable three equal v_one+v_two"); command("variable four equal PI"); + command("variable five equal version"); + command("variable six equal XXX"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 4); + ASSERT_EQ(variable->nvar, 6); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); @@ -229,11 +232,18 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),3.0); ivar = variable->find("four"); ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),MY_PI); + ivar = variable->find("five"); + ASSERT_GE(variable->compute_equal(ivar),20210310); + + TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", + command("print \"${six}\"");); } TEST_F(VariableTest, Functions) { + atomic_system(); file_vars(); + ASSERT_EQ(variable->nvar, 0); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); From 4f46ee30a2dd19fa018fe3c61c6c41018ce6aee4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 18:13:01 -0400 Subject: [PATCH 110/370] avoid crash when functions expecting an argument are used without --- src/variable.cpp | 7 ++++++- src/variable.h | 2 +- unittest/commands/test_variables.cpp | 21 ++++++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index eb1deaae15..9a8236fdb4 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1234,6 +1234,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int i = 0; int expect = ARG; + if (str == nullptr) + print_var_error(FLERR,"Invalid syntax in variable formula",ivar); + while (1) { onechar = str[i]; @@ -4688,9 +4691,11 @@ void Variable::atom_vector(char *word, Tree **tree, max allowed # of args = MAXFUNCARG ------------------------------------------------------------------------- */ -int Variable::parse_args(char *str, char **args) +int Variable::parse_args(const std::string &str, char **args) { int narg = 0; + args[0] = nullptr; + Tokenizer values(str,","); while (values.has_next() && narg < MAXFUNCARG) { diff --git a/src/variable.h b/src/variable.h index 5dc8748936..50d276bb14 100644 --- a/src/variable.h +++ b/src/variable.h @@ -122,7 +122,7 @@ class Variable : protected Pointers { Tree **, Tree **, int &, double *, int &); int is_atom_vector(char *); void atom_vector(char *, Tree **, Tree **, int &); - int parse_args(char *, char **); + int parse_args(const std::string &, char **); void print_var_error(const std::string &, int, const std::string &, int, int global=1); void print_tree(Tree *, int); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index cc20ea2b96..90a0fe00e7 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -37,8 +37,8 @@ const bool have_openmpi = true; const bool have_openmpi = false; #endif -using LAMMPS_NS::utils::split_words; using LAMMPS_NS::MathConst::MY_PI; +using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::ExitedWithCode; @@ -227,13 +227,13 @@ TEST_F(VariableTest, Expressions) ASSERT_FALSE(variable->equalstyle(ivar)); ivar = variable->find("two"); ASSERT_TRUE(variable->equalstyle(ivar)); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),2.0); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0); ivar = variable->find("three"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),3.0); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 3.0); ivar = variable->find("four"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),MY_PI); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), MY_PI); ivar = variable->find("five"); - ASSERT_GE(variable->compute_equal(ivar),20210310); + ASSERT_GE(variable->compute_equal(ivar), 20210310); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); @@ -249,14 +249,17 @@ TEST_F(VariableTest, Functions) command("variable one index 1"); command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); + command("variable four equal atan2()"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 3); + ASSERT_EQ(variable->nvar, 4); int ivar = variable->find("two"); - ASSERT_GT(variable->compute_equal(ivar),0.99); - ASSERT_LT(variable->compute_equal(ivar),2.01); + ASSERT_GT(variable->compute_equal(ivar), 0.99); + ASSERT_LT(variable->compute_equal(ivar), 2.01); ivar = variable->find("three"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar),0.25*MY_PI); + ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 0.25 * MY_PI); + TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*", + command("print \"${four}\"");); } } // namespace LAMMPS_NS From 180e8168862f0d50cd5a6cbed8e5f1a6c8553708 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Mar 2021 19:55:08 -0400 Subject: [PATCH 111/370] Simplify PythonPackage tests --- unittest/python/test_python_package.cpp | 44 +++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index cba77ee2b0..5974592997 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -40,6 +40,8 @@ protected: LAMMPS *lmp; Info *info; + void command(const std::string &line) { lmp->input->one(line.c_str()); } + void SetUp() override { const char *args[] = {"PythonPackageTest", "-log", "none", "-echo", "screen", "-nocite"}; @@ -51,16 +53,16 @@ protected: ASSERT_NE(lmp, nullptr); info = new Info(lmp); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("region box block -4 4 -4 4 -4 4"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 single 0.0 0.0 0.0 units box"); - lmp->input->one("create_atoms 1 single 1.9 -1.9 1.9999 units box"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("pair_coeff * *"); - lmp->input->one("mass * 1.0"); - lmp->input->one("variable input_dir index " + INPUT_FOLDER); + command("units real"); + command("dimension 3"); + command("region box block -4 4 -4 4 -4 4"); + command("create_box 1 box"); + command("create_atoms 1 single 0.0 0.0 0.0 units box"); + command("create_atoms 1 single 1.9 -1.9 1.9999 units box"); + command("pair_style zero 2.0"); + command("pair_coeff * *"); + command("mass * 1.0"); + command("variable input_dir index " + INPUT_FOLDER); if (!verbose) ::testing::internal::GetCapturedStdout(); } @@ -78,31 +80,31 @@ TEST_F(PythonPackageTest, python_invoke) if (!info->has_style("command", "python")) GTEST_SKIP(); // execute python function from file if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("python printnum file ${input_dir}/func.py"); + command("python printnum file ${input_dir}/func.py"); if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - lmp->input->one("python printnum invoke"); + command("python printnum invoke"); std::string output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex("python.*2.25.*")); // execute another python function from same file if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("python printtxt exists"); + command("python printtxt exists"); if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - lmp->input->one("python printtxt invoke"); + command("python printtxt invoke"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex("python.*sometext.*")); // execute python function that uses the LAMMPS python module if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable idx equal 2.25"); - lmp->input->one("python getidxvar input 1 SELF format p exists"); + command("variable idx equal 2.25"); + command("python getidxvar input 1 SELF format p exists"); if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - lmp->input->one("python getidxvar invoke"); + command("python getidxvar invoke"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex("python.*2.25.*")); @@ -112,12 +114,12 @@ TEST_F(PythonPackageTest, python_variable) { if (!info->has_style("command", "python")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable sq python square"); - lmp->input->one("variable val index 1.5"); - lmp->input->one("python square input 1 v_val return v_sq format ff file ${input_dir}/func.py"); + command("variable sq python square"); + command("variable val index 1.5"); + command("python square input 1 v_val return v_sq format ff file ${input_dir}/func.py"); if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - lmp->input->one("print \"${sq}\""); + command("print \"${sq}\""); std::string output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex("print.*2.25.*")); From 6b24006d43f71f5368d3feedd66e7f48e29de9f1 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Mar 2021 19:56:18 -0400 Subject: [PATCH 112/370] Use Info::has_package to check for PYTHON support --- unittest/python/test_python_package.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index 5974592997..110ea24dbc 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -77,7 +77,7 @@ protected: TEST_F(PythonPackageTest, python_invoke) { - if (!info->has_style("command", "python")) GTEST_SKIP(); + if (!info->has_package("PYTHON")) GTEST_SKIP(); // execute python function from file if (!verbose) ::testing::internal::CaptureStdout(); command("python printnum file ${input_dir}/func.py"); @@ -112,7 +112,7 @@ TEST_F(PythonPackageTest, python_invoke) TEST_F(PythonPackageTest, python_variable) { - if (!info->has_style("command", "python")) GTEST_SKIP(); + if (!info->has_package("PYTHON")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); command("variable sq python square"); command("variable val index 1.5"); From 359a369573121f9101c0651384a9efd835ffba39 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Mar 2021 19:57:45 -0400 Subject: [PATCH 113/370] Ensure that global Py_UnbufferedStdioFlag is set when PYTHONUNBUFFERED=1 --- src/PYTHON/python_impl.cpp | 10 ++++++++++ unittest/python/CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index d1f602a1ea..1f45ca6635 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -55,6 +55,16 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) nfunc = 0; pfuncs = nullptr; + + // check for PYTHONUNBUFFERED environment variable + const char * PYTHONUNBUFFERED = getenv("PYTHONUNBUFFERED"); + + if (PYTHONUNBUFFERED != nullptr && strcmp(PYTHONUNBUFFERED, "1") == 0) { + // Python Global configuration variable + // Force the stdout and stderr streams to be unbuffered. + Py_UnbufferedStdioFlag = 1; + } + // one-time initialization of Python interpreter // pyMain stores pointer to main module external_interpreter = Py_IsInitialized(); diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index d508602c93..d1db17c941 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -8,7 +8,7 @@ add_executable(test_python_package test_python_package.cpp) target_link_libraries(test_python_package PRIVATE lammps GTest::GMock GTest::GTest) target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER}) add_test(NAME PythonPackage COMMAND test_python_package WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -set_tests_properties(PythonPackage PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}") +set_tests_properties(PythonPackage PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH};PYTHONUNBUFFERED=1") # we must have shared libraries enabled for testing the python module if(NOT BUILD_SHARED_LIBS) From 23c8d8ccfb9ec206e7acf6035c3adcd0919929b6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Mar 2021 20:13:39 -0400 Subject: [PATCH 114/370] Use HasSubstr since output order is dependent on buffering --- unittest/python/test_python_package.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index 110ea24dbc..723271c589 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -34,6 +34,7 @@ using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::MatchesRegex; using ::testing::StrEq; +using ::testing::HasSubstr; class PythonPackageTest : public ::testing::Test { protected: @@ -86,7 +87,7 @@ TEST_F(PythonPackageTest, python_invoke) command("python printnum invoke"); std::string output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; - ASSERT_THAT(output, MatchesRegex("python.*2.25.*")); + ASSERT_THAT(output, HasSubstr("2.25\n")); // execute another python function from same file if (!verbose) ::testing::internal::CaptureStdout(); @@ -96,7 +97,7 @@ TEST_F(PythonPackageTest, python_invoke) command("python printtxt invoke"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; - ASSERT_THAT(output, MatchesRegex("python.*sometext.*")); + ASSERT_THAT(output, HasSubstr("sometext\n")); // execute python function that uses the LAMMPS python module if (!verbose) ::testing::internal::CaptureStdout(); @@ -107,7 +108,7 @@ TEST_F(PythonPackageTest, python_invoke) command("python getidxvar invoke"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; - ASSERT_THAT(output, MatchesRegex("python.*2.25.*")); + ASSERT_THAT(output, HasSubstr("2.25\n")); } TEST_F(PythonPackageTest, python_variable) From 85d1257222797041e7186580d91c931889bc7f3c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 21:41:50 -0400 Subject: [PATCH 115/370] move redundant enumerator to Variable class definition in variable.h --- src/info.cpp | 11 +++++------ src/variable.cpp | 4 +--- src/variable.h | 4 ++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/info.cpp b/src/info.cpp index 98ad5a3097..948073bb10 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -64,9 +64,6 @@ #endif namespace LAMMPS_NS { -// same as in variable.cpp -enum {INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV, - SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL}; enum {COMPUTES=1<<0, DUMPS=1<<1, @@ -106,9 +103,11 @@ static const int STYLES = ATOM_STYLES | INTEGRATE_STYLES | MINIMIZE_STYLES using namespace LAMMPS_NS; +// must match enumerator in variable.h static const char *varstyles[] = { "index", "loop", "world", "universe", "uloop", "string", "getenv", - "file", "atomfile", "format", "equal", "atom", "vector", "python", "internal", "(unknown)"}; + "file", "atomfile", "format", "equal", "atom", "vector", "python", + "internal", "(unknown)"}; static const char *mapstyles[] = { "none", "array", "hash", "yes" }; @@ -649,11 +648,11 @@ void Info::command(int narg, char **arg) fmt::print(out,"Variable[{:3d}]: {:16} style = {:16} def =", i,std::string(names[i])+',', std::string(varstyles[style[i]])+','); - if (style[i] == INTERNAL) { + if (style[i] == Variable::INTERNAL) { fmt::print(out,"{:.8}\n",input->variable->dvalue[i]); continue; } - if ((style[i] != LOOP) && (style[i] != ULOOP)) + if ((style[i] != Variable::LOOP) && (style[i] != Variable::ULOOP)) ndata = input->variable->num[i]; for (int j=0; j < ndata; ++j) if (data[i][j]) fmt::print(out," {}",data[i][j]); diff --git a/src/variable.cpp b/src/variable.cpp index 9a8236fdb4..4646bf98b2 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -54,8 +54,6 @@ using namespace MathConst; #define MYROUND(a) (( a-floor(a) ) >= .5) ? ceil(a) : floor(a) -enum{INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV, - SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL}; enum{ARG,OP}; // customize by adding a function @@ -5023,7 +5021,7 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : id_fix = nullptr; buffer = nullptr; - if (style == ATOMFILE) { + if (style == Variable::ATOMFILE) { if (atom->map_style == Atom::MAP_NONE) error->all(FLERR,"Cannot use atomfile-style " "variable unless an atom map exists"); diff --git a/src/variable.h b/src/variable.h index 50d276bb14..e311380971 100644 --- a/src/variable.h +++ b/src/variable.h @@ -53,6 +53,10 @@ class Variable : protected Pointers { int nvar; // # of defined variables char **names; // name of each variable + // must match "varstyles" array in info.cpp + enum{INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV, + SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL}; + private: int me; int maxvar; // max # of variables following lists can hold From 67f1f12c20134b6db3ea1bf10d6aa45aa61a42d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Mar 2021 21:42:45 -0400 Subject: [PATCH 116/370] more tests for expressions --- src/variable.cpp | 15 ++++----- src/variable.h | 2 +- unittest/commands/test_variables.cpp | 46 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 4646bf98b2..76a4b84f89 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -534,12 +534,10 @@ void Variable::set(int narg, char **arg) if (replaceflag) return; + if (!utils::is_id(arg[0])) + error->all(FLERR,fmt::format("Variable name '{}' must have only alphanu" + "meric characters or underscores",arg[0])); names[nvar] = utils::strdup(arg[0]); - for (auto c : std::string(arg[0])) - if (!isalnum(c) && (c != '_')) - error->all(FLERR,fmt::format("Variable name '{}' must have only " - "alphanumeric characters or underscores", - names[nvar])); nvar++; } @@ -983,9 +981,12 @@ double Variable::compute_equal(int ivar) don't need to flag eval_in_progress since is an immediate variable ------------------------------------------------------------------------- */ -double Variable::compute_equal(char *str) +double Variable::compute_equal(const std::string &str) { - return evaluate(str,nullptr,-1); + char *ptr = utils::strdup(str); + double val = evaluate(ptr,nullptr,-1); + delete[] ptr; + return val; } /* ---------------------------------------------------------------------- diff --git a/src/variable.h b/src/variable.h index e311380971..a43e7f3ad7 100644 --- a/src/variable.h +++ b/src/variable.h @@ -41,7 +41,7 @@ class Variable : protected Pointers { char *retrieve(const char *); double compute_equal(int); - double compute_equal(char *); + double compute_equal(const std::string &); void compute_atom(int, int, double *, int, int); int compute_vector(int, double **); void internal_set(int, double); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 90a0fe00e7..9f8d08fa31 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -166,13 +166,15 @@ TEST_F(VariableTest, CreateDelete) command("variable eight getenv PWD"); command("variable eight getenv HOME"); command("variable nine file test_variable.file"); + command("variable ten internal 1.0"); + command("variable ten internal 10.0"); command("variable dummy index 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 12); + ASSERT_EQ(variable->nvar, 13); if (!verbose) ::testing::internal::CaptureStdout(); command("variable dummy delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 11); + ASSERT_EQ(variable->nvar, 12); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index");); @@ -183,8 +185,10 @@ TEST_F(VariableTest, CreateDelete) command("variable two getenv xxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable one equal 2");); + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable one internal 2");); TEST_FAILURE(".*ERROR: Cannot use atomfile-style variable unless an atom map exists.*", - command("variable ten atomfile test_variable.atomfile");); + command("variable eleven atomfile test_variable.atomfile");); TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", command("variable nine1 file test_variable.xxx");); } @@ -220,20 +224,42 @@ TEST_F(VariableTest, Expressions) command("variable four equal PI"); command("variable five equal version"); command("variable six equal XXX"); + command("variable seven equal -v_one"); + command("variable eight equal v_three-0.5"); + command("variable nine equal v_two*(v_one+v_three)"); + command("variable ten equal (1.0/v_two)^2"); + command("variable eleven equal v_three%2"); + command("variable twelve equal 1==2"); + command("variable ten3 equal 1!=v_two"); + command("variable ten4 equal 1<2"); + command("variable ten5 equal 2>1"); + command("variable ten6 equal (1<=v_one)&&(v_ten>=0.2)"); + command("variable ten7 equal !(1nvar, 6); + ASSERT_EQ(variable->nvar, 18); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); ivar = variable->find("two"); ASSERT_TRUE(variable->equalstyle(ivar)); ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0); - ivar = variable->find("three"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 3.0); - ivar = variable->find("four"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), MY_PI); - ivar = variable->find("five"); - ASSERT_GE(variable->compute_equal(ivar), 20210310); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0); + ASSERT_FLOAT_EQ(variable->compute_equal("v_four"), MY_PI); + ASSERT_GE(variable->compute_equal("v_five"), 20210310); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_nine"), 8); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten"), 0.25); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_eleven"), 1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_twelve"), 0); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten3"), 1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten4"), 1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten5"), 1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten6"), 1); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten7"), 0); + EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); From b6a030532d4f1259279562c3df71456fed11edc4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 10:33:00 -0400 Subject: [PATCH 117/370] add tests for boolean evaluation in "if" command --- unittest/commands/test_variables.cpp | 71 +++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 9f8d08fa31..5a1d249bd5 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -248,18 +248,18 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0); ASSERT_FLOAT_EQ(variable->compute_equal("v_four"), MY_PI); ASSERT_GE(variable->compute_equal("v_five"), 20210310); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_nine"), 8); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten"), 0.25); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_eleven"), 1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_twelve"), 0); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten3"), 1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten4"), 1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten5"), 1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten6"), 1); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten7"), 0); - EXPECT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_nine"), 8); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten"), 0.25); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_eleven"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_twelve"), 0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten3"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten4"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten5"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten6"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten7"), 0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); @@ -287,6 +287,53 @@ TEST_F(VariableTest, Functions) TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*", command("print \"${four}\"");); } + +TEST_F(VariableTest, IfCommand) +{ + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable one index 1"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + ::testing::internal::CaptureStdout(); + command("if 1>0 then 'print \".*bingo!\"'"); + auto text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if (1>=0) then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if (-1.0e-1<0.0E+0) then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if () then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if (1)( then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if (1)1 then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if (v_one==1.0)&&(2>=1) then 'print \"bingo!\"'");); +} + } // namespace LAMMPS_NS int main(int argc, char **argv) From 8790ecc141cfe52f01d3ec77bcf687bb3808c9da Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 11:18:21 -0400 Subject: [PATCH 118/370] Refactor existing tests --- unittest/python/test_python_package.cpp | 130 ++++++++++++++---------- 1 file changed, 76 insertions(+), 54 deletions(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index 723271c589..137278a9d2 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -20,6 +20,7 @@ #include #include #include +#include // location of '*.py' files required by tests #define STRINGIFY(val) XSTR(val) @@ -43,86 +44,107 @@ protected: void command(const std::string &line) { lmp->input->one(line.c_str()); } + void HIDE_OUTPUT(std::function f) { + if (!verbose) ::testing::internal::CaptureStdout(); + f(); + if (!verbose) ::testing::internal::GetCapturedStdout(); + } + + std::string CAPTURE_OUTPUT(std::function f) { + ::testing::internal::CaptureStdout(); + f(); + auto output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + return output; + } + void SetUp() override { const char *args[] = {"PythonPackageTest", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + HIDE_OUTPUT([&] { + lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + }); ASSERT_NE(lmp, nullptr); info = new Info(lmp); - if (!verbose) ::testing::internal::CaptureStdout(); - command("units real"); - command("dimension 3"); - command("region box block -4 4 -4 4 -4 4"); - command("create_box 1 box"); - command("create_atoms 1 single 0.0 0.0 0.0 units box"); - command("create_atoms 1 single 1.9 -1.9 1.9999 units box"); - command("pair_style zero 2.0"); - command("pair_coeff * *"); - command("mass * 1.0"); - command("variable input_dir index " + INPUT_FOLDER); - if (!verbose) ::testing::internal::GetCapturedStdout(); + if (!info->has_package("PYTHON")) GTEST_SKIP(); + HIDE_OUTPUT([&] { + command("units real"); + command("dimension 3"); + command("region box block -4 4 -4 4 -4 4"); + command("create_box 1 box"); + command("create_atoms 1 single 0.0 0.0 0.0 units box"); + command("create_atoms 1 single 1.9 -1.9 1.9999 units box"); + command("pair_style zero 2.0"); + command("pair_coeff * *"); + command("mass * 1.0"); + command("variable input_dir index " + INPUT_FOLDER); + }); } void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete info; - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + HIDE_OUTPUT([&] { + delete info; + delete lmp; + info = nullptr; + lmp = nullptr; + }); } }; -TEST_F(PythonPackageTest, python_invoke) +TEST_F(PythonPackageTest, InvokeFunctionFromFile) { - if (!info->has_package("PYTHON")) GTEST_SKIP(); // execute python function from file - if (!verbose) ::testing::internal::CaptureStdout(); - command("python printnum file ${input_dir}/func.py"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - ::testing::internal::CaptureStdout(); - command("python printnum invoke"); - std::string output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + HIDE_OUTPUT([&] { + command("python printnum file ${input_dir}/func.py"); + }); + + auto output = CAPTURE_OUTPUT([&]() { + command("python printnum invoke"); + }); ASSERT_THAT(output, HasSubstr("2.25\n")); +} +TEST_F(PythonPackageTest, InvokeOtherFunctionFromFile) +{ // execute another python function from same file - if (!verbose) ::testing::internal::CaptureStdout(); - command("python printtxt exists"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - ::testing::internal::CaptureStdout(); - command("python printtxt invoke"); - output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; - ASSERT_THAT(output, HasSubstr("sometext\n")); + HIDE_OUTPUT([&] { + command("python printnum file ${input_dir}/func.py"); + command("python printtxt exists"); + }); + auto output = CAPTURE_OUTPUT([&] { + command("python printtxt invoke"); + }); + ASSERT_THAT(output, HasSubstr("sometext\n")); +} + +TEST_F(PythonPackageTest, InvokeFunctionThatUsesLAMMPSModule) +{ // execute python function that uses the LAMMPS python module - if (!verbose) ::testing::internal::CaptureStdout(); - command("variable idx equal 2.25"); - command("python getidxvar input 1 SELF format p exists"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - ::testing::internal::CaptureStdout(); - command("python getidxvar invoke"); - output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + HIDE_OUTPUT([&] { + command("python printnum file ${input_dir}/func.py"); + command("variable idx equal 2.25"); + command("python getidxvar input 1 SELF format p exists"); + }); + auto output = CAPTURE_OUTPUT([&] { + command("python getidxvar invoke"); + }); ASSERT_THAT(output, HasSubstr("2.25\n")); } TEST_F(PythonPackageTest, python_variable) { - if (!info->has_package("PYTHON")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); - command("variable sq python square"); - command("variable val index 1.5"); - command("python square input 1 v_val return v_sq format ff file ${input_dir}/func.py"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - ::testing::internal::CaptureStdout(); - command("print \"${sq}\""); - std::string output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + HIDE_OUTPUT([&] { + command("variable sq python square"); + command("variable val index 1.5"); + command("python square input 1 v_val return v_sq format ff file ${input_dir}/func.py"); + }); + std::string output = CAPTURE_OUTPUT([&] { + command("print \"${sq}\""); + }); ASSERT_THAT(output, MatchesRegex("print.*2.25.*")); } From 487c55edf0d4a5e2811a430d8ac7429d1e63ef92 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 11:24:55 -0400 Subject: [PATCH 119/370] simplify and apply clang-format --- unittest/c-library/test_library_mpi.cpp | 2 +- unittest/commands/test_groups.cpp | 2 +- unittest/commands/test_kim_commands.cpp | 612 ++++++++---------- unittest/commands/test_lattice_region.cpp | 259 ++++---- unittest/commands/test_reset_ids.cpp | 132 ++-- unittest/commands/test_simple_commands.cpp | 126 ++-- unittest/commands/test_variables.cpp | 10 +- unittest/force-styles/test_angle_style.cpp | 4 +- unittest/force-styles/test_bond_style.cpp | 4 +- unittest/force-styles/test_config_reader.cpp | 14 +- unittest/force-styles/test_dihedral_style.cpp | 4 +- unittest/force-styles/test_improper_style.cpp | 4 +- unittest/force-styles/test_pair_style.cpp | 9 +- unittest/formats/test_atom_styles.cpp | 5 +- unittest/formats/test_file_operations.cpp | 8 +- unittest/formats/test_image_flags.cpp | 235 +++---- unittest/formats/test_molecule_file.cpp | 21 +- unittest/formats/test_pair_unit_convert.cpp | 500 +++++++------- .../formats/test_potential_file_reader.cpp | 34 +- unittest/utils/test_tokenizer.cpp | 6 +- unittest/utils/test_utils.cpp | 8 +- 21 files changed, 983 insertions(+), 1016 deletions(-) diff --git a/unittest/c-library/test_library_mpi.cpp b/unittest/c-library/test_library_mpi.cpp index 7502da767a..6fdec7b7e4 100644 --- a/unittest/c-library/test_library_mpi.cpp +++ b/unittest/c-library/test_library_mpi.cpp @@ -191,7 +191,7 @@ TEST(MPI, multi_partition) EXPECT_EQ(lammps_extract_setting(lmp, "world_rank"), 0); char *part_id = (char *)lammps_extract_variable(lmp, "partition", nullptr); - ASSERT_THAT(part_id, StrEq(std::to_string(me+1))); + ASSERT_THAT(part_id, StrEq(std::to_string(me + 1))); lammps_close(lmp); }; diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 7fa7ee721f..3ae1722f4d 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -73,7 +73,7 @@ protected: if (!verbose) ::testing::internal::CaptureStdout(); lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); if (!verbose) ::testing::internal::GetCapturedStdout(); - group = lmp->group; + group = lmp->group; domain = lmp->domain; } diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 311ce6acf1..2d044b86eb 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -59,6 +59,7 @@ using ::testing::StrEq; class KimCommandsTest : public ::testing::Test { protected: LAMMPS *lmp; + Variable *variable; void SetUp() override { @@ -68,6 +69,7 @@ protected: if (!verbose) ::testing::internal::CaptureStdout(); lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); if (!verbose) ::testing::internal::GetCapturedStdout(); + variable = lmp->input->variable; } void TearDown() override @@ -76,53 +78,45 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(KimCommandsTest, kim) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal kim command.*", - lmp->input->one("kim");); - TEST_FAILURE(".*ERROR: Unknown kim subcommand.*", - lmp->input->one("kim unknown");); - TEST_FAILURE(".*kim_init.*has been renamed to.*", - lmp->input->one("kim_init");); - TEST_FAILURE(".*kim_interactions.*has been renamed to.*", - lmp->input->one("kim_interactions");); - TEST_FAILURE(".*kim_param.*has been renamed to.*", - lmp->input->one("kim_param");); - TEST_FAILURE(".*kim_property.*has been renamed to.*", - lmp->input->one("kim_property");); - TEST_FAILURE(".*kim_query.*has been renamed to.*", - lmp->input->one("kim_query");); + TEST_FAILURE(".*ERROR: Illegal kim command.*", command("kim");); + TEST_FAILURE(".*ERROR: Unknown kim subcommand.*", command("kim unknown");); + TEST_FAILURE(".*kim_init.*has been renamed to.*", command("kim_init");); + TEST_FAILURE(".*kim_interactions.*has been renamed to.*", command("kim_interactions");); + TEST_FAILURE(".*kim_param.*has been renamed to.*", command("kim_param");); + TEST_FAILURE(".*kim_property.*has been renamed to.*", command("kim_property");); + TEST_FAILURE(".*kim_query.*has been renamed to.*", command("kim_query");); } TEST_F(KimCommandsTest, kim_init) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); + TEST_FAILURE(".*ERROR: Illegal 'kim init' command.*", command("kim init");); TEST_FAILURE(".*ERROR: Illegal 'kim init' command.*", - lmp->input->one("kim init");); - TEST_FAILURE(".*ERROR: Illegal 'kim init' command.*", - lmp->input->one("kim init LennardJones_Ar real si");); + command("kim init LennardJones_Ar real si");); TEST_FAILURE(".*ERROR: LAMMPS unit_style lj not supported by KIM models.*", - lmp->input->one("kim init LennardJones_Ar lj");); + command("kim init LennardJones_Ar lj");); TEST_FAILURE(".*ERROR: LAMMPS unit_style micro not supported by KIM models.*", - lmp->input->one("kim init LennardJones_Ar micro");); + command("kim init LennardJones_Ar micro");); TEST_FAILURE(".*ERROR: LAMMPS unit_style nano not supported by KIM models.*", - lmp->input->one("kim init LennardJones_Ar nano");); - TEST_FAILURE(".*ERROR: Unknown unit_style.*", - lmp->input->one("kim init LennardJones_Ar new_style");); - TEST_FAILURE(".*ERROR: KIM Model name not found.*", - lmp->input->one("kim init Unknown_Model real");); + command("kim init LennardJones_Ar nano");); + TEST_FAILURE(".*ERROR: Unknown unit_style.*", command("kim init LennardJones_Ar new_style");); + TEST_FAILURE(".*ERROR: KIM Model name not found.*", command("kim init Unknown_Model real");); TEST_FAILURE(".*ERROR: Incompatible units for KIM Simulator Model, required units = metal.*", - lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu real");); + command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu real");); // TEST_FAILURE(".*ERROR: KIM Model does not support the requested unit system.*", - // lmp->input->one("kim init ex_model_Ar_P_Morse real");); + // command("kim init ex_model_Ar_P_Morse real");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim init LennardJones_Ar real"); + command("kim init LennardJones_Ar real"); if (!verbose) ::testing::internal::GetCapturedStdout(); int ifix = lmp->modify->find_fix("KIM_MODEL_STORE"); @@ -133,124 +127,122 @@ TEST_F(KimCommandsTest, kim_interactions) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", - lmp->input->one("kim interactions");); + TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", command("kim interactions");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim init LennardJones_Ar real"); + command("kim init LennardJones_Ar real"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Must use 'kim interactions' command " "after simulation box is defined.*", - lmp->input->one("kim interactions Ar");); + command("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim init LennardJones_Ar real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("kim init LennardJones_Ar real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", - lmp->input->one("kim interactions Ar Ar");); + command("kim interactions Ar Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 20 0 20 0 20"); - lmp->input->one("create_box 4 box"); - lmp->input->one("create_atoms 4 box"); + command("clear"); + command("lattice fcc 4.4300"); + command("region box block 0 20 0 20 0 20"); + command("create_box 4 box"); + command("create_atoms 4 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", - lmp->input->one("kim interactions Ar Ar");); + command("kim interactions Ar Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("clear"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim interactions'.*", - lmp->input->one("kim interactions Ar");); + command("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones_Ar real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("clear"); + command("kim init LennardJones_Ar real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: fixed_types cannot be used with a KIM Portable Model.*", - lmp->input->one("kim interactions fixed_types");); + command("kim interactions fixed_types");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("pair_style kim LennardJones_Ar"); - lmp->input->one("region box block 0 1 0 1 0 1"); - lmp->input->one("create_box 4 box"); - lmp->input->one("pair_coeff * * Ar Ar Ar Ar"); + command("clear"); + command("units real"); + command("pair_style kim LennardJones_Ar"); + command("region box block 0 1 0 1 0 1"); + command("create_box 4 box"); + command("pair_coeff * * Ar Ar Ar Ar"); if (!verbose) ::testing::internal::GetCapturedStdout(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); - lmp->input->one("lattice fcc 4.920"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("clear"); + command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + command("lattice fcc 4.920"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Species 'Ar' is not supported by this KIM Simulator Model.*", - lmp->input->one("kim interactions Ar");); + command("kim interactions Ar");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); - lmp->input->one("lattice fcc 4.08"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim interactions Au"); + command("clear"); + command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + command("lattice fcc 4.08"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("kim interactions Au"); if (!verbose) ::testing::internal::GetCapturedStdout(); // ASSERT_EQ(lmp->output->var_kim_periodic, 1); // TEST_FAILURE(".*ERROR: Incompatible units for KIM Simulator Model.*", - // lmp->input->one("kim interactions Au");); - + // command("kim interactions Au");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones_Ar real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim interactions Ar"); - lmp->input->one("mass 1 39.95"); + command("clear"); + command("kim init LennardJones_Ar real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("kim interactions Ar"); + command("mass 1 39.95"); if (!verbose) ::testing::internal::GetCapturedStdout(); int ifix = lmp->modify->find_fix("KIM_MODEL_STORE"); ASSERT_GE(ifix, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones_Ar real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim interactions Ar"); - lmp->input->one("mass 1 39.95"); - lmp->input->one("run 1"); - lmp->input->one("kim interactions Ar"); - lmp->input->one("run 1"); + command("clear"); + command("kim init LennardJones_Ar real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("kim interactions Ar"); + command("mass 1 39.95"); + command("run 1"); + command("kim interactions Ar"); + command("run 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); } @@ -258,189 +250,188 @@ TEST_F(KimCommandsTest, kim_param) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal 'kim param' command.*", - lmp->input->one("kim param");); + TEST_FAILURE(".*ERROR: Illegal 'kim param' command.*", command("kim param");); TEST_FAILURE(".*ERROR: Incorrect arguments in 'kim param' command.\n" "'kim param get/set' is mandatory.*", - lmp->input->one("kim param unknown shift 1 shift");); + command("kim param unknown shift 1 shift");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); + command("clear"); + command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: 'kim param' can only be used with a KIM Portable Model.*", - lmp->input->one("kim param get shift 1 shift");); + command("kim param get shift 1 shift");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + command("clear"); + command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal 'kim param get' command.\nTo get the new " "parameter values, pair style must be assigned.\nMust use 'kim" " interactions' or 'pair_style kim' before 'kim param get'.*", - lmp->input->one("kim param get shift 1 shift");); + command("kim param get shift 1 shift");); TEST_FAILURE(".*ERROR: Illegal 'kim param set' command.\nTo set the new " "parameter values, pair style must be assigned.\nMust use 'kim" " interactions' or 'pair_style kim' before 'kim param set'.*", - lmp->input->one("kim param set shift 1 2");); + command("kim param set shift 1 2");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); - lmp->input->one("kim interactions Ar"); - lmp->input->one("mass 1 39.95"); + command("clear"); + command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("kim interactions Ar"); + command("mass 1 39.95"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Illegal index '0' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim param get shift 0 shift");); + command("kim param get shift 0 shift");); TEST_FAILURE(".*ERROR: Illegal index '2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim param get shift 2 shift");); + command("kim param get shift 2 shift");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1.' in index_range.*", - lmp->input->one("kim param get shift 1. shift");); + command("kim param get shift 1. shift");); TEST_FAILURE(".*ERROR: Illegal index_range '1-2' for 'shift' " "parameter with the extent of '1'.*", - lmp->input->one("kim param get shift 1:2 shift");); + command("kim param get shift 1:2 shift");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1-2' in index_range.*", - lmp->input->one("kim param get shift 1-2 shift");); + command("kim param get shift 1-2 shift");); TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param " "get' command.\nThe LAMMPS '3' variable names or " "'s1 split' is mandatory.*", - lmp->input->one("kim param get sigmas 1:3 s1 s2");); + command("kim param get sigmas 1:3 s1 s2");); TEST_FAILURE(".*ERROR: Wrong argument in 'kim param get' command.\nThis " "Model does not have the requested 'unknown' parameter.*", - lmp->input->one("kim param get unknown 1 unknown");); + command("kim param get unknown 1 unknown");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get shift 1 shift"); + command("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_FALSE(lmp->input->variable->find("shift") == -1); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "1"); + ASSERT_FALSE(variable->find("shift") == -1); + ASSERT_THAT(variable->retrieve("shift"), StrEq("1")); TEST_FAILURE(".*ERROR: Illegal index '2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim param set shift 2 2");); + command("kim param set shift 2 2");); TEST_FAILURE(".*ERROR: Illegal index_range.\nExpected integer " "parameter\\(s\\) instead of '1.' in index_range.*", - lmp->input->one("kim param set shift 1. shift");); + command("kim param set shift 1. shift");); TEST_FAILURE(".*ERROR: Illegal index_range '1-2' for " "'shift' parameter with the extent of '1'.*", - lmp->input->one("kim param set shift 1:2 2");); + command("kim param set shift 1:2 2");); TEST_FAILURE(".*ERROR: Wrong number of variable values for pair coefficients.*", - lmp->input->one("kim param set sigmas 1:3 0.5523570 0.4989030");); + command("kim param set sigmas 1:3 0.5523570 0.4989030");); TEST_FAILURE(".*ERROR: Wrong argument for pair coefficients.\nThis " "Model does not have the requested '0.4989030' parameter.*", - lmp->input->one("kim param set sigmas 1:1 0.5523570 0.4989030");); + command("kim param set sigmas 1:1 0.5523570 0.4989030");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable new_shift equal 2"); - lmp->input->one("kim param set shift 1 ${new_shift}"); - lmp->input->one("kim param get shift 1 shift"); + command("variable new_shift equal 2"); + command("kim param set shift 1 ${new_shift}"); + command("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "2"); + ASSERT_THAT(variable->retrieve("shift"), StrEq("2")); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 list");); + command("kim param get cutoffs 1:3 list");); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 list");); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 list");); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 split");); + command("kim param get cutoffs 1:3 split");); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 split");); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 split");); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 explicit");); + command("kim param get cutoffs 1:3 explicit");); TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 explicit");); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 explicit");); TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param get' " "command.\nThe LAMMPS '3' variable names or 'cutoffs " "split/list' is mandatory.*", - lmp->input->one("kim param get cutoffs 1:3 cutoffs");); + command("kim param get cutoffs 1:3 cutoffs");); TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param get' " "command.\nThe LAMMPS '3' variable names or 'cutoffs_1 " "split' is mandatory.*", - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2");); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3"); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); + ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); + ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3 explicit"); + command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3 explicit"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); + ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); + ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get cutoffs 1:3 cutoffs split"); + command("kim param get cutoffs 1:3 cutoffs split"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_1")) == "2.20943"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_2")) == "2.10252"); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs_3")) == "5.666115"); + ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); + ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); + ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get cutoffs 1:3 cutoffs list"); + command("kim param get cutoffs 1:3 cutoffs list"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.20943 2.10252 5.666115"); + ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.20943 2.10252 5.666115")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param set cutoffs 1 2.21 cutoffs 2 2.11"); - lmp->input->one("kim param get cutoffs 1:2 cutoffs list"); + command("kim param set cutoffs 1 2.21 cutoffs 2 2.11"); + command("kim param get cutoffs 1:2 cutoffs list"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.21 2.11"); + ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.21 2.11")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param set cutoffs 1:3 2.3 2.2 5.7"); - lmp->input->one("kim param get cutoffs 1:3 cutoffs list"); + command("kim param set cutoffs 1:3 2.3 2.2 5.7"); + command("kim param get cutoffs 1:3 cutoffs list"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("cutoffs")) == "2.3 2.2 5.7"); + ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.3 2.2 5.7")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("lattice fcc 4.4300"); - lmp->input->one("region box block 0 10 0 10 0 10"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); - lmp->input->one("mass 1 39.95"); - lmp->input->one("pair_style kim LennardJones612_UniversalShifted__MO_959249795837_003"); - lmp->input->one("pair_coeff * * Ar"); + command("clear"); + command("units real"); + command("lattice fcc 4.4300"); + command("region box block 0 10 0 10 0 10"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("mass 1 39.95"); + command("pair_style kim LennardJones612_UniversalShifted__MO_959249795837_003"); + command("pair_coeff * * Ar"); if (!verbose) ::testing::internal::GetCapturedStdout(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("kim param get shift 1 shift"); + command("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "1"); + ASSERT_THAT(variable->retrieve("shift"), StrEq("1")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable new_shift equal 2"); - lmp->input->one("kim param set shift 1 ${new_shift}"); - lmp->input->one("kim param get shift 1 shift"); + command("variable new_shift equal 2"); + command("kim param set shift 1 ${new_shift}"); + command("kim param get shift 1 shift"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE(std::string(lmp->input->variable->retrieve("shift")) == "2"); + ASSERT_THAT(variable->retrieve("shift"), StrEq("2")); } TEST_F(KimCommandsTest, kim_property) @@ -452,38 +443,36 @@ TEST_F(KimCommandsTest, kim_property) TEST_FAILURE(".*ERROR: Invalid Python version.\n" "The kim-property Python package requires Python " "3 >= 3.6 support.*", - lmp->input->one("kim property");); + command("kim property");); } else { - TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", - lmp->input->one("kim property");); - TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", - lmp->input->one("kim property create");); + TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", command("kim property");); + TEST_FAILURE(".*ERROR: Invalid 'kim property' command.*", command("kim property create");); TEST_FAILURE(".*ERROR: Incorrect arguments in 'kim property' command." "\n'kim property create/destroy/modify/remove/dump' " "is mandatory.*", - lmp->input->one("kim property unknown 1 atomic-mass");); + command("kim property unknown 1 atomic-mass");); } #if defined(KIM_EXTRA_UNITTESTS) TEST_FAILURE(".*ERROR: Invalid 'kim property create' command.*", - lmp->input->one("kim property create 1");); + command("kim property create 1");); TEST_FAILURE(".*ERROR: Invalid 'kim property destroy' command.*", - lmp->input->one("kim property destroy 1 cohesive-potential-energy-cubic-crystal");); + command("kim property destroy 1 cohesive-potential-energy-cubic-crystal");); TEST_FAILURE(".*ERROR: Invalid 'kim property modify' command.*", - lmp->input->one("kim property modify 1 key short-name");); + command("kim property modify 1 key short-name");); TEST_FAILURE(".*ERROR: There is no property instance to modify the content.*", - lmp->input->one("kim property modify 1 key short-name source-value 1 fcc");); + command("kim property modify 1 key short-name source-value 1 fcc");); TEST_FAILURE(".*ERROR: Invalid 'kim property remove' command.*", - lmp->input->one("kim property remove 1 key");); + command("kim property remove 1 key");); TEST_FAILURE(".*ERROR: There is no property instance to remove the content.*", - lmp->input->one("kim property remove 1 key short-name");); + command("kim property remove 1 key short-name");); TEST_FAILURE(".*ERROR: There is no property instance to dump the content.*", - lmp->input->one("kim property dump results.edn");); + command("kim property dump results.edn");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); - lmp->input->one("kim property create 1 cohesive-potential-energy-cubic-crystal"); - lmp->input->one("kim property modify 1 key short-name source-value 1 fcc"); - lmp->input->one("kim property destroy 1"); + command("clear"); + command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); + command("kim property create 1 cohesive-potential-energy-cubic-crystal"); + command("kim property modify 1 key short-name source-value 1 fcc"); + command("kim property destroy 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); #endif } @@ -492,264 +481,233 @@ TEST_F(KimCommandsTest, kim_query) { if (!LAMMPS::is_installed_pkg("KIM")) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal 'kim query' command.*", - lmp->input->one("kim query");); + TEST_FAILURE(".*ERROR: Illegal 'kim query' command.*", command("kim query");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'split' " "must be followed by the name of the query function.*", - lmp->input->one("kim query a0 split");); + command("kim query a0 split");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'list' " "must be followed by the name of the query function.*", - lmp->input->one("kim query a0 list");); + command("kim query a0 list");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe keyword 'index' " "must be followed by the name of the query function.*", - lmp->input->one("kim query a0 index");); + command("kim query a0 index");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " "can not be used after 'split'.*", - lmp->input->one("kim query a0 split list");); + command("kim query a0 split list");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'index' keyword " "can not be used after 'split'.*", - lmp->input->one("kim query a0 split index");); + command("kim query a0 split index");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'split' keyword " "can not be used after 'list'.*", - lmp->input->one("kim query a0 list split");); + command("kim query a0 list split");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'index' keyword " "can not be used after 'list'.*", - lmp->input->one("kim query a0 list index");); + command("kim query a0 list index");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'list' keyword " "can not be used after 'index'.*", - lmp->input->one("kim query a0 index list");); + command("kim query a0 index list");); TEST_FAILURE(".*ERROR: Illegal 'kim query' command.\nThe 'split' keyword " "can not be used after 'index'.*", - lmp->input->one("kim query a0 index split");); + command("kim query a0 index split");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `crystal` " "to 'kim query' is wrong. The query format is the " "keyword=\\[value\\], where value is always an array of one " "or more comma-separated items.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic " - "crystal");); + command("kim query a0 get_lattice_constant_cubic " + "crystal");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" "crystal=fcc` to 'kim query' is wrong. The query format is the " "keyword=\\[value\\], where value is always an array of one " "or more comma-separated items.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic " - "crystal=fcc");); + command("kim query a0 get_lattice_constant_cubic " + "crystal=fcc");); TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" "crystal=\\[fcc` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic " - "crystal=[fcc");); - TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" + command("kim query a0 get_lattice_constant_cubic " + "crystal=[fcc");); + TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `" "crystal=fcc\\]` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one("kim query a0 get_lattice_constant_cubic " - "crystal=fcc]");); + command("kim query a0 get_lattice_constant_cubic " + "crystal=fcc]");); - std::string squery("kim query a0 get_lattice_constant_cubic "); - squery += "crystal=[\"fcc\"] species=\"Al\",\"Ni\" units=[\"angstrom\"]"; + std::string squery = "kim query a0 get_lattice_constant_cubic " + "crystal=[\"fcc\"] species=\"Al\",\"Ni\" units=[\"angstrom\"]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "\"Al\",\"Ni\"` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=Al,Ni units=[angstrom]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=Al,Ni units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "Al,Ni` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=Al,Ni, units=[angstrom]"; + squery = + "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=Al,Ni, units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "Al,Ni,` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=[Al,Ni, units=[angstrom]"; + squery = + "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al,Ni, units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "\\[Al,Ni,` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=Al,Ni], units=[angstrom]"; + squery = + "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=Al,Ni], units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "Al,Ni\\],` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=Al,\"Ni\"], units=[angstrom]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=Al,\"Ni\"], " + "units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "Al,\"Ni\"\\],` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=\"Al\",Ni], units=[angstrom]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=\"Al\",Ni], " + "units=[angstrom]"; TEST_FAILURE(".*ERROR: Illegal query format.\nInput argument of `species=" "\"Al\",Ni\\],` to 'kim query' is wrong. The query format is " "the keyword=\\[value\\], where value is always an array of " "one or more comma-separated items.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic crystal=[\"fcc\"] " - "species=[\"Al\"]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[\"fcc\"] species=[\"Al\"]"; TEST_FAILURE(".*ERROR: Illegal query format.\nMust use 'kim init' before " "'kim query' or must provide the model name after query " "function with the format of 'model=\\[model_name\\]'.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] " - "species=[Al]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[fcc] species=[Al]"; TEST_FAILURE(".*ERROR: Illegal query format.\nMust use 'kim init' before " "'kim query' or must provide the model name after query " "function with the format of 'model=\\[model_name\\]'.*", - lmp->input->one(squery);); + command(squery);); - squery = "kim query a0 get_lattice_constant_cubic crystal=[\"fcc\"] " - "species=[Al]"; + squery = "kim query a0 get_lattice_constant_cubic crystal=[\"fcc\"] species=[Al]"; TEST_FAILURE(".*ERROR: Illegal query format.\nMust use 'kim init' before " "'kim query' or must provide the model name after query " "function with the format of 'model=\\[model_name\\]'.*", - lmp->input->one(squery);); + command(squery);); #if defined(KIM_EXTRA_UNITTESTS) if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - - squery = "kim query latconst_1 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=[Al] units=[angstrom] "; - squery += "model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005]"; - lmp->input->one(squery); + command("clear"); + command("kim query latconst_1 get_lattice_constant_cubic " + "crystal=[fcc] species=[Al] units=[angstrom] " + "model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == - "4.032082033157349")); + ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("4.032082033157349")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); + command("clear"); + command("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); + command("kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] " + "units=[angstrom]"); - squery = "kim query latconst_1 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=[Al] units=[angstrom]"; - lmp->input->one(squery); - - squery = "kim query latconst_2 get_lattice_constant_cubic "; - squery += "crystal=[fcc] species=[Al] units=[angstrom] "; - squery += "model=[LennardJones612_UniversalShifted__MO_959249795837_003]"; - lmp->input->one(squery); + command("kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] " + "units=[angstrom] " + "model=[LennardJones612_UniversalShifted__MO_959249795837_003]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == - "4.032082033157349")); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == - "3.328125931322575")); + ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("4.032082033157349")); + ASSERT_THAT(variable->retrieve("latconst_2"), StrEq("3.328125931322575")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); + command("clear"); + command("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); - squery = "kim query latconst split get_lattice_constant_hexagonal "; - squery += "crystal=[hcp] species=[Zr] units=[angstrom]"; - lmp->input->one(squery); + command("kim query latconst split get_lattice_constant_hexagonal crystal=[hcp] species=[Zr] " + "units=[angstrom]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_1")) == - "3.234055244384789")); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst_2")) == - "5.167650199630013")); + ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("3.234055244384789")); + ASSERT_THAT(variable->retrieve("latconst_2"), StrEq("5.167650199630013")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); + command("clear"); - squery = "kim query latconst index get_lattice_constant_hexagonal "; - squery += "crystal=[hcp] species=[Zr] units=[angstrom] "; - squery += "model=[EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000]"; - lmp->input->one(squery); + command("kim query latconst index get_lattice_constant_hexagonal " + "crystal=[hcp] species=[Zr] units=[angstrom] " + "model=[EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == - "3.234055244384789")); + ASSERT_THAT(variable->retrieve("latconst"), StrEq("3.234055244384789")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable latconst delete"); - lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); + command("variable latconst delete"); + command("clear"); + command("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); - squery = "kim query latconst list get_lattice_constant_hexagonal "; - squery += "crystal=[hcp] species=[Zr] units=[angstrom]"; - lmp->input->one(squery); + command("kim query latconst list get_lattice_constant_hexagonal crystal=[hcp] species=[Zr] " + "units=[angstrom]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("latconst")) == - "3.234055244384789 5.167650199630013")); + ASSERT_THAT(variable->retrieve("latconst"), StrEq("3.234055244384789 5.167650199630013")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); + command("clear"); + command("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); - squery = "kim query alpha get_linear_thermal_expansion_coefficient_cubic "; - squery += "crystal=[fcc] species=[Al] units=[1/K] temperature=[293.15] "; - squery += "temperature_units=[K]"; - lmp->input->one(squery); + command("kim query alpha get_linear_thermal_expansion_coefficient_cubic " + "crystal=[fcc] species=[Al] units=[1/K] temperature=[293.15] " + "temperature_units=[K]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_TRUE((std::string(lmp->input->variable->retrieve("alpha")) == - "1.654960564704273e-05")); + ASSERT_THAT(variable->retrieve("alpha"), StrEq("1.654960564704273e-05")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); + command("clear"); - squery = "kim query model_list list get_available_models "; - squery += "species=[Al]"; - lmp->input->one(squery); + command("kim query model_list list get_available_models species=[Al]"); if (!verbose) ::testing::internal::GetCapturedStdout(); - std::string model_list = lmp->input->variable->retrieve("model_list"); + std::string model_list = variable->retrieve("model_list"); auto n = model_list.find("EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005"); ASSERT_TRUE(n != std::string::npos); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); + command("clear"); - squery = "kim query model_name index get_available_models "; - squery += "species=[Al]"; - lmp->input->one(squery); - lmp->input->one("variable model_name delete"); + command("kim query model_name index get_available_models species=[Al]"); + command("variable model_name delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); + command("clear"); - squery = "kim query model_name index get_available_models "; - squery += "species=[Al] potential_type=[eam,meam]"; - lmp->input->one(squery); - lmp->input->one("variable model_name delete"); + command("kim query model_name index get_available_models " + "species=[Al] potential_type=[eam,meam]"); + command("variable model_name delete"); - squery = "kim query model_name index get_available_models "; - squery += "species=[Al] potential_type=[\"eam\",\"meam\"]"; - lmp->input->one(squery); - lmp->input->one("variable model_name delete"); + command("kim query model_name index get_available_models " + "species=[Al] potential_type=[\"eam\",\"meam\"]"); + command("variable model_name delete"); - squery = "kim query model_name index get_available_models "; - squery += "species=[Al] potential_type=[eam,\"meam\"]"; - lmp->input->one(squery); - lmp->input->one("variable model_name delete"); + command("kim query model_name index get_available_models " + "species=[Al] potential_type=[eam,\"meam\"]"); + command("variable model_name delete"); - squery = "kim query model_name index get_available_models "; - squery += "species=[Al] potential_type=[\"eam\",meam]"; - lmp->input->one(squery); - lmp->input->one("variable model_name delete"); + command("kim query model_name index get_available_models " + "species=[Al] potential_type=[\"eam\",meam]"); + command("variable model_name delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); #endif } diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index b359c90c75..2924c75d9f 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -81,12 +81,14 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(LatticeRegionTest, lattice_none) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice none 2.0"); + command("lattice none 2.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::NONE); @@ -96,14 +98,14 @@ TEST_F(LatticeRegionTest, lattice_none) ASSERT_EQ(lattice->nbasis, 0); ASSERT_EQ(lattice->basis, nullptr); - TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice");); - TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice xxx");); - TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice none 1.0 origin");); - TEST_FAILURE(".*ERROR: Expected floating point.*", lmp->input->one("lattice none xxx");); + TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice");); + TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice xxx");); + TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice none 1.0 origin");); + TEST_FAILURE(".*ERROR: Expected floating point.*", command("lattice none xxx");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units lj"); - lmp->input->one("lattice none 1.0"); + command("units lj"); + command("lattice none 1.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); lattice = lmp->domain->lattice; ASSERT_EQ(lattice->xlattice, 1.0); @@ -114,7 +116,7 @@ TEST_F(LatticeRegionTest, lattice_none) TEST_F(LatticeRegionTest, lattice_sc) { ::testing::internal::CaptureStdout(); - lmp->input->one("lattice sc 1.0 spacing 1.5 2.0 3.0"); + command("lattice sc 1.0 spacing 1.5 2.0 3.0"); auto output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 1.50* 2.0* 3.0*.*")); @@ -125,7 +127,7 @@ TEST_F(LatticeRegionTest, lattice_sc) ASSERT_EQ(lattice->zlattice, 3.0); ::testing::internal::CaptureStdout(); - lmp->input->one("lattice sc 2.0"); + command("lattice sc 2.0"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 2.0* 2.0* 2.0*.*")); @@ -151,25 +153,24 @@ TEST_F(LatticeRegionTest, lattice_sc) ASSERT_EQ(lattice->basis[0][2], 0.0); TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice sc 1.0 origin 1.0 1.0 1.0");); + command("lattice sc 1.0 origin 1.0 1.0 1.0");); + TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice sc 1.0 origin 1.0");); TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice sc 1.0 origin 1.0");); - TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice sc 1.0 origin 0.0 0.0 0.0 xxx");); + command("lattice sc 1.0 origin 0.0 0.0 0.0 xxx");); TEST_FAILURE(".*ERROR: Expected floating point.*", - lmp->input->one("lattice sc 1.0 origin xxx 1.0 1.0");); + command("lattice sc 1.0 origin xxx 1.0 1.0");); TEST_FAILURE(".*ERROR: Lattice orient vectors are not orthogonal.*", - lmp->input->one("lattice sc 1.0 orient x 2 2 0");); + command("lattice sc 1.0 orient x 2 2 0");); TEST_FAILURE(".*ERROR: Lattice orient vectors are not right-handed.*", - lmp->input->one("lattice sc 1.0 orient y 0 -1 0");); + command("lattice sc 1.0 orient y 0 -1 0");); TEST_FAILURE(".*ERROR: Lattice spacings are invalid.*", - lmp->input->one("lattice sc 1.0 spacing 0.0 1.0 1.0");); + command("lattice sc 1.0 spacing 0.0 1.0 1.0");); TEST_FAILURE(".*ERROR: Lattice spacings are invalid.*", - lmp->input->one("lattice sc 1.0 spacing 1.0 -0.1 1.0");); + command("lattice sc 1.0 spacing 1.0 -0.1 1.0");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units lj"); - lmp->input->one("lattice sc 2.0"); + command("units lj"); + command("lattice sc 2.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); lattice = lmp->domain->lattice; ASSERT_DOUBLE_EQ(lattice->xlattice, pow(0.5, 1.0 / 3.0)); @@ -177,16 +178,16 @@ TEST_F(LatticeRegionTest, lattice_sc) ASSERT_DOUBLE_EQ(lattice->zlattice, pow(0.5, 1.0 / 3.0)); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice sc 1.0");); + command("lattice sc 1.0");); } TEST_F(LatticeRegionTest, lattice_bcc) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0"); + command("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::BCC); @@ -202,16 +203,16 @@ TEST_F(LatticeRegionTest, lattice_bcc) ASSERT_EQ(lattice->basis[1][2], 0.5); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice bcc 1.0");); + command("lattice bcc 1.0");); } TEST_F(LatticeRegionTest, lattice_fcc) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 3.5 origin 0.5 0.5 0.5"); + command("lattice fcc 3.5 origin 0.5 0.5 0.5"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::FCC); @@ -233,23 +234,22 @@ TEST_F(LatticeRegionTest, lattice_fcc) ASSERT_EQ(lattice->basis[3][2], 0.5); TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*", - lmp->input->one("lattice fcc 1.0 basis 0.0 0.0 0.0");); + command("lattice fcc 1.0 basis 0.0 0.0 0.0");); TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*", - lmp->input->one("lattice fcc 1.0 a1 0.0 1.0 0.0");); - TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice fcc 1.0 orient w 1 0 0");); + command("lattice fcc 1.0 a1 0.0 1.0 0.0");); + TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice fcc 1.0 orient w 1 0 0");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice fcc 1.0");); + command("lattice fcc 1.0");); } TEST_F(LatticeRegionTest, lattice_hcp) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice hcp 3.0 orient z 0 0 1"); + command("lattice hcp 3.0 orient z 0 0 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HCP); @@ -280,20 +280,20 @@ TEST_F(LatticeRegionTest, lattice_hcp) ASSERT_DOUBLE_EQ(lattice->a3[2], sqrt(8.0 / 3.0)); TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*", - lmp->input->one("lattice hcp 1.0 a2 0.0 1.0 0.0");); + command("lattice hcp 1.0 a2 0.0 1.0 0.0");); TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*", - lmp->input->one("lattice hcp 1.0 a3 0.0 1.0 0.0");); + command("lattice hcp 1.0 a3 0.0 1.0 0.0");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice hcp 1.0");); + command("lattice hcp 1.0");); } TEST_F(LatticeRegionTest, lattice_diamond) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"); + command("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::DIAMOND); @@ -336,17 +336,17 @@ TEST_F(LatticeRegionTest, lattice_diamond) ASSERT_EQ(lattice->a3[2], 1.0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice diamond 1.0");); + command("lattice diamond 1.0");); } TEST_F(LatticeRegionTest, lattice_sq) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); - lmp->input->one("lattice sq 3.0"); + command("dimension 2"); + command("lattice sq 3.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ); @@ -358,22 +358,21 @@ TEST_F(LatticeRegionTest, lattice_sq) ASSERT_EQ(lattice->basis[0][1], 0.0); ASSERT_EQ(lattice->basis[0][2], 0.0); - TEST_FAILURE( - ".*ERROR: Lattice settings are not compatible with 2d simulation.*", - lmp->input->one("lattice sq 1.0 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");); + TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", + command("lattice sq 1.0 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 3"); + command("dimension 3"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice sq 1.0");); + command("lattice sq 1.0");); } TEST_F(LatticeRegionTest, lattice_sq2) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); - lmp->input->one("lattice sq2 2.0"); + command("dimension 2"); + command("lattice sq2 2.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ2); @@ -389,17 +388,17 @@ TEST_F(LatticeRegionTest, lattice_sq2) ASSERT_EQ(lattice->basis[1][2], 0.0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 3"); + command("dimension 3"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice sq2 1.0");); + command("lattice sq2 1.0");); } TEST_F(LatticeRegionTest, lattice_hex) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); - lmp->input->one("lattice hex 2.0"); + command("dimension 2"); + command("lattice hex 2.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HEX); @@ -424,32 +423,32 @@ TEST_F(LatticeRegionTest, lattice_hex) ASSERT_EQ(lattice->a3[2], 1.0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 3"); + command("dimension 3"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", - lmp->input->one("lattice hex 1.0");); + command("lattice hex 1.0");); } TEST_F(LatticeRegionTest, lattice_custom) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable a equal 4.34"); - lmp->input->one("variable b equal $a*sqrt(3.0)"); - lmp->input->one("variable c equal $a*sqrt(8.0/3.0)"); - lmp->input->one("variable t equal 1.0/3.0"); - lmp->input->one("variable f equal 5.0/6.0"); - lmp->input->one("lattice custom 1.0 " - "a1 $a 0.0 0.0 " - "a2 0.0 $b 0.0 " - "a3 0.0 0.0 $c " - "basis 0.0 0.0 0.0 " - "basis 0.5 0.5 0.0 " - "basis $t 0.0 0.5 " - "basis $f 0.5 0.5 " - "basis 0.0 0.0 0.625 " - "basis 0.5 0.5 0.625 " - "basis $t 0.0 0.125 " - "basis $f 0.5 0.125 "); + command("variable a equal 4.34"); + command("variable b equal $a*sqrt(3.0)"); + command("variable c equal $a*sqrt(8.0/3.0)"); + command("variable t equal 1.0/3.0"); + command("variable f equal 5.0/6.0"); + command("lattice custom 1.0 " + "a1 $a 0.0 0.0 " + "a2 0.0 $b 0.0 " + "a3 0.0 0.0 $c " + "basis 0.0 0.0 0.0 " + "basis 0.5 0.5 0.0 " + "basis $t 0.0 0.5 " + "basis $f 0.5 0.5 " + "basis 0.0 0.0 0.625 " + "basis 0.5 0.5 0.625 " + "basis $t 0.0 0.125 " + "basis $f 0.5 0.125 "); if (!verbose) ::testing::internal::GetCapturedStdout(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::CUSTOM); @@ -492,47 +491,47 @@ TEST_F(LatticeRegionTest, lattice_custom) ASSERT_DOUBLE_EQ(lattice->a3[2], 4.34 * sqrt(8.0 / 3.0)); TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice custom 1.0 basis -0.1 0 0");); + command("lattice custom 1.0 basis -0.1 0 0");); TEST_FAILURE(".*ERROR: Illegal lattice command.*", - lmp->input->one("lattice custom 1.0 basis 0.0 1.0 0");); + command("lattice custom 1.0 basis 0.0 1.0 0");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("dimension 2"); + command("dimension 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: No basis atoms in lattice.*", lmp->input->one("lattice custom 1.0");); + TEST_FAILURE(".*ERROR: No basis atoms in lattice.*", command("lattice custom 1.0");); TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", - lmp->input->one("lattice custom 1.0 origin 0.5 0.5 0.5 basis 0.0 0.0 0.0");); + command("lattice custom 1.0 origin 0.5 0.5 0.5 basis 0.0 0.0 0.0");); TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", - lmp->input->one("lattice custom 1.0 a1 1.0 1.0 1.0 basis 0.0 0.0 0.0");); + command("lattice custom 1.0 a1 1.0 1.0 1.0 basis 0.0 0.0 0.0");); TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", - lmp->input->one("lattice custom 1.0 a2 1.0 1.0 1.0 basis 0.0 0.0 0.0");); + command("lattice custom 1.0 a2 1.0 1.0 1.0 basis 0.0 0.0 0.0");); TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", - lmp->input->one("lattice custom 1.0 a3 1.0 1.0 1.0 basis 0.0 0.0 0.0");); + command("lattice custom 1.0 a3 1.0 1.0 1.0 basis 0.0 0.0 0.0");); } TEST_F(LatticeRegionTest, region_fail) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice none 2.0"); - lmp->input->one("region box block 0 1 0 1 0 1"); + command("lattice none 2.0"); + command("region box block 0 1 0 1 0 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Create_atoms command before simulation box is defined.*", - lmp->input->one("create_atoms 1 box");); + command("create_atoms 1 box");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("create_box 1 box"); + command("create_box 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR: Cannot create atoms with undefined lattice.*", - lmp->input->one("create_atoms 1 box");); + command("create_atoms 1 box");); } TEST_F(LatticeRegionTest, region_block_lattice) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice sc 1.5"); - lmp->input->one("region box block 0 2 0 2 0 2 units lattice"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("lattice sc 1.5"); + command("region box block 0 2 0 2 0 2 units lattice"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); @@ -555,10 +554,10 @@ TEST_F(LatticeRegionTest, region_block_lattice) TEST_F(LatticeRegionTest, region_block_box) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice sc 1.5 origin 0.75 0.75 0.75"); - lmp->input->one("region box block 0 2 0 2 0 2 units box"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("lattice sc 1.5 origin 0.75 0.75 0.75"); + command("region box block 0 2 0 2 0 2 units box"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); @@ -572,11 +571,11 @@ TEST_F(LatticeRegionTest, region_block_box) TEST_F(LatticeRegionTest, region_cone) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region box cone x 1.0 1.0 0.5 2.1 0.0 2.0"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region box"); - lmp->input->one("write_dump all atom init.lammpstrj"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region box cone x 1.0 1.0 0.5 2.1 0.0 2.0"); + command("create_box 1 box"); + command("create_atoms 1 region box"); + command("write_dump all atom init.lammpstrj"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 42); @@ -585,10 +584,10 @@ TEST_F(LatticeRegionTest, region_cone) TEST_F(LatticeRegionTest, region_cylinder) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region box cylinder z 1.0 1.0 2.1 0.0 2.0 "); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region box"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region box cylinder z 1.0 1.0 2.1 0.0 2.0 "); + command("create_box 1 box"); + command("create_atoms 1 region box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 114); @@ -597,10 +596,10 @@ TEST_F(LatticeRegionTest, region_cylinder) TEST_F(LatticeRegionTest, region_prism) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice bcc 2.5 origin 0.75 0.75 0.75"); - lmp->input->one("region box prism 0 2 0 2 0 2 0.5 0.0 0.0"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 box"); + command("lattice bcc 2.5 origin 0.75 0.75 0.75"); + command("region box prism 0 2 0 2 0 2 0.5 0.0 0.0"); + command("create_box 1 box"); + command("create_atoms 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 1); ASSERT_EQ(lmp->atom->natoms, 16); @@ -609,10 +608,10 @@ TEST_F(LatticeRegionTest, region_prism) TEST_F(LatticeRegionTest, region_sphere) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region box sphere 1.0 1.0 1.0 1.1"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region box"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region box sphere 1.0 1.0 1.0 1.1"); + command("create_box 1 box"); + command("create_atoms 1 region box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 14); @@ -621,12 +620,12 @@ TEST_F(LatticeRegionTest, region_sphere) TEST_F(LatticeRegionTest, region_union) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region part1 sphere 2.0 1.0 1.0 1.1"); - lmp->input->one("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); - lmp->input->one("region box union 2 part1 part2"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region box"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region part1 sphere 2.0 1.0 1.0 1.1"); + command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); + command("region box union 2 part1 part2"); + command("create_box 1 box"); + command("create_atoms 1 region box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 67); @@ -635,12 +634,12 @@ TEST_F(LatticeRegionTest, region_union) TEST_F(LatticeRegionTest, region_intersect) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region part1 sphere 2.0 1.0 1.0 1.8"); - lmp->input->one("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); - lmp->input->one("region box intersect 2 part1 part2"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region box"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region part1 sphere 2.0 1.0 1.0 1.8"); + command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); + command("region box intersect 2 part1 part2"); + command("create_box 1 box"); + command("create_atoms 1 region box"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 21); @@ -649,14 +648,14 @@ TEST_F(LatticeRegionTest, region_intersect) TEST_F(LatticeRegionTest, region_plane) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5"); - lmp->input->one("region box block 0.0 2.0 0.0 2.0 0.0 2.0"); - lmp->input->one("region part1 plane 0.5 1.0 0.0 0.75 0.0 0.0"); - lmp->input->one("region part2 plane 1.5 1.0 0.0 0.75 0.0 0.0 side out"); - lmp->input->one("region atoms intersect 2 part1 part2"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 region atoms"); - lmp->input->one("write_dump all atom init.lammpstrj"); + command("lattice fcc 2.5 origin 0.5 0.5 0.5"); + command("region box block 0.0 2.0 0.0 2.0 0.0 2.0"); + command("region part1 plane 0.5 1.0 0.0 0.75 0.0 0.0"); + command("region part2 plane 1.5 1.0 0.0 0.75 0.0 0.0 side out"); + command("region atoms intersect 2 part1 part2"); + command("create_box 1 box"); + command("create_atoms 1 region atoms"); + command("write_dump all atom init.lammpstrj"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 16); diff --git a/unittest/commands/test_reset_ids.cpp b/unittest/commands/test_reset_ids.cpp index 3ea2f26cef..89e09b53a6 100644 --- a/unittest/commands/test_reset_ids.cpp +++ b/unittest/commands/test_reset_ids.cpp @@ -85,6 +85,8 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(ResetIDsTest, MolIDAll) @@ -125,7 +127,7 @@ TEST_F(ResetIDsTest, MolIDAll) // the original data file has two different molecule IDs // for two residues of the same molecule/fragment. if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_mol_ids all"); + command("reset_mol_ids all"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(molid[GETIDX(1)], 1); @@ -167,10 +169,10 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) // delete two water molecules if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("group allwater molecule 3:6"); - lmp->input->one("group twowater molecule 4:6:2"); - lmp->input->one("delete_atoms group twowater compress no bond yes"); - lmp->input->one("reset_mol_ids all"); + command("group allwater molecule 3:6"); + command("group twowater molecule 4:6:2"); + command("delete_atoms group twowater compress no bond yes"); + command("reset_mol_ids all"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -229,7 +231,7 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) ASSERT_GE(GETIDX(26), 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_atom_ids"); + command("reset_atom_ids"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->map_tag_max, 23); @@ -245,9 +247,9 @@ TEST_F(ResetIDsTest, PartialOffset) // delete two water molecules if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("group allwater molecule 3:6"); - lmp->input->one("group nowater subtract all allwater"); - lmp->input->one("reset_mol_ids allwater offset 4"); + command("group allwater molecule 3:6"); + command("group nowater subtract all allwater"); + command("reset_mol_ids allwater offset 4"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->natoms, 29); ASSERT_EQ(lmp->atom->map_tag_max, 29); @@ -283,7 +285,7 @@ TEST_F(ResetIDsTest, PartialOffset) ASSERT_EQ(molid[GETIDX(29)], 8); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_mol_ids nowater offset 0"); + command("reset_mol_ids nowater offset 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(molid[GETIDX(1)], 1); @@ -325,11 +327,11 @@ TEST_F(ResetIDsTest, DeleteAdd) // delete two water molecules if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("group allwater molecule 3:6"); - lmp->input->one("group twowater molecule 4:6:2"); - lmp->input->one("group nowater subtract all allwater"); - lmp->input->one("delete_atoms group twowater compress no bond yes mol yes"); - lmp->input->one("reset_mol_ids allwater"); + command("group allwater molecule 3:6"); + command("group twowater molecule 4:6:2"); + command("group nowater subtract all allwater"); + command("delete_atoms group twowater compress no bond yes mol yes"); + command("reset_mol_ids allwater"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -388,7 +390,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_GE(GETIDX(26), 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_atom_ids sort yes"); + command("reset_atom_ids sort yes"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->map_tag_max, 23); @@ -396,7 +398,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_GE(GETIDX(i), 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_mol_ids nowater offset 1"); + command("reset_mol_ids nowater offset 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(molid[GETIDX(1)], 2); @@ -424,11 +426,11 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(23)], 4); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("create_atoms 1 single 0.0 0.0 0.0"); - lmp->input->one("create_atoms 2 single 1.0 0.0 0.0"); - lmp->input->one("create_atoms 3 single 2.0 0.0 0.0"); - lmp->input->one("create_atoms 4 single 3.0 0.0 0.0"); - lmp->input->one("reset_mol_ids all single yes"); + command("create_atoms 1 single 0.0 0.0 0.0"); + command("create_atoms 2 single 1.0 0.0 0.0"); + command("create_atoms 3 single 2.0 0.0 0.0"); + command("create_atoms 4 single 3.0 0.0 0.0"); + command("reset_mol_ids all single yes"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->natoms, 27); ASSERT_EQ(lmp->atom->map_tag_max, 27); @@ -442,7 +444,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(27)], 7); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_mol_ids all single no"); + command("reset_mol_ids all single no"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(molid[GETIDX(21)], 3); @@ -454,7 +456,7 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(27)], 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_mol_ids all compress no single yes"); + command("reset_mol_ids all compress no single yes"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(molid[GETIDX(21)], 21); @@ -472,20 +474,20 @@ TEST_F(ResetIDsTest, TopologyData) // delete two water molecules if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("group allwater molecule 3:6"); - lmp->input->one("group twowater molecule 4:6:2"); - lmp->input->one("group nowater subtract all allwater"); - lmp->input->one("delete_atoms group twowater compress no bond yes mol yes"); + command("group allwater molecule 3:6"); + command("group twowater molecule 4:6:2"); + command("group nowater subtract all allwater"); + command("delete_atoms group twowater compress no bond yes mol yes"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); - auto num_bond = lmp->atom->num_bond; - auto num_angle = lmp->atom->num_angle; - auto bond_atom = lmp->atom->bond_atom; - auto angle_atom1 = lmp->atom->angle_atom1; - auto angle_atom2 = lmp->atom->angle_atom2; - auto angle_atom3 = lmp->atom->angle_atom3; + auto num_bond = lmp->atom->num_bond; + auto num_angle = lmp->atom->num_angle; + auto bond_atom = lmp->atom->bond_atom; + auto angle_atom1 = lmp->atom->angle_atom1; + auto angle_atom2 = lmp->atom->angle_atom2; + auto angle_atom3 = lmp->atom->angle_atom3; ASSERT_EQ(num_bond[GETIDX(1)], 2); ASSERT_EQ(bond_atom[GETIDX(1)][0], 2); ASSERT_EQ(bond_atom[GETIDX(1)][1], 3); @@ -561,15 +563,15 @@ TEST_F(ResetIDsTest, TopologyData) ASSERT_EQ(angle_atom3[GETIDX(24)][0], 26); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_atom_ids sort yes"); + command("reset_atom_ids sort yes"); if (!verbose) ::testing::internal::GetCapturedStdout(); - num_bond = lmp->atom->num_bond; - num_angle = lmp->atom->num_angle; - bond_atom = lmp->atom->bond_atom; - angle_atom1 = lmp->atom->angle_atom1; - angle_atom2 = lmp->atom->angle_atom2; - angle_atom3 = lmp->atom->angle_atom3; + num_bond = lmp->atom->num_bond; + num_angle = lmp->atom->num_angle; + bond_atom = lmp->atom->bond_atom; + angle_atom1 = lmp->atom->angle_atom1; + angle_atom2 = lmp->atom->angle_atom2; + angle_atom3 = lmp->atom->angle_atom3; ASSERT_EQ(num_bond[GETIDX(1)], 2); ASSERT_EQ(bond_atom[GETIDX(1)][0], 3); ASSERT_EQ(bond_atom[GETIDX(1)][1], 2); @@ -658,26 +660,23 @@ TEST_F(ResetIDsTest, DeathTests) { if (lmp->atom->natoms == 0) GTEST_SKIP(); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", lmp->input->one("reset_mol_ids");); + TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids");); TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all offset 1 1");); + command("reset_mol_ids all offset 1 1");); TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all offset -2");); + command("reset_mol_ids all offset -2");); + TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", command("reset_mol_ids all offset xxx");); TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", - lmp->input->one("reset_mol_ids all offset xxx");); - TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", - lmp->input->one("reset_mol_ids all compress yes single no offset xxx");); + command("reset_mol_ids all compress yes single no offset xxx");); + TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all offset");); TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all offset");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all compress");); + command("reset_mol_ids all compress");); TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all compress xxx");); + command("reset_mol_ids all compress xxx");); + TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all single");); TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all single");); - TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", - lmp->input->one("reset_mol_ids all single xxx");); + command("reset_mol_ids all single xxx");); } TEST(ResetMolIds, CMDFail) @@ -693,20 +692,23 @@ TEST(ResetMolIds, CMDFail) TEST_FAILURE(".*ERROR: Reset_mol_ids command before simulation box is.*", lmp->input->one("reset_mol_ids all");); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("atom_modify id no"); - lmp->input->one("region box block 0 1 0 1 0 1"); - lmp->input->one("create_box 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*", - lmp->input->one("reset_mol_ids all");); + auto command = [&](const std::string &line) { + lmp->input->one(line.c_str()); + }; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("region box block 0 1 0 1 0 1"); - lmp->input->one("create_box 1 box"); + command("atom_modify id no"); + command("region box block 0 1 0 1 0 1"); + command("create_box 1 box"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", lmp->input->one("reset_mol_ids all");); + TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*", command("reset_mol_ids all");); + + if (!verbose) ::testing::internal::CaptureStdout(); + command("clear"); + command("region box block 0 1 0 1 0 1"); + command("create_box 1 box"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", command("reset_mol_ids all");); if (!verbose) ::testing::internal::CaptureStdout(); delete lmp; diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 5fdc1e912b..4261dbd61d 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -82,11 +82,13 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(SimpleCommandsTest, UnknownCommand) { - TEST_FAILURE(".*ERROR: Unknown command.*", lmp->input->one("XXX one two");); + TEST_FAILURE(".*ERROR: Unknown command.*", command("XXX one two");); } TEST_F(SimpleCommandsTest, Echo) @@ -95,31 +97,31 @@ TEST_F(SimpleCommandsTest, Echo) ASSERT_EQ(lmp->input->echo_log, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("echo none"); + command("echo none"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->input->echo_screen, 0); ASSERT_EQ(lmp->input->echo_log, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("echo both"); + command("echo both"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->input->echo_screen, 1); ASSERT_EQ(lmp->input->echo_log, 1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("echo screen"); + command("echo screen"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->input->echo_screen, 1); ASSERT_EQ(lmp->input->echo_log, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("echo log"); + command("echo log"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->input->echo_screen, 0); ASSERT_EQ(lmp->input->echo_log, 1); - TEST_FAILURE(".*ERROR: Illegal echo command.*", lmp->input->one("echo");); - TEST_FAILURE(".*ERROR: Illegal echo command.*", lmp->input->one("echo xxx");); + TEST_FAILURE(".*ERROR: Illegal echo command.*", command("echo");); + TEST_FAILURE(".*ERROR: Illegal echo command.*", command("echo xxx");); } TEST_F(SimpleCommandsTest, Log) @@ -127,13 +129,13 @@ TEST_F(SimpleCommandsTest, Log) ASSERT_EQ(lmp->logfile, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("log simple_command_test.log"); - lmp->input->one("print 'test1'"); + command("log simple_command_test.log"); + command("print 'test1'"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_NE(lmp->logfile, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("log none"); + command("log none"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->logfile, nullptr); @@ -145,12 +147,12 @@ TEST_F(SimpleCommandsTest, Log) ASSERT_THAT(text, StrEq("test1")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("log simple_command_test.log append"); - lmp->input->one("print 'test2'"); + command("log simple_command_test.log append"); + command("print 'test2'"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_NE(lmp->logfile, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("log none"); + command("log none"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->logfile, nullptr); @@ -162,7 +164,7 @@ TEST_F(SimpleCommandsTest, Log) in.close(); remove("simple_command_test.log"); - TEST_FAILURE(".*ERROR: Illegal log command.*", lmp->input->one("log");); + TEST_FAILURE(".*ERROR: Illegal log command.*", command("log");); } TEST_F(SimpleCommandsTest, Newton) @@ -171,22 +173,22 @@ TEST_F(SimpleCommandsTest, Newton) ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("newton off"); + command("newton off"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->force->newton_pair, 0); ASSERT_EQ(lmp->force->newton_bond, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("newton on off"); + command("newton on off"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("newton off on"); + command("newton off on"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->force->newton_pair, 0); ASSERT_EQ(lmp->force->newton_bond, 1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("newton on"); + command("newton on"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 1); @@ -195,21 +197,20 @@ TEST_F(SimpleCommandsTest, Newton) TEST_F(SimpleCommandsTest, Partition) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("echo none"); + command("echo none"); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal partition command .*", - lmp->input->one("partition xxx 1 echo none");); + TEST_FAILURE(".*ERROR: Illegal partition command .*", command("partition xxx 1 echo none");); TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*", - lmp->input->one("partition yes 2 echo none");); + command("partition yes 2 echo none");); ::testing::internal::CaptureStdout(); - lmp->input->one("partition yes 1 print 'test'"); + command("partition yes 1 print 'test'"); auto text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; ASSERT_THAT(text, StrEq("test\n")); ::testing::internal::CaptureStdout(); - lmp->input->one("partition no 1 print 'test'"); + command("partition no 1 print 'test'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; ASSERT_THAT(text, StrEq("")); @@ -218,14 +219,14 @@ TEST_F(SimpleCommandsTest, Partition) TEST_F(SimpleCommandsTest, Quit) { ::testing::internal::CaptureStdout(); - lmp->input->one("echo none"); + command("echo none"); ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Expected integer .*", lmp->input->one("quit xxx");); + TEST_FAILURE(".*ERROR: Expected integer .*", command("quit xxx");); // the following tests must be skipped with OpenMPI due to using threads if (have_openmpi) GTEST_SKIP(); - ASSERT_EXIT(lmp->input->one("quit"), ExitedWithCode(0), ""); - ASSERT_EXIT(lmp->input->one("quit 9"), ExitedWithCode(9), ""); + ASSERT_EXIT(command("quit"), ExitedWithCode(0), ""); + ASSERT_EXIT(command("quit 9"), ExitedWithCode(9), ""); } TEST_F(SimpleCommandsTest, ResetTimestep) @@ -233,19 +234,19 @@ TEST_F(SimpleCommandsTest, ResetTimestep) ASSERT_EQ(lmp->update->ntimestep, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_timestep 10"); + command("reset_timestep 10"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->ntimestep, 10); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_timestep 0"); + command("reset_timestep 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->ntimestep, 0); - TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", lmp->input->one("reset_timestep -10");); - TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", lmp->input->one("reset_timestep");); - TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", lmp->input->one("reset_timestep 10 10");); - TEST_FAILURE(".*ERROR: Expected integer .*", lmp->input->one("reset_timestep xxx");); + TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10");); + TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep");); + TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep 10 10");); + TEST_FAILURE(".*ERROR: Expected integer .*", command("reset_timestep xxx");); } TEST_F(SimpleCommandsTest, Suffix) @@ -254,39 +255,38 @@ TEST_F(SimpleCommandsTest, Suffix) ASSERT_EQ(lmp->suffix, nullptr); ASSERT_EQ(lmp->suffix2, nullptr); - TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", - lmp->input->one("suffix on");); + TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix on");); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("suffix one"); + command("suffix one"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->suffix, StrEq("one")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("suffix hybrid two three"); + command("suffix hybrid two three"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->suffix, StrEq("two")); ASSERT_THAT(lmp->suffix2, StrEq("three")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("suffix four"); + command("suffix four"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->suffix, StrEq("four")); ASSERT_EQ(lmp->suffix2, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("suffix off"); + command("suffix off"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->suffix_enable, 0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("suffix on"); + command("suffix on"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->suffix_enable, 1); - TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix");); - TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix hybrid");); - TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix hybrid one");); + TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix");); + TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix hybrid");); + TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix hybrid one");); } TEST_F(SimpleCommandsTest, Thermo) @@ -294,53 +294,53 @@ TEST_F(SimpleCommandsTest, Thermo) ASSERT_EQ(lmp->output->thermo_every, 0); ASSERT_EQ(lmp->output->var_thermo, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("thermo 2"); + command("thermo 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->output->thermo_every, 2); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("variable step equal logfreq(10,3,10)"); - lmp->input->one("thermo v_step"); + command("variable step equal logfreq(10,3,10)"); + command("thermo v_step"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->output->var_thermo, StrEq("step")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("thermo 10"); + command("thermo 10"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->output->thermo_every, 10); ASSERT_EQ(lmp->output->var_thermo, nullptr); - TEST_FAILURE(".*ERROR: Illegal thermo command.*", lmp->input->one("thermo");); - TEST_FAILURE(".*ERROR: Illegal thermo command.*", lmp->input->one("thermo -1");); - TEST_FAILURE(".*ERROR: Expected integer.*", lmp->input->one("thermo xxx");); + TEST_FAILURE(".*ERROR: Illegal thermo command.*", command("thermo");); + TEST_FAILURE(".*ERROR: Illegal thermo command.*", command("thermo -1");); + TEST_FAILURE(".*ERROR: Expected integer.*", command("thermo xxx");); } TEST_F(SimpleCommandsTest, TimeStep) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("timestep 1"); + command("timestep 1"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->dt, 1.0); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("timestep 0.1"); + command("timestep 0.1"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->dt, 0.1); // zero timestep is legal and works (atoms don't move) if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("timestep 0.0"); + command("timestep 0.0"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->dt, 0.0); // negative timestep also creates a viable MD. if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("timestep -0.1"); + command("timestep -0.1"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->update->dt, -0.1); - TEST_FAILURE(".*ERROR: Illegal timestep command.*", lmp->input->one("timestep");); - TEST_FAILURE(".*ERROR: Expected floating point.*", lmp->input->one("timestep xxx");); + TEST_FAILURE(".*ERROR: Illegal timestep command.*", command("timestep");); + TEST_FAILURE(".*ERROR: Expected floating point.*", command("timestep xxx");); } TEST_F(SimpleCommandsTest, Units) @@ -353,24 +353,24 @@ TEST_F(SimpleCommandsTest, Units) ASSERT_THAT(lmp->update->unit_style, StrEq("lj")); for (std::size_t i = 0; i < num; ++i) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one(fmt::format("units {}", names[i])); + command(fmt::format("units {}", names[i])); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->update->unit_style, StrEq(names[i])); ASSERT_EQ(lmp->update->dt, dt[i]); } if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); + command("clear"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(lmp->update->unit_style, StrEq("lj")); - TEST_FAILURE(".*ERROR: Illegal units command.*", lmp->input->one("units unknown");); + TEST_FAILURE(".*ERROR: Illegal units command.*", command("units unknown");); } TEST_F(SimpleCommandsTest, Shell) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("shell putenv TEST_VARIABLE=simpletest"); + command("shell putenv TEST_VARIABLE=simpletest"); if (!verbose) ::testing::internal::GetCapturedStdout(); char *test_var = getenv("TEST_VARIABLE"); @@ -378,8 +378,8 @@ TEST_F(SimpleCommandsTest, Shell) ASSERT_THAT(test_var, StrEq("simpletest")); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("shell putenv TEST_VARIABLE=simpletest"); - lmp->input->one("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2"); + command("shell putenv TEST_VARIABLE=simpletest"); + command("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2"); if (!verbose) ::testing::internal::GetCapturedStdout(); char *test_var2 = getenv("TEST_VARIABLE2"); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 5a1d249bd5..7106867894 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -298,31 +298,31 @@ TEST_F(VariableTest, IfCommand) command("if 1>0 then 'print \".*bingo!\"'"); auto text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); ::testing::internal::CaptureStdout(); command("if (1>=0) then 'print \"bingo!\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); ::testing::internal::CaptureStdout(); command("if (-1.0e-1<0.0E+0) then 'print \"bingo!\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); ::testing::internal::CaptureStdout(); command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); ::testing::internal::CaptureStdout(); command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text,MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", command("if () then 'print \"bingo!\"'");); diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index 7f07052b3d..8cef78c6f8 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -327,7 +327,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit_block("run_stress", block); block.clear(); - f = lmp->atom->f; + f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index a4956006f5..fa9f8fbc02 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -327,7 +327,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit_block("run_stress", block); block.clear(); - f = lmp->atom->f; + f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index 4ef3692f56..d4d9d3c854 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -53,17 +53,17 @@ TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(co consumers["global_scalar"] = &TestConfigReader::global_scalar; consumers["global_vector"] = &TestConfigReader::global_vector; - consumers["bond_style"] = &TestConfigReader::bond_style; - consumers["bond_coeff"] = &TestConfigReader::bond_coeff; - consumers["angle_style"] = &TestConfigReader::angle_style; - consumers["angle_coeff"] = &TestConfigReader::angle_coeff; + consumers["bond_style"] = &TestConfigReader::bond_style; + consumers["bond_coeff"] = &TestConfigReader::bond_coeff; + consumers["angle_style"] = &TestConfigReader::angle_style; + consumers["angle_coeff"] = &TestConfigReader::angle_coeff; consumers["dihedral_style"] = &TestConfigReader::dihedral_style; consumers["dihedral_coeff"] = &TestConfigReader::dihedral_coeff; consumers["improper_style"] = &TestConfigReader::improper_style; consumers["improper_coeff"] = &TestConfigReader::improper_coeff; - consumers["init_energy"] = &TestConfigReader::init_energy; - consumers["run_energy"] = &TestConfigReader::run_energy; - consumers["equilibrium"] = &TestConfigReader::equilibrium; + consumers["init_energy"] = &TestConfigReader::init_energy; + consumers["run_energy"] = &TestConfigReader::run_energy; + consumers["equilibrium"] = &TestConfigReader::equilibrium; } void TestConfigReader::prerequisites(const yaml_event_t &event) diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index 6dd6a3f205..81df454fcc 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -310,7 +310,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -330,7 +330,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit_block("run_stress", block); block.clear(); - f = lmp->atom->f; + f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index 1b97f38faf..33d95820bd 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -301,7 +301,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -321,7 +321,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit_block("run_stress", block); block.clear(); - f = lmp->atom->f; + f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index fd8d306538..edfad1f923 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // init_forces block.clear(); - auto f = lmp->atom->f; + auto f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -330,7 +330,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) writer.emit_block("run_stress", block); block.clear(); - f = lmp->atom->f; + f = lmp->atom->f; for (int i = 1; i <= natoms; ++i) { const int j = lmp->atom->map(i); block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]); @@ -829,9 +829,8 @@ TEST(PairStyle, intel) GTEST_SKIP(); } - if ((test_config.pair_style == "rebo") - || utils::strmatch(test_config.pair_style, "^dpd") - || utils::strmatch(test_config.pair_style, "^tersoff.* shift ")) { + if ((test_config.pair_style == "rebo") || utils::strmatch(test_config.pair_style, "^dpd") || + utils::strmatch(test_config.pair_style, "^tersoff.* shift ")) { std::cerr << "Skipping pair style " << lmp->force->pair_style << "\n"; if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 37d436a7a2..b787076495 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -102,9 +102,6 @@ class AtomStyleTest : public ::testing::Test { protected: LAMMPS *lmp; - // convenience... - void command(const std::string cmd) { lmp->input->one(cmd); } - void SetUp() override { const char *args[] = {"SimpleCommandsTest", "-log", "none", "-echo", "screen", "-nocite"}; @@ -131,6 +128,8 @@ protected: remove("input_atom_styles.data"); remove("test_atom_styles.restart"); } + + void command(const std::string cmd) { lmp->input->one(cmd); } }; // default class Atom state diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index 8c4c8bce89..cf85d810df 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -84,6 +84,8 @@ protected: if (!verbose) ::testing::internal::GetCapturedStdout(); remove("safe_file_read_test.txt"); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; #define MAX_BUF_SIZE 128 @@ -155,13 +157,13 @@ TEST_F(FileOperationsTest, logmesg) { char buf[8]; ::testing::internal::CaptureStdout(); - lmp->input->one("echo none"); + command("echo none"); ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); utils::logmesg(lmp, "one\n"); - lmp->input->one("log test_logmesg.log"); + command("log test_logmesg.log"); utils::logmesg(lmp, "two\n"); - lmp->input->one("log none"); + command("log none"); std::string out = ::testing::internal::GetCapturedStdout(); memset(buf, 0, 8); FILE *fp = fopen("test_logmesg.log", "r"); diff --git a/unittest/formats/test_image_flags.cpp b/unittest/formats/test_image_flags.cpp index 6d4ae08111..6b3a333328 100644 --- a/unittest/formats/test_image_flags.cpp +++ b/unittest/formats/test_image_flags.cpp @@ -28,7 +28,6 @@ using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::Eq; - class ImageFlagsTest : public ::testing::Test { protected: LAMMPS *lmp; @@ -43,18 +42,18 @@ protected: if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_NE(lmp, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("region box block -2 2 -2 2 -2 2"); - lmp->input->one("create_box 1 box"); - lmp->input->one("create_atoms 1 single 0.0 0.0 0.0 units box"); - lmp->input->one("create_atoms 1 single 1.9 -1.9 1.9999 units box"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("pair_coeff * *"); - lmp->input->one("mass * 1.0"); - lmp->input->one("set atom 1 image -1 2 3"); - lmp->input->one("set atom 2 image -2 1 -1"); - lmp->input->one("write_data test_image_flags.data"); + command("units real"); + command("dimension 3"); + command("region box block -2 2 -2 2 -2 2"); + command("create_box 1 box"); + command("create_atoms 1 single 0.0 0.0 0.0 units box"); + command("create_atoms 1 single 1.9 -1.9 1.9999 units box"); + command("pair_style zero 2.0"); + command("pair_coeff * *"); + command("mass * 1.0"); + command("set atom 1 image -1 2 3"); + command("set atom 2 image -2 1 -1"); + command("write_data test_image_flags.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); } @@ -65,196 +64,198 @@ protected: if (!verbose) ::testing::internal::GetCapturedStdout(); remove("test_image_flags.data"); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(ImageFlagsTest, change_box) { auto image = lmp->atom->image; - int imx = (image[0] & IMGMASK) - IMGMAX; - int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - int imz = (image[0] >> IMG2BITS) - IMGMAX; + int imx = (image[0] & IMGMASK) - IMGMAX; + int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + int imz = (image[0] >> IMG2BITS) - IMGMAX; + + ASSERT_EQ(imx, -1); + ASSERT_EQ(imy, 2); + ASSERT_EQ(imz, 3); - ASSERT_EQ(imx,-1); - ASSERT_EQ(imy,2); - ASSERT_EQ(imz,3); - imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-2); - ASSERT_EQ(imy,1); - ASSERT_EQ(imz,-1); - + ASSERT_EQ(imx, -2); + ASSERT_EQ(imy, 1); + ASSERT_EQ(imz, -1); + if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("change_box all boundary f p p"); + command("change_box all boundary f p p"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,2); - ASSERT_EQ(imz,3); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 2); + ASSERT_EQ(imz, 3); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,1); - ASSERT_EQ(imz,-1); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 1); + ASSERT_EQ(imz, -1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("change_box all boundary f s p"); + command("change_box all boundary f s p"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,3); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, 3); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,-1); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, -1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("change_box all boundary p p m"); + command("change_box all boundary p p m"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,0); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, 0); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,0); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, 0); } TEST_F(ImageFlagsTest, read_data) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("boundary p p p"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("read_data test_image_flags.data"); + command("clear"); + command("units real"); + command("dimension 3"); + command("boundary p p p"); + command("pair_style zero 2.0"); + command("read_data test_image_flags.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); - + auto image = lmp->atom->image; - int imx = (image[0] & IMGMASK) - IMGMAX; - int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - int imz = (image[0] >> IMG2BITS) - IMGMAX; + int imx = (image[0] & IMGMASK) - IMGMAX; + int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + int imz = (image[0] >> IMG2BITS) - IMGMAX; + + ASSERT_EQ(imx, -1); + ASSERT_EQ(imy, 2); + ASSERT_EQ(imz, 3); - ASSERT_EQ(imx,-1); - ASSERT_EQ(imy,2); - ASSERT_EQ(imz,3); - imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-2); - ASSERT_EQ(imy,1); - ASSERT_EQ(imz,-1); - + ASSERT_EQ(imx, -2); + ASSERT_EQ(imy, 1); + ASSERT_EQ(imz, -1); + if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("boundary f p p"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("read_data test_image_flags.data"); + command("clear"); + command("units real"); + command("dimension 3"); + command("boundary f p p"); + command("pair_style zero 2.0"); + command("read_data test_image_flags.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,2); - ASSERT_EQ(imz,3); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 2); + ASSERT_EQ(imz, 3); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,0); - ASSERT_EQ(imy,1); - ASSERT_EQ(imz,-1); + ASSERT_EQ(imx, 0); + ASSERT_EQ(imy, 1); + ASSERT_EQ(imz, -1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("boundary p s p"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("read_data test_image_flags.data"); + command("clear"); + command("units real"); + command("dimension 3"); + command("boundary p s p"); + command("pair_style zero 2.0"); + command("read_data test_image_flags.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-1); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,3); + ASSERT_EQ(imx, -1); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, 3); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-2); - ASSERT_EQ(imy,0); - ASSERT_EQ(imz,-1); + ASSERT_EQ(imx, -2); + ASSERT_EQ(imy, 0); + ASSERT_EQ(imz, -1); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("dimension 3"); - lmp->input->one("boundary p p m"); - lmp->input->one("pair_style zero 2.0"); - lmp->input->one("read_data test_image_flags.data"); + command("clear"); + command("units real"); + command("dimension 3"); + command("boundary p p m"); + command("pair_style zero 2.0"); + command("read_data test_image_flags.data"); if (!verbose) ::testing::internal::GetCapturedStdout(); image = lmp->atom->image; - imx = (image[0] & IMGMASK) - IMGMAX; - imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; - imz = (image[0] >> IMG2BITS) - IMGMAX; + imx = (image[0] & IMGMASK) - IMGMAX; + imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX; + imz = (image[0] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-1); - ASSERT_EQ(imy,2); - ASSERT_EQ(imz,0); + ASSERT_EQ(imx, -1); + ASSERT_EQ(imy, 2); + ASSERT_EQ(imz, 0); imx = (image[1] & IMGMASK) - IMGMAX; imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX; imz = (image[1] >> IMG2BITS) - IMGMAX; - ASSERT_EQ(imx,-2); - ASSERT_EQ(imy,1); - ASSERT_EQ(imz,0); + ASSERT_EQ(imx, -2); + ASSERT_EQ(imy, 1); + ASSERT_EQ(imz, 0); } } // namespace LAMMPS_NS diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 3bfc0dc4fa..204a1bd061 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -131,19 +131,20 @@ protected: lmp->input->one(fmt::format("molecule {} {} {}", name, file, args)); remove(file.c_str()); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(MoleculeFileTest, nofile) { - TEST_FAILURE(".*Cannot open molecule file nofile.mol.*", - lmp->input->one("molecule 1 nofile.mol");); + TEST_FAILURE(".*Cannot open molecule file nofile.mol.*", command("molecule 1 nofile.mol");); } TEST_F(MoleculeFileTest, badid) { TEST_FAILURE(".*Molecule template ID must have only " "alphanumeric or underscore characters.*", - lmp->input->one("molecule @mol nofile.mol");); + command("molecule @mol nofile.mol");); } TEST_F(MoleculeFileTest, badargs) @@ -223,7 +224,7 @@ TEST_F(MoleculeFileTest, twomols) TEST_F(MoleculeFileTest, twofiles) { ::testing::internal::CaptureStdout(); - lmp->input->one("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); + command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); auto output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms " @@ -237,10 +238,10 @@ TEST_F(MoleculeFileTest, twofiles) TEST_F(MoleculeFileTest, bonds) { ::testing::internal::CaptureStdout(); - lmp->input->one("atom_style bond"); - lmp->input->one("region box block 0 1 0 1 0 1"); - lmp->input->one("create_box 2 box bond/types 2 extra/bond/per/atom 2 " - "extra/special/per/atom 4"); + command("atom_style bond"); + command("region box block 0 1 0 1 0 1"); + command("create_box 2 box bond/types 2 extra/bond/per/atom 2 " + "extra/special/per/atom 4"); run_mol_cmd(test_name, "", "Comment\n" "4 atoms\n" @@ -264,8 +265,8 @@ TEST_F(MoleculeFileTest, bonds) "2 bonds.*type.*2.*0 angles.*")); ::testing::internal::CaptureStdout(); - lmp->input->one("mass * 2.0"); - lmp->input->one("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235"); + command("mass * 2.0"); + command("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235"); output = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << output; ASSERT_THAT(output, MatchesRegex(".*Created 4 atoms.*")); diff --git a/unittest/formats/test_pair_unit_convert.cpp b/unittest/formats/test_pair_unit_convert.cpp index 712e6ff50c..f0c2f0d031 100644 --- a/unittest/formats/test_pair_unit_convert.cpp +++ b/unittest/formats/test_pair_unit_convert.cpp @@ -59,19 +59,19 @@ protected: ASSERT_NE(lmp, nullptr); if (!verbose) ::testing::internal::CaptureStdout(); info = new Info(lmp); - lmp->input->one("units metal"); - lmp->input->one("dimension 3"); - lmp->input->one("region box block -4 4 -4 4 -4 4"); - lmp->input->one("create_box 2 box"); - lmp->input->one("create_atoms 1 single -1.1 1.2 0.0 units box"); - lmp->input->one("create_atoms 1 single -1.2 -1.1 0.0 units box"); - lmp->input->one("create_atoms 2 single 0.9 1.0 0.0 units box"); - lmp->input->one("create_atoms 2 single 1.0 -0.9 0.0 units box"); - lmp->input->one("pair_style zero 4.0"); - lmp->input->one("pair_coeff * *"); - lmp->input->one("mass * 1.0"); - lmp->input->one("write_data test_pair_unit_convert.data nocoeff"); - lmp->input->one("clear"); + command("units metal"); + command("dimension 3"); + command("region box block -4 4 -4 4 -4 4"); + command("create_box 2 box"); + command("create_atoms 1 single -1.1 1.2 0.0 units box"); + command("create_atoms 1 single -1.2 -1.1 0.0 units box"); + command("create_atoms 2 single 0.9 1.0 0.0 units box"); + command("create_atoms 2 single 1.0 -0.9 0.0 units box"); + command("pair_style zero 4.0"); + command("pair_coeff * *"); + command("mass * 1.0"); + command("write_data test_pair_unit_convert.data nocoeff"); + command("clear"); if (!verbose) ::testing::internal::GetCapturedStdout(); } @@ -83,6 +83,8 @@ protected: if (!verbose) ::testing::internal::GetCapturedStdout(); remove("test_pair_unit_convert.data"); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(PairUnitConvertTest, zero) @@ -91,11 +93,11 @@ TEST_F(PairUnitConvertTest, zero) if (!info->has_style("pair", "zero")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style zero 6.0"); - lmp->input->one("pair_coeff * *"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style zero 6.0"); + command("pair_coeff * *"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -108,12 +110,12 @@ TEST_F(PairUnitConvertTest, zero) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style zero 6.0"); - lmp->input->one("pair_coeff * *"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style zero 6.0"); + command("pair_coeff * *"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -134,15 +136,15 @@ TEST_F(PairUnitConvertTest, lj_cut) if (!info->has_style("pair", "lj/cut")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style lj/cut 6.0"); - lmp->input->one("pair_coeff * * 0.01014286346782117 2.0"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style lj/cut 6.0"); + command("pair_coeff * * 0.01014286346782117 2.0"); remove("test.table.metal"); - lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.metal lj_1_1"); - lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2"); - lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2"); - lmp->input->one("run 0 post no"); + command("pair_write 1 1 1000 r 0.1 6.0 test.table.metal lj_1_1"); + command("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2"); + command("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -155,16 +157,16 @@ TEST_F(PairUnitConvertTest, lj_cut) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style lj/cut 6.0"); - lmp->input->one("pair_coeff * * 0.2339 2.0"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style lj/cut 6.0"); + command("pair_coeff * * 0.2339 2.0"); remove("test.table.real"); - lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.real lj_1_1"); - lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2"); - lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2"); - lmp->input->one("run 0 post no"); + command("pair_write 1 1 1000 r 0.1 6.0 test.table.real lj_1_1"); + command("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2"); + command("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -185,11 +187,11 @@ TEST_F(PairUnitConvertTest, eam) if (!info->has_style("pair", "eam")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam"); - lmp->input->one("pair_coeff * * Cu_u3.eam"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam"); + command("pair_coeff * * Cu_u3.eam"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -202,12 +204,12 @@ TEST_F(PairUnitConvertTest, eam) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam"); - lmp->input->one("pair_coeff * * Cu_u3.eam"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam"); + command("pair_coeff * * Cu_u3.eam"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -228,11 +230,11 @@ TEST_F(PairUnitConvertTest, eam_alloy) if (!info->has_style("pair", "eam/alloy")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/alloy"); - lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/alloy"); + command("pair_coeff * * AlCu.eam.alloy Al Cu"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -245,12 +247,12 @@ TEST_F(PairUnitConvertTest, eam_alloy) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/alloy"); - lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/alloy"); + command("pair_coeff * * AlCu.eam.alloy Al Cu"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -271,11 +273,11 @@ TEST_F(PairUnitConvertTest, eam_fs) if (!info->has_style("pair", "eam/fs")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/fs"); - lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/fs"); + command("pair_coeff * * FeP_mm.eam.fs Fe P"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -288,12 +290,12 @@ TEST_F(PairUnitConvertTest, eam_fs) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/fs"); - lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/fs"); + command("pair_coeff * * FeP_mm.eam.fs Fe P"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -314,11 +316,11 @@ TEST_F(PairUnitConvertTest, eam_cd) if (!info->has_style("pair", "eam/cd")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/cd"); - lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/cd"); + command("pair_coeff * * FeCr.cdeam Cr Fe"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -331,12 +333,12 @@ TEST_F(PairUnitConvertTest, eam_cd) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eam/cd"); - lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eam/cd"); + command("pair_coeff * * FeCr.cdeam Cr Fe"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -357,11 +359,11 @@ TEST_F(PairUnitConvertTest, eim) if (!info->has_style("pair", "eim")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eim"); - lmp->input->one("pair_coeff * * Na Cl ffield.eim Na Cl"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eim"); + command("pair_coeff * * Na Cl ffield.eim Na Cl"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -374,12 +376,12 @@ TEST_F(PairUnitConvertTest, eim) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style eim"); - lmp->input->one("pair_coeff * * Na Cl ffield.eim Na Cl"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style eim"); + command("pair_coeff * * Na Cl ffield.eim Na Cl"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -400,11 +402,11 @@ TEST_F(PairUnitConvertTest, gw) if (!info->has_style("pair", "gw")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style gw"); - lmp->input->one("pair_coeff * * SiC.gw Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style gw"); + command("pair_coeff * * SiC.gw Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -417,12 +419,12 @@ TEST_F(PairUnitConvertTest, gw) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style gw"); - lmp->input->one("pair_coeff * * SiC.gw Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style gw"); + command("pair_coeff * * SiC.gw Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -443,11 +445,11 @@ TEST_F(PairUnitConvertTest, gw_zbl) if (!info->has_style("pair", "gw/zbl")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style gw/zbl"); - lmp->input->one("pair_coeff * * SiC.gw.zbl Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style gw/zbl"); + command("pair_coeff * * SiC.gw.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -460,12 +462,12 @@ TEST_F(PairUnitConvertTest, gw_zbl) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style gw/zbl"); - lmp->input->one("pair_coeff * * SiC.gw.zbl Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style gw/zbl"); + command("pair_coeff * * SiC.gw.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -486,11 +488,11 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic) if (!info->has_style("pair", "nb3b/harmonic")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style nb3b/harmonic"); - lmp->input->one("pair_coeff * * MOH.nb3b.harmonic M O"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style nb3b/harmonic"); + command("pair_coeff * * MOH.nb3b.harmonic M O"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -503,12 +505,12 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style nb3b/harmonic"); - lmp->input->one("pair_coeff * * MOH.nb3b.harmonic M O"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style nb3b/harmonic"); + command("pair_coeff * * MOH.nb3b.harmonic M O"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -529,11 +531,11 @@ TEST_F(PairUnitConvertTest, sw) if (!info->has_style("pair", "sw")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style sw"); - lmp->input->one("pair_coeff * * GaN.sw Ga N"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style sw"); + command("pair_coeff * * GaN.sw Ga N"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -546,12 +548,12 @@ TEST_F(PairUnitConvertTest, sw) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style sw"); - lmp->input->one("pair_coeff * * GaN.sw Ga N"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style sw"); + command("pair_coeff * * GaN.sw Ga N"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -572,13 +574,13 @@ TEST_F(PairUnitConvertTest, table_metal2real) if (!info->has_style("pair", "table")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style table linear 1000"); - lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1"); - lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2"); - lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style table linear 1000"); + command("pair_coeff 1 1 test.table.metal lj_1_1"); + command("pair_coeff 1 2 test.table.metal lj_1_2"); + command("pair_coeff 2 2 test.table.metal lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -591,14 +593,14 @@ TEST_F(PairUnitConvertTest, table_metal2real) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style table linear 1000"); - lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1"); - lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2"); - lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style table linear 1000"); + command("pair_coeff 1 1 test.table.metal lj_1_1"); + command("pair_coeff 1 2 test.table.metal lj_1_2"); + command("pair_coeff 2 2 test.table.metal lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -619,13 +621,13 @@ TEST_F(PairUnitConvertTest, table_real2metal) if (!info->has_style("pair", "table")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style table linear 1000"); - lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1"); - lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2"); - lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2"); - lmp->input->one("run 0 post no"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style table linear 1000"); + command("pair_coeff 1 1 test.table.real lj_1_1"); + command("pair_coeff 1 2 test.table.real lj_1_2"); + command("pair_coeff 2 2 test.table.real lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -638,14 +640,14 @@ TEST_F(PairUnitConvertTest, table_real2metal) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style table linear 1000"); - lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1"); - lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2"); - lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style table linear 1000"); + command("pair_coeff 1 1 test.table.real lj_1_1"); + command("pair_coeff 1 2 test.table.real lj_1_2"); + command("pair_coeff 2 2 test.table.real lj_2_2"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -666,11 +668,11 @@ TEST_F(PairUnitConvertTest, tersoff) if (!info->has_style("pair", "tersoff")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff"); - lmp->input->one("pair_coeff * * SiC.tersoff Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff"); + command("pair_coeff * * SiC.tersoff Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -683,12 +685,12 @@ TEST_F(PairUnitConvertTest, tersoff) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff"); - lmp->input->one("pair_coeff * * SiC.tersoff Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff"); + command("pair_coeff * * SiC.tersoff Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -709,11 +711,11 @@ TEST_F(PairUnitConvertTest, tersoff_mod) if (!info->has_style("pair", "tersoff/mod")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/mod"); - lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/mod"); + command("pair_coeff * * Si.tersoff.mod Si Si"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -726,12 +728,12 @@ TEST_F(PairUnitConvertTest, tersoff_mod) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/mod"); - lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/mod"); + command("pair_coeff * * Si.tersoff.mod Si Si"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -752,11 +754,11 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c) if (!info->has_style("pair", "tersoff/mod/c")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/mod/c"); - lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/mod/c"); + command("pair_coeff * * Si.tersoff.modc Si Si"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -769,12 +771,12 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/mod/c"); - lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/mod/c"); + command("pair_coeff * * Si.tersoff.modc Si Si"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -795,11 +797,11 @@ TEST_F(PairUnitConvertTest, tersoff_table) if (!info->has_style("pair", "tersoff/table")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/table"); - lmp->input->one("pair_coeff * * SiC.tersoff Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/table"); + command("pair_coeff * * SiC.tersoff Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -812,12 +814,12 @@ TEST_F(PairUnitConvertTest, tersoff_table) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/table"); - lmp->input->one("pair_coeff * * SiC.tersoff Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/table"); + command("pair_coeff * * SiC.tersoff Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -838,11 +840,11 @@ TEST_F(PairUnitConvertTest, tersoff_zbl) if (!info->has_style("pair", "tersoff/zbl")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/zbl"); - lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/zbl"); + command("pair_coeff * * SiC.tersoff.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -855,12 +857,12 @@ TEST_F(PairUnitConvertTest, tersoff_zbl) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/zbl"); - lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/zbl"); + command("pair_coeff * * SiC.tersoff.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -881,12 +883,12 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp) if (!info->has_style("pair", "tersoff/zbl/omp")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("package omp 4"); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/zbl/omp"); - lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C"); - lmp->input->one("run 0 post no"); + command("package omp 4"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/zbl/omp"); + command("pair_coeff * * SiC.tersoff.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -899,13 +901,13 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("package omp 4"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style tersoff/zbl/omp"); - lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("package omp 4"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style tersoff/zbl/omp"); + command("pair_coeff * * SiC.tersoff.zbl Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; @@ -926,11 +928,11 @@ TEST_F(PairUnitConvertTest, vashishta) if (!info->has_style("pair", "vashishta")) GTEST_SKIP(); if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style vashishta"); - lmp->input->one("pair_coeff * * SiC.vashishta Si C"); - lmp->input->one("run 0 post no"); + command("units metal"); + command("read_data test_pair_unit_convert.data"); + command("pair_style vashishta"); + command("pair_coeff * * SiC.vashishta Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); // copy pressure, energy, and force from first step @@ -943,12 +945,12 @@ TEST_F(PairUnitConvertTest, vashishta) fold[i][j] = f[i][j]; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("clear"); - lmp->input->one("units real"); - lmp->input->one("read_data test_pair_unit_convert.data"); - lmp->input->one("pair_style vashishta"); - lmp->input->one("pair_coeff * * SiC.vashishta Si C"); - lmp->input->one("run 0 post no"); + command("clear"); + command("units real"); + command("read_data test_pair_unit_convert.data"); + command("pair_style vashishta"); + command("pair_coeff * * SiC.vashishta Si C"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); double pnew; diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 4279c8d1a7..6cf2fd010c 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -96,13 +96,15 @@ protected: delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); } + + void command(const std::string &cmd) { lmp->input->one(cmd); } }; // open for native units TEST_F(PotentialFileReaderTest, Sw_native) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -114,7 +116,7 @@ TEST_F(PotentialFileReaderTest, Sw_native) TEST_F(PotentialFileReaderTest, Sw_conv) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); + command("units real"); PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -126,7 +128,7 @@ TEST_F(PotentialFileReaderTest, Sw_conv) TEST_F(PotentialFileReaderTest, Sw_noconv) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); + command("units real"); if (!verbose) ::testing::internal::GetCapturedStdout(); TEST_FAILURE(".*ERROR on proc.*potential.*requires metal units but real.*", @@ -136,7 +138,7 @@ TEST_F(PotentialFileReaderTest, Sw_noconv) TEST_F(PotentialFileReaderTest, Comb) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "ffield.comb", "COMB"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -147,7 +149,7 @@ TEST_F(PotentialFileReaderTest, Comb) TEST_F(PotentialFileReaderTest, Comb3) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "ffield.comb3", "COMB3"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -158,7 +160,7 @@ TEST_F(PotentialFileReaderTest, Comb3) TEST_F(PotentialFileReaderTest, Tersoff) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -169,7 +171,7 @@ TEST_F(PotentialFileReaderTest, Tersoff) TEST_F(PotentialFileReaderTest, TersoffMod) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -180,7 +182,7 @@ TEST_F(PotentialFileReaderTest, TersoffMod) TEST_F(PotentialFileReaderTest, TersoffModC) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -191,7 +193,7 @@ TEST_F(PotentialFileReaderTest, TersoffModC) TEST_F(PotentialFileReaderTest, TersoffTable) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -202,7 +204,7 @@ TEST_F(PotentialFileReaderTest, TersoffTable) TEST_F(PotentialFileReaderTest, TersoffZBL) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -213,7 +215,7 @@ TEST_F(PotentialFileReaderTest, TersoffZBL) TEST_F(PotentialFileReaderTest, GW) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "SiC.gw", "GW"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -224,7 +226,7 @@ TEST_F(PotentialFileReaderTest, GW) TEST_F(PotentialFileReaderTest, GWZBL) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -235,7 +237,7 @@ TEST_F(PotentialFileReaderTest, GWZBL) TEST_F(PotentialFileReaderTest, Nb3bHarmonic) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units real"); + command("units real"); PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -246,7 +248,7 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic) TEST_F(PotentialFileReaderTest, Vashishta) { if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -260,7 +262,7 @@ TEST_F(PotentialFileReaderTest, UnitConvert) int unit_convert, flag; if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("units metal"); + command("units metal"); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber"); if (!verbose) ::testing::internal::GetCapturedStdout(); @@ -288,7 +290,7 @@ TEST_F(PotentialFileReaderTest, UnitConvert) if (!verbose) ::testing::internal::CaptureStdout(); flag = utils::get_supported_conversions(utils::ENERGY); - lmp->input->one("units real"); + command("units real"); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag); if (!verbose) ::testing::internal::GetCapturedStdout(); diff --git a/unittest/utils/test_tokenizer.cpp b/unittest/utils/test_tokenizer.cpp index de7472599c..69ec7a55d2 100644 --- a/unittest/utils/test_tokenizer.cpp +++ b/unittest/utils/test_tokenizer.cpp @@ -112,7 +112,7 @@ TEST(Tokenizer, as_vector1) TEST(Tokenizer, as_vector2) { - auto list = Tokenizer("a\\b\\c","\\").as_vector(); + auto list = Tokenizer("a\\b\\c", "\\").as_vector(); ASSERT_THAT(list[0], Eq("a")); ASSERT_THAT(list[1], Eq("b")); ASSERT_THAT(list[2], Eq("c")); @@ -121,14 +121,14 @@ TEST(Tokenizer, as_vector2) TEST(Tokenizer, as_vector3) { - auto list = Tokenizer ("a\\","\\").as_vector(); + auto list = Tokenizer("a\\", "\\").as_vector(); ASSERT_THAT(list[0], Eq("a")); ASSERT_EQ(list.size(), 1); } TEST(Tokenizer, as_vector4) { - auto list = Tokenizer ("\\a","\\").as_vector(); + auto list = Tokenizer("\\a", "\\").as_vector(); ASSERT_THAT(list[0], Eq("a")); ASSERT_EQ(list.size(), 1); } diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index 2fa17a5e5a..56a88e330a 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -533,10 +533,12 @@ TEST(Utils, strfind_dot) TEST(Utils, strfind_kim) { - ASSERT_THAT(utils::strfind("n3409jfse MO_004835508849_000 aslfjiaf", - "[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), StrEq("MO_004835508849_000")); + ASSERT_THAT( + utils::strfind("n3409jfse MO_004835508849_000 aslfjiaf", "[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), + StrEq("MO_004835508849_000")); ASSERT_THAT(utils::strfind("VanDuinChakraborty_2003_CHNO__SM_107643900657_000", - "[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), StrEq("SM_107643900657_000")); + "[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), + StrEq("SM_107643900657_000")); } TEST(Utils, bounds_case1) From 51946205ce2b4f90c9b4d1c65a7fca6b9090e5a2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 12:18:12 -0400 Subject: [PATCH 120/370] add YAML files for MLIAP nn and quadratic snap model input --- .../tests/manybody-pair-mliap_nn.yaml | 158 ++++++++++++++++++ ...l => manybody-pair-mliap_snap_linear.yaml} | 0 .../manybody-pair-mliap_snap_quadratic.yaml | 158 ++++++++++++++++++ 3 files changed, 316 insertions(+) create mode 100644 unittest/force-styles/tests/manybody-pair-mliap_nn.yaml rename unittest/force-styles/tests/{manybody-pair-mliap_snap.yaml => manybody-pair-mliap_snap_linear.yaml} (100%) create mode 100644 unittest/force-styles/tests/manybody-pair-mliap_snap_quadratic.yaml diff --git a/unittest/force-styles/tests/manybody-pair-mliap_nn.yaml b/unittest/force-styles/tests/manybody-pair-mliap_nn.yaml new file mode 100644 index 0000000000..5270c9571f --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-mliap_nn.yaml @@ -0,0 +1,158 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Wed Mar 24 12:18:23 202 +epsilon: 5e-13 +prerequisites: ! | + pair mliap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.8 mliap model nn Ta06A.nn.mliap.model descriptor + sna Ta06A.mliap.descriptor +pair_coeff: ! | + 1*8 1*8 zbl 73 73 + * * mliap Ta Ta Ta Ta Ta Ta Ta Ta +extract: ! "" +natoms: 64 +init_vdwl: -473.569864629026 +init_coul: 0 +init_stress: ! |2- + 3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184823e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00 +init_forces: ! |2 + 1 -3.7538180163781538e+00 8.8612947043788708e+00 6.7712977816732263e+00 + 2 -7.6696525239232596e+00 -3.7674335682223203e-01 -5.7958054718422760e+00 + 3 -2.9221261341045079e-01 -1.2984917885683813e+00 2.2320440844884399e+00 + 4 -4.7103509354198474e+00 9.2783458784125941e+00 4.3108702582741429e+00 + 5 -2.0331946400488916e+00 -2.9593716047756180e+00 -1.6136351145373196e+00 + 6 1.8086748683348572e+00 4.6479727629048675e+00 3.0425695895915184e-01 + 7 -3.0573043543220644e+00 -4.0575899915120264e+00 1.5283788878527900e+00 + 8 2.7148403621334427e-01 1.3063473238306007e+00 -1.1268098385676173e+00 + 9 5.2043326273129953e-01 -2.9340446386399996e+00 -7.6461969078455834e+00 + 10 -6.2786875145099508e-01 5.6606570005199308e-02 -5.3746300485699576e+00 + 11 8.1946917251451818e+00 -6.7267140406524675e+00 2.5930013855034630e+00 + 12 -1.4328402235895087e+01 -8.0774309292156197e+00 -7.6980199570965677e+00 + 13 -3.2260600618006614e+00 1.3854745225224621e+01 -1.8038061855949390e+00 + 14 -2.9498732270039856e+00 8.5589611530655674e+00 2.0530716609447816e-01 + 15 -8.6349846297038031e+00 9.1996942753987270e+00 -9.5905201240123024e+00 + 16 3.7310502876344778e+00 1.9788328492752776e+00 1.5687925430243098e+01 + 17 5.0755393464331471e+00 6.1278868384113423e+00 -1.0750955741273682e+01 + 18 1.7371660543384140e+00 3.0620693584379239e+00 7.2701166654624991e+00 + 19 -2.9132243097469201e+00 -1.1018213008189437e+00 -2.8349170179881567e+00 + 20 -1.6464048708371479e+01 2.4791517492525559e+00 3.4072780064525732e-01 + 21 3.9250706073854098e+00 -1.0562396695052145e+00 -9.1632104209006702e+00 + 22 -1.5634125465245701e+01 8.9090677007239911e+00 -1.2750204519006148e+01 + 23 2.8936071278420723e+00 5.3816164530412767e+00 7.4597216732837071e+00 + 24 3.1860163425620680e+00 4.7170150104555253e+00 6.3461114127051133e+00 + 25 8.8078411119652245e-01 -1.4554648001614754e+00 1.6812657581308246e+00 + 26 -1.8170871697803546e+00 -3.7700946621067644e-01 6.2457161242680581e-01 + 27 4.3406014531279231e+00 -2.9009678649007267e+00 5.2435008444617139e+00 + 28 -7.0542478046177770e-01 1.0981989037209707e+00 1.3116499712117630e+01 + 29 -6.6151960592236154e+00 1.6410275382967996e+00 -1.0570398181017497e+00 + 30 -3.6949627314218070e+00 2.0505225752289262e+00 -1.5676706969561256e+00 + 31 -3.1645464836586603e+00 3.4678442856969571e-01 -3.0903933004746946e+00 + 32 -7.8831496558114571e+00 4.7917666582558249e-01 8.5821461480119510e-01 + 33 1.0742815926879523e+01 -5.8142728701457189e+00 9.7282423280124952e+00 + 34 -1.3523086688998047e+00 -1.1117518205645105e-01 1.6057041203339644e+00 + 35 2.5212001799950716e+00 -2.2938190564661185e+00 5.7029334689777986e+00 + 36 1.7666626040313700e+00 -4.4698105712986091e+00 2.0563602888032650e-01 + 37 -3.8714388913204467e+00 5.6357721515897250e+00 -6.6078854304621775e+00 + 38 1.4632813171776671e+00 -3.3182377007830244e-01 -8.4412322782161375e-01 + 39 4.1718406489245972e+00 -6.3270387696640586e+00 -1.1208012916569135e+01 + 40 9.5193696695210637e+00 -7.0213638399035432e+00 -1.5692669012530696e+00 + 41 2.4000089474497699e-01 1.0045144396502914e+00 -2.3032449685213630e+00 + 42 -9.4741999244791426e+00 -6.3134658287662750e+00 -3.6928028439517893e+00 + 43 2.7218639962411728e-01 -1.3813634477251096e+01 5.5147832931992291e-01 + 44 8.0196107396135208e+00 -8.1793730426384545e+00 3.5131695854462590e+00 + 45 -1.8910274064701343e-01 3.9137627573846219e+00 -7.4450993876429399e+00 + 46 -3.5282857552811575e+00 -5.1713579630178099e+00 1.2477491203990510e+01 + 47 5.1131478665605341e+00 2.3800985688973459e+00 5.1348001359881970e+00 + 48 2.1755560727357057e+00 2.9996491762493216e+00 -9.9575511910097214e-01 + 49 -2.3978299788760209e+00 -1.2283692236805253e+01 -8.3755937565454435e+00 + 50 3.6161933080447888e+00 5.6291551969069182e+00 -6.9709721613230968e-01 + 51 -3.0166275666360352e+00 1.1037977712957442e+01 8.8691052932904171e+00 + 52 1.2943573147098917e+01 -1.1745909799528654e+01 1.6522312348562508e+01 + 53 5.8389424736085775e+00 7.5295796786576226e+00 5.5403096028203525e+00 + 54 4.6678942858445893e+00 -5.7948610984030058e+00 -4.7138910958393971e+00 + 55 4.9846400582125163e+00 -8.4400769236810902e+00 -6.5776931744173313e+00 + 56 -3.5699586538966939e-02 1.5545384984529795e+00 -5.2139902048630429e+00 + 57 2.1375440189892982e+00 -1.3001299791681296e+00 -8.9740026386466654e-01 + 58 5.2652486142639416e+00 -2.5529130533710997e+00 2.0016357749193905e-01 + 59 9.0343971306644377e+00 4.2302611807585224e+00 -1.8088550980511922e+00 + 60 -5.1586404521695464e+00 -1.5178664164309549e+01 -9.8559725391424795e+00 + 61 9.6892046530364073e-01 3.6493959386458350e+00 -8.3809793809505195e-01 + 62 -6.2693637951458694e+00 5.5593866650560679e+00 -4.0417158962655781e+00 + 63 5.8570431431678962e+00 -6.2896068000076317e+00 -3.8788666930728688e+00 + 64 7.5837965251215369e+00 7.5954689486766096e+00 1.6804021764142011e+01 +run_vdwl: -473.666568306022 +run_coul: 0 +run_stress: ! |2- + 3.9951053758431499e+02 4.0757094669497650e+02 4.3599209936956868e+02 -2.5012844114476398e+01 1.2751742945242590e+02 3.9821818278564844e+00 +run_forces: ! |2 + 1 -3.7832595710893155e+00 8.8212124103655292e+00 6.7792549500694745e+00 + 2 -7.6693903913873163e+00 -4.4331479267505980e-01 -5.8319844453604492e+00 + 3 -3.5652510811236748e-01 -1.2843261396638010e+00 2.3164336943032460e+00 + 4 -4.6688281400123417e+00 9.2569804046918627e+00 4.2532553525093961e+00 + 5 -2.0698377683688305e+00 -3.0068940885360655e+00 -1.5557558367041349e+00 + 6 1.9121936983089021e+00 4.6485144224151016e+00 3.8302570899366983e-01 + 7 -3.0000564919294019e+00 -3.9598169423628935e+00 1.4730795882443171e+00 + 8 2.2616298546615310e-01 1.3160780554993146e+00 -1.1365737437456360e+00 + 9 4.5475496885290934e-01 -3.0115904820513633e+00 -7.6802788934953448e+00 + 10 -6.5754023848348220e-01 4.3910855294922169e-02 -5.2814927356947416e+00 + 11 8.0870811363765238e+00 -6.6478157150338770e+00 2.5239196033647513e+00 + 12 -1.4266979871278297e+01 -7.9890391049193692e+00 -7.6506348180232058e+00 + 13 -3.0605842642063994e+00 1.3809674690005217e+01 -1.6731082107132822e+00 + 14 -3.0058694850615257e+00 8.5169039650285132e+00 1.8498544937038552e-01 + 15 -8.6057398167379340e+00 9.1431278151038597e+00 -9.5164336499508586e+00 + 16 3.7105123804670184e+00 1.9684880085511294e+00 1.5628485674431591e+01 + 17 5.0446625217738115e+00 6.1086935560886335e+00 -1.0684670022014132e+01 + 18 1.6342572076662352e+00 3.0978003138559700e+00 7.3023410755539730e+00 + 19 -2.9853538081785418e+00 -1.1736228416330263e+00 -2.8772549755196275e+00 + 20 -1.6354717680325663e+01 2.4069036913441169e+00 2.5852528541413577e-01 + 21 3.9596059647558470e+00 -1.1309140461374385e+00 -9.2411865520092746e+00 + 22 -1.5578599385494211e+01 8.8837889458923414e+00 -1.2717012806950681e+01 + 23 2.9286474436436607e+00 5.4115499463398438e+00 7.4875237575502283e+00 + 24 3.2309052666659346e+00 4.6724691716691664e+00 6.3076914533727404e+00 + 25 8.7447853599857761e-01 -1.4447800235404800e+00 1.6369348219913344e+00 + 26 -1.8229284577405889e+00 -3.3721763232208768e-01 6.1531223202321172e-01 + 27 4.3482945496099807e+00 -2.9274873379719288e+00 5.2404893120488989e+00 + 28 -7.6160360457911214e-01 1.1530752576673735e+00 1.3094542130299224e+01 + 29 -6.6257114998810200e+00 1.6523572981586176e+00 -1.0670925651816274e+00 + 30 -3.6586042068050459e+00 2.0111737944853250e+00 -1.5501355511382873e+00 + 31 -3.1601602861552482e+00 3.3256891161094693e-01 -3.0724685917071382e+00 + 32 -7.8275016718590731e+00 4.4236506496773642e-01 8.3868054333668041e-01 + 33 1.0688722918141039e+01 -5.7920158261872583e+00 9.6923706747923646e+00 + 34 -1.3525464452783258e+00 -1.0575652830645854e-01 1.6380965403350563e+00 + 35 2.5193832475087721e+00 -2.2598987796878789e+00 5.6810280412635601e+00 + 36 1.7111787089042565e+00 -4.4473718671663391e+00 9.6398513850121076e-02 + 37 -3.8563809307986823e+00 5.6131073606614059e+00 -6.6177968130852260e+00 + 38 1.5064516388374909e+00 -3.1694753678232956e-01 -8.3526359314898979e-01 + 39 4.1314418694153812e+00 -6.2751004763663678e+00 -1.1210904504268449e+01 + 40 9.5830290785144836e+00 -7.0395435048262769e+00 -1.6267459470122683e+00 + 41 3.1375436243120802e-01 1.0622164383329200e+00 -2.2467935230672076e+00 + 42 -9.4881290346220375e+00 -6.3542967900678029e+00 -3.7436081761319060e+00 + 43 2.2855728522521823e-01 -1.3797673758210431e+01 5.1169123226999269e-01 + 44 8.0135824689800454e+00 -8.1618220152116709e+00 3.4767795780208774e+00 + 45 -2.2793629160624870e-01 3.8533578964252726e+00 -7.3720918772105994e+00 + 46 -3.5217473183911405e+00 -5.1375353430494126e+00 1.2535347493777751e+01 + 47 5.1244898311428937e+00 2.3801653011346930e+00 5.1114297013297003e+00 + 48 2.1906793040748171e+00 3.0345200169741182e+00 -1.0179863236095192e+00 + 49 -2.4788694934316329e+00 -1.2411071815396923e+01 -8.4971983039341392e+00 + 50 3.6569038614206466e+00 5.6055766933888798e+00 -7.2525721879624516e-01 + 51 -3.1071936932427051e+00 1.1143003955179145e+01 8.9003301745210983e+00 + 52 1.2953816665492676e+01 -1.1681525536724189e+01 1.6495289315845085e+01 + 53 5.8923317047264643e+00 7.6559750818830006e+00 5.7413363341910788e+00 + 54 4.6456819257039355e+00 -5.7613868673147293e+00 -4.6785882460677595e+00 + 55 4.9036275837635479e+00 -8.4131355466563491e+00 -6.4652425471547437e+00 + 56 -2.5919766291264371e-02 1.4942725648609447e+00 -5.1846171304946838e+00 + 57 2.1354464802186661e+00 -1.3197172317543322e+00 -8.9084444403811647e-01 + 58 5.2496503717062382e+00 -2.5023030575014631e+00 1.2534239362101771e-01 + 59 9.1088663289515797e+00 4.2501608997098561e+00 -1.8293706034164023e+00 + 60 -5.2377119984886820e+00 -1.5252944642880552e+01 -9.9884309435445626e+00 + 61 9.8418569822230928e-01 3.6718229831397404e+00 -7.9620939417097958e-01 + 62 -6.2529671270584286e+00 5.5348777429740972e+00 -3.9890515783571203e+00 + 63 5.8510809377900035e+00 -6.3420520892802621e+00 -3.9437203585924383e+00 + 64 7.6647749161376320e+00 7.7322248465188412e+00 1.6865884297614787e+01 +... diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap_linear.yaml similarity index 100% rename from unittest/force-styles/tests/manybody-pair-mliap_snap.yaml rename to unittest/force-styles/tests/manybody-pair-mliap_snap_linear.yaml diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap_quadratic.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap_quadratic.yaml new file mode 100644 index 0000000000..475fc1caac --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap_quadratic.yaml @@ -0,0 +1,158 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Wed Mar 24 12:24:38 202 +epsilon: 5e-13 +prerequisites: ! | + pair mliap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.8 mliap model quadratic W.quadratic.mliap.model + descriptor sna W.quadratic.mliap.descriptor +pair_coeff: ! | + 1*8 1*8 zbl 74 74 + * * mliap W W W W W W W W +extract: ! "" +natoms: 64 +init_vdwl: 310.670038860846 +init_coul: 0 +init_stress: ! |2- + 5.6259528842196187e+02 5.7316629871796738e+02 5.8790591480137323e+02 -1.8189500835315549e+01 1.3614672500307736e+02 5.6212035897053383e+00 +init_forces: ! |2 + 1 -1.7332406552612252e+00 9.6965139437668633e+00 5.8109280039223741e+00 + 2 -8.4506855506966403e+00 1.7517630868906400e+00 -5.8585143024763751e+00 + 3 1.3067558540335114e+00 2.4533443839399922e+00 -5.3832194918864029e-01 + 4 -5.4997504048583030e+00 8.6507394288895618e+00 3.5210921442144869e+00 + 5 -5.4578004799253836e+00 -3.8166835957403560e+00 -1.9324965001410375e+00 + 6 1.8068295611859355e+00 7.7167110612740411e+00 2.2464754671860354e+00 + 7 -1.4615233556948404e+00 -4.5523205969121312e+00 5.2307165009286525e+00 + 8 1.3470528830761590e+00 1.1150099302890997e+00 -2.4124956929134638e+00 + 9 1.8536678547304528e+00 -5.9192817641183115e+00 -8.9231779770120117e+00 + 10 -1.6830129533144051e+00 -2.0004948002622096e+00 -6.7940188134883588e+00 + 11 9.3899899055663916e+00 -9.6096061996623181e+00 5.4294046031393410e+00 + 12 -1.8440182258152287e+01 -9.1578611598783599e+00 -6.9019373206621033e+00 + 13 -1.4789077352315048e+00 1.6126223605834220e+01 -2.3399418562200816e+00 + 14 -5.1192810384232743e+00 7.8887975887856649e+00 2.7987351355628833e+00 + 15 -1.1432288954023196e+01 1.2052925891647078e+01 -7.6561230955500186e+00 + 16 4.9875199325917112e+00 -7.9756500980837031e-01 1.5348327626794408e+01 + 17 3.0326448198662455e+00 1.0247763080256838e+01 -1.3162357502394531e+01 + 18 1.1912120343158321e+00 3.8795028741303881e+00 9.7535980505837134e+00 + 19 -4.1904376957856400e+00 -3.2045372808825174e+00 -1.1178952155997879e+00 + 20 -2.0524722840954009e+01 1.3584987641399842e+00 1.2643890965526294e+00 + 21 7.8962692301193274e+00 3.0756220916596053e+00 -1.0060035052224105e+01 + 22 -1.6638865872488534e+01 7.3242501928548176e+00 -1.1470088145525292e+01 + 23 3.1098873977160020e+00 8.9978923066815906e+00 7.3796685128197010e+00 + 24 3.7623303590129575e+00 3.9470381598445985e+00 8.3456006313463575e+00 + 25 2.7135762879995773e+00 1.2688233449033359e-01 2.7652325878214103e+00 + 26 -2.5567333671028858e+00 -1.5012729784955012e+00 3.8180756571583805e+00 + 27 5.4933629833598179e+00 -3.5852699914334007e-01 5.6772577899252621e+00 + 28 2.1583223591405485e+00 2.5602854563986126e+00 1.2987493211097293e+01 + 29 -9.3928065614100227e+00 8.1231719788253520e-01 -3.4139694444606663e+00 + 30 -6.5111025810175223e+00 3.9239227943865140e+00 -1.9909323666256402e+00 + 31 -4.5532920832558466e+00 2.9334735012590949e+00 -2.2603005294374805e+00 + 32 -1.1131319171235056e+01 4.0773060096293179e-01 2.3495354245782185e-01 + 33 1.1946312975015427e+01 -4.8997346173109610e+00 8.5135451343035555e+00 + 34 2.2567306848110924e-01 -9.7924723339198039e-01 1.7583322195512454e+00 + 35 2.8580692192724184e+00 -9.9224668537616911e-01 8.1615215594264985e+00 + 36 -9.5804648131257442e-02 -6.2355391184959963e+00 -1.1533359083409473e+00 + 37 -5.1866584177272408e+00 5.2276382338316552e+00 -9.4551207183301855e+00 + 38 -1.1543907922565189e+00 -1.2217116705851163e+00 7.8535042419588308e-01 + 39 7.5764294215464227e+00 -4.6563914581780939e+00 -1.4559998851452969e+01 + 40 1.1962426631242364e+01 -6.5095442931054395e+00 -3.2593809840204688e+00 + 41 4.2161422225881529e-01 -1.4729246940628351e+00 -4.8653082075157528e+00 + 42 -1.2872945210845128e+01 -6.7834573750437004e+00 -6.3019087398505946e-01 + 43 2.5785048972790117e+00 -1.6923099420445759e+01 -1.3360019377139212e+00 + 44 1.2291023950270986e+01 -1.2191603864766963e+01 2.7304006094143318e+00 + 45 -1.2398099447130371e+00 5.0658390044921555e+00 -9.2322482748129762e+00 + 46 -1.4311260929166141e+00 -5.6910264552445193e+00 1.3277999978308035e+01 + 47 6.2057343183031417e+00 3.7310981833648289e+00 4.8205098133270914e+00 + 48 3.3963650236743295e+00 2.0831245825926228e+00 -1.2673031459768591e+00 + 49 -1.8543360773247199e+00 -1.3380317233196116e+01 -8.4112300152561250e+00 + 50 -1.9920275269520710e-01 7.0107508582593869e+00 -2.6708325452002271e+00 + 51 -9.3660629689657249e-01 1.1809167034995344e+01 9.8986119959157612e+00 + 52 1.2220659999225337e+01 -1.2024509026677922e+01 1.4962970527017067e+01 + 53 7.4348387428600198e+00 7.7548706874243649e+00 4.1933368746931752e+00 + 54 7.0105713161150085e+00 -7.7007180274608169e+00 -6.5961935960226112e+00 + 55 3.2473798770902653e+00 -9.0385173613511878e+00 -8.5508326243716120e+00 + 56 4.2348804882267466e-01 4.3169490550492495e-01 -5.3478203134943731e+00 + 57 3.5009508489349979e+00 -3.3027079935021968e+00 -2.1184761311459956e+00 + 58 9.2468424036384231e+00 -4.5181490794556876e+00 2.4559890235342761e+00 + 59 9.9448793924013952e+00 4.5973129034833260e+00 -2.2322113512955504e+00 + 60 -3.6986806985028280e+00 -1.7543528229443428e+01 -1.0133821358926038e+01 + 61 -2.2233420196353229e+00 6.0781304306653574e+00 -1.8495331839082056e+00 + 62 -1.2719363808848012e+01 8.6073749589883608e+00 -4.9797073704539283e+00 + 63 7.9457470990016770e+00 -9.7673000016796276e+00 -4.3317841246475552e-01 + 64 9.3812874011747454e+00 7.3062141638106093e+00 2.1744814847410481e+01 +run_vdwl: 310.495392494539 +run_coul: 0 +run_stress: ! |2- + 5.6245390685235475e+02 5.7310155923142815e+02 5.8811705982147669e+02 -1.8382792415481248e+01 1.3530908723557451e+02 6.7996805811527254e+00 +run_forces: ! |2 + 1 -1.7474911328125362e+00 9.6453508706584969e+00 5.8264070485591564e+00 + 2 -8.4157283593600489e+00 1.6574874271599898e+00 -5.8310589262897814e+00 + 3 1.2088949261773574e+00 2.4669650164003505e+00 -4.1375090165872641e-01 + 4 -5.4649039359012761e+00 8.6435152499830856e+00 3.4462094837625115e+00 + 5 -5.4958328716797862e+00 -3.8484174335646353e+00 -1.8816778997456991e+00 + 6 1.9551787223560284e+00 7.7494231202147503e+00 2.2973472684776728e+00 + 7 -1.4123397167898091e+00 -4.4576559389423105e+00 5.1606908467828738e+00 + 8 1.3003903361118314e+00 1.1090418970773539e+00 -2.4122402377787160e+00 + 9 1.7752795626830657e+00 -5.9789440759859360e+00 -8.9434548975396595e+00 + 10 -1.7012447055310522e+00 -1.9935230569531357e+00 -6.6673307006625988e+00 + 11 9.2689566064779427e+00 -9.5287746372607316e+00 5.4104731087638704e+00 + 12 -1.8405278855921495e+01 -9.0991584859228194e+00 -6.8488708319775853e+00 + 13 -1.2996763830273808e+00 1.6069530823653931e+01 -2.2707313142490793e+00 + 14 -5.1882033738262070e+00 7.8832636277485548e+00 2.7916487158318102e+00 + 15 -1.1433449800945827e+01 1.2015094164432849e+01 -7.5825275115016781e+00 + 16 4.9454676036434462e+00 -7.8102971145205025e-01 1.5266194219606220e+01 + 17 3.0052148409052588e+00 1.0222703724442866e+01 -1.3093555057589381e+01 + 18 1.0836570454713836e+00 3.9100837051064552e+00 9.7948718675854156e+00 + 19 -4.2707464401127355e+00 -3.2934173316232527e+00 -1.1211010156027728e+00 + 20 -2.0392897715847305e+01 1.3054265260795233e+00 1.1968830911637141e+00 + 21 7.9027972563135283e+00 2.9933448022464120e+00 -1.0141811195436880e+01 + 22 -1.6575655480795024e+01 7.3026015885081472e+00 -1.1453084247555879e+01 + 23 3.1438035132341287e+00 9.0208182590437627e+00 7.4001520562013852e+00 + 24 3.8345333002034385e+00 3.8688922268567087e+00 8.2635479168723016e+00 + 25 2.6893003750410522e+00 1.3495734265712933e-01 2.6770556576379549e+00 + 26 -2.5895248886874898e+00 -1.4293305889359713e+00 3.8291245405081260e+00 + 27 5.5060054332311656e+00 -4.1092061919393136e-01 5.6759895801356688e+00 + 28 2.1307408306936098e+00 2.6175526554889608e+00 1.2958660769748445e+01 + 29 -9.3633952447569087e+00 8.2665579439215930e-01 -3.4012747321257448e+00 + 30 -6.4533544693943297e+00 3.8387646522939547e+00 -2.0200114390690862e+00 + 31 -4.5312579127038672e+00 2.9434281499085380e+00 -2.2589125870011584e+00 + 32 -1.1081437585586908e+01 3.5221507626974347e-01 1.7034641632139044e-01 + 33 1.1876109082707279e+01 -4.8655564590595244e+00 8.4901635945810785e+00 + 34 1.9834861495951994e-01 -9.7867922827610787e-01 1.7689988369185765e+00 + 35 2.8755972285806117e+00 -9.4201232104253185e-01 8.1427329437299605e+00 + 36 -1.7696676342095063e-01 -6.2050030582426956e+00 -1.2610314329006926e+00 + 37 -5.1523185432926066e+00 5.1647495629610471e+00 -9.4596116018450456e+00 + 38 -1.0982182558331921e+00 -1.1973914898033993e+00 8.2357032136004271e-01 + 39 7.5153819798537249e+00 -4.6353686206926801e+00 -1.4561478300809743e+01 + 40 1.2018485301986439e+01 -6.4889114819969862e+00 -3.3179507002516861e+00 + 41 5.3906537639254815e-01 -1.3597164515464635e+00 -4.7572664553057376e+00 + 42 -1.2853367469523606e+01 -6.8243263403454719e+00 -7.0954222980753212e-01 + 43 2.5285681786651231e+00 -1.6882295131334587e+01 -1.3986624925913076e+00 + 44 1.2309710907856807e+01 -1.2175400941985238e+01 2.6677164515852514e+00 + 45 -1.3287685848983446e+00 4.9721749381786715e+00 -9.1534484515246355e+00 + 46 -1.4302864380872948e+00 -5.6407929749476793e+00 1.3337675572559966e+01 + 47 6.2320161927247124e+00 3.7264499027617033e+00 4.8100453121557578e+00 + 48 3.4140183611989756e+00 2.1640838168269934e+00 -1.2936781336070275e+00 + 49 -1.9593115645555264e+00 -1.3493991739193522e+01 -8.5023532432195843e+00 + 50 -1.6811489988289596e-01 6.9681072464297396e+00 -2.7188888125967106e+00 + 51 -1.0469270161190001e+00 1.1884430462587432e+01 9.9090099481589125e+00 + 52 1.2258922313552624e+01 -1.1933013587721307e+01 1.4931067313457525e+01 + 53 7.4707442724281288e+00 7.8432472024360917e+00 4.3940747538426654e+00 + 54 6.9725677862692397e+00 -7.6678940689959383e+00 -6.5509217426800008e+00 + 55 3.1754349262716173e+00 -9.0126325358351416e+00 -8.4265432974728931e+00 + 56 4.0310136221619780e-01 3.3628916654912500e-01 -5.3158911291318605e+00 + 57 3.5009222797756716e+00 -3.3989600099867601e+00 -2.1369392158489036e+00 + 58 9.2532114410873234e+00 -4.4437952950838877e+00 2.3641140155667579e+00 + 59 1.0015845748025313e+01 4.6123938091542342e+00 -2.2569748666852796e+00 + 60 -3.7800808893756161e+00 -1.7584651166860183e+01 -1.0234679510276377e+01 + 61 -2.1980530287652753e+00 6.1071583911470810e+00 -1.7912415049492632e+00 + 62 -1.2705161798029133e+01 8.5765301471185520e+00 -4.9056271749898661e+00 + 63 7.9321561763633355e+00 -9.8033451737328594e+00 -4.9729640856821433e-01 + 64 9.4795662420049851e+00 7.4221786097433808e+00 2.1786648548971794e+01 +... From 9d3e37b1028b16ba14c3fed101e10036440333fd Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 12:43:47 -0400 Subject: [PATCH 121/370] Add more python variable tests --- unittest/python/func.py | 10 ++-- unittest/python/test_python_package.cpp | 65 ++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/unittest/python/func.py b/unittest/python/func.py index 27704660a6..cc2269c435 100644 --- a/unittest/python/func.py +++ b/unittest/python/func.py @@ -4,6 +4,11 @@ from __future__ import print_function def square(val): return val*val +def bool_to_val(txt): + if txt.upper() in ["TRUE", "YES"]: + return 1.0 + return 0.0 + def printnum(): print("2.25") @@ -11,8 +16,7 @@ def printtxt(): print("sometext") def getidxvar(lmpptr): - from lammps import lammps, LMP_VAR_EQUAL + from lammps import lammps lmp = lammps(ptr=lmpptr) - - val = lmp.extract_variable("idx",None,LMP_VAR_EQUAL) + val = lmp.extract_variable("idx") print(val) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index 137278a9d2..a7cf52c74e 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -14,6 +14,7 @@ #include "atom.h" #include "info.h" #include "input.h" +#include "variable.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -58,6 +59,13 @@ protected: return output; } + double get_variable_value(const std::string & name) { + char * str = utils::strdup(fmt::format("v_{}", name)); + double value = lmp->input->variable->compute_equal(str); + delete [] str; + return value; + } + void SetUp() override { const char *args[] = {"PythonPackageTest", "-log", "none", "-echo", "screen", "-nocite"}; @@ -100,13 +108,67 @@ TEST_F(PythonPackageTest, InvokeFunctionFromFile) HIDE_OUTPUT([&] { command("python printnum file ${input_dir}/func.py"); }); - + auto output = CAPTURE_OUTPUT([&]() { command("python printnum invoke"); }); ASSERT_THAT(output, HasSubstr("2.25\n")); } +TEST_F(PythonPackageTest, InvokeFunctionPassInt) +{ + // execute python function, passing integer as argument + HIDE_OUTPUT([&] { + command("variable sq python square"); + command("python square input 1 2 format ii return v_sq file ${input_dir}/func.py"); + }); + + ASSERT_EQ(get_variable_value("sq"), 4.0); +} + +TEST_F(PythonPackageTest, InvokeFunctionPassFloat) +{ + // execute python function, passing float as argument + HIDE_OUTPUT([&] { + command("variable sq python square"); + command("python square input 1 2.5 format ff return v_sq file ${input_dir}/func.py"); + }); + + ASSERT_EQ(get_variable_value("sq"), 6.25); +} + +TEST_F(PythonPackageTest, InvokeFunctionPassString) +{ + // execute python function, passing string as argument + HIDE_OUTPUT([&] { + command("variable val python bool_to_val"); + command("python bool_to_val input 1 \"true\" format sf return v_val file ${input_dir}/func.py"); + }); + + ASSERT_EQ(get_variable_value("val"), 1.0); +} + +TEST_F(PythonPackageTest, InvokeFunctionPassStringVariable) +{ + // execute python function, passing string variable as argument + HIDE_OUTPUT([&] { + command("variable val python bool_to_val"); + command("python bool_to_val input 1 v_str format sf return v_val file ${input_dir}/func.py"); + }); + + HIDE_OUTPUT([&] { + command("variable str string \"true\""); + }); + + ASSERT_EQ(get_variable_value("val"), 1.0); + + HIDE_OUTPUT([&] { + command("variable str string \"false\""); + }); + + ASSERT_EQ(get_variable_value("val"), 0.0); +} + TEST_F(PythonPackageTest, InvokeOtherFunctionFromFile) { // execute another python function from same file @@ -137,6 +199,7 @@ TEST_F(PythonPackageTest, InvokeFunctionThatUsesLAMMPSModule) TEST_F(PythonPackageTest, python_variable) { + // define variable that evaluates a python function HIDE_OUTPUT([&] { command("variable sq python square"); command("variable val index 1.5"); From cc54f553e0d09ecaa0a15881f1598c33765d2d9c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 14:35:48 -0400 Subject: [PATCH 122/370] complete tests for if command booleans --- unittest/commands/test_variables.cpp | 56 ++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 7106867894..37856184eb 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -295,19 +295,25 @@ TEST_F(VariableTest, IfCommand) if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - command("if 1>0 then 'print \".*bingo!\"'"); + command("if 1>0 then 'print \"bingo!\"'"); auto text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); ::testing::internal::CaptureStdout(); - command("if (1>=0) then 'print \"bingo!\"'"); + command("if 1>2 then 'print \"bingo!\"' else 'print \"nope?\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; - ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); ::testing::internal::CaptureStdout(); - command("if (-1.0e-1<0.0E+0) then 'print \"bingo!\"'"); + command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); + + ::testing::internal::CaptureStdout(); + command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'"); text = ::testing::internal::GetCapturedStdout(); if (verbose) std::cout << text; ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); @@ -324,8 +330,50 @@ TEST_F(VariableTest, IfCommand) if (verbose) std::cout << text; ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + ::testing::internal::CaptureStdout(); + command("if (1>=2)&&(0&&1) then 'print \"missed\"' else 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if !1 then 'print \"missed\"' else 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if !(a==b) then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if x==x|^1==0 then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + + ::testing::internal::CaptureStdout(); + command("if x!=x|^a!=b then 'print \"bingo!\"'"); + text = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << text; + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", command("if () then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if \"1 1\" then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if 1a then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if 1=<2 then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if 1!=a then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if 1&<2 then 'print \"bingo!\"'");); + TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", + command("if 1|<2 then 'print \"bingo!\"'");); TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", command("if (1)( then 'print \"bingo!\"'");); TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", From 407212153ff8a6d24d28dc12d86f209690a406c7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 15:14:58 -0400 Subject: [PATCH 123/370] create more variables of different styles --- unittest/commands/test_variables.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 37856184eb..c558e02376 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -168,17 +168,22 @@ TEST_F(VariableTest, CreateDelete) command("variable nine file test_variable.file"); command("variable ten internal 1.0"); command("variable ten internal 10.0"); + command("variable ten1 universe 1 2 3 4"); + command("variable ten2 uloop 4"); + command("variable ten3 uloop 4 pad"); command("variable dummy index 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 13); + ASSERT_EQ(variable->nvar, 16); if (!verbose) ::testing::internal::CaptureStdout(); command("variable dummy delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 12); + ASSERT_EQ(variable->nvar, 15); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy delete xxx");); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop -1");); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop 10 1");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable two string xxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", @@ -191,6 +196,12 @@ TEST_F(VariableTest, CreateDelete) command("variable eleven atomfile test_variable.atomfile");); TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", command("variable nine1 file test_variable.xxx");); + TEST_FAILURE(".*ERROR: World variable count doesn't match # of partitions.*", + command("variable ten10 world xxx xxx");); + TEST_FAILURE(".*ERROR: All universe/uloop variables must have same # of values.*", + command("variable ten4 uloop 2");); + TEST_FAILURE(".*ERROR: Incorrect conversion in format string.*", + command("variable ten11 format two \"%08f\"");); } TEST_F(VariableTest, AtomicSystem) @@ -204,8 +215,16 @@ TEST_F(VariableTest, AtomicSystem) command("variable id atom type"); command("variable id atom id"); command("variable ten atomfile test_variable.atomfile"); + command("compute press all pressure NULL pair"); + command("fix press all ave/time 1 1 1 c_press mode vector"); + command("variable press vector f_press"); + command("variable stress vector v_press+vol"); + command("variable pmax equal max(f_press)"); + command("run 0 post no"); + if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 3); + ASSERT_EQ(variable->nvar, 6); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 0.0); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable one atom x");); From 1c9c46d2c1811531a18b05b10ec0f33f8104ecee Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 15:42:38 -0400 Subject: [PATCH 124/370] Add tests to cover python command --- src/PYTHON/python_impl.cpp | 1 + unittest/python/func.py | 8 ++ unittest/python/run.py | 2 + unittest/python/test_python_package.cpp | 100 +++++++++++++++++++++++- 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 unittest/python/run.py diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 1f45ca6635..4c43ca3744 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -506,6 +506,7 @@ int PythonImpl::create_entry(char *name) "cannot be used unless output is a string"); pfuncs[ifunc].length_longstr = length_longstr; pfuncs[ifunc].longstr = new char[length_longstr+1]; + pfuncs[ifunc].longstr[length_longstr] = '\0'; } if (strstr(ostr,"v_") != ostr) error->all(FLERR,"Invalid python command"); diff --git a/unittest/python/func.py b/unittest/python/func.py index cc2269c435..cf8db41670 100644 --- a/unittest/python/func.py +++ b/unittest/python/func.py @@ -9,6 +9,11 @@ def bool_to_val(txt): return 1.0 return 0.0 +def val_to_bool(val): + if val != 0: + return "True" + return "False" + def printnum(): print("2.25") @@ -20,3 +25,6 @@ def getidxvar(lmpptr): lmp = lammps(ptr=lmpptr) val = lmp.extract_variable("idx") print(val) + +def longstr(): + return "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus." diff --git a/unittest/python/run.py b/unittest/python/run.py new file mode 100644 index 0000000000..7cdb205f50 --- /dev/null +++ b/unittest/python/run.py @@ -0,0 +1,2 @@ +from __future__ import print_function +print("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus.") diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index a7cf52c74e..f7a184b6b3 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -15,6 +15,7 @@ #include "info.h" #include "input.h" #include "variable.h" +#include "library.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -31,11 +32,14 @@ std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER); // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; +const char * LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus."; + using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::MatchesRegex; using ::testing::StrEq; +using ::testing::Eq; using ::testing::HasSubstr; class PythonPackageTest : public ::testing::Test { @@ -45,6 +49,8 @@ protected: void command(const std::string &line) { lmp->input->one(line.c_str()); } + void command_string(const std::string &lines) { lammps_commands_string(lmp, lines.c_str()); } + void HIDE_OUTPUT(std::function f) { if (!verbose) ::testing::internal::CaptureStdout(); f(); @@ -66,6 +72,10 @@ protected: return value; } + std::string get_variable_string(const std::string & name) { + return lmp->input->variable->retrieve(name.c_str()); + } + void SetUp() override { const char *args[] = {"PythonPackageTest", "-log", "none", "-echo", "screen", "-nocite"}; @@ -121,6 +131,7 @@ TEST_F(PythonPackageTest, InvokeFunctionPassInt) HIDE_OUTPUT([&] { command("variable sq python square"); command("python square input 1 2 format ii return v_sq file ${input_dir}/func.py"); + command("python square invoke"); }); ASSERT_EQ(get_variable_value("sq"), 4.0); @@ -169,6 +180,38 @@ TEST_F(PythonPackageTest, InvokeFunctionPassStringVariable) ASSERT_EQ(get_variable_value("val"), 0.0); } +TEST_F(PythonPackageTest, InvokeStringFunction) +{ + // execute python function, passing string variable as argument + HIDE_OUTPUT([&] { + command("variable str python val_to_bool"); + command("python val_to_bool input 1 v_val format is return v_str file ${input_dir}/func.py"); + }); + + HIDE_OUTPUT([&] { + command("variable val equal 0"); + }); + + ASSERT_THAT(get_variable_string("str"), StrEq("False")); + + HIDE_OUTPUT([&] { + command("variable val equal 1"); + }); + + ASSERT_THAT(get_variable_string("str"), StrEq("True")); +} + +TEST_F(PythonPackageTest, InvokeLongStringFunction) +{ + // execute python function, passing string variable as argument + HIDE_OUTPUT([&] { + command("variable str python longstr"); + command("python longstr format s length 72 return v_str file ${input_dir}/func.py"); + }); + + ASSERT_THAT(get_variable_string("str"), StrEq(LOREM_IPSUM)); +} + TEST_F(PythonPackageTest, InvokeOtherFunctionFromFile) { // execute another python function from same file @@ -211,6 +254,61 @@ TEST_F(PythonPackageTest, python_variable) ASSERT_THAT(output, MatchesRegex("print.*2.25.*")); } +TEST_F(PythonPackageTest, InlineFunction) +{ + // define variable that evaluates a python function + HIDE_OUTPUT([&] { + command("variable fact python factorial"); + command("python factorial input 1 v_n return v_fact format ii here \"\"\"\n" + "def factorial(n):\n" + " if n == 0 or n == 1: return 1\n" + " return n*factorial(n-1)\n" + "\"\"\""); + }); + + HIDE_OUTPUT([&] { + command("variable n equal 1"); + }); + + ASSERT_EQ(get_variable_value("fact"), 1.0); + + HIDE_OUTPUT([&] { + command("variable n equal 2"); + }); + + ASSERT_EQ(get_variable_value("fact"), 2.0); + + HIDE_OUTPUT([&] { + command("variable n equal 3"); + }); + + ASSERT_EQ(get_variable_value("fact"), 6.0); +} + +TEST_F(PythonPackageTest, RunSource) +{ + // execute python script from file + auto output = CAPTURE_OUTPUT([&] { + command("python xyz source ${input_dir}/run.py"); + }); + + ASSERT_THAT(output, HasSubstr(LOREM_IPSUM)); +} + +TEST_F(PythonPackageTest, RunSourceInline) +{ + // execute inline python script + auto output = CAPTURE_OUTPUT([&] { + command("python xyz source \"\"\"\n" + "from __future__ import print_function\n" + "print(2+2)\n" + "\"\"\"" + ); + }); + + ASSERT_THAT(output, HasSubstr("4")); +} + } // namespace LAMMPS_NS int main(int argc, char **argv) @@ -220,7 +318,7 @@ int main(int argc, char **argv) // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { - std::vector env = split_words(var); + auto env = split_words(var); for (auto arg : env) { if (arg == "-v") { verbose = true; From b15502ddc861526a72f4041896fbabc5e0b64337 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 15:53:00 -0400 Subject: [PATCH 125/370] Add utils::split_lines --- src/utils.cpp | 8 ++++++++ src/utils.h | 6 ++++++ unittest/utils/test_utils.cpp | 17 +++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index b5576b9f27..e733d7eaae 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -851,6 +851,14 @@ std::vector utils::split_words(const std::string &text) return list; } +/* ---------------------------------------------------------------------- + Convert multi-line string into lines +------------------------------------------------------------------------- */ +std::vector utils::split_lines(const std::string &text) +{ + return Tokenizer(text, "\n").as_vector(); +} + /* ---------------------------------------------------------------------- Return whether string is a valid integer number ------------------------------------------------------------------------- */ diff --git a/src/utils.h b/src/utils.h index eab81f1343..ec4dd6ae85 100644 --- a/src/utils.h +++ b/src/utils.h @@ -321,6 +321,12 @@ namespace LAMMPS_NS { std::vector split_words(const std::string &text); + /** Take multi-line text and split into lines + * + * \param text string that should be split + * \return STL vector with the lines */ + std::vector split_lines(const std::string &text); + /** Check if string can be converted to valid integer * * \param str string that should be checked diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index 2fa17a5e5a..2a87f1c347 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -113,7 +113,7 @@ TEST(Utils, count_words_with_extra_spaces) TEST(Utils, split_words_simple) { - std::vector list = utils::split_words("one two three"); + auto list = utils::split_words("one two three"); ASSERT_EQ(list.size(), 3); ASSERT_THAT(list[0], StrEq("one")); ASSERT_THAT(list[1], StrEq("two")); @@ -122,7 +122,7 @@ TEST(Utils, split_words_simple) TEST(Utils, split_words_quoted) { - std::vector list = utils::split_words("one 'two' \"three\""); + auto list = utils::split_words("one 'two' \"three\""); ASSERT_EQ(list.size(), 3); ASSERT_THAT(list[0], StrEq("one")); ASSERT_THAT(list[1], StrEq("two")); @@ -131,7 +131,7 @@ TEST(Utils, split_words_quoted) TEST(Utils, split_words_escaped) { - std::vector list = utils::split_words("1\\' '\"two\"' 3\\\""); + auto list = utils::split_words("1\\' '\"two\"' 3\\\""); ASSERT_EQ(list.size(), 3); ASSERT_THAT(list[0], StrEq("1\\'")); ASSERT_THAT(list[1], StrEq("\"two\"")); @@ -140,13 +140,22 @@ TEST(Utils, split_words_escaped) TEST(Utils, split_words_quote_in_quoted) { - std::vector list = utils::split_words("one 't\\'wo' \"th\\\"ree\""); + auto list = utils::split_words("one 't\\'wo' \"th\\\"ree\""); ASSERT_EQ(list.size(), 3); ASSERT_THAT(list[0], StrEq("one")); ASSERT_THAT(list[1], StrEq("t\\'wo")); ASSERT_THAT(list[2], StrEq("th\\\"ree")); } +TEST(Utils, split_lines) +{ + auto list = utils::split_lines(" line 1\nline 2 \n line 3 \n"); + ASSERT_EQ(list.size(), 3); + ASSERT_THAT(list[0], StrEq(" line 1")); + ASSERT_THAT(list[1], StrEq("line 2 ")); + ASSERT_THAT(list[2], StrEq(" line 3 ")); +} + TEST(Utils, valid_integer1) { ASSERT_TRUE(utils::is_integer("10")); From 45191e9f7c3c21a8f445c3c9699037838bb382cf Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 16:33:39 -0400 Subject: [PATCH 126/370] Refactor and add fix python/invoke tests --- unittest/python/test_python_package.cpp | 115 +++++++++++++----------- unittest/testing/core.h | 46 ++++++++-- unittest/testing/systems/melt.h | 28 +++--- 3 files changed, 117 insertions(+), 72 deletions(-) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index f7a184b6b3..5a36112781 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -24,14 +24,14 @@ #include #include +#include "../testing/core.h" +#include "../testing/systems/melt.h" + // location of '*.py' files required by tests #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER); -// whether to print verbose output (i.e. not capturing LAMMPS screen output). -bool verbose = false; - const char * LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus."; using LAMMPS_NS::utils::split_words; @@ -42,51 +42,12 @@ using ::testing::StrEq; using ::testing::Eq; using ::testing::HasSubstr; -class PythonPackageTest : public ::testing::Test { +class PythonPackageTest : public LAMMPSTest { protected: - LAMMPS *lmp; - Info *info; - - void command(const std::string &line) { lmp->input->one(line.c_str()); } - - void command_string(const std::string &lines) { lammps_commands_string(lmp, lines.c_str()); } - - void HIDE_OUTPUT(std::function f) { - if (!verbose) ::testing::internal::CaptureStdout(); - f(); - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - std::string CAPTURE_OUTPUT(std::function f) { - ::testing::internal::CaptureStdout(); - f(); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; - return output; - } - - double get_variable_value(const std::string & name) { - char * str = utils::strdup(fmt::format("v_{}", name)); - double value = lmp->input->variable->compute_equal(str); - delete [] str; - return value; - } - - std::string get_variable_string(const std::string & name) { - return lmp->input->variable->retrieve(name.c_str()); - } - - void SetUp() override + void InitSystem() override { - const char *args[] = {"PythonPackageTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - HIDE_OUTPUT([&] { - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - }); - ASSERT_NE(lmp, nullptr); - info = new Info(lmp); if (!info->has_package("PYTHON")) GTEST_SKIP(); + HIDE_OUTPUT([&] { command("units real"); command("dimension 3"); @@ -100,15 +61,15 @@ protected: command("variable input_dir index " + INPUT_FOLDER); }); } +}; - void TearDown() override +class FixPythonInvokeTest : public MeltTest { +protected: + void InitSystem() override { - HIDE_OUTPUT([&] { - delete info; - delete lmp; - info = nullptr; - lmp = nullptr; - }); + if (!info->has_package("PYTHON")) GTEST_SKIP(); + + MeltTest::InitSystem(); } }; @@ -309,6 +270,56 @@ TEST_F(PythonPackageTest, RunSourceInline) ASSERT_THAT(output, HasSubstr("4")); } +TEST_F(FixPythonInvokeTest, end_of_step) +{ + HIDE_OUTPUT([&] { + command("python end_of_step_callback here \"\"\"\n" + "from __future__ import print_function\n" + "def end_of_step_callback(ptr):\n" + " print(\"PYTHON_END_OF_STEP\")\n" + "\"\"\""); + command("fix eos all python/invoke 10 end_of_step end_of_step_callback"); + }); + + auto output = CAPTURE_OUTPUT([&] { + command("run 50"); + }); + + auto lines = utils::split_lines(output); + int count = 0; + + for(auto & line : lines) { + if (line == "PYTHON_END_OF_STEP") ++count; + } + + ASSERT_EQ(count, 5); +} + +TEST_F(FixPythonInvokeTest, post_force) +{ + HIDE_OUTPUT([&] { + command("python post_force_callback here \"\"\"\n" + "from __future__ import print_function\n" + "def post_force_callback(ptr, vflag):\n" + " print(\"PYTHON_POST_FORCE\")\n" + "\"\"\""); + command("fix pf all python/invoke 10 post_force post_force_callback"); + }); + + auto output = CAPTURE_OUTPUT([&] { + command("run 50"); + }); + + auto lines = utils::split_lines(output); + int count = 0; + + for(auto & line : lines) { + if (line == "PYTHON_POST_FORCE") ++count; + } + + ASSERT_EQ(count, 5); +} + } // namespace LAMMPS_NS int main(int argc, char **argv) diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 5852f7fd06..4dc15a5327 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -16,9 +16,12 @@ #include "info.h" #include "input.h" #include "lammps.h" +#include "variable.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include + using namespace LAMMPS_NS; using ::testing::MatchesRegex; @@ -45,29 +48,58 @@ class LAMMPSTest : public ::testing::Test { public: void command(const std::string &line) { lmp->input->one(line.c_str()); } + void HIDE_OUTPUT(std::function f) { + if (!verbose) ::testing::internal::CaptureStdout(); + f(); + if (!verbose) ::testing::internal::GetCapturedStdout(); + } + + std::string CAPTURE_OUTPUT(std::function f) { + ::testing::internal::CaptureStdout(); + f(); + auto output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + return output; + } + + double get_variable_value(const std::string & name) { + char * str = utils::strdup(fmt::format("v_{}", name)); + double value = lmp->input->variable->compute_equal(str); + delete [] str; + return value; + } + + std::string get_variable_string(const std::string & name) { + return lmp->input->variable->retrieve(name.c_str()); + } + protected: const char *testbinary = "LAMMPSTest"; LAMMPS *lmp; + Info *info; void SetUp() override { const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + HIDE_OUTPUT([&] { + lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + info = new Info(lmp); + }); InitSystem(); - if (!verbose) ::testing::internal::GetCapturedStdout(); } virtual void InitSystem() {} void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - lmp = nullptr; - if (!verbose) ::testing::internal::GetCapturedStdout(); + HIDE_OUTPUT([&] { + delete info; + delete lmp; + info = nullptr; + lmp = nullptr; + }); } }; diff --git a/unittest/testing/systems/melt.h b/unittest/testing/systems/melt.h index 4189a6b771..5ac92f562b 100644 --- a/unittest/testing/systems/melt.h +++ b/unittest/testing/systems/melt.h @@ -19,23 +19,25 @@ class MeltTest : public LAMMPSTest { protected: virtual void InitSystem() override { - command("units lj"); - command("atom_style atomic"); - command("atom_modify map yes"); + HIDE_OUTPUT([&] { + command("units lj"); + command("atom_style atomic"); + command("atom_modify map yes"); - command("lattice fcc 0.8442"); - command("region box block 0 2 0 2 0 2"); - command("create_box 1 box"); - command("create_atoms 1 box"); - command("mass 1 1.0"); + command("lattice fcc 0.8442"); + command("region box block 0 2 0 2 0 2"); + command("create_box 1 box"); + command("create_atoms 1 box"); + command("mass 1 1.0"); - command("velocity all create 3.0 87287"); + command("velocity all create 3.0 87287"); - command("pair_style lj/cut 2.5"); - command("pair_coeff 1 1 1.0 1.0 2.5"); + command("pair_style lj/cut 2.5"); + command("pair_coeff 1 1 1.0 1.0 2.5"); - command("neighbor 0.3 bin"); - command("neigh_modify every 20 delay 0 check no"); + command("neighbor 0.3 bin"); + command("neigh_modify every 20 delay 0 check no"); + }); } }; From 157698543fa85ed6d849f5f1418d658b5e3f42d3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 16:47:08 -0400 Subject: [PATCH 127/370] add tests for "next" command --- unittest/commands/test_variables.cpp | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index c558e02376..476874ec74 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -401,6 +401,47 @@ TEST_F(VariableTest, IfCommand) command("if (v_one==1.0)&&(2>=1) then 'print \"bingo!\"'");); } +TEST_F(VariableTest, NextCommand) +{ + file_vars(); + + if (!verbose) ::testing::internal::CaptureStdout(); + command("variable one index 1 2"); + command("variable two equal 2"); + command("variable three file test_variable.file"); + command("variable four loop 2 4"); + command("variable five index 1 2"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 1); + ASSERT_THAT(variable->retrieve("three"), StrEq("one")); + if (!verbose) ::testing::internal::CaptureStdout(); + command("next one"); + command("next three"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 2); + ASSERT_THAT(variable->retrieve("three"), StrEq("two")); + ASSERT_GE(variable->find("one"), 0); + if (!verbose) ::testing::internal::CaptureStdout(); + command("next one"); + command("next three"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + // index style variable is deleted if no more next element + ASSERT_EQ(variable->find("one"), -1); + ASSERT_GE(variable->find("three"), 0); + if (!verbose) ::testing::internal::CaptureStdout(); + command("next three"); + command("next three"); + command("next three"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + // file style variable is deleted if no more next element + ASSERT_EQ(variable->find("three"), -1); + + TEST_FAILURE(".*ERROR: Illegal next command.*", command("next");); + TEST_FAILURE(".*ERROR: Invalid variable 'xxx' in next command.*", command("next xxx");); + TEST_FAILURE(".*ERROR: Invalid variable style with next command.*", command("next two");); + TEST_FAILURE(".*ERROR: All variables in next command must have same style.*", + command("next five four");); +} } // namespace LAMMPS_NS int main(int argc, char **argv) From aab51fe70e5db178bdac8e5599751e9b2f9e1dba Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 16:47:56 -0400 Subject: [PATCH 128/370] more coverage of utility functions in Variable class --- unittest/commands/test_variables.cpp | 61 +++++++++++++++++++++------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 476874ec74..30bbccf4d9 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -71,7 +71,8 @@ protected: void SetUp() override { - const char *args[] = {"VariableTest", "-log", "none", "-echo", "screen", "-nocite"}; + const char *args[] = {"VariableTest", "-log", "none", "-echo", "screen", + "-nocite", "-v", "num", "1"}; char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); if (!verbose) ::testing::internal::CaptureStdout(); @@ -150,7 +151,7 @@ protected: TEST_F(VariableTest, CreateDelete) { file_vars(); - ASSERT_EQ(variable->nvar, 0); + ASSERT_EQ(variable->nvar, 1); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1 2 3 4"); command("variable two equal 1"); @@ -160,7 +161,7 @@ TEST_F(VariableTest, CreateDelete) command("variable four1 loop 4"); command("variable four2 loop 2 4"); command("variable five1 loop 100 pad"); - command("variable five2 loop 100 200 pad"); + command("variable five2 loop 10 200 pad"); command("variable six world one"); command("variable seven format two \"%5.2f\""); command("variable eight getenv PWD"); @@ -173,17 +174,32 @@ TEST_F(VariableTest, CreateDelete) command("variable ten3 uloop 4 pad"); command("variable dummy index 0"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 16); + ASSERT_EQ(variable->nvar, 17); if (!verbose) ::testing::internal::CaptureStdout(); command("variable dummy delete"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 15); + ASSERT_EQ(variable->nvar, 16); + ASSERT_THAT(variable->retrieve("three"), StrEq("three")); + variable->set_string("three", "four"); + ASSERT_THAT(variable->retrieve("three"), StrEq("four")); + ASSERT_THAT(variable->retrieve("four2"), StrEq("2")); + ASSERT_THAT(variable->retrieve("five1"), StrEq("001")); + ASSERT_THAT(variable->retrieve("seven"), StrEq(" 2.00")); + ASSERT_THAT(variable->retrieve("ten"), StrEq("1")); + + ASSERT_EQ(variable->equalstyle(variable->find("one")), 0); + ASSERT_EQ(variable->equalstyle(variable->find("two")), 1); + ASSERT_EQ(variable->equalstyle(variable->find("ten")), 1); + + ASSERT_EQ(variable->internalstyle(variable->find("two")), 0); + ASSERT_EQ(variable->internalstyle(variable->find("ten")), 1); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy delete xxx");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop -1");); TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop 10 1");); + TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy xxxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable two string xxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", @@ -202,6 +218,8 @@ TEST_F(VariableTest, CreateDelete) command("variable ten4 uloop 2");); TEST_FAILURE(".*ERROR: Incorrect conversion in format string.*", command("variable ten11 format two \"%08f\"");); + TEST_FAILURE(".*ERROR: Variable name 'ten@12' must have only alphanumeric characters or.*", + command("variable ten@12 index one two three");); } TEST_F(VariableTest, AtomicSystem) @@ -218,16 +236,28 @@ TEST_F(VariableTest, AtomicSystem) command("compute press all pressure NULL pair"); command("fix press all ave/time 1 1 1 c_press mode vector"); command("variable press vector f_press"); - command("variable stress vector v_press+vol"); - command("variable pmax equal max(f_press)"); + command("variable press vector f_press+vol"); + command("variable pmax equal max(v_press)"); + command("variable psum equal sum(v_press)"); command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 6); - ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 0.0); + ASSERT_EQ(variable->nvar, 7); + + ASSERT_EQ(variable->atomstyle(variable->find("one")), 0); + ASSERT_EQ(variable->atomstyle(variable->find("id")), 1); + ASSERT_EQ(variable->atomstyle(variable->find("ten")), 1); + + ASSERT_EQ(variable->vectorstyle(variable->find("one")), 0); + ASSERT_EQ(variable->vectorstyle(variable->find("press")), 1); + + ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 64.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_psum"), 6 * 64.0); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable one atom x");); + TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", + command("variable one vector f_press");); TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", command("variable ten1 atomfile test_variable.xxx");); } @@ -235,7 +265,7 @@ TEST_F(VariableTest, AtomicSystem) TEST_F(VariableTest, Expressions) { atomic_system(); - ASSERT_EQ(variable->nvar, 0); + ASSERT_EQ(variable->nvar, 1); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal 2"); @@ -255,9 +285,10 @@ TEST_F(VariableTest, Expressions) command("variable ten6 equal (1<=v_one)&&(v_ten>=0.2)"); command("variable ten7 equal !(1set("dummy index 1 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 18); + ASSERT_EQ(variable->nvar, 21); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); @@ -282,6 +313,8 @@ TEST_F(VariableTest, Expressions) TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); + TEST_FAILURE(".*ERROR: Variable ten9: has a circular dependency.*", + command("print \"${ten9}\"");); } TEST_F(VariableTest, Functions) @@ -289,14 +322,14 @@ TEST_F(VariableTest, Functions) atomic_system(); file_vars(); - ASSERT_EQ(variable->nvar, 0); + ASSERT_EQ(variable->nvar, 1); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); command("variable four equal atan2()"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 4); + ASSERT_EQ(variable->nvar, 5); int ivar = variable->find("two"); ASSERT_GT(variable->compute_equal(ivar), 0.99); From 81e8676c7e8fe1566817decacc2f65cf4e5989fd Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 17:10:15 -0400 Subject: [PATCH 129/370] Prepare python/move unittest --- unittest/force-styles/tests/py_nve.py | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 unittest/force-styles/tests/py_nve.py diff --git a/unittest/force-styles/tests/py_nve.py b/unittest/force-styles/tests/py_nve.py new file mode 100644 index 0000000000..4740c85597 --- /dev/null +++ b/unittest/force-styles/tests/py_nve.py @@ -0,0 +1,75 @@ +from __future__ import print_function +from lammps import lammps, LAMMPS_INT, LAMMPS_DOUBLE + +class LAMMPSFix(object): + def __init__(self, ptr, group_name="all"): + self.lmp = lammps(ptr=ptr) + self.group_name = group_name + +class LAMMPSFixMove(LAMMPSFix): + def __init__(self, ptr, group_name="all"): + super(LAMMPSFixMove, self).__init__(ptr, group_name) + + def init(self): + pass + + def initial_integrate(self, vflag): + pass + + def final_integrate(self): + pass + + def initial_integrate_respa(self, vflag, ilevel, iloop): + pass + + def final_integrate_respa(self, ilevel, iloop): + pass + + def reset_dt(self): + pass + + +class NVE(LAMMPSFixMove): + """ Python implementation of fix/nve """ + def __init__(self, ptr, group_name="all"): + super(NVE, self).__init__(ptr) + assert(self.group_name == "all") + + def init(self): + dt = self.lmp.extract_global("dt") + ftm2v = self.lmp.extract_global("ftm2v") + self.ntypes = self.lmp.extract_global("ntypes") + self.dtv = dt + self.dtf = 0.5 * dt * ftm2v + + def initial_integrate(self, vflag): + nlocal = self.lmp.extract_global("nlocal") + mass = self.lmp.extract_atom("mass") + atype = self.lmp.extract_atom("type") + x = self.lmp.extract_atom("x") + v = self.lmp.extract_atom("v") + f = self.lmp.extract_atom("f") + + for i in range(nlocal): + dtfm = self.dtf / mass[int(atype[i])] + v[i][0] += dtfm * f[i][0] + v[i][1] += dtfm * f[i][1] + v[i][2] += dtfm * f[i][2] + x[i][0] += self.dtv * v[i][0] + x[i][1] += self.dtv * v[i][1] + x[i][2] += self.dtv * v[i][2] + + def final_integrate(self): + nlocal = self.lmp.extract_global("nlocal") + mass = self.lmp.extract_atom("mass") + atype = self.lmp.extract_atom("type") + v = self.lmp.extract_atom("v") + f = self.lmp.extract_atom("f") + + for i in range(nlocal): + dtfm = self.dtf / mass[int(atype[i])] + v[i][0] += dtfm * f[i][0] + v[i][1] += dtfm * f[i][1] + v[i][2] += dtfm * f[i][2] + + From b0bc0b9a2f0e39bf936a7b89b10eae3f218bf674 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 17:54:10 -0400 Subject: [PATCH 130/370] Use time.strptime instead of datetime.strptime Embedding the Python interpreter multiple times in the same process can cause this issue due to import caching. https://bugs.python.org/issue27400 This seems to be avoidable by using the time module instead. --- python/lammps/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lammps/__init__.py b/python/lammps/__init__.py index 48839273c5..e6ffd779a9 100644 --- a/python/lammps/__init__.py +++ b/python/lammps/__init__.py @@ -15,7 +15,7 @@ from .pylammps import * # convert module string version to numeric version def get_version_number(): - from datetime import datetime + import time from sys import version_info vstring = None if version_info.major == 3 and version_info.minor >= 8: @@ -32,7 +32,7 @@ def get_version_number(): if not vstring: return 0 - d = datetime.strptime(vstring, "%d%b%Y") - return d.year*10000 + d.month*100 + d.day + t = time.strptime(vstring, "%d%b%Y") + return t.tm_year*10000 + t.tm_mon*100 + t.tm_mday __version__ = get_version_number() From 55b0e33200dceda41397966f2c8999160c95e52d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 18:01:48 -0400 Subject: [PATCH 131/370] fix typo --- doc/src/variable.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/variable.rst b/doc/src/variable.rst index ea6b7ef8ec..6a6cdf9a6d 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -429,7 +429,7 @@ argument. For *equal*\ -style variables the formula computes a scalar quantity, which becomes the value of the variable whenever it is evaluated. For *vector*\ -style variables the formula must compute a vector of quantities, which becomes the value of the variable whenever -it is evaluated. The calculated vector can be on length one, but it +it is evaluated. The calculated vector can be of length one, but it cannot be a simple scalar value like that produced by an equal-style compute. I.e. the formula for a vector-style variable must have at least one quantity in it that refers to a global vector produced by a From d04d326413760462d6e670d417610a6bb214514e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 18:02:30 -0400 Subject: [PATCH 132/370] more tests for expressions and vector style variables --- unittest/commands/test_variables.cpp | 68 ++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 30bbccf4d9..f214dadd36 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -165,7 +165,7 @@ TEST_F(VariableTest, CreateDelete) command("variable six world one"); command("variable seven format two \"%5.2f\""); command("variable eight getenv PWD"); - command("variable eight getenv HOME"); + command("variable eight getenv XXXXX"); command("variable nine file test_variable.file"); command("variable ten internal 1.0"); command("variable ten internal 10.0"); @@ -186,6 +186,9 @@ TEST_F(VariableTest, CreateDelete) ASSERT_THAT(variable->retrieve("five1"), StrEq("001")); ASSERT_THAT(variable->retrieve("seven"), StrEq(" 2.00")); ASSERT_THAT(variable->retrieve("ten"), StrEq("1")); + ASSERT_THAT(variable->retrieve("eight"), StrEq("")); + variable->internal_set(variable->find("ten"), 2.5); + ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5")); ASSERT_EQ(variable->equalstyle(variable->find("one")), 0); ASSERT_EQ(variable->equalstyle(variable->find("two")), 1); @@ -220,6 +223,10 @@ TEST_F(VariableTest, CreateDelete) command("variable ten11 format two \"%08f\"");); TEST_FAILURE(".*ERROR: Variable name 'ten@12' must have only alphanumeric characters or.*", command("variable ten@12 index one two three");); + TEST_FAILURE(".*ERROR: Variable evaluation before simulation box is defined.*", + variable->compute_equal("c_thermo_press");); + TEST_FAILURE(".*ERROR: Invalid variable reference v_unknown in variable formula.*", + variable->compute_equal("v_unknown");); } TEST_F(VariableTest, AtomicSystem) @@ -233,16 +240,29 @@ TEST_F(VariableTest, AtomicSystem) command("variable id atom type"); command("variable id atom id"); command("variable ten atomfile test_variable.atomfile"); - command("compute press all pressure NULL pair"); - command("fix press all ave/time 1 1 1 c_press mode vector"); - command("variable press vector f_press"); - command("variable press vector f_press+vol"); - command("variable pmax equal max(v_press)"); - command("variable psum equal sum(v_press)"); - command("run 0 post no"); + command("compute press all pressure NULL pair"); + command("compute rg all gyration"); + command("compute vacf all vacf"); + command("fix press all ave/time 1 1 1 c_press mode vector"); + command("fix rg all ave/time 1 1 1 c_rg mode vector"); + command("fix vacf all ave/time 1 1 1 c_vacf mode vector"); + + command("variable press vector f_press"); + command("variable rg vector f_rg"); + command("variable vacf vector f_vacf"); + command("variable press vector f_press+0.0"); + command("variable self vector v_self+f_press"); + command("variable circle vector f_press+v_circle"); + command("variable sum vector v_press+v_rg"); + command("variable sum2 vector v_vacf+v_rg"); + command("variable pmax equal max(v_press)"); + command("variable psum equal sum(v_press)"); + command("variable rgmax equal max(v_rg)"); + command("variable rgsum equal sum(v_rg)"); + command("variable loop equal v_loop+1"); + command("run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 7); ASSERT_EQ(variable->atomstyle(variable->find("one")), 0); ASSERT_EQ(variable->atomstyle(variable->find("id")), 1); @@ -251,8 +271,11 @@ TEST_F(VariableTest, AtomicSystem) ASSERT_EQ(variable->vectorstyle(variable->find("one")), 0); ASSERT_EQ(variable->vectorstyle(variable->find("press")), 1); - ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 64.0); - ASSERT_DOUBLE_EQ(variable->compute_equal("v_psum"), 6 * 64.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_psum"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_rgmax"), 1.25); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_rgsum"), 3.75); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_sum[1]"), 1.25); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable one atom x");); @@ -260,12 +283,17 @@ TEST_F(VariableTest, AtomicSystem) command("variable one vector f_press");); TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*", command("variable ten1 atomfile test_variable.xxx");); + TEST_FAILURE(".*ERROR: Variable loop: has a circular dependency.*", + variable->compute_equal("v_loop");); + TEST_FAILURE(".*Variable self: Vector-style variable in equal-style variable formula.*", + variable->compute_equal("v_self");); + TEST_FAILURE(".*ERROR: Variable sum2: Inconsistent lengths in vector-style variable.*", + variable->compute_equal("max(v_sum2)");); } TEST_F(VariableTest, Expressions) { atomic_system(); - ASSERT_EQ(variable->nvar, 1); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal 2"); @@ -286,9 +314,13 @@ TEST_F(VariableTest, Expressions) command("variable ten7 equal !(12)+(1>=2)+(1&&0)+(0||0)+(1|^1)+10^0"); + command("variable err1 equal v_one/v_ten7"); + command("variable err2 equal v_one%v_ten7"); + command("variable err3 equal v_ten7^-v_one"); variable->set("dummy index 1 2"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 21); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); @@ -310,11 +342,19 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten6"), 1); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten7"), 0); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten10"), 100); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten11"), 1); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); TEST_FAILURE(".*ERROR: Variable ten9: has a circular dependency.*", command("print \"${ten9}\"");); + TEST_FAILURE(".*ERROR on proc 0: Variable err1: Divide by 0 in variable formula.*", + command("print \"${err1}\"");); + TEST_FAILURE(".*ERROR on proc 0: Variable err2: Modulo 0 in variable formula.*", + command("print \"${err2}\"");); + TEST_FAILURE(".*ERROR on proc 0: Variable err3: Invalid power expression in variable formula.*", + command("print \"${err3}\"");); } TEST_F(VariableTest, Functions) @@ -322,14 +362,12 @@ TEST_F(VariableTest, Functions) atomic_system(); file_vars(); - ASSERT_EQ(variable->nvar, 1); if (!verbose) ::testing::internal::CaptureStdout(); command("variable one index 1"); command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); command("variable four equal atan2()"); if (!verbose) ::testing::internal::GetCapturedStdout(); - ASSERT_EQ(variable->nvar, 5); int ivar = variable->find("two"); ASSERT_GT(variable->compute_equal(ivar), 0.99); From 4fa5ce2dbccd5d6bdcffcce5cce9c2a3bc636585 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 18:11:31 -0400 Subject: [PATCH 133/370] Remove unnecessary import --- unittest/force-styles/tests/py_nve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/py_nve.py b/unittest/force-styles/tests/py_nve.py index 4740c85597..1f05be04a8 100644 --- a/unittest/force-styles/tests/py_nve.py +++ b/unittest/force-styles/tests/py_nve.py @@ -1,5 +1,5 @@ from __future__ import print_function -from lammps import lammps, LAMMPS_INT, LAMMPS_DOUBLE +from lammps import lammps class LAMMPSFix(object): def __init__(self, ptr, group_name="all"): From 3c41c12dbc0818b2e93165d436aed45430285188 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 24 Mar 2021 18:58:46 -0400 Subject: [PATCH 134/370] Add testcase for python/move --- unittest/force-styles/CMakeLists.txt | 2 +- unittest/force-styles/test_fix_timestep.cpp | 5 +- .../tests/fix-timestep-python_move_nve.yaml | 73 +++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 unittest/force-styles/tests/fix-timestep-python_move_nve.yaml diff --git a/unittest/force-styles/CMakeLists.txt b/unittest/force-styles/CMakeLists.txt index 02300b5ea2..60e83e7e16 100644 --- a/unittest/force-styles/CMakeLists.txt +++ b/unittest/force-styles/CMakeLists.txt @@ -124,7 +124,7 @@ file(GLOB FIX_TIMESTEP_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/fix-tim foreach(TEST ${FIX_TIMESTEP_TESTS}) string(REGEX REPLACE "^.*fix-timestep-(.*)\.yaml" "FixTimestep:\\1" TNAME ${TEST}) add_test(NAME ${TNAME} COMMAND test_fix_timestep ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:$ENV{PYTHONPATH}") + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};PYTHONPATH=${TEST_INPUT_FOLDER}:${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}") endforeach() # dihedral style tester diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index e4b0fa6e02..aa07f36fb9 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -518,9 +518,12 @@ TEST(FixTimestep, plain) // rigid fixes need work to test properly with r-RESPA. // fix nve/limit cannot work with r-RESPA + // fix python/move implementation is missing library interface access to Repsa::step ifix = lmp->modify->find_fix("test"); if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && - !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) { + !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit") && + !utils::strmatch(lmp->modify->fix[ifix]->style, "^python/move") + ) { if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); diff --git a/unittest/force-styles/tests/fix-timestep-python_move_nve.yaml b/unittest/force-styles/tests/fix-timestep-python_move_nve.yaml new file mode 100644 index 0000000000..9c78dbe416 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-python_move_nve.yaml @@ -0,0 +1,73 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Wed Mar 24 18:57:26 202 +epsilon: 9e-12 +prerequisites: ! | + atom full + fix python/move +pre_commands: ! "" +post_commands: ! | + fix test all python/move py_nve.NVE +input_file: in.fourmol +natoms: 29 +run_pos: ! |2 + 1 -2.7045559775384037e-01 2.4912159905679729e+00 -1.6695851791541885e-01 + 2 3.1004029573899528e-01 2.9612354631094391e+00 -8.5466363037021464e-01 + 3 -7.0398551400789477e-01 1.2305509955830618e+00 -6.2777526944456274e-01 + 4 -1.5818159336499285e+00 1.4837407818929933e+00 -1.2538710836062004e+00 + 5 -9.0719763672789266e-01 9.2652103885675297e-01 3.9954210488374786e-01 + 6 2.4831720524855985e-01 2.8313021497871271e-01 -1.2314233331711453e+00 + 7 3.4143527641386412e-01 -2.2646551041391422e-02 -2.5292291414903052e+00 + 8 1.1743552229100009e+00 -4.8863228565853950e-01 -6.3783432910825522e-01 + 9 1.3800524229500313e+00 -2.5274721030406683e-01 2.8353985887095157e-01 + 10 2.0510765220543883e+00 -1.4604063740302866e+00 -9.8323745081712954e-01 + 11 1.7878031944442556e+00 -1.9921863272948861e+00 -1.8890602447625777e+00 + 12 3.0063007039340053e+00 -4.9013350496963298e-01 -1.6231898107386229e+00 + 13 4.0515402959192999e+00 -8.9202011606653986e-01 -1.6400005529924957e+00 + 14 2.6066963345543819e+00 -4.1789253965514150e-01 -2.6634003608794394e+00 + 15 2.9695287185712913e+00 5.5422613165234036e-01 -1.2342022021790127e+00 + 16 2.6747029695228521e+00 -2.4124119054564295e+00 -2.3435746150616148e-02 + 17 2.2153577785283796e+00 -2.0897985186907717e+00 1.1963150794479436e+00 + 18 2.1369701704115704e+00 3.0158507413630606e+00 -3.5179348337215015e+00 + 19 1.5355837136087378e+00 2.6255292355375675e+00 -4.2353987779879052e+00 + 20 2.7727573005678776e+00 3.6923910449610169e+00 -3.9330842459133493e+00 + 21 4.9040128073204299e+00 -4.0752348172957946e+00 -3.6210314709891711e+00 + 22 4.3582355554440841e+00 -4.2126119427287048e+00 -4.4612844196314052e+00 + 23 5.7439382849307599e+00 -3.5821957939275029e+00 -3.8766361295935821e+00 + 24 2.0689243582422630e+00 3.1513346907271012e+00 3.1550389754828800e+00 + 25 1.3045351331492134e+00 3.2665125705842848e+00 2.5111855257433504e+00 + 26 2.5809237402711274e+00 4.0117602605482832e+00 3.2212060529089896e+00 + 27 -1.9611343130357228e+00 -4.3563411931359752e+00 2.1098293115523705e+00 + 28 -2.7473562684513411e+00 -4.0200819932379330e+00 1.5830052163433954e+00 + 29 -1.3126000191359855e+00 -3.5962518039482929e+00 2.2746342468737835e+00 +run_vel: ! |2 + 1 8.1705744183262364e-03 1.6516406176274288e-02 4.7902264318912978e-03 + 2 5.4501493445687759e-03 5.1791699408496334e-03 -1.4372931530376651e-03 + 3 -8.2298292722385643e-03 -1.2926551614621381e-02 -4.0984181178163881e-03 + 4 -3.7699042590093588e-03 -6.5722892098813799e-03 -1.1184640360133230e-03 + 5 -1.1021961004346586e-02 -9.8906780939335987e-03 -2.8410737829284395e-03 + 6 -3.9676663166400034e-02 4.6817061464710256e-02 3.7148491979476124e-02 + 7 9.1033953013898580e-04 -1.0128524411938794e-02 -5.1568251805019748e-02 + 8 7.9064712058855707e-03 -3.3507254552631767e-03 3.4557098492564629e-02 + 9 1.5644176117320923e-03 3.7365546102722164e-03 1.5047408822037646e-02 + 10 2.9201446820573174e-02 -2.9249578745486147e-02 -1.5018077424322538e-02 + 11 -4.7835961513517560e-03 -3.7481385134185206e-03 -2.3464104142290089e-03 + 12 2.2696451841920521e-03 -3.4774154398129479e-04 -3.0640770327796806e-03 + 13 2.7531740451953168e-03 5.8171061612840667e-03 -7.9467454022160518e-04 + 14 3.5246182371994252e-03 -5.7939995585585468e-03 -3.9478431172751344e-03 + 15 -1.8547943640122894e-03 -5.8554729942777743e-03 6.2938485140538649e-03 + 16 1.8681499973445245e-02 -1.3262466204585335e-02 -4.5638651457003243e-02 + 17 -1.2896269981100382e-02 9.7527665265956451e-03 3.7296535360836762e-02 + 18 -8.0065794848261610e-04 -8.6270473212554395e-04 -1.4483040697508738e-03 + 19 1.2452390836182623e-03 -2.5061097118772701e-03 7.2998631009712975e-03 + 20 3.5930060229597042e-03 3.6938860309252966e-03 3.2322732687893028e-03 + 21 -1.4689220370766550e-03 -2.7352129761527741e-04 7.0581624215243391e-04 + 22 -7.0694199254630339e-03 -4.2577148924878554e-03 2.8079117614251796e-04 + 23 6.0446963117374913e-03 -1.4000131614795382e-03 2.5819754847014255e-03 + 24 3.1926367902287940e-04 -9.9445664749276438e-04 1.4999996959365452e-04 + 25 1.3789754514814662e-04 -4.4335894884532569e-03 -8.1808136725080281e-04 + 26 2.0485904035217549e-03 2.7813358633835984e-03 4.3245727149206692e-03 + 27 4.5604120293369857e-04 -1.0305523026921137e-03 2.1188058381358511e-04 + 28 -6.2544520861855116e-03 1.4127711176146942e-03 -1.8429821884794269e-03 + 29 6.4110631534401762e-04 3.1273432719593867e-03 3.7253671105656715e-03 +... From a772c3b7d2ae9c981ce4712f6df1ab739d342640 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 21:27:32 -0400 Subject: [PATCH 135/370] test a few more functions and constants --- unittest/commands/test_variables.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index f214dadd36..45183a2e54 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -316,6 +316,7 @@ TEST_F(VariableTest, Expressions) command("variable ten9 equal v_one-v_ten9"); command("variable ten10 internal 100.0"); command("variable ten11 equal (1!=1)+(2<1)+(2<=1)+(1>2)+(1>=2)+(1&&0)+(0||0)+(1|^1)+10^0"); + command("variable ten12 equal yes+no+on+off+true+false"); command("variable err1 equal v_one/v_ten7"); command("variable err2 equal v_one%v_ten7"); command("variable err3 equal v_ten7^-v_one"); @@ -344,6 +345,7 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten10"), 100); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten11"), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten12"), 3); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); @@ -367,13 +369,27 @@ TEST_F(VariableTest, Functions) command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); command("variable four equal atan2()"); + command("variable five equal sqrt(v_one+v_one)"); + command("variable six equal exp(ln(0.1))"); + command("variable seven equal abs(log(1.0/100.0))"); + command("variable eight equal 0.5*PI"); + command("variable nine equal round(sin(v_eight)+cos(v_eight))"); + command("variable ten equal floor(1.85)+ceil(1.85)"); + command("variable ten1 equal tan(v_eight/2.0)"); + command("variable ten2 equal asin(-1.0)+acos(0.0)"); if (!verbose) ::testing::internal::GetCapturedStdout(); - int ivar = variable->find("two"); - ASSERT_GT(variable->compute_equal(ivar), 0.99); - ASSERT_LT(variable->compute_equal(ivar), 2.01); - ivar = variable->find("three"); - ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 0.25 * MY_PI); + ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99); + ASSERT_LT(variable->compute_equal(variable->find("two")), 2.01); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("three")), 0.25 * MY_PI); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("five")), sqrt(2.0)); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("six")), 0.1); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("seven")), 2); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("nine")), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten")), 3); + ASSERT_FLOAT_EQ(variable->compute_equal(variable->find("ten1")), 1); + ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten2")), 0); + TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*", command("print \"${four}\"");); } From 6d6e2a7920bd9d98f50711f684b51ba527a0e842 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Mar 2021 21:51:55 -0400 Subject: [PATCH 136/370] add simple check whether the compiled executable can actually run --- unittest/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index c7f46a7f7b..f5d990d3ed 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -1,5 +1,14 @@ include(GTest) +# check if we can run the compiled executable and whether it prints +# the LAMMPS version header in the output for an empty input +file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/in.empty) +add_test(NAME RunLammps + COMMAND $ -log none -echo none -in in.empty + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_tests_properties(RunLammps PROPERTIES + PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)") + if(BUILD_MPI) function(add_mpi_test) set(MPI_TEST_NUM_PROCS 1) From 28ac1fddc78376698c738e286cb2a0def55255ec Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 14:20:44 -0400 Subject: [PATCH 137/370] add tests for fix adapt with pairwise and coulomb interactions --- .../tests/fix-timestep-adapt_coul.yaml | 78 +++++++++++++++++++ .../tests/fix-timestep-adapt_pair.yaml | 77 ++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 unittest/force-styles/tests/fix-timestep-adapt_coul.yaml create mode 100644 unittest/force-styles/tests/fix-timestep-adapt_pair.yaml diff --git a/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml new file mode 100644 index 0000000000..4bf25f3b33 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml @@ -0,0 +1,78 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Mar 25 14:07:45 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + fix adapt +pre_commands: ! | + variable scale equal ramp(0.5,1.0) +post_commands: ! | + fix move all nve + pair_style coul/long 8.0 + pair_coeff * * + kspace_style pppm 1.0e-5 + fix test solute adapt 1 pair coul/long scale * * v_scale kspace v_scale scale no +input_file: in.fourmol +natoms: 29 +run_pos: ! |2 + 1 -2.7585387890471996e-01 2.4721267521182790e+00 -1.7590741140808724e-01 + 2 3.0525219871189541e-01 2.9567528136379986e+00 -8.4936576402532038e-01 + 3 -6.9505003051265457e-01 1.2527081545845018e+00 -6.1997181046584049e-01 + 4 -1.5812017862079175e+00 1.4837803436802379e+00 -1.2534501022240629e+00 + 5 -9.0698616844921520e-01 9.2696438488362154e-01 3.9881670647678125e-01 + 6 2.9475212358066677e-01 2.3090672513870800e-01 -1.2850129871041163e+00 + 7 3.3910265413162427e-01 -9.8304106880631008e-03 -2.4646152989509647e+00 + 8 1.1651505006204030e+00 -4.8743821011767707e-01 -6.7114884751728299e-01 + 9 1.3774263981599719e+00 -2.5621838794437357e-01 2.7183404529472238e-01 + 10 2.0205575722774203e+00 -1.4247755749375353e+00 -9.7170370274694495e-01 + 11 1.7878178367325690e+00 -1.9913978116155537e+00 -1.8882122011553970e+00 + 12 3.0049755926663213e+00 -4.9113386667261005e-01 -1.6222548793223990e+00 + 13 4.0509873346708982e+00 -8.9189599256758900e-01 -1.6399664169684836e+00 + 14 2.6067290768076905e+00 -4.1787776166657575e-01 -2.6628987151232200e+00 + 15 2.9696220092443193e+00 5.5371700758037623e-01 -1.2345762790291681e+00 + 16 2.6502758794398509e+00 -2.3947260224551123e+00 3.7979604817656068e-02 + 17 2.2329379457566403e+00 -2.1019011639091216e+00 1.1489747581405534e+00 + 18 2.1370039459092824e+00 3.0160650231380983e+00 -3.5182461434707273e+00 + 19 1.5358245580755947e+00 2.6253262982024990e+00 -4.2345405067543185e+00 + 20 2.7723206208610200e+00 3.6917660744997280e+00 -3.9324445897897893e+00 + 21 4.9046698830002544e+00 -4.0744208992376789e+00 -3.6231785861154941e+00 + 22 4.3619404928241057e+00 -4.2118418466324723e+00 -4.4549778550789503e+00 + 23 5.7375471428283742e+00 -3.5861419285984151e+00 -3.8743083628403299e+00 + 24 2.0685472614153846e+00 3.1534292413678289e+00 3.1539268144873454e+00 + 25 1.3099248377134609e+00 3.2652552015323466e+00 2.5158443987470833e+00 + 26 2.5769610944059931e+00 4.0046351067750248e+00 3.2209102828198946e+00 + 27 -1.9616446495134594e+00 -4.3541288139763008e+00 2.1089564303871438e+00 + 28 -2.7409194780982360e+00 -4.0232390590132754e+00 1.5874446954442702e+00 + 29 -1.3169303967683006e+00 -3.6019395338314788e+00 2.2736834157327834e+00 +run_vel: ! |2 + 1 3.2647934948866072e-03 -1.0659515509476220e-03 -3.5596416446573862e-03 + 2 6.5461183155830240e-04 5.3408204488965814e-04 3.7281153774905299e-03 + 3 5.5824606761867453e-04 6.8767077705354802e-03 2.6081254050903369e-03 + 4 -3.0104306057251481e-03 -6.3737880755571717e-03 -5.7689309472175711e-04 + 5 -1.0695603162793169e-02 -9.3124438941875488e-03 -3.5561825582117166e-03 + 6 9.7217275192988716e-04 2.4037242875343898e-03 -1.4804194461220557e-03 + 7 -9.8813125701116859e-04 7.1676860005907047e-05 -4.9726864557309155e-04 + 8 5.7695861497255153e-04 -2.8105851335220203e-03 5.2330664783477206e-03 + 9 -1.4995649604676725e-03 3.1649947790849786e-06 2.0412648677152027e-03 + 10 1.5839012837707146e-03 3.0321007338515189e-03 -4.0872484640111792e-03 + 11 -4.7758918532801661e-03 -2.6593274143911529e-03 -1.1550198582046794e-03 + 12 9.0128567357444442e-04 -1.2761751259519178e-03 -2.0871137241467094e-03 + 13 2.1567295863873783e-03 5.8607859346030983e-03 -7.1626599947017036e-04 + 14 3.5355218381749455e-03 -5.7850299516532602e-03 -3.4518030258956843e-03 + 15 -1.7110094580322296e-03 -6.3503642729395085e-03 5.8528583997245172e-03 + 16 -1.3548756014535996e-03 1.4721717701533786e-03 3.4684968840172224e-03 + 17 1.2456371869895035e-03 7.2712506650925211e-05 -1.0263875344785681e-03 + 18 -7.6671852987712384e-04 -6.2725590016584319e-04 -1.7887461816215443e-03 + 19 1.5144560879023705e-03 -2.7339688331763923e-03 8.2529894052008699e-03 + 20 3.1192665056846264e-03 3.0118796973856330e-03 3.9267694079263664e-03 + 21 -8.3441863827979606e-04 5.2127470504020413e-04 -1.3858761585700890e-03 + 22 -3.4781949993989694e-03 -3.5196597997799125e-03 6.4236038889072932e-03 + 23 -1.5073299456798523e-04 -5.2285186251896619e-03 4.8604614163606421e-03 + 24 -6.9684359242923175e-05 1.0646658518855285e-03 -9.5542384314521332e-04 + 25 5.4585615099357566e-03 -5.7013984855115978e-03 3.7920245454784174e-03 + 26 -1.8076492725572590e-03 -4.1945707008573113e-03 4.0407648570027713e-03 + 27 -3.5547747026063570e-05 1.1321728960280906e-03 -6.3187029759558986e-04 + 28 -4.2637774879869998e-05 -1.6726973615869391e-03 2.4434056859341056e-03 + 29 -3.5302833519675510e-03 -2.4353648747156768e-03 2.8116576375086392e-03 +... diff --git a/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml b/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml new file mode 100644 index 0000000000..167f531b8e --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-adapt_pair.yaml @@ -0,0 +1,77 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Mar 25 14:01:17 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + fix adapt +pre_commands: ! | + variable epsilon equal ramp(0.01,0.03) +post_commands: ! | + fix move all nve + pair_style lj/cut 8.0 + pair_coeff * * 0.02 2.5 + fix test solute adapt 1 pair lj/cut epsilon * * v_epsilon scale no +input_file: in.fourmol +natoms: 29 +run_pos: ! |2 + 1 -3.2551307172152166e-01 2.4346451341937119e+00 -1.1396829659429568e-01 + 2 4.8617926885321056e-01 3.1070882859405997e+00 -1.0606347736697450e+00 + 3 -6.4277692336189840e-01 1.2540574692558419e+00 -6.5067148095539729e-01 + 4 -1.7124546848614086e+00 1.5199062846474698e+00 -1.3466731463120185e+00 + 5 -9.4318702684092770e-01 8.7036167560098177e-01 5.8107949039715845e-01 + 6 2.8417536732521353e-01 2.4411028847076369e-01 -1.2672995916002334e+00 + 7 3.3978105928826102e-01 -1.3702127966002052e-02 -2.4842417404954271e+00 + 8 1.1448702036571965e+00 -5.1199787721085332e-01 -7.6207631323785585e-01 + 9 1.4560807143664061e+00 -1.7028374483027719e-01 6.2141359752210135e-01 + 10 2.0382797810616289e+00 -1.4042635759560305e+00 -9.2654260470655225e-01 + 11 1.7519024690839582e+00 -2.0813293238835207e+00 -2.0333284515052927e+00 + 12 2.9787289051059695e+00 -5.2434906497210465e-01 -1.5904467995849627e+00 + 13 4.1953422217253049e+00 -9.4830119722648354e-01 -1.6427468797605889e+00 + 14 2.5500081793995157e+00 -4.0614435033397922e-01 -2.8121984203395161e+00 + 15 2.9657048145111777e+00 7.0300473914796602e-01 -1.1808819862439999e+00 + 16 2.6579963051616033e+00 -2.4005456919625914e+00 2.0005383723547647e-02 + 17 2.2277056239576578e+00 -2.0984522178633980e+00 1.1635464820238732e+00 + 18 2.1302246968151799e+00 2.9885050666882940e+00 -3.4237069257450177e+00 + 19 1.3456038469693135e+00 2.5038497935542385e+00 -4.4658170467307343e+00 + 20 2.9896625556783665e+00 3.9232215029072903e+00 -4.0788037150506025e+00 + 21 4.8757906644427553e+00 -4.1085999726993636e+00 -3.5248264027627227e+00 + 22 4.1728425444281765e+00 -4.2576916791274551e+00 -4.7519930504553214e+00 + 23 6.0419888290998678e+00 -3.4039201576442903e+00 -3.9699675670526715e+00 + 24 2.0885027685082749e+00 3.0623262332232590e+00 3.2053854817911325e+00 + 25 1.0405778226848383e+00 3.3092074961772369e+00 2.2889143046855063e+00 + 26 2.7667223704388135e+00 4.3243759349108064e+00 3.2424899041692892e+00 + 27 -1.9442324574216177e+00 -4.4528190486931383e+00 2.1453601072505339e+00 + 28 -3.0374110711029547e+00 -3.8950976773182124e+00 1.3869509742028494e+00 + 29 -1.0900141540951092e+00 -3.3361017662313661e+00 2.3288506481859019e+00 +run_vel: ! |2 + 1 -2.6363966609802322e-02 -2.1121682067821074e-02 3.6083903537541533e-02 + 2 1.1439082425218627e-01 9.6059686259844332e-02 -1.2808582493334400e-01 + 3 4.1111553959541365e-02 4.8218907676123458e-03 -2.0053345127339979e-02 + 4 -1.1200342113854607e-01 2.3479218026487367e-02 -7.8322526982440521e-02 + 5 -3.8701176979056742e-02 -5.4238808461352553e-02 1.3872068929223944e-01 + 6 -1.2123879257604515e-02 1.8312769875475924e-02 1.5946869603522588e-02 + 7 -2.8033909635229349e-04 -4.1270986674540478e-03 -2.1849258860351647e-02 + 8 -1.0170253112050078e-02 -1.7528863700725254e-02 -4.2491773012772370e-02 + 9 4.5241065101710616e-02 5.1469831376004180e-02 2.0995899436627763e-01 + 10 1.8368003566726739e-02 1.4179451083200369e-02 2.9470727636806446e-02 + 11 -3.2659358322720752e-02 -7.3493919093785873e-02 -1.1457396195350034e-01 + 12 -2.1332063889491135e-02 -2.8577988202947827e-02 2.3932097053094816e-02 + 13 1.2690181040869375e-01 -4.2622009579717637e-02 -3.2122980905022864e-03 + 14 -4.3986665577866770e-02 4.1189150738941797e-03 -1.2884939606320925e-01 + 15 -5.1087806082402770e-03 1.2103885273247751e-01 5.1598463273012998e-02 + 16 7.2721700595591750e-03 -5.1107380318211630e-03 -1.6206172124102816e-02 + 17 -4.5383051620802401e-03 3.8550131312268723e-03 1.5203146179855118e-02 + 18 -3.4035600174367278e-03 -1.6724199163900926e-02 5.8534078947667954e-02 + 19 -1.2309357029421318e-01 -8.2342186011711699e-02 -1.4270564232030267e-01 + 20 1.3831939524791759e-01 1.4683346823701657e-01 -8.6190510762895065e-02 + 21 -1.8190109221215101e-02 -2.0433705925500686e-02 5.9790597332019774e-02 + 22 -1.2248854674722252e-01 -3.2562959165287515e-02 -1.7942350258565937e-01 + 23 1.8820938314857302e-01 1.0738920901878871e-01 -5.3571267428950652e-02 + 24 1.3241508666550663e-02 -5.5202622564252735e-02 3.1590984003367552e-02 + 25 -1.6538995535147813e-01 2.1577200806135906e-02 -1.3992038866639564e-01 + 26 1.1598773628387443e-01 1.9315924859017630e-01 1.7906411933036825e-02 + 27 9.5161140946472839e-03 -6.0207807869183290e-02 2.1271816291477584e-02 + 28 -1.8165131190419664e-01 7.5944941014218031e-02 -1.2012012232111549e-01 + 29 1.3987378313944554e-01 1.6482908858701009e-01 3.7930623655713772e-02 +... From 27e31c4b151ae6c950d66fe630e45111fa4f4f90 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 14:49:49 -0400 Subject: [PATCH 138/370] simplify --- src/ASPHERE/compute_temp_asphere.cpp | 4 +--- src/BODY/compute_temp_body.cpp | 4 +--- src/GPU/fix_npt_gpu.cpp | 32 ++++++---------------------- src/GPU/fix_nvt_gpu.cpp | 19 ++++------------- src/USER-OMP/fix_npt_omp.cpp | 27 ++++------------------- src/USER-OMP/fix_nvt_omp.cpp | 14 ++---------- 6 files changed, 18 insertions(+), 82 deletions(-) diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 2fe2e9699c..9afae4d2d9 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -58,9 +58,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/asphere command"); tempbias = 1; - int n = strlen(arg[iarg+1]) + 1; - id_bias = new char[n]; - strcpy(id_bias,arg[iarg+1]); + id_bias = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dof") == 0) { if (iarg+2 > narg) diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index 730a857aec..fb16723b23 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -56,9 +56,7 @@ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/body command"); tempbias = 1; - int n = strlen(arg[iarg+1]) + 1; - id_bias = new char[n]; - strcpy(id_bias,arg[iarg+1]); + id_bias = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dof") == 0) { if (iarg+2 > narg) diff --git a/src/GPU/fix_npt_gpu.cpp b/src/GPU/fix_npt_gpu.cpp index 2ba0be29e0..073d5dc6c1 100644 --- a/src/GPU/fix_npt_gpu.cpp +++ b/src/GPU/fix_npt_gpu.cpp @@ -25,44 +25,24 @@ FixNPTGPU::FixNPTGPU(LAMMPS *lmp, int narg, char **arg) : FixNHGPU(lmp, narg, arg) { if (!tstat_flag) - error->all(FLERR,"Temperature control must be used with fix npt/omp"); + error->all(FLERR,"Temperature control must be used with fix npt/gpu"); if (!pstat_flag) - error->all(FLERR,"Pressure control must be used with fix npt/omp"); + error->all(FLERR,"Pressure control must be used with fix npt/gpu"); // create a new compute temp style // id = fix-ID + temp // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(id_temp+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(std::string(id_press)+" all pressure "+id_temp); pcomputeflag = 1; } diff --git a/src/GPU/fix_nvt_gpu.cpp b/src/GPU/fix_nvt_gpu.cpp index 7d7826b6bf..6858c26497 100644 --- a/src/GPU/fix_nvt_gpu.cpp +++ b/src/GPU/fix_nvt_gpu.cpp @@ -26,25 +26,14 @@ FixNVTGPU::FixNVTGPU(LAMMPS *lmp, int narg, char **arg) : FixNHGPU(lmp, narg, arg) { if (!tstat_flag) - error->all(FLERR,"Temperature control must be used with fix nvt"); + error->all(FLERR,"Temperature control must be used with fix nvt/gpu"); if (pstat_flag) - error->all(FLERR,"Pressure control can not be used with fix nvt"); + error->all(FLERR,"Pressure control can not be used with fix nvt/gpu"); // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } - diff --git a/src/USER-OMP/fix_npt_omp.cpp b/src/USER-OMP/fix_npt_omp.cpp index f3f08c15c2..54328803f4 100644 --- a/src/USER-OMP/fix_npt_omp.cpp +++ b/src/USER-OMP/fix_npt_omp.cpp @@ -34,35 +34,16 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(std::string(id_press)+" all pressure "+id_temp); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nvt_omp.cpp b/src/USER-OMP/fix_nvt_omp.cpp index bfa2dcbe49..127876b4e8 100644 --- a/src/USER-OMP/fix_nvt_omp.cpp +++ b/src/USER-OMP/fix_nvt_omp.cpp @@ -33,17 +33,7 @@ FixNVTOMP::FixNVTOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } From 4efe60ec43e6fba31b9eebfb383ff5dac762097b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 17:14:57 -0400 Subject: [PATCH 139/370] compatibility with older CMake versions --- unittest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index f5d990d3ed..4e27f4be45 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -2,7 +2,7 @@ include(GTest) # check if we can run the compiled executable and whether it prints # the LAMMPS version header in the output for an empty input -file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/in.empty) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/in.empty "") add_test(NAME RunLammps COMMAND $ -log none -echo none -in in.empty WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) From 2b34d88b71ce3b3757b1cfbf991e422b8d92e0bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 17:19:03 -0400 Subject: [PATCH 140/370] fix bug --- src/GPU/fix_npt_gpu.cpp | 2 +- src/USER-OMP/fix_npt_omp.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GPU/fix_npt_gpu.cpp b/src/GPU/fix_npt_gpu.cpp index 073d5dc6c1..3847f31a65 100644 --- a/src/GPU/fix_npt_gpu.cpp +++ b/src/GPU/fix_npt_gpu.cpp @@ -35,7 +35,7 @@ FixNPTGPU::FixNPTGPU(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(id_temp+" all temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/USER-OMP/fix_npt_omp.cpp b/src/USER-OMP/fix_npt_omp.cpp index 54328803f4..4037dd928e 100644 --- a/src/USER-OMP/fix_npt_omp.cpp +++ b/src/USER-OMP/fix_npt_omp.cpp @@ -34,7 +34,6 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - id_temp = utils::strdup(std::string(id)+"_temp"); modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; From 2baafda5171a8bf3291162ba4ef225b395695728 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 17:19:11 -0400 Subject: [PATCH 141/370] simplify --- src/USER-OMP/fix_nph_omp.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/USER-OMP/fix_nph_omp.cpp b/src/USER-OMP/fix_nph_omp.cpp index ba7f6e6c26..8c2f9ed3a3 100644 --- a/src/USER-OMP/fix_nph_omp.cpp +++ b/src/USER-OMP/fix_nph_omp.cpp @@ -34,35 +34,15 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(std::string(id_press)+" all pressure "+id_temp); pcomputeflag = 1; } From 53f32cea7e2b42c3ea3bf915ef3dfc3db4be6796 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 19:42:41 -0400 Subject: [PATCH 142/370] simplify using utils::strdup() --- src/GRANULAR/fix_pour.cpp | 8 ++----- src/GRANULAR/fix_wall_gran.cpp | 4 +--- src/KOKKOS/atom_kokkos.cpp | 8 ++----- src/KOKKOS/atom_vec_hybrid_kokkos.cpp | 9 +++----- src/KOKKOS/fix_nph_kokkos.cpp | 33 ++++++--------------------- src/KOKKOS/fix_npt_kokkos.cpp | 33 ++++++--------------------- src/KOKKOS/fix_nvt_kokkos.cpp | 18 ++++----------- 7 files changed, 26 insertions(+), 87 deletions(-) diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 3b93722426..08dae55d17 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -948,18 +948,14 @@ void FixPour::options(int narg, char **arg) } else if (strcmp(arg[iarg],"rigid") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idrigid; - idrigid = new char[n]; - strcpy(idrigid,arg[iarg+1]); + idrigid = utils::strdup(arg[iarg+1]); rigidflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"shake") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idshake; - idshake = new char[n]; - strcpy(idshake,arg[iarg+1]); + idshake = utils::strdup(arg[iarg+1]); shakeflag = 1; iarg += 2; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 73d2a2f8ba..d18b72aa65 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -338,9 +338,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"region") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = REGION; - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); iarg += 2; } diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index c41a42c99a..19cfe02c96 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -257,9 +257,7 @@ int AtomKokkos::add_custom(const char *name, int flag) nivector++; iname = (char **) memory->srealloc(iname,nivector*sizeof(char *), "atom:iname"); - int n = strlen(name) + 1; - iname[index] = new char[n]; - strcpy(iname[index],name); + iname[index] = utils::strdup(name); ivector = (int **) memory->srealloc(ivector,nivector*sizeof(int *), "atom:ivector"); memory->create(ivector[index],nmax,"atom:ivector"); @@ -268,9 +266,7 @@ int AtomKokkos::add_custom(const char *name, int flag) ndvector++; dname = (char **) memory->srealloc(dname,ndvector*sizeof(char *), "atom:dname"); - int n = strlen(name) + 1; - dname[index] = new char[n]; - strcpy(dname[index],name); + dname[index] = utils::strdup(name); this->sync(Device,DVECTOR_MASK); memoryKK->grow_kokkos(k_dvector,dvector,ndvector,nmax, "atom:dvector"); diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp index f1390f754b..907d1d555f 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp @@ -72,8 +72,7 @@ void AtomVecHybridKokkos::process_args(int narg, char **arg) if (strcmp(arg[iarg],keywords[i]) == 0) error->all(FLERR,"Atom style hybrid cannot use same atom style twice"); styles[nstyles] = atom->new_avec(arg[iarg],1,dummy); - keywords[nstyles] = new char[strlen(arg[iarg])+1]; - strcpy(keywords[nstyles],arg[iarg]); + keywords[nstyles] = utils::strdup(arg[iarg]); jarg = iarg + 1; while (jarg < narg && !known_style(arg[jarg])) jarg++; styles[nstyles]->process_args(jarg-iarg-1,&arg[iarg+1]); @@ -1175,10 +1174,8 @@ void AtomVecHybridKokkos::build_styles() int n; nallstyles = 0; #define ATOM_CLASS -#define AtomStyle(key,Class) \ - n = strlen(#key) + 1; \ - allstyles[nallstyles] = new char[n]; \ - strcpy(allstyles[nallstyles],#key); \ +#define AtomStyle(key,Class) \ + allstyles[nallstyles] = utils::strdup(#key); \ nallstyles++; #include "style_atom.h" // IWYU pragma: keep #undef AtomStyle diff --git a/src/KOKKOS/fix_nph_kokkos.cpp b/src/KOKKOS/fix_nph_kokkos.cpp index 71639083d9..f679940eaf 100644 --- a/src/KOKKOS/fix_nph_kokkos.cpp +++ b/src/KOKKOS/fix_nph_kokkos.cpp @@ -29,45 +29,26 @@ FixNPHKokkos::FixNPHKokkos(LAMMPS *lmp, int narg, char **arg) : { this->kokkosable = 1; if (this->tstat_flag) - this->error->all(FLERR,"Temperature control can not be used with fix nph"); + this->error->all(FLERR,"Temperature control can not be used with fix nph/kk"); if (!this->pstat_flag) - this->error->all(FLERR,"Pressure control must be used with fix nph"); + this->error->all(FLERR,"Pressure control must be used with fix nph/kk"); // create a new compute temp style // id = fix-ID + temp // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(this->id) + 6; - this->id_temp = new char[n]; - strcpy(this->id_temp,this->id); - strcat(this->id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = this->id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/kk"; - - this->modify->add_compute(3,newarg); - delete [] newarg; + this->id_temp = utils::strdup(std::string(this->id)+"_temp"); + this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); this->tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(this->id) + 7; - this->id_press = new char[n]; - strcpy(this->id_press,this->id); - strcat(this->id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = this->id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = this->id_temp; - this->modify->add_compute(4,newarg); - delete [] newarg; + this->id_press = utils::strdup(std::string(this->id)+"_press"); + this->modify->add_compute(std::string(this->id_press) + +" all pressure "+this->id_temp); this->pcomputeflag = 1; } diff --git a/src/KOKKOS/fix_npt_kokkos.cpp b/src/KOKKOS/fix_npt_kokkos.cpp index 55c1d9d33f..baa47e026f 100644 --- a/src/KOKKOS/fix_npt_kokkos.cpp +++ b/src/KOKKOS/fix_npt_kokkos.cpp @@ -29,45 +29,26 @@ FixNPTKokkos::FixNPTKokkos(LAMMPS *lmp, int narg, char **arg) : { this->kokkosable = 1; if (!this->tstat_flag) - this->error->all(FLERR,"Temperature control must be used with fix npt"); + this->error->all(FLERR,"Temperature control must be used with fix npt/kk"); if (!this->pstat_flag) - this->error->all(FLERR,"Pressure control must be used with fix npt"); + this->error->all(FLERR,"Pressure control must be used with fix npt/kk"); // create a new compute temp style // id = fix-ID + temp // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(this->id) + 6; - this->id_temp = new char[n]; - strcpy(this->id_temp,this->id); - strcat(this->id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = this->id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/kk"; - - this->modify->add_compute(3,newarg); - delete [] newarg; + this->id_temp = utils::strdup(std::string(this->id)+"_temp"); + this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); this->tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(this->id) + 7; - this->id_press = new char[n]; - strcpy(this->id_press,this->id); - strcat(this->id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = this->id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = this->id_temp; - this->modify->add_compute(4,newarg); - delete [] newarg; + this->id_press = utils::strdup(std::string(this->id)+"_press"); + this->modify->add_compute(std::string(this->id_press) + +" all pressure "+this->id_temp); this->pcomputeflag = 1; } diff --git a/src/KOKKOS/fix_nvt_kokkos.cpp b/src/KOKKOS/fix_nvt_kokkos.cpp index 25984726b7..f589600dde 100644 --- a/src/KOKKOS/fix_nvt_kokkos.cpp +++ b/src/KOKKOS/fix_nvt_kokkos.cpp @@ -30,25 +30,15 @@ FixNVTKokkos::FixNVTKokkos(LAMMPS *lmp, int narg, char **arg) : { this->kokkosable = 1; if (!this->tstat_flag) - this->error->all(FLERR,"Temperature control must be used with fix nvt"); + this->error->all(FLERR,"Temperature control must be used with fix nvt/kk"); if (this->pstat_flag) - this->error->all(FLERR,"Pressure control can not be used with fix nvt"); + this->error->all(FLERR,"Pressure control can not be used with fix nvt/kk"); // create a new compute temp style // id = fix-ID + temp - int n = strlen(this->id) + 6; - this->id_temp = new char[n]; - strcpy(this->id_temp,this->id); - strcat(this->id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = this->id_temp; - newarg[1] = this->group->names[this->igroup]; - newarg[2] = (char *) "temp/kk"; - - this->modify->add_compute(3,newarg); - delete [] newarg; + this->id_temp = utils::strdup(std::string(this->id)+"_temp"); + this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); this->tcomputeflag = 1; } From e0fdd2ad892531632ce18b6cd929f73367c33b91 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 10:09:08 -0400 Subject: [PATCH 143/370] correct lammps.extract_global() method for returned arrays which are returned as list --- python/lammps/core.py | 21 +++++++++++++++++---- unittest/python/python-commands.py | 9 +++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index be026d5e10..279b0a64dc 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -746,12 +746,21 @@ class lammps(object): :type name: string :param dtype: data type of the returned data (see :ref:`py_datatype_constants`) :type dtype: int, optional - :return: value of the property or None - :rtype: int, float, or NoneType + :return: value of the property or list of values or None + :rtype: int, float, list, or NoneType """ + if dtype == LAMMPS_AUTODETECT: dtype = self.extract_global_datatype(name) + # set length of vector for items that are not a scalar + vec_dict = { 'boxlo':3, 'boxhi':3, 'sublo':3, 'subhi':3, + 'sublo_lambda':3, 'subhi_lambda':3, 'periodicity':3 } + if name in vec_dict: + veclen = vec_dict[name] + else: + veclen = 1 + if name: name = name.encode() else: return None @@ -770,10 +779,14 @@ class lammps(object): ptr = self.lib.lammps_extract_global(self.lmp, name) if ptr: - return target_type(ptr[0]) + if veclen > 1: + result = [] + for i in range(0,veclen): + result.append(target_type(ptr[i])) + return result + else: return target_type(ptr[0]) return None - # ------------------------------------------------------------------------- # extract per-atom info datatype diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index c82e2fdb26..c1e4cecef5 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -268,6 +268,15 @@ create_atoms 1 single & self.assertEqual(self.lmp.extract_global("boxyhi"), 2.0) self.assertEqual(self.lmp.extract_global("boxzlo"), -3.0) self.assertEqual(self.lmp.extract_global("boxzhi"), 3.0) + self.assertEqual(self.lmp.extract_global("boxlo"), [-1.0, -2.0, -3.0]) + self.assertEqual(self.lmp.extract_global("boxhi"), [1.0, 2.0, 3.0]) + self.assertEqual(self.lmp.extract_global("sublo"), [-1.0, -2.0, -3.0]) + self.assertEqual(self.lmp.extract_global("subhi"), [1.0, 2.0, 3.0]) + self.assertEqual(self.lmp.extract_global("periodicity"), [1,1,1]) + # only valid for triclinic box + self.lmp.command("change_box all triclinic") + self.assertEqual(self.lmp.extract_global("sublo_lambda"), [0.0, 0.0, 0.0]) + self.assertEqual(self.lmp.extract_global("subhi_lambda"), [1.0, 1.0, 1.0]) ############################## if __name__ == "__main__": From b8f02d759abdbbd88407818bef22bcc48abe7e43 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 11:22:22 -0400 Subject: [PATCH 144/370] add support for extracting respa levels and timestep values --- python/lammps/core.py | 2 ++ src/library.cpp | 19 ++++++++++++++++++- unittest/python/python-commands.py | 10 ++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 279b0a64dc..b3cdceb1a6 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -758,6 +758,8 @@ class lammps(object): 'sublo_lambda':3, 'subhi_lambda':3, 'periodicity':3 } if name in vec_dict: veclen = vec_dict[name] + elif name == 'respa_dt': + veclen = self.extract_global('respa_levels',LAMMPS_INT) else: veclen = 1 diff --git a/src/library.cpp b/src/library.cpp index 8de36a299f..6f08cffcc2 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -31,12 +31,14 @@ #include "group.h" #include "info.h" #include "input.h" +#include "integrate.h" #include "memory.h" #include "modify.h" #include "molecule.h" #include "neigh_list.h" #include "neighbor.h" #include "region.h" +#include "respa.h" #include "output.h" #include "thermo.h" #include "timer.h" @@ -984,12 +986,14 @@ to then decide how to cast the (void*) pointer and access the data. * \return integer constant encoding the data type of the property * or -1 if not found. */ -int lammps_extract_global_datatype(void *handle, const char *name) +int lammps_extract_global_datatype(void * /*handle*/, const char *name) { if (strcmp(name,"dt") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"ntimestep") == 0) return LAMMPS_BIGINT; if (strcmp(name,"atime") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"atimestep") == 0) return LAMMPS_BIGINT; + if (strcmp(name,"respa_levels") == 0) return LAMMPS_INT; + if (strcmp(name,"respa_dt") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"boxlo") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"boxhi") == 0) return LAMMPS_DOUBLE; @@ -1116,6 +1120,14 @@ report the "native" data type. The following tables are provided: - bigint - 1 - the number of the timestep when "atime" was last updated. + * - respa_levels + - int + - 1 + - number of r-RESPA levels. See :doc:`run_style`. + * - respa_dt + - double + - number of r-RESPA levels + - length of the time steps with r-RESPA. See :doc:`run_style`. .. _extract_box_settings: @@ -1366,6 +1378,11 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"atime") == 0) return (void *) &lmp->update->atime; if (strcmp(name,"atimestep") == 0) return (void *) &lmp->update->atimestep; + if (utils::strmatch(lmp->update->integrate_style,"^respa")) { + Respa *respa = (Respa *)lmp->update->integrate; + if (strcmp(name,"respa_levels") == 0) return (void *) &respa->nlevels; + if (strcmp(name,"respa_dt") == 0) return (void *) respa->step; + } if (strcmp(name,"boxlo") == 0) return (void *) lmp->domain->boxlo; if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi; if (strcmp(name,"sublo") == 0) return (void *) lmp->domain->sublo; diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index c1e4cecef5..3bcb785b74 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -274,6 +274,16 @@ create_atoms 1 single & self.assertEqual(self.lmp.extract_global("subhi"), [1.0, 2.0, 3.0]) self.assertEqual(self.lmp.extract_global("periodicity"), [1,1,1]) # only valid for triclinic box + self.assertEqual(self.lmp.extract_global("respa_levels"), None) + self.assertEqual(self.lmp.extract_global("respa_dt"), None) + + # set and initialize r-RESPA + self.lmp.command("run_style respa 3 5 2 pair 2 kspace 3") + self.lmp.command("mass * 1.0") + self.lmp.command("run 1 post no") + self.assertEqual(self.lmp.extract_global("ntimestep"), 1) + self.assertEqual(self.lmp.extract_global("respa_levels"), 3) + self.assertEqual(self.lmp.extract_global("respa_dt"), [0.0005, 0.0025, 0.005]) self.lmp.command("change_box all triclinic") self.assertEqual(self.lmp.extract_global("sublo_lambda"), [0.0, 0.0, 0.0]) self.assertEqual(self.lmp.extract_global("subhi_lambda"), [1.0, 1.0, 1.0]) From a193d9d429ccf8129db46731bf3716b5b58b2c8c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 11:23:28 -0400 Subject: [PATCH 145/370] fix several issues when using extract_global() from python exposed by tests --- python/lammps/core.py | 3 ++- src/library.cpp | 9 +++++++-- unittest/python/python-commands.py | 13 +++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index b3cdceb1a6..e112c4f3f8 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -777,10 +777,11 @@ class lammps(object): target_type = float elif dtype == LAMMPS_STRING: self.lib.lammps_extract_global.restype = c_char_p - target_type = lambda x: str(x, 'ascii') ptr = self.lib.lammps_extract_global(self.lmp, name) if ptr: + if dtype == LAMMPS_STRING: + return ptr.decode('utf-8') if veclen > 1: result = [] for i in range(0,veclen): diff --git a/src/library.cpp b/src/library.cpp index 6f08cffcc2..a950d31e4e 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -1387,8 +1387,13 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi; if (strcmp(name,"sublo") == 0) return (void *) lmp->domain->sublo; if (strcmp(name,"subhi") == 0) return (void *) lmp->domain->subhi; - if (strcmp(name,"sublo_lambda") == 0) return (void *) lmp->domain->sublo_lamda; - if (strcmp(name,"subhi_lambda") == 0) return (void *) lmp->domain->subhi_lamda; + // these are only valid for a triclinic cell + if (lmp->domain->triclinic) { + if (strcmp(name,"sublo_lambda") == 0) + return (void *) lmp->domain->sublo_lamda; + if (strcmp(name,"subhi_lambda") == 0) + return (void *) lmp->domain->subhi_lamda; + } if (strcmp(name,"boxxlo") == 0) return (void *) &lmp->domain->boxlo[0]; if (strcmp(name,"boxxhi") == 0) return (void *) &lmp->domain->boxhi[0]; if (strcmp(name,"boxylo") == 0) return (void *) &lmp->domain->boxlo[1]; diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 3bcb785b74..3661feb8a0 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -259,9 +259,13 @@ create_atoms 1 single & result = self.lmp.get_thermo(key) self.assertEqual(value, result, key) - def test_extract_global_double(self): + def test_extract_global(self): self.lmp.command("region box block -1 1 -2 2 -3 3") self.lmp.command("create_box 1 box") + self.assertEqual(self.lmp.extract_global("units"), "lj") + self.assertEqual(self.lmp.extract_global("ntimestep"), 0) + self.assertEqual(self.lmp.extract_global("dt"), 0.005) + self.assertEqual(self.lmp.extract_global("boxxlo"), -1.0) self.assertEqual(self.lmp.extract_global("boxxhi"), 1.0) self.assertEqual(self.lmp.extract_global("boxylo"), -2.0) @@ -273,7 +277,9 @@ create_atoms 1 single & self.assertEqual(self.lmp.extract_global("sublo"), [-1.0, -2.0, -3.0]) self.assertEqual(self.lmp.extract_global("subhi"), [1.0, 2.0, 3.0]) self.assertEqual(self.lmp.extract_global("periodicity"), [1,1,1]) - # only valid for triclinic box + self.assertEqual(self.lmp.extract_global("triclinic"), 0) + self.assertEqual(self.lmp.extract_global("sublo_lambda"), None) + self.assertEqual(self.lmp.extract_global("subhi_lambda"), None) self.assertEqual(self.lmp.extract_global("respa_levels"), None) self.assertEqual(self.lmp.extract_global("respa_dt"), None) @@ -284,7 +290,10 @@ create_atoms 1 single & self.assertEqual(self.lmp.extract_global("ntimestep"), 1) self.assertEqual(self.lmp.extract_global("respa_levels"), 3) self.assertEqual(self.lmp.extract_global("respa_dt"), [0.0005, 0.0025, 0.005]) + + # checks only for triclinic boxes self.lmp.command("change_box all triclinic") + self.assertEqual(self.lmp.extract_global("triclinic"), 1) self.assertEqual(self.lmp.extract_global("sublo_lambda"), [0.0, 0.0, 0.0]) self.assertEqual(self.lmp.extract_global("subhi_lambda"), [1.0, 1.0, 1.0]) From cb25e4aa3957b44af87823c2ec9e2f67a28c2845 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Thu, 25 Mar 2021 20:08:32 -0400 Subject: [PATCH 146/370] Add nve respa testcase for python/move --- unittest/force-styles/test_fix_timestep.cpp | 3 +-- unittest/force-styles/tests/py_nve.py | 29 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index aa07f36fb9..f72295716e 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -521,8 +521,7 @@ TEST(FixTimestep, plain) // fix python/move implementation is missing library interface access to Repsa::step ifix = lmp->modify->find_fix("test"); if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && - !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit") && - !utils::strmatch(lmp->modify->fix[ifix]->style, "^python/move") + !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit") ) { if (!verbose) ::testing::internal::CaptureStdout(); diff --git a/unittest/force-styles/tests/py_nve.py b/unittest/force-styles/tests/py_nve.py index 1f05be04a8..57592ea074 100644 --- a/unittest/force-styles/tests/py_nve.py +++ b/unittest/force-styles/tests/py_nve.py @@ -34,6 +34,7 @@ class NVE(LAMMPSFixMove): def __init__(self, ptr, group_name="all"): super(NVE, self).__init__(ptr) assert(self.group_name == "all") + self._step_respa = None def init(self): dt = self.lmp.extract_global("dt") @@ -42,6 +43,12 @@ class NVE(LAMMPSFixMove): self.dtv = dt self.dtf = 0.5 * dt * ftm2v + @property + def step_respa(self): + if not self._step_respa: + self._step_respa = self.lmp.extract_global("respa_dt") + return self._step_respa + def initial_integrate(self, vflag): nlocal = self.lmp.extract_global("nlocal") mass = self.lmp.extract_atom("mass") @@ -72,4 +79,26 @@ class NVE(LAMMPSFixMove): v[i][1] += dtfm * f[i][1] v[i][2] += dtfm * f[i][2] + def initial_integrate_respa(self, vflag, ilevel, iloop): + ftm2v = self.lmp.extract_global("ftm2v") + self.dtv = self.step_respa[ilevel] + self.dtf = 0.5 * self.step_respa[ilevel] * ftm2v + # innermost level - NVE update of v and x + # all other levels - NVE update of v + + if ilevel == 0: + self.initial_integrate(vflag) + else: + self.final_integrate() + + def final_integrate_respa(self, ilevel, iloop): + ftm2v = self.lmp.extract_global("ftm2v") + self.dtf = 0.5 * self.step_respa[ilevel] * ftm2v + self.final_integrate() + + def reset_dt(self): + dt = self.lmp.extract_global("dt") + ftm2v = self.lmp.extract_global("ftm2v") + self.dtv = dt; + self.dtf = 0.5 * dt * ftm2v; From 029db1413e5248e344df1b1a161b4f90e62932eb Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Thu, 25 Mar 2021 21:01:32 -0400 Subject: [PATCH 147/370] Add missing verbose after merge --- unittest/python/test_python_package.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/python/test_python_package.cpp b/unittest/python/test_python_package.cpp index 5a36112781..c240d23875 100644 --- a/unittest/python/test_python_package.cpp +++ b/unittest/python/test_python_package.cpp @@ -33,6 +33,7 @@ std::string INPUT_FOLDER = STRINGIFY(TEST_INPUT_FOLDER); const char * LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent metus."; +bool verbose = false; using LAMMPS_NS::utils::split_words; From 756d935d0651768d042dc7c2dcdd91e0d1e68e5b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 21:13:24 -0400 Subject: [PATCH 148/370] use std:: namespace for STL containers --- src/USER-AWPMD/pair_awpmd_cut.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 3d4e1f12a7..54f851171b 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -150,7 +150,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) # if 1 // mapping of the LAMMPS numbers to the AWPMC numbers - vector gmap(ntot,-1); + std::vector gmap(ntot,-1); for (int ii = 0; ii < inum; ii++) { int i = ilist[ii]; @@ -226,7 +226,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) // prepare the solver object wpmd->reset(); - map > etmap; + std::map > etmap; // add particles to the AWPMD solver object for (int i = 0; i < ntot; i++) { //int i = ilist[ii]; @@ -246,8 +246,8 @@ void PairAWPMDCut::compute(int eflag, int vflag) fi= new Vector_3[wpmd->ni]; // adding electrons - for (map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { - vector &el=it->second; + for (std::map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { + std::vector &el=it->second; if (!el.size()) // should not happen continue; int s=spin[el[0]] >0 ? 0 : 1; From 664335420aebe34d95fa72382f5b5285d64f621e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 26 Mar 2021 11:50:58 -0400 Subject: [PATCH 149/370] Start refactoring tests --- .../formats/test_potential_file_reader.cpp | 120 ++++++------------ unittest/testing/core.h | 75 ++++++++++- 2 files changed, 107 insertions(+), 88 deletions(-) diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 6cf2fd010c..1e3d96d6d7 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -28,37 +28,17 @@ #include "potential_file_reader.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include #include #include -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using namespace LAMMPS_NS; using ::testing::MatchesRegex; using utils::split_words; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } - // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -75,38 +55,16 @@ const int LAMMPS_NS::PairNb3bHarmonic::NPARAMS_PER_LINE; const int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE; const int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE; -class PotentialFileReaderTest : public ::testing::Test { -protected: - LAMMPS *lmp; - - void SetUp() override - { - const char *args[] = { - "PotentialFileReaderTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } +class PotentialFileReaderTest : public LAMMPSTest { }; // open for native units TEST_F(PotentialFileReaderTest, Sw_native) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairSW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE); @@ -115,10 +73,10 @@ TEST_F(PotentialFileReaderTest, Sw_native) // open with supported conversion enabled TEST_F(PotentialFileReaderTest, Sw_conv) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairSW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE); @@ -127,9 +85,9 @@ TEST_F(PotentialFileReaderTest, Sw_conv) // open without conversion enabled TEST_F(PotentialFileReaderTest, Sw_noconv) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR on proc.*potential.*requires metal units but real.*", PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::REAL2METAL);); @@ -137,10 +95,10 @@ TEST_F(PotentialFileReaderTest, Sw_noconv) TEST_F(PotentialFileReaderTest, Comb) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "ffield.comb", "COMB"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairComb::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairComb::NPARAMS_PER_LINE); @@ -148,10 +106,10 @@ TEST_F(PotentialFileReaderTest, Comb) TEST_F(PotentialFileReaderTest, Comb3) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "ffield.comb3", "COMB3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairComb3::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairComb3::NPARAMS_PER_LINE); @@ -159,10 +117,10 @@ TEST_F(PotentialFileReaderTest, Comb3) TEST_F(PotentialFileReaderTest, Tersoff) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairTersoff::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoff::NPARAMS_PER_LINE); @@ -170,10 +128,10 @@ TEST_F(PotentialFileReaderTest, Tersoff) TEST_F(PotentialFileReaderTest, TersoffMod) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffMOD::NPARAMS_PER_LINE); @@ -181,10 +139,10 @@ TEST_F(PotentialFileReaderTest, TersoffMod) TEST_F(PotentialFileReaderTest, TersoffModC) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE); @@ -192,10 +150,10 @@ TEST_F(PotentialFileReaderTest, TersoffModC) TEST_F(PotentialFileReaderTest, TersoffTable) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE); @@ -203,10 +161,10 @@ TEST_F(PotentialFileReaderTest, TersoffTable) TEST_F(PotentialFileReaderTest, TersoffZBL) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairTersoffZBL::NPARAMS_PER_LINE); @@ -214,10 +172,10 @@ TEST_F(PotentialFileReaderTest, TersoffZBL) TEST_F(PotentialFileReaderTest, GW) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "SiC.gw", "GW"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairGW::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairGW::NPARAMS_PER_LINE); @@ -225,10 +183,10 @@ TEST_F(PotentialFileReaderTest, GW) TEST_F(PotentialFileReaderTest, GWZBL) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairGWZBL::NPARAMS_PER_LINE); @@ -236,10 +194,10 @@ TEST_F(PotentialFileReaderTest, GWZBL) TEST_F(PotentialFileReaderTest, Nb3bHarmonic) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairNb3bHarmonic::NPARAMS_PER_LINE); @@ -247,10 +205,10 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic) TEST_F(PotentialFileReaderTest, Vashishta) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto line = reader.next_line(PairVashishta::NPARAMS_PER_LINE); ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE); @@ -261,38 +219,38 @@ TEST_F(PotentialFileReaderTest, UnitConvert) PotentialFileReader *reader; int unit_convert, flag; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); unit_convert = reader->get_unit_convert(); ASSERT_EQ(unit_convert, 0); delete reader; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); flag = utils::get_supported_conversions(utils::UNKNOWN); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); unit_convert = reader->get_unit_convert(); ASSERT_EQ(unit_convert, 0); delete reader; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); flag = utils::get_supported_conversions(utils::ENERGY); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); unit_convert = reader->get_unit_convert(); ASSERT_EQ(unit_convert, 0); delete reader; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); flag = utils::get_supported_conversions(utils::ENERGY); command("units real"); reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); unit_convert = reader->get_unit_convert(); ASSERT_EQ(unit_convert, utils::METAL2REAL); @@ -304,7 +262,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 6243eb219e..19013bf90a 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -16,8 +16,12 @@ #include "info.h" #include "input.h" #include "lammps.h" +#include "variable.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "exceptions.h" + +#include using namespace LAMMPS_NS; @@ -45,29 +49,86 @@ class LAMMPSTest : public ::testing::Test { public: void command(const std::string &line) { lmp->input->one(line.c_str()); } + void BEGIN_HIDE_OUTPUT() { + if (!verbose) ::testing::internal::CaptureStdout(); + } + + void END_HIDE_OUTPUT() { + if (!verbose) ::testing::internal::GetCapturedStdout(); + } + + void BEGIN_CAPTURE_OUTPUT() { + if (!verbose) ::testing::internal::CaptureStdout(); + } + + std::string END_CAPTURE_OUTPUT() { + auto output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + return output; + } + + void HIDE_OUTPUT(std::function f) { + if (!verbose) ::testing::internal::CaptureStdout(); + try { + f(); + } catch(LAMMPSException & e) { + if (!verbose) std::cout << ::testing::internal::GetCapturedStdout(); + throw e; + } + if (!verbose) ::testing::internal::GetCapturedStdout(); + } + + std::string CAPTURE_OUTPUT(std::function f) { + ::testing::internal::CaptureStdout(); + try { + f(); + } catch(LAMMPSException & e) { + if (verbose) std::cout << ::testing::internal::GetCapturedStdout(); + throw e; + } + auto output = ::testing::internal::GetCapturedStdout(); + if (verbose) std::cout << output; + return output; + } + + double get_variable_value(const std::string & name) { + char * str = utils::strdup(fmt::format("v_{}", name)); + double value = lmp->input->variable->compute_equal(str); + delete [] str; + return value; + } + + std::string get_variable_string(const std::string & name) { + return lmp->input->variable->retrieve(name.c_str()); + } + protected: const char *testbinary = "LAMMPSTest"; LAMMPS *lmp; + Info *info; void SetUp() override { const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + HIDE_OUTPUT([&] { + lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); + info = new Info(lmp); + }); InitSystem(); - if (!verbose) ::testing::internal::GetCapturedStdout(); } virtual void InitSystem() {} void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - lmp = nullptr; - if (!verbose) ::testing::internal::GetCapturedStdout(); + HIDE_OUTPUT([&] { + delete info; + delete lmp; + info = nullptr; + lmp = nullptr; + }); } }; From 1752bd02765a25caec346d1a034f7226f131679e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 26 Mar 2021 12:23:58 -0400 Subject: [PATCH 150/370] Refactoring of some test files --- unittest/commands/test_groups.cpp | 121 +++++-------- unittest/commands/test_simple_commands.cpp | 201 ++++++++------------- unittest/testing/core.h | 1 + 3 files changed, 122 insertions(+), 201 deletions(-) diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 3ae1722f4d..181f000a7c 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -22,6 +22,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -29,12 +30,6 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { @@ -42,54 +37,22 @@ using ::testing::ExitedWithCode; using ::testing::MatchesRegex; using ::testing::StrEq; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - if (verbose) std::cout << mesg; \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - if (verbose) std::cout << mesg; \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } - -class GroupTest : public ::testing::Test { +class GroupTest : public LAMMPSTest { protected: - LAMMPS *lmp; Group *group; Domain *domain; void SetUp() override { - const char *args[] = {"GroupTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "GroupTest"; + LAMMPSTest::SetUp(); group = lmp->group; domain = lmp->domain; } - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - std::cout.flush(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } - void atomic_system() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); command("lattice sc 1.0 origin 0.125 0.125 0.125"); command("region box block -2 2 -2 2 -2 2"); @@ -101,23 +64,25 @@ protected: command("region top block INF INF -2.0 -1.0 INF INF"); command("set region left type 2"); command("set region right type 3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void molecular_system() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("fix props all property/atom mol rmass q"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); + atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + + BEGIN_HIDE_OUTPUT(); command("variable molid atom floor(id/4)+1"); command("variable charge atom 2.0*sin(PI/32*id)"); command("set atom * mol v_molid"); command("set atom * charge v_charge"); command("set type 1 mass 0.5"); command("set type 2*4 mass 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } }; @@ -131,7 +96,7 @@ TEST_F(GroupTest, EmptyDelete) { atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group new1 empty"); command("group new2 empty"); command("group new2 empty"); @@ -143,16 +108,16 @@ TEST_F(GroupTest, EmptyDelete) command("compute 1 new3 ke"); command("dump 1 new4 atom 50 dump.melt"); command("atom_modify first new5"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->ngroup, 7); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new3 xxx");); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new3 empty xxx");); TEST_FAILURE(".*ERROR: Group command requires atom attribute molecule.*", command("group new2 include molecule");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); group->assign("new1 delete"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->ngroup, 6); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new2 delete xxx");); @@ -172,13 +137,13 @@ TEST_F(GroupTest, RegionClear) { atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group one region left"); command("group two region right"); command("group three empty"); command("group four region left"); command("group four region right"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("one")), 16); ASSERT_EQ(group->count(group->find("two")), 16); ASSERT_EQ(group->count(group->find("three")), 0); @@ -189,20 +154,20 @@ TEST_F(GroupTest, RegionClear) TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three region left xxx");); TEST_FAILURE(".*ERROR: Group region ID does not exist.*", command("group four region dummy");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group one clear"); command("group two clear"); command("group three clear"); command("group four clear"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("one")), 0); ASSERT_EQ(group->count(group->find("two")), 0); ASSERT_EQ(group->count(group->find("three")), 0); ASSERT_EQ(group->count(group->find("four")), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("delete_atoms region box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("all")), 0); } @@ -214,7 +179,7 @@ TEST_F(GroupTest, SelectRestart) for (int i = 0; i < lmp->atom->natoms; ++i) flags[i] = i & 1; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group one region left"); command("group two region right"); group->create("half", flags); @@ -224,7 +189,7 @@ TEST_F(GroupTest, SelectRestart) command("group five subtract all half four"); command("group top region top"); command("group six intersect half top"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("one")), 16); ASSERT_EQ(group->count(group->find("two")), 16); ASSERT_EQ(group->count(group->find("three")), 0); @@ -235,12 +200,12 @@ TEST_F(GroupTest, SelectRestart) ASSERT_EQ(group->count(group->find("half"), domain->find_region("top")), 8); ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 8.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_restart group.restart"); command("clear"); command("read_restart group.restart"); unlink("group.restart"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); group = lmp->group; ASSERT_EQ(group->count(group->find("one")), 16); ASSERT_EQ(group->count(group->find("two")), 16); @@ -250,11 +215,11 @@ TEST_F(GroupTest, SelectRestart) ASSERT_EQ(group->count(group->find("five")), 16); ASSERT_DOUBLE_EQ(group->mass(group->find("six")), 8.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group four clear"); command("group five clear"); command("group six clear"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Group ID does not exist.*", command("group four union one two xxx");); TEST_FAILURE(".*ERROR: Group ID does not exist.*", @@ -267,14 +232,14 @@ TEST_F(GroupTest, Molecular) { molecular_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group one region left"); command("group two region right"); command("group half id 1:1000:2"); command("group top region top"); command("group three intersect half top"); command("group three include molecule"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("one")), 16); ASSERT_EQ(group->count(group->find("two")), 16); ASSERT_EQ(group->count(group->find("three")), 15); @@ -290,36 +255,36 @@ TEST_F(GroupTest, Dynamic) { atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable step atom id<=step"); command("group half id 1:1000:2"); command("group grow dynamic half var step every 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("grow")), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("run 10 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("grow")), 5); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group grow dynamic half var step every 1"); command("run 10 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("grow")), 10); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group grow static"); command("run 10 post no"); command("group part variable step"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("grow")), 10); ASSERT_EQ(group->count(group->find("part")), 30); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group grow dynamic half var step every 1"); command("run 10 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->count(group->find("grow")), 20); TEST_FAILURE(".*ERROR: Cannot subtract groups using a dynamic group.*", command("group chunk subtract half grow");); @@ -328,10 +293,10 @@ TEST_F(GroupTest, Dynamic) TEST_FAILURE(".*ERROR: Cannot intersect groups using a dynamic group.*", command("group chunk intersect half grow");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group grow delete"); command("variable ramp equal step"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(group->ngroup, 4); TEST_FAILURE(".*ERROR: Group dynamic cannot reference itself.*", @@ -351,7 +316,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 4261dbd61d..2ed5e7a989 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -24,6 +24,7 @@ #include "fmt/format.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -34,11 +35,6 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif using LAMMPS_NS::utils::split_words; @@ -47,43 +43,7 @@ using ::testing::ExitedWithCode; using ::testing::MatchesRegex; using ::testing::StrEq; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } - -class SimpleCommandsTest : public ::testing::Test { -protected: - LAMMPS *lmp; - - void SetUp() override - { - const char *args[] = {"SimpleCommandsTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } +class SimpleCommandsTest : public LAMMPSTest { }; TEST_F(SimpleCommandsTest, UnknownCommand) @@ -96,27 +56,27 @@ TEST_F(SimpleCommandsTest, Echo) ASSERT_EQ(lmp->input->echo_screen, 1); ASSERT_EQ(lmp->input->echo_log, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo none"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->input->echo_screen, 0); ASSERT_EQ(lmp->input->echo_log, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo both"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->input->echo_screen, 1); ASSERT_EQ(lmp->input->echo_log, 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo screen"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->input->echo_screen, 1); ASSERT_EQ(lmp->input->echo_log, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo log"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->input->echo_screen, 0); ASSERT_EQ(lmp->input->echo_log, 1); @@ -128,15 +88,15 @@ TEST_F(SimpleCommandsTest, Log) { ASSERT_EQ(lmp->logfile, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("log simple_command_test.log"); command("print 'test1'"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_NE(lmp->logfile, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("log none"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->logfile, nullptr); std::string text; @@ -146,14 +106,14 @@ TEST_F(SimpleCommandsTest, Log) in.close(); ASSERT_THAT(text, StrEq("test1")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("log simple_command_test.log append"); command("print 'test2'"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_NE(lmp->logfile, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("log none"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->logfile, nullptr); in.open("simple_command_test.log"); @@ -172,59 +132,57 @@ TEST_F(SimpleCommandsTest, Newton) // default setting is "on" for both ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("newton off"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->force->newton_pair, 0); ASSERT_EQ(lmp->force->newton_bond, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("newton on off"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("newton off on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->force->newton_pair, 0); ASSERT_EQ(lmp->force->newton_bond, 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("newton on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->force->newton_pair, 1); ASSERT_EQ(lmp->force->newton_bond, 1); } TEST_F(SimpleCommandsTest, Partition) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo none"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal partition command .*", command("partition xxx 1 echo none");); TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*", command("partition yes 2 echo none");); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("partition yes 1 print 'test'"); - auto text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + auto text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, StrEq("test\n")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("partition no 1 print 'test'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, StrEq("")); } TEST_F(SimpleCommandsTest, Quit) { - ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo none"); - ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Expected integer .*", command("quit xxx");); // the following tests must be skipped with OpenMPI due to using threads - if (have_openmpi) GTEST_SKIP(); + if (Info::get_mpi_vendor() == "Open MPI") GTEST_SKIP(); ASSERT_EXIT(command("quit"), ExitedWithCode(0), ""); ASSERT_EXIT(command("quit 9"), ExitedWithCode(9), ""); } @@ -233,14 +191,14 @@ TEST_F(SimpleCommandsTest, ResetTimestep) { ASSERT_EQ(lmp->update->ntimestep, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_timestep 10"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->ntimestep, 10); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_timestep 0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->ntimestep, 0); TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10");); @@ -257,31 +215,31 @@ TEST_F(SimpleCommandsTest, Suffix) TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix on");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("suffix one"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->suffix, StrEq("one")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("suffix hybrid two three"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->suffix, StrEq("two")); ASSERT_THAT(lmp->suffix2, StrEq("three")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("suffix four"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->suffix, StrEq("four")); ASSERT_EQ(lmp->suffix2, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("suffix off"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->suffix_enable, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("suffix on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->suffix_enable, 1); TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix");); @@ -293,20 +251,20 @@ TEST_F(SimpleCommandsTest, Thermo) { ASSERT_EQ(lmp->output->thermo_every, 0); ASSERT_EQ(lmp->output->var_thermo, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("thermo 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->output->thermo_every, 2); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable step equal logfreq(10,3,10)"); command("thermo v_step"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->output->var_thermo, StrEq("step")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("thermo 10"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->output->thermo_every, 10); ASSERT_EQ(lmp->output->var_thermo, nullptr); @@ -317,26 +275,26 @@ TEST_F(SimpleCommandsTest, Thermo) TEST_F(SimpleCommandsTest, TimeStep) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("timestep 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->dt, 1.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("timestep 0.1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->dt, 0.1); // zero timestep is legal and works (atoms don't move) - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("timestep 0.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->dt, 0.0); // negative timestep also creates a viable MD. - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("timestep -0.1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->dt, -0.1); TEST_FAILURE(".*ERROR: Illegal timestep command.*", command("timestep");); @@ -352,16 +310,16 @@ TEST_F(SimpleCommandsTest, Units) ASSERT_THAT(lmp->update->unit_style, StrEq("lj")); for (std::size_t i = 0; i < num; ++i) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("units {}", names[i])); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->update->unit_style, StrEq(names[i])); ASSERT_EQ(lmp->update->dt, dt[i]); } - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(lmp->update->unit_style, StrEq("lj")); TEST_FAILURE(".*ERROR: Illegal units command.*", command("units unknown");); @@ -369,18 +327,18 @@ TEST_F(SimpleCommandsTest, Units) TEST_F(SimpleCommandsTest, Shell) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("shell putenv TEST_VARIABLE=simpletest"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); char *test_var = getenv("TEST_VARIABLE"); ASSERT_NE(test_var, nullptr); ASSERT_THAT(test_var, StrEq("simpletest")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("shell putenv TEST_VARIABLE=simpletest"); command("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); char *test_var2 = getenv("TEST_VARIABLE2"); char *other_var = getenv("OTHER_VARIABLE"); @@ -398,32 +356,30 @@ TEST_F(SimpleCommandsTest, CiteMe) lmp->citeme = new LAMMPS_NS::CiteMe(lmp, CiteMe::TERSE, CiteMe::TERSE, nullptr); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 1\n"); lmp->citeme->add("test citation two:\n 2\n"); lmp->citeme->add("test citation one:\n 1\n"); lmp->citeme->flush(); - std::string text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + std::string text = END_CAPTURE_OUTPUT(); // find the two unique citations, but not the third ASSERT_THAT(text, MatchesRegex(".*one.*two.*")); ASSERT_THAT(text, Not(MatchesRegex(".*one.*two.*one.*"))); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 0\n"); lmp->citeme->add("test citation two:\n 2\n"); lmp->citeme->add("test citation three:\n 3\n"); lmp->citeme->flush(); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); // find the forth (only differs in long citation) and sixth added citation ASSERT_THAT(text, MatchesRegex(".*one.*three.*")); ASSERT_THAT(text, Not(MatchesRegex(".*two.*"))); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); lmp->citeme->add("test citation one:\n 1\n"); lmp->citeme->add("test citation two:\n 2\n"); lmp->citeme->add("test citation one:\n 0\n"); @@ -431,8 +387,7 @@ TEST_F(SimpleCommandsTest, CiteMe) lmp->citeme->add("test citation three:\n 3\n"); lmp->citeme->flush(); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); // no new citation. no CITE-CITE-CITE- lines ASSERT_THAT(text, Not(MatchesRegex(".*CITE-CITE-CITE-CITE.*"))); @@ -444,7 +399,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 19013bf90a..01c5872579 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -129,6 +129,7 @@ protected: info = nullptr; lmp = nullptr; }); + std::cout.flush(); } }; From e85f945d8e22ab813c472c6b3857fc5a4576440f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 26 Mar 2021 23:12:29 -0400 Subject: [PATCH 151/370] fix typos --- cmake/CMakeLists.txt | 2 +- doc/src/pair_polymorphic.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 06600d02c4..6d98385d02 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -31,7 +31,7 @@ endif() # If enabled, no need to use LD_LIBRARY_PATH / DYLD_LIBRARY_PATH when installed option(LAMMPS_INSTALL_RPATH "Set runtime path for shared libraries linked to LAMMPS binaries" OFF) -if (LAMMPS_INSTALL_RPATH) +if(LAMMPS_INSTALL_RPATH) set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) endif() diff --git a/doc/src/pair_polymorphic.rst b/doc/src/pair_polymorphic.rst index 6abe037581..3df70a017c 100644 --- a/doc/src/pair_polymorphic.rst +++ b/doc/src/pair_polymorphic.rst @@ -319,7 +319,7 @@ This pair style is part of the MANYBODY package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. -This pair potential requires the :doc:`newtion ` setting to be +This pair potential requires the :doc:`newton ` setting to be "on" for pair interactions. The potential files provided with LAMMPS (see the potentials directory) From 35abca1b40de24c634bce37c2173f56028d07ae9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Mar 2021 11:18:59 -0400 Subject: [PATCH 152/370] we should include when using strcasecmp() --- src/USER-DIFFRACTION/compute_saed.cpp | 1 + src/USER-DIFFRACTION/compute_xrd.cpp | 1 + src/USER-MOLFILE/molfile_interface.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index e825006dba..b1fa296315 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -30,6 +30,7 @@ #include #include +#include // for strcasecmp() #include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index a077df0183..720e5809b1 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -31,6 +31,7 @@ #include #include +#include // for strcasecmp() #include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 1ced86da86..dc40859127 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // for strcasecmp() #if defined(_WIN32) #include From 0b73ab96d2fa979f5fe3c8bb9e1c7514c52f97d1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Mar 2021 11:10:36 -0400 Subject: [PATCH 153/370] avoid replicated code, consolidate variables and element mapping --- src/GPU/pair_sw_gpu.cpp | 6 +- src/GPU/pair_tersoff_gpu.cpp | 4 +- src/GPU/pair_tersoff_mod_gpu.cpp | 4 +- src/GPU/pair_tersoff_zbl_gpu.cpp | 4 +- src/GPU/pair_vashishta_gpu.cpp | 4 +- src/KOKKOS/pair_sw_kokkos.cpp | 36 ++-- src/KOKKOS/pair_sw_kokkos.h | 2 +- src/KOKKOS/pair_tersoff_kokkos.cpp | 2 +- src/KOKKOS/pair_tersoff_mod_kokkos.cpp | 2 +- src/KOKKOS/pair_tersoff_zbl_kokkos.cpp | 2 +- src/KOKKOS/pair_vashishta_kokkos.cpp | 38 ++-- src/KOKKOS/pair_vashishta_kokkos.h | 2 +- src/MANYBODY/pair_adp.cpp | 2 - src/MANYBODY/pair_adp.h | 2 - src/MANYBODY/pair_bop.cpp | 13 +- src/MANYBODY/pair_bop.h | 5 - src/MANYBODY/pair_comb.cpp | 105 ++-------- src/MANYBODY/pair_comb.h | 6 - src/MANYBODY/pair_comb3.cpp | 183 ++++++------------ src/MANYBODY/pair_comb3.h | 6 - src/MANYBODY/pair_eam.cpp | 4 +- src/MANYBODY/pair_eam.h | 2 - src/MANYBODY/pair_eim.cpp | 63 +----- src/MANYBODY/pair_eim.h | 4 - src/MANYBODY/pair_gw.cpp | 85 +------- src/MANYBODY/pair_gw.h | 6 - src/MANYBODY/pair_lcbop.cpp | 45 +---- src/MANYBODY/pair_lcbop.h | 3 - src/MANYBODY/pair_nb3b_harmonic.cpp | 83 +------- src/MANYBODY/pair_nb3b_harmonic.h | 6 - src/MANYBODY/pair_polymorphic.cpp | 70 +------ src/MANYBODY/pair_polymorphic.h | 5 - src/MANYBODY/pair_sw.cpp | 85 +------- src/MANYBODY/pair_sw.h | 6 - src/MANYBODY/pair_tersoff.cpp | 85 +------- src/MANYBODY/pair_tersoff.h | 6 - src/MANYBODY/pair_tersoff_mod.cpp | 8 +- src/MANYBODY/pair_vashishta.cpp | 85 +------- src/MANYBODY/pair_vashishta.h | 6 - src/MANYBODY/pair_vashishta_table.cpp | 10 +- src/SNAP/pair_snap.cpp | 94 +-------- src/SNAP/pair_snap.h | 3 - src/USER-INTEL/pair_sw_intel.cpp | 4 +- src/USER-INTEL/pair_tersoff_intel.cpp | 4 +- src/USER-MEAMC/pair_meamc.cpp | 119 ++++++------ src/USER-MEAMC/pair_meamc.h | 9 +- src/USER-MISC/pair_agni.cpp | 78 +------- src/USER-MISC/pair_agni.h | 5 - src/USER-MISC/pair_drip.cpp | 78 +------- src/USER-MISC/pair_drip.h | 4 - src/USER-MISC/pair_edip.cpp | 101 ++-------- src/USER-MISC/pair_edip.h | 6 - src/USER-MISC/pair_edip_multi.cpp | 84 +------- src/USER-MISC/pair_edip_multi.h | 6 - src/USER-MISC/pair_extep.cpp | 89 ++------- src/USER-MISC/pair_extep.h | 26 +-- src/USER-MISC/pair_ilp_graphene_hbn.cpp | 85 +------- src/USER-MISC/pair_ilp_graphene_hbn.h | 6 - src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 85 +------- src/USER-MISC/pair_kolmogorov_crespi_full.h | 6 - src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 49 +---- src/USER-MISC/pair_kolmogorov_crespi_z.h | 6 - src/USER-MISC/pair_lebedeva_z.cpp | 54 +----- src/USER-MISC/pair_lebedeva_z.h | 6 - src/USER-MISC/pair_meam_spline.cpp | 27 +-- src/USER-MISC/pair_meam_spline.h | 4 - src/USER-MISC/pair_meam_sw_spline.cpp | 78 +------- src/USER-MISC/pair_meam_sw_spline.h | 3 - src/USER-MISC/pair_tersoff_table.cpp | 130 +++---------- src/USER-MISC/pair_tersoff_table.h | 6 - src/USER-OMP/pair_agni_omp.cpp | 2 +- src/USER-OMP/pair_comb_omp.cpp | 18 +- src/USER-OMP/pair_edip_omp.cpp | 6 +- src/USER-OMP/pair_sw_omp.cpp | 8 +- src/USER-OMP/pair_tersoff_mod_c_omp.cpp | 8 +- src/USER-OMP/pair_tersoff_mod_omp.cpp | 8 +- src/USER-OMP/pair_tersoff_omp.cpp | 8 +- src/USER-OMP/pair_tersoff_table_omp.cpp | 24 +-- src/USER-OMP/pair_vashishta_omp.cpp | 8 +- src/USER-OMP/pair_vashishta_table_omp.cpp | 8 +- src/USER-REAXC/pair_reaxc.cpp | 25 ++- src/USER-REAXC/pair_reaxc.h | 3 - src/USER-SMTBQ/pair_smtbq.cpp | 78 +------- src/USER-SMTBQ/pair_smtbq.h | 9 +- src/input.cpp | 3 + src/pair.cpp | 74 +++++++ src/pair.h | 28 ++- src/pair_coul_streitz.cpp | 84 ++------ src/pair_coul_streitz.h | 8 +- 89 files changed, 601 insertions(+), 2159 deletions(-) diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index 7bfbe2810f..b819580488 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -186,7 +186,7 @@ void PairSWGPU::init_style() if (i < 0 || j < 0) continue; else { - int ijparam = elem2param[i][j][j]; + int ijparam = elem3param[i][j][j]; ncutsq[ii][jj] = params[ijparam].cutsq; ncut[ii][jj] = params[ijparam].cut; sigma[ii][jj] = params[ijparam].sigma; @@ -206,7 +206,7 @@ void PairSWGPU::init_style() if (k < 0) continue; else { - int ijkparam = elem2param[i][j][k]; + int ijkparam = elem3param[i][j][k]; costheta[ii][jj][kk] = params[ijkparam].costheta; lambda_epsilon[ii][jj][kk] = params[ijkparam].lambda_epsilon; } @@ -218,7 +218,7 @@ void PairSWGPU::init_style() int success = sw_gpu_init(tp1, atom->nlocal, atom->nlocal+atom->nghost, mnf, cell_size, gpu_mode, screen, ncutsq, ncut, sigma, powerp, powerq, sigma_gamma, c1, c2, c3, c4, c5, - c6, lambda_epsilon, costheta, map, elem2param); + c6, lambda_epsilon, costheta, map, elem3param); memory->destroy(ncutsq); memory->destroy(ncut); diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index e675ba6903..c2f3413d3d 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -41,7 +41,7 @@ using namespace LAMMPS_NS; int tersoff_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, FILE *screen, int* host_map, const int nelements, - int*** host_elem2param, const int nparams, + int*** host_elem3param, const int nparams, const double* ts_lam1, const double* ts_lam2, const double* ts_lam3, const double* ts_powermint, const double* ts_biga, const double* ts_bigb, @@ -218,7 +218,7 @@ void PairTersoffGPU::init_style() int success = tersoff_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, mnf, cell_size, gpu_mode, screen, map, nelements, - elem2param, nparams, lam1, lam2, lam3, + elem3param, nparams, lam1, lam2, lam3, powermint, biga, bigb, bigr, bigd, c1, c2, c3, c4, c, d, h, gamma, beta, powern, _cutsq); diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index 98a7248c1f..6a5e9892ec 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; int tersoff_mod_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, FILE *screen, - int* host_map, const int nelements, int*** host_elem2param, const int nparams, + int* host_map, const int nelements, int*** host_elem3param, const int nparams, const double* ts_lam1, const double* ts_lam2, const double* ts_lam3, const double* ts_powermint, const double* ts_biga, const double* ts_bigb, const double* ts_bigr, const double* ts_bigd, const double* ts_c1, @@ -211,7 +211,7 @@ void PairTersoffMODGPU::init_style() int success = tersoff_mod_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, mnf, cell_size, gpu_mode, screen, map, nelements, - elem2param, nparams, lam1, lam2, lam3, + elem3param, nparams, lam1, lam2, lam3, powermint, biga, bigb, bigr, bigd, c1, c2, c3, c4, c5, h, beta, powern, powern_del, ca1, _cutsq); diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index e17b48fec5..0c56212fef 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -41,7 +41,7 @@ using namespace LAMMPS_NS; int tersoff_zbl_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, FILE *screen, int* host_map, const int nelements, - int*** host_elem2param, const int nparams, + int*** host_elem3param, const int nparams, const double* ts_lam1, const double* ts_lam2, const double* ts_lam3, const double* ts_powermint, const double* ts_biga, const double* ts_bigb, @@ -227,7 +227,7 @@ void PairTersoffZBLGPU::init_style() int success = tersoff_zbl_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, mnf, cell_size, gpu_mode, screen, map, nelements, - elem2param, nparams, lam1, lam2, lam3, + elem3param, nparams, lam1, lam2, lam3, powermint, biga, bigb, bigr, bigd, c1, c2, c3, c4, c, d, h, gamma, beta, powern, Z_i, Z_j, ZBLcut, ZBLexpscale, diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index c5dd722974..b3c703952f 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -41,7 +41,7 @@ using namespace LAMMPS_NS; int vashishta_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, FILE *screen, int* host_map, - const int nelements, int*** host_elem2param, + const int nelements, int*** host_elem3param, const int nparams, const double* cutsq, const double* r0, const double* gamma, const double* eta, const double* lam1inv, const double* lam4inv, @@ -217,7 +217,7 @@ void PairVashishtaGPU::init_style() int mnf = 5e-2 * neighbor->oneatom; int success = vashishta_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, mnf, cell_size, gpu_mode, screen, map, nelements, - elem2param, nparams, cutsq, r0, gamma, eta, lam1inv, + elem3param, nparams, cutsq, r0, gamma, eta, lam1inv, lam4inv, zizj, mbigd, dvrc, big6w, heta, bigh, bigw, c0, costheta, bigb, big2b, bigc); memory->destroy(cutsq); diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 5d629dc42a..2fb90b7aec 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -289,7 +289,7 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf const X_FLOAT delz = ztmp - x(j,2); const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - const int ijparam = d_elem2param(itype,jtype,jtype); + const int ijparam = d_elem3param(itype,jtype,jtype); if (rsq >= d_params[ijparam].cutsq) continue; twobody(d_params[ijparam],rsq,fpair,eflag,evdwl); @@ -313,7 +313,7 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf int j = d_neighbors_short(i,jj); j &= NEIGHMASK; const int jtype = d_map[type[j]]; - const int ijparam = d_elem2param(itype,jtype,jtype); + const int ijparam = d_elem3param(itype,jtype,jtype); delr1[0] = x(j,0) - xtmp; delr1[1] = x(j,1) - ytmp; delr1[2] = x(j,2) - ztmp; @@ -328,8 +328,8 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf int k = d_neighbors_short(i,kk); k &= NEIGHMASK; const int ktype = d_map[type[k]]; - const int ikparam = d_elem2param(itype,ktype,ktype); - const int ijkparam = d_elem2param(itype,jtype,ktype); + const int ikparam = d_elem3param(itype,ktype,ktype); + const int ijkparam = d_elem3param(itype,jtype,ktype); delr2[0] = x(k,0) - xtmp; delr2[1] = x(k,1) - ytmp; @@ -412,7 +412,7 @@ void PairSWKokkos::operator()(TagPairSWComputeFullA= d_params[ijparam].cutsq) continue; @@ -434,7 +434,7 @@ void PairSWKokkos::operator()(TagPairSWComputeFullA::operator()(TagPairSWComputeFullA::operator()(TagPairSWComputeFullB= nlocal) continue; const int jtype = d_map[type[j]]; - const int jiparam = d_elem2param(jtype,itype,itype); + const int jiparam = d_elem3param(jtype,itype,itype); const X_FLOAT xtmpj = x(j,0); const X_FLOAT ytmpj = x(j,1); const X_FLOAT ztmpj = x(j,2); @@ -530,8 +530,8 @@ void PairSWKokkos::operator()(TagPairSWComputeFullB::setup_params() { PairSW::setup_params(); - // sync elem2param and params + // sync elem3param and params - tdual_int_3d k_elem2param = tdual_int_3d("pair:elem2param",nelements,nelements,nelements); - t_host_int_3d h_elem2param = k_elem2param.h_view; + tdual_int_3d k_elem3param = tdual_int_3d("pair:elem3param",nelements,nelements,nelements); + t_host_int_3d h_elem3param = k_elem3param.h_view; tdual_param_1d k_params = tdual_param_1d("pair:params",nparams); t_host_param_1d h_params = k_params.h_view; @@ -646,17 +646,17 @@ void PairSWKokkos::setup_params() for (int i = 0; i < nelements; i++) for (int j = 0; j < nelements; j++) for (int k = 0; k < nelements; k++) - h_elem2param(i,j,k) = elem2param[i][j][k]; + h_elem3param(i,j,k) = elem3param[i][j][k]; for (int m = 0; m < nparams; m++) h_params[m] = params[m]; - k_elem2param.template modify(); - k_elem2param.template sync(); + k_elem3param.template modify(); + k_elem3param.template sync(); k_params.template modify(); k_params.template sync(); - d_elem2param = k_elem2param.template view(); + d_elem3param = k_elem3param.template view(); d_params = k_params.template view(); } diff --git a/src/KOKKOS/pair_sw_kokkos.h b/src/KOKKOS/pair_sw_kokkos.h index 31b7f3301d..b9f4559bc2 100644 --- a/src/KOKKOS/pair_sw_kokkos.h +++ b/src/KOKKOS/pair_sw_kokkos.h @@ -102,7 +102,7 @@ class PairSWKokkos : public PairSW { typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread; typedef typename tdual_int_3d::t_host t_host_int_3d; - t_int_3d_randomread d_elem2param; + t_int_3d_randomread d_elem3param; typename AT::t_int_1d_randomread d_map; typedef Kokkos::DualView tdual_param_1d; diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 41a32a61e3..72a79c0b49 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -125,7 +125,7 @@ void PairTersoffKokkos::setup_params() for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) for (k = 1; k <= n; k++) { - m = elem2param[map[i]][map[j]][map[k]]; + m = elem3param[map[i]][map[j]][map[k]]; k_params.h_view(i,j,k).powerm = params[m].powerm; k_params.h_view(i,j,k).gamma = params[m].gamma; k_params.h_view(i,j,k).lam3 = params[m].lam3; diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index bd8e4d7528..c8431abc4b 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -124,7 +124,7 @@ void PairTersoffMODKokkos::setup_params() for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) for (k = 1; k <= n; k++) { - m = elem2param[map[i]][map[j]][map[k]]; + m = elem3param[map[i]][map[j]][map[k]]; k_params.h_view(i,j,k).powerm = params[m].powerm; k_params.h_view(i,j,k).lam3 = params[m].lam3; k_params.h_view(i,j,k).h = params[m].h; diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 5e201dbc1c..3c362ad340 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -135,7 +135,7 @@ void PairTersoffZBLKokkos::setup_params() for (i = 1; i <= n; i++) for (j = 1; j <= n; j++) for (k = 1; k <= n; k++) { - m = elem2param[map[i]][map[j]][map[k]]; + m = elem3param[map[i]][map[j]][map[k]]; k_params.h_view(i,j,k).powerm = params[m].powerm; k_params.h_view(i,j,k).gamma = params[m].gamma; k_params.h_view(i,j,k).lam3 = params[m].lam3; diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index 4b7b50afe9..71f3215931 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -208,7 +208,7 @@ void PairVashishtaKokkos::operator()(TagPairVashishtaComputeShortNei int j = d_neighbors(i,jj); j &= NEIGHMASK; const int jtype = d_map[type[j]]; - const int ijparam = d_elem2param(itype,jtype,jtype); + const int ijparam = d_elem3param(itype,jtype,jtype); const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); @@ -279,7 +279,7 @@ void PairVashishtaKokkos::operator()(TagPairVashishtaComputeHalf::operator()(TagPairVashishtaComputeHalf::operator()(TagPairVashishtaComputeHalf::operator()(TagPairVashishtaComputeFullA::operator()(TagPairVashishtaComputeFullA::operator()(TagPairVashishtaComputeFullA::operator()(TagPairVashishtaComputeFullB= nlocal) continue; const int jtype = d_map[type[j]]; - const int jiparam = d_elem2param(jtype,itype,itype); + const int jiparam = d_elem3param(jtype,itype,itype); const X_FLOAT xtmpj = x(j,0); const X_FLOAT ytmpj = x(j,1); const X_FLOAT ztmpj = x(j,2); @@ -508,8 +508,8 @@ void PairVashishtaKokkos::operator()(TagPairVashishtaComputeFullB::setup_params() { PairVashishta::setup_params(); - // sync elem2param and params + // sync elem3param and params - tdual_int_3d k_elem2param = tdual_int_3d("pair:elem2param",nelements,nelements,nelements); - t_host_int_3d h_elem2param = k_elem2param.h_view; + tdual_int_3d k_elem3param = tdual_int_3d("pair:elem3param",nelements,nelements,nelements); + t_host_int_3d h_elem3param = k_elem3param.h_view; tdual_param_1d k_params = tdual_param_1d("pair:params",nparams); t_host_param_1d h_params = k_params.h_view; @@ -622,17 +622,17 @@ void PairVashishtaKokkos::setup_params() for (int i = 0; i < nelements; i++) for (int j = 0; j < nelements; j++) for (int k = 0; k < nelements; k++) - h_elem2param(i,j,k) = elem2param[i][j][k]; + h_elem3param(i,j,k) = elem3param[i][j][k]; for (int m = 0; m < nparams; m++) h_params[m] = params[m]; - k_elem2param.template modify(); - k_elem2param.template sync(); + k_elem3param.template modify(); + k_elem3param.template sync(); k_params.template modify(); k_params.template sync(); - d_elem2param = k_elem2param.template view(); + d_elem3param = k_elem3param.template view(); d_params = k_params.template view(); } diff --git a/src/KOKKOS/pair_vashishta_kokkos.h b/src/KOKKOS/pair_vashishta_kokkos.h index 14dcf755df..aa8543e751 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.h +++ b/src/KOKKOS/pair_vashishta_kokkos.h @@ -102,7 +102,7 @@ class PairVashishtaKokkos : public PairVashishta { typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread; typedef typename tdual_int_3d::t_host t_host_int_3d; - t_int_3d_randomread d_elem2param; + t_int_3d_randomread d_elem3param; typename AT::t_int_1d_randomread d_map; typedef Kokkos::DualView tdual_param_1d; diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index aa11e0682a..59afbc280b 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -45,7 +45,6 @@ PairADP::PairADP(LAMMPS *lmp) : Pair(lmp) fp = nullptr; mu = nullptr; lambda = nullptr; - map = nullptr; setfl = nullptr; @@ -86,7 +85,6 @@ PairADP::~PairADP() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; delete [] type2frho; memory->destroy(type2rhor); memory->destroy(type2z2r); diff --git a/src/MANYBODY/pair_adp.h b/src/MANYBODY/pair_adp.h index 65596113ba..6a292dda14 100644 --- a/src/MANYBODY/pair_adp.h +++ b/src/MANYBODY/pair_adp.h @@ -67,8 +67,6 @@ class PairADP : public Pair { // potentials as file data - int *map; // which element each atom type maps to - struct Setfl { char **elements; int nelements,nrho,nr; diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index be4f17b291..a8f64853bc 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -69,7 +69,6 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp) BOP_index3 = nullptr; BOP_total = nullptr; BOP_total3 = nullptr; - map = nullptr; pi_a = nullptr; pro_delta = nullptr; pi_delta = nullptr; @@ -184,7 +183,6 @@ PairBOP::~PairBOP() if (allocated) { memory_theta_destroy(); if (otfly==0) memory->destroy(cos_index); - delete [] map; memory->destroy(BOP_index); memory->destroy(BOP_total); @@ -620,11 +618,6 @@ void PairBOP::coeff(int narg, char **arg) if (narg != 3 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients"); - // ensure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - // read the potential file nr=2000; nBOt=2000; @@ -657,6 +650,7 @@ void PairBOP::coeff(int narg, char **arg) if (elements) { for (i = 0; i < bop_types; i++) delete [] elements[i]; delete [] elements; + elements = nullptr; } } // clear setflag since coeff() called once with I,J = * * @@ -4922,10 +4916,7 @@ void _noopt PairBOP::read_table(char *filename) ValueTokenizer values = reader.next_values(3); values.next_int(); values.next_double(); - std::string name = values.next_string(); - - elements[i] = new char[name.length()+1]; - strcpy(elements[i], name.c_str()); + elements[i] = utils::strdup(values.next_string()); } ValueTokenizer values = reader.next_values(2); diff --git a/src/MANYBODY/pair_bop.h b/src/MANYBODY/pair_bop.h index d61c969094..ba75d5c591 100644 --- a/src/MANYBODY/pair_bop.h +++ b/src/MANYBODY/pair_bop.h @@ -46,17 +46,12 @@ class PairBOP : public Pair { int update_list; // check for changing maximum size of neighbor list int maxbopn; // maximum size of bop neighbor list for allocation int maxnall; // maximum size of bop neighbor list for allocation - int *map; // mapping from atom types to elements - int nelements; // # of unique elements int nr; // increments for the BOP pair potential int ntheta; // increments for the angle function int npower; // power of the angular function int nBOt; // second BO increments int bop_types; // number of elements in potential int npairs; // number of element pairs - char **elements; // names of unique elements - int ***elem2param; - int nparams; int bop_step; int allocate_neigh; int nb_pi,nb_sg; diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 2d93c6783e..a1fc65deb7 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -62,12 +62,7 @@ PairComb::PairComb(LAMMPS *lmp) : Pair(lmp) map = nullptr; esm = nullptr; - nelements = 0; - elements = nullptr; - nparams = 0; - maxparam = 0; params = nullptr; - elem2param = nullptr; intype = nullptr; fafb = nullptr; @@ -97,12 +92,8 @@ PairComb::~PairComb() { memory->destroy(NCo); - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - - delete [] elements; memory->sfree(params); - memory->destroy(elem2param); + memory->destroy(elem3param); memory->destroy(intype); memory->destroy(fafb); @@ -120,7 +111,6 @@ PairComb::~PairComb() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; delete [] esm; } } @@ -184,7 +174,7 @@ void PairComb::compute(int eflag, int vflag) iq = q[i]; NCo[i] = 0; nj = 0; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; // self energy, only on i atom @@ -223,7 +213,7 @@ void PairComb::compute(int eflag, int vflag) dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // long range q-dependent @@ -282,7 +272,7 @@ void PairComb::compute(int eflag, int vflag) for (jj = 0; jj < sht_jnum; jj++) { j = sht_jlist[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (params[iparam_ij].hfocor > 0.0) { delr1[0] = x[j][0] - xtmp; @@ -303,7 +293,7 @@ void PairComb::compute(int eflag, int vflag) j = sht_jlist[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // this Qj for q-dependent BSi @@ -326,7 +316,7 @@ void PairComb::compute(int eflag, int vflag) k = sht_jlist[kk]; if (j == k) continue; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -370,7 +360,7 @@ void PairComb::compute(int eflag, int vflag) k = sht_jlist[kk]; if (j == k) continue; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -445,54 +435,15 @@ void PairComb::settings(int narg, char **/*arg*/) void PairComb::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - n = atom->ntypes; - // generate streitz-mintmire direct 1/r energy look-up table if (comm->me == 0 && screen) @@ -506,24 +457,6 @@ void PairComb::coeff(int narg, char **arg) else fputs(" will not apply over-coordination correction ...\n",screen); } - - // clear setflag since coeff() called once with I,J = * * - - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -741,12 +674,12 @@ void PairComb::setup_params() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -760,7 +693,7 @@ void PairComb::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // compute parameter values derived from inputs @@ -1403,7 +1336,7 @@ void PairComb::sm_table() if (map[i+1] < 0) continue; r = drin; itype = params[map[i+1]].ielement; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; z = params[iparam_i].esm1; if (comm->me == 0 && screen) @@ -1425,7 +1358,7 @@ void PairComb::sm_table() if (j == i) { itype = params[map[i+1]].ielement; inty = intype[itype][itype]; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; z = params[iparam_i].esm1; zrc = z * rc; exp2ersh = exp(-2.0 * zrc); @@ -1451,10 +1384,10 @@ void PairComb::sm_table() itype = params[map[i+1]].ielement; jtype = params[map[j+1]].ielement; inty = intype[itype][jtype]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; ea = params[iparam_ij].esm1; ea3 = ea*ea*ea; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ji = elem3param[jtype][itype][itype]; eb = params[iparam_ji].esm1; eb3 = eb*eb*eb; E1 = ea*eb3*eb/((ea+eb)*(ea+eb)*(ea-eb)*(ea-eb)); @@ -1672,7 +1605,7 @@ double PairComb::yasu_char(double *qf_fix, int &igroup) ytmp = x[i][1]; ztmp = x[i][2]; iq = q[i]; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; // charge force from self energy @@ -1706,7 +1639,7 @@ double PairComb::yasu_char(double *qf_fix, int &igroup) delr1[2] = x[j][2] - ztmp; rsq1 = dot3(delr1,delr1); - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // long range q-dependent @@ -1743,7 +1676,7 @@ double PairComb::yasu_char(double *qf_fix, int &igroup) delr1[2] = x[j][2] - ztmp; rsq1 = dot3(delr1,delr1); - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq1 > params[iparam_ij].cutsq) continue; nj ++; diff --git a/src/MANYBODY/pair_comb.h b/src/MANYBODY/pair_comb.h index c127bc0543..51b522badf 100644 --- a/src/MANYBODY/pair_comb.h +++ b/src/MANYBODY/pair_comb.h @@ -62,12 +62,6 @@ class PairComb : public Pair { }; double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets double precision; Param *params; // parameter set for an I-J-K interaction diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index d7814737ea..a0fa3b96b6 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -63,12 +63,7 @@ PairComb3::PairComb3(LAMMPS *lmp) : Pair(lmp) map = nullptr; esm = nullptr; - nelements = 0; - elements = nullptr; - nparams = 0; - maxparam = 0; params = nullptr; - elem2param = nullptr; intype = nullptr; afb = nullptr; @@ -107,12 +102,8 @@ PairComb3::~PairComb3() { memory->destroy(NCo); - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - - delete [] elements; memory->sfree(params); - memory->destroy(elem2param); + memory->destroy(elem3param); memory->destroy(afb); memory->destroy(dpl); @@ -139,7 +130,6 @@ PairComb3::~PairComb3() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutghost); - delete [] map; delete [] esm; } @@ -184,78 +174,31 @@ void PairComb3::settings(int narg, char **arg) void PairComb3::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); + cflag = 0; + for (int i = 3; i < narg; i++) + if (strcmp(arg[i],"C") == 0) { + cflag = 1; + break; + } - // insure I,J args are * * - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if ((strcmp(arg[i],"C") == 0) && (cflag == 0)) { - if (comm->me == 0 && screen) - fputs(" PairComb3: Found C: reading additional library file\n",screen); + if (cflag) { + if (comm->me == 0 && screen) + fputs(" PairComb3: Found C: reading additional library file\n",screen); read_lib(); - cflag = 1; - } - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } } + map_element2type(narg-3,arg+3); + // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - n = atom->ntypes; - // generate Wolf 1/r energy and van der Waals look-up tables + tables(); - - // clear setflag since coeff() called once with I,J = * * - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - } /* ---------------------------------------------------------------------- @@ -687,12 +630,12 @@ void PairComb3::setup_params() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -706,7 +649,7 @@ void PairComb3::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // compute parameter values derived from inputs @@ -804,7 +747,7 @@ void PairComb3::Short_neigh() delrj[2] = x[i][2] - x[j][2]; rsq1 = dot3(delrj,delrj); jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq1 > cutmin) continue; @@ -928,8 +871,8 @@ void PairComb3::compute(int eflag, int vflag) delrj[2] = x[j][2] - ztmp; rsq = dot3(delrj,delrj); - iparam_ij = elem2param[itype][jtype][jtype]; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ij = elem3param[itype][jtype][jtype]; + iparam_ji = elem3param[jtype][itype][itype]; if (rsq > params[iparam_ij].lcutsq) continue; @@ -950,7 +893,7 @@ void PairComb3::compute(int eflag, int vflag) ztmp = x[i][2]; iq = q[i]; nj = 0; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; // self energy, only on i atom yaself = self(¶ms[iparam_i],iq); @@ -991,8 +934,8 @@ void PairComb3::compute(int eflag, int vflag) dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - iparam_ij = elem2param[itype][jtype][jtype]; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ij = elem3param[itype][jtype][jtype]; + iparam_ji = elem3param[jtype][itype][itype]; if (rsq > params[iparam_ij].lcutsq) continue; @@ -1091,8 +1034,8 @@ void PairComb3::compute(int eflag, int vflag) ycn = NCo[j]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ij = elem3param[itype][jtype][jtype]; + iparam_ji = elem3param[jtype][itype][itype]; delrj[0] = x[j][0] - xtmp; delrj[1] = x[j][1] - ytmp; @@ -1114,10 +1057,10 @@ void PairComb3::compute(int eflag, int vflag) if (j == k) continue; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; - iparam_ikj = elem2param[itype][ktype][jtype]; - iparam_jik = elem2param[jtype][itype][ktype]; - iparam_ik = elem2param[itype][ktype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; + iparam_ikj = elem3param[itype][ktype][jtype]; + iparam_jik = elem3param[jtype][itype][ktype]; + iparam_ik = elem3param[itype][ktype][ktype]; delrk[0] = x[k][0] - xtmp; delrk[1] = x[k][1] - ytmp; delrk[2] = x[k][2] - ztmp; @@ -1133,7 +1076,7 @@ void PairComb3::compute(int eflag, int vflag) if (params[iparam_ij].rad_flag > 0 && params[iparam_ik].ielementgp == 1 && params[iparam_ik].jelementgp == 1) { - iparam_ki = elem2param[ktype][itype][itype]; + iparam_ki = elem3param[ktype][itype][itype]; kcn=NCo[k]; kconjug += rad_init(rsq2,¶ms[iparam_ki],i,kradtot,kcn); @@ -1157,11 +1100,11 @@ void PairComb3::compute(int eflag, int vflag) delrl[1] = x[l][1] - x[j][1]; delrl[2] = x[l][2] - x[j][2]; rsq3 = dot3(delrl,delrl); - iparam_jl = elem2param[jtype][ltype][ltype]; + iparam_jl = elem3param[jtype][ltype][ltype]; if (rsq3 > params[iparam_jl].cutsq) continue; - iparam_ikl = elem2param[itype][ktype][ltype]; + iparam_ikl = elem3param[itype][ktype][ltype]; torindx = params[iparam_ij].tor_flag; bbtor += bbtor1(torindx, ¶ms[iparam_ikl],¶ms[iparam_jl], rsq1,rsq2,rsq3,delrj,delrk,delrl,srmu); @@ -1178,10 +1121,10 @@ void PairComb3::compute(int eflag, int vflag) if (l == i) continue; ltype = map[type[l]]; - iparam_jil = elem2param[jtype][itype][ltype]; - iparam_ijl = elem2param[itype][jtype][ltype]; - iparam_jl = elem2param[jtype][ltype][ltype]; - iparam_lj = elem2param[ltype][jtype][jtype]; + iparam_jil = elem3param[jtype][itype][ltype]; + iparam_ijl = elem3param[itype][jtype][ltype]; + iparam_jl = elem3param[jtype][ltype][ltype]; + iparam_lj = elem3param[ltype][jtype][jtype]; delrk[0] = x[l][0] - x[j][0]; delrk[1] = x[l][1] - x[j][1]; @@ -1204,7 +1147,7 @@ void PairComb3::compute(int eflag, int vflag) if (params[iparam_ji].rad_flag > 0 && params[iparam_jl].ielementgp == 1 && params[iparam_jl].jelementgp == 1) { - iparam_lj = elem2param[ltype][jtype][jtype]; + iparam_lj = elem3param[ltype][jtype][jtype]; lcn=NCo[l]; lconjug += rad_init(rsq2,¶ms[iparam_lj],j,lradtot,lcn); } @@ -1240,10 +1183,10 @@ void PairComb3::compute(int eflag, int vflag) sht_mnum = sht_num[k]; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; - iparam_ikj = elem2param[itype][ktype][jtype]; - iparam_jik = elem2param[jtype][itype][ktype]; - iparam_ik = elem2param[itype][ktype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; + iparam_ikj = elem3param[itype][ktype][jtype]; + iparam_jik = elem3param[jtype][itype][ktype]; + iparam_ik = elem3param[itype][ktype][ktype]; delrk[0] = x[k][0] - xtmp; delrk[1] = x[k][1] - ytmp; delrk[2] = x[k][2] - ztmp; @@ -1289,9 +1232,9 @@ void PairComb3::compute(int eflag, int vflag) delrl[2] = x[l][2] - x[j][2]; rsq3 = dot3(delrl,delrl); - iparam_jl = elem2param[jtype][ltype][ltype]; + iparam_jl = elem3param[jtype][ltype][ltype]; if (rsq3 > params[iparam_jl].cutsq) continue; - iparam_ikl = elem2param[itype][ktype][ltype]; + iparam_ikl = elem3param[itype][ktype][ltype]; torindx = params[iparam_ij].tor_flag; tor_force(torindx, ¶ms[iparam_ikl], ¶ms[iparam_jl],srmu, rsq1,rsq2,rsq3,delrj,delrk,delrl); @@ -1309,7 +1252,7 @@ void PairComb3::compute(int eflag, int vflag) if ( params[iparam_ijk].rad_flag>=1 && params[iparam_ijk].ielementgp==1 && params[iparam_ijk].kelementgp==1) { - iparam_ki = elem2param[ktype][itype][itype]; + iparam_ki = elem3param[ktype][itype][itype]; kcn=NCo[k]; double rik=sqrt(rsq2); kradtot = -comb_fc(rik,¶ms[iparam_ki])*params[iparam_ki].pcross+kcn; @@ -1333,8 +1276,8 @@ void PairComb3::compute(int eflag, int vflag) delrm[2] = x[m][2] - x[k][2]; rsq3 = dot3(delrm,delrm); - iparam_km = elem2param[ktype][mtype][mtype]; - iparam_ki = elem2param[ktype][itype][itype]; + iparam_km = elem3param[ktype][mtype][mtype]; + iparam_ki = elem3param[ktype][itype][itype]; if (rsq3 > params[iparam_km].cutsq) continue; @@ -1364,10 +1307,10 @@ void PairComb3::compute(int eflag, int vflag) sht_pnum = sht_num[l]; ltype = map[type[l]]; - iparam_jil = elem2param[jtype][itype][ltype]; - iparam_jli = elem2param[jtype][ltype][itype]; - iparam_ijl = elem2param[itype][jtype][ltype]; - iparam_jl = elem2param[jtype][ltype][ltype]; + iparam_jil = elem3param[jtype][itype][ltype]; + iparam_jli = elem3param[jtype][ltype][itype]; + iparam_ijl = elem3param[itype][jtype][ltype]; + iparam_jl = elem3param[jtype][ltype][ltype]; delrk[0] = x[l][0] - x[j][0]; delrk[1] = x[l][1] - x[j][1]; delrk[2] = x[l][2] - x[j][2]; @@ -1405,7 +1348,7 @@ void PairComb3::compute(int eflag, int vflag) if ( params[iparam_jil].rad_flag >= 1 && params[iparam_jil].ielementgp == 1 && params[iparam_jil].kelementgp == 1) { - iparam_lj = elem2param[ltype][jtype][jtype]; + iparam_lj = elem3param[ltype][jtype][jtype]; lcn=NCo[l]; double rjl=sqrt(rsq2); lradtot=-comb_fc(rjl,¶ms[iparam_lj])*params[iparam_lj].pcross +lcn; @@ -1428,7 +1371,7 @@ void PairComb3::compute(int eflag, int vflag) delrp[2] = x[p][2] - x[l][2]; rsq3 = dot3(delrp,delrp); - iparam_lp = elem2param[ltype][ptype][ptype]; + iparam_lp = elem3param[ltype][ptype][ptype]; if (rsq3 > params[iparam_lp].cutsq) continue; @@ -2354,7 +2297,7 @@ void PairComb3::tables() if (map[i+1] < 0) continue; r = drin - dra; itype = map[i+1]; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; z = params[iparam_i].esm; exp2ershift = exp(-2.0*z*rc); afbshift = -exp2ershift*(z+1.0/rc); @@ -2381,7 +2324,7 @@ void PairComb3::tables() if (j == i) { itype = map[i+1]; inty = intype[itype][itype]; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; z = params[iparam_i].esm; zrc = z * rc; exp2ersh = exp(-2.0 * zrc); @@ -2407,10 +2350,10 @@ void PairComb3::tables() itype = map[i+1]; jtype = map[j+1]; inty = intype[itype][jtype]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; ea = params[iparam_ij].esm; ea3 = ea*ea*ea; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ji = elem3param[jtype][itype][itype]; eb = params[iparam_ji].esm; eb3 = eb*eb*eb; E1 = ea*eb3*eb/((ea+eb)*(ea+eb)*(ea-eb)*(ea-eb)); @@ -2474,7 +2417,7 @@ void PairComb3::tables() itype = ii; jtype = jj; inty = intype[itype][jtype]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // parameter check: eps > 0 if (params[iparam_ij].vdwflag > 0) { @@ -2521,7 +2464,7 @@ void PairComb3::tables() itype = ii; jtype = jj; inty = intype[itype][jtype]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; r = drin; for (k = 0; k < ncoul; k ++) { r6 = r*r*r*r*r*r; @@ -3229,7 +3172,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) ytmp = x[i][1]; ztmp = x[i][2]; iq = q[i]; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; // charge force from self energy fqi = qfo_self(¶ms[iparam_i],iq); @@ -3257,8 +3200,8 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) delrj[2] = ztmp - x[j][2]; rsq1 = dot3(delrj,delrj); - iparam_ij = elem2param[itype][jtype][jtype]; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ij = elem3param[itype][jtype][jtype]; + iparam_ji = elem3param[jtype][itype][itype]; // long range q-dependent @@ -3304,8 +3247,8 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) delrj[2] = ztmp - x[j][2]; rsq1 = dot3(delrj,delrj); - iparam_ij = elem2param[itype][jtype][jtype]; - iparam_ji = elem2param[jtype][itype][itype]; + iparam_ij = elem3param[itype][jtype][jtype]; + iparam_ji = elem3param[jtype][itype][itype]; if (rsq1 >= params[iparam_ij].cutsq) continue; nj ++; diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index b999d2cece..d03ee0e474 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -61,16 +61,10 @@ class PairComb3 : public Pair { }; // general setups - int nelements; // # of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets double PI,PI2,PI4,PIsq; // PIs double cutmin; // min cutoff for all elements double cutmax; // max cutoff for all elements double precision; // tolerance for QEq convergence - char **elements; // names of unique elements Param *params; // parameter set for an I-J-K interaction int debug_eng1, debug_eng2, debug_fq; // logic controlling debugging outputs int pack_flag; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 03098904c8..b5fd507687 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -49,7 +49,6 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp) rho = nullptr; fp = nullptr; numforce = nullptr; - map = nullptr; type2frho = nullptr; nfuncfl = 0; @@ -90,9 +89,7 @@ PairEAM::~PairEAM() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; delete [] type2frho; - map = nullptr; type2frho = nullptr; memory->destroy(type2rhor); memory->destroy(type2z2r); @@ -348,6 +345,7 @@ void PairEAM::allocate() memory->create(cutsq,n+1,n+1,"pair:cutsq"); + delete[] map; map = new int[n+1]; for (int i = 1; i <= n; i++) map[i] = -1; diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index 7e47c0f4e9..e9cbd15f34 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -75,8 +75,6 @@ class PairEAM : public Pair { // potentials as file data - int *map; // which element each atom type maps to - struct Funcfl { char *file; int nrho,nr; diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index b82a410791..eda1838a5a 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -46,10 +46,6 @@ PairEIM::PairEIM(LAMMPS *lmp) : Pair(lmp) nmax = 0; rho = nullptr; fp = nullptr; - map = nullptr; - - nelements = 0; - elements = nullptr; negativity = nullptr; q0 = nullptr; @@ -80,15 +76,11 @@ PairEIM::~PairEIM() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; memory->destroy(type2Fij); memory->destroy(type2Gij); memory->destroy(type2phiij); } - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - deallocate_setfl(); delete [] negativity; @@ -353,8 +345,6 @@ void PairEIM::settings(int narg, char **/*arg*/) void PairEIM::coeff(int narg, char **arg) { - int i,j,m,n; - if (!allocated) allocate(); if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); @@ -364,23 +354,8 @@ void PairEIM::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read EIM element names before filename - // nelements = # of EIM elements to read from file - // elements = list of unique element names - - if (nelements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - nelements = narg - 3 - atom->ntypes; - if (nelements < 1) error->all(FLERR,"Incorrect args for pair coefficients"); - elements = new char*[nelements]; - - for (i = 0; i < nelements; i++) { - n = strlen(arg[i+2]) + 1; - elements[i] = new char[n]; - strcpy(elements[i],arg[i+2]); - } + const int ntypes = atom->ntypes; + map_element2type(ntypes,arg+(narg-ntypes)); // read EIM file @@ -388,38 +363,12 @@ void PairEIM::coeff(int narg, char **arg) setfl = new Setfl(); read_file(arg[2+nelements]); - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" + // set per-type atomic masses - for (i = 3 + nelements; i < narg; i++) { - m = i - (3+nelements) + 1; - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - if (j < nelements) map[m] = j; - else if (strcmp(arg[i],"NULL") == 0) map[m] = -1; - else error->all(FLERR,"Incorrect args for pair coefficients"); - } - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - // set mass of atom type if i = j - - int count = 0; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; + for (int i = 1; i <= ntypes; i++) + for (int j = i; j <= ntypes; j++) + if ((map[i] >= 0) && (map[j] >= 0)) if (i == j) atom->set_mass(FLERR,i,setfl->mass[map[i]]); - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 75f8ea6bea..7611898c45 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -60,10 +60,6 @@ class PairEIM : public Pair { int nmax; double *rho,*fp; int rhofp; - int *map; // which element each atom type maps to - - int nelements; // # of elements to read from potential file - char **elements; // element names Setfl *setfl; diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 6039e00c0a..7e0cb3a3a2 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -51,12 +51,7 @@ PairGW::PairGW(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; } /* ---------------------------------------------------------------------- @@ -65,16 +60,12 @@ PairGW::PairGW(LAMMPS *lmp) : Pair(lmp) PairGW::~PairGW() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } } @@ -142,7 +133,7 @@ void PairGW::compute(int eflag, int vflag) delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq > params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,eflag,evdwl); @@ -165,7 +156,7 @@ void PairGW::compute(int eflag, int vflag) j = jlist[jj]; j &= NEIGHMASK; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; @@ -182,7 +173,7 @@ void PairGW::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -214,7 +205,7 @@ void PairGW::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -271,70 +262,14 @@ void PairGW::settings(int narg, char **/*arg*/) void PairGW::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -480,12 +415,12 @@ void PairGW::setup_params() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -500,7 +435,7 @@ void PairGW::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } diff --git a/src/MANYBODY/pair_gw.h b/src/MANYBODY/pair_gw.h index 620f0b1af0..a1cbdb5c86 100644 --- a/src/MANYBODY/pair_gw.h +++ b/src/MANYBODY/pair_gw.h @@ -52,13 +52,7 @@ class PairGW : public Pair { }; Param *params; // parameter set for an I-J-K interaction - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to paramegw - int *map; // mapping from atom types to elements double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets int **pages; // neighbor list pages int maxlocal; // size of numneigh, firstneigh arrays diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index a2a8c3d1fa..727556dd50 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -74,8 +74,6 @@ PairLCBOP::~PairLCBOP() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutghost); - - delete [] map; } } @@ -128,48 +126,17 @@ void PairLCBOP::coeff(int narg, char **arg) { if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); + map_element2type(narg-3,arg+3); - // insure I,J args are * * + // only element "C" is allowed - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to C and "NULL" - // map[i] = which element (0 for C) the Ith atom type is, -1 if "NULL" - - for (int i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - } else if (strcmp(arg[i],"C") == 0) { - map[i-2] = 0; - } else error->all(FLERR,"Incorrect args for pair coefficients"); - } + if ((nelements != 1) || (strcmp(elements[0],"C") != 0)) + error->all(FLERR,"Incorrect args for pair coefficients"); // read potential file and initialize fitting splines read_file(arg[2]); spline_init(); - - // clear setflag since coeff() called once with I,J = * * - - int n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -965,11 +932,9 @@ void PairLCBOP::read_file(char *filename) int i,k,l; char s[MAXLINE]; - MPI_Comm_rank(world,&me); - // read file on proc 0 - if (me == 0) { + if (comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); if (fp == nullptr) { char str[128]; diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index dacbe74158..4ee89b4148 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,9 +39,6 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 ("NULL") for each type - - int me; double cutLR; // LR cutoff diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index a1dc903a43..dfc4046eda 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -50,12 +50,7 @@ PairNb3bHarmonic::PairNb3bHarmonic(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; } /* ---------------------------------------------------------------------- @@ -64,16 +59,12 @@ PairNb3bHarmonic::PairNb3bHarmonic(LAMMPS *lmp) : Pair(lmp) PairNb3bHarmonic::~PairNb3bHarmonic() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } } @@ -117,7 +108,7 @@ void PairNb3bHarmonic::compute(int eflag, int vflag) j = jlist[jj]; j &= NEIGHMASK; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -128,8 +119,8 @@ void PairNb3bHarmonic::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -186,70 +177,14 @@ void PairNb3bHarmonic::settings(int narg, char **/*arg*/) void PairNb3bHarmonic::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -374,12 +309,12 @@ void PairNb3bHarmonic::setup_params() int i,j,k,m,n; double rtmp; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -393,7 +328,7 @@ void PairNb3bHarmonic::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // compute parameter values derived from inputs diff --git a/src/MANYBODY/pair_nb3b_harmonic.h b/src/MANYBODY/pair_nb3b_harmonic.h index b68974e15f..38ec07c78b 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.h +++ b/src/MANYBODY/pair_nb3b_harmonic.h @@ -44,12 +44,6 @@ class PairNb3bHarmonic : public Pair { }; double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction void allocate(); diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index a353ad1c47..e267031901 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -49,14 +49,11 @@ PairPolymorphic::PairPolymorphic(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; - nelements = 0; - elements = nullptr; match = nullptr; pairParameters = nullptr; tripletParameters = nullptr; elem2param = nullptr; elem3param = nullptr; - map = nullptr; epsilon = 0.0; neighsize = 0; firstneighV = nullptr; @@ -78,9 +75,6 @@ PairPolymorphic::PairPolymorphic(LAMMPS *lmp) : Pair(lmp) PairPolymorphic::~PairPolymorphic() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; delete [] match; delete [] pairParameters; @@ -91,7 +85,6 @@ PairPolymorphic::~PairPolymorphic() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; delete [] firstneighV; delete [] firstneighW; delete [] firstneighW1; @@ -466,74 +459,19 @@ void PairPolymorphic::settings(int narg, char **/*arg*/) void PairPolymorphic::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg == 4 + atom->ntypes) { - narg--; - epsilon = atof(arg[narg]); - } else if (narg != 3 + atom->ntypes) { - error->all(FLERR,"Incorrect args for pair coefficients"); - } + // parse and remove optional last parameter - // insure I,J args are * * + if (narg == 4 + atom->ntypes) + epsilon = utils::numeric(FLERR,arg[--narg],false,lmp); - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index c94acd6230..a8a74267cd 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -302,13 +302,8 @@ class PairPolymorphic : public Pair { double *delxV,*delyV,*delzV,*drV; double *delxW,*delyW,*delzW,*drW; - char **elements; // names of unique elements - int **elem2param; // map: element pairs to parameters - int ***elem3param; // map: element triplets to parameters - int *map; // mapping from atom types to elements double cutmax; // max cutoff for all elements double cutmaxsq; - int nelements; // # of unique elements int npair,ntriple; int *match; diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index e7a334d9a9..fe7e56456e 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -46,12 +46,7 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; maxshort = 10; neighshort = nullptr; @@ -65,17 +60,13 @@ PairSW::~PairSW() { if (copymode) return; - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(neighshort); - delete [] map; } } @@ -135,7 +126,7 @@ void PairSW::compute(int eflag, int vflag) rsq = delx*delx + dely*dely + delz*delz; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) { continue; } else { @@ -175,7 +166,7 @@ void PairSW::compute(int eflag, int vflag) for (jj = 0; jj < jnumm1; jj++) { j = neighshort[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -187,8 +178,8 @@ void PairSW::compute(int eflag, int vflag) for (kk = jj+1; kk < numshort; kk++) { k = neighshort[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -250,70 +241,14 @@ void PairSW::settings(int narg, char **/*arg*/) void PairSW::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -451,12 +386,12 @@ void PairSW::setup_params() int i,j,k,m,n; double rtmp; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -470,7 +405,7 @@ void PairSW::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } diff --git a/src/MANYBODY/pair_sw.h b/src/MANYBODY/pair_sw.h index 4fdc538430..4e13caee85 100644 --- a/src/MANYBODY/pair_sw.h +++ b/src/MANYBODY/pair_sw.h @@ -50,12 +50,6 @@ class PairSW : public Pair { protected: double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction int maxshort; // size of short neighbor list array int *neighshort; // short neighbor list array diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index dea01589a6..2a642e6244 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -54,12 +54,7 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; maxshort = 10; neighshort = nullptr; @@ -73,17 +68,13 @@ PairTersoff::~PairTersoff() { if (copymode) return; - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(neighshort); - delete [] map; } } @@ -204,7 +195,7 @@ void PairTersoff::eval() } jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq >= params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,EFLAG,evdwl); @@ -231,7 +222,7 @@ void PairTersoff::eval() for (jj = 0; jj < numshort; jj++) { j = neighshort[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; @@ -255,7 +246,7 @@ void PairTersoff::eval() if (jj == kk) continue; k = neighshort[kk]; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -295,7 +286,7 @@ void PairTersoff::eval() if (jj == kk) continue; k = neighshort[kk]; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -383,70 +374,14 @@ void PairTersoff::settings(int narg, char **arg) void PairTersoff::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -598,12 +533,12 @@ void PairTersoff::setup_params() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -617,7 +552,7 @@ void PairTersoff::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } diff --git a/src/MANYBODY/pair_tersoff.h b/src/MANYBODY/pair_tersoff.h index 18c6ebc5f9..a4612d03be 100644 --- a/src/MANYBODY/pair_tersoff.h +++ b/src/MANYBODY/pair_tersoff.h @@ -59,13 +59,7 @@ class PairTersoff : public Pair { }; Param *params; // parameter set for an I-J-K interaction - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets int maxshort; // size of short neighbor list array int *neighshort; // short neighbor list array diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 86994ccc0e..465bc0ebd0 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -163,12 +163,12 @@ void PairTersoffMOD::setup_params() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -182,7 +182,7 @@ void PairTersoffMOD::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 94f211dd95..cacfa7078e 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -48,12 +48,7 @@ PairVashishta::PairVashishta(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; r0max = 0.0; maxshort = 10; @@ -68,17 +63,13 @@ PairVashishta::~PairVashishta() { if (copymode) return; - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(neighshort); - delete [] map; } } @@ -158,7 +149,7 @@ void PairVashishta::compute(int eflag, int vflag) } jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) continue; twobody(¶ms[ijparam],rsq,fpair,eflag,evdwl); @@ -179,7 +170,7 @@ void PairVashishta::compute(int eflag, int vflag) for (jj = 0; jj < jnumm1; jj++) { j = neighshort[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -192,8 +183,8 @@ void PairVashishta::compute(int eflag, int vflag) for (kk = jj+1; kk < numshort; kk++) { k = neighshort[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -257,70 +248,14 @@ void PairVashishta::settings(int narg, char **/*arg*/) void PairVashishta::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -465,12 +400,12 @@ void PairVashishta::setup_params() { int i,j,k,m,n; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -484,7 +419,7 @@ void PairVashishta::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // compute parameter values derived from inputs diff --git a/src/MANYBODY/pair_vashishta.h b/src/MANYBODY/pair_vashishta.h index 19a8e01cd9..06c23b2384 100644 --- a/src/MANYBODY/pair_vashishta.h +++ b/src/MANYBODY/pair_vashishta.h @@ -48,12 +48,6 @@ class PairVashishta : public Pair { }; protected: double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction double r0max; // largest value of r0 int maxshort; // size of short neighbor list array diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index 76b44d8664..14dacdae3f 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -120,7 +120,7 @@ void PairVashishtaTable::compute(int eflag, int vflag) } jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) continue; twobody_table(params[ijparam],rsq,fpair,eflag,evdwl); @@ -141,7 +141,7 @@ void PairVashishtaTable::compute(int eflag, int vflag) for (jj = 0; jj < jnumm1; jj++) { j = neighshort[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; delr1[2] = x[j][2] - ztmp; @@ -154,8 +154,8 @@ void PairVashishtaTable::compute(int eflag, int vflag) for (kk = jj+1; kk < numshort; kk++) { k = neighshort[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -272,7 +272,7 @@ void PairVashishtaTable::create_tables() for (i = 0; i < nelements; i++) { for (j = 0; j < nelements; j++) { - int ijparam = elem2param[i][j][j]; + int ijparam = elem3param[i][j][j]; for (idx = 0; idx <= ntable; idx++) { rsq = tabinnersq + idx*deltaR2; PairVashishta::twobody(¶ms[ijparam],rsq,fpair,1,eng); diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index 7d57ca3673..ae0023ddec 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -42,8 +42,6 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; - nelements = 0; - elements = nullptr; radelem = nullptr; wjelem = nullptr; coeffelem = nullptr; @@ -60,14 +58,9 @@ PairSNAP::~PairSNAP() { if (copymode) return; - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(radelem); - memory->destroy(wjelem); - memory->destroy(coeffelem); - } + memory->destroy(radelem); + memory->destroy(wjelem); + memory->destroy(coeffelem); memory->destroy(beta); memory->destroy(bispectrum); @@ -77,7 +70,6 @@ PairSNAP::~PairSNAP() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - memory->destroy(map); } } @@ -362,7 +354,7 @@ void PairSNAP::allocate() memory->create(setflag,n+1,n+1,"pair:setflag"); memory->create(cutsq,n+1,n+1,"pair:cutsq"); - memory->create(map,n+1,"pair:map"); + map = new int[n+1]; } /* ---------------------------------------------------------------------- @@ -384,61 +376,11 @@ void PairSNAP::coeff(int narg, char **arg) if (!allocated) allocate(); if (narg != 4 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients"); - char* type1 = arg[0]; - char* type2 = arg[1]; - char* coefffilename = arg[2]; - char* paramfilename = arg[3]; - char** elemtypes = &arg[4]; - - // insure I,J args are * * - - if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // clean out old arrays - - if (elements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(radelem); - memory->destroy(wjelem); - memory->destroy(coeffelem); - } - - // nelements = # of unique elements declared - // elements = list of unique element names - // allocate as ntypes >= nelements - - elements = new char*[atom->ntypes]; - for (int i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - // read args that map atom types to SNAP elements - // map[i] = which element the Ith atom type is, -1 if not mapped - // map[0] is not used - - nelements = 0; - for (int i = 1; i <= atom->ntypes; i++) { - char* elemstring = elemtypes[i-1]; - if (strcmp(elemstring,"NULL") == 0) { - map[i] = -1; - continue; - } - int j; - for (j = 0; j < nelements; j++) - if (strcmp(elemstring,elements[j]) == 0) break; - map[i] = j; - if (j == nelements) { - int n = strlen(elemstring) + 1; - elements[j] = new char[n]; - strcpy(elements[j],elemstring); - nelements++; - } - } + map_element2type(narg-4,arg+4); // read snapcoeff and snapparam files - read_files(coefffilename,paramfilename); + read_files(arg[2],arg[3]); if (!quadraticflag) ncoeff = ncoeffall - 1; @@ -455,25 +397,6 @@ void PairSNAP::coeff(int narg, char **arg) } } - // clear setflag since coeff() called once with I,J = * * - - int n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag, wselfallflag, nelements); @@ -571,8 +494,11 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) "file: {}", e.what())); } - // set up element lists + // clean out old arrays and set up element lists + memory->destroy(radelem); + memory->destroy(wjelem); + memory->destroy(coeffelem); memory->create(radelem,nelements,"pair:radelem"); memory->create(wjelem,nelements,"pair:wjelem"); memory->create(coeffelem,nelements,ncoeffall,"pair:coeffelem"); diff --git a/src/SNAP/pair_snap.h b/src/SNAP/pair_snap.h index d60000da3a..ee596d2ba7 100644 --- a/src/SNAP/pair_snap.h +++ b/src/SNAP/pair_snap.h @@ -50,14 +50,11 @@ protected: void compute_bispectrum(); double rcutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements double *radelem; // element radii double *wjelem; // elements weights double **coeffelem; // element bispectrum coefficients double** beta; // betas for all atoms in list double** bispectrum; // bispectrum components for all atoms in list - int *map; // mapping from atom types to elements int twojmax, switchflag, bzeroflag, bnormflag; int chemflag, wselfallflag; int chunksize; diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 984b2100a3..bc5c40a258 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1204,7 +1204,7 @@ void PairSWIntel::pack_force_const(ForceConst &fc, fc.p2e[ii][jj].c5 = 0; fc.p2e[ii][jj].c6 = 0; } else { - int ijparam = elem2param[i][j][j]; + int ijparam = elem3param[i][j][j]; fc.p2[ii][jj].cutsq = params[ijparam].cutsq; fc.p2[ii][jj].cut = params[ijparam].cut; fc.p2[ii][jj].sigma_gamma = params[ijparam].sigma_gamma; @@ -1237,7 +1237,7 @@ void PairSWIntel::pack_force_const(ForceConst &fc, mytypes++; _onetype = ii * tp1 + jj; _onetype3 = ii * tp1 * tp1 + jj * tp1 + kk; - int ijkparam = elem2param[i][j][k]; + int ijkparam = elem3param[i][j][k]; fc.p3[ii][jj][kk].costheta = params[ijkparam].costheta; fc.p3[ii][jj][kk].lambda_epsilon = params[ijkparam].lambda_epsilon; fc.p3[ii][jj][kk].lambda_epsilon2 = params[ijkparam].lambda_epsilon2; diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 4284309b74..eb3ce562fa 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -482,7 +482,7 @@ void PairTersoffIntel::pack_force_const(ForceConst &fc, fc.c_inner_loop[i][0][j].d2 = 1.0; fc.c_inner_loop[0][i][j].d2 = 1.0; for (int k = 1; k < tp1; k++) { - Param * param = ¶ms[elem2param[map[i]][map[j]][map[k]]]; + Param * param = ¶ms[elem3param[map[i]][map[j]][map[k]]]; fc.c_cutoff_inner[i][k][j].cutsq = static_cast(param->cutsq); fc.c_inner_loop[i][j][k].lam3 = static_cast(param->lam3); fc.c_inner_loop[i][j][k].bigr = static_cast(param->bigr); @@ -504,7 +504,7 @@ void PairTersoffIntel::pack_force_const(ForceConst &fc, fc.c_inner[i][j][k].powermint = static_cast(param->powermint); } - Param * param = ¶ms[elem2param[map[i]][map[j]][map[j]]]; + Param * param = ¶ms[elem3param[map[i]][map[j]][map[j]]]; fc.c_cutoff_outer[i][j].cutsq = static_cast(param->cutsq); fc.c_first_loop[i][j].bigr = static_cast(param->bigr); fc.c_first_loop[i][j].bigd = static_cast(param->bigd); diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 29d81e9516..67ab3522ad 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -55,7 +55,7 @@ PairMEAMC::PairMEAMC(LAMMPS *lmp) : Pair(lmp) allocated = 0; - nelements = 0; + nlibelements = 0; meam_inst = new MEAM(memory); scale = nullptr; @@ -78,7 +78,6 @@ PairMEAMC::~PairMEAMC() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(scale); - delete [] map; } } @@ -239,23 +238,23 @@ void PairMEAMC::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // MEAM element names between 2 filenames - // nelements = # of MEAM elements + // nlibelements = # of MEAM elements // elements = list of unique element names - if (nelements) { - elements.clear(); + if (nlibelements) { + libelements.clear(); mass.clear(); } - nelements = paridx - 3; - if (nelements < 1) error->all(FLERR,"Incorrect args for pair coefficients"); - if (nelements > maxelt) + nlibelements = paridx - 3; + if (nlibelements < 1) error->all(FLERR,"Incorrect args for pair coefficients"); + if (nlibelements > maxelt) error->all(FLERR,fmt::format("Too many elements extracted from MEAM " "library (current limit: {}). Increase " "'maxelt' in meam.h and recompile.", maxelt)); - for (int i = 0; i < nelements; i++) { - elements.push_back(arg[i+3]); + for (int i = 0; i < nlibelements; i++) { + libelements.push_back(arg[i+3]); mass.push_back(0.0); } @@ -269,12 +268,12 @@ void PairMEAMC::coeff(int narg, char **arg) // read args that map atom types to MEAM elements // map[i] = which element the Ith atom type is, -1 if not mapped - for (int i = 4 + nelements; i < narg; i++) { - m = i - (4+nelements) + 1; + for (int i = 4 + nlibelements; i < narg; i++) { + m = i - (4+nlibelements) + 1; int j; - for (j = 0; j < nelements; j++) - if (elements[j] == arg[i]) break; - if (j < nelements) map[m] = j; + for (j = 0; j < nlibelements; j++) + if (libelements[j] == arg[i]) break; + if (j < nlibelements) map[m] = j; else if (strcmp(arg[i],"NULL") == 0) map[m] = -1; else error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -359,25 +358,25 @@ void PairMEAMC::read_files(const std::string &globalfile, void PairMEAMC::read_global_meamc_file(const std::string &globalfile) { // allocate parameter arrays - std::vector lat(nelements); - std::vector ielement(nelements); - std::vector ibar(nelements); - std::vector z(nelements); - std::vector atwt(nelements); - std::vector alpha(nelements); - std::vector b0(nelements); - std::vector b1(nelements); - std::vector b2(nelements); - std::vector b3(nelements); - std::vector alat(nelements); - std::vector esub(nelements); - std::vector asub(nelements); - std::vector t0(nelements); - std::vector t1(nelements); - std::vector t2(nelements); - std::vector t3(nelements); - std::vector rozero(nelements); - std::vector found(nelements, false); + std::vector lat(nlibelements); + std::vector ielement(nlibelements); + std::vector ibar(nlibelements); + std::vector z(nlibelements); + std::vector atwt(nlibelements); + std::vector alpha(nlibelements); + std::vector b0(nlibelements); + std::vector b1(nlibelements); + std::vector b2(nlibelements); + std::vector b3(nlibelements); + std::vector alat(nlibelements); + std::vector esub(nlibelements); + std::vector asub(nlibelements); + std::vector t0(nlibelements); + std::vector t1(nlibelements); + std::vector t2(nlibelements); + std::vector t3(nlibelements); + std::vector rozero(nlibelements); + std::vector found(nlibelements, false); // open global meamf file on proc 0 @@ -401,9 +400,9 @@ void PairMEAMC::read_global_meamc_file(const std::string &globalfile) // skip if element name isn't in element list int index; - for (index = 0; index < nelements; index++) - if (elements[index] == element) break; - if (index == nelements) continue; + for (index = 0; index < nlibelements; index++) + if (libelements[index] == element) break; + if (index == nlibelements) continue; // skip if element already appeared (technically error in library file, but always ignored) @@ -452,47 +451,47 @@ void PairMEAMC::read_global_meamc_file(const std::string &globalfile) // error if didn't find all elements in file - if (nset != nelements) { + if (nset != nlibelements) { std::string msg = "Did not find all elements in MEAM library file, missing:"; - for (int i = 0; i < nelements; i++) + for (int i = 0; i < nlibelements; i++) if (!found[i]) { msg += " "; - msg += elements[i]; + msg += libelements[i]; } error->one(FLERR,msg); } } // distribute complete parameter sets - MPI_Bcast(lat.data(), nelements, MPI_INT, 0, world); - MPI_Bcast(ielement.data(), nelements, MPI_INT, 0, world); - MPI_Bcast(ibar.data(), nelements, MPI_INT, 0, world); - MPI_Bcast(z.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(atwt.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(alpha.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(b0.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(b1.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(b2.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(b3.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(alat.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(esub.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(asub.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(t0.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(t1.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(t2.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(t3.data(), nelements, MPI_DOUBLE, 0, world); - MPI_Bcast(rozero.data(), nelements, MPI_DOUBLE, 0, world); + MPI_Bcast(lat.data(), nlibelements, MPI_INT, 0, world); + MPI_Bcast(ielement.data(), nlibelements, MPI_INT, 0, world); + MPI_Bcast(ibar.data(), nlibelements, MPI_INT, 0, world); + MPI_Bcast(z.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(atwt.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(alpha.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(b0.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(b1.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(b2.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(b3.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(alat.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(esub.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(asub.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(t0.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(t1.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(t2.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(t3.data(), nlibelements, MPI_DOUBLE, 0, world); + MPI_Bcast(rozero.data(), nlibelements, MPI_DOUBLE, 0, world); // pass element parameters to MEAM package - meam_inst->meam_setup_global(nelements, lat.data(), ielement.data(), atwt.data(), + meam_inst->meam_setup_global(nlibelements, lat.data(), ielement.data(), atwt.data(), alpha.data(), b0.data(), b1.data(), b2.data(), b3.data(), alat.data(), esub.data(), asub.data(), t0.data(), t1.data(), t2.data(), t3.data(), rozero.data(), ibar.data()); // set element masses - for (int i = 0; i < nelements; i++) mass[i] = atwt[i]; + for (int i = 0; i < nlibelements; i++) mass[i] = atwt[i]; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MEAMC/pair_meamc.h b/src/USER-MEAMC/pair_meamc.h index 6bf6923869..24625c4076 100644 --- a/src/USER-MEAMC/pair_meamc.h +++ b/src/USER-MEAMC/pair_meamc.h @@ -47,12 +47,11 @@ class PairMEAMC : public Pair { private: class MEAM *meam_inst; - double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - std::vector elements; // names of unique elements - std::vector mass; // mass of each element + double cutmax; // max cutoff for all elements + int nlibelements; // # of library elements + std::vector libelements; // names of library elements + std::vector mass; // mass of library element - int *map; // mapping from atom types (1-indexed) to elements (1-indexed) double **scale; // scaling factor for adapt void allocate(); diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 7481ca35d4..7acaf90e4f 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -67,12 +67,7 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; - nelements = 0; - elements = nullptr; - elem2param = nullptr; - nparams = 0; params = nullptr; - map = nullptr; cutmax = 0.0; } @@ -82,9 +77,6 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp) PairAGNI::~PairAGNI() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; if (params) { for (int i = 0; i < nparams; ++i) { memory->destroy(params[i].eta); @@ -94,12 +86,11 @@ PairAGNI::~PairAGNI() memory->destroy(params); params = nullptr; } - memory->destroy(elem2param); + memory->destroy(elem1param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } } @@ -135,7 +126,7 @@ void PairAGNI::compute(int eflag, int vflag) ztmp = x[i][2]; fxtmp = fytmp = fztmp = 0.0; - const Param &iparam = params[elem2param[itype]]; + const Param &iparam = params[elem1param[itype]]; Vx = new double[iparam.numeta]; Vy = new double[iparam.numeta]; Vz = new double[iparam.numeta]; @@ -238,46 +229,10 @@ void PairAGNI::settings(int narg, char ** /* arg */) void PairAGNI::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); + map_element2type(narg-3,arg+3); - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } if (nelements != 1) error->all(FLERR,"Cannot handle multi-element systems with this potential"); @@ -285,25 +240,6 @@ void PairAGNI::coeff(int narg, char **arg) read_file(arg[2]); setup_params(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -466,10 +402,10 @@ void PairAGNI::setup_params() int i,m,n; double rtmp; - // set elem2param for all elements + // set elem1param for all elements - memory->destroy(elem2param); - memory->create(elem2param,nelements,"pair:elem2param"); + memory->destroy(elem1param); + memory->create(elem1param,nelements,"pair:elem1param"); for (i = 0; i < nelements; i++) { n = -1; @@ -480,7 +416,7 @@ void PairAGNI::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i] = n; + elem1param[i] = n; } // compute parameter values derived from inputs diff --git a/src/USER-MISC/pair_agni.h b/src/USER-MISC/pair_agni.h index 6fba506d04..0a33c11b95 100644 --- a/src/USER-MISC/pair_agni.h +++ b/src/USER-MISC/pair_agni.h @@ -45,11 +45,6 @@ class PairAGNI : public Pair { protected: double cutmax; // max cutoff for all elements - int nelements; // # of unique atom type labels - char **elements; // names of unique elements - int *elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets int atomic_feature_version; // version of fingerprint Param *params; // parameter set for an I-J interaction virtual void allocate(); diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 45b49ee293..0f571dd41e 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -22,17 +22,17 @@ #include "pair_drip.h" -#include - -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" + +#include +#include using namespace LAMMPS_NS; @@ -51,10 +51,6 @@ PairDRIP::PairDRIP(LAMMPS *lmp) : Pair(lmp) params = nullptr; nearest3neigh = nullptr; - elements = nullptr; - elem2param = nullptr; - map = nullptr; - nelements = 0; cutmax = 0.0; } @@ -65,14 +61,8 @@ PairDRIP::~PairDRIP() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } - if (elements != nullptr) { - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - elements = nullptr; - } memory->destroy(params); memory->destroy(elem2param); memory->destroy(nearest3neigh); @@ -127,64 +117,10 @@ void PairDRIP::settings(int narg, char ** /* arg */) void PairDRIP::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - + map_element2type(narg-3,arg+3); read_file(arg[2]); - - - // clear setflag since coeff() called once with I,J = * * - n = atom->ntypes; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - setflag[i][j] = 0; - - int count = 0; - for (i = 1; i <= n; i++) - for (j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } diff --git a/src/USER-MISC/pair_drip.h b/src/USER-MISC/pair_drip.h index 3ea6c735a6..59dac076c8 100644 --- a/src/USER-MISC/pair_drip.h +++ b/src/USER-MISC/pair_drip.h @@ -58,10 +58,6 @@ protected: }; Param *params; // parameter set for I-J interactions int **nearest3neigh; // nearest 3 neighbors of atoms - char **elements; // names of unique elements - int **elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nelements; // # of unique elements double cutmax; // max cutoff for all species void read_file(char *); diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 12390ba69d..88b8728c38 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -23,18 +23,18 @@ #include "pair_edip.h" -#include -#include - -#include #include "atom.h" -#include "neighbor.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" + +#include +#include +#include using namespace LAMMPS_NS; @@ -64,11 +64,7 @@ PairEDIP::PairEDIP(LAMMPS *lmp) : manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -77,16 +73,12 @@ PairEDIP::PairEDIP(LAMMPS *lmp) : PairEDIP::~PairEDIP() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; deallocateGrids(); deallocatePreLoops(); @@ -198,7 +190,7 @@ void PairEDIP::compute(int eflag, int vflag) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -313,7 +305,7 @@ void PairEDIP::compute(int eflag, int vflag) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -367,7 +359,7 @@ void PairEDIP::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; dr_ik[0] = x[k][0] - xtmp; dr_ik[1] = x[k][1] - ytmp; @@ -766,47 +758,9 @@ void PairEDIP::initGrids(void) void PairEDIP::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - + map_element2type(narg-3,arg+3); if (nelements != 1) error->all(FLERR,"Pair style edip only supports single element potentials"); @@ -815,25 +769,6 @@ void PairEDIP::coeff(int narg, char **arg) read_file(arg[2]); setup_params(); - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // allocate tables and internal structures allocatePreLoops(); @@ -1015,12 +950,12 @@ void PairEDIP::setup_params() int i,j,k,m,n; double rtmp; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -1034,7 +969,7 @@ void PairEDIP::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // set cutoff square diff --git a/src/USER-MISC/pair_edip.h b/src/USER-MISC/pair_edip.h index 6c4a37d795..006c124229 100644 --- a/src/USER-MISC/pair_edip.h +++ b/src/USER-MISC/pair_edip.h @@ -87,12 +87,6 @@ class PairEDIP : public Pair { double u4; double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction void allocate(); diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index c0969831b9..4db52da11a 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -82,11 +82,7 @@ PairEDIPMulti::PairEDIPMulti(LAMMPS *lmp) : Pair(lmp), preForceCoord(nullptr) manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -95,16 +91,12 @@ PairEDIPMulti::PairEDIPMulti(LAMMPS *lmp) : Pair(lmp), preForceCoord(nullptr) PairEDIPMulti::~PairEDIPMulti() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } deallocatePreLoops(); } @@ -173,7 +165,7 @@ void PairEDIPMulti::compute(int eflag, int vflag) r_ij = delx * delx + dely * dely + delz * delz; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -214,7 +206,7 @@ void PairEDIPMulti::compute(int eflag, int vflag) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -246,8 +238,8 @@ void PairEDIPMulti::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = x[k][0] - xtmp; dr_ik[1] = x[k][1] - ytmp; @@ -537,71 +529,15 @@ void PairEDIPMulti::settings(int narg, char **/*arg*/) void PairEDIPMulti::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup(); - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // (re-)allocate tables and internal structures deallocatePreLoops(); @@ -784,12 +720,12 @@ void PairEDIPMulti::setup() int i,j,k,m,n; double rtmp; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -803,7 +739,7 @@ void PairEDIPMulti::setup() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // set cutoff square diff --git a/src/USER-MISC/pair_edip_multi.h b/src/USER-MISC/pair_edip_multi.h index cf1d56945f..2aba064aa9 100644 --- a/src/USER-MISC/pair_edip_multi.h +++ b/src/USER-MISC/pair_edip_multi.h @@ -54,12 +54,6 @@ class PairEDIPMulti : public Pair { double *preForceCoord; double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction void allocate(); diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index ea4a8031a1..c64c7474cd 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -52,18 +52,13 @@ PairExTeP::PairExTeP(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; ghostneigh = 1; - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; maxlocal = 0; SR_numneigh = nullptr; SR_firstneigh = nullptr; ipage = nullptr; pgsize = oneatom = 0; - map = nullptr; Nt = nullptr; Nd = nullptr; @@ -75,11 +70,8 @@ PairExTeP::PairExTeP(LAMMPS *lmp) : Pair(lmp) PairExTeP::~PairExTeP() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); memory->destroy(SR_numneigh); memory->sfree(SR_firstneigh); @@ -91,7 +83,6 @@ PairExTeP::~PairExTeP() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutghost); - delete [] map; } } @@ -159,7 +150,7 @@ void PairExTeP::SR_neigh() rsq = delx*delx + dely*dely + delz*delz; jtype=map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq < params[iparam_ij].cutsq) { neighptr[n++] = j; @@ -246,7 +237,7 @@ void PairExTeP::compute(int eflag, int vflag) delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq > params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,eflag,evdwl); @@ -270,7 +261,7 @@ void PairExTeP::compute(int eflag, int vflag) j &= NEIGHMASK; jtag = tag[j]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j][0] - xtmp; delr1[1] = x[j][1] - ytmp; @@ -337,7 +328,7 @@ void PairExTeP::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -352,7 +343,7 @@ void PairExTeP::compute(int eflag, int vflag) /* F_IJ (2) */ // compute force components due to spline derivatives // uses only the part with FXY_x (FXY_y is done when i and j are inversed) - int iparam_ik = elem2param[itype][ktype][0]; + int iparam_ik = elem3param[itype][ktype][0]; double fc_ik_d = ters_fc_d(r2,¶ms[iparam_ik]); double fc_prefac_ik_0 = 1.0 * fc_ik_d * fa / r2; double fc_prefac_ik = dFc_dNtij * fc_prefac_ik_0; @@ -396,7 +387,7 @@ void PairExTeP::compute(int eflag, int vflag) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -455,71 +446,15 @@ void PairExTeP::settings(int narg, char **/*arg*/) void PairExTeP::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); spline_init(); setup(); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -818,12 +753,12 @@ void PairExTeP::setup() { int i,j,k,m,n; - // set elem2param for all element triplet combinations + // set elem3param for all element triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -837,7 +772,7 @@ void PairExTeP::setup() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // compute parameter values derived from inputs diff --git a/src/USER-MISC/pair_extep.h b/src/USER-MISC/pair_extep.h index 599147c46e..08ee6d9a82 100644 --- a/src/USER-MISC/pair_extep.h +++ b/src/USER-MISC/pair_extep.h @@ -48,30 +48,24 @@ class PairExTeP : public Pair { double c1,c2,c3,c4; int ielement,jelement,kelement; int powermint; - double Z_i,Z_j; // added for ExTePZBL + double Z_i,Z_j; // added for ExTePZBL double ZBLcut,ZBLexpscale; - double c5,ca1,ca4; // added for ExTePMOD + double c5,ca1,ca4; // added for ExTePMOD double powern_del; }; Param *params; // parameter set for an I-J-K interaction - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets - int maxlocal; // size of numneigh, firstneigh arrays - int maxpage; // # of pages currently allocated - int pgsize; // size of neighbor page - int oneatom; // max # of neighbors for one atom - MyPage *ipage; // neighbor list pages - int *SR_numneigh; // # of pair neighbors for each atom - int **SR_firstneigh; // ptr to 1st neighbor of each atom + int maxlocal; // size of numneigh, firstneigh arrays + int maxpage; // # of pages currently allocated + int pgsize; // size of neighbor page + int oneatom; // max # of neighbors for one atom + MyPage *ipage; // neighbor list pages + int *SR_numneigh; // # of pair neighbors for each atom + int **SR_firstneigh; // ptr to 1st neighbor of each atom - double *Nt, *Nd; // sum of cutoff fns ( f_C ) with SR neighs + double *Nt, *Nd; // sum of cutoff fns ( f_C ) with SR neighs void allocate(); void spline_init(); diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 982e67d4c1..2870d175c4 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -22,20 +22,19 @@ #include "pair_ilp_graphene_hbn.h" -#include - -#include #include "atom.h" +#include "citeme.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "memory.h" +#include "my_page.h" #include "neigh_list.h" #include "neigh_request.h" -#include "my_page.h" -#include "memory.h" -#include "error.h" -#include "citeme.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; @@ -66,13 +65,8 @@ PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) pvector = new double[nextra]; // initialize element to parameter maps - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; cutILPsq = nullptr; - map = nullptr; nmax = 0; maxlocal = 0; @@ -110,13 +104,8 @@ PairILPGrapheneHBN::~PairILPGrapheneHBN() memory->destroy(offset); } - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - memory->destroy(params); memory->destroy(elem2param); memory->destroy(cutILPsq); - if (allocated) delete [] map; } /* ---------------------------------------------------------------------- @@ -168,68 +157,10 @@ void PairILPGrapheneHBN::settings(int narg, char **arg) void PairILPGrapheneHBN::coeff(int narg, char **arg) { - int i,j,n; - - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - - + map_element2type(narg-3,arg+3); read_file(arg[2]); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - cut[i][j] = cut_global; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.h b/src/USER-MISC/pair_ilp_graphene_hbn.h index aadb792cad..4f5e187782 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.h +++ b/src/USER-MISC/pair_ilp_graphene_hbn.h @@ -56,12 +56,6 @@ class PairILPGrapheneHBN : public Pair { int ielement,jelement; }; Param *params; // parameter set for I-J interactions - char **elements; // names of unique elements - int **elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets int nmax; // max # of atoms double cut_global; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index c5fa33bbac..45ad36dd7c 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -21,21 +21,20 @@ ------------------------------------------------------------------------- */ #include "pair_kolmogorov_crespi_full.h" -#include - -#include #include "atom.h" +#include "citeme.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "memory.h" +#include "my_page.h" #include "neigh_list.h" #include "neigh_request.h" -#include "my_page.h" -#include "memory.h" -#include "error.h" -#include "citeme.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; @@ -66,13 +65,8 @@ PairKolmogorovCrespiFull::PairKolmogorovCrespiFull(LAMMPS *lmp) : Pair(lmp) pvector = new double[nextra]; // initialize element to parameter maps - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; cutKCsq = nullptr; - map = nullptr; nmax = 0; maxlocal = 0; @@ -111,13 +105,9 @@ PairKolmogorovCrespiFull::~PairKolmogorovCrespiFull() memory->destroy(offset); } - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); memory->destroy(elem2param); memory->destroy(cutKCsq); - if (allocated) delete [] map; } /* ---------------------------------------------------------------------- @@ -169,68 +159,9 @@ void PairKolmogorovCrespiFull::settings(int narg, char **arg) void PairKolmogorovCrespiFull::coeff(int narg, char **arg) { - int i,j,n; - - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - - + map_element2type(narg-3,arg+3); read_file(arg[2]); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - cut[i][j] = cut_global; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.h b/src/USER-MISC/pair_kolmogorov_crespi_full.h index f7d9237be4..dd2721d37e 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.h +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.h @@ -57,12 +57,6 @@ class PairKolmogorovCrespiFull : public Pair { int ielement,jelement; }; Param *params; // parameter set for I-J interactions - char **elements; // names of unique elements - int **elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets int nmax; // max # of atoms double cut_global; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 1bea688be5..4b5de2314e 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -23,16 +23,15 @@ #include "pair_kolmogorov_crespi_z.h" -#include - -#include #include "atom.h" #include "comm.h" -#include "force.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include +#include using namespace LAMMPS_NS; @@ -69,12 +68,8 @@ PairKolmogorovCrespiZ::~PairKolmogorovCrespiZ() memory->destroy(offset); } - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); memory->destroy(elem2param); - if (allocated) delete [] map; } /* ---------------------------------------------------------------------- */ @@ -221,45 +216,13 @@ void PairKolmogorovCrespiZ::settings(int narg, char **arg) void PairKolmogorovCrespiZ::coeff(int narg, char **arg) { - int i,j,n; - - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - + map_element2type(narg-3,arg+3,false); read_file(arg[2]); // set setflag only for i,j pairs where both are mapped to elements diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.h b/src/USER-MISC/pair_kolmogorov_crespi_z.h index 1a90fdfa0b..7d242d67fd 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.h +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.h @@ -43,12 +43,6 @@ class PairKolmogorovCrespiZ : public Pair { int ielement,jelement; }; Param *params; // parameter set for I-J interactions - char **elements; // names of unique elements - int **elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets double cut_global; double **cut; diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index a600f5b761..afd7209c6b 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -24,16 +24,15 @@ #include "pair_lebedeva_z.h" -#include - -#include #include "atom.h" #include "comm.h" -#include "force.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include +#include using namespace LAMMPS_NS; @@ -48,12 +47,7 @@ PairLebedevaZ::PairLebedevaZ(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; // initialize element to parameter maps - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; - map = nullptr; // always compute energy offset offset_flag = 1; @@ -70,12 +64,8 @@ PairLebedevaZ::~PairLebedevaZ() memory->destroy(offset); } - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); memory->destroy(elem2param); - if (allocated) delete [] map; } /* ---------------------------------------------------------------------- */ @@ -217,45 +207,13 @@ void PairLebedevaZ::settings(int narg, char **arg) void PairLebedevaZ::coeff(int narg, char **arg) { - int i,j,n; - - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } - + map_element2type(narg-3,arg+3,false); read_file(arg[2]); // set setflag only for i,j pairs where both are mapped to elements diff --git a/src/USER-MISC/pair_lebedeva_z.h b/src/USER-MISC/pair_lebedeva_z.h index e221087a0a..57cf445889 100644 --- a/src/USER-MISC/pair_lebedeva_z.h +++ b/src/USER-MISC/pair_lebedeva_z.h @@ -43,12 +43,6 @@ class PairLebedevaZ : public Pair { int ielement,jelement; }; Param *params; // parameter set for I-J interactions - char **elements; // names of unique elements - int **elem2param; // mapping from element pairs to parameters - int *map; // mapping from atom types to elements - int nelements; // # of unique elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets double cut_global; double **cut; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index a6bf602c70..e956d96cf2 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -32,18 +32,18 @@ ------------------------------------------------------------------------- */ #include "pair_meam_spline.h" -#include -#include #include "atom.h" -#include "force.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; @@ -55,10 +55,6 @@ PairMEAMSpline::PairMEAMSpline(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; one_coeff = 1; - nelements = 0; - elements = nullptr; - map = nullptr; - Uprime_values = nullptr; nmax = 0; maxNeighbors = 0; @@ -80,10 +76,6 @@ PairMEAMSpline::PairMEAMSpline(LAMMPS *lmp) : Pair(lmp) PairMEAMSpline::~PairMEAMSpline() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - delete[] twoBodyInfo; memory->destroy(Uprime_values); @@ -98,8 +90,6 @@ PairMEAMSpline::~PairMEAMSpline() delete[] gs; delete[] zero_atom_energies; - - delete [] map; } } @@ -389,11 +379,6 @@ void PairMEAMSpline::coeff(int narg, char **arg) if (narg != 3 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients"); - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - // read potential file: also sets the number of elements. read_file(arg[2]); diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index d1dc5064f5..b20454f18d 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -67,10 +67,6 @@ public: double memory_usage(); protected: - char **elements; // names of unique elements - int *map; // mapping from atom types to elements - int nelements; // # of unique elements - class SplineFunction { public: /// Default constructor. diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 58c0f75546..ff7b89fbe7 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -24,18 +24,18 @@ ------------------------------------------------------------------------- */ #include "pair_meam_sw_spline.h" -#include -#include #include "atom.h" -#include "force.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; @@ -49,9 +49,6 @@ PairMEAMSWSpline::PairMEAMSWSpline(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; centroidstressflag = CENTROID_NOTAVAIL; - nelements = 0; - elements = nullptr; - Uprime_values = nullptr; //ESWprime_values = nullptr; nmax = 0; @@ -66,10 +63,6 @@ PairMEAMSWSpline::PairMEAMSWSpline(LAMMPS *lmp) : Pair(lmp) PairMEAMSWSpline::~PairMEAMSWSpline() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - delete[] twoBodyInfo; memory->destroy(Uprime_values); //memory->destroy(ESWprime_values); @@ -77,7 +70,6 @@ PairMEAMSWSpline::~PairMEAMSWSpline() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; } } @@ -381,46 +373,9 @@ void PairMEAMSWSpline::settings(int narg, char **/*arg*/) void PairMEAMSWSpline::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // for now, only allow single element @@ -431,25 +386,6 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) // read potential file read_file(arg[2]); - - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index 7b40d123ed..ecf56c7931 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -54,9 +54,6 @@ public: double memory_usage(); protected: - char **elements; // names of unique elements - int *map; // mapping from atom types to elements - int nelements; // # of unique elements class SplineFunction { public: diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 0d5bbc1147..ed05961fa7 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -22,21 +22,19 @@ #include "pair_tersoff_table.h" -#include - -#include #include "atom.h" -#include "neighbor.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" - -#include "tokenizer.h" +#include "neighbor.h" #include "potential_file_reader.h" +#include "tokenizer.h" -#include "error.h" +#include +#include using namespace LAMMPS_NS; @@ -64,11 +62,7 @@ PairTersoffTable::PairTersoffTable(LAMMPS *lmp) : Pair(lmp) centroidstressflag = CENTROID_NOTAVAIL; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - nelements = 0; - elements = nullptr; - nparams = maxparam = 0; params = nullptr; - elem2param = nullptr; allocated = 0; preGtetaFunction = preGtetaFunctionDerived = nullptr; @@ -88,17 +82,12 @@ PairTersoffTable::PairTersoffTable(LAMMPS *lmp) : Pair(lmp) PairTersoffTable::~PairTersoffTable() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; memory->destroy(params); - memory->destroy(elem2param); + memory->destroy(elem3param); if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; - } deallocateGrids(); deallocatePreLoops(); @@ -177,7 +166,7 @@ void PairTersoffTable::compute(int eflag, int vflag) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; @@ -208,8 +197,8 @@ void PairTersoffTable::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k][0]; dr_ik[1] = ytmp -x[k][1]; @@ -264,7 +253,7 @@ void PairTersoffTable::compute(int eflag, int vflag) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; @@ -308,8 +297,8 @@ void PairTersoffTable::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k][0]; dr_ik[1] = ytmp -x[k][1]; @@ -333,8 +322,8 @@ void PairTersoffTable::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k][0]; dr_ik[1] = ytmp -x[k][1]; @@ -392,8 +381,8 @@ void PairTersoffTable::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k][0]; dr_ik[1] = ytmp -x[k][1]; @@ -457,8 +446,8 @@ void PairTersoffTable::compute(int eflag, int vflag) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k][0]; dr_ik[1] = ytmp -x[k][1]; @@ -608,7 +597,7 @@ void PairTersoffTable::allocateGrids(void) r = -1.0; deltaArgumentGtetaFunction = 1.0 / GRIDDENSITY_GTETA; - int iparam = elem2param[i][i][i]; + int iparam = elem3param[i][i][i]; double c = params[iparam].c; double d = params[iparam].d; double h = params[iparam].h; @@ -628,7 +617,7 @@ void PairTersoffTable::allocateGrids(void) for (i=0; intypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - // clear setflag since coeff() called once with I,J = * * - - n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // allocate tables and internal structures + allocatePreLoops(); allocateGrids(); } @@ -966,12 +900,12 @@ void PairTersoffTable::setup_params() { int i,j,k,m,n; - // set elem2param for all triplet combinations + // set elem3param for all triplet combinations // must be a single exact match to lines read from file // do not allow for ACB in place of ABC - memory->destroy(elem2param); - memory->create(elem2param,nelements,nelements,nelements,"pair:elem2param"); + memory->destroy(elem3param); + memory->create(elem3param,nelements,nelements,nelements,"pair:elem3param"); for (i = 0; i < nelements; i++) for (j = 0; j < nelements; j++) @@ -985,7 +919,7 @@ void PairTersoffTable::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i][j][k] = n; + elem3param[i][j][k] = n; } // set cutoff square diff --git a/src/USER-MISC/pair_tersoff_table.h b/src/USER-MISC/pair_tersoff_table.h index d63a5be5a6..84e6f6fe50 100644 --- a/src/USER-MISC/pair_tersoff_table.h +++ b/src/USER-MISC/pair_tersoff_table.h @@ -59,12 +59,6 @@ class PairTersoffTable : public Pair { double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - int ***elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets Param *params; // parameter set for an I-J-K interaction void allocate(); diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index 02a6126e03..258c833cdf 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -101,7 +101,7 @@ void PairAGNIOMP::eval(int iifrom, int iito, ThrData * const thr) ztmp = x[i].z; fxtmp = fytmp = fztmp = 0.0; - const Param &iparam = params[elem2param[itype]]; + const Param &iparam = params[elem1param[itype]]; Vx = new double[iparam.numeta]; Vy = new double[iparam.numeta]; Vz = new double[iparam.numeta]; diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index cfde8ff905..52c8855738 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -139,7 +139,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) iq = q[i]; NCo[i] = 0; nj = 0; - iparam_i = elem2param[itype][itype][itype]; + iparam_i = elem3param[itype][itype][itype]; // self energy, only on i atom @@ -180,7 +180,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // long range q-dependent @@ -242,7 +242,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) for (jj = 0; jj < sht_jnum; jj++) { j = sht_jlist[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (params[iparam_ij].hfocor > 0.0) { delr1[0] = x[j][0] - xtmp; @@ -264,7 +264,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) j = sht_jlist[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; // this Qj for q-dependent BSi @@ -288,7 +288,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) k = sht_jlist[kk]; if (j == k) continue; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -332,7 +332,7 @@ void PairCombOMP::eval(int iifrom, int iito, ThrData * const thr) k = sht_jlist[kk]; if (j == k) continue; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k][0] - xtmp; delr2[1] = x[k][1] - ytmp; @@ -434,7 +434,7 @@ double PairCombOMP::yasu_char(double *qf_fix, int &igroup) const double ytmp = x[i][1]; const double ztmp = x[i][2]; const double iq = q[i]; - const int iparam_i = elem2param[itype][itype][itype]; + const int iparam_i = elem3param[itype][itype][itype]; // charge force from self energy @@ -467,7 +467,7 @@ double PairCombOMP::yasu_char(double *qf_fix, int &igroup) delr1[2] = x[j][2] - ztmp; double rsq1 = dot3(delr1,delr1); - const int iparam_ij = elem2param[itype][jtype][jtype]; + const int iparam_ij = elem3param[itype][jtype][jtype]; // long range q-dependent @@ -505,7 +505,7 @@ double PairCombOMP::yasu_char(double *qf_fix, int &igroup) delr1[2] = x[j][2] - ztmp; double rsq1 = dot3(delr1,delr1); - const int iparam_ij = elem2param[itype][jtype][jtype]; + const int iparam_ij = elem3param[itype][jtype][jtype]; if (rsq1 > params[iparam_ij].cutsq) continue; nj ++; diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 106d038743..b2e8708305 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -184,7 +184,7 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -299,7 +299,7 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; r_ij = sqrt(r_ij); @@ -353,7 +353,7 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; dr_ik[0] = x[k].x - xtmp; dr_ik[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index 92d0d0c15a..28e450f517 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -121,7 +121,7 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) rsq = delx*delx + dely*dely + delz*delz; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) { continue; } else { @@ -161,7 +161,7 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) for (jj = 0; jj < jnumm1; jj++) { j = neighshort_thr[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; delr1[2] = x[j].z - ztmp; @@ -173,8 +173,8 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) for (kk = jj+1; kk < numshort; kk++) { k = neighshort_thr[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index c6947bbde7..8f255ee1ba 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -157,7 +157,7 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) rsq = rsqtmp; } - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq > params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,EFLAG,evdwl); @@ -185,7 +185,7 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; @@ -210,7 +210,7 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; @@ -251,7 +251,7 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index e689803c38..454a387982 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -159,7 +159,7 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) rsq = rsqtmp; } - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq > params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,EFLAG,evdwl); @@ -187,7 +187,7 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) j = jlist[jj]; j &= NEIGHMASK; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; @@ -212,7 +212,7 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; @@ -253,7 +253,7 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[kk]; k &= NEIGHMASK; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index 7fb3c70d78..c12e3b9859 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -173,7 +173,7 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) } jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; if (rsq >= params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij],rsq,fpair,EFLAG,evdwl); @@ -200,7 +200,7 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) for (jj = 0; jj < numshort; jj++) { j = neighshort_thr[jj]; jtype = map[type[j]]; - iparam_ij = elem2param[itype][jtype][jtype]; + iparam_ij = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; @@ -224,7 +224,7 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) if (jj == kk) continue; k = neighshort_thr[kk]; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; @@ -264,7 +264,7 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) if (jj == kk) continue; k = neighshort_thr[kk]; ktype = map[type[k]]; - iparam_ijk = elem2param[itype][jtype][ktype]; + iparam_ijk = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 2e52492491..02752c8577 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -154,7 +154,7 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; @@ -185,8 +185,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k].x; dr_ik[1] = ytmp -x[k].y; @@ -241,7 +241,7 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) r_ij = dr_ij[0]*dr_ij[0] + dr_ij[1]*dr_ij[1] + dr_ij[2]*dr_ij[2]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (r_ij > params[ijparam].cutsq) continue; @@ -285,8 +285,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k].x; dr_ik[1] = ytmp -x[k].y; @@ -310,8 +310,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k].x; dr_ik[1] = ytmp -x[k].y; @@ -370,8 +370,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k].x; dr_ik[1] = ytmp -x[k].y; @@ -436,8 +436,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) k = jlist[neighbor_k]; k &= NEIGHMASK; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; dr_ik[0] = xtmp -x[k].x; dr_ik[1] = ytmp -x[k].y; diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 303de78e37..23d7235578 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -143,7 +143,7 @@ void PairVashishtaOMP::eval(int iifrom, int iito, ThrData * const thr) } jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) continue; twobody(¶ms[ijparam],rsq,fpair,EFLAG,evdwl); @@ -164,7 +164,7 @@ void PairVashishtaOMP::eval(int iifrom, int iito, ThrData * const thr) for (jj = 0; jj < jnumm1; jj++) { j = neighshort_thr[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; delr1[2] = x[j].z - ztmp; @@ -177,8 +177,8 @@ void PairVashishtaOMP::eval(int iifrom, int iito, ThrData * const thr) for (kk = jj+1; kk < numshort; kk++) { k = neighshort_thr[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index 50c985ad68..c03d827d9b 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -141,7 +141,7 @@ void PairVashishtaTableOMP::eval(int iifrom, int iito, ThrData * const thr) } jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; if (rsq >= params[ijparam].cutsq) continue; twobody_table(params[ijparam],rsq,fpair,EFLAG,evdwl); @@ -162,7 +162,7 @@ void PairVashishtaTableOMP::eval(int iifrom, int iito, ThrData * const thr) for (jj = 0; jj < jnumm1; jj++) { j = neighshort_thr[jj]; jtype = map[type[j]]; - ijparam = elem2param[itype][jtype][jtype]; + ijparam = elem3param[itype][jtype][jtype]; delr1[0] = x[j].x - xtmp; delr1[1] = x[j].y - ytmp; delr1[2] = x[j].z - ztmp; @@ -175,8 +175,8 @@ void PairVashishtaTableOMP::eval(int iifrom, int iito, ThrData * const thr) for (kk = jj+1; kk < numshort; kk++) { k = neighshort_thr[kk]; ktype = map[type[k]]; - ikparam = elem2param[itype][ktype][ktype]; - ijkparam = elem2param[itype][jtype][ktype]; + ikparam = elem3param[itype][ktype][ktype]; + ijkparam = elem3param[itype][jtype][ktype]; delr2[0] = x[k].x - xtmp; delr2[1] = x[k].y - ytmp; diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index fe78fbbb37..4d6f240ec6 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -22,23 +22,23 @@ #include "pair_reaxc.h" -#include - -#include -#include #include "atom.h" -#include "update.h" -#include "force.h" +#include "citeme.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_reaxc.h" -#include "citeme.h" +#include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "update.h" + +#include +#include +#include // for strcasecmp() #include "reaxc_defs.h" #include "reaxc_types.h" @@ -175,7 +175,6 @@ PairReaxC::~PairReaxC() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cutghost); - delete [] map; delete [] chi; delete [] eta; diff --git a/src/USER-REAXC/pair_reaxc.h b/src/USER-REAXC/pair_reaxc.h index a833ddbcf0..53b41ba9c8 100644 --- a/src/USER-REAXC/pair_reaxc.h +++ b/src/USER-REAXC/pair_reaxc.h @@ -62,9 +62,6 @@ class PairReaxC : public Pair { protected: char *fix_id; double cutmax; - int nelements; // # of unique elements - char **elements; // names of unique elements - int *map; class FixReaxC *fix_reax; double *chi,*eta,*gamma; diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 7ed37fefc4..5a27855a47 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -91,10 +91,6 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) ds = 0.0; kmax = 0; - nelements = 0; - elements = nullptr; - nparams = 0; - maxparam = 0; params = nullptr; intparams = nullptr; @@ -153,8 +149,6 @@ PairSMTBQ::~PairSMTBQ() { int i; if (elements) { - for ( i = 0; i < nelements; i++) delete [] elements[i]; - for (i = 0; i < atom->ntypes ; i++ ) free( params[i].nom); for (i = 1; i <= maxintparam ; i++ ) free( intparams[i].typepot); for (i = 1; i <= maxintparam ; i++ ) free( intparams[i].mode); @@ -166,7 +160,6 @@ PairSMTBQ::~PairSMTBQ() free(writeenerg); free(Bavard); - delete [] elements; memory->sfree(params); memory->sfree(intparams); @@ -216,7 +209,6 @@ PairSMTBQ::~PairSMTBQ() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - delete [] map; delete [] esm; } @@ -252,92 +244,30 @@ void PairSMTBQ::settings(int narg, char ** /* arg */) void PairSMTBQ::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (strstr(force->pair_style,"hybrid")) + if (utils::strmatch(force->pair_style,"^hybrid")) error->all(FLERR,"Pair style SMTBQ is not compatible with hybrid styles"); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - n = strlen(arg[i]) + 1; - elements[j] = new char[n]; - strcpy(elements[j],arg[i]); - nelements++; - } - } + map_element2type(narg-3,arg+3); // read potential file and initialize potential parameters read_file(arg[2]); - n = atom->ntypes; - // generate Coulomb 1/r energy look-up table - if (comm->me == 0 && screen) fprintf(screen,"Pair SMTBQ:\n"); if (comm->me == 0 && screen) - fprintf(screen," generating Coulomb integral lookup table ...\n"); + fputs("Pair SMTBQ: generating Coulomb integral lookup table ...\n",screen); tabqeq(); // ------------ - if (comm->me == 0 && screen) - fprintf(screen," generating Second Moment integral lookup table ...\n"); + fputs(" generating Second Moment integral lookup table ...\n",screen); tabsm(); - - // ------------ - - // clear setflag since coeff() called once with I,J = * * - - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- diff --git a/src/USER-SMTBQ/pair_smtbq.h b/src/USER-SMTBQ/pair_smtbq.h index 4681c94895..8bf1cba57c 100644 --- a/src/USER-SMTBQ/pair_smtbq.h +++ b/src/USER-SMTBQ/pair_smtbq.h @@ -60,8 +60,6 @@ protected: int loopmax; // max of iteration double cutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements char *QEqMode; // name of QEqMode char *Bavard; // Verbose parameter char *writepot; // write or not the electronegativity component @@ -70,11 +68,8 @@ protected: double zlim1QEq; // z limit for QEq equilibration double zlim2QEq; // z limit for QEq equilibration double QOxInit; // Initial charge for oxygen atoms (if the charge is not specified) - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets - int maxintparam; // max # of interaction sets - int maxintsm; // max # of interaction SM + int maxintparam; // max # of interaction sets + int maxintsm; // max # of interaction SM double r1Coord,r2Coord; Param *params; // parameter set for an I atom Intparam *intparams; // parameter set for an I interaction diff --git a/src/input.cpp b/src/input.cpp index 53fcc606db..f96cf8c75c 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1697,6 +1697,9 @@ void Input::pair_coeff() error->all(FLERR,"Pair_coeff command before simulation box is defined"); if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command before pair_style is defined"); + if ((narg < 2) || (force->pair->one_coeff && ((strcmp(arg[0],"*") != 0) + || (strcmp(arg[1],"*") != 0)))) + error->all(FLERR,"Incorrect args for pair coefficients"); force->pair->coeff(narg,arg); } diff --git a/src/pair.cpp b/src/pair.cpp index 27a8831eb1..767fa638cf 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -106,6 +106,13 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) num_tally_compute = 0; list_tally_compute = nullptr; + nelements = nparams = maxparam = 0; + elements = nullptr; + elem1param = nullptr; + elem2param = nullptr; + elem3param = nullptr; + map = nullptr; + nondefault_history_transfer = 0; beyond_contact = 0; @@ -129,6 +136,11 @@ Pair::~Pair() if (copymode) return; + if (elements) + for (int i = 0; i < nelements; i++) delete[] elements[i]; + delete[] elements; + + delete[] map; memory->destroy(eatom); memory->destroy(vatom); memory->destroy(cvatom); @@ -776,6 +788,68 @@ void Pair::del_tally_callback(Compute *ptr) } } +/* ------------------------------------------------------------------- + build element to atom type mapping for manybody potentials + also clear and reset setflag[][] array and check missing entries +---------------------------------------------------------------------- */ + +void Pair::map_element2type(int narg, char **arg, bool update_setflag) +{ + int i,j; + const int ntypes = atom->ntypes; + + // read args that map atom types to elements in potential file + // map[i] = which element the Ith atom type is, -1 if "NULL" + // nelements = # of unique elements + // elements = list of element names + + if (narg != ntypes) + error->all(FLERR,"Incorrect args for pair coefficients"); + + if (elements) { + for (i = 0; i < nelements; i++) delete[] elements[i]; + delete[] elements; + } + elements = new char*[ntypes]; + for (i = 0; i < ntypes; i++) elements[i] = nullptr; + + nelements = 0; + map[0] = -1; + for (i = 1; i <= narg; i++) { + std::string entry = arg[i-1]; + if (entry == "NULL") { + map[i] = -1; + continue; + } + for (j = 0; j < nelements; j++) + if (entry == elements[j]) break; + map[i] = j; + if (j == nelements) { + elements[j] = utils::strdup(entry); + nelements++; + } + } + + // if requested, clear setflag[i][j] and set it for type pairs + // where both are mapped to elements in map. + + if (update_setflag) { + + int count = 0; + for (i = 1; i <= ntypes; i++) { + for (j = i; j <= ntypes; j++) { + setflag[i][j] = 0; + if ((map[i] >= 0) && (map[j] >= 0)) { + setflag[i][j] = 1; + count++; + } + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + } +} + /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag diff --git a/src/pair.h b/src/pair.h index 9bca64fbf3..b25ad448eb 100644 --- a/src/pair.h +++ b/src/pair.h @@ -216,17 +216,27 @@ class Pair : protected Pointers { virtual void del_tally_callback(class Compute *); protected: - int instance_me; // which Pair class instantiation I am + int instance_me; // which Pair class instantiation I am + int special_lj[4]; // copied from force->special_lj for Kokkos + int suffix_flag; // suffix compatibility flag - int special_lj[4]; // copied from force->special_lj for Kokkos - - int suffix_flag; // suffix compatibility flag - - // pair_modify settings - int offset_flag,mix_flag; // flags for offset and mixing - double tabinner; // inner cutoff for Coulomb table - double tabinner_disp; // inner cutoff for dispersion table + // pair_modify settings + int offset_flag,mix_flag; // flags for offset and mixing + double tabinner; // inner cutoff for Coulomb table + double tabinner_disp; // inner cutoff for dispersion table + protected: + // for mapping of elements to atom types and parameters + // mostly used for manybody potentials + int nelements; // # of unique elements + char **elements; // names of unique elements + int *elem1param; // mapping from elements to parameters + int **elem2param; // mapping from element pairs to parameters + int ***elem3param; // mapping from element triplets to parameters + int *map; // mapping from atom types to elements + int nparams; // # of stored parameter sets + int maxparam; // max # of parameter sets + void map_element2type(int, char**, bool update_setflag=true); public: // custom data type for accessing Coulomb tables diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 68790c0f03..55529f9eae 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -49,13 +49,8 @@ PairCoulStreitz::PairCoulStreitz(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; one_coeff = 1; nmax = 0; - nelements = 0; - elements = nullptr; - nparams = 0; - maxparam = 0; params = nullptr; - elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -64,12 +59,8 @@ PairCoulStreitz::PairCoulStreitz(LAMMPS *lmp) : Pair(lmp) PairCoulStreitz::~PairCoulStreitz() { - if (elements) - for (int i = 0; i < nelements; i++) delete [] elements[i]; - - delete [] elements; memory->sfree(params); - memory->destroy(elem2param); + memory->destroy(elem1param); if (allocated) { memory->destroy(setflag); @@ -80,7 +71,6 @@ PairCoulStreitz::~PairCoulStreitz() memory->destroy(qeq_g); memory->destroy(qeq_z); memory->destroy(qeq_c); - delete [] map; } } @@ -130,69 +120,19 @@ void PairCoulStreitz::settings(int narg, char **arg) void PairCoulStreitz::coeff(int narg, char **arg) { - int i,j,n; - if (!allocated) allocate(); - if (narg != 3 + atom->ntypes) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // insure I,J args are * * - - if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if "NULL" - // nelements = # of unique elements - // elements = list of element names - - if (elements) { - for (i = 0; i < nelements; i++) delete [] elements[i]; - delete [] elements; - } - elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; - - nelements = 0; - for (i = 3; i < narg; i++) { - if (strcmp(arg[i],"NULL") == 0) { - map[i-2] = -1; - continue; - } - for (j = 0; j < nelements; j++) - if (strcmp(arg[i],elements[j]) == 0) break; - map[i-2] = j; - if (j == nelements) { - elements[j] = utils::strdup(arg[i]); - nelements++; - } - } + map_element2type(narg-3, arg+3); // read potential file and initialize potential parameters read_file(arg[2]); setup_params(); - n = atom->ntypes; - - // clear setflag since coeff() called once with I,J = * * + const int n = atom->ntypes; for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { + for (int j = 1; j <= n; j++) scale[i][j] = 1.0; - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } /* ---------------------------------------------------------------------- @@ -308,10 +248,10 @@ void PairCoulStreitz::setup_params() { int i,m,n; - // set elem2param + // set elem1param - memory->destroy(elem2param); - memory->create(elem2param,nelements,"pair:elem2param"); + memory->destroy(elem1param); + memory->create(elem1param,nelements,"pair:elem1param"); for (i = 0; i < nelements; i++) { n = -1; @@ -322,7 +262,7 @@ void PairCoulStreitz::setup_params() } } if (n < 0) error->all(FLERR,"Potential file is missing an entry"); - elem2param[i] = n; + elem1param[i] = n; } // Wolf sum self energy @@ -381,7 +321,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) ytmp = x[i][1]; ztmp = x[i][2]; itype = map[type[i]]; - iparam_i = elem2param[itype]; + iparam_i = elem1param[itype]; qi = q[i]; zei = params[iparam_i].zeta; @@ -401,7 +341,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) j &= NEIGHMASK; jtype = map[type[j]]; - iparam_j = elem2param[jtype]; + iparam_j = elem1param[jtype]; qj = q[j]; zej = params[iparam_j].zeta; zj = params[iparam_j].zcore; @@ -454,7 +394,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) ytmp = x[i][1]; ztmp = x[i][2]; itype = map[type[i]]; - iparam_i = elem2param[itype]; + iparam_i = elem1param[itype]; qi = q[i]; zei = params[iparam_i].zeta; @@ -473,7 +413,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) j = jlist[jj]; j &= NEIGHMASK; jtype = map[type[j]]; - iparam_j = elem2param[jtype]; + iparam_j = elem1param[jtype]; qj = q[j]; zej = params[iparam_j].zeta; zj = params[iparam_j].zcore; diff --git a/src/pair_coul_streitz.h b/src/pair_coul_streitz.h index 2f62846212..12da6afcfe 100644 --- a/src/pair_coul_streitz.h +++ b/src/pair_coul_streitz.h @@ -45,14 +45,8 @@ class PairCoulStreitz : public Pair { }; int nmax; - int nelements; // # of unique elements - char **elements; // names of unique elements - int *elem2param; // mapping from element triplets to parameters - int *map; // mapping from atom types to elements - int nparams; // # of stored parameter sets - int maxparam; // max # of parameter sets double precision; - Param *params; // parameter set for an I-J-K interaction + Param *params; // parameter sets for elements // Kspace parameters int kspacetype; From 436be824e14d23115506cf11639bd101818fa084 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 25 Mar 2021 21:13:24 -0400 Subject: [PATCH 154/370] use std:: namespace for STL containers --- src/USER-AWPMD/pair_awpmd_cut.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 3d4e1f12a7..54f851171b 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -150,7 +150,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) # if 1 // mapping of the LAMMPS numbers to the AWPMC numbers - vector gmap(ntot,-1); + std::vector gmap(ntot,-1); for (int ii = 0; ii < inum; ii++) { int i = ilist[ii]; @@ -226,7 +226,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) // prepare the solver object wpmd->reset(); - map > etmap; + std::map > etmap; // add particles to the AWPMD solver object for (int i = 0; i < ntot; i++) { //int i = ilist[ii]; @@ -246,8 +246,8 @@ void PairAWPMDCut::compute(int eflag, int vflag) fi= new Vector_3[wpmd->ni]; // adding electrons - for (map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { - vector &el=it->second; + for (std::map >::iterator it=etmap.begin(); it!= etmap.end(); ++it) { + std::vector &el=it->second; if (!el.size()) // should not happen continue; int s=spin[el[0]] >0 ? 0 : 1; From dfb18caf5a38b9e32ae6262ce6645f9a37135566 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Mar 2021 15:52:14 -0400 Subject: [PATCH 155/370] simplify using utils::strdup(), update order of include files --- src/KOKKOS/pair_exp6_rx_kokkos.cpp | 10 +---- src/KOKKOS/pair_table_rx_kokkos.cpp | 18 +++------ src/LATTE/fix_latte.cpp | 5 +-- src/MC/fix_atom_swap.cpp | 45 +++++++++++---------- src/MC/fix_bond_swap.cpp | 34 ++++++++-------- src/MC/fix_gcmc.cpp | 53 +++++++++++-------------- src/MC/fix_widom.cpp | 4 +- src/MISC/compute_ti.cpp | 26 +++++------- src/MISC/fix_deposit.cpp | 12 ++---- src/MISC/fix_evaporate.cpp | 4 +- src/MISC/fix_oneway.cpp | 4 +- src/MISC/fix_orient_bcc.cpp | 16 ++------ src/MISC/fix_orient_fcc.cpp | 16 ++------ src/MLIAP/mliap_descriptor_snap.cpp | 9 ++--- src/MLIAP/mliap_model_nn.cpp | 2 +- src/REPLICA/compute_event_displace.cpp | 4 +- src/REPLICA/prd.cpp | 22 +++-------- src/REPLICA/tad.cpp | 19 +++------ src/RIGID/compute_erotate_rigid.cpp | 16 ++++---- src/RIGID/compute_ke_rigid.cpp | 16 ++++---- src/RIGID/compute_rigid_local.cpp | 4 +- src/RIGID/fix_ehex.cpp | 22 +++++------ src/RIGID/fix_rigid_nh.cpp | 8 +--- src/RIGID/fix_rigid_nh_small.cpp | 8 +--- src/RIGID/fix_rigid_nph.cpp | 27 ++----------- src/RIGID/fix_rigid_nph_small.cpp | 27 ++----------- src/RIGID/fix_rigid_npt.cpp | 27 ++----------- src/RIGID/fix_rigid_npt_small.cpp | 27 ++----------- src/SHOCK/fix_msst.cpp | 25 ++++++------ src/SHOCK/fix_nphug.cpp | 55 +++++++------------------- src/SPIN/fix_neb_spin.cpp | 28 +++++-------- 31 files changed, 191 insertions(+), 402 deletions(-) diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 5c1a3b3589..c0cfd11466 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -1800,14 +1800,8 @@ void PairExp6rxKokkos::read_file(char *file) } params[nparams].ispecies = ispecies; - - n = strlen(&atom->dname[ispecies][0]) + 1; - params[nparams].name = new char[n]; - strcpy(params[nparams].name,&atom->dname[ispecies][0]); - - n = strlen(words[1]) + 1; - params[nparams].potential = new char[n]; - strcpy(params[nparams].potential,words[1]); + params[nparams].name = utils::strdup(&atom->dname[ispecies][0]); + params[nparams].potential = utils::strdup(words[1]); if (strcmp(params[nparams].potential,"exp6") == 0) { params[nparams].alpha = atof(words[2]); params[nparams].epsilon = atof(words[3]); diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index c3e23b6e5e..41b0343443 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -1040,25 +1040,19 @@ void PairTableRXKokkos::coeff(int narg, char **arg) nspecies = atom->nspecies_dpd; if (nspecies==0) error->all(FLERR,"There are no rx species specified."); - int n; - n = strlen(arg[4]) + 1; - site1 = new char[n]; - strcpy(site1,arg[4]); + site1 = utils::strdup(arg[4]); int ispecies; - for (ispecies = 0; ispecies < nspecies; ispecies++) { + for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(site1,&atom->dname[ispecies][0]) == 0) break; - } + if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) error->all(FLERR,"Site1 name not recognized in pair coefficients"); - n = strlen(arg[5]) + 1; - site2 = new char[n]; - strcpy(site2,arg[5]); - - for (ispecies = 0; ispecies < nspecies; ispecies++) { + site2 = utils::strdup(arg[5]); + for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; - } + if (ispecies == nspecies && strcmp(site2,"1fluid") != 0) error->all(FLERR,"Site2 name not recognized in pair coefficients"); diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index ababe2f185..81d7cb3201 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -84,10 +84,7 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix latte does not yet support a LAMMPS calculation " "of a Coulomb potential"); - int n = strlen(arg[3]) + 1; - id_pe = new char[n]; - strcpy(id_pe,arg[3]); - + id_pe = utils::strdup(arg[3]); int ipe = modify->find_compute(id_pe); if (ipe < 0) error->all(FLERR,"Could not find fix latte compute ID"); if (modify->compute[ipe]->peatomflag == 0) diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 92671fb637..954ce46aa6 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -18,30 +18,31 @@ #include "fix_atom_swap.h" +#include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "pair.h" +#include "random_park.h" +#include "region.h" +#include "update.h" + #include #include #include #include -#include "atom.h" -#include "update.h" -#include "modify.h" -#include "fix.h" -#include "comm.h" -#include "compute.h" -#include "group.h" -#include "domain.h" -#include "region.h" -#include "random_park.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "kspace.h" -#include "memory.h" -#include "error.h" -#include "neighbor.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -138,9 +139,7 @@ void FixAtomSwap::options(int narg, char **arg) iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) error->all(FLERR,"Region ID for fix atom/swap does not exist"); - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"ke") == 0) { diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 119c95d842..84d89a9626 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -13,27 +13,27 @@ #include "fix_bond_swap.h" -#include -#include -#include "atom.h" -#include "force.h" -#include "pair.h" -#include "bond.h" #include "angle.h" -#include "neighbor.h" +#include "atom.h" +#include "bond.h" +#include "citeme.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" -#include "comm.h" -#include "domain.h" -#include "modify.h" -#include "compute.h" +#include "neighbor.h" +#include "pair.h" #include "random_mars.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" - #include "update.h" +#include +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -642,9 +642,7 @@ int FixBondSwap::modify_param(int narg, char **arg) tflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index b8eecf95ca..b946615b04 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -17,32 +17,33 @@ #include "fix_gcmc.h" -#include -#include +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "molecule.h" -#include "update.h" -#include "modify.h" -#include "fix.h" +#include "bond.h" #include "comm.h" #include "compute.h" -#include "group.h" -#include "domain.h" -#include "region.h" -#include "random_park.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "math_extra.h" #include "math_const.h" +#include "math_extra.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "molecule.h" #include "neighbor.h" +#include "pair.h" +#include "random_park.h" +#include "region.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -301,9 +302,7 @@ void FixGCMC::options(int narg, char **arg) iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) error->all(FLERR,"Region ID for fix gcmc does not exist"); - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"maxangle") == 0) { @@ -327,18 +326,14 @@ void FixGCMC::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"rigid") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idrigid; - idrigid = new char[n]; - strcpy(idrigid,arg[iarg+1]); + idrigid = utils::strdup(arg[iarg+1]); rigidflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"shake") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idshake; - idshake = new char[n]; - strcpy(idshake,arg[iarg+1]); + idshake = utils::strdup(arg[iarg+1]); shakeflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"full_energy") == 0) { @@ -353,9 +348,7 @@ void FixGCMC::options(int narg, char **arg) ngroupsmax*sizeof(char *), "fix_gcmc:groupstrings"); } - int n = strlen(arg[iarg+1]) + 1; - groupstrings[ngroups] = new char[n]; - strcpy(groupstrings[ngroups],arg[iarg+1]); + groupstrings[ngroups] = utils::strdup(arg[iarg+1]); ngroups++; iarg += 2; } else if (strcmp(arg[iarg],"grouptype") == 0) { @@ -370,9 +363,7 @@ void FixGCMC::options(int narg, char **arg) "fix_gcmc:grouptypestrings"); } grouptypes[ngrouptypes] = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - int n = strlen(arg[iarg+2]) + 1; - grouptypestrings[ngrouptypes] = new char[n]; - strcpy(grouptypestrings[ngrouptypes],arg[iarg+2]); + grouptypestrings[ngrouptypes] = utils::strdup(arg[iarg+2]); ngrouptypes++; iarg += 3; } else if (strcmp(arg[iarg],"intra_energy") == 0) { diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index a1bdc32515..e898196e14 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -224,9 +224,7 @@ void FixWidom::options(int narg, char **arg) iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) error->all(FLERR,"Region ID for fix widom does not exist"); - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index e81dd81c86..5ba85679a3 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -17,17 +17,17 @@ #include "compute_ti.h" -#include #include "atom.h" -#include "update.h" #include "domain.h" -#include "force.h" -#include "pair.h" -#include "kspace.h" -#include "input.h" -#include "variable.h" #include "error.h" +#include "force.h" +#include "input.h" +#include "kspace.h" +#include "pair.h" +#include "update.h" +#include "variable.h" +#include using namespace LAMMPS_NS; @@ -77,21 +77,15 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg],"tail") == 0) which[nterms] = TAIL; else which[nterms] = PAIR; - int n = strlen(arg[iarg]) + 1; - pstyle[nterms] = new char[n]; - strcpy(pstyle[nterms],arg[iarg]); + pstyle[nterms] = utils::strdup(arg[iarg]); utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,ilo[nterms],ihi[nterms],error); iarg += 1; if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) { - int n = strlen(&arg[iarg+1][2]) + 1; - var1[nterms] = new char[n]; - strcpy(var1[nterms],&arg[iarg+1][2]); + var1[nterms] = utils::strdup(&arg[iarg+1][2]); } else error->all(FLERR,"Illegal compute ti command"); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { - int n = strlen(&arg[iarg+2][2]) + 1; - var2[nterms] = new char[n]; - strcpy(var2[nterms],&arg[iarg+2][2]); + var2[nterms] = utils::strdup(&arg[iarg+2][2]); } else error->all(FLERR,"Illegal compute ti command"); nterms++; diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index e832b37e67..6af537f6f4 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -697,9 +697,7 @@ void FixDeposit::options(int narg, char **arg) iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) error->all(FLERR,"Region ID for fix deposit does not exist"); - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"mol") == 0) { @@ -728,18 +726,14 @@ void FixDeposit::options(int narg, char **arg) iarg += nmol+1; } else if (strcmp(arg[iarg],"rigid") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idrigid; - idrigid = new char[n]; - strcpy(idrigid,arg[iarg+1]); + idrigid = utils::strdup(arg[iarg+1]); rigidflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"shake") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - int n = strlen(arg[iarg+1]) + 1; delete [] idshake; - idshake = new char[n]; - strcpy(idshake,arg[iarg+1]); + idshake = utils::strdup(arg[iarg+1]); shakeflag = 1; iarg += 2; diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index d0e016b554..2a11d1675a 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -44,9 +44,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : nevery = utils::inumeric(FLERR,arg[3],false,lmp); nflux = utils::inumeric(FLERR,arg[4],false,lmp); iregion = domain->find_region(arg[5]); - int n = strlen(arg[5]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[5]); + idregion = utils::strdup(arg[5]); int seed = utils::inumeric(FLERR,arg[6],false,lmp); if (nevery <= 0 || nflux <= 0) diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index a2e612730c..7e655e60c6 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -42,9 +42,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 1) error->all(FLERR,"Illegal fix oneway command"); - int len = strlen(arg[4]); - regionstr = new char[len+1]; - strcpy(regionstr,arg[4]); + regionstr = utils::strdup(arg[4]); if (strcmp(arg[5], "x") == 0) direction = X|PLUS; if (strcmp(arg[5], "X") == 0) direction = X|PLUS; diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index 186e651504..4c6693f729 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -82,19 +82,11 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : uxif_high = utils::numeric(FLERR,arg[8],false,lmp); if (direction_of_motion == 0) { - int n = strlen(arg[9]) + 1; - chifilename = new char[n]; - strcpy(chifilename,arg[9]); - n = strlen(arg[10]) + 1; - xifilename = new char[n]; - strcpy(xifilename,arg[10]); + chifilename = utils::strdup(arg[9]); + xifilename = utils::strdup(arg[10]); } else if (direction_of_motion == 1) { - int n = strlen(arg[9]) + 1; - xifilename = new char[n]; - strcpy(xifilename,arg[9]); - n = strlen(arg[10]) + 1; - chifilename = new char[n]; - strcpy(chifilename,arg[10]); + xifilename = utils::strdup(arg[9]); + chifilename = utils::strdup(arg[10]); } else error->all(FLERR,"Illegal fix orient/bcc command"); // initializations diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index 04eae4ac3e..a59e412fde 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -80,19 +80,11 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : uxif_high = utils::numeric(FLERR,arg[8],false,lmp); if (direction_of_motion == 0) { - int n = strlen(arg[9]) + 1; - chifilename = new char[n]; - strcpy(chifilename,arg[9]); - n = strlen(arg[10]) + 1; - xifilename = new char[n]; - strcpy(xifilename,arg[10]); + chifilename = utils::strdup(arg[9]); + xifilename = utils::strdup(arg[10]); } else if (direction_of_motion == 1) { - int n = strlen(arg[9]) + 1; - xifilename = new char[n]; - strcpy(xifilename,arg[9]); - n = strlen(arg[10]) + 1; - chifilename = new char[n]; - strcpy(chifilename,arg[10]); + xifilename = utils::strdup(arg[9]); + chifilename = utils::strdup(arg[10]); } else error->all(FLERR,"Illegal fix orient/fcc command"); // initializations diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 388561e248..0fdc548fc1 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -427,22 +427,19 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) if (strcmp(keywd,"elems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { - char* elemtmp = keyval; - int n = strlen(elemtmp) + 1; - elements[ielem] = new char[n]; - strcpy(elements[ielem],elemtmp); + elements[ielem] = utils::strdup(keyval); keyval = strtok(nullptr,"' \t\n\r\f"); } elementsflag = 1; } else if (strcmp(keywd,"radelems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { - radelem[ielem] = atof(keyval); + radelem[ielem] = utils::numeric(FLERR,keyval,false,lmp); keyval = strtok(nullptr,"' \t\n\r\f"); } radelemflag = 1; } else if (strcmp(keywd,"welems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { - wjelem[ielem] = atof(keyval); + wjelem[ielem] = utils::numeric(FLERR,keyval,false,lmp); keyval = strtok(nullptr,"' \t\n\r\f"); } wjelemflag = 1; diff --git a/src/MLIAP/mliap_model_nn.cpp b/src/MLIAP/mliap_model_nn.cpp index 2bf75385b4..3805a5761b 100644 --- a/src/MLIAP/mliap_model_nn.cpp +++ b/src/MLIAP/mliap_model_nn.cpp @@ -18,9 +18,9 @@ #include "mliap_model_nn.h" #include "pair_mliap.h" #include "mliap_data.h" -#include "error.h" #include "comm.h" +#include "error.h" #include "memory.h" #include "tokenizer.h" diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 958c2d3c22..0ef14b8603 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -206,7 +206,5 @@ void ComputeEventDisplace::reset_extra_compute_fix(const char *id_new) id_event = nullptr; if (id_new == nullptr) return; - int n = strlen(id_new) + 1; - id_event = new char[n]; - strcpy(id_event,id_new); + id_event = utils::strdup(id_new); } diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index de45116194..40e5fc8833 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -77,8 +77,7 @@ void PRD::command(int narg, char **arg) t_dephase = utils::inumeric(FLERR,arg[3],false,lmp); t_corr = utils::inumeric(FLERR,arg[4],false,lmp); - char *id_compute = new char[strlen(arg[5])+1]; - strcpy(id_compute,arg[5]); + char *id_compute = utils::strdup(arg[5]); int seed = utils::inumeric(FLERR,arg[6],false,lmp); options(narg-7,&arg[7]); @@ -875,15 +874,8 @@ void PRD::options(int narg, char **arg) temp_flag = 0; stepmode = 0; - char *str = (char *) "geom"; - int n = strlen(str) + 1; - loop_setting = new char[n]; - strcpy(loop_setting,str); - - str = (char *) "gaussian"; - n = strlen(str) + 1; - dist_setting = new char[n]; - strcpy(dist_setting,str); + loop_setting = utils::strdup("geom"); + dist_setting = utils::strdup("gaussian"); int iarg = 0; while (iarg < narg) { @@ -912,16 +904,12 @@ void PRD::options(int narg, char **arg) else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = nullptr; else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = nullptr; else error->all(FLERR,"Illegal prd command"); - int n = strlen(arg[iarg+1]) + 1; - loop_setting = new char[n]; - strcpy(loop_setting,arg[iarg+1]); + loop_setting = utils::strdup(arg[iarg+1]); if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = nullptr; else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = nullptr; else error->all(FLERR,"Illegal prd command"); - n = strlen(arg[iarg+2]) + 1; - dist_setting = new char[n]; - strcpy(dist_setting,arg[iarg+2]); + dist_setting = utils::strdup(arg[iarg+2]); iarg += 3; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 0fc611b307..0bab7a31c8 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -89,15 +89,12 @@ void TAD::command(int narg, char **arg) delta_conf = utils::numeric(FLERR,arg[4],false,lmp); tmax = utils::numeric(FLERR,arg[5],false,lmp); - char *id_compute = new char[strlen(arg[6])+1]; - strcpy(id_compute,arg[6]); + char *id_compute = utils::strdup(arg[6]); // quench minimizer is set by min_style command // NEB minimizer is set by options, default = quickmin - int n = strlen(update->minimize_style) + 1; - min_style = new char[n]; - strcpy(min_style,update->minimize_style); + min_style = utils::strdup(update->minimize_style); options(narg-7,&arg[7]); @@ -585,9 +582,7 @@ void TAD::options(int narg, char **arg) n2steps_neb = 100; nevery_neb = 10; - int n = strlen("quickmin") + 1; - min_style_neb = new char[n]; - strcpy(min_style_neb,"quickmin"); + min_style_neb = utils::strdup("quickmin"); dt_neb = update->dt; neb_logfilename = nullptr; @@ -619,9 +614,7 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb_style") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); delete [] min_style_neb; - int n = strlen(arg[iarg+1]) + 1; - min_style_neb = new char[n]; - strcpy(min_style_neb,arg[iarg+1]); + min_style_neb = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"neb_step") == 0) { @@ -635,9 +628,7 @@ void TAD::options(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = nullptr; else { - int n = strlen(arg[iarg+1]) + 1; - neb_logfilename = new char[n]; - strcpy(neb_logfilename,arg[iarg+1]); + neb_logfilename = utils::strdup(arg[iarg+1]); } iarg += 2; } else error->all(FLERR,"Illegal tad command"); diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index b20e11e359..d1567cfe2e 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -12,14 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_erotate_rigid.h" -#include -#include "update.h" -#include "force.h" -#include "modify.h" + +#include "error.h" #include "fix.h" #include "fix_rigid.h" #include "fix_rigid_small.h" -#include "error.h" +#include "force.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -33,9 +35,7 @@ ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 1; - int n = strlen(arg[3]) + 1; - rfix = new char[n]; - strcpy(rfix,arg[3]); + rfix = utils::strdup(arg[3]); } /* ---------------------------------------------------------------------- */ diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index c005f6ac25..9da5aabb9a 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -12,14 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_ke_rigid.h" -#include -#include "update.h" -#include "force.h" -#include "modify.h" + +#include "error.h" #include "fix.h" #include "fix_rigid.h" #include "fix_rigid_small.h" -#include "error.h" +#include "force.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -33,9 +35,7 @@ ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 1; - int n = strlen(arg[3]) + 1; - rfix = new char[n]; - strcpy(rfix,arg[3]); + rfix = utils::strdup(arg[3]); } /* ---------------------------------------------------------------------- */ diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index 0a40062055..9de227531d 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -40,9 +40,7 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : local_flag = 1; nvalues = narg - 4; - int n = strlen(arg[3]) + 1; - idrigid = new char[n]; - strcpy(idrigid,arg[3]); + idrigid = utils::strdup(arg[3]); rstyle = new int[nvalues]; diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 7229dc8b02..4bfabea3dd 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -24,17 +24,19 @@ #include "fix_ehex.h" -#include -#include #include "atom.h" #include "domain.h" -#include "region.h" -#include "group.h" -#include "force.h" -#include "update.h" -#include "modify.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "region.h" +#include "update.h" + +#include +#include + #include "fix_shake.h" using namespace LAMMPS_NS; @@ -91,9 +93,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) error->all(FLERR,"Region ID for fix ehex does not exist"); - int n = strlen(arg[iarg+1]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[iarg+1]); + idregion = utils::strdup(arg[iarg+1]); iarg += 2; } diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index a29c8d9863..6fb2bd7a94 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -1202,9 +1202,7 @@ int FixRigidNH::modify_param(int narg, char **arg) tcomputeflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) @@ -1236,9 +1234,7 @@ int FixRigidNH::modify_param(int narg, char **arg) pcomputeflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index cfefe285f3..af2adb540d 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -1319,9 +1319,7 @@ int FixRigidNHSmall::modify_param(int narg, char **arg) tcomputeflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) @@ -1353,9 +1351,7 @@ int FixRigidNHSmall::modify_param(int narg, char **arg) pcomputeflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/RIGID/fix_rigid_nph.cpp b/src/RIGID/fix_rigid_nph.cpp index a2eb079f5c..77c42f0873 100644 --- a/src/RIGID/fix_rigid_nph.cpp +++ b/src/RIGID/fix_rigid_nph.cpp @@ -55,34 +55,15 @@ FixRigidNPH::FixRigidNPH(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press,id_temp)); pcomputeflag = 1; } diff --git a/src/RIGID/fix_rigid_nph_small.cpp b/src/RIGID/fix_rigid_nph_small.cpp index 414e408a9a..55c0f55379 100644 --- a/src/RIGID/fix_rigid_nph_small.cpp +++ b/src/RIGID/fix_rigid_nph_small.cpp @@ -58,34 +58,15 @@ FixRigidNPHSmall::FixRigidNPHSmall(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press,id_temp)); pcomputeflag = 1; } diff --git a/src/RIGID/fix_rigid_npt.cpp b/src/RIGID/fix_rigid_npt.cpp index e50b1a5045..59d7fa2764 100644 --- a/src/RIGID/fix_rigid_npt.cpp +++ b/src/RIGID/fix_rigid_npt.cpp @@ -65,34 +65,15 @@ FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press,id_temp)); pcomputeflag = 1; } diff --git a/src/RIGID/fix_rigid_npt_small.cpp b/src/RIGID/fix_rigid_npt_small.cpp index efb9c414f6..5b1ef61865 100644 --- a/src/RIGID/fix_rigid_npt_small.cpp +++ b/src/RIGID/fix_rigid_npt_small.cpp @@ -69,34 +69,15 @@ FixRigidNPTSmall::FixRigidNPTSmall(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press,id_temp)); pcomputeflag = 1; } diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 10ec0f0351..7a1efa064f 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -19,19 +19,20 @@ #include "fix_msst.h" -#include -#include #include "atom.h" -#include "force.h" #include "comm.h" -#include "modify.h" -#include "fix_external.h" #include "compute.h" -#include "kspace.h" -#include "update.h" #include "domain.h" -#include "memory.h" #include "error.h" +#include "fix_external.h" +#include "force.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -840,9 +841,7 @@ int FixMSST::modify_param(int narg, char **arg) tflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) @@ -864,9 +863,7 @@ int FixMSST::modify_param(int narg, char **arg) pflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(id_press); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 1fa7b77f6a..7467b7a293 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -12,15 +12,17 @@ ------------------------------------------------------------------------- */ #include "fix_nphug.h" -#include -#include -#include "modify.h" -#include "error.h" -#include "update.h" + #include "compute.h" -#include "force.h" #include "domain.h" +#include "error.h" +#include "force.h" #include "group.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -118,51 +120,22 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(std::string(id_temp)+" all temp"); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press,id_temp)); pcomputeflag = 1; // create a new compute potential energy compute - n = strlen(id) + 4; - id_pe = new char[n]; - strcpy(id_pe,id); - strcat(id_pe,"_pe"); - - newarg = new char*[3]; - newarg[0] = id_pe; - newarg[1] = (char*)"all"; - newarg[2] = (char*)"pe"; - modify->add_compute(3,newarg); - delete [] newarg; + id_pe = utils::strdup(std::string(id)+"_pe"); + modify->add_compute(std::string(id_pe)+" all pe"); peflag = 1; } diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp index 935365ce1b..620d0a47bd 100644 --- a/src/SPIN/fix_neb_spin.cpp +++ b/src/SPIN/fix_neb_spin.cpp @@ -23,18 +23,19 @@ #include "fix_neb_spin.h" -#include -#include -#include "universe.h" -#include "update.h" #include "atom.h" #include "comm.h" -#include "modify.h" #include "compute.h" -#include "group.h" -#include "memory.h" #include "error.h" #include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -120,17 +121,8 @@ FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) : // create a new compute pe style // id = fix-ID + pe, compute group = all - int n = strlen(id) + 4; - id_pe = new char[n]; - strcpy(id_pe,id); - strcat(id_pe,"_pe"); - - char **newarg = new char*[3]; - newarg[0] = id_pe; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pe"; - modify->add_compute(3,newarg); - delete [] newarg; + id_pe = utils::strdup(std::string(id)+"_pe"); + modify->add_compute(std::string(id_pe)+" all pe"); // initialize local storage From 31726f56e6b2605799144f9877b5f52ab803033f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 28 Mar 2021 13:12:39 -0400 Subject: [PATCH 156/370] refactor group2ndx and ndx2group commands to use fmtlib, tokenizer and utils --- src/USER-COLVARS/group_ndx.cpp | 189 ++++++++++++-------------- src/USER-COLVARS/group_ndx.h | 2 + src/USER-COLVARS/ndx_group.cpp | 233 ++++++++++++++------------------- src/USER-COLVARS/ndx_group.h | 3 +- src/group.cpp | 2 +- src/group.h | 2 +- 6 files changed, 187 insertions(+), 244 deletions(-) diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 96c3663ca0..995f60ac85 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -23,6 +23,8 @@ #include "error.h" #include "group.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- @@ -40,96 +42,6 @@ static int cmptagint(const void *p1, const void *p2) } } -/* ---------------------------------------------------------------------- - helper function. writes out one group to a gromacs style index file - ---------------------------------------------------------------------- */ - -static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me, - int np, MPI_Comm world, FILE *screen, FILE *logfile) -{ - char fmt[16]; - tagint *sendlist, *recvlist; - bigint num = group->count(gid); - int lnum, cols; - - if (me == 0) { - if (screen) fprintf(screen, " writing group %s... ", group->names[gid]); - if (logfile) fprintf(logfile, " writing group %s... ", group->names[gid]); - - // the "all" group in LAMMPS is called "System" in gromacs - if (gid == 0) { - fputs("[ System ]\n", fp); - } else { - fprintf(fp,"[ %s ]\n", group->names[gid]); - } - - // derive format string for index lists - bigint j = atom->natoms; - int i=0; - while (j > 0) { - ++i; - j /= 10; - } - snprintf(fmt,16,"%%%dd ", i); - cols = 80 / (i+1); - } - - if (num > 0) { - const int * const mask = atom->mask; - const tagint * const tag = atom->tag; - const int groupbit = group->bitmask[gid]; - const int nlocal = atom->nlocal; - int i; - - sendlist = new tagint[nlocal]; - recvlist = new tagint[num]; - lnum = 0; - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) sendlist[lnum++] = tag[i]; - - int nrecv,allrecv; - if (me == 0) { - MPI_Status status; - MPI_Request request; - - for (i=0; i < lnum; i++) - recvlist[i] = sendlist[i]; - - allrecv = lnum; - for (i=1; i < np; ++i) { - MPI_Irecv(recvlist+allrecv,num-allrecv,MPI_LMP_TAGINT,i,0, world,&request); - MPI_Send(&nrecv,0,MPI_INT,i,0,world); - MPI_Wait(&request,&status); - MPI_Get_count(&status,MPI_LMP_TAGINT,&nrecv); - allrecv += nrecv; - } - - // sort received list - qsort((void *)recvlist, num, sizeof(tagint), cmptagint); - } else { - MPI_Recv(&nrecv,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); - MPI_Rsend(sendlist,lnum,MPI_LMP_TAGINT,0,0,world); - } - delete [] sendlist; - } - - if (me == 0) { - int i, j; - for (i=0, j=0; i < num; ++i) { - fprintf(fp,fmt,recvlist[i]); - ++j; - if (j == cols) { - fputs("\n",fp); - j = 0; - } - } - if (j > 0) fputs("\n",fp); - if (screen) fputs("done\n",screen); - if (logfile) fputs("done\n",logfile); - } - if (num > 0) delete[] recvlist; -} - /* ---------------------------------------------------------------------- */ void Group2Ndx::command(int narg, char **arg) @@ -144,31 +56,100 @@ void Group2Ndx::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "w"); if (fp == nullptr) - error->one(FLERR,"Cannot open index file for writing"); - - if (screen) - fprintf(screen, "Writing groups to index file %s:\n",arg[0]); - if (logfile) - fprintf(logfile,"Writing groups to index file %s:\n",arg[0]); + error->one(FLERR,fmt::format("Cannot open index file for writing: {}", + utils::getsyserror())); + utils::logmesg(lmp,fmt::format("Writing groups to index file {}:\n",arg[0])); } if (narg == 1) { // write out all groups for (int i=0; i < group->ngroup; ++i) { - write_group(fp,i,atom,group,comm->me,comm->nprocs,world,screen,logfile); + write_group(fp,i); } - } else { // write only selected groups for (int i=1; i < narg; ++i) { int gid = group->find(arg[i]); if (gid < 0) error->all(FLERR, "Non-existing group requested"); - write_group(fp,gid,atom,group,comm->me,comm->nprocs,world,screen,logfile); + write_group(fp,gid); } } - if (comm->me == 0) { - if (screen) fputs("\n",screen); - if (logfile) fputs("\n",logfile); - fclose(fp); - } + if (comm->me == 0) fclose(fp); } +/* ---------------------------------------------------------------------- + write out one group to a Gromacs style index file + ---------------------------------------------------------------------- */ +void Group2Ndx::write_group(FILE *fp, int gid) +{ + tagint *sendlist, *recvlist; + bigint gcount = group->count(gid); + int lnum, width, cols; + + if (comm->me == 0) { + utils::logmesg(lmp,fmt::format(" writing group {}...",group->names[gid])); + + // the "all" group in LAMMPS is called "System" in Gromacs + if (gid == 0) { + fputs("[ System ]\n", fp); + } else { + fmt::print(fp,"[ {} ]\n", group->names[gid]); + } + width = log10((double) atom->natoms)+2; + cols = 80 / width; + } + + if (gcount > 0) { + const int * const mask = atom->mask; + const tagint * const tag = atom->tag; + const int groupbit = group->bitmask[gid]; + const int nlocal = atom->nlocal; + int i; + + sendlist = new tagint[nlocal]; + recvlist = new tagint[gcount]; + lnum = 0; + for (i = 0; i < nlocal; i++) + if (mask[i] & groupbit) sendlist[lnum++] = tag[i]; + + int nrecv=0; + bigint allrecv; + if (comm->me == 0) { + MPI_Status status; + MPI_Request request; + + for (i=0; i < lnum; i++) + recvlist[i] = sendlist[i]; + + allrecv = lnum; + for (i=1; i < comm->nprocs; ++i) { + MPI_Irecv(recvlist+allrecv,gcount-allrecv,MPI_LMP_TAGINT,i,0, world,&request); + MPI_Send(&nrecv,0,MPI_INT,i,0,world); // block rank "i" until we are ready to receive + MPI_Wait(&request,&status); + MPI_Get_count(&status,MPI_LMP_TAGINT,&nrecv); + allrecv += nrecv; + } + + // sort received list + qsort((void *)recvlist, allrecv, sizeof(tagint), cmptagint); + } else { + MPI_Recv(&nrecv,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); + MPI_Rsend(sendlist,lnum,MPI_LMP_TAGINT,0,0,world); + } + delete [] sendlist; + } + + if (comm->me == 0) { + int i, j; + for (i=0, j=0; i < gcount; ++i) { + fmt::print(fp,"{:>{}}",recvlist[i],width); + ++j; + if (j == cols) { + fputs("\n",fp); + j = 0; + } + } + if (j > 0) fputs("\n",fp); + utils::logmesg(lmp,"done\n"); + } + if (gcount > 0) delete[] recvlist; +} diff --git a/src/USER-COLVARS/group_ndx.h b/src/USER-COLVARS/group_ndx.h index 25c38dcf9f..fa15f0e82e 100644 --- a/src/USER-COLVARS/group_ndx.h +++ b/src/USER-COLVARS/group_ndx.h @@ -30,6 +30,8 @@ class Group2Ndx : protected Pointers { public: Group2Ndx(class LAMMPS *lmp) : Pointers(lmp) {}; void command(int, char **); + private: + void write_group(FILE *, int); }; } diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index bf1c5d060a..184faa62cc 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -22,64 +22,52 @@ #include "comm.h" #include "error.h" #include "group.h" +#include "memory.h" +#include "tokenizer.h" -#include +#include using namespace LAMMPS_NS; #define BUFLEN 4096 #define DELTA 16384 -static char *find_section(FILE *fp, const char *name) +// read file until next section "name" or any next section if name == "" + +static std::string find_section(FILE *fp, const std::string &name) { char linebuf[BUFLEN]; - char *n,*p,*t,*r; - while ((p = fgets(linebuf,BUFLEN,fp))) { - t = strtok(p," \t\n\r\f"); - if ((t != nullptr) && *t == '[') { - t = strtok(nullptr," \t\n\r\f"); - if (t != nullptr) { - n = t; - t = strtok(nullptr," \t\n\r\f"); - if ((t != nullptr) && *t == ']') { - if ((name == nullptr) || strcmp(name,n) == 0) { - int l = strlen(n); - r = new char[l+1]; - strncpy(r,n,l+1); - return r; - } - } - } - } + std::string pattern = "^\\s*\\[\\s+\\S+\\s+\\]\\s*$"; + if (!name.empty()) + pattern = fmt::format("^\\s*\\[\\s+{}\\s+\\]\\s*$",name); + + fgets(linebuf,BUFLEN,fp); + while (!feof(fp)) { + if (utils::strmatch(linebuf,pattern)) + return Tokenizer(linebuf).as_vector()[1]; + fgets(linebuf,BUFLEN,fp); } - return nullptr; + return ""; } -static tagint *read_section(FILE *fp, bigint &num) +static std::vector read_section(FILE *fp, std::string &name) { char linebuf[BUFLEN]; - char *p,*t; - tagint *tagbuf; - bigint nmax; + std::vector tagbuf; + std::string pattern = "^\\s*\\[\\s+\\S+\\s+\\]\\s*$"; - num = 0; - nmax = DELTA; - tagbuf = (tagint *)malloc(sizeof(tagint)*nmax); - - while ((p = fgets(linebuf,BUFLEN,fp))) { - t = strtok(p," \t\n\r\f"); - while (t != nullptr) { - // start of a new section. we are done here. - if (*t == '[') return tagbuf; - - tagbuf[num++] = ATOTAGINT(t); - if (num == nmax) { - nmax += DELTA; - tagbuf = (tagint *)realloc(tagbuf,sizeof(tagint)*nmax); - } - t = strtok(nullptr," \t\n\r\f"); + while (fgets(linebuf,BUFLEN,fp)) { + // start of new section. we are done, update "name" + if (utils::strmatch(linebuf,pattern)) { + name = Tokenizer(linebuf).as_vector()[1]; + return tagbuf; } + ValueTokenizer values(linebuf); + while (values.has_next()) + tagbuf.push_back(values.next_tagint()); } + // set empty name to indicate end of file + name = ""; return tagbuf; } @@ -90,151 +78,122 @@ void Ndx2Group::command(int narg, char **arg) int len; bigint num; FILE *fp; - char *name = nullptr; - tagint *tags; + tagint *tagbuf; + std::string name = "", next; if (narg < 1) error->all(FLERR,"Illegal ndx2group command"); - if (atom->tag_enable == 0) - error->all(FLERR,"Must have atom IDs for ndx2group command"); - + error->all(FLERR,"Must have atom IDs for ndx2group command"); if (comm->me == 0) { fp = fopen(arg[0], "r"); if (fp == nullptr) - error->one(FLERR,"Cannot open index file for reading"); - - if (screen) - fprintf(screen, "Reading groups from index file %s:\n",arg[0]); - if (logfile) - fprintf(logfile,"Reading groups from index file %s:\n",arg[0]); + error->one(FLERR,fmt::format("Cannot open index file for reading: {}", + utils::getsyserror())); + utils::logmesg(lmp,fmt::format("Reading groups from index file {}:\n",arg[0])); } - if (narg == 1) { // restore all groups + if (narg == 1) { // restore all groups - do { - if (comm->me == 0) { - len = 0; + if (comm->me == 0) { + name = find_section(fp,""); + while (!name.empty()) { - // find the next section. - // if we had processed a section, before we need to step back - if (name != nullptr) { - rewind(fp); - char *tmp = find_section(fp,name); - delete[] tmp; - delete[] name; - name = nullptr; + // skip over group "all", which is called "System" in gromacs + if (name == "System") { + name = find_section(fp,""); + continue; } - name = find_section(fp,nullptr); - if (name != nullptr) { - len=strlen(name)+1; - // skip over group "all", which is called "System" in gromacs - if (strcmp(name,"System") == 0) continue; - - if (screen) - fprintf(screen," Processing group '%s'\n",name); - if (logfile) - fprintf(logfile," Processing group '%s'\n",name); - } + utils::logmesg(lmp,fmt::format(" Processing group '{}'\n",name)); + len = name.size()+1; MPI_Bcast(&len,1,MPI_INT,0,world); - if (len > 0) { - MPI_Bcast(name,len,MPI_CHAR,0,world); + if (len > 1) { + MPI_Bcast((void *)name.c_str(),len,MPI_CHAR,0,world); // read tags for atoms in group and broadcast - num = 0; - tags = read_section(fp,num); + std::vector tags = read_section(fp,next); + num = tags.size(); MPI_Bcast(&num,1,MPI_LMP_BIGINT,0,world); - MPI_Bcast(tags,num,MPI_LMP_TAGINT,0,world); - create(name,num,tags); - free(tags); - } - } else { - MPI_Bcast(&len,1,MPI_INT,0,world); - if (len > 0) { - delete[] name; - name = new char[len]; - MPI_Bcast(name,len,MPI_CHAR,0,world); - - MPI_Bcast(&num,1,MPI_LMP_BIGINT,0,world); - tags = (tagint *)malloc(sizeof(tagint)*(num ? num : 1)); - MPI_Bcast(tags,num,MPI_LMP_TAGINT,0,world); - create(name,num,tags); - free(tags); + MPI_Bcast((void *)tags.data(),num,MPI_LMP_TAGINT,0,world); + create(name,tags); + name = next; } } - } while (len); + len = -1; + MPI_Bcast(&len,1,MPI_INT,0,world); + + } else { + + while (1) { + MPI_Bcast(&len,1,MPI_INT,0,world); + if (len < 0) break; + if (len > 1) { + char *buf = new char[len]; + MPI_Bcast(buf,len,MPI_CHAR,0,world); + MPI_Bcast(&num,1,MPI_LMP_BIGINT,0,world); + tagint *tbuf = new tagint[num]; + MPI_Bcast(tbuf,num,MPI_LMP_TAGINT,0,world); + create(buf,std::vector(tbuf,tbuf+num)); + delete[] buf; + delete[] tbuf; + } + } + } } else { // restore selected groups - for (int idx=1; idx < narg; ++idx) { + for (int idx=1; idx < narg; ++idx) { if (comm->me == 0) { - len = 0; // find named section, search from beginning of file - if (name != nullptr) delete[] name; rewind(fp); name = find_section(fp,arg[idx]); - if (name != nullptr) len=strlen(name)+1; - - if (screen) - fprintf(screen," %s group '%s'\n", - len ? "Processing" : "Skipping",arg[idx]); - if (logfile) - fprintf(logfile,"%s group '%s'\n", - len ? "Processing" : "Skipping",arg[idx]); - + utils::logmesg(lmp,fmt::format(" {} group '{}'\n", name.size() + ? "Processing" : "Skipping",arg[idx])); + len = name.size()+1; MPI_Bcast(&len,1,MPI_INT,0,world); - if (len > 0) { - MPI_Bcast(name,len,MPI_CHAR,0,world); + if (len > 1) { + MPI_Bcast((void *)name.c_str(),len,MPI_CHAR,0,world); + // read tags for atoms in group and broadcast - num = 0; - tags = read_section(fp,num); + std::vector tags = read_section(fp,name); + num = tags.size(); MPI_Bcast(&num,1,MPI_LMP_BIGINT,0,world); - MPI_Bcast(tags,num,MPI_LMP_TAGINT,0,world); - create(name,num,tags); - free(tags); + MPI_Bcast((void *)tags.data(),num,MPI_LMP_TAGINT,0,world); + create(name,tags); } } else { - MPI_Bcast(&len,1,MPI_INT,0,world); - if (len > 0) { - delete[] name; - name = new char[len]; - MPI_Bcast(name,len,MPI_CHAR,0,world); - + if (len > 1) { + char *buf = new char[len]; + MPI_Bcast(buf,len,MPI_CHAR,0,world); MPI_Bcast(&num,1,MPI_LMP_BIGINT,0,world); - tags = (tagint *)malloc(sizeof(tagint)*(num ? num : 1)); - MPI_Bcast(tags,num,MPI_LMP_TAGINT,0,world); - create(name,num,tags); - free(tags); + tagint *tbuf = new tagint[num]; + MPI_Bcast(tbuf,num,MPI_LMP_TAGINT,0,world); + create(buf,std::vector(tbuf,tbuf+num)); + delete[] buf; + delete[] tbuf; } } } } - - delete[] name; - if (comm->me == 0) { - if (screen) fputs("\n",screen); - if (logfile) fputs("\n",logfile); - fclose(fp); - } + if (comm->me == 0) fclose(fp); } /* ---------------------------------------------------------------------- */ -void Ndx2Group::create(char *name, bigint num, tagint *tags) +void Ndx2Group::create(const std::string &name, const std::vector &tags) { // wipe out all members if the group exists. gid==0 is group "all" int gid = group->find(name); - if (gid > 0) group->assign(std::string(name) + " clear"); + if (gid > 0) group->assign(name + " clear"); // map from global to local const int nlocal = atom->nlocal; int *flags = (int *)calloc(nlocal,sizeof(int)); - for (bigint i=0; i < num; ++i) { + for (bigint i=0; i < tags.size(); ++i) { const int id = atom->map(tags[i]); - if (id < nlocal && id >= 0) - flags[id] = 1; + if (id < nlocal && id >= 0) flags[id] = 1; } group->create(name,flags); free(flags); diff --git a/src/USER-COLVARS/ndx_group.h b/src/USER-COLVARS/ndx_group.h index cd3250a1d5..ceca1f9570 100644 --- a/src/USER-COLVARS/ndx_group.h +++ b/src/USER-COLVARS/ndx_group.h @@ -23,6 +23,7 @@ CommandStyle(ndx2group,Ndx2Group) #define LMP_NDX_GROUP_H #include "pointers.h" +#include namespace LAMMPS_NS { @@ -30,7 +31,7 @@ class Ndx2Group : protected Pointers { public: Ndx2Group(class LAMMPS *lmp) : Pointers(lmp) {}; void command(int, char **); - void create(char *, bigint, tagint *); + void create(const std::string &, const std::vector &); }; } diff --git a/src/group.cpp b/src/group.cpp index aa05ca6951..ebab78dd0f 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -553,7 +553,7 @@ void Group::assign(const std::string &groupcmd) add flagged atoms to a new or existing group ------------------------------------------------------------------------- */ -void Group::create(const char *name, int *flag) +void Group::create(const std::string &name, int *flag) { int i; diff --git a/src/group.h b/src/group.h index 0c5a18384c..37199712c5 100644 --- a/src/group.h +++ b/src/group.h @@ -32,7 +32,7 @@ class Group : protected Pointers { ~Group(); void assign(int, char **); // assign atoms to a group void assign(const std::string &); // convenience function - void create(const char *, int *); // add flagged atoms to a group + void create(const std::string &, int *); // add flagged atoms to a group int find(const std::string &); // lookup name in list of groups int find_or_create(const char *); // lookup name or create new group void write_restart(FILE *); From b32570c15ebbc0d03da0e03263888c96b15f2ce8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 28 Mar 2021 17:02:49 -0400 Subject: [PATCH 157/370] simplify by using utils::strdup() and reorder includes --- src/ASPHERE/fix_nph_asphere.cpp | 17 ++--- src/ASPHERE/fix_npt_asphere.cpp | 17 ++--- src/ASPHERE/fix_nve_asphere.cpp | 3 +- src/ASPHERE/fix_nvt_asphere.cpp | 13 ++-- src/BODY/fix_nph_body.cpp | 19 ++---- src/BODY/fix_npt_body.cpp | 19 ++---- src/BODY/fix_nvt_body.cpp | 13 ++-- src/GPU/fix_npt_gpu.cpp | 6 +- src/GPU/fix_nvt_gpu.cpp | 8 ++- src/KOKKOS/fix_nph_kokkos.cpp | 12 ++-- src/KOKKOS/fix_npt_kokkos.cpp | 12 ++-- src/KOKKOS/fix_nvt_kokkos.cpp | 2 +- src/MC/fix_bond_swap.cpp | 7 +- src/RIGID/fix_rigid_nph.cpp | 6 +- src/RIGID/fix_rigid_nph_small.cpp | 6 +- src/RIGID/fix_rigid_npt.cpp | 6 +- src/RIGID/fix_rigid_npt_small.cpp | 6 +- src/SHOCK/fix_nphug.cpp | 4 +- src/USER-BOCS/compute_pressure_bocs.cpp | 8 +-- src/USER-BOCS/fix_bocs.cpp | 43 +++--------- src/USER-DPD/fix_rx.cpp | 57 ++++------------ src/USER-DPD/pair_exp6_rx.cpp | 31 +++------ src/USER-DPD/pair_multi_lucy_rx.cpp | 9 +-- src/USER-DPD/pair_table_rx.cpp | 10 +-- src/USER-DRUDE/compute_temp_drude.cpp | 17 +++-- src/USER-DRUDE/fix_tgnh_drude.cpp | 32 +++++---- src/USER-DRUDE/fix_tgnpt_drude.cpp | 19 ++---- src/USER-DRUDE/fix_tgnvt_drude.cpp | 13 ++-- src/USER-EFF/compute_temp_region_eff.cpp | 17 +++-- src/USER-EFF/fix_nph_eff.cpp | 32 ++------- src/USER-EFF/fix_npt_eff.cpp | 32 ++------- src/USER-EFF/fix_nvt_eff.cpp | 21 ++---- src/USER-EFF/fix_nvt_sllod_eff.cpp | 32 ++++----- src/USER-EFF/fix_temp_rescale_eff.cpp | 29 +++----- src/USER-INTEL/fix_npt_intel.cpp | 36 +++------- src/USER-INTEL/fix_nvt_intel.cpp | 24 +++---- src/USER-INTEL/fix_nvt_sllod_intel.cpp | 15 +---- src/USER-LB/fix_lb_fluid.cpp | 24 +++---- src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp | 35 +--------- src/USER-MISC/fix_grem.cpp | 67 +++++-------------- src/USER-MISC/fix_npt_cauchy.cpp | 60 ++++++----------- src/USER-OMP/fix_nph_asphere_omp.cpp | 32 ++------- src/USER-OMP/fix_nph_omp.cpp | 12 ++-- src/USER-OMP/fix_nph_sphere_omp.cpp | 32 ++------- src/USER-OMP/fix_npt_asphere_omp.cpp | 32 ++------- src/USER-OMP/fix_npt_omp.cpp | 12 ++-- src/USER-OMP/fix_npt_sphere_omp.cpp | 32 ++------- src/USER-OMP/fix_nvt_asphere_omp.cpp | 15 +---- src/USER-OMP/fix_nvt_omp.cpp | 6 +- src/USER-OMP/fix_nvt_sllod_omp.cpp | 36 +++++----- src/USER-OMP/fix_nvt_sphere_omp.cpp | 19 ++---- src/USER-OMP/fix_rigid_nph_omp.cpp | 31 ++------- src/USER-OMP/fix_rigid_npt_omp.cpp | 33 ++------- src/USER-QTB/fix_qbmsst.cpp | 46 ++++--------- src/USER-UEF/fix_nh_uef.cpp | 54 ++++++--------- src/VORONOI/compute_voronoi_atom.cpp | 4 +- src/fix_box_relax.cpp | 31 ++++----- src/fix_nph.cpp | 19 ++---- src/fix_nph_sphere.cpp | 19 ++---- src/fix_npt.cpp | 19 ++---- src/fix_npt_sphere.cpp | 19 ++---- src/fix_nve.cpp | 12 ++-- src/fix_nvt.cpp | 12 +--- src/fix_nvt_sllod.cpp | 22 +++--- src/fix_nvt_sphere.cpp | 13 ++-- src/fix_press_berendsen.cpp | 31 ++++----- src/fix_temp_berendsen.cpp | 6 +- src/fix_temp_csld.cpp | 6 +- src/fix_temp_csvr.cpp | 6 +- src/fix_temp_rescale.cpp | 6 +- 70 files changed, 447 insertions(+), 1009 deletions(-) diff --git a/src/ASPHERE/fix_nph_asphere.cpp b/src/ASPHERE/fix_nph_asphere.cpp index 5231434a45..538e467133 100644 --- a/src/ASPHERE/fix_nph_asphere.cpp +++ b/src/ASPHERE/fix_nph_asphere.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_nph_asphere.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -36,21 +35,15 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - modify->add_compute(tcmd + " all temp/asphere"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/asphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp index 6492dfcde4..99909e5a2a 100644 --- a/src/ASPHERE/fix_npt_asphere.cpp +++ b/src/ASPHERE/fix_npt_asphere.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_npt_asphere.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,21 +34,15 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - modify->add_compute(tcmd + " all temp/asphere"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/asphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index 95fb89d5c9..62bb1db172 100644 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -16,10 +16,11 @@ ------------------------------------------------------------------------- */ #include "fix_nve_asphere.h" -#include "math_extra.h" + #include "atom.h" #include "atom_vec_ellipsoid.h" #include "error.h" +#include "math_extra.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp index 903d88f97a..ef6d97ec99 100644 --- a/src/ASPHERE/fix_nvt_asphere.cpp +++ b/src/ASPHERE/fix_nvt_asphere.cpp @@ -12,12 +12,10 @@ ------------------------------------------------------------------------- */ #include "fix_nvt_asphere.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" - using namespace LAMMPS_NS; using namespace FixConst; @@ -35,11 +33,8 @@ FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string cmd = id + std::string("_temp"); - id_temp = new char[cmd.size()+1]; - strcpy(id_temp,cmd.c_str()); - - cmd += fmt::format(" {} temp/asphere",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/asphere", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/BODY/fix_nph_body.cpp b/src/BODY/fix_nph_body.cpp index 1ebde47de6..a876ac9dc7 100644 --- a/src/BODY/fix_nph_body.cpp +++ b/src/BODY/fix_nph_body.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "fix_nph_body.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -41,22 +41,15 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += fmt::format(" {} temp/body",group->names[igroup]); - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/body",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/BODY/fix_npt_body.cpp b/src/BODY/fix_npt_body.cpp index adc5cd4587..bc669fc971 100644 --- a/src/BODY/fix_npt_body.cpp +++ b/src/BODY/fix_npt_body.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "fix_npt_body.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -41,22 +41,15 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += fmt::format(" {} temp/body",group->names[igroup]); - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/body",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/BODY/fix_nvt_body.cpp b/src/BODY/fix_nvt_body.cpp index a3884f330a..442aed2c94 100644 --- a/src/BODY/fix_nvt_body.cpp +++ b/src/BODY/fix_nvt_body.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "fix_nvt_body.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -39,11 +39,8 @@ FixNVTBody::FixNVTBody(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += fmt::format(" {} temp/body",group->names[igroup]); - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/body", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/GPU/fix_npt_gpu.cpp b/src/GPU/fix_npt_gpu.cpp index 3847f31a65..ce601548d4 100644 --- a/src/GPU/fix_npt_gpu.cpp +++ b/src/GPU/fix_npt_gpu.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_gpu.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,7 +35,7 @@ FixNPTGPU::FixNPTGPU(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/GPU/fix_nvt_gpu.cpp b/src/GPU/fix_nvt_gpu.cpp index 6858c26497..191039e343 100644 --- a/src/GPU/fix_nvt_gpu.cpp +++ b/src/GPU/fix_nvt_gpu.cpp @@ -11,11 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nvt_gpu.h" + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -33,7 +35,7 @@ FixNVTGPU::FixNVTGPU(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - id_temp = utils::strdup(std::string(id)+"_temp"); + id_temp = utils::strdup(std::string(id) + "_temp"); modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/KOKKOS/fix_nph_kokkos.cpp b/src/KOKKOS/fix_nph_kokkos.cpp index f679940eaf..e2c3bd8d14 100644 --- a/src/KOKKOS/fix_nph_kokkos.cpp +++ b/src/KOKKOS/fix_nph_kokkos.cpp @@ -16,8 +16,6 @@ #include "modify.h" #include "error.h" -#include - using namespace LAMMPS_NS; using namespace FixConst; @@ -38,17 +36,17 @@ FixNPHKokkos::FixNPHKokkos(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - this->id_temp = utils::strdup(std::string(this->id)+"_temp"); - this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); + this->id_temp = utils::strdup(std::string(this->id) + "_temp"); + this->modify->add_compute(fmt::format("{} all temp/kk",this->id_temp)); this->tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - this->id_press = utils::strdup(std::string(this->id)+"_press"); - this->modify->add_compute(std::string(this->id_press) - +" all pressure "+this->id_temp); + this->id_press = utils::strdup(std::string(this->id) + "_press"); + this->modify->add_compute(fmt::format("{} all pressure {}", + this->id_press, this->id_temp)); this->pcomputeflag = 1; } diff --git a/src/KOKKOS/fix_npt_kokkos.cpp b/src/KOKKOS/fix_npt_kokkos.cpp index baa47e026f..565703aa35 100644 --- a/src/KOKKOS/fix_npt_kokkos.cpp +++ b/src/KOKKOS/fix_npt_kokkos.cpp @@ -16,8 +16,6 @@ #include "modify.h" #include "error.h" -#include - using namespace LAMMPS_NS; using namespace FixConst; @@ -38,17 +36,17 @@ FixNPTKokkos::FixNPTKokkos(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - this->id_temp = utils::strdup(std::string(this->id)+"_temp"); - this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); + this->id_temp = utils::strdup(std::string(this->id) + "_temp"); + this->modify->add_compute(fmt::format("{} all temp/kk",this->id_temp)); this->tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - this->id_press = utils::strdup(std::string(this->id)+"_press"); - this->modify->add_compute(std::string(this->id_press) - +" all pressure "+this->id_temp); + this->id_press = utils::strdup(std::string(this->id) + "_press"); + this->modify->add_compute(fmt::format("{} all pressure {}", + this->id_press, this->id_temp)); this->pcomputeflag = 1; } diff --git a/src/KOKKOS/fix_nvt_kokkos.cpp b/src/KOKKOS/fix_nvt_kokkos.cpp index f589600dde..8eeffcb9f8 100644 --- a/src/KOKKOS/fix_nvt_kokkos.cpp +++ b/src/KOKKOS/fix_nvt_kokkos.cpp @@ -38,7 +38,7 @@ FixNVTKokkos::FixNVTKokkos(LAMMPS *lmp, int narg, char **arg) : // id = fix-ID + temp this->id_temp = utils::strdup(std::string(this->id)+"_temp"); - this->modify->add_compute(std::string(this->id_temp)+" all temp/kk"); + this->modify->add_compute(fmt::format("{} all temp/kk",this->id_temp)); this->tcomputeflag = 1; } diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 84d89a9626..1f3026888a 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -86,11 +86,8 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp, compute group = fix group - std::string cmd = id + std::string("_temp"); - id_temp = new char[cmd.size()+1]; - strcpy(id_temp,cmd.c_str()); - - modify->add_compute(cmd + " all temp"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tflag = 1; // initialize atom list diff --git a/src/RIGID/fix_rigid_nph.cpp b/src/RIGID/fix_rigid_nph.cpp index 77c42f0873..1c93df4599 100644 --- a/src/RIGID/fix_rigid_nph.cpp +++ b/src/RIGID/fix_rigid_nph.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nph.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -56,7 +56,7 @@ FixRigidNPH::FixRigidNPH(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/RIGID/fix_rigid_nph_small.cpp b/src/RIGID/fix_rigid_nph_small.cpp index 55c0f55379..ad5a48f1c2 100644 --- a/src/RIGID/fix_rigid_nph_small.cpp +++ b/src/RIGID/fix_rigid_nph_small.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nph_small.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -59,7 +59,7 @@ FixRigidNPHSmall::FixRigidNPHSmall(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/RIGID/fix_rigid_npt.cpp b/src/RIGID/fix_rigid_npt.cpp index 59d7fa2764..4f65929476 100644 --- a/src/RIGID/fix_rigid_npt.cpp +++ b/src/RIGID/fix_rigid_npt.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_npt.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -66,7 +66,7 @@ FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/RIGID/fix_rigid_npt_small.cpp b/src/RIGID/fix_rigid_npt_small.cpp index 5b1ef61865..6f7c025bc8 100644 --- a/src/RIGID/fix_rigid_npt_small.cpp +++ b/src/RIGID/fix_rigid_npt_small.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_npt_small.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -70,7 +70,7 @@ FixRigidNPTSmall::FixRigidNPTSmall(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 7467b7a293..20038c7df6 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -121,7 +121,7 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : // and thus its KE/temperature contribution should use group all id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style @@ -135,7 +135,7 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : // create a new compute potential energy compute id_pe = utils::strdup(std::string(id)+"_pe"); - modify->add_compute(std::string(id_pe)+" all pe"); + modify->add_compute(fmt::format("{} all pe",id_pe)); peflag = 1; } diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index a84442e658..43cf7efb8f 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -59,9 +59,7 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { - int n = strlen(arg[3]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[3]); + id_temp = utils::strdup(arg[3]); int icompute = modify->find_compute(id_temp); if (icompute < 0) @@ -446,7 +444,5 @@ void ComputePressureBocs::virial_compute(int n, int ndiag) void ComputePressureBocs::reset_extra_compute_fix(const char *id_new) { delete [] id_temp; - int n = strlen(id_new) + 1; - id_temp = new char[n]; - strcpy(id_temp,id_new); + id_temp = utils::strdup(id_new); } diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 28a0d6c01a..87d4653da5 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -16,11 +16,6 @@ #include "fix_bocs.h" -#include - -#include -#include - #include "atom.h" #include "citeme.h" #include "comm.h" @@ -29,7 +24,6 @@ #include "domain.h" #include "error.h" #include "fix_deform.h" - #include "force.h" #include "group.h" #include "irregular.h" @@ -40,6 +34,10 @@ #include "respa.h" #include "update.h" +#include +#include +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -70,7 +68,8 @@ const int NUM_INPUT_DATA_COLUMNS = 2; // columns in the pressure correction FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), + id_temp(nullptr), id_press(nullptr), eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), etap_mass(nullptr) @@ -403,38 +402,16 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id)+"_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "PRESSURE/BOCS"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id)+"_press"); + modify->add_compute(fmt::format("{} all PRESSURE/BOCS {}",id_press,id_temp)); pcomputeflag = 1; /*~ MRD End of stuff copied from fix_npt.cpp~*/ diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index c9d12506ab..675c3d6dea 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -257,7 +257,6 @@ void FixRX::post_constructor() bool match; char **tmpspecies = new char*[maxspecies]; - int tmpmaxstrlen = 0; for (int jj=0; jj < maxspecies; jj++) tmpspecies[jj] = nullptr; @@ -316,9 +315,7 @@ void FixRX::post_constructor() if (!match) { if (nUniqueSpecies+1>=maxspecies) error->all(FLERR,"Exceeded the maximum number of species permitted in fix rx."); - tmpspecies[nUniqueSpecies] = new char[strlen(word)+1]; - strcpy(tmpspecies[nUniqueSpecies],word); - tmpmaxstrlen = MAX(tmpmaxstrlen,(int)strlen(word)); + tmpspecies[nUniqueSpecies] = utils::strdup(word); nUniqueSpecies++; } word = strtok(nullptr, " \t\n\r\f"); @@ -335,61 +332,31 @@ void FixRX::post_constructor() id_fix_species = nullptr; id_fix_species_old = nullptr; - n = strlen(id) + strlen("_SPECIES") + 1; - id_fix_species = new char[n]; - n = strlen(id) + strlen("_SPECIES_OLD") + 1; - id_fix_species_old = new char[n]; + id_fix_species = utils::strdup(std::string(id)+"_SPECIES"); + id_fix_species_old = utils::strdup(std::string(id)+"_SPECIES_OLD"); - strcpy(id_fix_species,id); - strcat(id_fix_species,"_SPECIES"); - strcpy(id_fix_species_old,id); - strcat(id_fix_species_old,"_SPECIES_OLD"); - - char **newarg = new char*[nspecies+5]; - char **newarg2 = new char*[nspecies+5]; - newarg[0] = id_fix_species; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "property/atom"; - newarg2[0] = id_fix_species_old; - newarg2[1] = group->names[igroup]; - newarg2[2] = (char *) "property/atom"; - char *str1 = new char[tmpmaxstrlen+3]; - char *str2 = new char[tmpmaxstrlen+6]; + const std::string fmtstr = "{} {} property/atom "; + auto newcmd1 = fmt::format(fmtstr,id_fix_species,group->names[igroup]); + auto newcmd2 = fmt::format(fmtstr,id_fix_species_old,group->names[igroup]); for (int ii=0; iiadd_fix(nspecies+5,newarg,1); + modify->add_fix(newcmd1); fix_species = (FixPropertyAtom *) modify->fix[modify->nfix-1]; restartFlag = modify->fix[modify->nfix-1]->restart_reset; - modify->add_fix(nspecies+5,newarg2,1); + modify->add_fix(newcmd2); fix_species_old = (FixPropertyAtom *) modify->fix[modify->nfix-1]; if (nspecies==0) error->all(FLERR,"There are no rx species specified."); for (int jj=0;jjall(FLERR,"There are no rx species specified."); read_file(arg[2]); - n = strlen(arg[3]) + 1; - site1 = new char[n]; - strcpy(site1,arg[3]); + site1 = utils::strdup(arg[3]); int ispecies; for (ispecies = 0; ispecies < nspecies; ispecies++) { @@ -607,9 +605,7 @@ void PairExp6rx::coeff(int narg, char **arg) if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) error->all(FLERR,"Site1 name not recognized in pair coefficients"); - n = strlen(arg[4]) + 1; - site2 = new char[n]; - strcpy(site2,arg[4]); + site2 = utils::strdup(arg[4]); for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; @@ -806,17 +802,12 @@ void PairExp6rx::read_file(char *file) params[nparams].ispecies = ispecies; - n = strlen(&atom->dname[ispecies][0]) + 1; - params[nparams].name = new char[n]; - strcpy(params[nparams].name,&atom->dname[ispecies][0]); - - n = strlen(words[1]) + 1; - params[nparams].potential = new char[n]; - strcpy(params[nparams].potential,words[1]); + params[nparams].name = utils::strdup(&atom->dname[ispecies][0]); + params[nparams].potential = utils::strdup(words[1]); if (strcmp(params[nparams].potential,"exp6") == 0) { - params[nparams].alpha = atof(words[2]); - params[nparams].epsilon = atof(words[3]); - params[nparams].rm = atof(words[4]); + params[nparams].alpha = utils::numeric(FLERR,words[2],false,lmp); + params[nparams].epsilon = utils::numeric(FLERR,words[3],false,lmp); + params[nparams].rm = utils::numeric(FLERR,words[4],false,lmp); if (params[nparams].epsilon <= 0.0 || params[nparams].rm <= 0.0 || params[nparams].alpha < 0.0) error->all(FLERR,"Illegal exp6/rx parameters. Rm and Epsilon must be greater than zero. Alpha cannot be negative."); @@ -842,11 +833,9 @@ void PairExp6rx::read_file2(char *file) fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == nullptr) { - char str[128]; - snprintf(str,128,"Cannot open polynomial file %s",file); - error->one(FLERR,str); - } + if (fp == nullptr) + error->one(FLERR,fmt::format("Cannot open polynomial file {}: {}", + file,utils::getsyserror())); } // one set of params can span multiple lines diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index bd720ae138..c0f6af8a7e 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -387,14 +387,9 @@ void PairMultiLucyRX::coeff(int narg, char **arg) bcast_table(tb); nspecies = atom->nspecies_dpd; - int n; - n = strlen(arg[4]) + 1; - site1 = new char[n]; - strcpy(site1,arg[4]); - n = strlen(arg[5]) + 1; - site2 = new char[n]; - strcpy(site2,arg[5]); + site1 = utils::strdup(arg[4]); + site2 = utils::strdup(arg[5]); // set table cutoff diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index cefbe5a73d..85879d11fa 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -322,10 +322,8 @@ void PairTableRX::coeff(int narg, char **arg) nspecies = atom->nspecies_dpd; if (nspecies==0) error->all(FLERR,"There are no rx species specified."); - int n; - n = strlen(arg[4]) + 1; - site1 = new char[n]; - strcpy(site1,arg[4]); + + site1 = utils::strdup(arg[4]); int ispecies; for (ispecies = 0; ispecies < nspecies; ispecies++) { @@ -334,9 +332,7 @@ void PairTableRX::coeff(int narg, char **arg) if (ispecies == nspecies && strcmp(site1,"1fluid") != 0) error->all(FLERR,"Site1 name not recognized in pair coefficients"); - n = strlen(arg[5]) + 1; - site2 = new char[n]; - strcpy(site2,arg[5]); + site2 = utils::strdup(arg[5]); for (ispecies = 0; ispecies < nspecies; ispecies++) { if (strcmp(site2,&atom->dname[ispecies][0]) == 0) break; diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index fe75c10fe3..4325c9d6ae 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -13,15 +13,16 @@ #include "compute_temp_drude.h" -#include #include "atom.h" -#include "update.h" -#include "force.h" -#include "modify.h" -#include "fix_drude.h" +#include "comm.h" #include "domain.h" #include "error.h" -#include "comm.h" +#include "fix_drude.h" +#include "force.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -116,9 +117,7 @@ int ComputeTempDrude::modify_param(int narg, char **arg) if (strcmp(arg[0],"temp") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) diff --git a/src/USER-DRUDE/fix_tgnh_drude.cpp b/src/USER-DRUDE/fix_tgnh_drude.cpp index 8185b9bcbb..49a4061878 100644 --- a/src/USER-DRUDE/fix_tgnh_drude.cpp +++ b/src/USER-DRUDE/fix_tgnh_drude.cpp @@ -16,23 +16,25 @@ ---------------------------------------------------------------------------------------- */ #include "fix_tgnh_drude.h" -#include -#include + #include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "fix_deform.h" #include "force.h" #include "group.h" -#include "comm.h" -#include "neighbor.h" #include "irregular.h" -#include "modify.h" -#include "fix_deform.h" -#include "compute.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "domain.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -1428,9 +1430,7 @@ int FixTGNHDrude::modify_param(int narg, char **arg) tcomputeflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) @@ -1462,9 +1462,7 @@ int FixTGNHDrude::modify_param(int narg, char **arg) pcomputeflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/USER-DRUDE/fix_tgnpt_drude.cpp b/src/USER-DRUDE/fix_tgnpt_drude.cpp index 987af367c3..301e0aa029 100644 --- a/src/USER-DRUDE/fix_tgnpt_drude.cpp +++ b/src/USER-DRUDE/fix_tgnpt_drude.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_tgnpt_drude.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,23 +34,15 @@ FixTGNPTDrude::FixTGNPTDrude(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp, tcmd.c_str()); - - tcmd += " all temp"; - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press, pcmd.c_str()); - - pcmd += " all pressure " + std::string(id_temp); - modify->add_compute(pcmd); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-DRUDE/fix_tgnvt_drude.cpp b/src/USER-DRUDE/fix_tgnvt_drude.cpp index bd6809aaed..2339a6f9a7 100644 --- a/src/USER-DRUDE/fix_tgnvt_drude.cpp +++ b/src/USER-DRUDE/fix_tgnvt_drude.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_tgnvt_drude.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -34,11 +35,7 @@ FixTGNVTDrude::FixTGNVTDrude(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp, tcmd.c_str()); - - tcmd += fmt::format(" {} temp", group->names[igroup]); - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index 1ca62f39d3..ca13aac06b 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -16,17 +16,18 @@ ------------------------------------------------------------------------- */ -#include - #include "compute_temp_region_eff.h" + #include "atom.h" -#include "update.h" -#include "force.h" #include "domain.h" -#include "region.h" +#include "error.h" +#include "force.h" #include "group.h" #include "memory.h" -#include "error.h" +#include "region.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -43,9 +44,7 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : iregion = domain->find_region(arg[3]); if (iregion == -1) error->all(FLERR,"Region ID for compute temp/region/eff does not exist"); - int n = strlen(arg[3]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[3]); + idregion = utils::strdup(arg[3]); scalar_flag = vector_flag = 1; size_vector = 6; diff --git a/src/USER-EFF/fix_nph_eff.cpp b/src/USER-EFF/fix_nph_eff.cpp index 2478211c77..1e9871da02 100644 --- a/src/USER-EFF/fix_nph_eff.cpp +++ b/src/USER-EFF/fix_nph_eff.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nph_eff.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/eff"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/eff",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-EFF/fix_npt_eff.cpp b/src/USER-EFF/fix_npt_eff.cpp index 98b76b1b43..4612810c02 100644 --- a/src/USER-EFF/fix_npt_eff.cpp +++ b/src/USER-EFF/fix_npt_eff.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_eff.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/eff"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/eff",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-EFF/fix_nvt_eff.cpp b/src/USER-EFF/fix_nvt_eff.cpp index 8f37cbf2b1..f5358b5db1 100644 --- a/src/USER-EFF/fix_nvt_eff.cpp +++ b/src/USER-EFF/fix_nvt_eff.cpp @@ -11,11 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nvt_eff.h" + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -33,17 +35,8 @@ FixNVTEff::FixNVTEff(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/eff"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/eff", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-EFF/fix_nvt_sllod_eff.cpp b/src/USER-EFF/fix_nvt_sllod_eff.cpp index b5d40251bf..36a5cbb8ab 100644 --- a/src/USER-EFF/fix_nvt_sllod_eff.cpp +++ b/src/USER-EFF/fix_nvt_sllod_eff.cpp @@ -11,19 +11,20 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include - #include "fix_nvt_sllod_eff.h" -#include "math_extra.h" + #include "atom.h" +#include "compute.h" #include "domain.h" -#include "group.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_deform.h" -#include "compute.h" -#include "error.h" +#include "group.h" +#include "math_extra.h" +#include "modify.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -45,18 +46,9 @@ FixNVTSllodEff::FixNVTSllodEff(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/deform/eff"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} tmp/deform/eff", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-EFF/fix_temp_rescale_eff.cpp b/src/USER-EFF/fix_temp_rescale_eff.cpp index f796c7cb02..1ebed8b9ff 100644 --- a/src/USER-EFF/fix_temp_rescale_eff.cpp +++ b/src/USER-EFF/fix_temp_rescale_eff.cpp @@ -15,18 +15,19 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include - -#include #include "fix_temp_rescale_eff.h" + #include "atom.h" -#include "force.h" -#include "group.h" -#include "update.h" #include "comm.h" -#include "modify.h" #include "compute.h" #include "error.h" +#include "force.h" +#include "group.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -56,17 +57,9 @@ FixTempRescaleEff::FixTempRescaleEff(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp/eff // id = fix-ID + temp, compute group = fix group - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[6]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/eff"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/eff", + id_temp,group->names[igroup])); tflag = 1; energy = 0.0; diff --git a/src/USER-INTEL/fix_npt_intel.cpp b/src/USER-INTEL/fix_npt_intel.cpp index 4d69e80515..3f48130f99 100644 --- a/src/USER-INTEL/fix_npt_intel.cpp +++ b/src/USER-INTEL/fix_npt_intel.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_intel.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -25,44 +25,24 @@ FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) : FixNHIntel(lmp, narg, arg) { if (!tstat_flag) - error->all(FLERR,"Temperature control must be used with fix npt/omp"); + error->all(FLERR,"Temperature control must be used with fix npt/intel"); if (!pstat_flag) - error->all(FLERR,"Pressure control must be used with fix npt/omp"); + error->all(FLERR,"Pressure control must be used with fix npt/intl"); // create a new compute temp style // id = fix-ID + temp // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-INTEL/fix_nvt_intel.cpp b/src/USER-INTEL/fix_nvt_intel.cpp index b9ceea4c71..61259fba2f 100644 --- a/src/USER-INTEL/fix_nvt_intel.cpp +++ b/src/USER-INTEL/fix_nvt_intel.cpp @@ -11,11 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nvt_intel.h" + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -26,25 +28,15 @@ FixNVTIntel::FixNVTIntel(LAMMPS *lmp, int narg, char **arg) : FixNHIntel(lmp, narg, arg) { if (!tstat_flag) - error->all(FLERR,"Temperature control must be used with fix nvt"); + error->all(FLERR,"Temperature control must be used with fix nvt/intel"); if (pstat_flag) - error->all(FLERR,"Pressure control can not be used with fix nvt"); + error->all(FLERR,"Pressure control can not be used with fix nvt/intel"); // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-INTEL/fix_nvt_sllod_intel.cpp b/src/USER-INTEL/fix_nvt_sllod_intel.cpp index 3880adc055..efe124cb2d 100644 --- a/src/USER-INTEL/fix_nvt_sllod_intel.cpp +++ b/src/USER-INTEL/fix_nvt_sllod_intel.cpp @@ -46,18 +46,9 @@ FixNVTSllodIntel::FixNVTSllodIntel(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/deform"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/deform", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index 351e078dad..dafd5d2a3a 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -17,22 +17,22 @@ ------------------------------------------------------------------------- */ #include "fix_lb_fluid.h" + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "update.h" + #include - - #include #include #include -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "domain.h" -#include "atom.h" -#include "group.h" -#include "random_mars.h" -#include "update.h" -#include "force.h" -#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp index 310dae8725..844f99b725 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -131,24 +131,10 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, } // Create temperature compute: - const char *fix_id = arg[1]; - int n = strlen(fix_id)+6; - id_temp = new char[n]; - strcpy(id_temp,fix_id); - strcat(id_temp,"_temp"); - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char*) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); int icompute = modify->find_compute(id_temp); - if (icompute < 0) { - error->all(FLERR,"Temperature ID for fix nvt/manifold/rattle " - "does not exist"); - } temperature = modify->compute[icompute]; if (temperature->tempbias) which = BIAS; else which = NOBIAS; @@ -167,8 +153,6 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, for (int ich = 0; ich < mtchain; ++ich) { eta[ich] = eta_dot[ich] = eta_dotdot[ich] = 0.0; } - - } /* ---------------------------------------------------------------------- */ @@ -185,9 +169,6 @@ FixNVTManifoldRattle::~FixNVTManifoldRattle() if (id_temp) delete[] id_temp; } - - - int FixNVTManifoldRattle::setmask() { int mask = 0; @@ -198,7 +179,6 @@ int FixNVTManifoldRattle::setmask() return mask; } - /* -------------------------------------------------------------------------- Check that force modification happens before position and velocity update. Make sure respa is not used. @@ -219,8 +199,6 @@ void FixNVTManifoldRattle::init() } - - void FixNVTManifoldRattle::setup(int /*vflag*/) { compute_temp_target(); @@ -359,9 +337,6 @@ void FixNVTManifoldRattle::nh_v_temp() } } - - - // Most of this logic is based on fix_nh: void FixNVTManifoldRattle::initial_integrate(int /*vflag*/) { @@ -381,8 +356,6 @@ void FixNVTManifoldRattle::final_integrate() nhc_temp_integrate(); } - - /* ---------------------------------------------------------------------- */ void FixNVTManifoldRattle::reset_dt() { @@ -395,10 +368,6 @@ void FixNVTManifoldRattle::reset_dt() } - - - - double FixNVTManifoldRattle::memory_usage() { double bytes = FixNVEManifoldRattle::memory_usage(); diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index b1f1bded85..64c7e4a6b7 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -23,14 +23,16 @@ ------------------------------------------------------------------------- */ #include "fix_grem.h" -#include + #include "atom.h" -#include "force.h" -#include "update.h" -#include "modify.h" -#include "domain.h" #include "compute.h" +#include "domain.h" #include "error.h" +#include "force.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -65,65 +67,28 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[5]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "PRESSURE/GREM"; - newarg[3] = id_temp; - newarg[4] = id; - modify->add_compute(5,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all PRESSURE/GREM {}", + id_press, id_temp)); // create a new compute ke style // id = fix-ID + ke - n = strlen(id) + 8; - id_ke = new char[n]; - strcpy(id_ke,id); - strcat(id_ke,"_ke"); - - newarg = new char*[3]; - newarg[0] = id_ke; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "ke"; - modify->add_compute(3,newarg); - delete [] newarg; + id_ke = utils::strdup(std::string(id) + "_ke"); + modify->add_compute(fmt::format("{} all ke",id_temp)); // create a new compute pe style // id = fix-ID + pe - n = strlen(id) + 9; - id_pe = new char[n]; - strcpy(id_pe,id); - strcat(id_pe,"_pe"); - - newarg = new char*[3]; - newarg[0] = id_pe; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pe"; - modify->add_compute(3,newarg); - delete [] newarg; + id_pe = utils::strdup(std::string(id) + "_pe"); + modify->add_compute(fmt::format("{} all pe",id_temp)); int ifix = modify->find_fix(id_nh); if (ifix < 0) diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 5d51114262..37d6e5286b 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -15,27 +15,28 @@ Contributing authors: ------------------------------------------------------------------------- */ -#include - -#include #include "fix_npt_cauchy.h" -#include "math_extra.h" + #include "atom.h" -#include "force.h" -#include "group.h" #include "comm.h" -#include "neighbor.h" -#include "irregular.h" -#include "modify.h" +#include "compute.h" +#include "domain.h" +#include "error.h" #include "fix_deform.h" #include "fix_store.h" -#include "compute.h" +#include "force.h" +#include "group.h" +#include "irregular.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "domain.h" +#include "math_extra.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -53,7 +54,8 @@ enum{ISO,ANISO,TRICLINIC}; FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), + id_temp(nullptr), id_press(nullptr), eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), etap_mass(nullptr), id_store(nullptr),init_store(nullptr) @@ -604,36 +606,16 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nph_asphere_omp.cpp b/src/USER-OMP/fix_nph_asphere_omp.cpp index 4f20d9657c..eeeb4ef2ea 100644 --- a/src/USER-OMP/fix_nph_asphere_omp.cpp +++ b/src/USER-OMP/fix_nph_asphere_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nph_asphere_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/asphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/asphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nph_omp.cpp b/src/USER-OMP/fix_nph_omp.cpp index 8c2f9ed3a3..733600b4bf 100644 --- a/src/USER-OMP/fix_nph_omp.cpp +++ b/src/USER-OMP/fix_nph_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nph_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,15 +34,15 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - id_press = utils::strdup(std::string(id)+"_press"); - modify->add_compute(std::string(id_press)+" all pressure "+id_temp); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nph_sphere_omp.cpp b/src/USER-OMP/fix_nph_sphere_omp.cpp index 0e2a805dcf..35387b51f2 100644 --- a/src/USER-OMP/fix_nph_sphere_omp.cpp +++ b/src/USER-OMP/fix_nph_sphere_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nph_sphere_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/sphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_npt_asphere_omp.cpp b/src/USER-OMP/fix_npt_asphere_omp.cpp index c05fca9043..e896db8712 100644 --- a/src/USER-OMP/fix_npt_asphere_omp.cpp +++ b/src/USER-OMP/fix_npt_asphere_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_asphere_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/asphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/asphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_npt_omp.cpp b/src/USER-OMP/fix_npt_omp.cpp index 4037dd928e..386be81acc 100644 --- a/src/USER-OMP/fix_npt_omp.cpp +++ b/src/USER-OMP/fix_npt_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,15 +34,15 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - id_temp = utils::strdup(std::string(id)+"_temp"); - modify->add_compute(std::string(id_temp)+" all temp"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - id_press = utils::strdup(std::string(id)+"_press"); - modify->add_compute(std::string(id_press)+" all pressure "+id_temp); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_npt_sphere_omp.cpp b/src/USER-OMP/fix_npt_sphere_omp.cpp index 93b6cdda69..4e40fb63d5 100644 --- a/src/USER-OMP/fix_npt_sphere_omp.cpp +++ b/src/USER-OMP/fix_npt_sphere_omp.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_npt_sphere_omp.h" -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -34,35 +34,15 @@ FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/sphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nvt_asphere_omp.cpp b/src/USER-OMP/fix_nvt_asphere_omp.cpp index 353d839b4f..c8db9cc98d 100644 --- a/src/USER-OMP/fix_nvt_asphere_omp.cpp +++ b/src/USER-OMP/fix_nvt_asphere_omp.cpp @@ -33,17 +33,8 @@ FixNVTAsphereOMP::FixNVTAsphereOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/asphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/asphere", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-OMP/fix_nvt_omp.cpp b/src/USER-OMP/fix_nvt_omp.cpp index 127876b4e8..240825b2c6 100644 --- a/src/USER-OMP/fix_nvt_omp.cpp +++ b/src/USER-OMP/fix_nvt_omp.cpp @@ -11,11 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nvt_omp.h" + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-OMP/fix_nvt_sllod_omp.cpp b/src/USER-OMP/fix_nvt_sllod_omp.cpp index a665241efb..3193d58386 100644 --- a/src/USER-OMP/fix_nvt_sllod_omp.cpp +++ b/src/USER-OMP/fix_nvt_sllod_omp.cpp @@ -15,18 +15,21 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_nvt_sllod_omp.h" -#include -#include "math_extra.h" + #include "atom.h" -#include "group.h" -#include "modify.h" +#include "compute.h" +#include "domain.h" +#include "error.h" #include "fix.h" #include "fix_deform.h" -#include "compute.h" -#include "error.h" -#include "domain.h" +#include "group.h" +#include "math_extra.h" +#include "modify.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -51,18 +54,9 @@ FixNVTSllodOMP::FixNVTSllodOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/deform"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/deform", + id_temp,group->names[igroup])); tcomputeflag = 1; } @@ -82,7 +76,7 @@ void FixNVTSllodOMP::init() int i; for (i = 0; i < modify->nfix; i++) - if (strncmp(modify->fix[i]->style,"deform",6) == 0) { + if (utils::strmatch(modify->fix[i]->style,"^deform")) { if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix " "deform remap option"); diff --git a/src/USER-OMP/fix_nvt_sphere_omp.cpp b/src/USER-OMP/fix_nvt_sphere_omp.cpp index 680ddd7f17..d53d9ec32d 100644 --- a/src/USER-OMP/fix_nvt_sphere_omp.cpp +++ b/src/USER-OMP/fix_nvt_sphere_omp.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "fix_nvt_sphere_omp.h" + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -33,17 +33,8 @@ FixNVTSphereOMP::FixNVTSphereOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "temp/sphere"; - - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/sphere", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/USER-OMP/fix_rigid_nph_omp.cpp b/src/USER-OMP/fix_rigid_nph_omp.cpp index cb59ad0828..80bfbe8141 100644 --- a/src/USER-OMP/fix_rigid_nph_omp.cpp +++ b/src/USER-OMP/fix_rigid_nph_omp.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nph_omp.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -57,34 +57,15 @@ FixRigidNPHOMP::FixRigidNPHOMP(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-OMP/fix_rigid_npt_omp.cpp b/src/USER-OMP/fix_rigid_npt_omp.cpp index f496dd0a11..f832dda618 100644 --- a/src/USER-OMP/fix_rigid_npt_omp.cpp +++ b/src/USER-OMP/fix_rigid_npt_omp.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_npt_omp.h" -#include -#include "modify.h" + #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; @@ -67,36 +67,17 @@ FixRigidNPTOMP::FixRigidNPTOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp // compute group = all since pressure is always global (group all) - // and thus its KE/temperature contribution should use group all + // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index b221ecbca8..0b54811db0 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -18,9 +18,6 @@ #include "fix_qbmsst.h" -#include -#include - #include "atom.h" #include "force.h" #include "update.h" @@ -34,6 +31,9 @@ #include "kspace.h" #include "math_const.h" +#include +#include + using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -204,45 +204,23 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // id = fix-ID + temp // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = const_cast("all"); - newarg[2] = const_cast("temp"); - modify->add_compute(3,newarg); - delete [] newarg; + + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = const_cast("all"); - newarg[2] = const_cast("pressure"); - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pflag = 1; // create a new compute potential energy compute - n = strlen(id) + 3; - id_pe = new char[n]; - strcpy(id_pe,id); - strcat(id_pe,"_pe"); - newarg = new char*[3]; - newarg[0] = id_pe; - newarg[1] = (char*)"all"; - newarg[2] = (char*)"pe"; - modify->add_compute(3,newarg); - delete [] newarg; + + id_pe = utils::strdup(std::string(id) + "_pe"); + modify->add_compute(fmt::format("{} all pe",id_temp)); peflag = 1; // allocate qbmsst diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index b757900703..91125fd4ed 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -14,24 +14,26 @@ ------------------------------------------------------------------------- */ #include "fix_nh_uef.h" -#include -#include + #include "atom.h" -#include "force.h" -#include "comm.h" #include "citeme.h" -#include "irregular.h" -#include "modify.h" +#include "comm.h" #include "compute.h" -#include "update.h" -#include "domain.h" -#include "error.h" -#include "output.h" -#include "timer.h" -#include "neighbor.h" #include "compute_pressure_uef.h" #include "compute_temp_uef.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "irregular.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "timer.h" #include "uef_utils.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -179,29 +181,12 @@ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : // Create temp and pressure computes for nh/uef - int n = strlen(id) + 6; - id_temp = new char[n]; - strcpy(id_temp,id); - strcat(id_temp,"_temp"); - char **newarg = new char*[3]; - newarg[0] = id_temp; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp/uef"; - modify->add_compute(3,newarg); - delete [] newarg; + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/uef",id_temp)); tcomputeflag = 1; - n = strlen(id) + 7; - id_press = new char[n]; - strcpy(id_press,id); - strcat(id_press,"_press"); - newarg = new char*[4]; - newarg[0] = id_press; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure/uef"; - newarg[3] = id_temp; - modify->add_compute(4,newarg); - delete [] newarg; + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure/uef {}",id_press, id_temp)); pcomputeflag = 1; nevery = 1; @@ -214,8 +199,7 @@ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : FixNHUef::~FixNHUef() { delete uefbox; - if (pcomputeflag && !pstat_flag) - { + if (pcomputeflag && !pstat_flag) { modify->delete_compute(id_press); delete [] id_press; } diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index bcd9031b6e..d9cd746ca6 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -80,9 +80,7 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg], "radius") == 0) { if (iarg + 2 > narg || strstr(arg[iarg+1],"v_") != arg[iarg+1] ) error->all(FLERR,"Illegal compute voronoi/atom command"); - int n = strlen(&arg[iarg+1][2]) + 1; - radstr = new char[n]; - strcpy(radstr,&arg[iarg+1][2]); + radstr = utils::strdup(&arg[iarg+1][2]); iarg += 2; } else if (strcmp(arg[iarg], "surface") == 0) { diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index ef576e96f6..76bd8f05c2 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -16,20 +16,20 @@ ------------------------------------------------------------------------- */ #include "fix_box_relax.h" -#include -#include #include "atom.h" -#include "domain.h" -#include "update.h" #include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "modify.h" -#include "compute.h" -#include "error.h" #include "math_extra.h" +#include "modify.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -319,24 +319,17 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += " all temp"; - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tflag = 1; // create a new compute pressure style (virial only) // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - pcmd += " all pressure " + std::string(id_temp) + " virial"; - modify->add_compute(pcmd); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {} virial", + id_press, id_temp)); pflag = 1; dimension = domain->dimension; diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index 6002d2e40d..5b160689dd 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_nph.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,23 +34,15 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += " all temp"; - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - pcmd += " all pressure " + std::string(id_temp); - modify->add_compute(pcmd); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/fix_nph_sphere.cpp b/src/fix_nph_sphere.cpp index 27197c48a7..20e072d5b5 100644 --- a/src/fix_nph_sphere.cpp +++ b/src/fix_nph_sphere.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "fix_nph_sphere.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -35,21 +36,15 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - modify->add_compute(tcmd + " all temp/sphere"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/fix_npt.cpp b/src/fix_npt.cpp index 7ee346985d..78acf0cf7e 100644 --- a/src/fix_npt.cpp +++ b/src/fix_npt.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_npt.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -35,23 +34,15 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += " all temp"; - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - pcmd += " all pressure " + std::string(id_temp); - modify->add_compute(pcmd); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/fix_npt_sphere.cpp b/src/fix_npt_sphere.cpp index b806cf5362..a6dfeba425 100644 --- a/src/fix_npt_sphere.cpp +++ b/src/fix_npt_sphere.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "fix_npt_sphere.h" -#include -#include "modify.h" #include "error.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -35,21 +36,15 @@ FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - modify->add_compute(tcmd + " all temp/sphere"); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp/sphere",id_temp)); tcomputeflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - modify->add_compute(pcmd + " all pressure " + std::string(id_temp)); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pcomputeflag = 1; } diff --git a/src/fix_nve.cpp b/src/fix_nve.cpp index 23f69abc86..e14ff47e46 100644 --- a/src/fix_nve.cpp +++ b/src/fix_nve.cpp @@ -12,12 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_nve.h" -#include + #include "atom.h" -#include "force.h" -#include "update.h" -#include "respa.h" #include "error.h" +#include "force.h" +#include "respa.h" +#include "update.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -27,7 +27,7 @@ using namespace FixConst; FixNVE::FixNVE(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (strcmp(style,"nve/sphere") != 0 && narg < 3) + if (!utils::strmatch(style,"^nve/sphere") && narg < 3) error->all(FLERR,"Illegal fix nve command"); dynamic_group_allow = 1; @@ -53,7 +53,7 @@ void FixNVE::init() dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/fix_nvt.cpp b/src/fix_nvt.cpp index ad69e6ee81..14251a269a 100644 --- a/src/fix_nvt.cpp +++ b/src/fix_nvt.cpp @@ -12,12 +12,10 @@ ------------------------------------------------------------------------- */ #include "fix_nvt.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" - using namespace LAMMPS_NS; using namespace FixConst; @@ -35,11 +33,7 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += fmt::format(" {} temp",group->names[igroup]); - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/fix_nvt_sllod.cpp b/src/fix_nvt_sllod.cpp index 2257fa6c56..ba81adee0c 100644 --- a/src/fix_nvt_sllod.cpp +++ b/src/fix_nvt_sllod.cpp @@ -16,17 +16,18 @@ ------------------------------------------------------------------------- */ #include "fix_nvt_sllod.h" -#include -#include "math_extra.h" + #include "atom.h" +#include "compute.h" #include "domain.h" -#include "group.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_deform.h" -#include "compute.h" -#include "error.h" +#include "group.h" +#include "math_extra.h" +#include "modify.h" +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -49,12 +50,9 @@ FixNVTSllod::FixNVTSllod(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string cmd = id + std::string("_temp"); - id_temp = new char[cmd.size()+1]; - strcpy(id_temp,cmd.c_str()); - - cmd += fmt::format(" {} temp/deform",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/deform", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/fix_nvt_sphere.cpp b/src/fix_nvt_sphere.cpp index 1119d345bc..0733a27678 100644 --- a/src/fix_nvt_sphere.cpp +++ b/src/fix_nvt_sphere.cpp @@ -12,12 +12,10 @@ ------------------------------------------------------------------------- */ #include "fix_nvt_sphere.h" -#include +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" - using namespace LAMMPS_NS; using namespace FixConst; @@ -35,11 +33,8 @@ FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp - std::string cmd = id + std::string("_temp"); - id_temp = new char[cmd.size()+1]; - strcpy(id_temp,cmd.c_str()); - - cmd += fmt::format(" {} temp/sphere",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp/sphere", + id_temp,group->names[igroup])); tcomputeflag = 1; } diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index d929ca6f28..9cd9de9485 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -12,19 +12,20 @@ ------------------------------------------------------------------------- */ #include "fix_press_berendsen.h" -#include -#include #include "atom.h" -#include "force.h" #include "comm.h" -#include "modify.h" -#include "fix_deform.h" #include "compute.h" -#include "kspace.h" -#include "update.h" #include "domain.h" #include "error.h" +#include "fix_deform.h" +#include "force.h" +#include "kspace.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -218,24 +219,16 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : // compute group = all since pressure is always global (group all) // and thus its KE/temperature contribution should use group all - std::string tcmd = id + std::string("_temp"); - id_temp = new char[tcmd.size()+1]; - strcpy(id_temp,tcmd.c_str()); - - tcmd += " all temp"; - modify->add_compute(tcmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} all temp",id_temp)); tflag = 1; // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - std::string pcmd = id + std::string("_press"); - id_press = new char[pcmd.size()+1]; - strcpy(id_press,pcmd.c_str()); - - pcmd += " all pressure " + std::string(id_temp); - modify->add_compute(pcmd); + id_press = utils::strdup(std::string(id) + "_press"); + modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp)); pflag = 1; nrigid = 0; diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 39b8a5fefd..38ce9de333 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -72,10 +72,8 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp, compute group = fix group - std::string cmd = id + std::string("_temp"); - id_temp = utils::strdup(cmd); - cmd += fmt::format(" {} temp",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tflag = 1; energy = 0; diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index 787b4dd34e..bf3d0eb7f6 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -81,10 +81,8 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp, compute group = fix group - std::string cmd = id + std::string("_temp"); - id_temp = utils::strdup(cmd); - cmd += fmt::format(" {} temp",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tflag = 1; vhold = nullptr; diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index 525cf5b74a..2d04243a11 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -81,10 +81,8 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp style // id = fix-ID + temp, compute group = fix group - std::string cmd = id + std::string("_temp"); - id_temp = utils::strdup(cmd); - cmd += fmt::format(" {} temp",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tflag = 1; nmax = -1; diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index b57f6c238c..73c55f2793 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -68,10 +68,8 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : // create a new compute temp // id = fix-ID + temp, compute group = fix group - std::string cmd = id + std::string("_temp"); - id_temp = utils::strdup(cmd); - cmd += fmt::format(" {} temp",group->names[igroup]); - modify->add_compute(cmd); + id_temp = utils::strdup(std::string(id) + "_temp"); + modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup])); tflag = 1; energy = 0.0; From e481eb115456f7332ec7e9dd19151f02e23af515 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 07:29:14 -0400 Subject: [PATCH 158/370] simplify by using utils::strdup() fmt::format() and reorder includes --- src/USER-BOCS/fix_bocs.cpp | 8 ++---- src/USER-DPD/fix_eos_table_rx.cpp | 7 +++-- src/USER-DPD/fix_rx.cpp | 26 +++++++++---------- src/USER-DPD/pair_exp6_rx.cpp | 15 +++++------ src/USER-DPD/pair_multi_lucy.cpp | 22 +++++++--------- src/USER-DPD/pair_multi_lucy_rx.cpp | 26 +++++++++---------- src/USER-EFF/fix_temp_rescale_eff.cpp | 4 +-- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 7 ++--- src/USER-MGPT/pair_mgpt.cpp | 16 +++++------- src/USER-MISC/compute_gyration_shape.cpp | 13 +++++----- .../compute_gyration_shape_chunk.cpp | 21 +++++++-------- src/USER-MISC/compute_hma.cpp | 24 +++-------------- src/USER-MISC/compute_pressure_grem.cpp | 8 +++--- 13 files changed, 80 insertions(+), 117 deletions(-) diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 87d4653da5..60fb03cdf8 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -1525,9 +1525,7 @@ int FixBocs::modify_param(int narg, char **arg) tcomputeflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) @@ -1559,9 +1557,7 @@ int FixBocs::modify_param(int narg, char **arg) pcomputeflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index 28cd4eb4c3..7b0bec93f2 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -17,16 +17,15 @@ #include "fix_eos_table_rx.h" - -#include -#include #include "atom.h" +#include "comm.h" #include "error.h" #include "force.h" #include "memory.h" -#include "comm.h" #include "modify.h" +#include +#include #define MAXLINE 1024 diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index 675c3d6dea..4f0f381e6d 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -13,28 +13,26 @@ #include "fix_rx.h" - -#include -#include -#include // DBL_EPSILON #include "atom.h" -#include "error.h" -#include "group.h" -#include "modify.h" -#include "force.h" -#include "memory.h" #include "comm.h" -#include "update.h" #include "domain.h" -#include "neighbor.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "math_special.h" +#include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" -#include "math_special.h" +#include "neighbor.h" #include "pair_dpd_fdt_energy.h" +#include "update.h" - -#include // std::vector<> #include // std::max +#include // DBL_EPSILON +#include +#include +#include // std::vector<> using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 036d31060b..ba8d52776f 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -13,20 +13,19 @@ #include "pair_exp6_rx.h" -#include - -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" +#include "fix.h" #include "force.h" -#include "neigh_list.h" #include "math_special.h" #include "memory.h" -#include "error.h" - #include "modify.h" -#include "fix.h" +#include "neigh_list.h" + +#include +#include +#include using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 70ea8b40ad..85cab8a37f 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -21,21 +21,19 @@ The Journal of Chemical Physics, 2016, 144, 104501. ------------------------------------------------------------------------------------------- */ +#include "pair_multi_lucy.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neigh_list.h" #include -#include "math_const.h" - #include -#include "pair_multi_lucy.h" -#include "atom.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" - -#include "citeme.h" - using namespace LAMMPS_NS; diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index c0f6af8a7e..5bea395725 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -21,23 +21,21 @@ The Journal of Chemical Physics, 2016, 144, 104501. ------------------------------------------------------------------------------------------- */ +#include "pair_multi_lucy_rx.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" #include -#include "math_const.h" - #include -#include "pair_multi_lucy_rx.h" -#include "atom.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" - -#include "citeme.h" -#include "modify.h" -#include "fix.h" - using namespace LAMMPS_NS; diff --git a/src/USER-EFF/fix_temp_rescale_eff.cpp b/src/USER-EFF/fix_temp_rescale_eff.cpp index 1ebed8b9ff..0d3bf6ed43 100644 --- a/src/USER-EFF/fix_temp_rescale_eff.cpp +++ b/src/USER-EFF/fix_temp_rescale_eff.cpp @@ -165,9 +165,7 @@ int FixTempRescaleEff::modify_param(int narg, char **arg) tflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index a45d62a588..4b141a3bd1 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -31,10 +31,8 @@ ------------------------------------------------------------------------- */ - #include "fix_nve_manifold_rattle.h" -#include #include "atom.h" #include "force.h" #include "update.h" @@ -44,18 +42,17 @@ #include "citeme.h" #include "comm.h" +#include + #include "manifold_factory.h" #include "manifold.h" - using namespace LAMMPS_NS; using namespace FixConst; using namespace user_manifold; - enum { CONST, EQUAL }; // For treating the variables. - static const char* cite_fix_nve_manifold_rattle = "fix nve/manifold/rattle command:\n\n" "@article{paquay-2016,\n" diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 75f870e1b2..7061d1f86b 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -23,20 +23,18 @@ #include "pair_mgpt.h" -#include - -#include -#include - #include "atom.h" -#include "force.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include +#include +#include using namespace LAMMPS_NS; diff --git a/src/USER-MISC/compute_gyration_shape.cpp b/src/USER-MISC/compute_gyration_shape.cpp index daec7a6b4b..ac073d4cbc 100644 --- a/src/USER-MISC/compute_gyration_shape.cpp +++ b/src/USER-MISC/compute_gyration_shape.cpp @@ -15,17 +15,18 @@ * Contributing author: Evangelos Voyiatzis (Royal DSM) * ------------------------------------------------------------------------- */ - #include "compute_gyration_shape.h" -#include -#include + #include "error.h" -#include "math_extra.h" #include "math_eigen.h" +#include "math_extra.h" #include "math_special.h" #include "modify.h" #include "update.h" +#include +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -41,9 +42,7 @@ ComputeGyrationShape::ComputeGyrationShape(LAMMPS *lmp, int narg, char **arg) : extvector = 0; // ID of compute gyration - int n = strlen(arg[3]) + 1; - id_gyration = new char[n]; - strcpy(id_gyration,arg[3]); + id_gyration = utils::strdup(arg[3]); init(); diff --git a/src/USER-MISC/compute_gyration_shape_chunk.cpp b/src/USER-MISC/compute_gyration_shape_chunk.cpp index e0ab646ce2..e66173d704 100644 --- a/src/USER-MISC/compute_gyration_shape_chunk.cpp +++ b/src/USER-MISC/compute_gyration_shape_chunk.cpp @@ -15,17 +15,18 @@ * Contributing author: Evangelos Voyiatzis (Royal DSM) * ------------------------------------------------------------------------- */ - #include "compute_gyration_shape_chunk.h" + +#include "error.h" +#include "math_eigen.h" +#include "math_extra.h" +#include "math_special.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + #include #include -#include "error.h" -#include "math_extra.h" -#include "math_eigen.h" -#include "math_special.h" -#include "modify.h" -#include "memory.h" -#include "update.h" using namespace LAMMPS_NS; @@ -37,9 +38,7 @@ ComputeGyrationShapeChunk::ComputeGyrationShapeChunk(LAMMPS *lmp, int narg, char if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command"); // ID of compute gyration - int n = strlen(arg[3]) + 1; - id_gyration_chunk = new char[n]; - strcpy(id_gyration_chunk,arg[3]); + id_gyration_chunk = utils::strdup(arg[3]); init(); diff --git a/src/USER-MISC/compute_hma.cpp b/src/USER-MISC/compute_hma.cpp index 8220abebc4..fbe8c67d39 100644 --- a/src/USER-MISC/compute_hma.cpp +++ b/src/USER-MISC/compute_hma.cpp @@ -78,11 +78,7 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal compute hma command"); if (igroup) error->all(FLERR,"Compute hma must use group all"); if (strcmp(arg[3],"NULL") == 0) {error->all(FLERR,"fix ID specifying the set temperature of canonical simulation is required");} - else { - int n = strlen(arg[3]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[3]); - } + else id_temp = utils::strdup(arg[3]); create_attribute = 1; extscalar = 1; @@ -92,23 +88,11 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : // our new fix's id (id_fix)= compute-ID + COMPUTE_STORE // our new fix's group = same as compute group - int n = strlen(id) + strlen("_COMPUTE_STORE") + 1; - id_fix = new char[n]; - strcpy(id_fix,id); - strcat(id_fix,"_COMPUTE_STORE"); - - char **newarg = new char*[6]; - newarg[0] = id_fix; - newarg[1] = group->names[igroup]; - newarg[2] = (char *) "STORE"; - newarg[3] = (char *) "peratom"; - newarg[4] = (char *) "1"; - newarg[5] = (char *) "3"; - modify->add_fix(6,newarg); + id_fix = utils::strdup(std::string(id)+"_COMPUTE_STORE"); + modify->add_fix(fmt::format("{} {} STORE peratom 1 3", + id_fix, group->names[igroup])); fix = (FixStore *) modify->fix[modify->nfix-1]; - delete [] newarg; - // calculate xu,yu,zu for fix store array // skip if reset from restart file diff --git a/src/USER-MISC/compute_pressure_grem.cpp b/src/USER-MISC/compute_pressure_grem.cpp index 6ba4462c29..98f699491f 100644 --- a/src/USER-MISC/compute_pressure_grem.cpp +++ b/src/USER-MISC/compute_pressure_grem.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pressure_grem.h" -#include + #include "update.h" #include "domain.h" #include "modify.h" @@ -21,6 +21,8 @@ #include "kspace.h" #include "error.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- @@ -30,9 +32,7 @@ using namespace LAMMPS_NS; ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) : ComputePressure(lmp, narg-1, arg) { - int len = strlen(arg[narg-1])+1; - fix_grem = new char[len]; - strcpy(fix_grem,arg[narg-1]); + fix_grem = utils::strdup(arg[narg-1]); } /* ---------------------------------------------------------------------- */ From 806f4e73edf18719a18d9255ac8dbc97b647cd6b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 07:32:43 -0400 Subject: [PATCH 159/370] make dihedral style table/cut a derived class from table and remove redundant code --- src/USER-MISC/dihedral_table.cpp | 67 +-- src/USER-MISC/dihedral_table.h | 8 +- src/USER-MISC/dihedral_table_cut.cpp | 842 ++------------------------- src/USER-MISC/dihedral_table_cut.h | 118 +--- 4 files changed, 62 insertions(+), 973 deletions(-) diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index a81037cad6..ffbc9aad31 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -464,7 +464,6 @@ DihedralTable::~DihedralTable() if (allocated) { memory->destroy(setflag); - //memory->destroy(phi0); <- equilibrium angles not supported memory->destroy(tabindex); } } @@ -718,49 +717,18 @@ void DihedralTable::compute(int eflag, int vflag) } } // void DihedralTable::compute() - - - - - - -// single() calculates the dihedral-angle energy of atoms i1, i2, i3, i4. -double DihedralTable::single(int type, int i1, int i2, int i3, int i4) -{ - double vb12[g_dim]; - double vb23[g_dim]; - double vb34[g_dim]; - double n123[g_dim]; - double n234[g_dim]; - - double **x = atom->x; - - double phi = Phi(x[i1], x[i2], x[i3], x[i4], domain, - vb12, vb23, vb34, n123, n234); - - double u=0.0; - u_lookup(type, phi, u); //Calculate the energy, and store it in "u" - - return u; -} - - /* ---------------------------------------------------------------------- */ - - void DihedralTable::allocate() { allocated = 1; int n = atom->ndihedraltypes; memory->create(tabindex,n+1,"dihedral:tabindex"); - //memory->create(phi0,n+1,"dihedral:phi0"); <-equilibrium angles not supported memory->create(setflag,n+1,"dihedral:setflag"); for (int i = 1; i <= n; i++) setflag[i] = 0; } - /* ---------------------------------------------------------------------- global settings ------------------------------------------------------------------------- */ @@ -791,16 +759,13 @@ void DihedralTable::settings(int narg, char **arg) tables = nullptr; } - - /* ---------------------------------------------------------------------- set coeffs for one type ------------------------------------------------------------------------- */ - void DihedralTable::coeff(int narg, char **arg) { - if (narg != 3) error->all(FLERR,"Illegal dihedral_coeff command"); + if (narg != 3) error->all(FLERR,"Incorrect args for dihedral coefficients"); if (!allocated) allocate(); int ilo,ihi; @@ -815,25 +780,22 @@ void DihedralTable::coeff(int narg, char **arg) if (me == 0) read_table(tb,arg[1],arg[2]); bcast_table(tb); - // --- check the angle data for range errors --- // --- and resolve issues with periodicity --- - if (tb->ninput < 2) { - error->one(FLERR,fmt::format("Invalid dihedral table length ({}).", - arg[2])); - } else if ((tb->ninput == 2) && (tabstyle == SPLINE)) { - error->one(FLERR,fmt::format("Invalid dihedral spline table length. " - "(Try linear)\n ({}).",arg[2])); - } + if (tb->ninput < 2) + error->all(FLERR,fmt::format("Invalid dihedral table length: {}",arg[2])); + else if ((tb->ninput == 2) && (tabstyle == SPLINE)) + error->all(FLERR,fmt::format("Invalid dihedral spline table length: {} " + "(Try linear)",arg[2])); // check for monotonicity for (int i=0; i < tb->ninput-1; i++) { if (tb->phifile[i] >= tb->phifile[i+1]) { auto err_msg = fmt::format("Dihedral table values are not increasing " - "({}, {}th entry)",arg[2],i+1); + "({}, entry {})",arg[2],i+1); if (i==0) - err_msg += std::string("\n(This is probably a mistake with your table format.)\n"); + err_msg += "\n(This is probably a mistake with your table format.)\n"; error->all(FLERR,err_msg); } } @@ -971,15 +933,12 @@ void DihedralTable::coeff(int narg, char **arg) } ntables++; - if (count == 0) - error->all(FLERR,"Illegal dihedral_coeff command"); - -} //DihedralTable::coeff() - + if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients"); +} /* ---------------------------------------------------------------------- - proc 0 writes to restart file - ------------------------------------------------------------------------- */ + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ void DihedralTable::write_restart(FILE *fp) { @@ -1065,7 +1024,6 @@ void DihedralTable::read_table(Table *tb, char *file, char *keyword) error->one(FLERR,"Did not find keyword in table file"); } - // read args on 2nd line of section // allocate table arrays for file values @@ -1279,7 +1237,6 @@ void DihedralTable::compute_table(Table *tb) void DihedralTable::param_extract(Table *tb, char *line) { - //tb->theta0 = 180.0; <- equilibrium angles not supported tb->ninput = 0; tb->f_unspecified = false; //default tb->use_degrees = true; //default diff --git a/src/USER-MISC/dihedral_table.h b/src/USER-MISC/dihedral_table.h index a8d1f8f8bb..9d5b03f5cc 100644 --- a/src/USER-MISC/dihedral_table.h +++ b/src/USER-MISC/dihedral_table.h @@ -25,7 +25,6 @@ DihedralStyle(table,DihedralTable) #define LMP_DIHEDRAL_TABLE_H #include "dihedral.h" - namespace LAMMPS_NS { class DihedralTable : public Dihedral { @@ -34,7 +33,7 @@ class DihedralTable : public Dihedral { virtual ~DihedralTable(); virtual void compute(int, int); void settings(int, char **); - void coeff(int, char **); + virtual void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); void write_restart_settings(FILE *); @@ -43,13 +42,11 @@ class DihedralTable : public Dihedral { protected: int tabstyle,tablength; - // double *phi0; <- equilibrium angles not supported std::string checkU_fname; std::string checkF_fname; struct Table { int ninput; - //double phi0; <-equilibrium angles not supported int f_unspecified; // boolean (but MPI does not like type "bool") int use_degrees; // boolean (but MPI does not like type "bool") double *phifile,*efile,*ffile; @@ -62,7 +59,7 @@ class DihedralTable : public Dihedral { Table *tables; int *tabindex; - void allocate(); + virtual void allocate(); void null_table(Table *); void free_table(Table *); void read_table(Table *, char *, char *); @@ -152,6 +149,5 @@ class DihedralTable : public Dihedral { } // namespace LAMMPS_NS - #endif //#ifndef LMP_DIHEDRAL_TABLE_H #endif //#ifdef DIHEDRAL_CLASS ... #else diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index ed7b3ac0d6..dc7a6f9685 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -18,28 +18,23 @@ #include "dihedral_table_cut.h" -#include +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neighbor.h" +#include "update.h" + #include - #include - #include // IWYU pragma: keep #include // IWYU pragma: keep -#include "atom.h" -#include "neighbor.h" -#include "update.h" -#include "comm.h" -#include "force.h" -#include "citeme.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" - - using namespace LAMMPS_NS; using namespace MathConst; -using namespace std; static const char cite_dihedral_tablecut[] = "dihedral_style table/cut command:\n\n" @@ -89,272 +84,6 @@ enum { //GSL status return codes. }; -static int solve_cyc_tridiag( const double diag[], size_t d_stride, - const double offdiag[], size_t o_stride, - const double b[], size_t b_stride, - double x[], size_t x_stride, - size_t N, bool warn) -{ - int status = GSL_SUCCESS; - double * delta = (double *) malloc (N * sizeof (double)); - double * gamma = (double *) malloc (N * sizeof (double)); - double * alpha = (double *) malloc (N * sizeof (double)); - double * c = (double *) malloc (N * sizeof (double)); - double * z = (double *) malloc (N * sizeof (double)); - - if (delta == 0 || gamma == 0 || alpha == 0 || c == 0 || z == 0) { - if (warn) - fprintf(stderr,"Internal Cyclic Spline Error: failed to allocate working space\n"); - - if (delta) free(delta); - if (gamma) free(gamma); - if (alpha) free(alpha); - if (c) free(c); - if (z) free(z); - return GSL_ENOMEM; - } - else - { - size_t i, j; - double sum = 0.0; - - /* factor */ - - if (N == 1) - { - x[0] = b[0] / diag[0]; - free(delta); - free(gamma); - free(alpha); - free(c); - free(z); - return GSL_SUCCESS; - } - - alpha[0] = diag[0]; - gamma[0] = offdiag[0] / alpha[0]; - delta[0] = offdiag[o_stride * (N-1)] / alpha[0]; - - if (alpha[0] == 0) { - status = GSL_EZERODIV; - } - - for (i = 1; i < N - 2; i++) - { - alpha[i] = diag[d_stride * i] - offdiag[o_stride * (i-1)] * gamma[i - 1]; - gamma[i] = offdiag[o_stride * i] / alpha[i]; - delta[i] = -delta[i - 1] * offdiag[o_stride * (i-1)] / alpha[i]; - if (alpha[i] == 0) { - status = GSL_EZERODIV; - } - } - - for (i = 0; i < N - 2; i++) - { - sum += alpha[i] * delta[i] * delta[i]; - } - - alpha[N - 2] = diag[d_stride * (N - 2)] - offdiag[o_stride * (N - 3)] * gamma[N - 3]; - - gamma[N - 2] = (offdiag[o_stride * (N - 2)] - offdiag[o_stride * (N - 3)] * delta[N - 3]) / alpha[N - 2]; - - alpha[N - 1] = diag[d_stride * (N - 1)] - sum - alpha[(N - 2)] * gamma[N - 2] * gamma[N - 2]; - - /* update */ - z[0] = b[0]; - for (i = 1; i < N - 1; i++) - { - z[i] = b[b_stride * i] - z[i - 1] * gamma[i - 1]; - } - sum = 0.0; - for (i = 0; i < N - 2; i++) - { - sum += delta[i] * z[i]; - } - z[N - 1] = b[b_stride * (N - 1)] - sum - gamma[N - 2] * z[N - 2]; - for (i = 0; i < N; i++) - { - c[i] = z[i] / alpha[i]; - } - - /* backsubstitution */ - x[x_stride * (N - 1)] = c[N - 1]; - x[x_stride * (N - 2)] = c[N - 2] - gamma[N - 2] * x[x_stride * (N - 1)]; - if (N >= 3) - { - for (i = N - 3, j = 0; j <= N - 3; j++, i--) - { - x[x_stride * i] = c[i] - gamma[i] * x[x_stride * (i + 1)] - delta[i] * x[x_stride * (N - 1)]; - } - } - } - - free (z); - free (c); - free (alpha); - free (gamma); - free (delta); - - if ((status == GSL_EZERODIV) && warn) - fprintf(stderr, "Internal Cyclic Spline Error: Matrix must be positive definite.\n"); - - return status; -} //solve_cyc_tridiag() - -/* ---------------------------------------------------------------------- - spline and splint routines modified from Numerical Recipes -------------------------------------------------------------------------- */ - -static int cyc_spline(double const *xa, - double const *ya, - int n, - double period, - double *y2a, bool warn) -{ - - double *diag = new double[n]; - double *offdiag = new double[n]; - double *rhs = new double[n]; - double xa_im1, xa_ip1; - - // In the cyclic case, there are n equations with n unknows. - // The for loop sets up the equations we need to solve. - // Later we invoke the GSL tridiagonal matrix solver to solve them. - - for (int i=0; i < n; i++) { - - // I have to lookup xa[i+1] and xa[i-1]. This gets tricky because of - // periodic boundary conditions. We handle that now. - int im1 = i-1; - if (im1<0) { - im1 += n; - xa_im1 = xa[im1] - period; - } - else - xa_im1 = xa[im1]; - - int ip1 = i+1; - if (ip1>=n) { - ip1 -= n; - xa_ip1 = xa[ip1] + period; - } - else - xa_ip1 = xa[ip1]; - - // Recall that we want to find the y2a[] parameters (there are n of them). - // To solve for them, we have a linear equation with n unknowns - // (in the cyclic case that is). For details, the non-cyclic case is - // explained in equation 3.3.7 in Numerical Recipes in C, p. 115. - diag[i] = (xa_ip1 - xa_im1) / 3.0; - offdiag[i] = (xa_ip1 - xa[i]) / 6.0; - rhs[i] = ((ya[ip1] - ya[i]) / (xa_ip1 - xa[i])) - - ((ya[i] - ya[im1]) / (xa[i] - xa_im1)); - } - - // Because this matrix is tridiagonal (and cyclic), we can use the following - // cheap method to invert it. - if (solve_cyc_tridiag(diag, 1, - offdiag, 1, - rhs, 1, - y2a, 1, - n, warn) != GSL_SUCCESS) { - if (warn) - fprintf(stderr,"Error in inverting matrix for splines.\n"); - - delete [] diag; - delete [] offdiag; - delete [] rhs; - return 1; - } - delete [] diag; - delete [] offdiag; - delete [] rhs; - return 0; -} // cyc_spline() - -/* ---------------------------------------------------------------------- */ - -// cyc_splint(): Evaluates a spline at position x, with n control -// points located at xa[], ya[], and with parameters y2a[] -// The xa[] must be monotonically increasing and their -// range should not exceed period (ie xa[n-1] < xa[0] + period). -// x must lie in the range: [(xa[n-1]-period), (xa[0]+period)] -// "period" is typically 2*PI. -static double cyc_splint(double const *xa, - double const *ya, - double const *y2a, - int n, - double period, - double x) -{ - int klo = -1; - int khi = n; - int k; - double xlo = xa[n-1] - period; - double xhi = xa[0] + period; - while (khi-klo > 1) { - k = (khi+klo) >> 1; //(k=(khi+klo)/2) - if (xa[k] > x) { - khi = k; - xhi = xa[k]; - } - else { - klo = k; - xlo = xa[k]; - } - } - - if (khi == n) khi = 0; - if (klo ==-1) klo = n-1; - - double h = xhi-xlo; - double a = (xhi-x) / h; - double b = (x-xlo) / h; - double y = a*ya[klo] + b*ya[khi] + - ((a*a*a-a)*y2a[klo] + (b*b*b-b)*y2a[khi]) * (h*h)/6.0; - - return y; - -} // cyc_splint() - - -static double cyc_lin(double const *xa, - double const *ya, - int n, - double period, - double x) -{ - int klo = -1; - int khi = n; - int k; - double xlo = xa[n-1] - period; - double xhi = xa[0] + period; - while (khi-klo > 1) { - k = (khi+klo) >> 1; //(k=(khi+klo)/2) - if (xa[k] > x) { - khi = k; - xhi = xa[k]; - } - else { - klo = k; - xlo = xa[k]; - } - } - - if (khi == n) khi = 0; - if (klo ==-1) klo = n-1; - - double h = xhi-xlo; - double a = (xhi-x) / h; - double b = (x-xlo) / h; - double y = a*ya[klo] + b*ya[khi]; - - return y; - -} // cyc_lin() - - - // cyc_splintD(): Evaluate the deriviative of a cyclic spline at position x, // with n control points at xa[], ya[], with parameters y2a[]. @@ -405,35 +134,26 @@ static double cyc_splintD(double const *xa, } // cyc_splintD() +// -------------------------------------------- +// ------- Calculate the dihedral angle ------- +// -------------------------------------------- +static const int g_dim=3; /* ---------------------------------------------------------------------- */ -DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : Dihedral(lmp) +DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : DihedralTable(lmp) { if (lmp->citeme) lmp->citeme->add(cite_dihedral_tablecut); - ntables = 0; - tables = nullptr; - checkU_fname = checkF_fname = nullptr; + aat_k = aat_theta0_1 = aat_theta0_2 = nullptr; } /* ---------------------------------------------------------------------- */ DihedralTableCut::~DihedralTableCut() { - if (allocated) { - memory->destroy(aat_k); - memory->destroy(aat_theta0_1); - memory->destroy(aat_theta0_2); - - for (int m = 0; m < ntables; m++) free_table(&tables[m]); - memory->sfree(tables); - memory->sfree(checkU_fname); - memory->sfree(checkF_fname); - - memory->destroy(setflag); - memory->destroy(tabindex); - - } + memory->destroy(aat_k); + memory->destroy(aat_theta0_1); + memory->destroy(aat_theta0_2); } /* ---------------------------------------------------------------------- */ @@ -702,7 +422,7 @@ void DihedralTableCut::compute(int eflag, int vflag) for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) - fabcd[i][j] -= - gt*gtt*fpphi*dphidr[i][j] + fabcd[i][j] -= gt*gtt*fpphi*dphidr[i][j] - gt*gptt*fphi*dthetadr[1][i][j] + gpt*gtt*fphi*dthetadr[0][i][j]; // apply force to each of 4 atoms @@ -751,35 +471,7 @@ void DihedralTableCut::allocate() memory->create(tabindex,n+1,"dihedral:tabindex"); memory->create(setflag,n+1,"dihedral:setflag"); - - for (int i = 1; i <= n; i++) - setflag[i] = 0; -} - -void DihedralTableCut::settings(int narg, char **arg) -{ - if (narg != 2) error->all(FLERR,"Illegal dihedral_style command"); - - if (strcmp(arg[0],"linear") == 0) tabstyle = LINEAR; - else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; - else error->all(FLERR,"Unknown table style in dihedral style table_cut"); - - tablength = utils::inumeric(FLERR,arg[1],false,lmp); - if (tablength < 3) - error->all(FLERR,"Illegal number of dihedral table entries"); - // delete old tables, since cannot just change settings - - for (int m = 0; m < ntables; m++) free_table(&tables[m]); - memory->sfree(tables); - - if (allocated) { - memory->destroy(setflag); - memory->destroy(tabindex); - } - allocated = 0; - - ntables = 0; - tables = nullptr; + for (int i = 1; i <= n; i++) setflag[i] = 0; } /* ---------------------------------------------------------------------- @@ -790,9 +482,9 @@ void DihedralTableCut::settings(int narg, char **arg) void DihedralTableCut::coeff(int narg, char **arg) { - if (narg != 7) error->all(FLERR,"Incorrect args for dihedral coefficients"); if (!allocated) allocate(); + int ilo,ihi; utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); @@ -820,29 +512,19 @@ void DihedralTableCut::coeff(int narg, char **arg) // --- check the angle data for range errors --- // --- and resolve issues with periodicity --- - if (tb->ninput < 2) { - string err_msg; - err_msg = string("Invalid dihedral table length (") - + string(arg[5]) + string(")."); - error->one(FLERR,err_msg); - } - else if ((tb->ninput == 2) && (tabstyle == SPLINE)) { - string err_msg; - err_msg = string("Invalid dihedral spline table length. (Try linear)\n (") - + string(arg[5]) + string(")."); - error->one(FLERR,err_msg); - } + if (tb->ninput < 2) + error->all(FLERR,fmt::format("Invalid dihedral table length: {}",arg[5])); + else if ((tb->ninput == 2) && (tabstyle == SPLINE)) + error->all(FLERR,fmt::format("Invalid dihedral spline table length: {} " + "(Try linear)",arg[5])); // check for monotonicity for (int i=0; i < tb->ninput-1; i++) { if (tb->phifile[i] >= tb->phifile[i+1]) { - stringstream i_str; - i_str << i+1; - string err_msg = - string("Dihedral table values are not increasing (") + - string(arg[5]) + string(", ")+i_str.str()+string("th entry)"); + auto err_msg =fmt::format("Dihedral table values are not increasing " + "({}, entry {})",arg[5],i+1); if (i==0) - err_msg += string("\n(This is probably a mistake with your table format.)\n"); + err_msg += "\n(This is probably a mistake with your table format.)\n"; error->all(FLERR,err_msg); } } @@ -851,20 +533,13 @@ void DihedralTableCut::coeff(int narg, char **arg) double philo = tb->phifile[0]; double phihi = tb->phifile[tb->ninput-1]; if (tb->use_degrees) { - if ((phihi - philo) >= 360) { - string err_msg; - err_msg = string("Dihedral table angle range must be < 360 degrees (") - +string(arg[5]) + string(")."); - error->all(FLERR,err_msg); - } - } - else { - if ((phihi - philo) >= MY_2PI) { - string err_msg; - err_msg = string("Dihedral table angle range must be < 2*PI radians (") - + string(arg[5]) + string(")."); - error->all(FLERR,err_msg); - } + if ((phihi - philo) >= 360) + error->all(FLERR,fmt::format("Dihedral table angle range must be < 360 " + "degrees ({})",arg[5])); + } else { + if ((phihi - philo) >= MY_2PI) + error->all(FLERR,fmt::format("Dihedral table angle range must be < 2*PI " + "radians ({})",arg[5])); } // convert phi from degrees to radians @@ -932,10 +607,9 @@ void DihedralTableCut::coeff(int narg, char **arg) // Optional: allow the user to print out the interpolated spline tables if (me == 0) { - if (checkU_fname && (strlen(checkU_fname) != 0)) - { - ofstream checkU_file; - checkU_file.open(checkU_fname, ios::out); + if (!checkU_fname.empty()) { + std::ofstream checkU_file; + checkU_file.open(checkU_fname, std::ios::out); for (int i=0; i < tablength; i++) { double phi = i*MY_2PI/tablength; double u = tb->e[i]; @@ -945,12 +619,10 @@ void DihedralTableCut::coeff(int narg, char **arg) } checkU_file.close(); } - if (checkF_fname && (strlen(checkF_fname) != 0)) - { - ofstream checkF_file; - checkF_file.open(checkF_fname, ios::out); - for (int i=0; i < tablength; i++) - { + if (!checkF_fname.empty()) { + std::ofstream checkF_file; + checkF_file.open(checkF_fname, std::ios::out); + for (int i=0; i < tablength; i++) { double phi = i*MY_2PI/tablength; double f; if ((tabstyle == SPLINE) && (tb->f_unspecified)) { @@ -992,429 +664,3 @@ void DihedralTableCut::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for dihedral coefficients"); } - -/* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file -------------------------------------------------------------------------- */ - -void DihedralTableCut::write_restart(FILE *fp) -{ - write_restart_settings(fp); -} - -/* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them -------------------------------------------------------------------------- */ - -void DihedralTableCut::read_restart(FILE *fp) -{ - read_restart_settings(fp); - allocate(); -} - -/* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file -------------------------------------------------------------------------- */ - -void DihedralTableCut::write_restart_settings(FILE *fp) -{ - fwrite(&tabstyle,sizeof(int),1,fp); - fwrite(&tablength,sizeof(int),1,fp); -} - -/* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them -------------------------------------------------------------------------- */ - -void DihedralTableCut::read_restart_settings(FILE *fp) -{ - if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); - } - - MPI_Bcast(&tabstyle,1,MPI_INT,0,world); - MPI_Bcast(&tablength,1,MPI_INT,0,world); -} - -/* ---------------------------------------------------------------------- */ - -void DihedralTableCut::null_table(Table *tb) -{ - tb->phifile = tb->efile = tb->ffile = nullptr; - tb->e2file = tb->f2file = nullptr; - tb->phi = tb->e = tb->de = nullptr; - tb->f = tb->df = tb->e2 = tb->f2 = nullptr; -} - -/* ---------------------------------------------------------------------- */ - -void DihedralTableCut::free_table(Table *tb) -{ - memory->destroy(tb->phifile); - memory->destroy(tb->efile); - memory->destroy(tb->ffile); - memory->destroy(tb->e2file); - memory->destroy(tb->f2file); - - memory->destroy(tb->phi); - memory->destroy(tb->e); - memory->destroy(tb->de); - memory->destroy(tb->f); - memory->destroy(tb->df); - memory->destroy(tb->e2); - memory->destroy(tb->f2); -} - -/* ---------------------------------------------------------------------- - read table file, only called by proc 0 -------------------------------------------------------------------------- */ - -static const int MAXLINE=2048; - -void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) -{ - char line[MAXLINE]; - - // open file - - FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == nullptr) { - string err_msg = string("Cannot open file ") + string(file); - error->one(FLERR,err_msg); - } - - // loop until section found with matching keyword - - while (1) { - if (fgets(line,MAXLINE,fp) == nullptr) { - string err_msg=string("Did not find keyword \"") - +string(keyword)+string("\" in dihedral table file."); - error->one(FLERR, err_msg); - } - if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line - if (line[0] == '#') continue; // comment - char *word = strtok(line," \t\n\r"); - if (strcmp(word,keyword) == 0) break; // matching keyword - utils::sfgets(FLERR,line,MAXLINE,fp,file,error); // no match, skip section - param_extract(tb,line); - utils::sfgets(FLERR,line,MAXLINE,fp,file,error); - for (int i = 0; i < tb->ninput; i++) - utils::sfgets(FLERR,line,MAXLINE,fp,file,error); - } - - // read args on 2nd line of section - // allocate table arrays for file values - - utils::sfgets(FLERR,line,MAXLINE,fp,file,error); - param_extract(tb,line); - memory->create(tb->phifile,tb->ninput,"dihedral:phifile"); - memory->create(tb->efile,tb->ninput,"dihedral:efile"); - memory->create(tb->ffile,tb->ninput,"dihedral:ffile"); - - // read a,e,f table values from file - - int itmp; - for (int i = 0; i < tb->ninput; i++) { - // Read the next line. Make sure the file is long enough. - utils::sfgets(FLERR,line,MAXLINE,fp,file,error); - - // Skip blank lines and delete text following a '#' character - char *pe = strchr(line, '#'); - if (pe != nullptr) *pe = '\0'; //terminate string at '#' character - char *pc = line; - while ((*pc != '\0') && isspace(*pc)) - pc++; - if (*pc != '\0') { //If line is not a blank line - stringstream line_ss(line); - if (tb->f_unspecified) { - line_ss >> itmp; - line_ss >> tb->phifile[i]; - line_ss >> tb->efile[i]; - } else { - line_ss >> itmp; - line_ss >> tb->phifile[i]; - line_ss >> tb->efile[i]; - line_ss >> tb->ffile[i]; - } - if (! line_ss) { - stringstream err_msg; - err_msg << "Read error in table "<< keyword<<", near line "<f_unspecified) && (i==0)) - err_msg << "\n (This sometimes occurs if users forget to specify the \"NOF\" option.)\n"; - error->one(FLERR, err_msg.str().c_str()); - } - } else //if it is a blank line, then skip it. - i--; - } //for (int i = 0; (i < tb->ninput) && fp; i++) { - - fclose(fp); -} - -/* ---------------------------------------------------------------------- - build spline representation of e,f over entire range of read-in table - this function sets these values in e2file,f2file. - I also perform a crude check for force & energy consistency. -------------------------------------------------------------------------- */ - -void DihedralTableCut::spline_table(Table *tb) -{ - memory->create(tb->e2file,tb->ninput,"dihedral:e2file"); - memory->create(tb->f2file,tb->ninput,"dihedral:f2file"); - - if (cyc_spline(tb->phifile, tb->efile, tb->ninput, - MY_2PI,tb->e2file,comm->me == 0)) - error->one(FLERR,"Error computing dihedral spline tables"); - - if (! tb->f_unspecified) { - if (cyc_spline(tb->phifile, tb->ffile, tb->ninput, - MY_2PI, tb->f2file, comm->me == 0)) - error->one(FLERR,"Error computing dihedral spline tables"); - } - - // CHECK to help make sure the user calculated forces in a way - // which is grossly numerically consistent with the energy table. - if (! tb->f_unspecified) { - int num_disagreements = 0; - for (int i=0; ininput; i++) { - - // Calculate what the force should be at the control points - // by using linear interpolation of the derivatives of the energy: - - double phi_i = tb->phifile[i]; - - // First deal with periodicity - double phi_im1, phi_ip1; - int im1 = i-1; - if (im1 < 0) { - im1 += tb->ninput; - phi_im1 = tb->phifile[im1] - MY_2PI; - } - else - phi_im1 = tb->phifile[im1]; - int ip1 = i+1; - if (ip1 >= tb->ninput) { - ip1 -= tb->ninput; - phi_ip1 = tb->phifile[ip1] + MY_2PI; - } - else - phi_ip1 = tb->phifile[ip1]; - - // Now calculate the midpoints above and below phi_i = tb->phifile[i] - double phi_lo= 0.5*(phi_im1 + phi_i); //midpoint between phi_im1 and phi_i - double phi_hi= 0.5*(phi_i + phi_ip1); //midpoint between phi_i and phi_ip1 - - // Use a linear approximation to the derivative at these two midpoints - double dU_dphi_lo = - (tb->efile[i] - tb->efile[im1]) - / - (phi_i - phi_im1); - double dU_dphi_hi = - (tb->efile[ip1] - tb->efile[i]) - / - (phi_ip1 - phi_i); - - // Now calculate the derivative at position - // phi_i (=tb->phifile[i]) using linear interpolation - - double a = (phi_i - phi_lo) / (phi_hi - phi_lo); - double b = (phi_hi - phi_i) / (phi_hi - phi_lo); - double dU_dphi = a*dU_dphi_lo + b*dU_dphi_hi; - double f = -dU_dphi; - // Alternately, we could use spline interpolation instead: - // double f = - splintD(tb->phifile, tb->efile, tb->e2file, - // tb->ninput, MY_2PI, tb->phifile[i]); - // This is the way I originally did it, but I trust - // the ugly simple linear way above better. - // Recall this entire block of code doess not calculate - // anything important. It does not have to be perfect. - // We are only checking for stupid user errors here. - - if ((f != 0.0) && - (tb->ffile[i] != 0.0) && - ((f/tb->ffile[i] < 0.5) || (f/tb->ffile[i] > 2.0))) { - num_disagreements++; - } - } // for (int i=0; ininput; i++) - - if ((num_disagreements > tb->ninput/2) && (num_disagreements > 2)) { - string msg("Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n"); - error->all(FLERR,msg.c_str()); - } - - } // check for consistency if (! tb->f_unspecified) - -} // DihedralTable::spline_table() - - -/* ---------------------------------------------------------------------- - compute a,e,f vectors from splined values -------------------------------------------------------------------------- */ - -void DihedralTableCut::compute_table(Table *tb) -{ - //delta = table spacing in dihedral angle for tablength (cyclic) bins - tb->delta = MY_2PI / tablength; - tb->invdelta = 1.0/tb->delta; - tb->deltasq6 = tb->delta*tb->delta / 6.0; - - // N evenly spaced bins in dihedral angle from 0 to 2*PI - // phi,e,f = value at lower edge of bin - // de,df values = delta values of e,f (cyclic, in this case) - // phi,e,f,de,df are arrays containing "tablength" number of entries - - memory->create(tb->phi,tablength,"dihedral:phi"); - memory->create(tb->e,tablength,"dihedral:e"); - memory->create(tb->de,tablength,"dihedral:de"); - memory->create(tb->f,tablength,"dihedral:f"); - memory->create(tb->df,tablength,"dihedral:df"); - memory->create(tb->e2,tablength,"dihedral:e2"); - memory->create(tb->f2,tablength,"dihedral:f2"); - - if (tabstyle == SPLINE) { - // Use cubic spline interpolation to calculate the entries in the - // internal table. (This is true regardless...even if tabstyle!=SPLINE.) - for (int i = 0; i < tablength; i++) { - double phi = i*tb->delta; - tb->phi[i] = phi; - tb->e[i]= cyc_splint(tb->phifile,tb->efile,tb->e2file,tb->ninput,MY_2PI,phi); - if (! tb->f_unspecified) - tb->f[i] = cyc_splint(tb->phifile,tb->ffile,tb->f2file,tb->ninput,MY_2PI,phi); - } - } // if (tabstyle == SPLINE) - else if (tabstyle == LINEAR) { - if (! tb->f_unspecified) { - for (int i = 0; i < tablength; i++) { - double phi = i*tb->delta; - tb->phi[i] = phi; - tb->e[i]= cyc_lin(tb->phifile,tb->efile,tb->ninput,MY_2PI,phi); - tb->f[i]= cyc_lin(tb->phifile,tb->ffile,tb->ninput,MY_2PI,phi); - } - } - else { - for (int i = 0; i < tablength; i++) { - double phi = i*tb->delta; - tb->phi[i] = phi; - tb->e[i]= cyc_lin(tb->phifile,tb->efile,tb->ninput,MY_2PI,phi); - } - // In the linear case, if the user did not specify the forces, then we - // must generate the "f" array. Do this using linear interpolation - // of the e array (which itself was generated above) - for (int i = 0; i < tablength; i++) { - int im1 = i-1; if (im1 < 0) im1 += tablength; - int ip1 = i+1; if (ip1 >= tablength) ip1 -= tablength; - double dedx = (tb->e[ip1] - tb->e[im1]) / (2.0 * tb->delta); - // (This is the average of the linear slopes on either side of the node. - // Note that the nodes in the internal table are evenly spaced.) - tb->f[i] = -dedx; - } - } - - - // Fill the linear interpolation tables (de, df) - for (int i = 0; i < tablength; i++) { - int ip1 = i+1; if (ip1 >= tablength) ip1 -= tablength; - tb->de[i] = tb->e[ip1] - tb->e[i]; - tb->df[i] = tb->f[ip1] - tb->f[i]; - } - } // else if (tabstyle == LINEAR) - - - - cyc_spline(tb->phi, tb->e, tablength, MY_2PI, tb->e2, comm->me == 0); - if (! tb->f_unspecified) - cyc_spline(tb->phi, tb->f, tablength, MY_2PI, tb->f2, comm->me == 0); -} - - -/* ---------------------------------------------------------------------- - extract attributes from parameter line in table section - format of line: N value NOF DEGREES RADIANS - N is required, other params are optional -------------------------------------------------------------------------- */ - -void DihedralTableCut::param_extract(Table *tb, char *line) -{ - //tb->theta0 = 180.0; <- equilibrium angles not supported - tb->ninput = 0; - tb->f_unspecified = false; //default - tb->use_degrees = true; //default - - char *word = strtok(line," \t\n\r\f"); - while (word) { - if (strcmp(word,"N") == 0) { - word = strtok(nullptr," \t\n\r\f"); - tb->ninput = atoi(word); - } - else if (strcmp(word,"NOF") == 0) { - tb->f_unspecified = true; - } - else if ((strcmp(word,"DEGREES") == 0) || (strcmp(word,"degrees") == 0)) { - tb->use_degrees = true; - } - else if ((strcmp(word,"RADIANS") == 0) || (strcmp(word,"radians") == 0)) { - tb->use_degrees = false; - } - else if (strcmp(word,"CHECKU") == 0) { - word = strtok(nullptr," \t\n\r\f"); - memory->sfree(checkU_fname); - memory->create(checkU_fname,strlen(word)+1,"dihedral_table:checkU"); - strcpy(checkU_fname, word); - } - else if (strcmp(word,"CHECKF") == 0) { - word = strtok(nullptr," \t\n\r\f"); - memory->sfree(checkF_fname); - memory->create(checkF_fname,strlen(word)+1,"dihedral_table:checkF"); - strcpy(checkF_fname, word); - } - // COMMENTING OUT: equilibrium angles are not supported - //else if (strcmp(word,"EQ") == 0) { - // word = strtok(nullptr," \t\n\r\f"); - // tb->theta0 = atof(word); - //} - else { - string err_msg("Invalid keyword in dihedral angle table parameters"); - err_msg += string(" (") + string(word) + string(")"); - error->one(FLERR, err_msg); - } - word = strtok(nullptr," \t\n\r\f"); - } - - if (tb->ninput == 0) - error->one(FLERR,"Dihedral table parameters did not set N"); - -} // DihedralTable::param_extract() - - -/* ---------------------------------------------------------------------- - broadcast read-in table info from proc 0 to other procs - this function communicates these values in Table: - ninput,phifile,efile,ffile, - f_unspecified,use_degrees -------------------------------------------------------------------------- */ - -void DihedralTableCut::bcast_table(Table *tb) -{ - MPI_Bcast(&tb->ninput,1,MPI_INT,0,world); - - int me; - MPI_Comm_rank(world,&me); - if (me > 0) { - memory->create(tb->phifile,tb->ninput,"dihedral:phifile"); - memory->create(tb->efile,tb->ninput,"dihedral:efile"); - memory->create(tb->ffile,tb->ninput,"dihedral:ffile"); - } - - MPI_Bcast(tb->phifile,tb->ninput,MPI_DOUBLE,0,world); - MPI_Bcast(tb->efile,tb->ninput,MPI_DOUBLE,0,world); - MPI_Bcast(tb->ffile,tb->ninput,MPI_DOUBLE,0,world); - - MPI_Bcast(&tb->f_unspecified,1,MPI_INT,0,world); - MPI_Bcast(&tb->use_degrees,1,MPI_INT,0,world); - - // COMMENTING OUT: equilibrium angles are not supported - //MPI_Bcast(&tb->theta0,1,MPI_DOUBLE,0,world); -} - - diff --git a/src/USER-MISC/dihedral_table_cut.h b/src/USER-MISC/dihedral_table_cut.h index b07e925f08..b956069e14 100644 --- a/src/USER-MISC/dihedral_table_cut.h +++ b/src/USER-MISC/dihedral_table_cut.h @@ -20,131 +20,21 @@ DihedralStyle(table/cut,DihedralTableCut) #ifndef LMP_DIHEDRAL_TABLE_CUT_H #define LMP_DIHEDRAL_TABLE_CUT_H -#include "dihedral.h" +#include "dihedral_table.h" namespace LAMMPS_NS { -class DihedralTableCut : public Dihedral { +class DihedralTableCut : public DihedralTable { public: DihedralTableCut(class LAMMPS *); virtual ~DihedralTableCut(); virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); + virtual void coeff(int, char **); protected: double *aat_k,*aat_theta0_1,*aat_theta0_2; - void allocate(); - - int tabstyle,tablength; - char *checkU_fname; - char *checkF_fname; - - struct Table { - int ninput; - int f_unspecified; // boolean (but MPI does not like type "bool") - int use_degrees; // boolean (but MPI does not like type "bool") - double *phifile,*efile,*ffile; - double *e2file,*f2file; - double delta,invdelta,deltasq6; - double *phi,*e,*de,*f,*df,*e2,*f2; - }; - - int ntables; - Table *tables; - int *tabindex; - - void null_table(Table *); - void free_table(Table *); - void read_table(Table *, char *, char *); - void bcast_table(Table *); - void spline_table(Table *); - void compute_table(Table *); - - void param_extract(Table *, char *); - - // -------------------------------------------- - // ------------ inline functions -------------- - // -------------------------------------------- - - // ----------------------------------------------------------- - // uf_lookup() - // quickly calculate the potential u and force f at angle x, - // using the internal tables tb->e and tb->f (evenly spaced) - // ----------------------------------------------------------- - enum{LINEAR,SPLINE}; - - inline void uf_lookup(int type, double x, double &u, double &f) - { - Table *tb = &tables[tabindex[type]]; - double x_over_delta = x*tb->invdelta; - int i = static_cast (x_over_delta); - double a; - double b = x_over_delta - i; - // Apply periodic boundary conditions to indices i and i+1 - if (i >= tablength) i -= tablength; - int ip1 = i+1; if (ip1 >= tablength) ip1 -= tablength; - - switch(tabstyle) { - case LINEAR: - u = tb->e[i] + b * tb->de[i]; - f = -(tb->f[i] + b * tb->df[i]); //<--works even if tb->f_unspecified==true - break; - case SPLINE: - a = 1.0 - b; - u = a * tb->e[i] + b * tb->e[ip1] + - ((a*a*a-a)*tb->e2[i] + (b*b*b-b)*tb->e2[ip1]) * - tb->deltasq6; - if (tb->f_unspecified) - //Formula below taken from equation3.3.5 of "numerical recipes in c" - //"f"=-derivative of e with respect to x (or "phi" in this case) - f = -((tb->e[i]-tb->e[ip1])*tb->invdelta + - ((3.0*a*a-1.0)*tb->e2[i]+(1.0-3.0*b*b)*tb->e2[ip1])*tb->delta/6.0); - else - f = -(a * tb->f[i] + b * tb->f[ip1] + - ((a*a*a-a)*tb->f2[i] + (b*b*b-b)*tb->f2[ip1]) * - tb->deltasq6); - break; - } // switch(tabstyle) - } // uf_lookup() - - - // ---------------------------------------------------------- - // u_lookup() - // quickly calculate the potential u at angle x using tb->e - //----------------------------------------------------------- - - inline void u_lookup(int type, double x, double &u) - { - Table *tb = &tables[tabindex[type]]; - int N = tablength; - - // i = static_cast ((x - tb->lo) * tb->invdelta); <-general version - double x_over_delta = x*tb->invdelta; - int i = static_cast (x_over_delta); - double b = x_over_delta - i; - - // Apply periodic boundary conditions to indices i and i+1 - if (i >= N) i -= N; - int ip1 = i+1; if (ip1 >= N) ip1 -= N; - - if (tabstyle == LINEAR) { - u = tb->e[i] + b * tb->de[i]; - } - else if (tabstyle == SPLINE) { - double a = 1.0 - b; - u = a * tb->e[i] + b * tb->e[ip1] + - ((a*a*a-a)*tb->e2[i] + (b*b*b-b)*tb->e2[ip1]) * - tb->deltasq6; - } - } // u_lookup() - - + virtual void allocate(); }; } From 1e3f1c584c569601efef6111babd3b3302dde656 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 08:12:37 -0400 Subject: [PATCH 160/370] simplify by using utils::strdup() fmt::format() and reorder includes --- src/USER-MISC/fix_orient_eco.cpp | 4 +- src/USER-MISC/fix_pafi.cpp | 4 +- src/USER-MISC/fix_wall_region_ees.cpp | 5 +-- src/USER-MISC/temper_grem.cpp | 26 ++++++------ src/USER-MOLFILE/dump_molfile.cpp | 11 ++--- src/USER-PHONON/fix_phonon.cpp | 61 +++++++++++---------------- src/USER-PLUMED/fix_plumed.cpp | 27 +++++------- src/USER-PTM/compute_ptm_atom.cpp | 11 ++--- src/USER-QTB/fix_qbmsst.cpp | 20 ++++----- src/USER-QTB/fix_qtb.cpp | 24 +++++------ src/USER-QUIP/pair_quip.cpp | 37 +++++++--------- src/USER-REACTION/fix_bond_react.cpp | 48 +++++---------------- src/USER-REAXC/fix_qeq_reax.cpp | 28 ++++++------ src/USER-REAXC/fix_reaxc_species.cpp | 19 +++++---- src/USER-SCAFACOS/scafacos.cpp | 17 ++++---- src/USER-SMD/fix_smd_setvel.cpp | 16 ++----- src/USER-SMD/fix_smd_wall_surface.cpp | 38 +++-------------- src/USER-SMD/fix_smd_wall_surface.h | 1 - 18 files changed, 151 insertions(+), 246 deletions(-) diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index ce412e6fc9..3d6db4cd4f 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -87,9 +87,7 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : // read reference orientations from file // work on rank 0 only - int n = strlen(arg[6]) + 1; - dir_filename = new char[n]; - strcpy(dir_filename, arg[6]); + dir_filename = utils::strdup(arg[6]); if (me == 0) { char line[IMGMAX]; char *result; diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index ec0733657a..c2ad62d7d0 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -74,9 +74,7 @@ FixPAFI::FixPAFI(LAMMPS *lmp, int narg, char **arg) : com_flag = 1; time_integrate = 1; - int n = strlen(arg[3])+1; - computename = new char[n]; - strcpy(computename,&arg[3][0]); + computename = utils::strdup(&arg[3][0]); icompute = modify->find_compute(computename); if (icompute == -1) diff --git a/src/USER-MISC/fix_wall_region_ees.cpp b/src/USER-MISC/fix_wall_region_ees.cpp index 44067b0742..51e0af9dc4 100644 --- a/src/USER-MISC/fix_wall_region_ees.cpp +++ b/src/USER-MISC/fix_wall_region_ees.cpp @@ -52,10 +52,7 @@ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : iregion = domain->find_region(arg[3]); if (iregion == -1) error->all(FLERR,"Region ID for fix wall/region/ees does not exist"); - int n = strlen(arg[3]) + 1; - idregion = new char[n]; - strcpy(idregion,arg[3]); - + idregion = utils::strdup(arg[3]); epsilon = utils::numeric(FLERR,arg[4],false,lmp); sigma = utils::numeric(FLERR,arg[5],false,lmp); cutoff = utils::numeric(FLERR,arg[6],false,lmp); diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index ee3c5ae5e4..3b987aaad2 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -16,21 +16,23 @@ ------------------------------------------------------------------------- */ #include "temper_grem.h" -#include -#include -#include "fix_grem.h" -#include "universe.h" + +#include "compute.h" #include "domain.h" -#include "update.h" +#include "error.h" +#include "finish.h" +#include "fix.h" +#include "fix_grem.h" +#include "force.h" #include "integrate.h" #include "modify.h" -#include "compute.h" -#include "force.h" -#include "fix.h" #include "random_park.h" -#include "finish.h" #include "timer.h" -#include "error.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -90,9 +92,7 @@ void TemperGrem::command(int narg, char **arg) double pressref = 0; // Get and check for nh fix - int n = strlen(arg[4])+1; - id_nh = new char[n]; - strcpy(id_nh,arg[4]); + id_nh = utils::strdup(arg[4]); int ifix = modify->find_fix(id_nh); if (ifix < 0) error->all(FLERR,"Fix id for nvt or npt fix does not exist"); diff --git a/src/USER-MOLFILE/dump_molfile.cpp b/src/USER-MOLFILE/dump_molfile.cpp index 9de9a79e26..20790d4b32 100644 --- a/src/USER-MOLFILE/dump_molfile.cpp +++ b/src/USER-MOLFILE/dump_molfile.cpp @@ -17,15 +17,16 @@ #include "dump_molfile.h" -#include -#include -#include "domain.h" #include "atom.h" #include "comm.h" -#include "update.h" +#include "domain.h" +#include "error.h" #include "group.h" #include "memory.h" -#include "error.h" +#include "update.h" + +#include +#include #include "molfile_interface.h" diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index 30fb7baad5..222f3fa1d2 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -23,21 +23,22 @@ konglt@sjtu.edu.cn; konglt@gmail.com ------------------------------------------------------------------------- */ +#include "fix_phonon.h" + +#include "atom.h" +#include "citeme.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "fft3d_wrap.h" +#include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "update.h" #include #include -#include "fix_phonon.h" -#include "fft3d_wrap.h" -#include "atom.h" -#include "compute.h" -#include "domain.h" -#include "force.h" -#include "group.h" -#include "modify.h" -#include "update.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -77,15 +78,9 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) waitsteps = utils::bnumeric(FLERR,arg[5],false,lmp); // Wait this many timesteps before actually measuring if (waitsteps < 0) error->all(FLERR,"Illegal fix phonon command: waitsteps < 0 !"); - int n = strlen(arg[6]) + 1; // map file - mapfile = new char[n]; - strcpy(mapfile, arg[6]); - - n = strlen(arg[7]) + 1; // prefix of output - prefix = new char[n]; - strcpy(prefix, arg[7]); - logfile = new char[n+4]; - sprintf(logfile,"%s.log",prefix); + mapfile = utils::strdup(arg[6]); + prefix = utils::strdup(arg[7]); + logfile = utils::strdup(std::string(prefix)+".log"); int sdim = sysdim = domain->dimension; int iarg = 8; @@ -184,11 +179,9 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // output some information on the system to log file if (me == 0) { flog = fopen(logfile, "w"); - if (flog == nullptr) { - char str[MAXLINE]; - sprintf(str,"Can not open output file %s",logfile); - error->one(FLERR,str); - } + if (flog == nullptr) + error->one(FLERR,fmt::format("Can not open output file {}: {}", + logfile,utils::getsyserror())); fprintf(flog,"############################################################\n"); fprintf(flog,"# group name of the atoms under study : %s\n", group->names[igroup]); fprintf(flog,"# total number of atoms in the group : %d\n", ngroup); @@ -440,9 +433,7 @@ int FixPhonon::modify_param(int narg, char **arg) if (strcmp(arg[0],"temp") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) error->all(FLERR,"Could not find fix_modify temp ID"); @@ -563,10 +554,9 @@ void FixPhonon::readmap() // read from map file for others char line[MAXLINE]; FILE *fp = fopen(mapfile, "r"); - if (fp == nullptr) { - sprintf(line,"Cannot open input map file %s", mapfile); - error->all(FLERR,line); - } + if (fp == nullptr) + error->all(FLERR,fmt::format("Cannot open input map file {}: {}", + mapfile, utils::getsyserror())); if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading header of mapping file!"); @@ -712,9 +702,8 @@ void FixPhonon::postprocess( ) // write binary file, in fact, it is the force constants matrix that is written // Enforcement of ASR and the conversion of dynamical matrix is done in the postprocessing code - char fname[MAXLINE]; - sprintf(fname,"%s.bin." BIGINT_FORMAT,prefix,update->ntimestep); - FILE *fp_bin = fopen(fname,"wb"); + auto fname = fmt::format("{}.bin.{}",prefix,update->ntimestep); + FILE *fp_bin = fopen(fname.c_str(),"wb"); fwrite(&sysdim, sizeof(int), 1, fp_bin); fwrite(&nx, sizeof(int), 1, fp_bin); diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 1217237e19..8d3cdd5c34 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -16,25 +16,24 @@ Pablo Piaggi (EPFL) ------------------------------------------------------------------------- */ -#include - -#include +#include "fix_plumed.h" #include "atom.h" #include "comm.h" -#include "update.h" -#include "force.h" -#include "respa.h" +#include "compute.h" #include "domain.h" #include "error.h" +#include "force.h" #include "group.h" -#include "fix_plumed.h" -#include "universe.h" -#include "compute.h" #include "modify.h" #include "pair.h" - +#include "respa.h" #include "timer.h" +#include "universe.h" +#include "update.h" + +#include +#include #include "plumed/wrapper/Plumed.h" @@ -542,9 +541,7 @@ int FixPlumed::modify_param(int narg, char **arg) if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); modify->delete_compute(id_pe); delete[] id_pe; - int n = strlen(arg[1]) + 1; - id_pe = new char[n]; - strcpy(id_pe,arg[1]); + id_pe = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify potential energy ID"); @@ -561,9 +558,7 @@ int FixPlumed::modify_param(int narg, char **arg) if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); modify->delete_compute(id_press); delete[] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(arg[1]); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/USER-PTM/compute_ptm_atom.cpp b/src/USER-PTM/compute_ptm_atom.cpp index 376253dd84..0622b9dcc0 100644 --- a/src/USER-PTM/compute_ptm_atom.cpp +++ b/src/USER-PTM/compute_ptm_atom.cpp @@ -17,23 +17,24 @@ under ------------------------------------------------------------------------- */ #include "compute_ptm_atom.h" -#include -#include -#include -#include #include "atom.h" #include "citeme.h" #include "comm.h" #include "error.h" #include "force.h" +#include "group.h" #include "memory.h" #include "modify.h" #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" #include "update.h" -#include "group.h" + +#include +#include +#include +#include #include "ptm_functions.h" diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 0b54811db0..a9dfb83f06 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -19,17 +19,17 @@ #include "fix_qbmsst.h" #include "atom.h" -#include "force.h" -#include "update.h" -#include "modify.h" +#include "comm.h" #include "compute.h" #include "domain.h" -#include "comm.h" -#include "random_mars.h" -#include "memory.h" #include "error.h" +#include "force.h" #include "kspace.h" #include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "update.h" #include #include @@ -869,9 +869,7 @@ int FixQBMSST::modify_param(int narg, char **arg) tflag = 0; } delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); @@ -891,9 +889,7 @@ int FixQBMSST::modify_param(int narg, char **arg) pflag = 0; } delete [] id_press; - int n = strlen(arg[1]) + 1; - id_press = new char[n]; - strcpy(id_press,arg[1]); + id_press = utils::strdup(arg[1]); int icompute = modify->find_compute(id_press); if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index 4c79fbeaae..e4e645a1bb 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -18,20 +18,20 @@ #include "fix_qtb.h" -#include -#include - #include "atom.h" -#include "force.h" -#include "update.h" -#include "modify.h" -#include "compute.h" -#include "respa.h" #include "comm.h" -#include "random_mars.h" +#include "compute.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "random_mars.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -345,9 +345,7 @@ int FixQTB::modify_param(int narg, char **arg) if (strcmp(arg[0],"temp") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); delete [] id_temp; - int n = strlen(arg[1]) + 1; - id_temp = new char[n]; - strcpy(id_temp,arg[1]); + id_temp = utils::strdup(arg[1]); int icompute = modify->find_compute(id_temp); if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index f850925764..2d338da158 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -16,21 +16,21 @@ Aidan Thompson (Sandia, athomps@sandia.gov) ------------------------------------------------------------------------- */ -#include -#include - -#include #include "pair_quip.h" + #include "atom.h" -#include "update.h" -#include "force.h" #include "comm.h" -#include "neighbor.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" -#include "domain.h" +#include "neighbor.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -252,24 +252,17 @@ void PairQUIP::coeff(int narg, char **arg) if (!allocated) allocate(); int n = atom->ntypes; - if (narg != (4+n)) { - char str[1024]; - sprintf(str,"Number of arguments %d is not correct, it should be %d", narg, 4+n); - error->all(FLERR,str); - } + if (narg != (4+n)) + error->all(FLERR,fmt::format("Number of arguments {} is not correct, " + "it should be {}", narg, 4+n)); // ensure I,J args are * * if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - n_quip_file = strlen(arg[2]); - quip_file = new char[n_quip_file+1]; - strcpy(quip_file,arg[2]); - - n_quip_string = strlen(arg[3]); - quip_string = new char[n_quip_string+1]; - strcpy(quip_string,arg[3]); + quip_file = utils::strdup(arg[2]); + quip_string = utils::strdup(arg[3]); for (int i = 4; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 91354506d1..201949a874 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -169,9 +169,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix bond/react command:" "'stabilization' keyword has too few arguments"); - int n = strlen(arg[iarg+2]) + 1; - exclude_group = new char[n]; - strcpy(exclude_group,arg[iarg+2]); + exclude_group = utils::strdup(arg[iarg+2]); stabilization_flag = 1; nve_limit_xmax = arg[iarg+3]; iarg += 4; @@ -273,9 +271,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : groupbits[rxn] = group->bitmask[groupid]; if (strncmp(arg[iarg],"v_",2) == 0) { - n = strlen(&arg[iarg][2]) + 1; - char *str = new char[n]; - strcpy(str,&arg[iarg][2]); + char *str = utils::strdup(&arg[iarg][2]); var_id[NEVERY][rxn] = input->variable->find(str); if (var_id[NEVERY][rxn] < 0) error->all(FLERR,"Bond/react: Variable name does not exist"); @@ -291,9 +287,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : iarg++; if (strncmp(arg[iarg],"v_",2) == 0) { - n = strlen(&arg[iarg][2]) + 1; - char *str = new char[n]; - strcpy(str,&arg[iarg][2]); + char *str = utils::strdup(&arg[iarg][2]); var_id[RMIN][rxn] = input->variable->find(str); if (var_id[RMIN][rxn] < 0) error->all(FLERR,"Bond/react: Variable name does not exist"); @@ -312,9 +306,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : iarg++; if (strncmp(arg[iarg],"v_",2) == 0) { - n = strlen(&arg[iarg][2]) + 1; - char *str = new char[n]; - strcpy(str,&arg[iarg][2]); + char *str = utils::strdup(&arg[iarg][2]); var_id[RMAX][rxn] = input->variable->find(str); if (var_id[RMAX][rxn] < 0) error->all(FLERR,"Bond/react: Variable name does not exist"); @@ -340,8 +332,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : "fix bond/react does not exist"); //read superimpose file - files[rxn] = new char[strlen(arg[iarg])+1]; - strcpy(files[rxn],arg[iarg]); + files[rxn] = utils::strdup(arg[iarg]); iarg++; while (iarg < narg && strcmp(arg[iarg],"react") != 0) { @@ -350,9 +341,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : "'prob' keyword has too few arguments"); // check if probability is a variable if (strncmp(arg[iarg+1],"v_",2) == 0) { - int n = strlen(&arg[iarg+1][2]) + 1; - char *str = new char[n]; - strcpy(str,&arg[iarg+1][2]); + char *str = utils::strdup(&arg[iarg+1][2]); var_id[PROB][rxn] = input->variable->find(str); if (var_id[PROB][rxn] < 0) error->all(FLERR,"Bond/react: Variable name does not exist"); @@ -727,21 +716,14 @@ void FixBondReact::post_constructor() fix3 = modify->fix[modify->nfix-1]; } - len = strlen("statted_tags") + 1; - statted_id = new char[len]; - strcpy(statted_id,"statted_tags"); + statted_id = utils::strdup("statted_tags"); // if static group exists, use as parent group // also, rename dynamic exclude_group by appending '_REACT' char *exclude_PARENT_group; - int n = strlen(exclude_group) + 1; - exclude_PARENT_group = new char[n]; - strcpy(exclude_PARENT_group,exclude_group); - n += strlen("_REACT"); + exclude_PARENT_group = utils::strdup(exclude_group); delete [] exclude_group; - exclude_group = new char[n]; - strcpy(exclude_group,exclude_PARENT_group); - strcat(exclude_group,"_REACT"); + exclude_group = utils::strdup(std::string(exclude_PARENT_group)+"_REACT"); group->find_or_create(exclude_group); if (groupid == -1) @@ -766,13 +748,8 @@ void FixBondReact::post_constructor() // sleeping code, for future capabilities custom_exclude_flag = 1; // first we have to find correct fix group reference - int n = strlen("GROUP_") + strlen(exclude_group) + 1; - char *fix_group = new char[n]; - strcpy(fix_group,"GROUP_"); - strcat(fix_group,exclude_group); - int ifix = modify->find_fix(fix_group); + int ifix = modify->find_fix(std::string("GROUP_")+exclude_group); Fix *fix = modify->fix[ifix]; - delete [] fix_group; // this returns names of corresponding property int unused; @@ -780,10 +757,7 @@ void FixBondReact::post_constructor() idprop = (char *) fix->extract("property",unused); if (idprop == nullptr) error->all(FLERR,"Exclude group must be a per-atom property group"); - - len = strlen(idprop) + 1; - statted_id = new char[len]; - strcpy(statted_id,idprop); + statted_id = utils::strdup(idprop); // initialize per-atom statted_tags to 1 // need to correct for smooth restarts diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 355cbbb770..44088043f0 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -20,22 +20,24 @@ #include "fix_qeq_reax.h" -#include -#include -#include "pair_reaxc.h" #include "atom.h" +#include "citeme.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" +#include "error.h" #include "force.h" #include "group.h" -#include "pair.h" -#include "respa.h" #include "memory.h" -#include "citeme.h" -#include "error.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "pair_reaxc.h" +#include "respa.h" +#include "update.h" + +#include +#include + #include "reaxc_defs.h" #include "reaxc_types.h" @@ -70,9 +72,7 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : swa = utils::numeric(FLERR,arg[4],false,lmp); swb = utils::numeric(FLERR,arg[5],false,lmp); tolerance = utils::numeric(FLERR,arg[6],false,lmp); - int len = strlen(arg[7]) + 1; - pertype_option = new char[len]; - strcpy(pertype_option,arg[7]); + pertype_option = utils::strdup(arg[7]); // dual CG support only available for USER-OMP variant // check for compatibility is in Fix::post_constructor() diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index e90cde2529..81b1dafa61 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -18,20 +18,21 @@ #include "fix_reaxc_species.h" - -#include -#include "fix_ave_atom.h" #include "atom.h" -#include "domain.h" -#include "update.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" #include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_ave_atom.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" #include "pair_reaxc.h" +#include "update.h" + +#include + #include "reaxc_defs.h" using namespace LAMMPS_NS; diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index 0ce027ec1e..fa12cffe4c 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -15,21 +15,22 @@ Contributing author: Rene Halver (JSC) ------------------------------------------------------------------------- */ -#include -#include -#include #include "scafacos.h" + #include "atom.h" #include "comm.h" #include "domain.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" + +#include +#include +#include +#include // ScaFaCoS library -#include -#include #include "fcs.h" using namespace LAMMPS_NS; @@ -54,9 +55,7 @@ void Scafacos::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal scafacos command"); - int n = strlen(arg[0]) + 1; - method = new char[n]; - strcpy(method,arg[0]); + method = utils::strdup(arg[0]); tolerance = utils::numeric(FLERR,arg[1],false,lmp); // optional ScaFaCoS library setting defaults diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index f4c23e9f7a..471159ea53 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -60,9 +60,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : xstr = ystr = zstr = nullptr; if (strstr(arg[3], "v_") == arg[3]) { - int n = strlen(&arg[3][2]) + 1; - xstr = new char[n]; - strcpy(xstr, &arg[3][2]); + xstr = utils::strdup( &arg[3][2]); } else if (strcmp(arg[3], "NULL") == 0) { xstyle = NONE; } else { @@ -70,9 +68,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : xstyle = CONSTANT; } if (strstr(arg[4], "v_") == arg[4]) { - int n = strlen(&arg[4][2]) + 1; - ystr = new char[n]; - strcpy(ystr, &arg[4][2]); + ystr = utils::strdup( &arg[4][2]); } else if (strcmp(arg[4], "NULL") == 0) { ystyle = NONE; } else { @@ -80,9 +76,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : ystyle = CONSTANT; } if (strstr(arg[5], "v_") == arg[5]) { - int n = strlen(&arg[5][2]) + 1; - zstr = new char[n]; - strcpy(zstr, &arg[5][2]); + zstr = utils::strdup( &arg[5][2]); } else if (strcmp(arg[5], "NULL") == 0) { zstyle = NONE; } else { @@ -103,9 +97,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : iregion = domain->find_region(arg[iarg + 1]); if (iregion == -1) error->all(FLERR, "Region ID for fix setvelocity does not exist"); - int n = strlen(arg[iarg + 1]) + 1; - idregion = new char[n]; - strcpy(idregion, arg[iarg + 1]); + idregion = utils::strdup( arg[iarg + 1]); iarg += 2; } else error->all(FLERR, "Illegal fix setvelocity command"); diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index f37c9ec873..e9d32b5684 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -184,32 +184,6 @@ void FixSMDWallSurface::setup(int /*vflag*/) { read_triangles(0); } -/* ---------------------------------------------------------------------- - function to determine number of values in a text line - ------------------------------------------------------------------------- */ - -int FixSMDWallSurface::count_words(const char *line) { - int n = strlen(line) + 1; - char *copy; - memory->create(copy, n, "atom:copy"); - strcpy(copy, line); - - char *ptr; - if ((ptr = strchr(copy, '#'))) - *ptr = '\0'; - - if (strtok(copy, " \t\n\r\f") == nullptr) { - memory->destroy(copy); - return 0; - } - n = 1; - while (strtok(nullptr, " \t\n\r\f")) - n++; - - memory->destroy(copy); - return n; -} - /* ---------------------------------------------------------------------- size of atom nlocal's restart data ------------------------------------------------------------------------- */ @@ -265,7 +239,7 @@ void FixSMDWallSurface::read_triangles(int pass) { error->one(FLERR,"error reading number of triangle pairs"); } - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords < 1) { error->one(FLERR,"first line of file is incorrect"); } @@ -290,7 +264,7 @@ void FixSMDWallSurface::read_triangles(int pass) { while (fgets(line, sizeof(line), fp)) { // read a line, should be the facet line // evaluate facet line - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords != 5) { //sprintf(str, "found end solid line"); //error->message(FLERR, str); @@ -322,7 +296,7 @@ void FixSMDWallSurface::read_triangles(int pass) { error->one(FLERR, "error reading outer loop"); } - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords != 2) { error->one(FLERR,"error reading outer loop"); } @@ -335,7 +309,7 @@ void FixSMDWallSurface::read_triangles(int pass) { error->one(FLERR,"error reading vertex line"); } - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords != 4) { error->one(FLERR,"error reading vertex line"); } @@ -366,7 +340,7 @@ void FixSMDWallSurface::read_triangles(int pass) { error->one(FLERR, "error reading endloop"); } - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords != 1) { error->one(FLERR,"error reading endloop"); } @@ -377,7 +351,7 @@ void FixSMDWallSurface::read_triangles(int pass) { error->one(FLERR,"error reading endfacet"); } - nwords = count_words(line); + nwords = utils::count_words(line); if (nwords != 1) { error->one(FLERR,"error reading endfacet"); } diff --git a/src/USER-SMD/fix_smd_wall_surface.h b/src/USER-SMD/fix_smd_wall_surface.h index 10f80c4ca8..3ff2b49737 100644 --- a/src/USER-SMD/fix_smd_wall_surface.h +++ b/src/USER-SMD/fix_smd_wall_surface.h @@ -34,7 +34,6 @@ public: void setup(int); void min_setup(int); - int count_words(const char *line); void read_triangles(int pass); private: From 9058216a5421b2a292711ce06e48360ef23832ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 14:11:56 -0400 Subject: [PATCH 161/370] silence compiler warnings --- src/USER-COLVARS/ndx_group.cpp | 4 +--- src/USER-DPD/pair_exp6_rx.cpp | 1 - src/USER-MISC/dihedral_table_cut.cpp | 5 ----- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index 184faa62cc..d8d5632b06 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -78,7 +78,6 @@ void Ndx2Group::command(int narg, char **arg) int len; bigint num; FILE *fp; - tagint *tagbuf; std::string name = "", next; if (narg < 1) error->all(FLERR,"Illegal ndx2group command"); @@ -191,11 +190,10 @@ void Ndx2Group::create(const std::string &name, const std::vector &tags) // map from global to local const int nlocal = atom->nlocal; int *flags = (int *)calloc(nlocal,sizeof(int)); - for (bigint i=0; i < tags.size(); ++i) { + for (bigint i=0; i < (int)tags.size(); ++i) { const int id = atom->map(tags[i]); if (id < nlocal && id >= 0) flags[id] = 1; } group->create(name,flags); free(flags); } - diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index ba8d52776f..396047fca9 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -587,7 +587,6 @@ void PairExp6rx::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - int n; utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index dc7a6f9685..02e6d3e5da 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -134,11 +134,6 @@ static double cyc_splintD(double const *xa, } // cyc_splintD() -// -------------------------------------------- -// ------- Calculate the dihedral angle ------- -// -------------------------------------------- -static const int g_dim=3; - /* ---------------------------------------------------------------------- */ DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : DihedralTable(lmp) From aaf9aa6d69b1ba06ff9df5a40c2384f79b8c32a5 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 29 Mar 2021 14:27:42 -0400 Subject: [PATCH 162/370] Refactoring of more tests --- unittest/commands/test_kim_commands.cpp | 183 +++++------ unittest/commands/test_lattice_region.cpp | 170 ++++------ unittest/commands/test_reset_ids.cpp | 149 ++++----- unittest/commands/test_variables.cpp | 153 ++++----- unittest/formats/compressed_dump_test.h | 16 +- unittest/formats/test_atom_styles.cpp | 299 +++++++++--------- unittest/formats/test_dump_atom.cpp | 36 +-- .../formats/test_dump_atom_compressed.cpp | 8 +- unittest/formats/test_dump_cfg.cpp | 8 +- unittest/formats/test_dump_cfg_compressed.cpp | 8 +- unittest/formats/test_dump_custom.cpp | 32 +- .../formats/test_dump_local_compressed.cpp | 12 +- unittest/formats/test_dump_xyz_compressed.cpp | 8 +- .../test_eim_potential_file_reader.cpp | 44 ++- unittest/formats/test_file_operations.cpp | 43 +-- unittest/formats/test_image_flags.cpp | 51 ++- unittest/formats/test_molecule_file.cpp | 47 +-- unittest/formats/test_pair_unit_convert.cpp | 186 ++++++----- unittest/testing/core.h | 21 +- 19 files changed, 627 insertions(+), 847 deletions(-) diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 2d044b86eb..83e1e5b2d2 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -22,6 +22,7 @@ #include "variable.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -29,57 +30,23 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::MatchesRegex; using ::testing::StrEq; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } -class KimCommandsTest : public ::testing::Test { +class KimCommandsTest : public LAMMPSTest { protected: - LAMMPS *lmp; Variable *variable; void SetUp() override { - const char *args[] = {"KimCommandsTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "KimCommandsTest"; + LAMMPSTest::SetUp(); variable = lmp->input->variable; } - - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(KimCommandsTest, kim) @@ -115,9 +82,9 @@ TEST_F(KimCommandsTest, kim_init) // TEST_FAILURE(".*ERROR: KIM Model does not support the requested unit system.*", // command("kim init ex_model_Ar_P_Morse real");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim init LennardJones_Ar real"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); int ifix = lmp->modify->find_fix("KIM_MODEL_STORE"); ASSERT_GE(ifix, 0); @@ -129,81 +96,81 @@ TEST_F(KimCommandsTest, kim_interactions) TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", command("kim interactions");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim init LennardJones_Ar real"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Must use 'kim interactions' command " "after simulation box is defined.*", command("kim interactions Ar");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim init LennardJones_Ar real"); command("lattice fcc 4.4300"); command("region box block 0 10 0 10 0 10"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", command("kim interactions Ar Ar");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("lattice fcc 4.4300"); command("region box block 0 20 0 20 0 20"); command("create_box 4 box"); command("create_atoms 4 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal 'kim interactions' command.*", command("kim interactions Ar Ar");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("lattice fcc 4.4300"); command("region box block 0 10 0 10 0 10"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Must use 'kim init' before 'kim interactions'.*", command("kim interactions Ar");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones_Ar real"); command("lattice fcc 4.4300"); command("region box block 0 10 0 10 0 10"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: fixed_types cannot be used with a KIM Portable Model.*", command("kim interactions fixed_types");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("pair_style kim LennardJones_Ar"); command("region box block 0 1 0 1 0 1"); command("create_box 4 box"); command("pair_coeff * * Ar Ar Ar Ar"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); command("lattice fcc 4.920"); command("region box block 0 10 0 10 0 10"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Species 'Ar' is not supported by this KIM Simulator Model.*", command("kim interactions Ar");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); command("lattice fcc 4.08"); @@ -211,13 +178,13 @@ TEST_F(KimCommandsTest, kim_interactions) command("create_box 1 box"); command("create_atoms 1 box"); command("kim interactions Au"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // ASSERT_EQ(lmp->output->var_kim_periodic, 1); // TEST_FAILURE(".*ERROR: Incompatible units for KIM Simulator Model.*", // command("kim interactions Au");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones_Ar real"); command("lattice fcc 4.4300"); @@ -226,12 +193,12 @@ TEST_F(KimCommandsTest, kim_interactions) command("create_atoms 1 box"); command("kim interactions Ar"); command("mass 1 39.95"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); int ifix = lmp->modify->find_fix("KIM_MODEL_STORE"); ASSERT_GE(ifix, 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones_Ar real"); command("lattice fcc 4.4300"); @@ -243,7 +210,7 @@ TEST_F(KimCommandsTest, kim_interactions) command("run 1"); command("kim interactions Ar"); command("run 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } TEST_F(KimCommandsTest, kim_param) @@ -255,18 +222,18 @@ TEST_F(KimCommandsTest, kim_param) "'kim param get/set' is mandatory.*", command("kim param unknown shift 1 shift");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu metal"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: 'kim param' can only be used with a KIM Portable Model.*", command("kim param get shift 1 shift");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal 'kim param get' command.\nTo get the new " "parameter values, pair style must be assigned.\nMust use 'kim" @@ -278,7 +245,7 @@ TEST_F(KimCommandsTest, kim_param) " interactions' or 'pair_style kim' before 'kim param set'.*", command("kim param set shift 1 2");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); command("lattice fcc 4.4300"); @@ -287,7 +254,7 @@ TEST_F(KimCommandsTest, kim_param) command("create_atoms 1 box"); command("kim interactions Ar"); command("mass 1 39.95"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal index '0' for " "'shift' parameter with the extent of '1'.*", @@ -312,9 +279,9 @@ TEST_F(KimCommandsTest, kim_param) "Model does not have the requested 'unknown' parameter.*", command("kim param get unknown 1 unknown");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get shift 1 shift"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_FALSE(variable->find("shift") == -1); ASSERT_THAT(variable->retrieve("shift"), StrEq("1")); @@ -334,11 +301,11 @@ TEST_F(KimCommandsTest, kim_param) "Model does not have the requested '0.4989030' parameter.*", command("kim param set sigmas 1:1 0.5523570 0.4989030");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable new_shift equal 2"); command("kim param set shift 1 ${new_shift}"); command("kim param get shift 1 shift"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("shift"), StrEq("2")); @@ -363,51 +330,51 @@ TEST_F(KimCommandsTest, kim_param) "split' is mandatory.*", command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 cutoffs_3 explicit"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get cutoffs 1:3 cutoffs split"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs_1"), StrEq("2.20943")); ASSERT_THAT(variable->retrieve("cutoffs_2"), StrEq("2.10252")); ASSERT_THAT(variable->retrieve("cutoffs_3"), StrEq("5.666115")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get cutoffs 1:3 cutoffs list"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.20943 2.10252 5.666115")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param set cutoffs 1 2.21 cutoffs 2 2.11"); command("kim param get cutoffs 1:2 cutoffs list"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.21 2.11")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param set cutoffs 1:3 2.3 2.2 5.7"); command("kim param get cutoffs 1:3 cutoffs list"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("cutoffs"), StrEq("2.3 2.2 5.7")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("lattice fcc 4.4300"); @@ -417,19 +384,19 @@ TEST_F(KimCommandsTest, kim_param) command("mass 1 39.95"); command("pair_style kim LennardJones612_UniversalShifted__MO_959249795837_003"); command("pair_coeff * * Ar"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("kim param get shift 1 shift"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("shift"), StrEq("1")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable new_shift equal 2"); command("kim param set shift 1 ${new_shift}"); command("kim param get shift 1 shift"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("shift"), StrEq("2")); } @@ -467,13 +434,13 @@ TEST_F(KimCommandsTest, kim_property) command("kim property remove 1 key short-name");); TEST_FAILURE(".*ERROR: There is no property instance to dump the content.*", command("kim property dump results.edn");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init LennardJones612_UniversalShifted__MO_959249795837_003 real"); command("kim property create 1 cohesive-potential-energy-cubic-crystal"); command("kim property modify 1 key short-name source-value 1 fcc"); command("kim property destroy 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); #endif } @@ -608,16 +575,16 @@ TEST_F(KimCommandsTest, kim_query) command(squery);); #if defined(KIM_EXTRA_UNITTESTS) - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim query latconst_1 get_lattice_constant_cubic " "crystal=[fcc] species=[Al] units=[angstrom] " "model=[EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("4.032082033157349")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); command("kim query latconst_1 get_lattice_constant_cubic crystal=[fcc] species=[Al] " @@ -626,71 +593,71 @@ TEST_F(KimCommandsTest, kim_query) command("kim query latconst_2 get_lattice_constant_cubic crystal=[fcc] species=[Al] " "units=[angstrom] " "model=[LennardJones612_UniversalShifted__MO_959249795837_003]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("4.032082033157349")); ASSERT_THAT(variable->retrieve("latconst_2"), StrEq("3.328125931322575")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); command("kim query latconst split get_lattice_constant_hexagonal crystal=[hcp] species=[Zr] " "units=[angstrom]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("latconst_1"), StrEq("3.234055244384789")); ASSERT_THAT(variable->retrieve("latconst_2"), StrEq("5.167650199630013")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim query latconst index get_lattice_constant_hexagonal " "crystal=[hcp] species=[Zr] units=[angstrom] " "model=[EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("latconst"), StrEq("3.234055244384789")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable latconst delete"); command("clear"); command("kim init EAM_Dynamo_MendelevAckland_2007v3_Zr__MO_004835508849_000 metal"); command("kim query latconst list get_lattice_constant_hexagonal crystal=[hcp] species=[Zr] " "units=[angstrom]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("latconst"), StrEq("3.234055244384789 5.167650199630013")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim init EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005 metal"); command("kim query alpha get_linear_thermal_expansion_coefficient_cubic " "crystal=[fcc] species=[Al] units=[1/K] temperature=[293.15] " "temperature_units=[K]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("alpha"), StrEq("1.654960564704273e-05")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim query model_list list get_available_models species=[Al]"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); std::string model_list = variable->retrieve("model_list"); auto n = model_list.find("EAM_Dynamo_ErcolessiAdams_1994_Al__MO_123629422045_005"); ASSERT_TRUE(n != std::string::npos); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim query model_name index get_available_models species=[Al]"); command("variable model_name delete"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("kim query model_name index get_available_models " @@ -708,7 +675,7 @@ TEST_F(KimCommandsTest, kim_query) command("kim query model_name index get_available_models " "species=[Al] potential_type=[\"eam\",meam]"); command("variable model_name delete"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); #endif } } // namespace LAMMPS_NS @@ -718,7 +685,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index 2924c75d9f..eb6d577652 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -22,6 +22,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -32,12 +33,6 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { @@ -45,51 +40,22 @@ using ::testing::ExitedWithCode; using ::testing::MatchesRegex; using ::testing::StrEq; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } -class LatticeRegionTest : public ::testing::Test { +class LatticeRegionTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"LatticeRegionTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - lmp->input->one("units metal"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "LatticeRegionTest"; + LAMMPSTest::SetUp(); + command("units metal"); } - - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(LatticeRegionTest, lattice_none) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice none 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::NONE); ASSERT_EQ(lattice->xlattice, 2.0); @@ -103,10 +69,10 @@ TEST_F(LatticeRegionTest, lattice_none) TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice none 1.0 origin");); TEST_FAILURE(".*ERROR: Expected floating point.*", command("lattice none xxx");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units lj"); command("lattice none 1.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); lattice = lmp->domain->lattice; ASSERT_EQ(lattice->xlattice, 1.0); ASSERT_EQ(lattice->ylattice, 1.0); @@ -168,27 +134,27 @@ TEST_F(LatticeRegionTest, lattice_sc) TEST_FAILURE(".*ERROR: Lattice spacings are invalid.*", command("lattice sc 1.0 spacing 1.0 -0.1 1.0");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units lj"); command("lattice sc 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); lattice = lmp->domain->lattice; ASSERT_DOUBLE_EQ(lattice->xlattice, pow(0.5, 1.0 / 3.0)); ASSERT_DOUBLE_EQ(lattice->ylattice, pow(0.5, 1.0 / 3.0)); ASSERT_DOUBLE_EQ(lattice->zlattice, pow(0.5, 1.0 / 3.0)); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice sc 1.0");); } TEST_F(LatticeRegionTest, lattice_bcc) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::BCC); ASSERT_DOUBLE_EQ(lattice->xlattice, sqrt(2.0) * 4.2); @@ -202,18 +168,18 @@ TEST_F(LatticeRegionTest, lattice_bcc) ASSERT_EQ(lattice->basis[1][1], 0.5); ASSERT_EQ(lattice->basis[1][2], 0.5); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice bcc 1.0");); } TEST_F(LatticeRegionTest, lattice_fcc) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 3.5 origin 0.5 0.5 0.5"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::FCC); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.5); @@ -239,18 +205,18 @@ TEST_F(LatticeRegionTest, lattice_fcc) command("lattice fcc 1.0 a1 0.0 1.0 0.0");); TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice fcc 1.0 orient w 1 0 0");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice fcc 1.0");); } TEST_F(LatticeRegionTest, lattice_hcp) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice hcp 3.0 orient z 0 0 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HCP); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0); @@ -283,18 +249,18 @@ TEST_F(LatticeRegionTest, lattice_hcp) command("lattice hcp 1.0 a2 0.0 1.0 0.0");); TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*", command("lattice hcp 1.0 a3 0.0 1.0 0.0");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice hcp 1.0");); } TEST_F(LatticeRegionTest, lattice_diamond) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::DIAMOND); ASSERT_DOUBLE_EQ(lattice->xlattice, 6.6952719636073539); @@ -335,19 +301,19 @@ TEST_F(LatticeRegionTest, lattice_diamond) ASSERT_EQ(lattice->a3[1], 0.0); ASSERT_EQ(lattice->a3[2], 1.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice diamond 1.0");); } TEST_F(LatticeRegionTest, lattice_sq) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); command("lattice sq 3.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ); ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0); @@ -361,19 +327,19 @@ TEST_F(LatticeRegionTest, lattice_sq) TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", command("lattice sq 1.0 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice sq 1.0");); } TEST_F(LatticeRegionTest, lattice_sq2) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); command("lattice sq2 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::SQ2); ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0); @@ -387,19 +353,19 @@ TEST_F(LatticeRegionTest, lattice_sq2) ASSERT_EQ(lattice->basis[1][1], 0.5); ASSERT_EQ(lattice->basis[1][2], 0.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice sq2 1.0");); } TEST_F(LatticeRegionTest, lattice_hex) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); command("lattice hex 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::HEX); ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0); @@ -422,16 +388,16 @@ TEST_F(LatticeRegionTest, lattice_hex) ASSERT_EQ(lattice->a3[1], 0.0); ASSERT_EQ(lattice->a3[2], 1.0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*", command("lattice hex 1.0");); } TEST_F(LatticeRegionTest, lattice_custom) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable a equal 4.34"); command("variable b equal $a*sqrt(3.0)"); command("variable c equal $a*sqrt(8.0/3.0)"); @@ -449,7 +415,7 @@ TEST_F(LatticeRegionTest, lattice_custom) "basis 0.5 0.5 0.625 " "basis $t 0.0 0.125 " "basis $f 0.5 0.125 "); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto lattice = lmp->domain->lattice; ASSERT_EQ(lattice->style, Lattice::CUSTOM); ASSERT_DOUBLE_EQ(lattice->xlattice, 4.34); @@ -495,9 +461,9 @@ TEST_F(LatticeRegionTest, lattice_custom) TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice custom 1.0 basis 0.0 1.0 0");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: No basis atoms in lattice.*", command("lattice custom 1.0");); TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*", command("lattice custom 1.0 origin 0.5 0.5 0.5 basis 0.0 0.0 0.0");); @@ -511,28 +477,28 @@ TEST_F(LatticeRegionTest, lattice_custom) TEST_F(LatticeRegionTest, region_fail) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice none 2.0"); command("region box block 0 1 0 1 0 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Create_atoms command before simulation box is defined.*", command("create_atoms 1 box");); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Cannot create atoms with undefined lattice.*", command("create_atoms 1 box");); } TEST_F(LatticeRegionTest, region_block_lattice) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice sc 1.5"); command("region box block 0 2 0 2 0 2 units lattice"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); auto x = lmp->atom->x; @@ -553,12 +519,12 @@ TEST_F(LatticeRegionTest, region_block_lattice) TEST_F(LatticeRegionTest, region_block_box) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice sc 1.5 origin 0.75 0.75 0.75"); command("region box block 0 2 0 2 0 2 units box"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); auto x = lmp->atom->x; @@ -570,84 +536,84 @@ TEST_F(LatticeRegionTest, region_block_box) TEST_F(LatticeRegionTest, region_cone) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region box cone x 1.0 1.0 0.5 2.1 0.0 2.0"); command("create_box 1 box"); command("create_atoms 1 region box"); command("write_dump all atom init.lammpstrj"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 42); } TEST_F(LatticeRegionTest, region_cylinder) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region box cylinder z 1.0 1.0 2.1 0.0 2.0 "); command("create_box 1 box"); command("create_atoms 1 region box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 114); } TEST_F(LatticeRegionTest, region_prism) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice bcc 2.5 origin 0.75 0.75 0.75"); command("region box prism 0 2 0 2 0 2 0.5 0.0 0.0"); command("create_box 1 box"); command("create_atoms 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 1); ASSERT_EQ(lmp->atom->natoms, 16); } TEST_F(LatticeRegionTest, region_sphere) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region box sphere 1.0 1.0 1.0 1.1"); command("create_box 1 box"); command("create_atoms 1 region box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 14); } TEST_F(LatticeRegionTest, region_union) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region part1 sphere 2.0 1.0 1.0 1.1"); command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); command("region box union 2 part1 part2"); command("create_box 1 box"); command("create_atoms 1 region box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 67); } TEST_F(LatticeRegionTest, region_intersect) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region part1 sphere 2.0 1.0 1.0 1.8"); command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0"); command("region box intersect 2 part1 part2"); command("create_box 1 box"); command("create_atoms 1 region box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 21); } TEST_F(LatticeRegionTest, region_plane) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("lattice fcc 2.5 origin 0.5 0.5 0.5"); command("region box block 0.0 2.0 0.0 2.0 0.0 2.0"); command("region part1 plane 0.5 1.0 0.0 0.75 0.0 0.0"); @@ -656,7 +622,7 @@ TEST_F(LatticeRegionTest, region_plane) command("create_box 1 box"); command("create_atoms 1 region atoms"); command("write_dump all atom init.lammpstrj"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->domain->triclinic, 0); ASSERT_EQ(lmp->atom->natoms, 16); } @@ -668,7 +634,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/commands/test_reset_ids.cpp b/unittest/commands/test_reset_ids.cpp index 89e09b53a6..694fc9ac77 100644 --- a/unittest/commands/test_reset_ids.cpp +++ b/unittest/commands/test_reset_ids.cpp @@ -21,6 +21,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -28,12 +29,6 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { @@ -41,52 +36,23 @@ using ::testing::MatchesRegex; #define GETIDX(i) lmp->atom->map(i) -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val -class ResetIDsTest : public ::testing::Test { +class ResetIDsTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"ResetIDsTest", "-log", "none", "-nocite", "-echo", "screen"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - Info *info = new Info(lmp); + testbinary = "ResetIDsTest"; + LAMMPSTest::SetUp(); if (info->has_style("atom", "full")) { - lmp->input->one("variable input_dir index " STRINGIFY(TEST_INPUT_FOLDER)); - lmp->input->one("include ${input_dir}/in.fourmol"); + BEGIN_HIDE_OUTPUT(); + command("variable input_dir index " STRINGIFY(TEST_INPUT_FOLDER)); + command("include ${input_dir}/in.fourmol"); + END_HIDE_OUTPUT(); } - delete info; - if (!verbose) ::testing::internal::GetCapturedStdout(); } - - void TearDown() override - { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(ResetIDsTest, MolIDAll) @@ -126,9 +92,9 @@ TEST_F(ResetIDsTest, MolIDAll) // the original data file has two different molecule IDs // for two residues of the same molecule/fragment. - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_mol_ids all"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 1); ASSERT_EQ(molid[GETIDX(2)], 1); @@ -168,12 +134,12 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) auto molid = lmp->atom->molecule; // delete two water molecules - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group allwater molecule 3:6"); command("group twowater molecule 4:6:2"); command("delete_atoms group twowater compress no bond yes"); command("reset_mol_ids all"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -230,9 +196,9 @@ TEST_F(ResetIDsTest, DeletePlusAtomID) ASSERT_GE(GETIDX(25), 0); ASSERT_GE(GETIDX(26), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 23); for (int i = 1; i <= 23; ++i) @@ -246,11 +212,11 @@ TEST_F(ResetIDsTest, PartialOffset) auto molid = lmp->atom->molecule; // delete two water molecules - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group allwater molecule 3:6"); command("group nowater subtract all allwater"); command("reset_mol_ids allwater offset 4"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 29); ASSERT_EQ(lmp->atom->map_tag_max, 29); @@ -284,9 +250,9 @@ TEST_F(ResetIDsTest, PartialOffset) ASSERT_EQ(molid[GETIDX(28)], 8); ASSERT_EQ(molid[GETIDX(29)], 8); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_mol_ids nowater offset 0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 1); ASSERT_EQ(molid[GETIDX(2)], 1); @@ -326,13 +292,13 @@ TEST_F(ResetIDsTest, DeleteAdd) auto molid = lmp->atom->molecule; // delete two water molecules - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group allwater molecule 3:6"); command("group twowater molecule 4:6:2"); command("group nowater subtract all allwater"); command("delete_atoms group twowater compress no bond yes mol yes"); command("reset_mol_ids allwater"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -389,17 +355,17 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_GE(GETIDX(25), 0); ASSERT_GE(GETIDX(26), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids sort yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 23); for (int i = 1; i <= 23; ++i) ASSERT_GE(GETIDX(i), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_mol_ids nowater offset 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(1)], 2); ASSERT_EQ(molid[GETIDX(2)], 2); @@ -425,13 +391,13 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(22)], 4); ASSERT_EQ(molid[GETIDX(23)], 4); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_atoms 1 single 0.0 0.0 0.0"); command("create_atoms 2 single 1.0 0.0 0.0"); command("create_atoms 3 single 2.0 0.0 0.0"); command("create_atoms 4 single 3.0 0.0 0.0"); command("reset_mol_ids all single yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 27); ASSERT_EQ(lmp->atom->map_tag_max, 27); @@ -443,9 +409,9 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(26)], 6); ASSERT_EQ(molid[GETIDX(27)], 7); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_mol_ids all single no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(21)], 3); ASSERT_EQ(molid[GETIDX(22)], 3); @@ -455,9 +421,9 @@ TEST_F(ResetIDsTest, DeleteAdd) ASSERT_EQ(molid[GETIDX(26)], 0); ASSERT_EQ(molid[GETIDX(27)], 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_mol_ids all compress no single yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(molid[GETIDX(21)], 21); ASSERT_EQ(molid[GETIDX(22)], 21); @@ -473,12 +439,12 @@ TEST_F(ResetIDsTest, TopologyData) if (lmp->atom->natoms == 0) GTEST_SKIP(); // delete two water molecules - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group allwater molecule 3:6"); command("group twowater molecule 4:6:2"); command("group nowater subtract all allwater"); command("delete_atoms group twowater compress no bond yes mol yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->natoms, 23); ASSERT_EQ(lmp->atom->map_tag_max, 26); @@ -562,9 +528,9 @@ TEST_F(ResetIDsTest, TopologyData) ASSERT_EQ(angle_atom2[GETIDX(24)][0], 24); ASSERT_EQ(angle_atom3[GETIDX(24)][0], 26); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids sort yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); num_bond = lmp->atom->num_bond; num_angle = lmp->atom->num_angle; @@ -679,41 +645,40 @@ TEST_F(ResetIDsTest, DeathTests) command("reset_mol_ids all single xxx");); } -TEST(ResetMolIds, CMDFail) +class ResetMolIDsTest : public LAMMPSTest { +protected: + void SetUp() override + { + testbinary = "ResetIDsTest"; + LAMMPSTest::SetUp(); + } +}; + +TEST_F(ResetMolIDsTest, FailBeforeBox) { - LAMMPS *lmp; - const char *args[] = {"ResetIDsTest", "-log", "none", "-nocite", "-echo", "screen"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Reset_mol_ids command before simulation box is.*", - lmp->input->one("reset_mol_ids all");); + command("reset_mol_ids all");); +} - auto command = [&](const std::string &line) { - lmp->input->one(line.c_str()); - }; - - if (!verbose) ::testing::internal::CaptureStdout(); +TEST_F(ResetMolIDsTest, FailMissingId) +{ + BEGIN_HIDE_OUTPUT(); command("atom_modify id no"); command("region box block 0 1 0 1 0 1"); command("create_box 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*", command("reset_mol_ids all");); +} - if (!verbose) ::testing::internal::CaptureStdout(); +TEST_F(ResetMolIDsTest, FailOnlyMolecular) +{ + BEGIN_HIDE_OUTPUT(); command("clear"); command("region box block 0 1 0 1 0 1"); command("create_box 1 box"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", command("reset_mol_ids all");); - - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); -}; +} } // namespace LAMMPS_NS @@ -722,7 +687,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 45183a2e54..d41ad52e57 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -24,6 +24,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -31,12 +32,6 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - using LAMMPS_NS::MathConst::MY_PI; using LAMMPS_NS::utils::split_words; @@ -45,39 +40,18 @@ using ::testing::ExitedWithCode; using ::testing::MatchesRegex; using ::testing::StrEq; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - if (verbose) std::cout << mesg; \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - if (verbose) std::cout << mesg; \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } -class VariableTest : public ::testing::Test { +class VariableTest : public LAMMPSTest { protected: - LAMMPS *lmp; Group *group; Domain *domain; Variable *variable; void SetUp() override { - const char *args[] = {"VariableTest", "-log", "none", "-echo", "screen", - "-nocite", "-v", "num", "1"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "VariableTest"; + args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"}; + LAMMPSTest::SetUp(); group = lmp->group; domain = lmp->domain; variable = lmp->input->variable; @@ -85,19 +59,14 @@ protected: void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); - std::cout.flush(); + LAMMPSTest::TearDown(); unlink("test_variable.file"); unlink("test_variable.atomfile"); } - void command(const std::string &cmd) { lmp->input->one(cmd); } - void atomic_system() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); command("lattice sc 1.0 origin 0.125 0.125 0.125"); command("region box block -2 2 -2 2 -2 2"); @@ -109,23 +78,23 @@ protected: command("region top block INF INF -2.0 -1.0 INF INF"); command("set region left type 2"); command("set region right type 3"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void molecular_system() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("fix props all property/atom mol rmass q"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable molid atom floor(id/4)+1"); command("variable charge atom 2.0*sin(PI/32*id)"); command("set atom * mol v_molid"); command("set atom * charge v_charge"); command("set type 1 mass 0.5"); command("set type 2*4 mass 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void file_vars() @@ -152,7 +121,7 @@ TEST_F(VariableTest, CreateDelete) { file_vars(); ASSERT_EQ(variable->nvar, 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1 2 3 4"); command("variable two equal 1"); command("variable two equal 2"); @@ -173,11 +142,11 @@ TEST_F(VariableTest, CreateDelete) command("variable ten2 uloop 4"); command("variable ten3 uloop 4 pad"); command("variable dummy index 0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(variable->nvar, 17); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable dummy delete"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(variable->nvar, 16); ASSERT_THAT(variable->retrieve("three"), StrEq("three")); variable->set_string("three", "four"); @@ -235,7 +204,7 @@ TEST_F(VariableTest, AtomicSystem) atomic_system(); file_vars(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1 2 3 4"); command("variable id atom type"); command("variable id atom id"); @@ -262,7 +231,7 @@ TEST_F(VariableTest, AtomicSystem) command("variable rgsum equal sum(v_rg)"); command("variable loop equal v_loop+1"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(variable->atomstyle(variable->find("one")), 0); ASSERT_EQ(variable->atomstyle(variable->find("id")), 1); @@ -294,7 +263,7 @@ TEST_F(VariableTest, AtomicSystem) TEST_F(VariableTest, Expressions) { atomic_system(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1"); command("variable two equal 2"); command("variable three equal v_one+v_two"); @@ -321,7 +290,7 @@ TEST_F(VariableTest, Expressions) command("variable err2 equal v_one%v_ten7"); command("variable err3 equal v_ten7^-v_one"); variable->set("dummy index 1 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); int ivar = variable->find("one"); ASSERT_FALSE(variable->equalstyle(ivar)); @@ -364,7 +333,7 @@ TEST_F(VariableTest, Functions) atomic_system(); file_vars(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1"); command("variable two equal random(1,2,643532)"); command("variable three equal atan2(v_one,1)"); @@ -377,7 +346,7 @@ TEST_F(VariableTest, Functions) command("variable ten equal floor(1.85)+ceil(1.85)"); command("variable ten1 equal tan(v_eight/2.0)"); command("variable ten2 equal asin(-1.0)+acos(0.0)"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99); ASSERT_LT(variable->compute_equal(variable->find("two")), 2.01); @@ -396,74 +365,64 @@ TEST_F(VariableTest, Functions) TEST_F(VariableTest, IfCommand) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if 1>0 then 'print \"bingo!\"'"); - auto text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + auto text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if 1>2 then 'print \"bingo!\"' else 'print \"nope?\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*nope\?.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if (1>=2)&&(0&&1) then 'print \"missed\"' else 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if !1 then 'print \"missed\"' else 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if !(a==b) then 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if x==x|^1==0 then 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("if x!=x|^a!=b then 'print \"bingo!\"'"); - text = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << text; + text = END_CAPTURE_OUTPUT(); + ASSERT_THAT(text, MatchesRegex(".*bingo!.*")); TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*", @@ -492,34 +451,34 @@ TEST_F(VariableTest, NextCommand) { file_vars(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("variable one index 1 2"); command("variable two equal 2"); command("variable three file test_variable.file"); command("variable four loop 2 4"); command("variable five index 1 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 1); ASSERT_THAT(variable->retrieve("three"), StrEq("one")); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("next one"); command("next three"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 2); ASSERT_THAT(variable->retrieve("three"), StrEq("two")); ASSERT_GE(variable->find("one"), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("next one"); command("next three"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // index style variable is deleted if no more next element ASSERT_EQ(variable->find("one"), -1); ASSERT_GE(variable->find("three"), 0); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("next three"); command("next three"); command("next three"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // file style variable is deleted if no more next element ASSERT_EQ(variable->find("three"), -1); @@ -536,7 +495,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/formats/compressed_dump_test.h b/unittest/formats/compressed_dump_test.h index c8afb2aac3..6bc26e123d 100644 --- a/unittest/formats/compressed_dump_test.h +++ b/unittest/formats/compressed_dump_test.h @@ -45,14 +45,14 @@ public: void enable_triclinic() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all triclinic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_dump(std::string dump_file, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all {} 1 {}", dump_style, dump_file)); if (!dump_modify_options.empty()) { @@ -60,7 +60,7 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file, @@ -76,7 +76,7 @@ public: std::string text_modify_options, std::string compressed_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, text_options)); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, compressed_options)); @@ -89,17 +89,17 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } std::string convert_compressed_to_text(std::string compressed_file) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.')); std::string cmdline = fmt::format("{} -d -c {} > {}", COMPRESS_BINARY, compressed_file, converted_file); system(cmdline.c_str()); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); return converted_file; } }; diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index b787076495..67ee9742e5 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -24,6 +24,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -98,38 +99,28 @@ const double EPSILON = 5.0e-14; namespace LAMMPS_NS { using ::testing::Eq; -class AtomStyleTest : public ::testing::Test { +class AtomStyleTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"SimpleCommandsTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "AtomStyleTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); command("dimension 3"); command("pair_style zero 4.0"); command("region box block -4 4 -4 4 -4 4"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); remove("test_atom_styles.data"); remove("input_atom_styles.data"); remove("test_atom_styles.restart"); } - - void command(const std::string cmd) { lmp->input->one(cmd); } }; // default class Atom state @@ -503,17 +494,17 @@ TEST_F(AtomStyleTest, atomic_after_charge) expected.has_v = true; expected.has_f = true; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style charge"); command("atom_style atomic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_ATOM_STATE_EQ(lmp->atom, expected); } TEST_F(AtomStyleTest, atomic) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_modify map hash"); command("create_box 2 box"); command("create_atoms 1 single -2.0 2.0 0.1"); @@ -523,7 +514,7 @@ TEST_F(AtomStyleTest, atomic) command("mass 1 4.0"); command("mass 2 2.4"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -541,7 +532,7 @@ TEST_F(AtomStyleTest, atomic) ASSERT_EQ(lmp->atom->map_style, Atom::MAP_HASH); ASSERT_EQ(lmp->atom->map_user, 2); ASSERT_EQ(lmp->atom->map_tag_max, 4); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("write_data test_atom_styles.data nocoeff"); command("clear"); @@ -550,7 +541,7 @@ TEST_F(AtomStyleTest, atomic) command("atom_modify map array"); command("units real"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -598,14 +589,14 @@ TEST_F(AtomStyleTest, atomic) ASSERT_EQ(lmp->atom->map_tag_max, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); command("clear"); command("read_restart test_atom_styles.restart"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 2); @@ -639,16 +630,16 @@ TEST_F(AtomStyleTest, atomic) ASSERT_EQ(lmp->atom->map_style, Atom::MAP_ARRAY); ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 3); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 2); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("comm_style tiled"); command("change_box all triclinic"); command("replicate 2 2 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 16); x = lmp->atom->x; tag = lmp->atom->tag; @@ -704,9 +695,9 @@ TEST_F(AtomStyleTest, atomic) TEST_F(AtomStyleTest, charge) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style charge"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "charge"; @@ -721,7 +712,7 @@ TEST_F(AtomStyleTest, charge) expected.q_flag = 1; ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 2 box"); command("create_atoms 1 single -2.0 2.0 0.1"); command("create_atoms 1 single -2.0 -2.0 -0.1"); @@ -734,7 +725,7 @@ TEST_F(AtomStyleTest, charge) command("set atom 3 charge -1.0"); command("set atom 4 charge 1.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -747,7 +738,7 @@ TEST_F(AtomStyleTest, charge) ASSERT_NE(lmp->atom->mass, nullptr); ASSERT_NE(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("write_data test_atom_styles.data nocoeff"); command("clear"); @@ -756,7 +747,7 @@ TEST_F(AtomStyleTest, charge) command("units real"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -810,7 +801,7 @@ TEST_F(AtomStyleTest, charge) ASSERT_EQ(lmp->atom->mass_setflag[1], 1); ASSERT_EQ(lmp->atom->mass_setflag[2], 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -818,7 +809,7 @@ TEST_F(AtomStyleTest, charge) command("clear"); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); command("read_restart test_atom_styles.restart"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 2); @@ -854,11 +845,11 @@ TEST_F(AtomStyleTest, charge) ASSERT_EQ(lmp->atom->mass_setflag[1], 1); ASSERT_EQ(lmp->atom->mass_setflag[2], 1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); command("change_box all triclinic"); command("replicate 2 2 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 16); q = lmp->atom->q; EXPECT_NEAR(q[GETIDX(1)], -0.5, EPSILON); @@ -881,9 +872,9 @@ TEST_F(AtomStyleTest, charge) TEST_F(AtomStyleTest, sphere) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style sphere"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "sphere"; @@ -903,7 +894,7 @@ TEST_F(AtomStyleTest, sphere) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 2 box"); command("create_atoms 1 single -2.0 2.0 0.1"); command("create_atoms 1 single -2.0 -2.0 -0.1"); @@ -918,7 +909,7 @@ TEST_F(AtomStyleTest, sphere) command("set atom 3 omega -1.0 0.0 0.0"); command("set atom 4 omega 0.0 1.0 0.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -932,7 +923,7 @@ TEST_F(AtomStyleTest, sphere) ASSERT_EQ(lmp->atom->mass, nullptr); ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("write_data test_atom_styles.data nocoeff"); command("clear"); @@ -941,7 +932,7 @@ TEST_F(AtomStyleTest, sphere) command("units real"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -1005,7 +996,7 @@ TEST_F(AtomStyleTest, sphere) EXPECT_NEAR(omega[GETIDX(4)][1], 1.0, EPSILON); EXPECT_NEAR(omega[GETIDX(4)][2], 0.0, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -1015,7 +1006,7 @@ TEST_F(AtomStyleTest, sphere) command("read_restart test_atom_styles.restart"); command("replicate 1 1 2"); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -1052,9 +1043,9 @@ TEST_F(AtomStyleTest, ellipsoid) { if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style ellipsoid"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "ellipsoid"; @@ -1073,7 +1064,7 @@ TEST_F(AtomStyleTest, ellipsoid) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box"); command("create_atoms 1 single -2.0 2.0 0.1"); command("create_atoms 1 single -2.0 -2.0 -0.1"); @@ -1091,7 +1082,7 @@ TEST_F(AtomStyleTest, ellipsoid) command("set atom 3 quat 1.0 0.0 1.0 30.0"); command("set atom 4 quat 1.0 1.0 1.0 60.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("ellipsoid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1119,7 +1110,7 @@ TEST_F(AtomStyleTest, ellipsoid) ASSERT_NE(lmp->atom->ellipsoid, nullptr); ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("atom_style ellipsoid"); @@ -1128,7 +1119,7 @@ TEST_F(AtomStyleTest, ellipsoid) command("atom_modify map array"); command("read_data test_atom_styles.data"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("ellipsoid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1238,7 +1229,7 @@ TEST_F(AtomStyleTest, ellipsoid) EXPECT_NEAR(bonus[3].quat[2], sqrt(5.0 / 30.0), EPSILON); EXPECT_NEAR(bonus[3].quat[3], sqrt(5.0 / 30.0), EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group two id 2:4:2"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); @@ -1246,7 +1237,7 @@ TEST_F(AtomStyleTest, ellipsoid) command("read_restart test_atom_styles.restart"); command("comm_style tiled"); command("replicate 1 1 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("ellipsoid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 8); @@ -1319,9 +1310,9 @@ TEST_F(AtomStyleTest, ellipsoid) EXPECT_NEAR(bonus[3].quat[2], 0.0, EPSILON); EXPECT_NEAR(bonus[3].quat[3], 0.25056280708573159, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->nellipsoids, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -1389,10 +1380,10 @@ TEST_F(AtomStyleTest, line) { if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dimension 2"); command("atom_style line"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "line"; @@ -1414,7 +1405,7 @@ TEST_F(AtomStyleTest, line) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box"); command("create_atoms 1 single -2.0 2.0 0.0"); command("create_atoms 1 single -2.0 -2.0 0.0"); @@ -1432,7 +1423,7 @@ TEST_F(AtomStyleTest, line) command("set atom 3 theta 30.0"); command("set atom 4 theta 60.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("line")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1448,7 +1439,7 @@ TEST_F(AtomStyleTest, line) ASSERT_NE(lmp->atom->rmass, nullptr); ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("dimension 2"); @@ -1457,7 +1448,7 @@ TEST_F(AtomStyleTest, line) command("units real"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("line")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1547,7 +1538,7 @@ TEST_F(AtomStyleTest, line) EXPECT_NEAR(bonus[3].length, 3.0, EPSILON); EXPECT_NEAR(bonus[3].theta, MathConst::MY_PI / 3.0, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -1557,7 +1548,7 @@ TEST_F(AtomStyleTest, line) command("comm_style tiled"); command("change_box all triclinic"); command("replicate 1 2 1 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("line")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 8); @@ -1610,9 +1601,9 @@ TEST_F(AtomStyleTest, line) EXPECT_NEAR(bonus[3].length, 3.0, EPSILON); EXPECT_NEAR(bonus[3].theta, MathConst::MY_PI / 6.0, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->nlines, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -1660,9 +1651,9 @@ TEST_F(AtomStyleTest, tri) { if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style tri"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "tri"; @@ -1685,7 +1676,7 @@ TEST_F(AtomStyleTest, tri) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box"); command("create_atoms 1 single -2.0 2.0 0.1"); command("create_atoms 1 single -2.0 -2.0 -0.1"); @@ -1703,7 +1694,7 @@ TEST_F(AtomStyleTest, tri) command("set atom 3 quat 1.0 0.0 1.0 30.0"); command("set atom 4 quat 1.0 1.0 1.0 60.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("tri")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1731,7 +1722,7 @@ TEST_F(AtomStyleTest, tri) ASSERT_NE(lmp->atom->tri, nullptr); ASSERT_EQ(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("atom_style tri"); @@ -1740,7 +1731,7 @@ TEST_F(AtomStyleTest, tri) command("atom_modify map array"); command("read_data test_atom_styles.data"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("tri")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -1893,7 +1884,7 @@ TEST_F(AtomStyleTest, tri) EXPECT_NEAR(bonus[3].c3[1], 0.64304946932374796, EPSILON); EXPECT_NEAR(bonus[3].c3[2], -0.32808266428854477, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group two id 2:4:2"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); @@ -1901,7 +1892,7 @@ TEST_F(AtomStyleTest, tri) command("read_restart test_atom_styles.restart"); command("change_box all triclinic"); command("replicate 1 1 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("tri")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 8); @@ -2019,9 +2010,9 @@ TEST_F(AtomStyleTest, tri) EXPECT_NEAR(bonus[3].c3[1], 0.85047049833171351, EPSILON); EXPECT_NEAR(bonus[3].c3[2], -0.15731490073748589, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->ntris, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -2064,9 +2055,9 @@ TEST_F(AtomStyleTest, body_nparticle) { if (!LAMMPS::is_installed_pkg("BODY")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style body nparticle 2 4"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "body"; @@ -2129,7 +2120,7 @@ TEST_F(AtomStyleTest, body_nparticle) FILE *fp = fopen("input_atom_styles.data", "w"); fputs(data_file, fp); fclose(fp); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_modify map array"); command("read_data input_atom_styles.data"); command("create_atoms 3 single 2.0 2.0 -2.1"); @@ -2140,7 +2131,7 @@ TEST_F(AtomStyleTest, body_nparticle) command("set atom 3 quat 1.0 0.0 1.0 30.0"); command("set atom 4 quat 1.0 1.0 1.0 60.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("body")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -2306,7 +2297,7 @@ TEST_F(AtomStyleTest, body_nparticle) ASSERT_NE(bonus[2].dvalue, nullptr); ASSERT_NE(bonus[3].dvalue, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("atom_style body nparticle 2 4"); @@ -2315,7 +2306,7 @@ TEST_F(AtomStyleTest, body_nparticle) command("atom_modify map array"); command("read_data test_atom_styles.data"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("body")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -2479,7 +2470,7 @@ TEST_F(AtomStyleTest, body_nparticle) ASSERT_NE(bonus[2].dvalue, nullptr); ASSERT_NE(bonus[3].dvalue, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group two id 2:4:2"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); @@ -2487,7 +2478,7 @@ TEST_F(AtomStyleTest, body_nparticle) command("read_restart test_atom_styles.restart"); command("comm_style tiled"); command("replicate 1 1 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("body")); avec = (AtomVecBody *)lmp->atom->avec; ASSERT_THAT(std::string(avec->bptr->style), Eq("nparticle")); @@ -2594,9 +2585,9 @@ TEST_F(AtomStyleTest, body_nparticle) ASSERT_NE(bonus[2].dvalue, nullptr); ASSERT_NE(bonus[3].dvalue, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->nbodies, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -2632,11 +2623,11 @@ TEST_F(AtomStyleTest, template) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); create_molecule_files(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("atom_style template twomols"); command("newton on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "template"; @@ -2658,7 +2649,7 @@ TEST_F(AtomStyleTest, template) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 4 box bond/types 2 angle/types 2 "); command("create_atoms 0 single -2.0 2.0 0.1 mol twomols 65234"); command("create_atoms 0 single -2.0 -2.0 -0.1 mol twomols 62346"); @@ -2676,7 +2667,7 @@ TEST_F(AtomStyleTest, template) command("angle_style zero"); command("angle_coeff * 109.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 12); @@ -2706,7 +2697,7 @@ TEST_F(AtomStyleTest, template) ASSERT_NE(lmp->atom->mass, nullptr); ASSERT_NE(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data"); command("clear"); command("units real"); @@ -2718,7 +2709,7 @@ TEST_F(AtomStyleTest, template) command("angle_style zero"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -2780,7 +2771,7 @@ TEST_F(AtomStyleTest, template) ASSERT_EQ(molatom[GETIDX(11)], -1); ASSERT_EQ(molatom[GETIDX(12)], -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); @@ -2790,7 +2781,7 @@ TEST_F(AtomStyleTest, template) command("angle_style zero"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -2902,7 +2893,7 @@ TEST_F(AtomStyleTest, template) ASSERT_EQ(type[GETIDX(11)], 3); ASSERT_EQ(type[GETIDX(12)], 4); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group two id 7:10"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); @@ -2910,7 +2901,7 @@ TEST_F(AtomStyleTest, template) command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("read_restart test_atom_styles.restart"); command("replicate 1 1 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("template")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 16); @@ -2980,9 +2971,9 @@ TEST_F(AtomStyleTest, template) ASSERT_EQ(molatom[GETIDX(23)], -1); ASSERT_EQ(molatom[GETIDX(24)], -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 16); @@ -3028,11 +3019,11 @@ TEST_F(AtomStyleTest, template_charge) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); create_molecule_files(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("atom_style hybrid template twomols charge"); command("newton on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "hybrid"; @@ -3063,7 +3054,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 4 box bond/types 2 angle/types 2 "); command("create_atoms 0 single -2.0 2.0 0.1 mol twomols 65234"); command("create_atoms 0 single -2.0 -2.0 -0.1 mol twomols 62346"); @@ -3084,7 +3075,7 @@ TEST_F(AtomStyleTest, template_charge) command("angle_style zero"); command("angle_coeff * 109.0"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_NE(lmp->atom->avec, nullptr); hybrid = (AtomVecHybrid *)lmp->atom->avec; ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); @@ -3122,7 +3113,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_NE(lmp->atom->mass, nullptr); ASSERT_NE(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data"); command("clear"); command("units real"); @@ -3134,7 +3125,7 @@ TEST_F(AtomStyleTest, template_charge) command("angle_style zero"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -3196,7 +3187,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_EQ(molatom[GETIDX(11)], -1); ASSERT_EQ(molatom[GETIDX(12)], -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); @@ -3206,7 +3197,7 @@ TEST_F(AtomStyleTest, template_charge) command("angle_style zero"); command("atom_modify map array"); command("read_data test_atom_styles.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -3331,7 +3322,7 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_EQ(type[GETIDX(11)], 3); ASSERT_EQ(type[GETIDX(12)], 4); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("group two id 7:10"); command("delete_atoms group two compress no"); command("write_restart test_atom_styles.restart"); @@ -3339,7 +3330,7 @@ TEST_F(AtomStyleTest, template_charge) command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("read_restart test_atom_styles.restart"); command("replicate 1 1 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 16); @@ -3409,9 +3400,9 @@ TEST_F(AtomStyleTest, template_charge) ASSERT_EQ(molatom[GETIDX(23)], -1); ASSERT_EQ(molatom[GETIDX(24)], -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 16); @@ -3457,10 +3448,10 @@ TEST_F(AtomStyleTest, bond) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style bond"); command("newton on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "bond"; @@ -3480,7 +3471,7 @@ TEST_F(AtomStyleTest, bond) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box bond/types 2 " "extra/bond/per/atom 2 extra/special/per/atom 4"); command("create_atoms 1 single -2.0 2.0 0.1"); @@ -3500,7 +3491,7 @@ TEST_F(AtomStyleTest, bond) command("create_bonds single/bond 2 3 5"); command("create_bonds single/bond 2 3 6"); command("create_bonds single/bond 2 5 6"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("bond")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -3533,7 +3524,7 @@ TEST_F(AtomStyleTest, bond) lmp->atom->bond_type[GETIDX(1)][0] *= -1; lmp->atom->bond_type[GETIDX(5)][0] *= -1; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("units real"); @@ -3545,7 +3536,7 @@ TEST_F(AtomStyleTest, bond) command("read_data test_atom_styles.data"); command("pair_coeff * *"); command("bond_coeff * 4.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("bond")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -3594,7 +3585,7 @@ TEST_F(AtomStyleTest, bond) ASSERT_EQ(bond_atom[GETIDX(6)][0], 3); ASSERT_EQ(bond_atom[GETIDX(6)][1], 5); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("atom_style bond"); @@ -3604,7 +3595,7 @@ TEST_F(AtomStyleTest, bond) command("read_data test_atom_styles.data"); command("pair_coeff * *"); command("bond_coeff * 4.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("bond")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -3692,7 +3683,7 @@ TEST_F(AtomStyleTest, bond) lmp->atom->bond_type[GETIDX(1)][0] *= -1; lmp->atom->bond_type[GETIDX(5)][0] *= -1; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -3700,7 +3691,7 @@ TEST_F(AtomStyleTest, bond) command("clear"); command("read_restart test_atom_styles.restart"); command("replicate 1 1 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("bond")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 8); @@ -3754,10 +3745,10 @@ TEST_F(AtomStyleTest, bond) ASSERT_EQ(bond_type[GETIDX(9)][1], 2); ASSERT_EQ(bond_type[GETIDX(11)][0], 2); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("delete_bonds all bond 2"); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -3805,10 +3796,10 @@ TEST_F(AtomStyleTest, angle) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style angle"); command("newton on"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "angle"; @@ -3829,7 +3820,7 @@ TEST_F(AtomStyleTest, angle) ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box bond/types 2 angle/types 2 " "extra/bond/per/atom 2 extra/angle/per/atom 1 " "extra/special/per/atom 4"); @@ -3854,7 +3845,7 @@ TEST_F(AtomStyleTest, angle) command("create_bonds single/bond 2 5 6"); command("create_bonds single/angle 1 1 3 5"); command("create_bonds single/angle 2 3 5 6"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("angle")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -3889,7 +3880,7 @@ TEST_F(AtomStyleTest, angle) lmp->atom->angle_type[GETIDX(3)][0] *= -1; lmp->atom->angle_type[GETIDX(5)][0] *= -1; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("units real"); @@ -3903,7 +3894,7 @@ TEST_F(AtomStyleTest, angle) command("pair_coeff * *"); command("bond_coeff * 4.0"); command("angle_coeff * 90.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("angle")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -3987,7 +3978,7 @@ TEST_F(AtomStyleTest, angle) ASSERT_EQ(angle_atom2[GETIDX(6)][0], 5); ASSERT_EQ(angle_atom3[GETIDX(6)][0], 6); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("atom_style angle"); @@ -3997,7 +3988,7 @@ TEST_F(AtomStyleTest, angle) command("read_data test_atom_styles.data"); command("pair_coeff * *"); command("bond_coeff * 4.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("angle")); ASSERT_NE(lmp->atom->avec, nullptr); @@ -4086,7 +4077,7 @@ TEST_F(AtomStyleTest, angle) ASSERT_EQ(angle_type[GETIDX(3)][0], 1); ASSERT_EQ(angle_type[GETIDX(5)][0], 2); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -4094,7 +4085,7 @@ TEST_F(AtomStyleTest, angle) command("clear"); command("read_restart test_atom_styles.restart"); command("replicate 1 1 2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("angle")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 8); @@ -4131,10 +4122,10 @@ TEST_F(AtomStyleTest, angle) ASSERT_EQ(angle_type[GETIDX(9)][0], 1); ASSERT_EQ(angle_type[GETIDX(11)][0], 2); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("delete_bonds all angle 2"); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -4166,9 +4157,9 @@ TEST_F(AtomStyleTest, full_ellipsoid) if (!LAMMPS::is_installed_pkg("ASPHERE")) GTEST_SKIP(); if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_style hybrid full ellipsoid"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "hybrid"; @@ -4204,7 +4195,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) ASSERT_NE(hybrid->styles[0], nullptr); ASSERT_NE(hybrid->styles[1], nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 3 box bond/types 2 " "extra/bond/per/atom 2 extra/special/per/atom 4"); command("create_atoms 1 single -2.0 2.0 0.1"); @@ -4239,7 +4230,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) command("create_bonds single/bond 2 3 5"); command("create_bonds single/bond 2 3 6"); command("create_bonds single/bond 2 5 6"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 6); @@ -4269,7 +4260,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) ASSERT_NE(lmp->atom->ellipsoid, nullptr); ASSERT_NE(lmp->atom->mass_setflag, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("write_data test_atom_styles.data nocoeff"); command("clear"); command("units real"); @@ -4280,7 +4271,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) command("read_data test_atom_styles.data"); command("pair_coeff * *"); command("bond_coeff * 4.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); ASSERT_NE(lmp->atom->avec, nullptr); hybrid = (AtomVecHybrid *)lmp->atom->avec; @@ -4405,7 +4396,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) EXPECT_NEAR(bonus[3].quat[2], sqrt(5.0 / 30.0), EPSILON); EXPECT_NEAR(bonus[3].quat[3], sqrt(5.0 / 30.0), EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -4413,7 +4404,7 @@ TEST_F(AtomStyleTest, full_ellipsoid) command("clear"); command("read_restart test_atom_styles.restart"); command("replicate 1 1 2 bbox"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); hybrid = (AtomVecHybrid *)lmp->atom->avec; ASSERT_EQ(hybrid->nstyles, 2); @@ -4492,9 +4483,9 @@ TEST_F(AtomStyleTest, full_ellipsoid) EXPECT_NEAR(bonus[3].quat[2], 0.0, EPSILON); EXPECT_NEAR(bonus[3].quat[3], 0.25056280708573159, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->nellipsoids, 4); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); ASSERT_EQ(lmp->atom->map_tag_max, 8); @@ -4561,10 +4552,10 @@ TEST_F(AtomStyleTest, full_ellipsoid) TEST_F(AtomStyleTest, property_atom) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("atom_modify map array"); command("fix Properties all property/atom i_one d_two mol d_three q rmass ghost yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); AtomState expected; expected.atom_style = "atomic"; @@ -4596,7 +4587,7 @@ TEST_F(AtomStyleTest, property_atom) expected.nextra_border_max = 1; ASSERT_ATOM_STATE_EQ(lmp->atom, expected); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("create_box 2 box"); command("create_atoms 1 single -2.0 2.0 0.1"); command("create_atoms 1 single -2.0 -2.0 -0.1"); @@ -4623,7 +4614,7 @@ TEST_F(AtomStyleTest, property_atom) command("set atom 3 d_three 0.5"); command("set atom 4 d_three 2.0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); expected.natoms = 4; expected.nlocal = 4; expected.map_tag_max = 4; @@ -4637,7 +4628,7 @@ TEST_F(AtomStyleTest, property_atom) ASSERT_NE(lmp->atom->nmax, -1); ASSERT_NE(lmp->atom->rmass, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("write_data test_atom_styles.data nocoeff"); command("clear"); @@ -4648,7 +4639,7 @@ TEST_F(AtomStyleTest, property_atom) command("fix props all property/atom i_one d_two mol d_three q rmass ghost yes"); command("read_data test_atom_styles.data fix props NULL Properties"); command("pair_coeff * *"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); ASSERT_NE(lmp->atom->avec, nullptr); ASSERT_EQ(lmp->atom->natoms, 4); @@ -4726,7 +4717,7 @@ TEST_F(AtomStyleTest, property_atom) EXPECT_NEAR(three[GETIDX(3)], 0.5, EPSILON); EXPECT_NEAR(three[GETIDX(4)], 2.0, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("pair_coeff * *"); command("group two id 2:4:2"); command("delete_atoms group two compress no"); @@ -4735,7 +4726,7 @@ TEST_F(AtomStyleTest, property_atom) ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); command("read_restart test_atom_styles.restart"); command("fix props all property/atom i_one d_two mol d_three q rmass ghost yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); expected.natoms = 2; expected.nlocal = 2; expected.nghost = 0; @@ -4773,10 +4764,10 @@ TEST_F(AtomStyleTest, property_atom) EXPECT_NEAR(three[GETIDX(1)], -2.5, EPSILON); EXPECT_NEAR(three[GETIDX(3)], 0.5, EPSILON); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("reset_atom_ids"); command("change_box all triclinic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->atom->map_tag_max, 2); q = lmp->atom->q; EXPECT_NEAR(q[GETIDX(1)], -0.5, EPSILON); diff --git a/unittest/formats/test_dump_atom.cpp b/unittest/formats/test_dump_atom.cpp index 39cefdccea..46c6b7dfa7 100644 --- a/unittest/formats/test_dump_atom.cpp +++ b/unittest/formats/test_dump_atom.cpp @@ -32,14 +32,14 @@ class DumpAtomTest : public MeltTest { public: void enable_triclinic() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all triclinic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_dump(std::string dump_file, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all {} 1 {}", dump_style, dump_file)); if (!dump_modify_options.empty()) { @@ -47,13 +47,13 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_text_and_binary_dump(std::string text_file, std::string binary_file, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id0 all {} 1 {}", dump_style, text_file)); command(fmt::format("dump id1 all {} 1 {}", dump_style, binary_file)); @@ -63,15 +63,15 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } std::string convert_binary_to_text(std::string binary_file) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); std::string cmdline = fmt::format("{} {}", BINARY2TXT_BINARY, binary_file); system(cmdline.c_str()); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); return fmt::format("{}.txt", binary_file); } }; @@ -504,27 +504,27 @@ TEST_F(DumpAtomTest, per_processor_multi_file_run1) TEST_F(DumpAtomTest, dump_modify_scale_invalid) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dump id all atom 1 dump.txt"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id scale true");); } TEST_F(DumpAtomTest, dump_modify_image_invalid) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dump id all atom 1 dump.txt"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id image true");); } TEST_F(DumpAtomTest, dump_modify_invalid) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("dump id all atom 1 dump.txt"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id true");); } @@ -534,12 +534,12 @@ TEST_F(DumpAtomTest, write_dump) auto reference = "dump_ref_run0.melt"; auto dump_file = "write_dump_atom_run0.melt"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all atom 1 {}", reference)); command("dump_modify id scale no units yes"); command("run 0"); command("write_dump all atom write_dump_atom_run*.melt modify scale no units yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_FILE_EXISTS(reference); ASSERT_FILE_EXISTS(dump_file); @@ -556,12 +556,12 @@ TEST_F(DumpAtomTest, binary_write_dump) auto reference = "dump_run0.melt.bin"; auto dump_file = "write_dump_atom_run0_p0.melt.bin"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all atom 1 {}", reference)); command("dump_modify id scale no units yes"); command("run 0"); command("write_dump all atom write_dump_atom_run*_p%.melt.bin modify scale no units yes"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); ASSERT_FILE_EXISTS(reference); ASSERT_FILE_EXISTS(dump_file); diff --git a/unittest/formats/test_dump_atom_compressed.cpp b/unittest/formats/test_dump_atom_compressed.cpp index ed591184c3..5a519e06a1 100644 --- a/unittest/formats/test_dump_atom_compressed.cpp +++ b/unittest/formats/test_dump_atom_compressed.cpp @@ -340,9 +340,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_bad_param) { if (compression_style != "atom/gz") GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt"))); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 compression_level 12"); @@ -353,9 +353,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param) { if (compression_style != "atom/gz") GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt"))); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); diff --git a/unittest/formats/test_dump_cfg.cpp b/unittest/formats/test_dump_cfg.cpp index 327a9caca7..b8f879de6f 100644 --- a/unittest/formats/test_dump_cfg.cpp +++ b/unittest/formats/test_dump_cfg.cpp @@ -30,7 +30,7 @@ public: void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, fields)); if (!dump_modify_options.empty()) { @@ -38,7 +38,7 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } }; @@ -54,9 +54,9 @@ TEST_F(DumpCfgTest, require_multifile) auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all cfg 1 {} {}", dump_file, fields)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*Dump cfg requires one snapshot per file.*", command("run 0");); } diff --git a/unittest/formats/test_dump_cfg_compressed.cpp b/unittest/formats/test_dump_cfg_compressed.cpp index 834a71db70..20f902091b 100644 --- a/unittest/formats/test_dump_cfg_compressed.cpp +++ b/unittest/formats/test_dump_cfg_compressed.cpp @@ -230,9 +230,9 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param) if (compression_style != "cfg/gz") GTEST_SKIP(); auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 compression_level 12"); @@ -244,9 +244,9 @@ TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param) if (compression_style != "cfg/gz") GTEST_SKIP(); auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"), fields)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); diff --git a/unittest/formats/test_dump_custom.cpp b/unittest/formats/test_dump_custom.cpp index f2d7935426..b90d77e966 100644 --- a/unittest/formats/test_dump_custom.cpp +++ b/unittest/formats/test_dump_custom.cpp @@ -30,15 +30,15 @@ class DumpCustomTest : public MeltTest { public: void enable_triclinic() { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all triclinic"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, fields)); if (!dump_modify_options.empty()) { @@ -46,14 +46,14 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void generate_text_and_binary_dump(std::string text_file, std::string binary_file, std::string fields, std::string dump_modify_options, int ntimesteps) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, fields)); command(fmt::format("dump id1 all {} 1 {} {}", dump_style, binary_file, fields)); @@ -63,15 +63,15 @@ public: } command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } std::string convert_binary_to_text(std::string binary_file) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); std::string cmdline = fmt::format("{} {}", BINARY2TXT_BINARY, binary_file); system(cmdline.c_str()); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); return fmt::format("{}.txt", binary_file); } }; @@ -113,9 +113,9 @@ TEST_F(DumpCustomTest, thresh_run0) TEST_F(DumpCustomTest, compute_run0) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("compute comp all property/atom x y z"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto dump_file = "dump_custom_compute_run0.melt"; auto fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]"; @@ -134,9 +134,9 @@ TEST_F(DumpCustomTest, compute_run0) TEST_F(DumpCustomTest, fix_run0) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("fix numdiff all numdiff 1 0.0001"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto dump_file = "dump_custom_compute_run0.melt"; auto fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]"; @@ -155,10 +155,10 @@ TEST_F(DumpCustomTest, fix_run0) TEST_F(DumpCustomTest, custom_run0) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("fix prop all property/atom i_flag1 d_flag2"); command("compute 1 all property/atom i_flag1 d_flag2"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto dump_file = "dump_custom_custom_run0.melt"; auto fields = "id x y z i_flag1 d_flag2"; @@ -242,10 +242,10 @@ TEST_F(DumpCustomTest, binary_triclinic_run1) TEST_F(DumpCustomTest, with_variable_run1) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("compute 1 all property/atom proc"); command("variable p atom (c_1%10)+1"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto dump_file = "dump_custom_with_variable_run1.melt"; auto fields = "id type x y z v_p"; diff --git a/unittest/formats/test_dump_local_compressed.cpp b/unittest/formats/test_dump_local_compressed.cpp index 20f90984a1..95656071fc 100644 --- a/unittest/formats/test_dump_local_compressed.cpp +++ b/unittest/formats/test_dump_local_compressed.cpp @@ -31,9 +31,9 @@ public: void SetUp() override { CompressedDumpTest::SetUp(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("compute comp all pair/local dist eng"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } }; @@ -205,9 +205,9 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param) auto fields = "index c_comp[1]"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.local"), fields)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 compression_level 12"); @@ -220,9 +220,9 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param) auto fields = "index c_comp[1]"; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.local"), fields)); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); diff --git a/unittest/formats/test_dump_xyz_compressed.cpp b/unittest/formats/test_dump_xyz_compressed.cpp index f80201872c..dad7911b4c 100644 --- a/unittest/formats/test_dump_xyz_compressed.cpp +++ b/unittest/formats/test_dump_xyz_compressed.cpp @@ -191,9 +191,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_bad_param) { if (compression_style != "xyz/gz") GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.xyz"))); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 compression_level 12"); @@ -204,9 +204,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param) { if (compression_style != "xyz/gz") GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.xyz"))); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); diff --git a/unittest/formats/test_eim_potential_file_reader.cpp b/unittest/formats/test_eim_potential_file_reader.cpp index 9992fb8662..26f2795a85 100644 --- a/unittest/formats/test_eim_potential_file_reader.cpp +++ b/unittest/formats/test_eim_potential_file_reader.cpp @@ -18,6 +18,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -28,28 +29,23 @@ using utils::split_words; // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -class EIMPotentialFileReaderTest : public ::testing::Test { +class EIMPotentialFileReaderTest : public LAMMPSTest { protected: - LAMMPS *lmp; PairEIM::Setfl setfl; static const int nelements = 9; void SetUp() override { - const char *args[] = { - "PotentialFileReaderTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - lmp->input->one("units metal"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "EIMPotentialFileReaderTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); + + BEGIN_HIDE_OUTPUT(); + command("units metal"); + END_HIDE_OUTPUT(); // check if the prerequisite eim pair style is available - Info *info = new Info(lmp); ASSERT_TRUE(info->has_style("pair", "eim")); - delete info; int npair = nelements * (nelements + 1) / 2; setfl.ielement = new int[nelements]; @@ -99,17 +95,15 @@ protected: delete[] setfl.rs; delete[] setfl.tp; - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); } }; TEST_F(EIMPotentialFileReaderTest, global_line) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); EIMPotentialFileReader reader(lmp, "ffield.eim"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); reader.get_global(&setfl); ASSERT_DOUBLE_EQ(setfl.division, 2.0); @@ -119,9 +113,9 @@ TEST_F(EIMPotentialFileReaderTest, global_line) TEST_F(EIMPotentialFileReaderTest, element_line_sequential) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); EIMPotentialFileReader reader(lmp, "ffield.eim"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); reader.get_element(&setfl, 0, "Li"); ASSERT_EQ(setfl.ielement[0], 3); @@ -144,9 +138,9 @@ TEST_F(EIMPotentialFileReaderTest, element_line_sequential) TEST_F(EIMPotentialFileReaderTest, element_line_random) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); EIMPotentialFileReader reader(lmp, "ffield.eim"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); reader.get_element(&setfl, 0, "Id"); ASSERT_EQ(setfl.ielement[0], 53); @@ -160,9 +154,9 @@ TEST_F(EIMPotentialFileReaderTest, element_line_random) TEST_F(EIMPotentialFileReaderTest, pair_line) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); EIMPotentialFileReader reader(lmp, "ffield.eim"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); reader.get_pair(&setfl, 0, "Li", "Li"); ASSERT_DOUBLE_EQ(setfl.rcutphiA[0], 6.0490e+00); @@ -183,9 +177,9 @@ TEST_F(EIMPotentialFileReaderTest, pair_line) TEST_F(EIMPotentialFileReaderTest, pair_identical) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); EIMPotentialFileReader reader(lmp, "ffield.eim"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); reader.get_pair(&setfl, 0, "Li", "Na"); reader.get_pair(&setfl, 1, "Na", "Li"); diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index cf85d810df..80082bc53c 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -17,6 +17,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -31,43 +32,17 @@ using utils::sfgets; using utils::sfread; using utils::split_words; -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } - // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -class FileOperationsTest : public ::testing::Test { +class FileOperationsTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"FileOperationsTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "FileOperationsTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); + FILE *fp = fopen("safe_file_read_test.txt", "wb"); ASSERT_NE(fp, nullptr); fputs("one line\n", fp); @@ -79,13 +54,9 @@ protected: void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); remove("safe_file_read_test.txt"); } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; #define MAX_BUF_SIZE 128 @@ -179,7 +150,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/formats/test_image_flags.cpp b/unittest/formats/test_image_flags.cpp index 6b3a333328..63d85789e6 100644 --- a/unittest/formats/test_image_flags.cpp +++ b/unittest/formats/test_image_flags.cpp @@ -15,6 +15,7 @@ #include "input.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -28,20 +29,14 @@ using LAMMPS_NS::utils::split_words; namespace LAMMPS_NS { using ::testing::Eq; -class ImageFlagsTest : public ::testing::Test { +class ImageFlagsTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"ImageFlagsTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "ImageFlagsTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); command("dimension 3"); command("region box block -2 2 -2 2 -2 2"); @@ -54,18 +49,14 @@ protected: command("set atom 1 image -1 2 3"); command("set atom 2 image -2 1 -1"); command("write_data test_image_flags.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); remove("test_image_flags.data"); } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(ImageFlagsTest, change_box) @@ -87,9 +78,9 @@ TEST_F(ImageFlagsTest, change_box) ASSERT_EQ(imy, 1); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all boundary f p p"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; @@ -108,9 +99,9 @@ TEST_F(ImageFlagsTest, change_box) ASSERT_EQ(imy, 1); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all boundary f s p"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; @@ -129,9 +120,9 @@ TEST_F(ImageFlagsTest, change_box) ASSERT_EQ(imy, 0); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("change_box all boundary p p m"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; @@ -153,14 +144,14 @@ TEST_F(ImageFlagsTest, change_box) TEST_F(ImageFlagsTest, read_data) { - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("dimension 3"); command("boundary p p p"); command("pair_style zero 2.0"); command("read_data test_image_flags.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); auto image = lmp->atom->image; int imx = (image[0] & IMGMASK) - IMGMAX; @@ -179,14 +170,14 @@ TEST_F(ImageFlagsTest, read_data) ASSERT_EQ(imy, 1); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("dimension 3"); command("boundary f p p"); command("pair_style zero 2.0"); command("read_data test_image_flags.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; @@ -205,14 +196,14 @@ TEST_F(ImageFlagsTest, read_data) ASSERT_EQ(imy, 1); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("dimension 3"); command("boundary p s p"); command("pair_style zero 2.0"); command("read_data test_image_flags.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; @@ -231,14 +222,14 @@ TEST_F(ImageFlagsTest, read_data) ASSERT_EQ(imy, 0); ASSERT_EQ(imz, -1); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("dimension 3"); command("boundary p p m"); command("pair_style zero 2.0"); command("read_data test_image_flags.data"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); image = lmp->atom->image; imx = (image[0] & IMGMASK) - IMGMAX; diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 204a1bd061..4bcf375dff 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -19,6 +19,7 @@ #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -33,26 +34,6 @@ using utils::split_words; #define test_name test_info_->name() -#if defined(OMPI_MAJOR_VERSION) -const bool have_openmpi = true; -#else -const bool have_openmpi = false; -#endif - -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } else { \ - if (!have_openmpi) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ - } \ - } static void create_molecule_files() { @@ -96,27 +77,21 @@ static void create_molecule_files() // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -class MoleculeFileTest : public ::testing::Test { +class MoleculeFileTest : public LAMMPSTest { protected: - LAMMPS *lmp; - void SetUp() override { - const char *args[] = {"MoleculeFileTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - create_molecule_files(); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "MoleculeFileTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); + BEGIN_HIDE_OUTPUT(); + create_molecule_files(); + END_HIDE_OUTPUT(); } void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); remove("h2o.mol"); remove("co2.mol"); } @@ -128,11 +103,9 @@ protected: fputs(content.c_str(), fp); fclose(fp); - lmp->input->one(fmt::format("molecule {} {} {}", name, file, args)); + command(fmt::format("molecule {} {} {}", name, file, args)); remove(file.c_str()); } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(MoleculeFileTest, nofile) @@ -292,7 +265,7 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (have_openmpi && !LAMMPS_NS::Info::has_exceptions()) + if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions()) std::cout << "Warning: using OpenMPI without exceptions. " "Death tests will be skipped\n"; diff --git a/unittest/formats/test_pair_unit_convert.cpp b/unittest/formats/test_pair_unit_convert.cpp index f0c2f0d031..bdd66f67a6 100644 --- a/unittest/formats/test_pair_unit_convert.cpp +++ b/unittest/formats/test_pair_unit_convert.cpp @@ -20,6 +20,7 @@ #include "thermo.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "../testing/core.h" #include #include @@ -42,23 +43,17 @@ const double p_convert = 1.01325; // of data in update.cpp. could be 1.0e-12 const double rel_error = 5.0e-7; -class PairUnitConvertTest : public ::testing::Test { +class PairUnitConvertTest : public LAMMPSTest { protected: - LAMMPS *lmp; - Info *info; double fold[4][3]; void SetUp() override { - const char *args[] = {"PairUnitConvertTest", "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); - if (!verbose) ::testing::internal::GetCapturedStdout(); + testbinary = "PairUnitConvertTest"; + LAMMPSTest::SetUp(); ASSERT_NE(lmp, nullptr); - if (!verbose) ::testing::internal::CaptureStdout(); - info = new Info(lmp); + + BEGIN_HIDE_OUTPUT(); command("units metal"); command("dimension 3"); command("region box block -4 4 -4 4 -4 4"); @@ -72,19 +67,14 @@ protected: command("mass * 1.0"); command("write_data test_pair_unit_convert.data nocoeff"); command("clear"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); } void TearDown() override { - if (!verbose) ::testing::internal::CaptureStdout(); - delete info; - delete lmp; - if (!verbose) ::testing::internal::GetCapturedStdout(); + LAMMPSTest::TearDown(); remove("test_pair_unit_convert.data"); } - - void command(const std::string &cmd) { lmp->input->one(cmd); } }; TEST_F(PairUnitConvertTest, zero) @@ -92,13 +82,13 @@ TEST_F(PairUnitConvertTest, zero) // check if the prerequisite pair style is available if (!info->has_style("pair", "zero")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style zero 6.0"); command("pair_coeff * *"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -109,14 +99,14 @@ TEST_F(PairUnitConvertTest, zero) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style zero 6.0"); command("pair_coeff * *"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -135,7 +125,7 @@ TEST_F(PairUnitConvertTest, lj_cut) // check if the prerequisite pair style is available if (!info->has_style("pair", "lj/cut")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style lj/cut 6.0"); @@ -145,7 +135,7 @@ TEST_F(PairUnitConvertTest, lj_cut) command("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2"); command("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -156,7 +146,7 @@ TEST_F(PairUnitConvertTest, lj_cut) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); @@ -167,7 +157,7 @@ TEST_F(PairUnitConvertTest, lj_cut) command("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2"); command("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -186,13 +176,13 @@ TEST_F(PairUnitConvertTest, eam) // check if the prerequisite pair style is available if (!info->has_style("pair", "eam")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style eam"); command("pair_coeff * * Cu_u3.eam"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -203,14 +193,14 @@ TEST_F(PairUnitConvertTest, eam) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style eam"); command("pair_coeff * * Cu_u3.eam"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -229,13 +219,13 @@ TEST_F(PairUnitConvertTest, eam_alloy) // check if the prerequisite pair style is available if (!info->has_style("pair", "eam/alloy")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/alloy"); command("pair_coeff * * AlCu.eam.alloy Al Cu"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -246,14 +236,14 @@ TEST_F(PairUnitConvertTest, eam_alloy) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/alloy"); command("pair_coeff * * AlCu.eam.alloy Al Cu"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -272,13 +262,13 @@ TEST_F(PairUnitConvertTest, eam_fs) // check if the prerequisite pair style is available if (!info->has_style("pair", "eam/fs")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/fs"); command("pair_coeff * * FeP_mm.eam.fs Fe P"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -289,14 +279,14 @@ TEST_F(PairUnitConvertTest, eam_fs) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/fs"); command("pair_coeff * * FeP_mm.eam.fs Fe P"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -315,13 +305,13 @@ TEST_F(PairUnitConvertTest, eam_cd) // check if the prerequisite pair style is available if (!info->has_style("pair", "eam/cd")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/cd"); command("pair_coeff * * FeCr.cdeam Cr Fe"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -332,14 +322,14 @@ TEST_F(PairUnitConvertTest, eam_cd) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style eam/cd"); command("pair_coeff * * FeCr.cdeam Cr Fe"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -358,13 +348,13 @@ TEST_F(PairUnitConvertTest, eim) // check if the prerequisite pair style is available if (!info->has_style("pair", "eim")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style eim"); command("pair_coeff * * Na Cl ffield.eim Na Cl"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -375,14 +365,14 @@ TEST_F(PairUnitConvertTest, eim) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style eim"); command("pair_coeff * * Na Cl ffield.eim Na Cl"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -401,13 +391,13 @@ TEST_F(PairUnitConvertTest, gw) // check if the prerequisite pair style is available if (!info->has_style("pair", "gw")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style gw"); command("pair_coeff * * SiC.gw Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -418,14 +408,14 @@ TEST_F(PairUnitConvertTest, gw) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style gw"); command("pair_coeff * * SiC.gw Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -444,13 +434,13 @@ TEST_F(PairUnitConvertTest, gw_zbl) // check if the prerequisite pair style is available if (!info->has_style("pair", "gw/zbl")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style gw/zbl"); command("pair_coeff * * SiC.gw.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -461,14 +451,14 @@ TEST_F(PairUnitConvertTest, gw_zbl) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style gw/zbl"); command("pair_coeff * * SiC.gw.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -487,13 +477,13 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic) // check if the prerequisite pair style is available if (!info->has_style("pair", "nb3b/harmonic")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style nb3b/harmonic"); command("pair_coeff * * MOH.nb3b.harmonic M O"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -504,14 +494,14 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style nb3b/harmonic"); command("pair_coeff * * MOH.nb3b.harmonic M O"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -530,13 +520,13 @@ TEST_F(PairUnitConvertTest, sw) // check if the prerequisite pair style is available if (!info->has_style("pair", "sw")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style sw"); command("pair_coeff * * GaN.sw Ga N"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -547,14 +537,14 @@ TEST_F(PairUnitConvertTest, sw) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style sw"); command("pair_coeff * * GaN.sw Ga N"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -573,7 +563,7 @@ TEST_F(PairUnitConvertTest, table_metal2real) // check if the prerequisite pair style is available if (!info->has_style("pair", "table")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style table linear 1000"); @@ -581,7 +571,7 @@ TEST_F(PairUnitConvertTest, table_metal2real) command("pair_coeff 1 2 test.table.metal lj_1_2"); command("pair_coeff 2 2 test.table.metal lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -592,7 +582,7 @@ TEST_F(PairUnitConvertTest, table_metal2real) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); @@ -601,7 +591,7 @@ TEST_F(PairUnitConvertTest, table_metal2real) command("pair_coeff 1 2 test.table.metal lj_1_2"); command("pair_coeff 2 2 test.table.metal lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -620,7 +610,7 @@ TEST_F(PairUnitConvertTest, table_real2metal) // check if the prerequisite pair style is available if (!info->has_style("pair", "table")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style table linear 1000"); @@ -628,7 +618,7 @@ TEST_F(PairUnitConvertTest, table_real2metal) command("pair_coeff 1 2 test.table.real lj_1_2"); command("pair_coeff 2 2 test.table.real lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -639,7 +629,7 @@ TEST_F(PairUnitConvertTest, table_real2metal) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units metal"); command("read_data test_pair_unit_convert.data"); @@ -648,7 +638,7 @@ TEST_F(PairUnitConvertTest, table_real2metal) command("pair_coeff 1 2 test.table.real lj_1_2"); command("pair_coeff 2 2 test.table.real lj_2_2"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -667,13 +657,13 @@ TEST_F(PairUnitConvertTest, tersoff) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff"); command("pair_coeff * * SiC.tersoff Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -684,14 +674,14 @@ TEST_F(PairUnitConvertTest, tersoff) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff"); command("pair_coeff * * SiC.tersoff Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -710,13 +700,13 @@ TEST_F(PairUnitConvertTest, tersoff_mod) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff/mod")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/mod"); command("pair_coeff * * Si.tersoff.mod Si Si"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -727,14 +717,14 @@ TEST_F(PairUnitConvertTest, tersoff_mod) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/mod"); command("pair_coeff * * Si.tersoff.mod Si Si"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -753,13 +743,13 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff/mod/c")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/mod/c"); command("pair_coeff * * Si.tersoff.modc Si Si"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -770,14 +760,14 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/mod/c"); command("pair_coeff * * Si.tersoff.modc Si Si"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -796,13 +786,13 @@ TEST_F(PairUnitConvertTest, tersoff_table) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff/table")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/table"); command("pair_coeff * * SiC.tersoff Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -813,14 +803,14 @@ TEST_F(PairUnitConvertTest, tersoff_table) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/table"); command("pair_coeff * * SiC.tersoff Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -839,13 +829,13 @@ TEST_F(PairUnitConvertTest, tersoff_zbl) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff/zbl")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/zbl"); command("pair_coeff * * SiC.tersoff.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -856,14 +846,14 @@ TEST_F(PairUnitConvertTest, tersoff_zbl) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/zbl"); command("pair_coeff * * SiC.tersoff.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -882,14 +872,14 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp) // check if the prerequisite pair style is available if (!info->has_style("pair", "tersoff/zbl/omp")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("package omp 4"); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style tersoff/zbl/omp"); command("pair_coeff * * SiC.tersoff.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -900,7 +890,7 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("package omp 4"); command("units real"); @@ -908,7 +898,7 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp) command("pair_style tersoff/zbl/omp"); command("pair_coeff * * SiC.tersoff.zbl Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); @@ -927,13 +917,13 @@ TEST_F(PairUnitConvertTest, vashishta) // check if the prerequisite pair style is available if (!info->has_style("pair", "vashishta")) GTEST_SKIP(); - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("units metal"); command("read_data test_pair_unit_convert.data"); command("pair_style vashishta"); command("pair_coeff * * SiC.vashishta Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); // copy pressure, energy, and force from first step double pold; @@ -944,14 +934,14 @@ TEST_F(PairUnitConvertTest, vashishta) for (int j = 0; j < 3; ++j) fold[i][j] = f[i][j]; - if (!verbose) ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("clear"); command("units real"); command("read_data test_pair_unit_convert.data"); command("pair_style vashishta"); command("pair_coeff * * SiC.vashishta Si C"); command("run 0 post no"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + END_HIDE_OUTPUT(); double pnew; lmp->output->thermo->evaluate_keyword("press", &pnew); diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 01c5872579..deab845573 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -22,6 +22,8 @@ #include "exceptions.h" #include +#include +#include using namespace LAMMPS_NS; @@ -103,20 +105,31 @@ public: } protected: - const char *testbinary = "LAMMPSTest"; + std::string testbinary = "LAMMPSTest"; + std::vector args = {"-log", "none", "-echo", "screen", "-nocite"}; LAMMPS *lmp; Info *info; void SetUp() override { - const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"}; - char **argv = (char **)args; - int argc = sizeof(args) / sizeof(char *); + int argc = args.size() + 1; + char ** argv = new char*[argc]; + argv[0] = utils::strdup(testbinary); + for(int i = 1; i < argc; i++) { + argv[i] = utils::strdup(args[i-1]); + } + HIDE_OUTPUT([&] { lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD); info = new Info(lmp); }); InitSystem(); + + for(int i = 0; i < argc; i++) { + delete [] argv[i]; + argv[i] = nullptr; + } + delete [] argv; } virtual void InitSystem() {} From 6f986eee4eb5ef72c46fb1d8a0c0dc00f6918712 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 29 Mar 2021 15:01:29 -0400 Subject: [PATCH 163/370] Add missing changes --- unittest/commands/test_lattice_region.cpp | 10 +++----- unittest/formats/test_file_operations.cpp | 8 +++--- unittest/formats/test_molecule_file.cpp | 30 +++++++++-------------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index eb6d577652..ae38f3a7f5 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -81,10 +81,9 @@ TEST_F(LatticeRegionTest, lattice_none) TEST_F(LatticeRegionTest, lattice_sc) { - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("lattice sc 1.0 spacing 1.5 2.0 3.0"); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 1.50* 2.0* 3.0*.*")); auto lattice = lmp->domain->lattice; @@ -92,10 +91,9 @@ TEST_F(LatticeRegionTest, lattice_sc) ASSERT_EQ(lattice->ylattice, 2.0); ASSERT_EQ(lattice->zlattice, 3.0); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("lattice sc 2.0"); - output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 2.0* 2.0* 2.0*.*")); lattice = lmp->domain->lattice; diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index 80082bc53c..700990fb72 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -127,15 +127,15 @@ TEST_F(FileOperationsTest, safe_fread) TEST_F(FileOperationsTest, logmesg) { char buf[8]; - ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); command("echo none"); - ::testing::internal::GetCapturedStdout(); - ::testing::internal::CaptureStdout(); + END_HIDE_OUTPUT(); + BEGIN_CAPTURE_OUTPUT(); utils::logmesg(lmp, "one\n"); command("log test_logmesg.log"); utils::logmesg(lmp, "two\n"); command("log none"); - std::string out = ::testing::internal::GetCapturedStdout(); + std::string out = END_CAPTURE_OUTPUT(); memset(buf, 0, 8); FILE *fp = fopen("test_logmesg.log", "r"); fread(buf, 1, 8, fp); diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 4bcf375dff..9928ec4b7c 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -174,32 +174,29 @@ TEST_F(MoleculeFileTest, nospecial) TEST_F(MoleculeFileTest, minimal) { - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n"); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*")); } TEST_F(MoleculeFileTest, twomols) { - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); run_mol_cmd(test_name, "", "Comment\n2 atoms\n\n" " Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n" " Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n"); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*2 molecules.*2 atoms " "with max type 2.*0 bonds.*")); } TEST_F(MoleculeFileTest, twofiles) { - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms " "with max type 2.*2 bonds with max type 1.*" "1 angles with max type 1.*0 dihedrals.*" @@ -210,7 +207,7 @@ TEST_F(MoleculeFileTest, twofiles) TEST_F(MoleculeFileTest, bonds) { - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("atom_style bond"); command("region box block 0 1 0 1 0 1"); command("create_box 2 box bond/types 2 extra/bond/per/atom 2 " @@ -232,19 +229,17 @@ TEST_F(MoleculeFileTest, bonds) " Bonds\n\n" " 1 1 1 2\n" " 2 2 1 3\n\n"); - auto output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*4 atoms.*type.*2.*" "2 bonds.*type.*2.*0 angles.*")); - ::testing::internal::CaptureStdout(); + BEGIN_CAPTURE_OUTPUT(); command("mass * 2.0"); command("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235"); - output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, MatchesRegex(".*Created 4 atoms.*")); - ::testing::internal::CaptureStdout(); + BEGIN_HIDE_OUTPUT(); Molecule *mol = lmp->atom->molecules[0]; ASSERT_EQ(mol->natoms, 4); ASSERT_EQ(lmp->atom->natoms, 4); @@ -256,8 +251,7 @@ TEST_F(MoleculeFileTest, bonds) EXPECT_DOUBLE_EQ(mol->com[2], 0.5); EXPECT_DOUBLE_EQ(mol->maxextent, sqrt(2)); EXPECT_EQ(mol->comatom, 1); - output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; + END_HIDE_OUTPUT(); } int main(int argc, char **argv) From 2b11848fcca79cfc1ef1ffdbbb1e34f4d4833004 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 15:26:57 -0400 Subject: [PATCH 164/370] bugfix from dan bolintineanu for issue reported on lammps-users by Deng Pan --- src/GRANULAR/pair_granular.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index cc210138eb..bcf262aa2c 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -446,9 +446,9 @@ void PairGranular::compute(int eflag, int vflag) if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) < EPSILON*Fscrit; + frameupdate = fabs(rsht) > EPSILON*Fscrit; else - frameupdate = fabs(rsht)*k_tangential < EPSILON*Fscrit; + frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; if (frameupdate) { shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + history[2]*history[2]); @@ -568,7 +568,7 @@ void PairGranular::compute(int eflag, int vflag) if (historyupdate) { rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; - frameupdate = fabs(rolldotn)*k_roll < EPSILON*Frcrit; + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; if (frameupdate) { // rotate into tangential plane rollmag = sqrt(history[rhist0]*history[rhist0] + history[rhist1]*history[rhist1] + From 213fc06321270fa11eff0255e1d5bb16190546d4 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 29 Mar 2021 18:05:04 -0400 Subject: [PATCH 165/370] Add GzFileWriter implementation --- src/COMPRESS/dump_atom_gz.cpp | 89 +++++++-------- src/COMPRESS/dump_atom_gz.h | 5 +- src/COMPRESS/dump_atom_zstd.cpp | 6 +- src/COMPRESS/gz_file_writer.cpp | 105 ++++++++++++++++++ src/COMPRESS/gz_file_writer.h | 47 ++++++++ src/COMPRESS/zstd_file_writer.cpp | 8 +- src/COMPRESS/zstd_file_writer.h | 2 +- src/file_writer.h | 2 +- .../formats/test_dump_atom_compressed.cpp | 4 +- 9 files changed, 207 insertions(+), 61 deletions(-) create mode 100644 src/COMPRESS/gz_file_writer.cpp create mode 100644 src/COMPRESS/gz_file_writer.h diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index f252e32064..071af2167d 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -14,6 +14,7 @@ #include "dump_atom_gz.h" #include "domain.h" #include "error.h" +#include "file_writer.h" #include "update.h" @@ -25,10 +26,6 @@ using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - gzFp = nullptr; - - compression_level = Z_BEST_COMPRESSION; - if (!compressed) error->all(FLERR,"Dump atom/gz only writes compressed files"); } @@ -37,9 +34,6 @@ DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtomGZ::~DumpAtomGZ() { - if (gzFp) gzclose(gzFp); - gzFp = nullptr; - fp = nullptr; } /* ---------------------------------------------------------------------- @@ -91,17 +85,12 @@ void DumpAtomGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - std::string mode; - if (append_flag) { - mode = fmt::format("ab{}", compression_level); - } else { - mode = fmt::format("wb{}", compression_level); + try { + writer.open(filecurrent, append_flag); + } catch (FileWriterException &e) { + error->one(FLERR, e.what()); } - - gzFp = gzopen(filecurrent, mode.c_str()); - - if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); - } else gzFp = nullptr; + } // delete string with timestep replaced @@ -112,29 +101,34 @@ void DumpAtomGZ::openfile() void DumpAtomGZ::write_header(bigint ndump) { + std::string header; + if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - gzprintf(gzFp,"ITEM: UNITS\n%s\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) gzprintf(gzFp,"ITEM: TIME\n%.16g\n",compute_time()); - gzprintf(gzFp,"ITEM: TIMESTEP\n"); - gzprintf(gzFp,BIGINT_FORMAT "\n",update->ntimestep); - gzprintf(gzFp,"ITEM: NUMBER OF ATOMS\n"); - gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); - if (domain->triclinic == 0) { - gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); - } else { - gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } - gzprintf(gzFp,"ITEM: ATOMS %s\n",columns); + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: ATOMS {}\n", columns); + + writer.write(header.c_str(), header.length()); } } @@ -142,7 +136,7 @@ void DumpAtomGZ::write_header(bigint ndump) void DumpAtomGZ::write_data(int n, double *mybuf) { - gzwrite(gzFp,mybuf,sizeof(char)*n); + writer.write(mybuf, n); } /* ---------------------------------------------------------------------- */ @@ -152,11 +146,11 @@ void DumpAtomGZ::write() DumpAtom::write(); if (filewriter) { if (multifile) { - gzclose(gzFp); - gzFp = nullptr; + writer.close(); } else { - if (flush_flag) - gzflush(gzFp,Z_SYNC_FLUSH); + if (flush_flag && writer.isopen()) { + writer.flush(); + } } } } @@ -167,14 +161,15 @@ int DumpAtomGZ::modify_param(int narg, char **arg) { int consumed = DumpAtom::modify_param(narg, arg); if (consumed == 0) { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - int min_level = Z_DEFAULT_COMPRESSION; - int max_level = Z_BEST_COMPRESSION; - compression_level = utils::inumeric(FLERR, arg[1], false, lmp); - if (compression_level < min_level || compression_level > max_level) - error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); - return 2; + try { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException &e) { + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/src/COMPRESS/dump_atom_gz.h b/src/COMPRESS/dump_atom_gz.h index 0c0b95974f..d540f5300a 100644 --- a/src/COMPRESS/dump_atom_gz.h +++ b/src/COMPRESS/dump_atom_gz.h @@ -21,7 +21,7 @@ DumpStyle(atom/gz,DumpAtomGZ) #define LMP_DUMP_ATOM_GZ_H #include "dump_atom.h" -#include +#include "gz_file_writer.h" namespace LAMMPS_NS { @@ -31,8 +31,7 @@ class DumpAtomGZ : public DumpAtom { virtual ~DumpAtomGZ(); protected: - int compression_level; - gzFile gzFp; // file pointer for the compressed output stream + GzFileWriter writer; virtual void openfile(); virtual void write_header(bigint); diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index 3dde07bbf4..300a4c81cb 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -90,12 +90,8 @@ void DumpAtomZstd::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - if (append_flag) { - error->one(FLERR, "dump/zstd currently doesn't support append"); - } - try { - writer.open(filecurrent); + writer.open(filecurrent, append_flag); } catch (FileWriterException &e) { error->one(FLERR, e.what()); } diff --git a/src/COMPRESS/gz_file_writer.cpp b/src/COMPRESS/gz_file_writer.cpp new file mode 100644 index 0000000000..d24d77b21a --- /dev/null +++ b/src/COMPRESS/gz_file_writer.cpp @@ -0,0 +1,105 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#include "gz_file_writer.h" +#include +#include "fmt/format.h" + +using namespace LAMMPS_NS; + +GzFileWriter::GzFileWriter() : FileWriter(), + compression_level(Z_BEST_COMPRESSION), + gzFp(nullptr) +{ +} + +/* ---------------------------------------------------------------------- */ + +GzFileWriter::~GzFileWriter() +{ + close(); +} + +/* ---------------------------------------------------------------------- */ + +void GzFileWriter::open(const std::string &path, bool append) +{ + if (isopen()) return; + + std::string mode; + if (append) { + mode = fmt::format("ab{}", mode, compression_level); + } else { + mode = fmt::format("wb{}", mode, compression_level); + } + + gzFp = gzopen(path.c_str(), mode.c_str()); + + if (gzFp == nullptr) + throw FileWriterException(fmt::format("Could not open file '{}'", path)); +} + +/* ---------------------------------------------------------------------- */ + +size_t GzFileWriter::write(const void * buffer, size_t length) +{ + if (!isopen()) return 0; + + return gzwrite(gzFp, buffer, length); +} + +/* ---------------------------------------------------------------------- */ + +void GzFileWriter::flush() +{ + if (!isopen()) return; + + gzflush(gzFp, Z_SYNC_FLUSH); +} + +/* ---------------------------------------------------------------------- */ + +void GzFileWriter::close() +{ + if (!isopen()) return; + + gzclose(gzFp); + gzFp = nullptr; +} + +/* ---------------------------------------------------------------------- */ + +bool GzFileWriter::isopen() const +{ + return gzFp; +} + +/* ---------------------------------------------------------------------- */ + +void GzFileWriter::setCompressionLevel(int level) +{ + if (isopen()) + throw FileWriterException("Compression level can not be changed while file is open"); + + const int min_level = Z_DEFAULT_COMPRESSION; + const int max_level = Z_BEST_COMPRESSION; + + if (level < min_level || level > max_level) + throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level)); + + compression_level = level; +} diff --git a/src/COMPRESS/gz_file_writer.h b/src/COMPRESS/gz_file_writer.h new file mode 100644 index 0000000000..28473b1164 --- /dev/null +++ b/src/COMPRESS/gz_file_writer.h @@ -0,0 +1,47 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifndef LMP_GZ_FILE_WRITER_H +#define LMP_GZ_FILE_WRITER_H + +#include "file_writer.h" +#include +#include +#include + +namespace LAMMPS_NS { + +class GzFileWriter : public FileWriter { + int compression_level; + + gzFile gzFp; // file pointer for the compressed output stream +public: + GzFileWriter(); + virtual ~GzFileWriter(); + virtual void open(const std::string &path, bool append = false) override; + virtual void close() override; + virtual void flush() override; + virtual size_t write(const void * buffer, size_t length) override; + virtual bool isopen() const override; + + void setCompressionLevel(int level); +}; + + +} + +#endif diff --git a/src/COMPRESS/zstd_file_writer.cpp b/src/COMPRESS/zstd_file_writer.cpp index f82ade605c..3356fc1ad5 100644 --- a/src/COMPRESS/zstd_file_writer.cpp +++ b/src/COMPRESS/zstd_file_writer.cpp @@ -46,11 +46,15 @@ ZstdFileWriter::~ZstdFileWriter() /* ---------------------------------------------------------------------- */ -void ZstdFileWriter::open(const std::string &path) +void ZstdFileWriter::open(const std::string &path, bool append) { if (isopen()) return; - fp = fopen(path.c_str(), "wb"); + if (append) { + fp = fopen(path.c_str(), "ab"); + } else { + fp = fopen(path.c_str(), "wb"); + } if (!fp) { throw FileWriterException(fmt::format("Could not open file '{}'", path)); diff --git a/src/COMPRESS/zstd_file_writer.h b/src/COMPRESS/zstd_file_writer.h index 30afc86994..a4dbbdff64 100644 --- a/src/COMPRESS/zstd_file_writer.h +++ b/src/COMPRESS/zstd_file_writer.h @@ -38,7 +38,7 @@ class ZstdFileWriter : public FileWriter { public: ZstdFileWriter(); virtual ~ZstdFileWriter(); - virtual void open(const std::string &path) override; + virtual void open(const std::string &path, bool append = false) override; virtual void close() override; virtual void flush() override; virtual size_t write(const void * buffer, size_t length) override; diff --git a/src/file_writer.h b/src/file_writer.h index 8597ab570d..02eef6ad70 100644 --- a/src/file_writer.h +++ b/src/file_writer.h @@ -27,7 +27,7 @@ class FileWriter { public: FileWriter() = default; virtual ~FileWriter() = default; - virtual void open(const std::string &path) = 0; + virtual void open(const std::string &path, bool append = false) = 0; virtual void close() = 0; virtual void flush() = 0; virtual size_t write(const void * buffer, size_t length) = 0; diff --git a/unittest/formats/test_dump_atom_compressed.cpp b/unittest/formats/test_dump_atom_compressed.cpp index ed591184c3..51ce44fbb4 100644 --- a/unittest/formats/test_dump_atom_compressed.cpp +++ b/unittest/formats/test_dump_atom_compressed.cpp @@ -344,7 +344,7 @@ TEST_F(DumpAtomCompressTest, compressed_modify_bad_param) command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt"))); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 compression_level 12"); ); } @@ -357,7 +357,7 @@ TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param) command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt"))); if (!verbose) ::testing::internal::GetCapturedStdout(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); ); } From 20e6174e59fab97366f89f9ea8a7280e5299027a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 21:11:07 -0400 Subject: [PATCH 166/370] cannot use tokenizer for parse_args() as the search for commata must be away of parenthesis --- src/variable.cpp | 36 +++++++++++++++++++++------- src/variable.h | 3 ++- unittest/commands/test_variables.cpp | 7 ++++-- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 76a4b84f89..3bf88db55e 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4690,23 +4690,43 @@ void Variable::atom_vector(char *word, Tree **tree, max allowed # of args = MAXFUNCARG ------------------------------------------------------------------------- */ -int Variable::parse_args(const std::string &str, char **args) +int Variable::parse_args(char *str, char **args) { + char *ptrnext; int narg = 0; - args[0] = nullptr; + char *ptr = str; - Tokenizer values(str,","); - - while (values.has_next() && narg < MAXFUNCARG) { - args[narg] = utils::strdup(values.next()); + while (ptr && narg < MAXFUNCARG) { + ptrnext = find_next_comma(ptr); + if (ptrnext) *ptrnext = '\0'; + args[narg] = utils::strdup(ptr); narg++; + ptr = ptrnext; + if (ptr) ptr++; } - if (values.has_next()) - error->all(FLERR,"Too many args in variable function"); + if (ptr) error->all(FLERR,"Too many args in variable function"); return narg; } +/* ---------------------------------------------------------------------- + find next comma in str + skip commas inside one or more nested parenthesis + only return ptr to comma at level 0, else nullptr if not found +------------------------------------------------------------------------- */ + +char *Variable::find_next_comma(char *str) +{ + int level = 0; + for (char *p = str; *p; ++p) { + if ('(' == *p) level++; + else if (')' == *p) level--; + else if (',' == *p && !level) return p; + } + return nullptr; +} + + /* ---------------------------------------------------------------------- helper routine for printing variable name with error message ------------------------------------------------------------------------- */ diff --git a/src/variable.h b/src/variable.h index a43e7f3ad7..da759ecf6a 100644 --- a/src/variable.h +++ b/src/variable.h @@ -126,7 +126,8 @@ class Variable : protected Pointers { Tree **, Tree **, int &, double *, int &); int is_atom_vector(char *); void atom_vector(char *, Tree **, Tree **, int &); - int parse_args(const std::string &, char **); + int parse_args(char *, char **); + char *find_next_comma(char *); void print_var_error(const std::string &, int, const std::string &, int, int global=1); void print_tree(Tree *, int); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index d41ad52e57..eb533aee86 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -334,8 +334,9 @@ TEST_F(VariableTest, Functions) file_vars(); BEGIN_HIDE_OUTPUT(); + command("variable seed index 643532"); command("variable one index 1"); - command("variable two equal random(1,2,643532)"); + command("variable two equal random(1,2,v_seed)"); command("variable three equal atan2(v_one,1)"); command("variable four equal atan2()"); command("variable five equal sqrt(v_one+v_one)"); @@ -346,6 +347,7 @@ TEST_F(VariableTest, Functions) command("variable ten equal floor(1.85)+ceil(1.85)"); command("variable ten1 equal tan(v_eight/2.0)"); command("variable ten2 equal asin(-1.0)+acos(0.0)"); + command("variable ten3 equal floor(100*random(0.2,0.8,v_seed)+1)"); END_HIDE_OUTPUT(); ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99); @@ -357,7 +359,8 @@ TEST_F(VariableTest, Functions) ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("nine")), 1); ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten")), 3); ASSERT_FLOAT_EQ(variable->compute_equal(variable->find("ten1")), 1); - ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten2")), 0); + ASSERT_GT(variable->compute_equal(variable->find("ten3")), 19); + ASSERT_LT(variable->compute_equal(variable->find("ten3")), 81); TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*", command("print \"${four}\"");); From 41de02ee9dd48569456532bf875344d1846a6b60 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 29 Mar 2021 23:44:38 -0400 Subject: [PATCH 167/370] update granular howto --- doc/src/Howto_granular.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/src/Howto_granular.rst b/doc/src/Howto_granular.rst index c696d44249..70c2b2fbb7 100644 --- a/doc/src/Howto_granular.rst +++ b/doc/src/Howto_granular.rst @@ -18,12 +18,13 @@ This compute calculates rotational kinetic energy which can be :doc:`output with thermodynamic info `. -Use one of these 3 pair potentials, which compute forces and torques +Use one of these 4 pair potentials, which compute forces and torques between interacting pairs of particles: -* :doc:`pair_style ` gran/history -* :doc:`pair_style ` gran/no_history -* :doc:`pair_style ` gran/hertzian +* :doc:`pair_style gran/history ` +* :doc:`pair_style gran/no_history ` +* :doc:`pair_style gran/hertzian ` +* :doc:`pair_style granular ` These commands implement fix options specific to granular systems: @@ -31,6 +32,7 @@ These commands implement fix options specific to granular systems: * :doc:`fix pour ` * :doc:`fix viscous ` * :doc:`fix wall/gran ` +* :doc:`fix wall/gran/region ` The fix style *freeze* zeroes both the force and torque of frozen atoms, and should be used for granular system instead of the fix style From ea105a3c9a15d4958a46b079416d6dd10ca18407 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 07:36:22 -0400 Subject: [PATCH 168/370] fix typo --- doc/src/pair_dpd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_dpd.rst b/doc/src/pair_dpd.rst index d1d84407c4..62cf94786d 100644 --- a/doc/src/pair_dpd.rst +++ b/doc/src/pair_dpd.rst @@ -150,7 +150,7 @@ shifted to be 0.0 at the cutoff distance Rc. The :doc:`pair_modify ` table option is not relevant for these pair styles. -These pair style do not support the :doc:`pair_modify ` +These pair styles do not support the :doc:`pair_modify ` tail option for adding long-range tail corrections to energy and pressure. From 304156138347f16f77fcc15908ba9a9112cb822f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 07:36:53 -0400 Subject: [PATCH 169/370] add proper r-RESPA support for fix cmap --- doc/src/fix_cmap.rst | 5 +++++ src/MOLECULE/fix_cmap.cpp | 17 ++++++++++++----- src/MOLECULE/fix_cmap.h | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_cmap.rst b/doc/src/fix_cmap.rst index 892fd4ab41..e6e8d0c627 100644 --- a/doc/src/fix_cmap.rst +++ b/doc/src/fix_cmap.rst @@ -127,6 +127,11 @@ the :doc:`run ` command. The forces due to this fix are imposed during an energy minimization, invoked by the :doc:`minimize ` command. +The :doc:`fix_modify ` *respa* option is supported by this +fix. This allows to set at which level of the :doc:`r-RESPA +` integrator the fix is adding its forces. Default is the +outermost level. + .. note:: If you want the potential energy associated with the CMAP terms diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 6da259f6ca..1b58037eb7 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -81,6 +81,8 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : extvector = 1; wd_header = 1; wd_section = 1; + respa_level_support = 1; + ilevel_respa = 0; MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -182,6 +184,11 @@ void FixCMAP::init() // define newton_bond here in case restart file was read (not data file) newton_bond = force->newton_bond; + + if (utils::strmatch(update->integrate_style,"^respa")) { + ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); + } } /* --------------------------------------------------------------------- */ @@ -190,12 +197,12 @@ void FixCMAP::setup(int vflag) { pre_neighbor(); - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); - post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + post_force_respa(vflag,ilevel_respa,0); + ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); } } @@ -596,7 +603,7 @@ void FixCMAP::post_force(int vflag) void FixCMAP::post_force_respa(int vflag, int ilevel, int /*iloop*/) { - if (ilevel == nlevels_respa-1) post_force(vflag); + if (ilevel == ilevel_respa) post_force(vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/fix_cmap.h b/src/MOLECULE/fix_cmap.h index 39d10bd77b..cd0c01a921 100644 --- a/src/MOLECULE/fix_cmap.h +++ b/src/MOLECULE/fix_cmap.h @@ -67,7 +67,7 @@ class FixCMAP : public Fix { private: int nprocs,me; int newton_bond,eflag_caller; - int ctype,nlevels_respa; + int ctype,ilevel_respa; int ncrosstermtypes,crossterm_per_atom,maxcrossterm; int ncrosstermlist; bigint ncmap; From 40f1a74a7f39f0a281652ed611d3ecc3fc95ec9e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 07:37:39 -0400 Subject: [PATCH 170/370] use more precise detection of verlet and respa run styles --- src/fix_addforce.cpp | 4 ++-- src/fix_recenter.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 07031a40a4..a9f6248995 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -193,7 +193,7 @@ void FixAddForce::init() update->whichflag == 2 && estyle == NONE) error->all(FLERR,"Must use variable energy with fix addforce"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -203,7 +203,7 @@ void FixAddForce::init() void FixAddForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index 1db74981b6..f5e4513d74 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -144,7 +144,7 @@ void FixRecenter::init() zinit = xcm[2]; } - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } From bfca619957830e7a8168753c7ae778e5e3e947f8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 07:49:15 -0400 Subject: [PATCH 171/370] fix typos --- doc/src/pair_fep_soft.rst | 2 +- doc/src/pair_gayberne.rst | 2 +- doc/src/pair_vashishta.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/pair_fep_soft.rst b/doc/src/pair_fep_soft.rst index 109ddfdf21..1bb50fad1f 100644 --- a/doc/src/pair_fep_soft.rst +++ b/doc/src/pair_fep_soft.rst @@ -363,7 +363,7 @@ Mixing, shift, table, tail correction, restart, rRESPA info The different versions of the *lj/cut/soft* pair styles support mixing. For atom type pairs I,J and I != J, the :math:`\epsilon` and :math:`\sigma` -coefficients and cutoff distance for these pair style can be mixed. The default +coefficients and cutoff distance for these pair styles can be mixed. The default mix value is *geometric* for 12-6 styles. The mixing rule for epsilon and sigma for *lj/class2/soft* 9-6 potentials is to diff --git a/doc/src/pair_gayberne.rst b/doc/src/pair_gayberne.rst index 19597b9018..448f3a26de 100644 --- a/doc/src/pair_gayberne.rst +++ b/doc/src/pair_gayberne.rst @@ -188,7 +188,7 @@ Restrictions The *gayberne* style is part of the ASPHERE package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. -These pair style require that atoms store torque and a quaternion to +These pair styles require that atoms store torque and a quaternion to represent their orientation, as defined by the :doc:`atom_style `. It also require they store a per-type :doc:`shape `. The particles cannot store a per-particle diff --git a/doc/src/pair_vashishta.rst b/doc/src/pair_vashishta.rst index aef401ec7c..9edb77ecbe 100644 --- a/doc/src/pair_vashishta.rst +++ b/doc/src/pair_vashishta.rst @@ -217,7 +217,7 @@ This pair style can only be used via the *pair* keyword of the Restrictions """""""""""" -These pair style are part of the MANYBODY package. They is only +These pair styles are part of the MANYBODY package. They are only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. These pair styles requires the :doc:`newton ` setting to be "on" From 57ad6d50f45ed5974d8cecf1ca0ed08ced0975b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 10:35:04 -0400 Subject: [PATCH 172/370] silence compiler warnings --- src/KOKKOS/atom_vec_hybrid_kokkos.cpp | 1 - src/USER-REACTION/fix_bond_react.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp index 907d1d555f..c962ed0c71 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp @@ -1171,7 +1171,6 @@ void AtomVecHybridKokkos::build_styles() allstyles = new char*[nallstyles]; - int n; nallstyles = 0; #define ATOM_CLASS #define AtomStyle(key,Class) \ diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 17754c8297..2b88a8a264 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -682,7 +682,6 @@ it will have the name 'i_limit_tags' and will be intitialized to 0 (not in group void FixBondReact::post_constructor() { - int len; // let's add the limit_tags per-atom property fix std::string cmd = std::string("bond_react_props_internal"); id_fix2 = new char[cmd.size()+1]; From 71dbf43e090a6c6e93126efa4a4e293f29fae9df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 11:10:59 -0400 Subject: [PATCH 173/370] error our when Fix:set_molecule() is called with unsupported fixes also add example input for using fix rigid/small with fix deposit --- .../deposit/in.deposit.molecule.rigid-small | 56 +++++ examples/deposit/in.deposit.molecule.shake | 4 +- ...10Mar21.deposit.molecule.rigid-small.g++.1 | 218 ++++++++++++++++++ ...10Mar21.deposit.molecule.rigid-small.g++.4 | 218 ++++++++++++++++++ src/RIGID/fix_rigid_nh_small.cpp | 13 ++ src/RIGID/fix_rigid_nh_small.h | 1 + src/RIGID/fix_rigid_small.h | 2 +- src/fix.cpp | 6 + src/fix.h | 2 +- 9 files changed, 516 insertions(+), 4 deletions(-) create mode 100644 examples/deposit/in.deposit.molecule.rigid-small create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1 create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4 diff --git a/examples/deposit/in.deposit.molecule.rigid-small b/examples/deposit/in.deposit.molecule.rigid-small new file mode 100644 index 0000000000..2e6a84e54b --- /dev/null +++ b/examples/deposit/in.deposit.molecule.rigid-small @@ -0,0 +1,56 @@ +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +region slab block 0 5 0 5 8 9 + +group addatoms empty +region mobile block 0 5 0 5 2 INF +group mobile region mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/small molecule mol dimer +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 & + mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 diff --git a/examples/deposit/in.deposit.molecule.shake b/examples/deposit/in.deposit.molecule.shake index 7bd701c924..30c6bd7a53 100644 --- a/examples/deposit/in.deposit.molecule.shake +++ b/examples/deposit/in.deposit.molecule.shake @@ -21,11 +21,11 @@ bond_coeff 1 5.0 1.0 neigh_modify delay 0 -group addatoms type 2 +group addatoms empty region mobile block 0 5 0 5 2 INF group mobile region mobile -compute add addatoms temp +compute add addatoms temp compute_modify add dynamic/dof yes extra/dof 0 fix 1 addatoms nve diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1 new file mode 100644 index 0000000000..0f5a1afcfa --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.1 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 1 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.001 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/small molecule mol dimer + create bodies CPU = 0.000 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.929 | 5.929 | 5.929 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8875167 -6.8803581 -0.73353914 + 200 354 1.0081552 -6.8594643 -6.8452248 -0.70421276 + 300 356 1.0085803 -6.8171524 -6.7959042 -0.6917826 + 400 358 1.0099188 -6.7852701 -6.7570601 -0.70371699 + 500 360 1.0140221 -6.7493429 -6.7141338 -0.68415307 + 600 362 1.026148 -6.7105231 -6.6680032 -0.68314418 + 700 364 1.0683344 -6.6725162 -6.621154 -0.65747369 + 800 366 1.0958952 -6.6412275 -6.5813425 -0.68789614 + 900 368 1.1250033 -6.6101882 -6.541404 -0.66674346 + 1000 370 1.2326373 -6.5993719 -6.5160856 -0.6968868 + 1100 372 1.1397426 -6.5912861 -6.5070309 -0.63330356 + 1200 374 1.0514292 -6.5905747 -6.5062354 -0.71020362 + 1300 376 1.003296 -6.5747765 -6.4880555 -0.65459732 + 1400 378 0.82999289 -6.5681797 -6.4913285 -0.60438126 + 1500 380 0.90239175 -6.575298 -6.4862461 -0.66528725 + 1600 382 0.86399799 -6.5692206 -6.4787496 -0.65027781 + 1700 384 0.64747231 -6.5644237 -6.4927634 -0.6304614 + 1800 386 0.74288971 -6.5515735 -6.4649672 -0.67772325 + 1900 388 0.7257202 -6.5565091 -6.4676644 -0.66173549 + 2000 390 0.73381036 -6.5631515 -6.4690733 -0.64685916 + 2100 392 0.76476562 -6.5574124 -6.4549885 -0.68866192 + 2200 394 0.65932468 -6.5511557 -6.459118 -0.71728829 + 2300 396 0.70269509 -6.5728146 -6.4707819 -0.64362081 + 2400 398 0.60528919 -6.5845991 -6.4933494 -0.63956327 + 2500 400 0.51025744 -6.5812452 -6.5015175 -0.68706961 + 2600 402 0.5245131 -6.6003894 -6.5155801 -0.68972215 + 2700 404 0.46330251 -6.5659175 -6.4885092 -0.72870942 + 2800 406 0.48039778 -6.5715192 -6.488692 -0.753758 + 2900 408 0.53698616 -6.5813154 -6.4858951 -0.67117541 + 3000 410 0.50231419 -6.5886963 -6.4968096 -0.71905351 + 3100 412 0.49420225 -6.596733 -6.5037702 -0.65947518 + 3200 414 0.42703699 -6.5879338 -6.5054146 -0.80033546 + 3300 416 0.44306009 -6.580249 -6.4923825 -0.76503083 + 3400 418 0.55620672 -6.5923388 -6.4792346 -0.69367877 + 3500 420 0.39815033 -6.5911154 -6.5081674 -0.65569211 + 3600 422 0.44197847 -6.6026382 -6.5083774 -0.73299102 + 3700 424 0.45049389 -6.6060616 -6.5077817 -0.7552914 + 3800 426 0.43047295 -6.6079275 -6.51193 -0.71501328 + 3900 428 0.43779129 -6.6099306 -6.5102001 -0.71539515 + 4000 430 0.41113503 -6.6123009 -6.5166881 -0.74177096 + 4100 432 0.32800011 -6.5983566 -6.5205325 -0.71688103 + 4200 434 0.39168203 -6.6110342 -6.5162724 -0.78927697 + 4300 436 0.48151013 -6.6183315 -6.4996106 -0.70523035 + 4400 438 0.45391027 -6.6331732 -6.5191775 -0.7270855 + 4500 440 0.349126 -6.6091657 -6.5199006 -0.76974115 + 4600 442 0.43375023 -6.6219188 -6.5090653 -0.74576212 + 4700 444 0.40071749 -6.6184164 -6.5123707 -0.71919052 + 4800 446 0.414292 -6.6298132 -6.5183445 -0.76237313 + 4900 448 0.44210681 -6.6364174 -6.5155288 -0.78753121 + 5000 450 0.36101771 -6.6232703 -6.5229876 -0.73927083 + 5100 452 0.41481171 -6.6442404 -6.5272305 -0.76316209 + 5200 454 0.40283527 -6.6512252 -6.5358759 -0.79645689 + 5300 456 0.3642061 -6.6530346 -6.5472072 -0.77458364 + 5400 458 0.38449826 -6.6514864 -6.5381518 -0.73083784 + 5500 460 0.42559408 -6.6769326 -6.5497169 -0.78932279 + 5600 462 0.38905756 -6.6698705 -6.5519743 -0.77118812 + 5700 464 0.38354955 -6.6706904 -6.5528977 -0.75067129 + 5800 466 0.36760943 -6.6942519 -6.5798669 -0.685487 + 5900 468 0.30783118 -6.6838159 -6.5867965 -0.79233808 + 6000 470 0.33145368 -6.6733504 -6.5675673 -0.84390449 + 6100 472 0.39252324 -6.6912189 -6.5643973 -0.83342022 + 6200 474 0.32342144 -6.6906083 -6.5848481 -0.71262158 + 6300 476 0.34445238 -6.7008453 -6.5868721 -0.76650756 + 6400 478 0.38152782 -6.7017838 -6.5740758 -0.77113022 + 6500 480 0.37540166 -6.7119996 -6.5849105 -0.79907635 + 6600 482 0.3579419 -6.7034721 -6.5809401 -0.8141269 + 6700 484 0.33538235 -6.6916682 -6.575601 -0.83265486 + 6800 486 0.34081871 -6.6931924 -6.573976 -0.80582583 + 6900 488 0.3555283 -6.6939997 -6.5683263 -0.74771423 + 7000 490 0.3543769 -6.7093364 -6.5827732 -0.77643516 + 7100 492 0.31263107 -6.698361 -6.5855723 -0.73108333 + 7200 494 0.32107 -6.6959056 -6.5789166 -0.7575478 + 7300 496 0.32908165 -6.7137605 -6.592677 -0.86538023 + 7400 498 0.32539571 -6.7030353 -6.5821554 -0.79337428 + 7500 500 0.33902577 -6.7078178 -6.5806832 -0.85408988 + 7600 502 0.35530921 -6.707507 -6.5730274 -0.79914613 + 7700 504 0.32391812 -6.6978823 -6.5741635 -0.78603595 + 7800 506 0.36390015 -6.7151325 -6.5748943 -0.83164222 + 7900 508 0.3372561 -6.7086718 -6.5775535 -0.7949992 + 8000 510 0.36612946 -6.7225238 -6.5789437 -0.80322866 + 8100 512 0.34622305 -6.7229825 -6.5860486 -0.70478659 + 8200 514 0.3212233 -6.7202524 -6.5921381 -0.91836713 + 8300 516 0.3402461 -6.721488 -6.5846642 -0.88273592 + 8400 518 0.34070258 -6.7268378 -6.5887152 -0.76057264 + 8500 520 0.36267747 -6.744602 -6.5963924 -0.81051317 + 8600 522 0.3439948 -6.7376267 -6.595943 -0.84600203 + 8700 524 0.30960289 -6.7276471 -6.5991382 -0.90965986 + 8800 526 0.28868972 -6.7159628 -6.595218 -0.876093 + 8900 528 0.31020216 -6.7162903 -6.5855707 -0.83193125 + 9000 530 0.31836275 -6.7171479 -6.5819939 -0.82093897 + 9100 532 0.32543293 -6.724167 -6.5850016 -0.7690143 + 9200 534 0.32644265 -6.7139575 -6.5733549 -0.86903096 + 9300 536 0.33050759 -6.7254715 -6.5821077 -0.94504522 + 9400 538 0.30372582 -6.7139931 -6.5813247 -0.91128612 + 9500 540 0.32943659 -6.7206223 -6.5757312 -0.87818439 + 9600 542 0.30911968 -6.708091 -6.5712114 -0.79092372 + 9700 544 0.33909826 -6.7222948 -6.5711342 -0.80266151 + 9800 546 0.29015141 -6.7086869 -6.5784908 -0.87763769 + 9900 548 0.33838474 -6.7384955 -6.5856667 -0.85630604 + 10000 550 0.30213198 -6.7338924 -6.5965597 -0.75738882 +Loop time of 17.2852 on 1 procs for 10000 steps with 550 atoms + +Performance: 249924.414 tau/day, 578.529 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 9.637 | 9.637 | 9.637 | 0.0 | 55.75 +Bond | 0.025444 | 0.025444 | 0.025444 | 0.0 | 0.15 +Neigh | 4.6852 | 4.6852 | 4.6852 | 0.0 | 27.11 +Comm | 0.65556 | 0.65556 | 0.65556 | 0.0 | 3.79 +Output | 0.0099883 | 0.0099883 | 0.0099883 | 0.0 | 0.06 +Modify | 2.1895 | 2.1895 | 2.1895 | 0.0 | 12.67 +Other | | 0.08248 | | | 0.48 + +Nlocal: 550.000 ave 550 max 550 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2367.00 ave 2367 max 2367 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 36781.0 ave 36781 max 36781 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 36781 +Ave neighs/atom = 66.874545 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 840 +Dangerous builds = 0 +Total wall time: 0:00:17 diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4 new file mode 100644 index 0000000000..0dcae43ba2 --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-small.g++.4 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 4 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.139 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/small molecule mol dimer + create bodies CPU = 0.006 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.255 | 5.852 | 6.302 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8946578 -6.8874992 -0.73775337 + 200 354 1.0081552 -6.8645575 -6.850318 -0.69629729 + 300 356 1.0085803 -6.821677 -6.8004288 -0.69532657 + 400 358 1.0099188 -6.7837923 -6.7555822 -0.68879568 + 500 360 1.0140221 -6.7446709 -6.7094618 -0.72991641 + 600 362 1.026146 -6.7129201 -6.6704003 -0.67063836 + 700 364 1.0683193 -6.6776523 -6.6262908 -0.65572472 + 800 366 1.0958893 -6.6402029 -6.5803182 -0.66307281 + 900 368 1.1231768 -6.6050912 -6.5364187 -0.64076928 + 1000 370 1.1976283 -6.5942507 -6.5133299 -0.69249019 + 1100 372 1.0506263 -6.5772313 -6.499564 -0.63072939 + 1200 374 0.93724351 -6.5732957 -6.4981157 -0.64963897 + 1300 376 0.93899686 -6.5578406 -6.4766773 -0.65096289 + 1400 378 0.8704974 -6.5468498 -6.4662482 -0.67613931 + 1500 380 0.84490693 -6.5401094 -6.4567304 -0.64385968 + 1600 382 0.9243154 -6.5611604 -6.4643734 -0.62096869 + 1700 384 0.67202953 -6.5590557 -6.4846775 -0.67807465 + 1800 386 0.8712464 -6.5654953 -6.4639251 -0.65860236 + 1900 388 0.70011668 -6.5808612 -6.495151 -0.65146463 + 2000 390 0.64019295 -6.5652168 -6.4831408 -0.70291888 + 2100 392 0.67578277 -6.5596196 -6.469113 -0.63315981 + 2200 394 0.60785287 -6.558941 -6.4740885 -0.7133822 + 2300 396 0.8155086 -6.5756022 -6.4571887 -0.69176417 + 2400 398 0.69028748 -6.5875474 -6.483484 -0.63743938 + 2500 400 0.5013913 -6.5871851 -6.5088427 -0.65872179 + 2600 402 0.51268385 -6.5782356 -6.495339 -0.74289067 + 2700 404 0.57745388 -6.5815718 -6.4850912 -0.67922914 + 2800 406 0.47317895 -6.5974978 -6.5159152 -0.64657562 + 2900 408 0.50593124 -6.6019054 -6.5120034 -0.64211427 + 3000 410 0.44423233 -6.5956684 -6.5144064 -0.66526127 + 3100 412 0.40808865 -6.5949863 -6.5182221 -0.62722445 + 3200 414 0.40692632 -6.5866689 -6.5080358 -0.76440608 + 3300 416 0.43908529 -6.5851721 -6.4980939 -0.69345883 + 3400 418 0.53825907 -6.5880076 -6.478553 -0.69726204 + 3500 420 0.46363057 -6.6135193 -6.5169296 -0.58015901 + 3600 422 0.39262699 -6.621857 -6.5381213 -0.74921264 + 3700 424 0.42679205 -6.6146579 -6.5215488 -0.69040431 + 3800 426 0.38997492 -6.6139725 -6.5270063 -0.78237667 + 3900 428 0.5222531 -6.6403886 -6.5214174 -0.78298122 + 4000 430 0.47841128 -6.6502681 -6.5390097 -0.68125967 + 4100 432 0.44609186 -6.6610827 -6.5552392 -0.81157037 + 4200 434 0.4591431 -6.6858064 -6.5747234 -0.79000753 + 4300 436 0.40690573 -6.6800195 -6.579693 -0.6781696 + 4400 438 0.43023944 -6.6849804 -6.5769294 -0.7620548 + 4500 440 0.40889421 -6.6783124 -6.5737656 -0.8577593 + 4600 442 0.41452051 -6.6968565 -6.5890061 -0.70427746 + 4700 444 0.36740394 -6.6920933 -6.5948636 -0.69303162 + 4800 446 0.40112316 -6.6869413 -6.5790158 -0.84792822 + 4900 448 0.42437165 -6.6789835 -6.5629444 -0.82278531 + 5000 450 0.41822898 -6.6770254 -6.5608507 -0.72224472 + 5100 452 0.38445688 -6.6738997 -6.5654522 -0.7022418 + 5200 454 0.39998238 -6.6670536 -6.5525212 -0.73639959 + 5300 456 0.39471029 -6.6728592 -6.5581681 -0.70419927 + 5400 458 0.35817807 -6.6702423 -6.5646658 -0.81657219 + 5500 460 0.37151428 -6.6690855 -6.558035 -0.78076653 + 5600 462 0.32642513 -6.6622352 -6.5633185 -0.69118644 + 5700 464 0.43665879 -6.6811227 -6.5470195 -0.77500043 + 5800 466 0.40704721 -6.6858874 -6.5592311 -0.72683597 + 5900 468 0.3861903 -6.6896953 -6.5679794 -0.78001958 + 6000 470 0.34073346 -6.6833717 -6.574627 -0.78170837 + 6100 472 0.39953874 -6.7083668 -6.5792785 -0.81791744 + 6200 474 0.36685189 -6.7114648 -6.5915027 -0.80545451 + 6300 476 0.35851799 -6.7261023 -6.607475 -0.77350495 + 6400 478 0.41771823 -6.7427425 -6.6029205 -0.85319003 + 6500 480 0.36519478 -6.732662 -6.6090284 -0.78712805 + 6600 482 0.30669571 -6.7269784 -6.6219892 -0.76698134 + 6700 484 0.3384344 -6.7261448 -6.6090213 -0.79935239 + 6800 486 0.36420902 -6.7320259 -6.6046277 -0.84650552 + 6900 488 0.40181215 -6.7490619 -6.6070279 -0.75753238 + 7000 490 0.30536068 -6.7398924 -6.6308351 -0.73210162 + 7100 492 0.28813004 -6.7257287 -6.6217794 -0.92178435 + 7200 494 0.30956277 -6.7342688 -6.6214727 -0.77532949 + 7300 496 0.36625115 -6.7528159 -6.6180561 -0.76247835 + 7400 498 0.30935271 -6.7401433 -6.6252231 -0.82809158 + 7500 500 0.33222282 -6.7410421 -6.6164585 -0.81948236 + 7600 502 0.33318693 -6.7488106 -6.622704 -0.82395904 + 7700 504 0.34570598 -6.7547394 -6.6226989 -0.85644369 + 7800 506 0.34587242 -6.7446006 -6.6113099 -0.82476511 + 7900 508 0.2969166 -6.7305429 -6.6151078 -0.8210214 + 8000 510 0.32355758 -6.7437629 -6.6168776 -0.81719054 + 8100 512 0.33784479 -6.7545537 -6.6209335 -0.78082067 + 8200 514 0.32351289 -6.7525032 -6.6234757 -0.87093587 + 8300 516 0.31900134 -6.7550972 -6.6268166 -0.79928704 + 8400 518 0.3338521 -6.7588757 -6.6235302 -0.81699503 + 8500 520 0.33115184 -6.7614854 -6.6261589 -0.79958489 + 8600 522 0.29478929 -6.7490188 -6.6276018 -0.81954456 + 8700 524 0.267993 -6.7467764 -6.6355389 -0.76642994 + 8800 526 0.28792085 -6.7527118 -6.6322887 -0.86911619 + 8900 528 0.32430992 -6.75901 -6.6223453 -0.87087898 + 9000 530 0.33151321 -6.7534845 -6.6127478 -0.79309499 + 9100 532 0.32760982 -6.7599992 -6.6199028 -0.7506309 + 9200 534 0.32579101 -6.7671489 -6.6268269 -0.94238755 + 9300 536 0.35144354 -6.7782581 -6.625813 -0.77952234 + 9400 538 0.33689976 -6.7804455 -6.6332867 -0.75768501 + 9500 540 0.3052486 -6.7745436 -6.6402908 -0.89621525 + 9600 542 0.30617581 -6.7648172 -6.6292412 -0.90623541 + 9700 544 0.30097715 -6.7714379 -6.6372707 -0.85534149 + 9800 546 0.31297479 -6.7814978 -6.6410604 -0.88651064 + 9900 548 0.31832347 -6.790661 -6.6468926 -1.006 + 10000 550 0.29239559 -6.7823137 -6.6494066 -1.0337518 +Loop time of 34.7661 on 4 procs for 10000 steps with 550 atoms + +Performance: 124259.065 tau/day, 287.637 timesteps/s +73.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0076709 | 3.1286 | 9.1834 | 211.7 | 9.00 +Bond | 0.0040276 | 0.010416 | 0.022169 | 7.0 | 0.03 +Neigh | 0.052413 | 1.5948 | 4.885 | 155.3 | 4.59 +Comm | 4.9736 | 12.242 | 20.073 | 166.2 | 35.21 +Output | 0.053549 | 0.10104 | 0.21642 | 21.0 | 0.29 +Modify | 13.435 | 16.191 | 23.851 | 110.0 | 46.57 +Other | | 1.499 | | | 4.31 + +Nlocal: 137.500 ave 299 max 2 min +Histogram: 2 0 0 0 0 0 0 1 0 1 +Nghost: 1898.75 ave 2679 max 524 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Neighs: 9204.00 ave 23014 max 0 min +Histogram: 2 0 0 0 0 1 0 0 0 1 + +Total # of neighbors = 36816 +Ave neighs/atom = 66.938182 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 832 +Dangerous builds = 0 +Total wall time: 0:00:34 diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index af2adb540d..3956fcf35d 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -1365,6 +1365,19 @@ int FixRigidNHSmall::modify_param(int narg, char **arg) return FixRigidSmall::modify_param(narg,arg); } +/* ---------------------------------------------------------------------- + disallow using fix rigid/n??/small fixes with fix deposit + we would need custom functionality to update data structures + used by all fixes derived from this class but not fix rigid/small +------------------------------------------------------------------------- */ + +void FixRigidNHSmall::set_molecule(int, tagint, int, + double *, double *, double *) +{ + error->all(FLERR,fmt::format("Molecule update not (yet) implemented for " + "fix {}", style)); +} + /* ---------------------------------------------------------------------- */ void FixRigidNHSmall::allocate_chain() diff --git a/src/RIGID/fix_rigid_nh_small.h b/src/RIGID/fix_rigid_nh_small.h index e04290aee8..32c4c1ab74 100644 --- a/src/RIGID/fix_rigid_nh_small.h +++ b/src/RIGID/fix_rigid_nh_small.h @@ -80,6 +80,7 @@ class FixRigidNHSmall : public FixRigidSmall { void nh_epsilon_dot(); void compute_dof(); + void set_molecule(int, tagint, int, double *, double *, double *); void allocate_chain(); void allocate_order(); void deallocate_chain(); diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h index d6e97c06fd..6534017971 100644 --- a/src/RIGID/fix_rigid_small.h +++ b/src/RIGID/fix_rigid_small.h @@ -43,7 +43,7 @@ class FixRigidSmall : public Fix { void grow_arrays(int); void copy_arrays(int, int, int); void set_arrays(int); - void set_molecule(int, tagint, int, double *, double *, double *); + virtual void set_molecule(int, tagint, int, double *, double *, double *); int pack_exchange(int, double *); int unpack_exchange(int, double *); diff --git a/src/fix.cpp b/src/fix.cpp index b9d9fb3969..32a76cc125 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -174,6 +174,12 @@ void Fix::modify_params(int narg, char **arg) } } +void::Fix::set_molecule(int, tagint, int, double *, double *, double *) +{ + error->all(FLERR,fmt::format("Molecule update not implemented for " + "fix {}", style)); +} + /* ---------------------------------------------------------------------- setup for peratom energy and global/peratom virial computation see integrate::ev_set() for values of eflag (0-3) and vflag (0-6) diff --git a/src/fix.h b/src/fix.h index 7092b56c8f..31add74ee4 100644 --- a/src/fix.h +++ b/src/fix.h @@ -155,7 +155,7 @@ class Fix : protected Pointers { virtual void copy_arrays(int, int, int) {} virtual void set_arrays(int) {} virtual void update_arrays(int, int) {} - virtual void set_molecule(int, tagint, int, double *, double *, double *) {} + virtual void set_molecule(int, tagint, int, double *, double *, double *); virtual void clear_bonus() {} virtual int pack_border(int, int *, double *) {return 0;} From 24d9d6d17d1fbe1485b86debdf7c3bdac854bca0 Mon Sep 17 00:00:00 2001 From: "Ronald E. Miller" Date: Tue, 30 Mar 2021 11:27:39 -0400 Subject: [PATCH 174/370] update to kim_interactions to correctly handle incorrect combinations of periodic and f/s boundary conditions when the SM has to choose between kspace or real space coulomb calculations. This version treats "p p p" in kspace, "f f f" or "s s s" in realspace, and "p p f" with kspace-slab. all others are sent to kspace-slab and then caught there as an error. --- src/KIM/kim_interactions.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index b6a1ed6f47..c3da21b50d 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -94,6 +94,7 @@ void KimInteractions::command(int narg, char **arg) void KimInteractions::do_setup(int narg, char **arg) { + static bool kim_update=0; bool fixed_types; if ((narg == 1) && (0 == strcmp("fixed_types",arg[0]))) { fixed_types = true; @@ -185,9 +186,11 @@ void KimInteractions::do_setup(int narg, char **arg) KIM_SimulatorModel_GetSimulatorFieldMetadata( simulatorModel,i,&sim_lines,&sim_field); if (0 == strcmp(sim_field,"model-defn")) { + if (kim_update) input->one("variable kim_update equal 1"); + else input->one("variable kim_update equal 0"); if (domain->periodicity[0]&&domain->periodicity[1]&&domain->periodicity[2]) input->one("variable kim_periodic equal 1"); - else if (domain->periodicity[0]&&domain->periodicity[1]&&!domain->periodicity[2]) input->one("variable kim_periodic equal 2"); - else input->one("variable kim_periodic equal 0"); + else if (!domain->periodicity[0]&&!domain->periodicity[1]&&!domain->periodicity[2]) input->one("variable kim_periodic equal 0"); + else input->one("variable kim_periodic equal 2"); sim_model_idx = i; for (int j=0; j < sim_lines; ++j) { KIM_SimulatorModel_GetSimulatorFieldLine( @@ -217,7 +220,8 @@ void KimInteractions::do_setup(int narg, char **arg) KIM_SimulatorModel_OpenAndInitializeTemplateMap(simulatorModel); - } else { + } else if (!kim_update) { + // not a simulator model. issue pair_style and pair_coeff commands. @@ -242,6 +246,7 @@ void KimInteractions::do_setup(int narg, char **arg) // End output to log file input->write_echo("#=== END kim_interactions ====================================\n\n"); + kim_update=1; } /* ---------------------------------------------------------------------- */ From 2dbf59efa9fb4f30456a7cbb00f5a2b8eaeaecbe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 11:43:56 -0400 Subject: [PATCH 175/370] update install instructions for updates via patch and git for CMake/GNU make --- doc/src/Install_git.rst | 70 +++++++++++++++++++++++++++------------ doc/src/Install_patch.rst | 62 +++++++++++++++++++++++++--------- 2 files changed, 94 insertions(+), 38 deletions(-) diff --git a/doc/src/Install_git.rst b/doc/src/Install_git.rst index a84f31a80d..3c10171ea3 100644 --- a/doc/src/Install_git.rst +++ b/doc/src/Install_git.rst @@ -86,33 +86,59 @@ check out any other desired branch) first. Once you have updated your local files with a ``git pull`` (or ``git checkout``), you still need to re-build LAMMPS if any source files have -changed. To do this, you should cd to the src directory and type: +changed. How to do this depends on the build system you are using. -.. code-block:: bash +.. tabs:: - $ make purge # remove any deprecated src files - $ make package-update # sync package files with src files - $ make foo # re-build for your machine (mpi, serial, etc) + .. tab:: CMake build -just as described on the :doc:`Apply patch ` page, -after a patch has been installed. + Change to your build folder and type: -.. warning:: + .. code-block:: bash - If you wish to edit/change a src file that is from a - package, you should edit the version of the file inside the package - sub-directory with src, then re-install the package. The version in - the source directory is merely a copy and will be wiped out if you type "make - package-update". + cmake . --build -.. warning:: + CMake should auto-detect whether it needs to re-run the CMake + configuration step and otherwise redo the build for all files + that have been changed or files that depend on changed files. + In case some build options have been changed or renamed, you + may have to update those by running: - The GitHub servers support both the "git://" and - "https://" access protocols for anonymous read-only access. If you - have a correspondingly configured GitHub account, you may also use - SSH access with the URL "git@github.com:lammps/lammps.git". + .. code-block:: bash -The LAMMPS GitHub project is managed by Christoph Junghans (LANL, -junghans at lanl.gov), Axel Kohlmeyer (Temple U, akohlmey at -gmail.com) and Richard Berger (Temple U, richard.berger at -temple.edu). + cmake . + + and then rebuild. + + .. tab:: Traditional make + + Switch to the src directory and type: + + .. code-block:: bash + + $ make purge # remove any deprecated src files + $ make package-update # sync package files with src files + $ make foo # re-build for your machine (mpi, serial, etc) + + Just as described on the :doc:`Apply patch ` page, + after a patch has been installed. + + .. warning:: + + If you wish to edit/change a src file that is from a package, + you should edit the version of the file inside the package + sub-directory with src, then re-install the package. The + version in the source directory is merely a copy and will be + wiped out if you type "make package-update". + +.. admonition:: Git protocols + :class: note + + The servers at github.com support the "git://" and "https://" access + protocols for anonymous, read-only access. If you have a suitably + configured GitHub account, you may also use SSH protocol with the + URL "git@github.com:lammps/lammps.git". + +The LAMMPS GitHub project is currently managed by Axel Kohlmeyer +(Temple U, akohlmey at gmail.com) and Richard Berger (Temple U, +richard.berger at temple.edu). diff --git a/doc/src/Install_patch.rst b/doc/src/Install_patch.rst index 39e007bb67..b1f36b19e0 100644 --- a/doc/src/Install_patch.rst +++ b/doc/src/Install_patch.rst @@ -43,24 +43,54 @@ up to date. * A list of updated files print out to the screen. The -b switch creates backup files of your originals (e.g. src/force.cpp.orig), so you can manually undo the patch if something goes wrong. -* Type the following from the src directory, to enforce consistency - between the src and package directories. This is OK to do even if you - don't use one or more packages. If you are applying several patches - successively, you only need to type this once at the end. The purge - command removes deprecated src files if any were removed by the patch - from package sub-directories. - .. code-block:: bash +* Once you have updated your local files you need to re-build LAMMPS. + If you are applying several patches successively, you only need to + do the rebuild once at the end. How to do it depends on the build + system you are using. - $ make purge - $ make package-update + .. tabs:: -* Re-build LAMMPS via the "make" command. + .. tab:: CMake build -.. warning:: + Change to your build folder and type: - If you wish to edit/change a source file that is part of a package, - you should edit the version of the file inside the package folder in - src, and then re-install or update the package. The version in the - src directory is merely a copy and will be wiped out when you type - "make package-update". + .. code-block:: bash + + cmake . --build + + CMake should auto-detect whether it needs to re-run the CMake + configuration step and otherwise redo the build for all files + that have been changed or files that depend on changed files. + In case some build options have been changed or renamed, you + may have to update those by running: + + .. code-block:: bash + + cmake . + + and then rebuild. + + .. tab:: Traditional make + + Switch to the src directory and type: + + .. code-block:: bash + + $ make purge # remove any deprecated src files + $ make package-update # sync package files with src files + $ make foo # re-build for your machine (mpi, serial, etc) + + to enforce consistency of the source between the src folder + and package directories. This is OK to do even if you don't + use any packages. The "make purge" command removes any deprecated + src files if they were removed by the patch from a package + sub-directory. + + .. warning:: + + If you wish to edit/change a src file that is from a package, + you should edit the version of the file inside the package + sub-directory with src, then re-install the package. The + version in the source directory is merely a copy and will be + wiped out if you type "make package-update". From 4ee24b85b0e786b6bf98f998fd4d45e8994da20b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 11:45:47 -0400 Subject: [PATCH 176/370] fix a few minor issues with the docs --- doc/src/Build_basics.rst | 2 +- doc/src/angle_cosine_periodic.rst | 6 ------ doc/src/dihedral_table.rst | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index af6120630d..30e668a283 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -1,7 +1,7 @@ Basic build options =================== -The following topics are covered on this page, for building both with +The following topics are covered on this page, for building with both CMake and make: * :ref:`Serial vs parallel build ` diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index 8c60ac1ebb..4983745618 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -71,9 +71,3 @@ Default none ----------- - -.. _cosine-Mayo: - -**(Mayo)** Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909 -(1990). diff --git a/doc/src/dihedral_table.rst b/doc/src/dihedral_table.rst index f1b14065fd..a456fecebd 100644 --- a/doc/src/dihedral_table.rst +++ b/doc/src/dihedral_table.rst @@ -15,10 +15,10 @@ Syntax .. code-block:: LAMMPS - dihedral_style style interp Ntable + dihedral_style style interpolation Ntable * style = *table* or *table/cut* -* interp = *linear* or *spline* = method of interpolation +* interpolation = *linear* or *spline* = method of interpolation * Ntable = size of the internal lookup table Examples From 8f5d11c0c576e4ea4b3a8682a329ee949438124a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 13:34:31 -0400 Subject: [PATCH 177/370] add missing return --- src/deprecated.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/deprecated.cpp b/src/deprecated.cpp index 40974e202b..4e596abb43 100644 --- a/src/deprecated.cpp +++ b/src/deprecated.cpp @@ -47,6 +47,7 @@ void Deprecated::command(int narg, char **arg) newcmd.append(arg[i]); } input->one(newcmd); + return; } error->all(FLERR,"This command is no longer available"); } From 2e86cb4176743859deb289e3018be9df92288d43 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 15:33:11 -0400 Subject: [PATCH 178/370] for atom style template number of bonds does not depend on newton_bond --- src/read_data.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 90aafd4b98..09fb8f3eae 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -793,7 +793,7 @@ void ReadData::command(int narg, char **arg) special.build(); } - // for atom style template systems, count total bonds,angles,etc + // for atom style template just count total bonds, etc. from template(s) if (atom->molecular == Atom::TEMPLATE) { Molecule **onemols = atom->avec->onemols; @@ -821,13 +821,6 @@ void ReadData::command(int narg, char **arg) MPI_Allreduce(&ndihedrals,&atom->ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); MPI_Allreduce(&nimpropers,&atom->nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); - if (!force->newton_bond) { - atom->nbonds /= 2; - atom->nangles /= 3; - atom->ndihedrals /= 4; - atom->nimpropers /= 4; - } - if (me == 0) { std::string mesg; From e22f9c4768fb29f3dd0646ea303a623b79d15a74 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 16:48:51 -0400 Subject: [PATCH 179/370] newton bond off does not work with atom style template currently --- src/neighbor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 0055678f41..68fa3ca96e 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1363,6 +1363,10 @@ void Neighbor::init_topology() onoff = improper_off; MPI_Allreduce(&onoff,&improper_off,1,MPI_INT,MPI_MAX,world); + // newton_bond off is not supported with atom style template + if ((atom->molecular == Atom::TEMPLATE) && (force->newton_bond == 0)) + error->all(FLERR,"Must use 'newton bond on' with atom style template"); + // instantiate NTopo classes if (atom->avec->bonds_allow) { From eea2f45a95d7c43df38df672a882933ae3e9e8ea Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 17:19:28 -0400 Subject: [PATCH 180/370] force newton bond to be on since we don't support it to be off (yet) --- unittest/formats/test_atom_styles.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 37d436a7a2..a08bddcba4 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -2711,7 +2711,7 @@ TEST_F(AtomStyleTest, template) command("write_data test_atom_styles.data"); command("clear"); command("units real"); - command("newton off"); + command("newton off on"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("atom_style template twomols"); command("pair_style zero 4.0"); @@ -3127,7 +3127,7 @@ TEST_F(AtomStyleTest, template_charge) command("write_data test_atom_styles.data"); command("clear"); command("units real"); - command("newton off"); + command("newton off on"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("atom_style hybrid template twomols charge"); command("pair_style zero 4.0"); From 183b30abd7d66d66bbe4d577c9ffdc844b533ea3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 30 Mar 2021 18:30:22 -0400 Subject: [PATCH 181/370] use strmatch() consistently to detect respa and verlet runstyles with optional suffix --- src/BODY/fix_wall_body_polygon.cpp | 2 +- src/BODY/fix_wall_body_polyhedron.cpp | 2 +- src/CLASS2/pair_lj_class2.cpp | 4 ++-- src/CLASS2/pair_lj_class2_coul_long.cpp | 4 ++-- src/GPU/fix_gpu.cpp | 2 +- src/GPU/fix_nh_gpu.cpp | 2 +- src/GPU/fix_nve_gpu.cpp | 2 +- src/GPU/pppm_gpu.cpp | 2 +- src/GRANULAR/fix_freeze.cpp | 2 +- src/GRANULAR/fix_wall_gran.cpp | 4 ++-- src/KOKKOS/fix_setforce_kokkos.cpp | 2 +- src/KOKKOS/fix_shake_kokkos.cpp | 2 +- src/KOKKOS/pair_buck_coul_cut_kokkos.cpp | 2 +- src/KOKKOS/pair_buck_coul_long_kokkos.cpp | 2 +- src/KOKKOS/pair_buck_kokkos.cpp | 2 +- src/KOKKOS/pair_coul_long_kokkos.cpp | 2 +- src/KOKKOS/pair_hybrid_kokkos.cpp | 2 +- .../pair_lj_charmm_coul_charmm_implicit_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_class2_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_cut_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_expand_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_gromacs_kokkos.cpp | 2 +- src/KOKKOS/pair_lj_sdk_kokkos.cpp | 2 +- src/KOKKOS/pair_morse_kokkos.cpp | 2 +- src/KOKKOS/pair_yukawa_kokkos.cpp | 2 +- src/KOKKOS/pair_zbl_kokkos.cpp | 2 +- src/KSPACE/pair_buck_long_coul_long.cpp | 4 ++-- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 4 ++-- src/KSPACE/pair_lj_long_coul_long.cpp | 4 ++-- src/MANYBODY/fix_qeq_comb.cpp | 2 +- src/MC/fix_bond_break.cpp | 2 +- src/MC/fix_bond_create.cpp | 2 +- src/MISC/fix_efield.cpp | 4 ++-- src/MISC/fix_gld.cpp | 2 +- src/MISC/fix_orient_bcc.cpp | 4 ++-- src/MISC/fix_orient_fcc.cpp | 4 ++-- src/MISC/fix_ttm.cpp | 2 +- src/MOLECULE/dihedral_charmm.cpp | 2 +- src/MOLECULE/dihedral_charmmfsw.cpp | 2 +- src/POEMS/fix_poems.cpp | 2 +- src/QEQ/fix_qeq_dynamic.cpp | 2 +- src/QEQ/fix_qeq_fire.cpp | 2 +- src/QEQ/fix_qeq_point.cpp | 2 +- src/QEQ/fix_qeq_shielded.cpp | 2 +- src/QEQ/fix_qeq_slater.cpp | 2 +- src/RIGID/fix_rigid.cpp | 2 +- src/RIGID/fix_rigid_small.cpp | 2 +- src/RIGID/fix_shake.cpp | 4 ++-- src/SPIN/fix_precession_spin.cpp | 4 ++-- src/USER-BOCS/fix_bocs.cpp | 4 ++-- src/USER-COLVARS/fix_colvars.cpp | 4 ++-- src/USER-DRUDE/fix_langevin_drude.cpp | 2 +- src/USER-DRUDE/fix_tgnh_drude.cpp | 4 ++-- src/USER-EFF/fix_nve_eff.cpp | 2 +- src/USER-FEP/fix_adapt_fep.cpp | 2 +- src/USER-INTEL/fix_nh_intel.cpp | 2 +- src/USER-LB/fix_lb_viscous.cpp | 4 ++-- src/USER-MANIFOLD/fix_manifoldforce.cpp | 2 +- src/USER-MISC/fix_addtorque.cpp | 4 ++-- src/USER-MISC/fix_electron_stopping_fit.cpp | 2 +- src/USER-MISC/fix_ffl.cpp | 4 ++-- src/USER-MISC/fix_filter_corotate.cpp | 2 +- src/USER-MISC/fix_flow_gauss.cpp | 4 ++-- src/USER-MISC/fix_gle.cpp | 4 ++-- src/USER-MISC/fix_grem.cpp | 4 ++-- src/USER-MISC/fix_imd.cpp | 2 +- src/USER-MISC/fix_npt_cauchy.cpp | 4 ++-- src/USER-MISC/fix_nvk.cpp | 2 +- src/USER-MISC/fix_orient_eco.cpp | 4 ++-- src/USER-MISC/fix_pafi.cpp | 4 ++-- src/USER-MISC/fix_rhok.cpp | 4 ++-- src/USER-MISC/fix_smd.cpp | 10 +++++----- src/USER-MISC/fix_ti_spring.cpp | 4 ++-- src/USER-MISC/fix_ttm_mod.cpp | 2 +- src/USER-MISC/fix_wall_region_ees.cpp | 4 ++-- src/USER-MISC/pair_lj_expand_coul_long.cpp | 4 ++-- src/USER-OMP/fix_omp.cpp | 5 ++--- src/USER-OMP/fix_qeq_comb_omp.cpp | 2 +- src/USER-QMMM/fix_qmmm.cpp | 2 +- src/USER-QTB/fix_qtb.cpp | 4 ++-- src/USER-REAXC/fix_qeq_reax.cpp | 2 +- src/USER-SMD/fix_smd_setvel.cpp | 2 +- src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp | 4 ++-- src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp | 4 ++-- src/fix_adapt.cpp | 2 +- src/fix_aveforce.cpp | 4 ++-- src/fix_drag.cpp | 4 ++-- src/fix_dt_reset.cpp | 2 +- src/fix_enforce2d.cpp | 2 +- src/fix_gravity.cpp | 4 ++-- src/fix_indent.cpp | 4 ++-- src/fix_langevin.cpp | 4 ++-- src/fix_lineforce.cpp | 2 +- src/fix_move.cpp | 2 +- src/fix_nh.cpp | 4 ++-- src/fix_numdiff.cpp | 4 ++-- src/fix_nve_limit.cpp | 2 +- src/fix_nve_noforce.cpp | 2 +- src/fix_planeforce.cpp | 2 +- src/fix_restrain.cpp | 4 ++-- src/fix_setforce.cpp | 4 ++-- src/fix_spring.cpp | 4 ++-- src/fix_spring_chunk.cpp | 4 ++-- src/fix_spring_rg.cpp | 4 ++-- src/fix_spring_self.cpp | 4 ++-- src/fix_store_force.cpp | 4 ++-- src/fix_viscous.cpp | 4 ++-- src/fix_wall.cpp | 4 ++-- src/fix_wall_region.cpp | 4 ++-- src/neighbor.cpp | 2 +- src/pair_hybrid.cpp | 2 +- src/pair_lj96_cut.cpp | 4 ++-- src/pair_mie_cut.cpp | 4 ++-- src/run.cpp | 2 +- 123 files changed, 177 insertions(+), 178 deletions(-) diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 63df8d2a5c..027c0dbd5a 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -195,7 +195,7 @@ void FixWallBodyPolygon::init() void FixWallBodyPolygon::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); } diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 45edf28c98..acfafaefbe 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -202,7 +202,7 @@ void FixWallBodyPolyhedron::init() void FixWallBodyPolyhedron::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); } diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index 3727b17493..23b0be7396 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -491,7 +491,7 @@ void PairLJClass2::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -506,7 +506,7 @@ void PairLJClass2::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 8b4a6bd732..9bebae15c8 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -671,7 +671,7 @@ void PairLJClass2CoulLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -688,7 +688,7 @@ void PairLJClass2CoulLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 9fc3e67e5c..66a3e85941 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -297,7 +297,7 @@ void FixGPU::setup(int vflag) error->all(FLERR, "Cannot use neigh_modify exclude with GPU neighbor builds"); - if (strstr(update->integrate_style,"verlet")) post_force(vflag); + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { // In setup only, all forces calculated on GPU are put in the outer level ((Respa *) update->integrate)->copy_flevel_f(_nlevels_respa-1); diff --git a/src/GPU/fix_nh_gpu.cpp b/src/GPU/fix_nh_gpu.cpp index 8b57289a50..c41099c6d2 100644 --- a/src/GPU/fix_nh_gpu.cpp +++ b/src/GPU/fix_nh_gpu.cpp @@ -63,7 +63,7 @@ FixNHGPU::~FixNHGPU() void FixNHGPU::setup(int vflag) { FixNH::setup(vflag); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) _respa_on = 1; else _respa_on = 0; diff --git a/src/GPU/fix_nve_gpu.cpp b/src/GPU/fix_nve_gpu.cpp index c3dd5b6ae2..9c6705deac 100644 --- a/src/GPU/fix_nve_gpu.cpp +++ b/src/GPU/fix_nve_gpu.cpp @@ -52,7 +52,7 @@ FixNVEGPU::~FixNVEGPU() void FixNVEGPU::setup(int vflag) { FixNVE::setup(vflag); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) _respa_on = 1; else _respa_on = 0; diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 61d0144b73..d6a827354c 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -149,7 +149,7 @@ void PPPMGPU::init() // GPU precision specific init bool respa_value=false; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) respa_value=true; if (order>8) diff --git a/src/GRANULAR/fix_freeze.cpp b/src/GRANULAR/fix_freeze.cpp index a343683b03..6a16bbb1f6 100644 --- a/src/GRANULAR/fix_freeze.cpp +++ b/src/GRANULAR/fix_freeze.cpp @@ -69,7 +69,7 @@ void FixFreeze::init() void FixFreeze::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { int nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index d18b72aa65..5e8d568b7a 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -464,7 +464,7 @@ void FixWallGran::init() dt = update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; // check for FixRigid so can extract rigid body masses @@ -511,7 +511,7 @@ void FixWallGran::init() void FixWallGran::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index 81de089960..30899bf402 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -67,7 +67,7 @@ void FixSetForceKokkos::init() { FixSetForce::init(); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Cannot (yet) use respa with Kokkos"); } diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index 97a2932415..253c7ee7e0 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -156,7 +156,7 @@ void FixShakeKokkos::init() { FixShake::init(); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Cannot yet use respa with Kokkos"); if (rattle) diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index 1b6139a61a..975c191c3d 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -285,7 +285,7 @@ void PairBuckCoulCutKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index 771258f18b..2812abb026 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -447,7 +447,7 @@ void PairBuckCoulLongKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index bc25a26ded..b51bde119c 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -205,7 +205,7 @@ void PairBuckKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index affdf76ab0..4075108823 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -405,7 +405,7 @@ void PairCoulLongKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index 540a6a368a..5ef2edf1b6 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -90,7 +90,7 @@ void PairHybridKokkos::compute(int eflag, int vflag) Respa *respa = nullptr; respaflag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { respa = (Respa *) update->integrate; if (respa->nhybrid_styles > 0) respaflag = 1; } diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index b8fcc04b00..a0abce1510 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -450,7 +450,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index 8391338037..f683204d9d 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -451,7 +451,7 @@ void PairLJCharmmCoulCharmmKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index b54e5c96c9..7f9876a76f 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -459,7 +459,7 @@ void PairLJCharmmCoulLongKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index 281f29405f..36a15da628 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -287,7 +287,7 @@ void PairLJClass2CoulCutKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index de7b04159a..031d025544 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -442,7 +442,7 @@ void PairLJClass2CoulLongKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index 12b0c02421..cef3c1f8d8 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -223,7 +223,7 @@ void PairLJClass2Kokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index e2bf45c00a..636a72b5e1 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -278,7 +278,7 @@ void PairLJCutCoulCutKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 29eacfa774..8b4e189442 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -307,7 +307,7 @@ void PairLJCutCoulDebyeKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index 31380d88a8..cbeb0ab70a 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -300,7 +300,7 @@ void PairLJCutCoulDSFKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index 4270238c71..244acc644a 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -440,7 +440,7 @@ void PairLJCutCoulLongKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 2a900dac7a..bffb921490 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -217,7 +217,7 @@ void PairLJCutKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 3e6e955f02..d351f2d5fc 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -227,7 +227,7 @@ void PairLJExpandKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index ca59ec9d01..fa4a3ca06d 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -436,7 +436,7 @@ void PairLJGromacsCoulGromacsKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index c7bcacc778..58fe845b71 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -272,7 +272,7 @@ void PairLJGromacsKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index b752225902..f8f1fa87cc 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -255,7 +255,7 @@ void PairLJSDKKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index bab19c2f44..74c2934510 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -234,7 +234,7 @@ void PairMorseKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 39e604c9aa..123b0a2d84 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -107,7 +107,7 @@ void PairYukawaKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index a530b66ee0..954c2edf26 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -81,7 +81,7 @@ void PairZBLKokkos::init_style() // error if rRESPA with inner levels - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index c2c46f359b..f392179152 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -248,7 +248,7 @@ void PairBuckLongCoulLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; @@ -264,7 +264,7 @@ void PairBuckLongCoulLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 459eac1687..ea48f0676f 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -740,7 +740,7 @@ void PairLJCharmmfswCoulLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -779,7 +779,7 @@ void PairLJCharmmfswCoulLong::init_style() // set & error check interior rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) { cut_respa = ((Respa *) update->integrate)->cutoff; if (MIN(cut_lj,cut_coul) < cut_respa[3]) diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 2b34cf7f1b..da3b3c19e0 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -242,7 +242,7 @@ void PairLJLongCoulLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; @@ -258,7 +258,7 @@ void PairLJLongCoulLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 7c2d18fc13..910db90822 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -138,7 +138,7 @@ void FixQEQComb::init() void FixQEQComb::setup(int vflag) { firstflag = 1; - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 56da69a7bc..8974b9039f 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -143,7 +143,7 @@ int FixBondBreak::setmask() void FixBondBreak::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; // enable angle/dihedral/improper breaking if any defined diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index c8c0af3a3e..634837595b 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -232,7 +232,7 @@ int FixBondCreate::setmask() void FixBondCreate::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; // check cutoff for iatomtype,jatomtype diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index 1181f554cf..5eb3caf5ea 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -209,7 +209,7 @@ void FixEfield::init() update->whichflag == 2 && estyle == NONE) error->all(FLERR,"Must use variable energy with fix efield"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -219,7 +219,7 @@ void FixEfield::init() void FixEfield::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 3f6c3da258..d0ad26c740 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -206,7 +206,7 @@ void FixGLD::init() dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index 4c6693f729..520940f2f0 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -202,7 +202,7 @@ int FixOrientBCC::setmask() void FixOrientBCC::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -228,7 +228,7 @@ void FixOrientBCC::init_list(int /*id*/, NeighList *ptr) void FixOrientBCC::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index a59e412fde..c94e91a0b5 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -200,7 +200,7 @@ int FixOrientFCC::setmask() void FixOrientFCC::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -226,7 +226,7 @@ void FixOrientFCC::init_list(int /*id*/, NeighList *ptr) void FixOrientFCC::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index 4658c0c943..da71d736c2 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -207,7 +207,7 @@ void FixTTM::init() for (int iznode = 0; iznode < nznodes; iznode++) net_energy_transfer_all[ixnode][iynode][iznode] = 0; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index cc60dbec2b..d56c875744 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -368,7 +368,7 @@ void DihedralCharmm::coeff(int narg, char **arg) void DihedralCharmm::init_style() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { Respa *r = (Respa *) update->integrate; if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral)) error->all(FLERR,"Dihedral style charmm must be set to same" diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 1164e93f18..09372f67ac 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -386,7 +386,7 @@ void DihedralCharmmfsw::coeff(int narg, char **arg) void DihedralCharmmfsw::init_style() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { Respa *r = (Respa *) update->integrate; if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral)) error->all(FLERR,"Dihedral style charmmfsw must be set to same" diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index bb74e90850..3d5b3697f7 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -389,7 +389,7 @@ void FixPOEMS::init() // rRESPA info - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { step_respa = ((Respa *) update->integrate)->step; nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 2bd63b718d..b06bde223b 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -78,7 +78,7 @@ void FixQEqDynamic::init() error->warning(FLERR,"Fix qeq/dynamic tolerance may be too small" " for damped dynamics"); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 6e51c906bc..b33a7745e0 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -91,7 +91,7 @@ void FixQEqFire::init() error->warning(FLERR,"Fix qeq/fire tolerance may be too small" " for damped fires"); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; comb = (PairComb *) force->pair_match("comb",1); diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index f112c4859f..3d71135ae1 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -57,7 +57,7 @@ void FixQEqPoint::init() int ntypes = atom->ntypes; memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index decfe69ccc..356a747ed3 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -68,7 +68,7 @@ void FixQEqShielded::init() error->all(FLERR,"Invalid param file for fix qeq/shielded"); } - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 5cab1f1979..9b90f78d7a 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -79,7 +79,7 @@ void FixQEqSlater::init() error->all(FLERR,"Invalid param file for fix qeq/slater"); } - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index c211e0e4ca..a8a0e1409f 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -750,7 +750,7 @@ void FixRigid::init() dtf = 0.5 * update->dt * force->ftm2v; dtq = 0.5 * update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; // setup rigid bodies, using current atom info. if reinitflag is not set, diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index bdc7330d6d..b7e0a1b2ac 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -600,7 +600,7 @@ void FixRigidSmall::init() dtf = 0.5 * update->dt * force->ftm2v; dtq = 0.5 * update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index adef291ed9..390fe88309 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -456,7 +456,7 @@ void FixShake::setup(int vflag) // set respa to 0 if verlet is used and to 1 otherwise - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) respa = 0; else respa = 1; @@ -2956,7 +2956,7 @@ void FixShake::unpack_forward_comm(int n, int first, double *buf) void FixShake::reset_dt() { - if (strstr(update->integrate_style,"verlet")) { + if (utils::strmatch(update->integrate_style,"^verlet")) { dtv = update->dt; if (rattle) dtfsq = 0.5 * update->dt * update->dt * force->ftm2v; else dtfsq = update->dt * update->dt * force->ftm2v; diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index 70ea7e1a09..17b9d3eb22 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -186,7 +186,7 @@ void FixPrecessionSpin::init() k1ch = k1c/hbar; k2ch = k2c/hbar; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -225,7 +225,7 @@ void FixPrecessionSpin::init() void FixPrecessionSpin::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 60fb03cdf8..bd217e60a8 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -590,7 +590,7 @@ void FixBocs::init() if (force->kspace) kspace_flag = 1; else kspace_flag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; dto = 0.5*step_respa[0]; @@ -1850,7 +1850,7 @@ void FixBocs::reset_dt() // If using respa, then remap is performed in innermost level - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dto = 0.5*step_respa[0]; if (pstat_flag) diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index 74972a8076..a1b992059e 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -412,7 +412,7 @@ void FixColvars::init() if ((me == 0) && (update->whichflag == 2)) error->warning(FLERR,"Using fix colvars with minimization"); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -680,7 +680,7 @@ void FixColvars::setup(int vflag) proxy->setup(); // initialize forces - if (strstr(update->integrate_style,"verlet") || (update->whichflag == 2)) + if (utils::strmatch(update->integrate_style,"^verlet") || (update->whichflag == 2)) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index 2dabec3a30..44d2556b61 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -156,7 +156,7 @@ void FixLangevinDrude::init() void FixLangevinDrude::setup(int /*vflag*/) { - if (!strstr(update->integrate_style,"verlet")) + if (!utils::strmatch(update->integrate_style,"^verlet")) error->all(FLERR,"RESPA style not compatible with fix langevin/drude"); if (!comm->ghost_velocity) error->all(FLERR,"fix langevin/drude requires ghost velocities. Use comm_modify vel yes"); diff --git a/src/USER-DRUDE/fix_tgnh_drude.cpp b/src/USER-DRUDE/fix_tgnh_drude.cpp index 49a4061878..d8bf1d76f9 100644 --- a/src/USER-DRUDE/fix_tgnh_drude.cpp +++ b/src/USER-DRUDE/fix_tgnh_drude.cpp @@ -671,7 +671,7 @@ void FixTGNHDrude::init() if (force->kspace) kspace_flag = 1; else kspace_flag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; dto = 0.5*step_respa[0]; @@ -1593,7 +1593,7 @@ void FixTGNHDrude::reset_dt() // If using respa, then remap is performed in innermost level - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dto = 0.5*step_respa[0]; } diff --git a/src/USER-EFF/fix_nve_eff.cpp b/src/USER-EFF/fix_nve_eff.cpp index 58acdcc258..bfdd85df49 100644 --- a/src/USER-EFF/fix_nve_eff.cpp +++ b/src/USER-EFF/fix_nve_eff.cpp @@ -58,7 +58,7 @@ void FixNVEEff::init() dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index c8a65539b4..7f17179087 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -356,7 +356,7 @@ void FixAdaptFEP::init() fix_chg = (FixStore *) modify->fix[ifix]; } - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/USER-INTEL/fix_nh_intel.cpp b/src/USER-INTEL/fix_nh_intel.cpp index 19245cccbf..6105892041 100644 --- a/src/USER-INTEL/fix_nh_intel.cpp +++ b/src/USER-INTEL/fix_nh_intel.cpp @@ -317,7 +317,7 @@ void FixNHIntel::reset_dt() // If using respa, then remap is performed in innermost level - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dto = 0.5*step_respa[0]; if (pstat_flag) diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index 08a0a10356..a13fea3a1a 100644 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -79,7 +79,7 @@ int FixLbViscous::setmask() void FixLbViscous::init() { - if (strcmp(update->integrate_style,"respa") == 0) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -88,7 +88,7 @@ void FixLbViscous::init() void FixLbViscous::setup(int vflag) { - if (strstr(update->integrate_style,"verlet") != nullptr) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 26d209e7a9..b48decddba 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -120,7 +120,7 @@ void FixManifoldForce::init() void FixManifoldForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { int nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index b19f51a10b..59f2560e0b 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -130,7 +130,7 @@ void FixAddTorque::init() varflag = EQUAL; else varflag = CONSTANT; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -140,7 +140,7 @@ void FixAddTorque::init() void FixAddTorque::setup(int vflag) { - if (strcmp(update->integrate_style,"verlet") == 0) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/USER-MISC/fix_electron_stopping_fit.cpp b/src/USER-MISC/fix_electron_stopping_fit.cpp index 2d9034aaef..8768ed5f3d 100644 --- a/src/USER-MISC/fix_electron_stopping_fit.cpp +++ b/src/USER-MISC/fix_electron_stopping_fit.cpp @@ -140,7 +140,7 @@ void FixElectronStoppingFit::init() void FixElectronStoppingFit::setup(int vflag) { - if (strcmp(update->integrate_style,"verlet") == 0) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index eb9f033afc..6dfa9eb2ca 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -156,7 +156,7 @@ void FixFFL::init() { } } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; } @@ -178,7 +178,7 @@ void FixFFL::init_ffl() { /* ---------------------------------------------------------------------- */ void FixFFL::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 38b22c1189..6e6dce84a7 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -277,7 +277,7 @@ void FixFilterCorotate::init() // could have changed locations in fix list since created // set ptrs to rRESPA variables - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; } else error->all(FLERR,"Fix filter/corotate requires rRESPA!"); diff --git a/src/USER-MISC/fix_flow_gauss.cpp b/src/USER-MISC/fix_flow_gauss.cpp index 3c913f8039..9e6a2c0174 100644 --- a/src/USER-MISC/fix_flow_gauss.cpp +++ b/src/USER-MISC/fix_flow_gauss.cpp @@ -123,7 +123,7 @@ void FixFlowGauss::init() { //if respa level specified by fix_modify, then override default (outermost) //if specified level too high, set to max level - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); @@ -146,7 +146,7 @@ void FixFlowGauss::setup(int vflag) if (mTot <= 0.0) error->all(FLERR,"Invalid group mass in fix flow/gauss"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index a83ab0f9ce..8a7459b79d 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -416,7 +416,7 @@ void FixGLE::init() } } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; } @@ -502,7 +502,7 @@ void FixGLE::init_gles() void FixGLE::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index 64c7e4a6b7..e036eff205 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -200,10 +200,10 @@ void FixGrem::init() void FixGrem::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Run style 'respa' is not supported"); } diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 8796de289e..f9591db4d3 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -601,7 +601,7 @@ int FixIMD::setmask() /* ---------------------------------------------------------------------- */ void FixIMD::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; return; diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 37d6e5286b..802cabea67 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -765,7 +765,7 @@ void FixNPTCauchy::init() if (force->kspace) kspace_flag = 1; else kspace_flag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; dto = 0.5*step_respa[0]; @@ -1752,7 +1752,7 @@ void FixNPTCauchy::reset_dt() // If using respa, then remap is performed in innermost level - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dto = 0.5*step_respa[0]; if (pstat_flag) diff --git a/src/USER-MISC/fix_nvk.cpp b/src/USER-MISC/fix_nvk.cpp index d21f4efe4e..ef6c390f95 100644 --- a/src/USER-MISC/fix_nvk.cpp +++ b/src/USER-MISC/fix_nvk.cpp @@ -59,7 +59,7 @@ void FixNVK::init() dtv = update->dt; dtf = 0.5 * update->dt; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { error->all(FLERR,"Fix nvk not yet enabled for RESPA"); step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index 3d6db4cd4f..56da3cd6a1 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -177,7 +177,7 @@ void FixOrientECO::init() { MPI_Bcast(&norm_fac, 1, MPI_DOUBLE, 0, world); MPI_Bcast(&inv_norm_fac, 1, MPI_DOUBLE, 0, world); - if (strstr(update->integrate_style, "respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } @@ -201,7 +201,7 @@ void FixOrientECO::init_list(int /* id */, NeighList *ptr) { /* ---------------------------------------------------------------------- */ void FixOrientECO::setup(int vflag) { - if (strstr(update->integrate_style, "verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index c2ad62d7d0..7d5216f540 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -180,7 +180,7 @@ void FixPAFI::init() error->all(FLERR,"Compute for fix pafi must have 9 fields per atom"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { step_respa = ((Respa *) update->integrate)->step; // nve nlevels_respa = ((Respa *) update->integrate)->nlevels; if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); @@ -191,7 +191,7 @@ void FixPAFI::init() void FixPAFI::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { diff --git a/src/USER-MISC/fix_rhok.cpp b/src/USER-MISC/fix_rhok.cpp index f546b9a814..18e1ed195f 100644 --- a/src/USER-MISC/fix_rhok.cpp +++ b/src/USER-MISC/fix_rhok.cpp @@ -95,7 +95,7 @@ int FixRhok::setmask() void FixRhok::init() { // RESPA boilerplate - if (strcmp( update->integrate_style, "respa" ) == 0) + if (utils::strmatch(update->integrate_style,"^respa")) mNLevelsRESPA = ((Respa *) update->integrate)->nlevels; // Count the number of affected particles @@ -117,7 +117,7 @@ void FixRhok::init() // Initial application of the fix to a system (when doing MD) void FixRhok::setup( int inVFlag ) { - if (strcmp( update->integrate_style, "verlet" ) == 0) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force( inVFlag ); else { diff --git a/src/USER-MISC/fix_smd.cpp b/src/USER-MISC/fix_smd.cpp index 8ea1beac71..bc8ede4a17 100644 --- a/src/USER-MISC/fix_smd.cpp +++ b/src/USER-MISC/fix_smd.cpp @@ -159,7 +159,7 @@ void FixSMD::init() zn = dz/r_old; } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -169,7 +169,7 @@ void FixSMD::init() void FixSMD::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); @@ -190,7 +190,7 @@ void FixSMD::post_force(int vflag) else smd_couple(); if (styleflag & SMD_CVEL) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) r_old += v_smd * update->dt; else r_old += v_smd * ((Respa *) update->integrate)->step[ilevel_respa]; @@ -205,7 +205,7 @@ void FixSMD::smd_tether() group->xcm(igroup,masstotal,xcm); double dt = update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dt = ((Respa *) update->integrate)->step[ilevel_respa]; // fx,fy,fz = components of k * (r-r0) @@ -311,7 +311,7 @@ void FixSMD::smd_couple() group->xcm(igroup2,masstotal2,xcm2); double dt = update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dt = ((Respa *) update->integrate)->step[ilevel_respa]; // renormalize direction of spring diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 766b9df5eb..1d6079d4d6 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -141,7 +141,7 @@ int FixTISpring::setmask() void FixTISpring::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -149,7 +149,7 @@ void FixTISpring::init() void FixTISpring::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index 7056ad6a00..d4023b6011 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -230,7 +230,7 @@ void FixTTMMod::init() for (int iznode = 0; iznode < nznodes; iznode++) net_energy_transfer_all[ixnode][iynode][iznode] = 0; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/USER-MISC/fix_wall_region_ees.cpp b/src/USER-MISC/fix_wall_region_ees.cpp index 51e0af9dc4..8a79b73034 100644 --- a/src/USER-MISC/fix_wall_region_ees.cpp +++ b/src/USER-MISC/fix_wall_region_ees.cpp @@ -118,7 +118,7 @@ void FixWallRegionEES::init() offset = 0; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -126,7 +126,7 @@ void FixWallRegionEES::init() void FixWallRegionEES::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index f49d181e0f..84eb86aaa8 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -690,7 +690,7 @@ void PairLJExpandCoulLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -707,7 +707,7 @@ void PairLJExpandCoulLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 23671f4c7e..678df7c22a 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -203,9 +203,8 @@ void FixOMP::init() thr[i]->_timer_active=-1; } - if ((strstr(update->integrate_style,"respa") != nullptr) - && (strstr(update->integrate_style,"respa/omp") == nullptr)) - error->all(FLERR,"Need to use respa/omp for r-RESPA with /omp styles"); + if (!utils::strmatch(update->integrate_style,"^respa/omp")) + error->all(FLERR,"Must use respa/omp for r-RESPA with /omp styles"); if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; else _pair_compute_flag = false; diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index aceff62ebc..6844729e92 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -58,7 +58,7 @@ void FixQEQCombOMP::init() error->all(FLERR,"Must use pair_style comb or " "comb/omp with fix qeq/comb/omp"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 6689ebdb9d..fab658f8f2 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -651,7 +651,7 @@ void FixQMMM::exchange_forces() void FixQMMM::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Fix qmmm does not currently support r-RESPA"); if (do_init) { diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index e4e645a1bb..a4f6e8678f 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -216,7 +216,7 @@ void FixQTB::init() } // respa - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -225,7 +225,7 @@ void FixQTB::init() ------------------------------------------------------------------------- */ void FixQTB::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 44088043f0..3109950ff2 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -370,7 +370,7 @@ void FixQEqReax::init() init_shielding(); init_taper(); - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index 471159ea53..312deb4d19 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -208,7 +208,7 @@ void FixSMDSetVel::init() { /* ---------------------------------------------------------------------- */ void FixSMDSetVel::setup(int vflag) { - if (strstr(update->integrate_style, "verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else error->all(FLERR,"Fix smd/setvel does not support RESPA"); diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 556d303d30..c1bf0a308d 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -338,7 +338,7 @@ void PairLJSwitch3CoulGaussLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -355,7 +355,7 @@ void PairLJSwitch3CoulGaussLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 47ddf8c7ad..187778bb66 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -340,7 +340,7 @@ void PairMM3Switch3CoulGaussLong::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -357,7 +357,7 @@ void PairMM3Switch3CoulGaussLong::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index c09b6481f6..51fdb16d5d 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -462,7 +462,7 @@ void FixAdapt::init() fix_chg = (FixStore *) modify->fix[ifix]; } - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 5ce50aafea..867643499a 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -155,7 +155,7 @@ void FixAveForce::init() if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; else varflag = CONSTANT; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); else ilevel_respa = nlevels_respa-1; @@ -166,7 +166,7 @@ void FixAveForce::init() void FixAveForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { diff --git a/src/fix_drag.cpp b/src/fix_drag.cpp index 40b8af7f9a..03209ce729 100644 --- a/src/fix_drag.cpp +++ b/src/fix_drag.cpp @@ -69,7 +69,7 @@ int FixDrag::setmask() void FixDrag::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -79,7 +79,7 @@ void FixDrag::init() void FixDrag::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index 336911e8c7..34cecc45de 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -112,7 +112,7 @@ void FixDtReset::init() // set rRESPA flag respaflag = 0; - if (strstr(update->integrate_style,"respa")) respaflag = 1; + if (utils::strmatch(update->integrate_style,"^respa")) respaflag = 1; // check for DCD or XTC dumps diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index c1b8285a4b..1284a9b78c 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -90,7 +90,7 @@ void FixEnforce2D::init() void FixEnforce2D::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { int nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 194f5731bc..8c6baab1ee 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -181,7 +181,7 @@ int FixGravity::setmask() void FixGravity::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -243,7 +243,7 @@ void FixGravity::init() void FixGravity::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 48355446d1..d2a7ba0d2a 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -153,7 +153,7 @@ void FixIndent::init() error->all(FLERR,"Variable for fix indent is not equal style"); } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -163,7 +163,7 @@ void FixIndent::init() void FixIndent::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 66da7a9633..bf9d5cad23 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -310,7 +310,7 @@ void FixLangevin::init() if (temperature && temperature->tempbias) tbiasflag = BIAS; else tbiasflag = NOBIAS; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; if (utils::strmatch(update->integrate_style,"^respa") && gjfflag) @@ -367,7 +367,7 @@ void FixLangevin::setup(int vflag) } } } - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index 9582d8db51..6a77442ea4 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -59,7 +59,7 @@ int FixLineForce::setmask() void FixLineForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { int nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index e37fe52cc9..6b640cd747 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -433,7 +433,7 @@ void FixMove::init() if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); else velocity = nullptr; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 120aeeb7de..d95763f06b 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -728,7 +728,7 @@ void FixNH::init() if (force->kspace) kspace_flag = 1; else kspace_flag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; step_respa = ((Respa *) update->integrate)->step; dto = 0.5*step_respa[0]; @@ -1722,7 +1722,7 @@ void FixNH::reset_dt() // If using respa, then remap is performed in innermost level - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) dto = 0.5*step_respa[0]; if (pstat_flag) diff --git a/src/fix_numdiff.cpp b/src/fix_numdiff.cpp index 10926ec440..495e196749 100644 --- a/src/fix_numdiff.cpp +++ b/src/fix_numdiff.cpp @@ -120,7 +120,7 @@ void FixNumDiff::init() if (force->kspace && force->kspace->compute_flag) kspace_compute_flag = 1; else kspace_compute_flag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -130,7 +130,7 @@ void FixNumDiff::init() void FixNumDiff::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 7ee0e6f80e..58db5e25d9 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -66,7 +66,7 @@ void FixNVELimit::init() vlimitsq = (xlimit/dtv) * (xlimit/dtv); ncount = 0; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; // warn if using fix shake, which will lead to invalid constraint forces diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index 3a9c1c6442..61528a0024 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -47,7 +47,7 @@ void FixNVENoforce::init() { dtv = update->dt; - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) step_respa = ((Respa *) update->integrate)->step; } diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index cc0b43054a..783d26ac9e 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -59,7 +59,7 @@ int FixPlaneForce::setmask() void FixPlaneForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { int nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 82e91c8289..ff61703c1a 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -185,7 +185,7 @@ int FixRestrain::setmask() void FixRestrain::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -195,7 +195,7 @@ void FixRestrain::init() void FixRestrain::setup(int vflag) { - if (strcmp(update->integrate_style,"verlet") == 0) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 7d41b428c9..d59d091f42 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -166,7 +166,7 @@ void FixSetForce::init() varflag = EQUAL; else varflag = CONSTANT; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { nlevels_respa = ((Respa *) update->integrate)->nlevels; if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); else ilevel_respa = nlevels_respa-1; @@ -192,7 +192,7 @@ void FixSetForce::init() void FixSetForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 89d569fc8b..200d9f072a 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -128,7 +128,7 @@ void FixSpring::init() masstotal = group->mass(igroup); if (styleflag == COUPLE) masstotal2 = group->mass(igroup2); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -138,7 +138,7 @@ void FixSpring::init() void FixSpring::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index 8eb35e74aa..a007aabefc 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -112,7 +112,7 @@ void FixSpringChunk::init() if (strcmp(idchunk,ccom->idchunk) != 0) error->all(FLERR,"Fix spring chunk chunkID not same as comID chunkID"); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -122,7 +122,7 @@ void FixSpringChunk::init() void FixSpringChunk::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index cabdc4b11f..58249bbd2d 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -77,7 +77,7 @@ void FixSpringRG::init() rg0_flag = 0; } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -87,7 +87,7 @@ void FixSpringRG::init() void FixSpringRG::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 7a22cbd3f8..9f649faec0 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -120,7 +120,7 @@ int FixSpringSelf::setmask() void FixSpringSelf::init() { - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -130,7 +130,7 @@ void FixSpringSelf::init() void FixSpringSelf::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index 460422aee9..1541294f6c 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -68,7 +68,7 @@ int FixStoreForce::setmask() void FixStoreForce::init() { - if (strstr(update->integrate_style,"respa")) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; } @@ -76,7 +76,7 @@ void FixStoreForce::init() void FixStoreForce::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index 7bdac6aeaf..0c7d682ae2 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -80,7 +80,7 @@ void FixViscous::init() { int max_respa = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = max_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,max_respa); } @@ -90,7 +90,7 @@ void FixViscous::init() void FixViscous::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index 677085854c..280ce848c6 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -263,7 +263,7 @@ void FixWall::init() for (int m = 0; m < nwall; m++) precompute(m); - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -273,7 +273,7 @@ void FixWall::init() void FixWall::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) { + if (utils::strmatch(update->integrate_style,"^verlet")) { if (!fldflag) post_force(vflag); } else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index 7e30fe2361..e5c9167ce4 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -187,7 +187,7 @@ void FixWallRegion::init() offset = coeff3*r4inv*r4inv*rinv - coeff4*r2inv*rinv; } - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { ilevel_respa = ((Respa *) update->integrate)->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -197,7 +197,7 @@ void FixWallRegion::init() void FixWallRegion::setup(int vflag) { - if (strstr(update->integrate_style,"verlet")) + if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 68fa3ca96e..fb0a244cc0 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -319,7 +319,7 @@ void Neighbor::init() // rRESPA cutoffs int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 377364b8e5..c7b6048139 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -114,7 +114,7 @@ void PairHybrid::compute(int eflag, int vflag) Respa *respa = nullptr; respaflag = 0; - if (strstr(update->integrate_style,"respa")) { + if (utils::strmatch(update->integrate_style,"^respa")) { respa = (Respa *) update->integrate; if (respa->nhybrid_styles > 0) respaflag = 1; } diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index b68d595098..65f2d40e00 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -490,7 +490,7 @@ void PairLJ96Cut::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -505,7 +505,7 @@ void PairLJ96Cut::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index 043ad3aeaa..503ed60d1b 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -499,7 +499,7 @@ void PairMIECut::init_style() int irequest; int respa = 0; - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { + if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } @@ -514,7 +514,7 @@ void PairMIECut::init_style() // set rRESPA cutoffs - if (strstr(update->integrate_style,"respa") && + if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; else cut_respa = nullptr; diff --git a/src/run.cpp b/src/run.cpp index fedf020d9d..c503e174ff 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -134,7 +134,7 @@ void Run::command(int narg, char **arg) error->all(FLERR,"Run command stop value is before end of run"); } - if (!preflag && strstr(update->integrate_style,"respa")) + if (!preflag && utils::strmatch(update->integrate_style,"^respa")) error->all(FLERR,"Run flag 'pre no' not compatible with r-RESPA"); // if nevery, make copies of arg strings that are commands From 7092a7769c8cce2dd9e81aa6381cf2c2af72882c Mon Sep 17 00:00:00 2001 From: Bhanuday Sharma <55601693+bhanudaysharma@users.noreply.github.com> Date: Wed, 31 Mar 2021 06:44:52 +0530 Subject: [PATCH 182/370] Update units.rst In LJ units, the conversion formula between rho and rho* should be corrected to \rho^* = \rho \frac{\sigma^{dim}}{m} --- doc/src/units.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/units.rst b/doc/src/units.rst index 8ca29f4c49..3c0f4a220a 100644 --- a/doc/src/units.rst +++ b/doc/src/units.rst @@ -87,7 +87,7 @@ energy is a derived unit (in SI units you equivalently have the relation * charge = reduced LJ charge, where :math:`q^* = q \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon}}` * dipole = reduced LJ dipole, moment where :math:`\mu^* = \mu \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma^3 \epsilon}}` * electric field = force/charge, where :math:`E^* = E \frac{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon} \sigma}{\epsilon}` -* density = mass/volume, where :math:`\rho^* = \rho \sigma^{dim}` +* density = mass/volume, where :math:`\rho^* = \rho \frac{\sigma^{dim}}{m}` Note that for LJ units, the default mode of thermodynamic output via the :doc:`thermo_style ` command is to normalize all From 7e0d44e0ca471495e5a8dd4bb90040fd14a6aa84 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Tue, 30 Mar 2021 20:51:23 -0600 Subject: [PATCH 183/370] Adding no_attraction flag to granular pair and wall styles --- doc/src/fix_wall_gran.rst | 10 ++++++++-- doc/src/fix_wall_gran_region.rst | 10 +++++++++- doc/src/pair_gran.rst | 15 ++++++++++++++- doc/src/pair_granular.rst | 6 ++++++ src/GRANULAR/fix_wall_gran.cpp | 14 +++++++++++++- src/GRANULAR/fix_wall_gran.h | 1 + src/GRANULAR/pair_gran_hertz_history.cpp | 2 ++ src/GRANULAR/pair_gran_hooke.cpp | 2 ++ src/GRANULAR/pair_gran_hooke_history.cpp | 12 +++++++++++- src/GRANULAR/pair_gran_hooke_history.h | 1 + src/GRANULAR/pair_granular.cpp | 14 +++++++++++++- src/GRANULAR/pair_granular.h | 1 + src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 1 + 13 files changed, 82 insertions(+), 7 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 1eefc4aeae..73fa7e367b 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -45,7 +45,7 @@ Syntax radius = cylinder radius (distance units) * zero or more keyword/value pairs may be appended to args -* keyword = *wiggle* or *shear* or *contacts* +* keyword = *wiggle* or *shear* or *contacts* or *no_attraction* .. parsed-literal:: @@ -58,6 +58,8 @@ Syntax vshear = magnitude of shear velocity (velocity units) *contacts* value = none generate contact information for each particle + *no_attraction* value = none + turn off possibility for attractive interactions Examples @@ -175,8 +177,12 @@ the clockwise direction for *vshear* > 0 or counter-clockwise for *vshear* < 0. In this case, *vshear* is the tangential velocity of the wall at whatever *radius* has been defined. +If a particle is moving away from the wall while in contact, there +is a possibility that the particle could experience an effective attractive +force due to damping. If the *no_attraction* keyword is used, this fix +will zero out the normal component of the force if there is an effective +attractive force. This keyword cannot be used with the JKR or DMT models. -Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" This fix writes the shear friction state of atoms interacting with the diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 9ed5bb7bcc..356c8427b0 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -36,12 +36,14 @@ Syntax * wallstyle = region (see :doc:`fix wall/gran ` for options for other kinds of walls) * region-ID = region whose boundary will act as wall -* keyword = *contacts* +* keyword = *contacts* or *no_attraction* .. parsed-literal:: *contacts* value = none generate contact information for each particle + *no_attraction* value = none + turn off possibility for attractive interactions Examples """""""" @@ -199,6 +201,12 @@ values for the 6 wall/particle coefficients than for particle/particle interactions. E.g. if you wish to model the wall as a different material. +If a particle is moving away from the wall while in contact, there +is a possibility that the particle could experience an effective attractive +force due to damping. If the *no_attraction* keyword is used, this fix +will zero out the normal component of the force if there is an effective +attractive force. This keyword cannot be used with the JKR or DMT models. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index d3f87839e8..aa2e42d339 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -26,7 +26,7 @@ Syntax .. code-block:: LAMMPS - pair_style style Kn Kt gamma_n gamma_t xmu dampflag + pair_style style Kn Kt gamma_n gamma_t xmu dampflag keyword * style = *gran/hooke* or *gran/hooke/history* or *gran/hertz/history* * Kn = elastic constant for normal particle repulsion (force/distance units or pressure units - see discussion below) @@ -36,6 +36,13 @@ Syntax * xmu = static yield criterion (unitless value between 0.0 and 1.0e4) * dampflag = 0 or 1 if tangential damping force is excluded or included +* keyword = *no_attraction* + + .. parsed-literal:: + + *no_attraction* value = none + turn off possibility for attractive interactions + .. note:: Versions of LAMMPS before 9Jan09 had different style names for @@ -208,6 +215,12 @@ potential is used as a sub-style of :doc:`pair_style hybrid `, then pair_coeff command to determine which atoms interact via a granular potential. +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the *no_attraction* keyword is used, this fix +will zero out the normal component of the force if there is an effective +attractive force. + ---------- .. include:: accel_styles.rst diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 80663b7d49..cb65a58777 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -657,6 +657,12 @@ then LAMMPS will use that cutoff for the specified atom type combination, and automatically set pairwise cutoffs for the remaining atom types. +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the *no_attraction* keyword is used, this fix +will zero out the normal component of the force if there is an effective +attractive force. This keyword cannot be used with the JKR or DMT models. + ---------- .. include:: accel_styles.rst diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index d18b72aa65..9c17a323c5 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -347,6 +347,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wiggle = 0; wshear = 0; peratom_flag = 0; + noattraction_flag = 0; while (iarg < narg) { if (strcmp(arg[iarg],"wiggle") == 0) { @@ -373,6 +374,13 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 8; peratom_freq = 1; iarg += 1; + } else if (strcmp(arg[iarg],"no_attraction") == 0) { + noattraction_flag = 1; + if(normal_model == JKR) + error->all(FLERR,"Cannot turn off attraction with JRK model"); + if(normal_model == DMT) + error->all(FLERR,"Cannot turn off attraction with DMT model"); + iarg += 1; } else error->all(FLERR,"Illegal fix wall/gran command"); } @@ -761,6 +769,7 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; + if(noattraction_flag and ccel < 0.0) ccel = 0.0; // relative velocities @@ -853,6 +862,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; + if(noattraction_flag and ccel < 0.0) ccel = 0.0; // relative velocities @@ -984,7 +994,8 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; - + if(noattraction_flag and ccel < 0.0) ccel = 0.0; + // relative velocities vtr1 = vt1 - (dz*wr2-dy*wr3); @@ -1177,6 +1188,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; + if(noattraction_flag and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index a81a4c787c..3963b22a2c 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -69,6 +69,7 @@ class FixWallGran : public Fix { // for granular model choices int normal_model, damping_model; int tangential_model, roll_model, twist_model; + int noattraction_flag; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index e7193140b9..7da0c6142d 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -181,6 +181,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities @@ -388,6 +389,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 3875d12a0f..76946701cb 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -158,6 +158,7 @@ void PairGranHooke::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities @@ -299,6 +300,7 @@ double PairGranHooke::single(int i, int j, int /*itype*/, int /*jtype*/, double damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 4deb828d76..4893be4084 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -237,6 +237,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities @@ -356,7 +357,7 @@ void PairGranHookeHistory::allocate() void PairGranHookeHistory::settings(int narg, char **arg) { - if (narg != 6) error->all(FLERR,"Illegal pair_style command"); + if (narg != 6 and narg != 7) error->all(FLERR,"Illegal pair_style command"); kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; @@ -369,6 +370,14 @@ void PairGranHookeHistory::settings(int narg, char **arg) xmu = utils::numeric(FLERR,arg[4],false,lmp); dampflag = utils::inumeric(FLERR,arg[5],false,lmp); if (dampflag == 0) gammat = 0.0; + + noattractionflag = 0; + if(narg == 7) { + if(strcmp(arg[6], "no_attraction")) + noattractionflag = 1; + else + error->all(FLERR,"Illegal pair_style command"); + } if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) @@ -686,6 +695,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if(noattractionflag and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index c27ce8a9af..bf40097f9d 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -49,6 +49,7 @@ class PairGranHookeHistory : public Pair { double dt; int freeze_group_bit; int history; + int noattractionflag; int neighprev; double *onerad_dynamic,*onerad_frozen; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index cc210138eb..7c1a1f2b29 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -793,6 +793,7 @@ void PairGranular::coeff(int narg, char **arg) roll_model_one = ROLL_NONE; twist_model_one = TWIST_NONE; damping_model_one = VISCOELASTIC; + noattractionflag = 0; int iarg = 2; while (iarg < narg) { @@ -1030,7 +1031,18 @@ void PairGranular::coeff(int narg, char **arg) count++; } } - + + if(noattraction flag) { + for(int i = 1; i <= ntypes; i++) { + for(int j = 1; j <= ntypes; j++) { + if(normal_model[i][j] == JKR) + error->all(FLERR,"Cannot turn off attraction with JKR pairstyle"); + if(normal_model[i][j] == DMT) + error->all(FLERR,"Cannot turn off attraction with DMT pairstyle"); + } + } + } + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 7ef4f2af98..1e4e8c8fc4 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -70,6 +70,7 @@ class PairGranular : public Pair { // model choices int **normal_model, **damping_model; int **tangential_model, **roll_model, **twist_model; + int **noattractionflag; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index 81c82ab826..caa19ffdef 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -392,6 +392,7 @@ void PairGranHookeHistoryKokkos::operator()(TagPairGranHookeHistoryC F_FLOAT damp = meff*gamman*vnnr*rsqinv; F_FLOAT ccel = kn*(radsum-r)*rinv - damp; + if(noattractionflag & ccel < 0.0) ccel = 0.0; // relative velocities From 2988aa2d1f6cc3d6a67bc7b03021d898656a30f9 Mon Sep 17 00:00:00 2001 From: Dan Bolintineanu Date: Tue, 30 Mar 2021 21:55:06 -0600 Subject: [PATCH 184/370] Fixes bug where accumulated tangential and rolling displacements are not rotated correctly. Pointed out by Deng Pan on LAMMPS mailing list 3/26/21 --- src/GRANULAR/pair_granular.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index cc210138eb..bcf262aa2c 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -446,9 +446,9 @@ void PairGranular::compute(int eflag, int vflag) if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) < EPSILON*Fscrit; + frameupdate = fabs(rsht) > EPSILON*Fscrit; else - frameupdate = fabs(rsht)*k_tangential < EPSILON*Fscrit; + frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; if (frameupdate) { shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + history[2]*history[2]); @@ -568,7 +568,7 @@ void PairGranular::compute(int eflag, int vflag) if (historyupdate) { rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; - frameupdate = fabs(rolldotn)*k_roll < EPSILON*Frcrit; + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; if (frameupdate) { // rotate into tangential plane rollmag = sqrt(history[rhist0]*history[rhist0] + history[rhist1]*history[rhist1] + From d36894ccf5691ca9ba6e85d264a3cb435526ce44 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Tue, 30 Mar 2021 22:16:47 -0600 Subject: [PATCH 185/370] Adding pertype flag to pair granular --- doc/src/fix_wall_gran.rst | 2 +- doc/src/fix_wall_gran_region.rst | 2 +- doc/src/pair_gran.rst | 2 +- doc/src/pair_granular.rst | 8 ++++++++ src/GRANULAR/pair_granular.cpp | 34 ++++++++++++++++++++------------ 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 73fa7e367b..bfe06bf7a0 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -59,7 +59,7 @@ Syntax *contacts* value = none generate contact information for each particle *no_attraction* value = none - turn off possibility for attractive interactions + turn off possibility of attractive interactions Examples diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 356c8427b0..00eb19ba1c 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -43,7 +43,7 @@ Syntax *contacts* value = none generate contact information for each particle *no_attraction* value = none - turn off possibility for attractive interactions + turn off possibility of attractive interactions Examples """""""" diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index aa2e42d339..8145f7fb7a 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -41,7 +41,7 @@ Syntax .. parsed-literal:: *no_attraction* value = none - turn off possibility for attractive interactions + turn off possibility of attractive interactions .. note:: diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index cb65a58777..0076994e25 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -623,6 +623,14 @@ Finally, the twisting torque on each particle is given by: ---------- +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the optional *no_attraction* keyword is used, this fix +will zero out the normal component of the force if there is an effective +attractive force. This keyword cannot be used with the JKR or DMT models. + +---------- + The *granular* pair style can reproduce the behavior of the *pair gran/\** styles with the appropriate settings (some very minor differences can be expected due to corrections in diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 7c1a1f2b29..256acd5a6a 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -130,6 +130,7 @@ PairGranular::~PairGranular() memory->destroy(tangential_model); memory->destroy(roll_model); memory->destroy(twist_model); + memory->destroy(noattraction_flag); delete [] onerad_dynamic; delete [] onerad_frozen; @@ -370,6 +371,7 @@ void PairGranular::compute(int eflag, int vflag) Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; + if(noattraction_flag[itype][jtype] and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects @@ -740,6 +742,7 @@ void PairGranular::allocate() memory->create(tangential_model,n+1,n+1,"pair:tangential_model"); memory->create(roll_model,n+1,n+1,"pair:roll_model"); memory->create(twist_model,n+1,n+1,"pair:twist_model"); + memory->create(noattraction_flag,n+1,n+1,"pair:noattraction_flag"); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -793,8 +796,8 @@ void PairGranular::coeff(int narg, char **arg) roll_model_one = ROLL_NONE; twist_model_one = TWIST_NONE; damping_model_one = VISCOELASTIC; - noattractionflag = 0; - + int na_flag = 0; + int iarg = 2; while (iarg < narg) { if (strcmp(arg[iarg], "hooke") == 0) { @@ -968,6 +971,9 @@ void PairGranular::coeff(int narg, char **arg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; + } else if (strcmp(arg[iarg], "no_attraction") == 0) { + na_flag = 1; + iarg += 1; } else error->all(FLERR, "Illegal pair coeff command"); } @@ -985,6 +991,12 @@ void PairGranular::coeff(int narg, char **arg) 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); } else damp = normal_coeffs_one[1]; + if(na_flag and normal_model_one == JKR) + error->all(FLERR,"Cannot turn off attraction with JKR pairstyle"); + + if(na_flag and normal_model_one == DMT) + error->all(FLERR,"Cannot turn off attraction with DMT pairstyle"); + for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { normal_model[i][j] = normal_model[j][i] = normal_model_one; @@ -1027,21 +1039,13 @@ void PairGranular::coeff(int narg, char **arg) cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; + noattraction_flag[i][j] = na_flag; + setflag[i][j] = 1; count++; } } - - if(noattraction flag) { - for(int i = 1; i <= ntypes; i++) { - for(int j = 1; j <= ntypes; j++) { - if(normal_model[i][j] == JKR) - error->all(FLERR,"Cannot turn off attraction with JKR pairstyle"); - if(normal_model[i][j] == DMT) - error->all(FLERR,"Cannot turn off attraction with DMT pairstyle"); - } - } - } + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -1315,6 +1319,7 @@ void PairGranular::write_restart(FILE *fp) fwrite(&tangential_model[i][j],sizeof(int),1,fp); fwrite(&roll_model[i][j],sizeof(int),1,fp); fwrite(&twist_model[i][j],sizeof(int),1,fp); + fwrite(&noattraction_flag[i][j],sizeof(int),1,fp); fwrite(normal_coeffs[i][j],sizeof(double),4,fp); fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); fwrite(roll_coeffs[i][j],sizeof(double),3,fp); @@ -1345,6 +1350,7 @@ void PairGranular::read_restart(FILE *fp) utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&noattraction_flag[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); @@ -1356,6 +1362,7 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&tangential_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&roll_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&twist_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(&noattraction_flag[i][j],1,MPI_INT,0,world); MPI_Bcast(normal_coeffs[i][j],4,MPI_DOUBLE,0,world); MPI_Bcast(tangential_coeffs[i][j],3,MPI_DOUBLE,0,world); MPI_Bcast(roll_coeffs[i][j],3,MPI_DOUBLE,0,world); @@ -1541,6 +1548,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; + if(noattraction_flag[itype][jtype] and Fntot < 0.0) Fntot = 0.0; jnum = list->numneigh[i]; jlist = list->firstneigh[i]; From e1cf6a312fabb721d7ee7103c619064e2e532ddd Mon Sep 17 00:00:00 2001 From: Oliver Henrich Date: Wed, 31 Mar 2021 18:56:50 +0100 Subject: [PATCH 186/370] Corrected error message --- src/USER-CGDNA/pair_oxdna2_coaxstk.cpp | 4 ++-- src/USER-CGDNA/pair_oxdna2_dh.cpp | 4 ++-- src/USER-CGDNA/pair_oxrna2_stk.cpp | 2 +- src/USER-CGDNA/pair_oxrna2_xstk.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index f0b3386478..47d16c4806 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -551,7 +551,7 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) { int count; - if (narg != 21) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/coaxstk"); + if (narg != 21) error->all(FLERR,"Incorrect args for pair coefficients in oxdna2/coaxstk"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; @@ -673,7 +673,7 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/coaxstk"); + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna2/coaxstk"); } diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index d877e0bf9a..6b0df2cde6 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -273,7 +273,7 @@ void PairOxdna2Dh::coeff(int narg, char **arg) { int count; - if (narg != 5) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/dh"); + if (narg != 5) error->all(FLERR,"Incorrect args for pair coefficients in oxdna2/dh"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; @@ -356,7 +356,7 @@ void PairOxdna2Dh::coeff(int narg, char **arg) } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/dh"); + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna2/dh"); } /* ---------------------------------------------------------------------- diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index 33480aa380..3b02a57501 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -1022,7 +1022,7 @@ void PairOxrna2Stk::coeff(int narg, char **arg) } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/stk"); + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxrna2/stk"); } diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index c3b97bfa9c..71c6ca0356 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -576,7 +576,7 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) { int count; - if (narg != 22) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/xstk"); + if (narg != 22) error->all(FLERR,"Incorrect args for pair coefficients in oxrna2/xstk"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; @@ -707,7 +707,7 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) } } - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxdna/xstk"); + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients in oxrna2/xstk"); } From 0bde6c82a3630ec29381bdcc736a016c6c46782c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 Mar 2021 14:40:54 -0400 Subject: [PATCH 187/370] remove newton bond off check again --- src/neighbor.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index fb0a244cc0..704d94c77c 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1363,10 +1363,6 @@ void Neighbor::init_topology() onoff = improper_off; MPI_Allreduce(&onoff,&improper_off,1,MPI_INT,MPI_MAX,world); - // newton_bond off is not supported with atom style template - if ((atom->molecular == Atom::TEMPLATE) && (force->newton_bond == 0)) - error->all(FLERR,"Must use 'newton bond on' with atom style template"); - // instantiate NTopo classes if (atom->avec->bonds_allow) { From 9e412bb7a661088a9bc7b43cf0585fb9c9fb25ae Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 31 Mar 2021 11:42:39 -0700 Subject: [PATCH 188/370] Fixing bug with GPU neighboring when using builds supporting CUDPP. ...introduced in Feb 2021 GPU package update. Manifests when GPU library is built with -DUSE_CUDPP and -DLAL_USE_OLD_NEIGHBOR (latter forced with CUDA 11.2). --- lib/gpu/lal_neighbor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gpu/lal_neighbor.cpp b/lib/gpu/lal_neighbor.cpp index aabba49575..a0d2eaa8c3 100644 --- a/lib/gpu/lal_neighbor.cpp +++ b/lib/gpu/lal_neighbor.cpp @@ -740,6 +740,7 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum, // If binning on GPU, do this now if (_gpu_nbor==1) { + mn = _max_nbors; const numtyp i_cell_size=static_cast(1.0/_cell_size); const int neigh_block=_block_cell_id; const int GX=(int)ceil((float)nall/neigh_block); From c53f2d4629acfa1b88416e886bb1f2e498620bef Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 Mar 2021 14:55:07 -0400 Subject: [PATCH 189/370] correct USER-OMP respa/omp check --- src/USER-OMP/fix_omp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 678df7c22a..ccc86325db 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -203,7 +203,8 @@ void FixOMP::init() thr[i]->_timer_active=-1; } - if (!utils::strmatch(update->integrate_style,"^respa/omp")) + if (utils::strmatch(update->integrate_style,"^respa") + && !utils::strmatch(update->integrate_style,"^respa/omp")) error->all(FLERR,"Must use respa/omp for r-RESPA with /omp styles"); if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; From 7699fb37080d55ac041611983ef3889905afc4e1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 31 Mar 2021 15:55:31 -0400 Subject: [PATCH 190/370] generalize some checks in fix rigid and rigid/small --- src/RIGID/fix_rigid.cpp | 15 ++++++--------- src/RIGID/fix_rigid_nh_small.cpp | 24 +++++++++++++----------- src/RIGID/fix_rigid_small.cpp | 14 ++++++-------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index a8a0e1409f..985554f738 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -720,17 +720,14 @@ void FixRigid::init() } } - // error if npt,nph fix comes before rigid fix - - for (i = 0; i < modify->nfix; i++) { - if (strcmp(modify->fix[i]->style,"npt") == 0) break; - if (strcmp(modify->fix[i]->style,"nph") == 0) break; - } + // error if a fix changing the box comes before rigid fix + for (i = 0; i < modify->nfix; i++) + if (modify->fix[i]->box_change) break; if (i < modify->nfix) { for (int j = i; j < modify->nfix; j++) - if (strcmp(modify->fix[j]->style,"rigid") == 0) - error->all(FLERR,"Rigid fix must come before NPT/NPH fix"); + if (utils::strmatch(modify->fix[j]->style,"^rigid")) + error->all(FLERR,"Rigid fixes must come before any box changing fix"); } // add gravity forces based on gravity vector from fix @@ -738,7 +735,7 @@ void FixRigid::init() if (id_gravity) { int ifix = modify->find_fix(id_gravity); if (ifix < 0) error->all(FLERR,"Fix rigid cannot find fix gravity ID"); - if (strcmp(modify->fix[ifix]->style,"gravity") != 0) + if (!utils::strmatch(modify->fix[ifix]->style,"^gravity")) error->all(FLERR,"Fix rigid gravity fix is invalid"); int tmp; gvec = (double *) modify->fix[ifix]->extract("gvec",tmp); diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 3956fcf35d..454f240bb4 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -19,22 +19,24 @@ #include "fix_rigid_nh_small.h" -#include -#include -#include "math_extra.h" #include "atom.h" +#include "comm.h" #include "compute.h" #include "domain.h" -#include "update.h" -#include "modify.h" -#include "fix_deform.h" -#include "group.h" -#include "comm.h" -#include "force.h" -#include "kspace.h" -#include "memory.h" #include "error.h" +#include "fix_deform.h" +#include "force.h" +#include "group.h" +#include "kspace.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "molecule.h" #include "rigid_const.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index b7e0a1b2ac..d9a0b82ae8 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -571,16 +571,14 @@ void FixRigidSmall::init() } } - // error if npt,nph fix comes before rigid fix + // error if a fix changing the box comes before rigid fix - for (i = 0; i < modify->nfix; i++) { - if (strcmp(modify->fix[i]->style,"npt") == 0) break; - if (strcmp(modify->fix[i]->style,"nph") == 0) break; - } + for (i = 0; i < modify->nfix; i++) + if (modify->fix[i]->box_change) break; if (i < modify->nfix) { for (int j = i; j < modify->nfix; j++) - if (strcmp(modify->fix[j]->style,"rigid") == 0) - error->all(FLERR,"Rigid fix must come before NPT/NPH fix"); + if (utils::strmatch(modify->fix[j]->style,"^rigid")) + error->all(FLERR,"Rigid fixes must come before any box changing fix"); } // add gravity forces based on gravity vector from fix @@ -588,7 +586,7 @@ void FixRigidSmall::init() if (id_gravity) { int ifix = modify->find_fix(id_gravity); if (ifix < 0) error->all(FLERR,"Fix rigid/small cannot find fix gravity ID"); - if (strcmp(modify->fix[ifix]->style,"gravity") != 0) + if (!utils::strmatch(modify->fix[ifix]->style,"^gravity")) error->all(FLERR,"Fix rigid/small gravity fix is invalid"); int tmp; gvec = (double *) modify->fix[ifix]->extract("gvec",tmp); From bed57e02f71168fabd0f7e2895e08162c2a0797b Mon Sep 17 00:00:00 2001 From: "Ronald E. Miller" Date: Wed, 31 Mar 2021 16:18:05 -0400 Subject: [PATCH 191/370] avoiding static variable --- src/KIM/kim_interactions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 3b37c96870..9b63224f0f 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -65,6 +65,7 @@ #include "error.h" #include "fix_store_kim.h" #include "input.h" +#include "variable.h" #include "modify.h" #include "update.h" @@ -96,7 +97,6 @@ void KimInteractions::command(int narg, char **arg) void KimInteractions::do_setup(int narg, char **arg) { - static bool kim_update=0; bool fixed_types; const std::string arg_str(arg[0]); if ((narg == 1) && (arg_str == "fixed_types")) { @@ -130,6 +130,7 @@ void KimInteractions::do_setup(int narg, char **arg) "=======\n"); if (simulatorModel) { + auto first_visit = input->variable->find("kim_update"); if (!fixed_types) { std::string atom_type_sym_list = fmt::format("{}", fmt::join(arg, arg + narg, " ")); @@ -199,8 +200,8 @@ void KimInteractions::do_setup(int narg, char **arg) const std::string sim_field_str(sim_field); if (sim_field_str == "model-defn") { - if (kim_update) input->one("variable kim_update equal 1"); - else input->one("variable kim_update equal 0"); + if (first_visit<0) input->one("variable kim_update equal 0"); + else input->one("variable kim_update equal 1"); if (domain->periodicity[0] && domain->periodicity[1] && domain->periodicity[2]) @@ -242,7 +243,7 @@ void KimInteractions::do_setup(int narg, char **arg) KIM_SimulatorModel_OpenAndInitializeTemplateMap(simulatorModel); - } else if (!kim_update) { + } else { // not a simulator model. issue pair_style and pair_coeff commands. @@ -264,7 +265,6 @@ void KimInteractions::do_setup(int narg, char **arg) // End output to log file input->write_echo("#=== END kim interactions =============================" "=======\n\n"); - kim_update=1; } /* ---------------------------------------------------------------------- */ From 8b2676a103c8fc220fe404c547d1e40ea3d78d5f Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Wed, 31 Mar 2021 16:57:13 -0600 Subject: [PATCH 192/370] Moving arguments in gran wall, renaming toarg limit_damping --- src/GRANULAR/fix_wall_gran.cpp | 31 ++++++++++++------- src/GRANULAR/fix_wall_gran.h | 2 +- src/GRANULAR/pair_gran_hertz_history.cpp | 4 +-- src/GRANULAR/pair_gran_hooke.cpp | 4 +-- src/GRANULAR/pair_gran_hooke_history.cpp | 10 +++--- src/GRANULAR/pair_gran_hooke_history.h | 2 +- src/GRANULAR/pair_granular.cpp | 30 +++++++++--------- src/GRANULAR/pair_granular.h | 2 +- src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 2 +- 9 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 9c17a323c5..c9d00ccdd3 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -116,6 +116,12 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : kt /= force->nktv2p; } iarg = 10; + + if (strcmp(arg[iarg],"limit_damping") == 0) { + limit_damping = 1; + iarg += 1; + } + } else { iarg = 4; damping_model = VISCOELASTIC; @@ -292,6 +298,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : strcmp(arg[iarg], "zcylinder") == 0 || strcmp(arg[iarg], "region") == 0) { break; + } else if (strcmp(arg[iarg],"limit_damping") == 0) { + limit_damping = 1; + iarg += 1; } else { error->all(FLERR, "Illegal fix wall/gran command"); } @@ -301,6 +310,11 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : if (tangential_model == TANGENTIAL_MINDLIN_RESCALE) size_history += 1; } + if(normal_model == JKR) + error->all(FLERR,"Cannot limit damping with JRK model"); + if(normal_model == DMT) + error->all(FLERR,"Cannot limit damping with DMT model"); + // wallstyle args idregion = nullptr; @@ -347,7 +361,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wiggle = 0; wshear = 0; peratom_flag = 0; - noattraction_flag = 0; + limit_damping = 0; while (iarg < narg) { if (strcmp(arg[iarg],"wiggle") == 0) { @@ -374,13 +388,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 8; peratom_freq = 1; iarg += 1; - } else if (strcmp(arg[iarg],"no_attraction") == 0) { - noattraction_flag = 1; - if(normal_model == JKR) - error->all(FLERR,"Cannot turn off attraction with JRK model"); - if(normal_model == DMT) - error->all(FLERR,"Cannot turn off attraction with DMT model"); - iarg += 1; } else error->all(FLERR,"Illegal fix wall/gran command"); } @@ -769,7 +776,7 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if(noattraction_flag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -862,7 +869,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if(noattraction_flag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -994,7 +1001,7 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; - if(noattraction_flag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -1188,7 +1195,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(noattraction_flag and Fntot < 0.0) Fntot = 0.0; + if(limit_damping and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 3963b22a2c..473f26cca4 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -69,7 +69,7 @@ class FixWallGran : public Fix { // for granular model choices int normal_model, damping_model; int tangential_model, roll_model, twist_model; - int noattraction_flag; + int limit_damping; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 7da0c6142d..40c6c3a41d 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -181,7 +181,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -389,7 +389,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 76946701cb..0e3ffc7293 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -158,7 +158,7 @@ void PairGranHooke::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -300,7 +300,7 @@ double PairGranHooke::single(int i, int j, int /*itype*/, int /*jtype*/, double damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 4893be4084..d3c1cf7672 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -237,7 +237,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -371,10 +371,10 @@ void PairGranHookeHistory::settings(int narg, char **arg) dampflag = utils::inumeric(FLERR,arg[5],false,lmp); if (dampflag == 0) gammat = 0.0; - noattractionflag = 0; + limit_damping = 0; if(narg == 7) { - if(strcmp(arg[6], "no_attraction")) - noattractionflag = 1; + if(strcmp(arg[6], "limit_damping")) + limit_damping = 1; else error->all(FLERR,"Illegal pair_style command"); } @@ -695,7 +695,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(noattractionflag and ccel < 0.0) ccel = 0.0; + if(limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index bf40097f9d..f511d30237 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -49,7 +49,7 @@ class PairGranHookeHistory : public Pair { double dt; int freeze_group_bit; int history; - int noattractionflag; + int limit_damping; int neighprev; double *onerad_dynamic,*onerad_frozen; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 256acd5a6a..dd22f03fa8 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -130,7 +130,7 @@ PairGranular::~PairGranular() memory->destroy(tangential_model); memory->destroy(roll_model); memory->destroy(twist_model); - memory->destroy(noattraction_flag); + memory->destroy(limit_damping); delete [] onerad_dynamic; delete [] onerad_frozen; @@ -371,7 +371,7 @@ void PairGranular::compute(int eflag, int vflag) Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(noattraction_flag[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if(limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects @@ -742,7 +742,7 @@ void PairGranular::allocate() memory->create(tangential_model,n+1,n+1,"pair:tangential_model"); memory->create(roll_model,n+1,n+1,"pair:roll_model"); memory->create(twist_model,n+1,n+1,"pair:twist_model"); - memory->create(noattraction_flag,n+1,n+1,"pair:noattraction_flag"); + memory->create(limit_damping,n+1,n+1,"pair:limit_damping"); onerad_dynamic = new double[n+1]; onerad_frozen = new double[n+1]; @@ -796,7 +796,7 @@ void PairGranular::coeff(int narg, char **arg) roll_model_one = ROLL_NONE; twist_model_one = TWIST_NONE; damping_model_one = VISCOELASTIC; - int na_flag = 0; + int ld_flag = 0; int iarg = 2; while (iarg < narg) { @@ -971,8 +971,8 @@ void PairGranular::coeff(int narg, char **arg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } else if (strcmp(arg[iarg], "no_attraction") == 0) { - na_flag = 1; + } else if (strcmp(arg[iarg], "limit_damping") == 0) { + ld_flag = 1; iarg += 1; } else error->all(FLERR, "Illegal pair coeff command"); } @@ -991,11 +991,11 @@ void PairGranular::coeff(int narg, char **arg) 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); } else damp = normal_coeffs_one[1]; - if(na_flag and normal_model_one == JKR) - error->all(FLERR,"Cannot turn off attraction with JKR pairstyle"); + if(ld_flag and normal_model_one == JKR) + error->all(FLERR,"Cannot limit damping with JKR model"); - if(na_flag and normal_model_one == DMT) - error->all(FLERR,"Cannot turn off attraction with DMT pairstyle"); + if(ld_flag and normal_model_one == DMT) + error->all(FLERR,"Cannot limit damping with DMT model"); for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { @@ -1039,7 +1039,7 @@ void PairGranular::coeff(int narg, char **arg) cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; - noattraction_flag[i][j] = na_flag; + limit_damping[i][j] = ld_flag; setflag[i][j] = 1; count++; @@ -1319,7 +1319,7 @@ void PairGranular::write_restart(FILE *fp) fwrite(&tangential_model[i][j],sizeof(int),1,fp); fwrite(&roll_model[i][j],sizeof(int),1,fp); fwrite(&twist_model[i][j],sizeof(int),1,fp); - fwrite(&noattraction_flag[i][j],sizeof(int),1,fp); + fwrite(&limit_damping[i][j],sizeof(int),1,fp); fwrite(normal_coeffs[i][j],sizeof(double),4,fp); fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); fwrite(roll_coeffs[i][j],sizeof(double),3,fp); @@ -1350,7 +1350,7 @@ void PairGranular::read_restart(FILE *fp) utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&noattraction_flag[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&limit_damping[i][j],sizeof(int),1,fp,nullptr,error); utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); @@ -1362,7 +1362,7 @@ void PairGranular::read_restart(FILE *fp) MPI_Bcast(&tangential_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&roll_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&twist_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&noattraction_flag[i][j],1,MPI_INT,0,world); + MPI_Bcast(&limit_damping[i][j],1,MPI_INT,0,world); MPI_Bcast(normal_coeffs[i][j],4,MPI_DOUBLE,0,world); MPI_Bcast(tangential_coeffs[i][j],3,MPI_DOUBLE,0,world); MPI_Bcast(roll_coeffs[i][j],3,MPI_DOUBLE,0,world); @@ -1548,7 +1548,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(noattraction_flag[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if(limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; jnum = list->numneigh[i]; jlist = list->firstneigh[i]; diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 1e4e8c8fc4..49eb457f0d 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -70,7 +70,7 @@ class PairGranular : public Pair { // model choices int **normal_model, **damping_model; int **tangential_model, **roll_model, **twist_model; - int **noattractionflag; + int **limit_damping; // history flags int normal_history, tangential_history, roll_history, twist_history; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index caa19ffdef..8d853b7dae 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -392,7 +392,7 @@ void PairGranHookeHistoryKokkos::operator()(TagPairGranHookeHistoryC F_FLOAT damp = meff*gamman*vnnr*rsqinv; F_FLOAT ccel = kn*(radsum-r)*rinv - damp; - if(noattractionflag & ccel < 0.0) ccel = 0.0; + if(limit_damping & ccel < 0.0) ccel = 0.0; // relative velocities From 8b37f3c04448bc3d3ed7a9f416cde67e8ad8e802 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Wed, 31 Mar 2021 17:25:41 -0600 Subject: [PATCH 193/370] Fixing incorrect arg for pair gran --- doc/src/fix_wall_gran.rst | 14 ++++---------- doc/src/fix_wall_gran_region.rst | 9 ++------- doc/src/pair_gran.rst | 6 +++--- doc/src/pair_granular.rst | 2 +- src/GRANULAR/pair_gran_hooke_history.cpp | 6 ++---- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index bfe06bf7a0..02d52ef1a6 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -29,6 +29,7 @@ Syntax gamma_t = damping coefficient for collisions in tangential direction (1/time units or 1/time-distance units - see discussion below) xmu = static yield criterion (unitless value between 0.0 and 1.0e4) dampflag = 0 or 1 if tangential damping force is excluded or included + optional keyword = *limit_damping*, limit damping to prevent attractive interaction .. parsed-literal:: @@ -45,7 +46,7 @@ Syntax radius = cylinder radius (distance units) * zero or more keyword/value pairs may be appended to args -* keyword = *wiggle* or *shear* or *contacts* or *no_attraction* +* keyword = *wiggle* or *shear* or *contacts* .. parsed-literal:: @@ -58,8 +59,6 @@ Syntax vshear = magnitude of shear velocity (velocity units) *contacts* value = none generate contact information for each particle - *no_attraction* value = none - turn off possibility of attractive interactions Examples @@ -97,7 +96,8 @@ Specifically, delta = radius - r = overlap of particle with wall, m_eff = mass of particle, and the effective radius of contact = RiRj/Ri+Rj is set to the radius of the particle. -The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu* and *dampflag* +The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, +and the optional keyword *limit_damping* have the same meaning and units as those specified with the :doc:`pair_style gran/\* ` commands. This means a NULL can be used for either *Kt* or *gamma_t* as described on that page. If a @@ -177,12 +177,6 @@ the clockwise direction for *vshear* > 0 or counter-clockwise for *vshear* < 0. In this case, *vshear* is the tangential velocity of the wall at whatever *radius* has been defined. -If a particle is moving away from the wall while in contact, there -is a possibility that the particle could experience an effective attractive -force due to damping. If the *no_attraction* keyword is used, this fix -will zero out the normal component of the force if there is an effective -attractive force. This keyword cannot be used with the JKR or DMT models. - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" This fix writes the shear friction state of atoms interacting with the diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 00eb19ba1c..b7a9ff6bd7 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -183,7 +183,8 @@ radius - r = overlap of particle with wall, m_eff = mass of particle, and the effective radius of contact is just the radius of the particle. -The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu* and *dampflag* +The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, +and the optional keyword *limit_damping* have the same meaning and units as those specified with the :doc:`pair_style gran/\* ` commands. This means a NULL can be used for either *Kt* or *gamma_t* as described on that page. If a @@ -201,12 +202,6 @@ values for the 6 wall/particle coefficients than for particle/particle interactions. E.g. if you wish to model the wall as a different material. -If a particle is moving away from the wall while in contact, there -is a possibility that the particle could experience an effective attractive -force due to damping. If the *no_attraction* keyword is used, this fix -will zero out the normal component of the force if there is an effective -attractive force. This keyword cannot be used with the JKR or DMT models. - Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index 8145f7fb7a..b918e38da6 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -40,8 +40,8 @@ Syntax .. parsed-literal:: - *no_attraction* value = none - turn off possibility of attractive interactions + *limit_damping* value = none + limit damping to prevent attractive interaction .. note:: @@ -217,7 +217,7 @@ potential. If two particles are moving away from each other while in contact, there is a possibility that the particles could experience an effective attractive -force due to damping. If the *no_attraction* keyword is used, this fix +force due to damping. If the *limit_damping* keyword is used, this fix will zero out the normal component of the force if there is an effective attractive force. diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 0076994e25..04c9d45afd 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -625,7 +625,7 @@ Finally, the twisting torque on each particle is given by: If two particles are moving away from each other while in contact, there is a possibility that the particles could experience an effective attractive -force due to damping. If the optional *no_attraction* keyword is used, this fix +force due to damping. If the optional *limit_damping* keyword is used, this fix will zero out the normal component of the force if there is an effective attractive force. This keyword cannot be used with the JKR or DMT models. diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index d3c1cf7672..a86af2116e 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -373,10 +373,8 @@ void PairGranHookeHistory::settings(int narg, char **arg) limit_damping = 0; if(narg == 7) { - if(strcmp(arg[6], "limit_damping")) - limit_damping = 1; - else - error->all(FLERR,"Illegal pair_style command"); + if(strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; + else error->all(FLERR,"Illegal pair_style command"); } if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || From f48af95d499536dd5da692ba0b3ea9c6361ffcee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 08:23:10 -0400 Subject: [PATCH 194/370] update gcmc example to use fix rigid/small --- examples/gcmc/in.gcmc.co2 | 48 +++--- examples/gcmc/log.27Nov18.gcmc.co2.g++.1 | 196 ----------------------- examples/gcmc/log.31Mar21.gcmc.co2.g++.1 | 196 +++++++++++++++++++++++ 3 files changed, 220 insertions(+), 220 deletions(-) delete mode 100644 examples/gcmc/log.27Nov18.gcmc.co2.g++.1 create mode 100644 examples/gcmc/log.31Mar21.gcmc.co2.g++.1 diff --git a/examples/gcmc/in.gcmc.co2 b/examples/gcmc/in.gcmc.co2 index b5e11d212d..1da9020a64 100644 --- a/examples/gcmc/in.gcmc.co2 +++ b/examples/gcmc/in.gcmc.co2 @@ -1,4 +1,4 @@ -# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics +# GCMC for CO2 molecular fluid, rigid/small dynamics # Rigid CO2 TraPPE model # [Potoff and J.I. Siepmann, Vapor-liquid equilibria of # mixtures containing alkanes, carbon dioxide and @@ -7,7 +7,7 @@ # variables available on command line variable mu index -8.1 -variable disp index 0.5 +variable disp index 0.5 variable temp index 338.0 variable lbox index 10.0 variable spacing index 5.0 @@ -17,7 +17,7 @@ variable spacing index 5.0 units real atom_style full boundary p p p -pair_style lj/cut/coul/long 14 +pair_style lj/cut/coul/long 14 pair_modify mix arithmetic tail yes kspace_style ewald 0.0001 bond_style harmonic @@ -25,7 +25,7 @@ angle_style harmonic # box, start molecules on simple cubic lattice -lattice sc ${spacing} +lattice sc ${spacing} region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box create_box 2 box & bond/types 1 & @@ -34,56 +34,56 @@ create_box 2 box & extra/angle/per/atom 1 & extra/special/per/atom 2 molecule co2mol CO2.txt -create_atoms 0 box mol co2mol 464563 units box - -# rigid CO2 TraPPE model +create_atoms 0 box mol co2mol 464563 units box + +# rigid CO2 TraPPE model pair_coeff 1 1 0.053649 2.8 -pair_coeff 2 2 0.156973 3.05 -bond_coeff 1 0 1.16 -angle_coeff 1 0 180 +pair_coeff 2 2 0.156973 3.05 +bond_coeff 1 0 1.16 +angle_coeff 1 0 180 # masses -mass 1 12.0107 -mass 2 15.9994 +mass 1 12.0107 +mass 2 15.9994 # MD settings group co2 type 1 2 neighbor 2.0 bin neigh_modify every 1 delay 10 check yes -velocity all create ${temp} 54654 +velocity all create ${temp} 54654 timestep 1.0 -# rigid constraints with thermostat +# rigid constraints with thermostat -fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol +fix myrigid co2 rigid/small molecule mol co2mol # dynamically update fix rigid/nvt/small temperature ndof -fix_modify myrigidnvt dynamic/dof yes +fix_modify myrigid dynamic/dof yes # gcmc variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans) fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol & - co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt + co2mol tfac_insert ${tfac} group co2 rigid myrigid # atom counts -variable carbon atom "type==1" +variable carbon atom "type==1" variable oxygen atom "type==2" -group carbon dynamic co2 var carbon -group oxygen dynamic co2 var oxygen +group carbon dynamic co2 var carbon +group oxygen dynamic co2 var oxygen variable nC equal count(carbon) variable nO equal count(oxygen) # output -variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1) -variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1) -variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1) -variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1) +variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1) +variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1) +variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1) +variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1) # dynamically update default temperature ndof compute_modify thermo_temp dynamic/dof yes diff --git a/examples/gcmc/log.27Nov18.gcmc.co2.g++.1 b/examples/gcmc/log.27Nov18.gcmc.co2.g++.1 deleted file mode 100644 index 4ed9056d04..0000000000 --- a/examples/gcmc/log.27Nov18.gcmc.co2.g++.1 +++ /dev/null @@ -1,196 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# GCMC for CO2 molecular fluid, rigid/small/nvt dynamics -# Rigid CO2 TraPPE model -# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of -# mixtures containing alkanes, carbon dioxide and -# nitrogen AIChE J., 47,1676-1682 (2001)]. - -# variables available on command line - -variable mu index -8.1 -variable disp index 0.5 -variable temp index 338.0 -variable lbox index 10.0 -variable spacing index 5.0 - -# global model settings - -units real -atom_style full -boundary p p p -pair_style lj/cut/coul/long 14 -pair_modify mix arithmetic tail yes -kspace_style ewald 0.0001 -bond_style harmonic -angle_style harmonic - -# box, start molecules on simple cubic lattice - -lattice sc ${spacing} -lattice sc 5.0 -Lattice spacing in x,y,z = 5 5 5 -region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box -region box block 0 10.0 0 ${lbox} 0 ${lbox} units box -region box block 0 10.0 0 10.0 0 ${lbox} units box -region box block 0 10.0 0 10.0 0 10.0 units box -create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2 -Created orthogonal box = (0 0 0) to (10 10 10) - 1 by 1 by 1 MPI processor grid -molecule co2mol CO2.txt -Read molecule co2mol: - 3 atoms with max type 2 - 2 bonds with max type 1 - 1 angles with max type 1 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -create_atoms 0 box mol co2mol 464563 units box -Created 24 atoms - Time spent = 0.00134993 secs - -# rigid CO2 TraPPE model - -pair_coeff 1 1 0.053649 2.8 -pair_coeff 2 2 0.156973 3.05 -bond_coeff 1 0 1.16 -angle_coeff 1 0 180 - -# masses - -mass 1 12.0107 -mass 2 15.9994 - -# MD settings - -group co2 type 1 2 -24 atoms in group co2 -neighbor 2.0 bin -neigh_modify every 1 delay 10 check yes -velocity all create ${temp} 54654 -velocity all create 338.0 54654 -timestep 1.0 - -# rigid constraints with thermostat - -fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol -fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 ${temp} 100 mol co2mol -fix myrigidnvt co2 rigid/nvt/small molecule temp 338.0 338.0 100 mol co2mol -8 rigid bodies with 24 atoms - 1.16 = max distance from body owner to body atom - -# dynamically update fix rigid/nvt/small temperature ndof -fix_modify myrigidnvt dynamic/dof yes - -# gcmc - -variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans) -fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt -fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt -fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt -fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt -fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigidnvt - -# atom counts - -variable carbon atom "type==1" -variable oxygen atom "type==2" -group carbon dynamic co2 var carbon -dynamic group carbon defined -group oxygen dynamic co2 var oxygen -dynamic group oxygen defined -variable nC equal count(carbon) -variable nO equal count(oxygen) - -# output - -variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1) -variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1) -variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1) -variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1) - -# dynamically update default temperature ndof -compute_modify thermo_temp dynamic/dof yes - -thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO -thermo 1000 - -# run - -run 20000 -Ewald initialization ... - using 12-bit tables for long-range coulomb (src/kspace.cpp:321) - G vector (1/distance) = 0.164636 - estimated absolute RMS force accuracy = 0.0332064 - estimated relative force accuracy = 0.0001 - KSpace vectors: actual max1d max3d = 16 2 62 - kxmax kymax kzmax = 2 2 2 -WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:487) -0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc -0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc -WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:471) -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 16 - ghost atom cutoff = 16 - binsize = 8, bins = 2 2 2 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes -Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO - 0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16 - 1000 267.9799 -73.919548 -3.6735999 5.8578459 0.36539744 15 0.23663972 0.2494423 0 0 5 10 - 2000 409.06596 -98.033864 -6.7570039 10.974131 0.43847693 18 0.29379544 0.29816284 0 0 6 12 - 3000 279.3225 -836.47758 -26.434976 15.819539 0.87695385 36 0.23798567 0.24203908 0 0 12 24 - 4000 333.6181 606.63478 -30.35312 18.894592 0.87695385 36 0.19121778 0.19481508 0 0 12 24 - 5000 405.98741 -103.97582 -14.180277 16.942399 0.65771539 27 0.15272841 0.15982952 0 0 9 18 - 6000 283.5835 -240.01076 -6.7198093 7.607777 0.43847693 18 0.1606796 0.16536735 0 0 6 12 - 7000 142.00717 154.95914 -0.74192319 0.98769159 0.14615898 6 0.19501993 0.20103405 0 0 2 4 - 8000 376.67702 -118.12474 -10.774631 13.847899 0.5846359 24 0.20133396 0.20468352 0 0 8 16 - 9000 305.43166 -1095.8633 -10.388279 9.7112935 0.51155641 21 0.19445239 0.19869334 0 0 7 14 - 10000 244.08225 -179.31274 -12.974988 8.9732748 0.5846359 24 0.19098971 0.19586397 0 0 8 16 - 11000 305.03389 -568.94714 -21.745425 14.244887 0.73079488 30 0.18517522 0.18978828 0 0 10 20 - 12000 318.29735 767.76579 -37.184231 21.189508 1.0231128 42 0.17256426 0.17580267 0 0 14 28 - 13000 411.21707 433.01125 -4.5149215 8.9889065 0.36539744 15 0.16329385 0.16767604 0 0 5 10 - 14000 304.29535 148.28607 -2.3505844 6.6516754 0.36539744 15 0.17435868 0.17897674 0 0 5 10 - 15000 338.00555 2384.1424 -21.438264 17.463859 0.80387436 33 0.17237066 0.17634112 0 0 11 22 - 16000 613.56062 610.93867 -0.057364228 1.2192718 0.073079488 3 0.17128158 0.1758886 0 0 1 2 - 17000 432.63323 -980.52384 -15.79844 18.054365 0.65771539 27 0.17145651 0.17504846 0 0 9 18 - 18000 181.74572 -352.81765 -1.8617959 2.1669979 0.21923846 9 0.17292463 0.17654774 0 0 3 6 - 19000 208.55292 -248.38735 -4.2287767 4.5588154 0.36539744 15 0.18168324 0.18454331 0 0 5 10 - 20000 304.73317 -649.9896 -16.532405 12.716924 0.65771539 27 0.18085983 0.18345574 0 0 9 18 -Loop time of 21.0434 on 1 procs for 20000 steps with 27 atoms - -Performance: 82.116 ns/day, 0.292 hours/ns, 950.415 timesteps/s -98.5% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.2373 | 2.2373 | 2.2373 | 0.0 | 10.63 -Bond | 0.022895 | 0.022895 | 0.022895 | 0.0 | 0.11 -Kspace | 0.16756 | 0.16756 | 0.16756 | 0.0 | 0.80 -Neigh | 0.11436 | 0.11436 | 0.11436 | 0.0 | 0.54 -Comm | 0.26988 | 0.26988 | 0.26988 | 0.0 | 1.28 -Output | 0.0014684 | 0.0014684 | 0.0014684 | 0.0 | 0.01 -Modify | 18.193 | 18.193 | 18.193 | 0.0 | 86.45 -Other | | 0.03692 | | | 0.18 - -Nlocal: 27 ave 27 max 27 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 2081 ave 2081 max 2081 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 6264 ave 6264 max 6264 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 6264 -Ave neighs/atom = 232 -Ave special neighs/atom = 2 -Neighbor list builds = 20177 -Dangerous builds = 0 - -Total wall time: 0:00:21 diff --git a/examples/gcmc/log.31Mar21.gcmc.co2.g++.1 b/examples/gcmc/log.31Mar21.gcmc.co2.g++.1 new file mode 100644 index 0000000000..80de6554e4 --- /dev/null +++ b/examples/gcmc/log.31Mar21.gcmc.co2.g++.1 @@ -0,0 +1,196 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# GCMC for CO2 molecular fluid, rigid/small dynamics +# Rigid CO2 TraPPE model +# [Potoff and J.I. Siepmann, Vapor-liquid equilibria of +# mixtures containing alkanes, carbon dioxide and +# nitrogen AIChE J., 47,1676-1682 (2001)]. + +# variables available on command line + +variable mu index -8.1 +variable disp index 0.5 +variable temp index 338.0 +variable lbox index 10.0 +variable spacing index 5.0 + +# global model settings + +units real +atom_style full +boundary p p p +pair_style lj/cut/coul/long 14 +pair_modify mix arithmetic tail yes +kspace_style ewald 0.0001 +bond_style harmonic +angle_style harmonic + +# box, start molecules on simple cubic lattice + +lattice sc ${spacing} +lattice sc 5.0 +Lattice spacing in x,y,z = 5.0000000 5.0000000 5.0000000 +region box block 0 ${lbox} 0 ${lbox} 0 ${lbox} units box +region box block 0 10.0 0 ${lbox} 0 ${lbox} units box +region box block 0 10.0 0 10.0 0 ${lbox} units box +region box block 0 10.0 0 10.0 0 10.0 units box +create_box 2 box bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (10.000000 10.000000 10.000000) + 1 by 1 by 1 MPI processor grid +molecule co2mol CO2.txt +Read molecule template co2mol: + 1 molecules + 3 atoms with max type 2 + 2 bonds with max type 1 + 1 angles with max type 1 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +create_atoms 0 box mol co2mol 464563 units box +Created 24 atoms + create_atoms CPU = 0.002 seconds + +# rigid CO2 TraPPE model + +pair_coeff 1 1 0.053649 2.8 +pair_coeff 2 2 0.156973 3.05 +bond_coeff 1 0 1.16 +angle_coeff 1 0 180 + +# masses + +mass 1 12.0107 +mass 2 15.9994 + +# MD settings + +group co2 type 1 2 +24 atoms in group co2 +neighbor 2.0 bin +neigh_modify every 1 delay 10 check yes +velocity all create ${temp} 54654 +velocity all create 338.0 54654 +timestep 1.0 + +# rigid constraints with thermostat + +fix myrigid co2 rigid/small molecule mol co2mol + create bodies CPU = 0.000 seconds + 8 rigid bodies with 24 atoms + 1.1600000 = max distance from body owner to body atom + +# dynamically update fix rigid/nvt/small temperature ndof +fix_modify myrigid dynamic/dof yes + +# gcmc + +variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans) +fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid +fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 ${mu} ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid +fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 ${disp} mol co2mol tfac_insert ${tfac} group co2 rigid myrigid +fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert ${tfac} group co2 rigid myrigid +fix mygcmc co2 gcmc 100 100 0 0 54341 338.0 -8.1 0.5 mol co2mol tfac_insert 1.66666666666667 group co2 rigid myrigid + +# atom counts + +variable carbon atom "type==1" +variable oxygen atom "type==2" +group carbon dynamic co2 var carbon +dynamic group carbon defined +group oxygen dynamic co2 var oxygen +dynamic group oxygen defined +variable nC equal count(carbon) +variable nO equal count(oxygen) + +# output + +variable tacc equal f_mygcmc[2]/(f_mygcmc[1]+0.1) +variable iacc equal f_mygcmc[4]/(f_mygcmc[3]+0.1) +variable dacc equal f_mygcmc[6]/(f_mygcmc[5]+0.1) +variable racc equal f_mygcmc[8]/(f_mygcmc[7]+0.1) + +# dynamically update default temperature ndof +compute_modify thermo_temp dynamic/dof yes + +thermo_style custom step temp press pe ke density atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO +thermo 1000 + +# run + +run 20000 +Ewald initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:339) + G vector (1/distance) = 0.16463644 + estimated absolute RMS force accuracy = 0.033206372 + estimated relative force accuracy = 0.0001 + KSpace vectors: actual max1d max3d = 16 2 62 + kxmax kymax kzmax = 2 2 2 +WARNING: Fix gcmc using full_energy option (src/MC/fix_gcmc.cpp:482) +0 atoms in group FixGCMC:gcmc_exclusion_group:mygcmc +0 atoms in group FixGCMC:rotation_gas_atoms:mygcmc +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 16 + ghost atom cutoff = 16 + binsize = 8, bins = 2 2 2 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 15.62 | 15.62 | 15.62 Mbytes +Step Temp Press PotEng KinEng Density Atoms v_iacc v_dacc v_tacc v_racc v_nC v_nO + 0 364.27579 4238.8631 -9.6809388 13.391989 0.5846359 24 0 0 0 0 8 16 + 1000 261.50949 -204.60974 -9.6459249 8.3147747 0.51155641 21 0.096366192 0.097590121 0 0 7 14 + 2000 479.39697 231.28436 -7.0089345 10.47927 0.36539744 15 0.085531005 0.085453295 0 0 5 10 + 3000 318.31766 -433.17133 -7.3680951 8.5396005 0.43847693 18 0.078556687 0.080101462 0 0 6 12 + 4000 357.40776 -186.78 -16.453111 14.915105 0.65771539 27 0.082003877 0.08249082 0 0 9 18 + 5000 399.94731 1524.2909 -16.624678 18.677282 0.73079488 30 0.071285101 0.072731705 0 0 10 20 + 6000 354.71736 60.134827 -18.988979 16.565073 0.73079488 30 0.071615663 0.071713414 0 0 10 20 + 7000 483.32057 966.32174 -5.7393251 10.565037 0.36539744 15 0.087027775 0.089855826 0 0 5 10 + 8000 547.68562 494.96891 -4.125626 11.97201 0.36539744 15 0.11738082 0.11937373 0 0 5 10 + 9000 433.76488 390.91467 -0.85312985 5.1718828 0.21923846 9 0.13265238 0.13513212 0 0 3 6 + 10000 330.01685 -862.07457 -26.494645 18.690633 0.87695385 36 0.13775034 0.13905403 0 0 12 24 + 11000 334.26318 -578.48274 -13.236965 12.288625 0.5846359 24 0.13713936 0.13960485 0 0 8 16 + 12000 243.68657 -1244.7156 -25.757644 12.590645 0.80387436 33 0.1339588 0.13588739 0 0 11 22 + 13000 307.66758 -429.66928 -17.864639 14.367878 0.73079488 30 0.12604721 0.1278094 0 0 10 20 + 14000 330.91434 495.97112 -15.374248 13.809499 0.65771539 27 0.12011756 0.12145865 0 0 9 18 + 15000 564.87966 982.72332 -14.810525 26.379517 0.73079488 30 0.12164324 0.12343521 0 0 10 20 + 16000 342.63867 -54.776299 -2.2580523 5.7875978 0.29231795 12 0.13535812 0.13790758 0 0 4 8 + 17000 461.07005 -2.4317694 -1.145154 3.2068452 0.14615898 6 0.1444739 0.14730804 0 0 2 4 + 18000 197.21207 -40.124433 -7.0857418 5.2906654 0.43847693 18 0.14403997 0.14574329 0 0 6 12 + 19000 393.36395 -420.49802 -11.172739 14.461366 0.5846359 24 0.15005606 0.15142063 0 0 8 16 + 20000 356.48539 56.071962 -1.7861789 4.2504609 0.21923846 9 0.15422732 0.15627984 0 0 3 6 +Loop time of 19.5982 on 1 procs for 20000 steps with 9 atoms + +Performance: 88.171 ns/day, 0.272 hours/ns, 1020.502 timesteps/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.3404 | 2.3404 | 2.3404 | 0.0 | 11.94 +Bond | 0.033919 | 0.033919 | 0.033919 | 0.0 | 0.17 +Kspace | 0.19974 | 0.19974 | 0.19974 | 0.0 | 1.02 +Neigh | 0.11478 | 0.11478 | 0.11478 | 0.0 | 0.59 +Comm | 0.22538 | 0.22538 | 0.22538 | 0.0 | 1.15 +Output | 0.00096536 | 0.00096536 | 0.00096536 | 0.0 | 0.00 +Modify | 16.627 | 16.627 | 16.627 | 0.0 | 84.84 +Other | | 0.05594 | | | 0.29 + +Nlocal: 9.00000 ave 9 max 9 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 703.000 ave 703 max 703 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 719.000 ave 719 max 719 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 719 +Ave neighs/atom = 79.888889 +Ave special neighs/atom = 2.0000000 +Neighbor list builds = 20196 +Dangerous builds = 0 + +Total wall time: 0:00:19 From d72b390c41f63bae8f6cde7c9d4a56e6a9abf042 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 08:48:39 -0400 Subject: [PATCH 195/370] correct check for box changing fixes --- src/RIGID/fix_rigid.cpp | 4 ++-- src/RIGID/fix_rigid_small.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 985554f738..26bbb9477f 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -725,7 +725,7 @@ void FixRigid::init() for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->box_change) break; if (i < modify->nfix) { - for (int j = i; j < modify->nfix; j++) + for (int j = i+1; j < modify->nfix; j++) if (utils::strmatch(modify->fix[j]->style,"^rigid")) error->all(FLERR,"Rigid fixes must come before any box changing fix"); } @@ -736,7 +736,7 @@ void FixRigid::init() int ifix = modify->find_fix(id_gravity); if (ifix < 0) error->all(FLERR,"Fix rigid cannot find fix gravity ID"); if (!utils::strmatch(modify->fix[ifix]->style,"^gravity")) - error->all(FLERR,"Fix rigid gravity fix is invalid"); + error->all(FLERR,"Fix rigid gravity fix ID is not a gravity fix style"); int tmp; gvec = (double *) modify->fix[ifix]->extract("gvec",tmp); } diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index d9a0b82ae8..14bd9f7a55 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -576,7 +576,7 @@ void FixRigidSmall::init() for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->box_change) break; if (i < modify->nfix) { - for (int j = i; j < modify->nfix; j++) + for (int j = i+1; j < modify->nfix; j++) if (utils::strmatch(modify->fix[j]->style,"^rigid")) error->all(FLERR,"Rigid fixes must come before any box changing fix"); } @@ -587,7 +587,7 @@ void FixRigidSmall::init() int ifix = modify->find_fix(id_gravity); if (ifix < 0) error->all(FLERR,"Fix rigid/small cannot find fix gravity ID"); if (!utils::strmatch(modify->fix[ifix]->style,"^gravity")) - error->all(FLERR,"Fix rigid/small gravity fix is invalid"); + error->all(FLERR,"Fix rigid gravity fix ID is not a gravity fix style"); int tmp; gvec = (double *) modify->fix[ifix]->extract("gvec",tmp); } From c9652f3aa695f95d62914cc94000cdcd51f4fd98 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 09:31:54 -0400 Subject: [PATCH 196/370] update documentation for the extract_global() method of the lammps.lammps class --- python/lammps/core.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index e112c4f3f8..3118cb3d99 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -729,12 +729,11 @@ class lammps(object): def extract_global(self, name, dtype=LAMMPS_AUTODETECT): """Query LAMMPS about global settings of different types. - This is a wrapper around the :cpp:func:`lammps_extract_global` - function of the C-library interface. Unlike the C function - this method returns the value and not a pointer and thus can - only return the first value for keywords representing a list - of values. The :cpp:func:`lammps_extract_global` documentation - includes a list of the supported keywords and their data types. + This is a wrapper around the :cpp:func:`lammps_extract_global` function + of the C-library interface. Since there are no pointers in Python, this + method will - unlike the C function - return the value or a list of + values. The :cpp:func:`lammps_extract_global` documentation includes a + list of the supported keywords and their data types. Since Python needs to know the data type to be able to interpret the result, by default, this function will try to auto-detect the data type by asking the library. You can also force a specific data type. For that From f867e69290beea676eb86b0cabae44768349df9f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 09:35:52 -0400 Subject: [PATCH 197/370] include new split_lines() function in Developer docs --- doc/src/Developer_utils.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/src/Developer_utils.rst b/doc/src/Developer_utils.rst index 992df6ba63..17b4715dc7 100644 --- a/doc/src/Developer_utils.rst +++ b/doc/src/Developer_utils.rst @@ -101,6 +101,9 @@ and parsing files or arguments. .. doxygenfunction:: split_words :project: progguide +.. doxygenfunction:: split_lines + :project: progguide + .. doxygenfunction:: strmatch :project: progguide From e0aec1b5d9ba2c3d26d16beb11d5a100853b195f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 09:39:17 -0400 Subject: [PATCH 198/370] remove obsoleted comment --- unittest/force-styles/test_fix_timestep.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index f72295716e..e4b0fa6e02 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -518,11 +518,9 @@ TEST(FixTimestep, plain) // rigid fixes need work to test properly with r-RESPA. // fix nve/limit cannot work with r-RESPA - // fix python/move implementation is missing library interface access to Repsa::step ifix = lmp->modify->find_fix("test"); if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && - !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit") - ) { + !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) { if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); From b5d2f5f2b27828a3544cb42a05ad0906044ab1f2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 09:45:01 -0400 Subject: [PATCH 199/370] address whitespace issues --- src/KIM/kim_interactions.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 9b63224f0f..f12c1774d2 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -12,11 +12,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Axel Kohlmeyer (Temple U), - Ryan S. Elliott (UMN) - Ellad B. Tadmor (UMN) - Ronald Miller (Carleton U) - Yaser Afshar (UMN) + Contributing authors: Axel Kohlmeyer (Temple U), + Ryan S. Elliott (UMN), + Ellad B. Tadmor (UMN), + Ronald Miller (Carleton U), + Yaser Afshar (UMN) ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- @@ -200,8 +200,8 @@ void KimInteractions::do_setup(int narg, char **arg) const std::string sim_field_str(sim_field); if (sim_field_str == "model-defn") { - if (first_visit<0) input->one("variable kim_update equal 0"); - else input->one("variable kim_update equal 1"); + if (first_visit < 0) input->one("variable kim_update equal 0"); + else input->one("variable kim_update equal 1"); if (domain->periodicity[0] && domain->periodicity[1] && domain->periodicity[2]) From 4c2fb7a4312501d59ab530a09a5c5054272d53bf Mon Sep 17 00:00:00 2001 From: Nick Curtis Date: Thu, 1 Apr 2021 09:43:13 -0500 Subject: [PATCH 200/370] Porting to new default platform for AMD/HIP in ROCm 4.1 --- cmake/Modules/Packages/GPU.cmake | 12 +++++++++--- doc/src/Build_extras.rst | 13 ++++++++++--- lib/gpu/Makefile.hip | 6 +++++- lib/gpu/README | 5 ++--- lib/gpu/lal_pre_cuda_hip.h | 8 ++++---- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 9aa917144b..68d74ea42e 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -218,7 +218,7 @@ elseif(GPU_API STREQUAL "HIP") if(NOT DEFINED HIP_PLATFORM) if(NOT DEFINED ENV{HIP_PLATFORM}) - set(HIP_PLATFORM "hcc" CACHE PATH "HIP Platform to be used during compilation") + set(HIP_PLATFORM "amd" CACHE PATH "HIP Platform to be used during compilation") else() set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE PATH "HIP Platform used during compilation") endif() @@ -226,7 +226,7 @@ elseif(GPU_API STREQUAL "HIP") set(ENV{HIP_PLATFORM} ${HIP_PLATFORM}) - if(HIP_PLATFORM STREQUAL "hcc") + if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd") set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture") elseif(HIP_PLATFORM STREQUAL "nvcc") find_package(CUDA REQUIRED) @@ -284,7 +284,7 @@ elseif(GPU_API STREQUAL "HIP") set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin") set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h") - if(HIP_PLATFORM STREQUAL "hcc") + if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd") configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY) if(HIP_COMPILER STREQUAL "clang") @@ -381,6 +381,12 @@ elseif(GPU_API STREQUAL "HIP") target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__) target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include) + elseif(HIP_PLATFORM STREQUAL "amd") + target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__) + target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include) + + target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__) + target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include) endif() target_link_libraries(lammps PRIVATE gpu) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 2081dc4bcd..3af018c656 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -125,7 +125,7 @@ CMake build # default is sm_50 -D HIP_ARCH=value # primary GPU hardware choice for GPU_API=hip # value depends on selected HIP_PLATFORM - # default is 'gfx906' for HIP_PLATFORM=hcc and 'sm_50' for HIP_PLATFORM=nvcc + # default is 'gfx906' for HIP_PLATFORM=amd and 'sm_50' for HIP_PLATFORM=nvcc -D HIP_USE_DEVICE_SORT=value # enables GPU sorting # value = yes (default) or no -D CUDPP_OPT=value # use GPU binning on with CUDA (should be off for modern GPUs) @@ -169,17 +169,24 @@ desired, you can set :code:`USE_STATIC_OPENCL_LOADER` to :code:`no`. If you are compiling with HIP, note that before running CMake you will have to set appropriate environment variables. Some variables such as -:code:`HCC_AMDGPU_TARGET` or :code:`CUDA_PATH` are necessary for :code:`hipcc` +:code:`HCC_AMDGPU_TARGET` (for ROCm <= 4.0) or :code:`CUDA_PATH` are necessary for :code:`hipcc` and the linker to work correctly. .. code:: bash - # AMDGPU target + # AMDGPU target (ROCm <= 4.0) export HIP_PLATFORM=hcc export HCC_AMDGPU_TARGET=gfx906 cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc .. make -j 4 +.. code:: bash + + # AMDGPU target (ROCm >= 4.1) + export HIP_PLATFORM=amd + cmake -D PKG_GPU=on -D GPU_API=HIP -D HIP_ARCH=gfx906 -D CMAKE_CXX_COMPILER=hipcc .. + make -j 4 + .. code:: bash # CUDA target (not recommended, use GPU_ARCH=cuda) diff --git a/lib/gpu/Makefile.hip b/lib/gpu/Makefile.hip index dbdef433ec..a736988596 100644 --- a/lib/gpu/Makefile.hip +++ b/lib/gpu/Makefile.hip @@ -1,6 +1,6 @@ # /* ---------------------------------------------------------------------- # Generic Linux Makefile for HIP -# - export HIP_PLATFORM=hcc (or nvcc) before execution +# - export HIP_PLATFORM=amd (or nvcc) before execution # - change HIP_ARCH for your GPU # ------------------------------------------------------------------------- */ @@ -42,6 +42,10 @@ ifeq (hcc,$(HIP_PLATFORM)) HIP_OPTS += -ffast-math # possible values: gfx803,gfx900,gfx906 HIP_ARCH = gfx906 +else ifeq (amd,$(HIP_PLATFORM)) + HIP_OPTS += -ffast-math + # possible values: gfx803,gfx900,gfx906 + HIP_ARCH = gfx906 else ifeq (nvcc,$(HIP_PLATFORM)) HIP_OPTS += --use_fast_math HIP_ARCH = -gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_32,code=[sm_32,compute_32] -gencode arch=compute_35,code=[sm_35,compute_35] \ diff --git a/lib/gpu/README b/lib/gpu/README index dfffe11b81..eb22839a59 100644 --- a/lib/gpu/README +++ b/lib/gpu/README @@ -212,8 +212,8 @@ additionally requires cub (https://nvlabs.github.io/cub). Download and extract the cub directory to lammps/lib/gpu/ or specify an appropriate path in lammps/lib/gpu/Makefile.hip. 2. In Makefile.hip it is possible to specify the target platform via -export HIP_PLATFORM=hcc or HIP_PLATFORM=nvcc as well as the target -architecture (gfx803, gfx900, gfx906 etc.) +export HIP_PLATFORM=amd (ROCm >= 4.1), HIP_PLATFORM=hcc (ROCm <= 4.0) +or HIP_PLATFORM=nvcc as well as the target architecture (gfx803, gfx900, gfx906 etc.) 3. If your MPI implementation does not support `mpicxx --showme` command, it is required to specify the corresponding MPI compiler and linker flags in lammps/lib/gpu/Makefile.hip and in lammps/src/MAKE/OPTIONS/Makefile.hip. @@ -278,4 +278,3 @@ and Brown, W.M., Masako, Y. Implementing Molecular Dynamics on Hybrid High Performance Computers - Three-Body Potentials. Computer Physics Communications. 2013. 184: p. 2785–2793. - diff --git a/lib/gpu/lal_pre_cuda_hip.h b/lib/gpu/lal_pre_cuda_hip.h index d37b4a94c2..dfb6229bed 100644 --- a/lib/gpu/lal_pre_cuda_hip.h +++ b/lib/gpu/lal_pre_cuda_hip.h @@ -30,7 +30,7 @@ // ------------------------------------------------------------------------- -#ifdef __HIP_PLATFORM_HCC__ +#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) #define CONFIG_ID 303 #define SIMD_SIZE 64 #else @@ -161,7 +161,7 @@ // KERNEL MACROS - TEXTURES // ------------------------------------------------------------------------- -#ifdef __HIP_PLATFORM_HCC__ +#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) #define _texture(name, type) __device__ type* name #define _texture_2d(name, type) __device__ type* name #else @@ -201,7 +201,7 @@ #define mu_tex mu_ #endif -#ifdef __HIP_PLATFORM_HCC__ +#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) #undef fetch4 #undef fetch @@ -266,7 +266,7 @@ typedef struct _double4 double4; #endif #endif -#if defined(CUDA_PRE_NINE) || defined(__HIP_PLATFORM_HCC__) +#if defined(CUDA_PRE_NINE) || defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) #ifdef _SINGLE_SINGLE #define shfl_down __shfl_down From e7422a6bf73f836db3bd7689a30cbaf8a96174df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 11:26:54 -0400 Subject: [PATCH 201/370] silence compiler warnings --- src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp | 5 ++--- src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 556d303d30..ce0090ce5e 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -611,7 +611,7 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, { double r2inv,r6inv,r,grij,expm2,t,erfc1,prefactor,prefactor2; double fraction,table,forcecoul,forcecoul2,forcelj,phicoul; - double rrij,expn2,erfc2,expb,ecoul,evdwl,trx,tr,ftr; + double rrij,expn2,erfc2,expb,evdwl,trx,tr,ftr; int itable; @@ -657,7 +657,7 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, prefactor2 = -force->qqrd2e * atom->q[i]*atom->q[j]/r; forcecoul2 = prefactor2 * (erfc2 + EWALD_F*rrij*expn2); forcelj = expb*lj1[itype][jtype]*r-6.0*lj4[itype][jtype]*r6inv; - } else forcelj = 0.0; + } else forcelj = forcecoul2 = 0.0; double eng = 0.0; if (rsq < cut_coulsq) { @@ -672,7 +672,6 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, } if (rsq < cut_ljsq[itype][jtype]) { - ecoul += prefactor2*erfc2*factor_coul; evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - offset[itype][jtype]; } else evdwl = 0.0; diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 47ddf8c7ad..4416a7c932 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -611,7 +611,7 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, { double r2inv,r6inv,r,grij,expm2,t,erfc1,prefactor,prefactor2; double fraction,table,forcecoul,forcecoul2,forcelj,phicoul; - double expb,rrij,expn2,erfc2,ecoul,evdwl,trx,tr,ftr; + double expb,rrij,expn2,erfc2,evdwl,trx,tr,ftr; int itable; @@ -658,7 +658,7 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, prefactor2 = -force->qqrd2e * atom->q[i]*atom->q[j]/r; forcecoul2 = prefactor2 * (erfc2 + EWALD_F*rrij*expn2); forcelj = expb*lj1[itype][jtype]*r-6.0*lj4[itype][jtype]*r6inv; - } else forcelj = 0.0; + } else forcelj = forcecoul2 = 0.0; double eng = 0.0; if (rsq < cut_coulsq) { @@ -673,7 +673,6 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, } if (rsq < cut_ljsq[itype][jtype]) { - ecoul += prefactor2*erfc2*factor_coul; evdwl = expb-lj4[itype][jtype]*r6inv-offset[itype][jtype]; } else evdwl = 0.0; From 9ac246011e2d15f594bee7aedd61527897ee394a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 11:48:54 -0400 Subject: [PATCH 202/370] remove flags and setup for multi-cutoff r-RESPA support which is missing --- .../pair_lj_switch3_coulgauss_long.cpp | 54 +++++-------------- .../pair_mm3_switch3_coulgauss_long.cpp | 50 ++++------------- 2 files changed, 22 insertions(+), 82 deletions(-) diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index ce0090ce5e..f406965e9b 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -17,21 +17,20 @@ #include "pair_lj_switch3_coulgauss_long.h" -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -49,7 +48,6 @@ using namespace MathConst; PairLJSwitch3CoulGaussLong::PairLJSwitch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - respa_enable = 1; writedata = 1; ftable = nullptr; qdist = 0.0; @@ -170,8 +168,8 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; - } - else { + prefactor2 = 0.0; + } else { rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); erfc2 = erfc(rrij); @@ -333,42 +331,19 @@ void PairLJSwitch3CoulGaussLong::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style lj/switch3/coulgauss/long requires atom attribute q"); - // request regular or rRESPA neighbor list - - int irequest; - int respa = 0; - - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { - if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; - if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - } - - irequest = neighbor->request(this,instance_me); - - if (respa >= 1) { - neighbor->requests[irequest]->respaouter = 1; - neighbor->requests[irequest]->respainner = 1; - } - if (respa == 2) neighbor->requests[irequest]->respamiddle = 1; - cut_coulsq = cut_coul * cut_coul; - // set rRESPA cutoffs - - if (strstr(update->integrate_style,"respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = nullptr; - // insure use of KSpace long-range solver, set g_ewald if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; + neighbor->request(this,instance_me); + // setup force tables - if (ncoultablebits) init_tables(cut_coul,cut_respa); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -413,11 +388,6 @@ double PairLJSwitch3CoulGaussLong::init_one(int i, int j) lj4[j][i] = lj4[i][j]; offset[j][i] = offset[i][j]; - // check interior rRESPA cutoff - - if (cut_respa && MIN(cut_lj[i][j],cut_coul) < cut_respa[3]) - error->all(FLERR,"Pair cutoff < Respa interior cutoff"); - // compute I,J contribution to long-range tail correction // count total # of atoms of type I and J via Allreduce diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 4416a7c932..64ea669a30 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -17,21 +17,20 @@ #include "pair_mm3_switch3_coulgauss_long.h" -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -49,7 +48,6 @@ using namespace MathConst; PairMM3Switch3CoulGaussLong::PairMM3Switch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - respa_enable = 1; writedata = 1; ftable = nullptr; qdist = 0.0; @@ -335,42 +333,19 @@ void PairMM3Switch3CoulGaussLong::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style mm3/switch3/coulgauss/long requires atom attribute q"); - // request regular or rRESPA neighbor list - - int irequest; - int respa = 0; - - if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { - if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; - if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - } - - irequest = neighbor->request(this,instance_me); - - if (respa >= 1) { - neighbor->requests[irequest]->respaouter = 1; - neighbor->requests[irequest]->respainner = 1; - } - if (respa == 2) neighbor->requests[irequest]->respamiddle = 1; - cut_coulsq = cut_coul * cut_coul; - // set rRESPA cutoffs - - if (strstr(update->integrate_style,"respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = nullptr; - // insure use of KSpace long-range solver, set g_ewald if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; + irequest = neighbor->request(this,instance_me); + // setup force tables - if (ncoultablebits) init_tables(cut_coul,cut_respa); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -414,11 +389,6 @@ double PairMM3Switch3CoulGaussLong::init_one(int i, int j) lj4[j][i] = lj4[i][j]; offset[j][i] = offset[i][j]; - // check interior rRESPA cutoff - - if (cut_respa && MIN(cut_lj[i][j],cut_coul) < cut_respa[3]) - error->all(FLERR,"Pair cutoff < Respa interior cutoff"); - // compute I,J contribution to long-range tail correction // count total # of atoms of type I and J via Allreduce From b5ef98cc22ea023579351a3c7fc2f1210f1801e3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 12:42:07 -0400 Subject: [PATCH 203/370] consolidate the documentation for lj/switch3/coulgauss/long and mm3/switch3/coulgauss/long into a single file --- doc/src/Commands_pair.rst | 2 +- doc/src/Packages_details.rst | 2 +- doc/src/pair_lj_switch3_coulgauss_long.rst | 55 +++++++++- doc/src/pair_mm3_switch3_coulgauss_long.rst | 109 -------------------- doc/src/pair_style.rst | 2 +- 5 files changed, 53 insertions(+), 117 deletions(-) delete mode 100644 doc/src/pair_mm3_switch3_coulgauss_long.rst diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index da403aa87e..080f3eff20 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -187,7 +187,7 @@ OPT. * :doc:`mgpt ` * :doc:`mie/cut (g) ` * :doc:`mliap ` - * :doc:`mm3/switch3/coulgauss/long ` + * :doc:`mm3/switch3/coulgauss/long ` * :doc:`momb ` * :doc:`morse (gkot) ` * :doc:`morse/smooth/linear (o) ` diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index e858593c4c..173c515fc2 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -2456,6 +2456,6 @@ which discuss the `QuickFF `_ methodology. * :doc:`bond_style mm3 ` * :doc:`improper_style distharm ` * :doc:`improper_style sqdistharm ` -* :doc:`pair_style mm3/switch3/coulgauss/long ` +* :doc:`pair_style mm3/switch3/coulgauss/long ` * :doc:`pair_style lj/switch3/coulgauss/long ` * examples/USER/yaff diff --git a/doc/src/pair_lj_switch3_coulgauss_long.rst b/doc/src/pair_lj_switch3_coulgauss_long.rst index f791b9836b..6b918c1071 100644 --- a/doc/src/pair_lj_switch3_coulgauss_long.rst +++ b/doc/src/pair_lj_switch3_coulgauss_long.rst @@ -1,8 +1,12 @@ .. index:: pair_style lj/switch3/coulgauss/long +.. index:: pair_style mm3/switch3/coulgauss/long pair_style lj/switch3/coulgauss/long command ============================================ +pair_style mm3/switch3/coulgauss/long command +============================================= + Syntax """""" @@ -10,7 +14,7 @@ Syntax pair_style style args -* style = *lj/switch3/coulgauss/long* +* style = *lj/switch3/coulgauss/long* or *mm3/switch3/coulgauss/long* * args = list of arguments for a particular style .. parsed-literal:: @@ -20,6 +24,11 @@ Syntax cutoff2 = global cutoff for Coulombic (optional) (distance units) width = width parameter of the smoothing function (distance units) + *mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width + cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units) + cutoff2 = global cutoff for Coulombic (optional) (distance units) + width = width parameter of the smoothing function (distance units) + Examples """""""" @@ -31,6 +40,12 @@ Examples pair_style lj/switch3/coulgauss/long 12.0 10.0 3.0 pair_coeff 1 0.2 2.5 1.2 + pair_style mm3/switch3/coulgauss/long 12.0 3.0 + pair_coeff 1 0.2 2.5 1.2 + + pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0 + pair_coeff 1 0.2 2.5 1.2 + Description """"""""""" @@ -41,8 +56,17 @@ vdW potential E = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12}-\left(\frac{\sigma}{r}\right)^{6} \right] -, which goes smoothly to zero at the cutoff r_c as defined -by the switching function +The *mm3/switch3/coulgauss/long* style evaluates the MM3 +vdW potential :ref:`(Allinger) ` + +.. math:: + + E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\ + r_{v,ij} & = r_{v,i} + r_{v,j} \\ + \epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j} + +Both potentials go smoothly to zero at the cutoff r_c as defined by the +switching function .. math:: @@ -85,14 +109,35 @@ commands: Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" +For atom type pairs I,J and I != J, the epsilon and sigma coefficients +and cutoff distance for all of the lj/long pair styles can be mixed. +The default mix value is *geometric*\ . See the "pair_modify" command +for details. + Shifting the potential energy is not necessary because the switching function ensures that the potential is zero at the cut-off. +These pair styles support the :doc:`pair_modify ` table and +options since they can tabulate the short-range portion of the +long-range Coulombic interactions. + +Thes pair styles do not support the :doc:`pair_modify ` +tail option for adding a long-range tail correction to the +Lennard-Jones portion of the energy and pressure. + +These pair styles write their information to :doc:`binary restart files `, so pair_style and pair_coeff commands do not need +to be specified in an input script that reads a restart file. + +These pair styles can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. They do not support the +*inner*\ , *middle*\ , *outer* keywords. + Restrictions """""""""""" -These styles are part of the USER-YAFF package. They are only -enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. +These styles are part of the USER-YAFF package. They are only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` doc page for more info. Related commands """""""""""""""" diff --git a/doc/src/pair_mm3_switch3_coulgauss_long.rst b/doc/src/pair_mm3_switch3_coulgauss_long.rst deleted file mode 100644 index 798df0bf7a..0000000000 --- a/doc/src/pair_mm3_switch3_coulgauss_long.rst +++ /dev/null @@ -1,109 +0,0 @@ -.. index:: pair_style mm3/switch3/coulgauss/long - -pair_style mm3/switch3/coulgauss/long command -============================================= - -Syntax -"""""" - -.. code-block:: LAMMPS - - pair_style style args - -* style = *mm3/switch3/coulgauss/long* -* args = list of arguments for a particular style - -.. parsed-literal:: - - *mm3/switch3/coulgauss/long* args = cutoff (cutoff2) width - cutoff = global cutoff for MM3 (and Coulombic if only 1 arg) (distance units) - cutoff2 = global cutoff for Coulombic (optional) (distance units) - width = width parameter of the smoothing function (distance units) - -Examples -"""""""" - -.. code-block:: LAMMPS - - pair_style mm3/switch3/coulgauss/long 12.0 3.0 - pair_coeff 1 0.2 2.5 1.2 - - pair_style mm3/switch3/coulgauss/long 12.0 10.0 3.0 - pair_coeff 1 0.2 2.5 1.2 - -Description -""""""""""" - -The *mm3/switch3/coulgauss/long* style evaluates the MM3 -vdW potential :ref:`(Allinger) ` - -.. math:: - - E & = \epsilon_{ij} \left[ -2.25 \left(\frac{r_{v,ij}}{r_{ij}}\right)^6 + 1.84(10)^5 \exp\left[-12.0 r_{ij}/r_{v,ij}\right] \right] S_3(r_{ij}) \\ - r_{v,ij} & = r_{v,i} + r_{v,j} \\ - \epsilon_{ij} & = \sqrt{\epsilon_i \epsilon_j} - -, which goes smoothly to zero at the cutoff r_c as defined -by the switching function - -.. math:: - - S_3(r) = \left\lbrace \begin{array}{ll} - 1 & \quad\mathrm{if}\quad r < r_\mathrm{c} - w \\ - 3x^2 - 2x^3 & \quad\mathrm{if}\quad r < r_\mathrm{c} \quad\mathrm{with\quad} x=\frac{r_\mathrm{c} - r}{w} \\ - 0 & \quad\mathrm{if}\quad r >= r_\mathrm{c} - \end{array} \right. - -where w is the width defined in the arguments. This potential -is combined with Coulomb interaction between Gaussian charge densities: - -.. math:: - - E = \frac{q_i q_j \mathrm{erf}\left( r/\sqrt{\gamma_1^2+\gamma_2^2} \right) }{\epsilon r_{ij}} - -where :math:`q_i` and :math:`q_j` are the charges on the 2 atoms, -epsilon is the dielectric constant which can be set by the -:doc:`dielectric ` command, ::math:`\gamma_i` and -:math:`\gamma_j` are the widths of the Gaussian charge distribution and -erf() is the error-function. This style has to be used in conjunction -with the :doc:`kspace_style ` command - -If one cutoff is specified it is used for both the vdW and Coulomb -terms. If two cutoffs are specified, the first is used as the cutoff -for the vdW terms, and the second is the cutoff for the Coulombic term. - -The following coefficients must be defined for each pair of atoms -types via the :doc:`pair_coeff ` command as in the examples -above, or in the data file or restart files read by the -:doc:`read_data ` or :doc:`read_restart ` -commands: - -* :math:`\epsilon` (energy) -* :math:`r_v` (distance) -* :math:`\gamma` (distance) - ----------- - -Mixing, shift, table, tail correction, restart, rRESPA info -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -Mixing rules are fixed for this style as defined above. - -Shifting the potential energy is not necessary because the switching -function ensures that the potential is zero at the cut-off. - -Restrictions -"""""""""""" - -These styles are part of the USER-YAFF package. They are only -enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. - -Related commands -"""""""""""""""" - -:doc:`pair_coeff ` - -Default -""""""" - -none diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index fc66b778a1..89530895c4 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -250,7 +250,7 @@ accelerated styles exist. * :doc:`mgpt ` - simplified model generalized pseudopotential theory (MGPT) potential * :doc:`mesont/tpm ` - nanotubes mesoscopic force field * :doc:`mie/cut ` - Mie potential -* :doc:`mm3/switch3/coulgauss/long ` - smoothed MM3 vdW potential with Gaussian electrostatics +* :doc:`mm3/switch3/coulgauss/long ` - smoothed MM3 vdW potential with Gaussian electrostatics * :doc:`momb ` - Many-Body Metal-Organic (MOMB) force field * :doc:`morse ` - Morse potential * :doc:`morse/smooth/linear ` - linear smoothed Morse potential From 994ee59fd55200b74b80f1738f53b295bf4ee9ad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 12:42:48 -0400 Subject: [PATCH 204/370] correct single() functions for USER-YAFF pair styles to be consistent with compute() --- .../pair_lj_switch3_coulgauss_long.cpp | 37 ++++++++------- .../pair_mm3_switch3_coulgauss_long.cpp | 46 ++++++++++--------- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index f406965e9b..c6bc65c196 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -580,8 +580,8 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, double &fforce) { double r2inv,r6inv,r,grij,expm2,t,erfc1,prefactor,prefactor2; - double fraction,table,forcecoul,forcecoul2,forcelj,phicoul; - double rrij,expn2,erfc2,expb,evdwl,trx,tr,ftr; + double fraction,table,forcecoul,forcecoul2,forcelj; + double rrij,expn2,erfc2,expb,ecoul,evdwl,trx,tr,ftr; int itable; @@ -613,41 +613,41 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, } else forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - r = sqrt(rsq); r6inv = r2inv*r2inv*r2inv; - rrij = lj2[itype][jtype] * r; - if (rrij==0.0) { + forcelj = r6inv*(12.0*lj3[itype][jtype]*r6inv-6.0*lj4[itype][jtype]); + if (lj2[itype][jtype] == 0.0) { expn2 = 0.0; erfc2 = 0.0; - } - else { + forcecoul2 = 0.0; + } else { + r = sqrt(rsq); + rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); erfc2 = erfc(rrij); + prefactor2 = -force->qqrd2e*atom->q[i]*atom->q[j]/r; + forcecoul2 = prefactor2*(erfc2+EWALD_F*rrij*expn2); } - prefactor2 = -force->qqrd2e * atom->q[i]*atom->q[j]/r; - forcecoul2 = prefactor2 * (erfc2 + EWALD_F*rrij*expn2); - forcelj = expb*lj1[itype][jtype]*r-6.0*lj4[itype][jtype]*r6inv; - } else forcelj = forcecoul2 = 0.0; + } else forcelj = 0.0; - double eng = 0.0; + evdwl = ecoul = 0.0; if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) - phicoul = prefactor*erfc1; + ecoul = prefactor*erfc1; else { table = etable[itable] + fraction*detable[itable]; - phicoul = atom->q[i]*atom->q[j] * table; + ecoul = atom->q[i]*atom->q[j] * table; } - if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; - eng += phicoul; + if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } if (rsq < cut_ljsq[itype][jtype]) { + ecoul += prefactor2*erfc2*factor_coul; evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - offset[itype][jtype]; } else evdwl = 0.0; // Truncation, see Yaff Switch3 - if (truncw>0) { + if (truncw > 0) { if (rsq < cut_ljsq[itype][jtype]) { if (r>cut_lj[itype][jtype]-truncw) { trx = (cut_lj[itype][jtype]-r)*truncwi; @@ -658,10 +658,9 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, } } } - eng += evdwl*factor_lj; fforce = (forcecoul + factor_coul*forcecoul2 + factor_lj*forcelj) * r2inv; - return eng; + return evdwl*factor_lj + ecoul; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 64ea669a30..e91ea5c695 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -171,8 +171,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag) expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; - } - else { + } else { rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); erfc2 = erfc(rrij); @@ -341,7 +340,7 @@ void PairMM3Switch3CoulGaussLong::init_style() error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; - irequest = neighbor->request(this,instance_me); + neighbor->request(this,instance_me); // setup force tables @@ -580,8 +579,8 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, double &fforce) { double r2inv,r6inv,r,grij,expm2,t,erfc1,prefactor,prefactor2; - double fraction,table,forcecoul,forcecoul2,forcelj,phicoul; - double expb,rrij,expn2,erfc2,evdwl,trx,tr,ftr; + double fraction,table,forcecoul,forcecoul2,forcelj; + double expb,rrij,expn2,erfc2,evdwl,ecoul,trx,tr,ftr; int itable; @@ -614,40 +613,43 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, if (rsq < cut_ljsq[itype][jtype]) { r = sqrt(rsq); - r6inv = r2inv*r2inv*r2inv; expb = lj3[itype][jtype]*exp(-lj1[itype][jtype]*r); - rrij = lj2[itype][jtype] * r; - if (rrij==0.0) { + forcelj = expb*lj1[itype][jtype]*r; + r6inv = r2inv*r2inv*r2inv; + forcelj -= 6.0*lj4[itype][jtype]*r6inv; + + if (lj2[itype][jtype] == 0.0) { expn2 = 0.0; erfc2 = 0.0; - } - else { + forcecoul2 = 0.0; + prefactor2 = 0.0; + } else { + rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); erfc2 = erfc(rrij); + prefactor2 = -force->qqrd2e * atom->q[i]*atom->q[j]/r; + forcecoul2 = prefactor2 * (erfc2 + EWALD_F*rrij*expn2); } - prefactor2 = -force->qqrd2e * atom->q[i]*atom->q[j]/r; - forcecoul2 = prefactor2 * (erfc2 + EWALD_F*rrij*expn2); - forcelj = expb*lj1[itype][jtype]*r-6.0*lj4[itype][jtype]*r6inv; - } else forcelj = forcecoul2 = 0.0; + } else expb = forcelj = 0.0; - double eng = 0.0; + evdwl = ecoul = 0.0; if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) - phicoul = prefactor*erfc1; + ecoul = prefactor*erfc1; else { table = etable[itable] + fraction*detable[itable]; - phicoul = atom->q[i]*atom->q[j] * table; + ecoul = atom->q[i]*atom->q[j] * table; } - if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; - eng += phicoul; + if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } if (rsq < cut_ljsq[itype][jtype]) { + ecoul += prefactor2*erfc2*factor_coul; evdwl = expb-lj4[itype][jtype]*r6inv-offset[itype][jtype]; } else evdwl = 0.0; // Truncation, see Yaff Switch3 - if (truncw>0) { + if (truncw > 0) { if (rsq < cut_ljsq[itype][jtype]) { if (r>cut_lj[itype][jtype]-truncw) { trx = (cut_lj[itype][jtype]-r)*truncwi; @@ -658,10 +660,10 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, } } } - eng += evdwl*factor_lj; fforce = (forcecoul + factor_coul*forcecoul2 + factor_lj*forcelj) * r2inv; - return eng; + return ecoul + evdwl*factor_lj; +; } /* ---------------------------------------------------------------------- */ From c3eb52f46ab37f77748c35620e1052130ab96b2e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 1 Apr 2021 12:43:24 -0400 Subject: [PATCH 205/370] add force tests for USER-YAFF pair styles --- .../mol-pair-lj_switch3_coulgauss_long.yaml | 99 +++++++++++++++++++ .../mol-pair-lj_switch3_coulgauss_table.yaml | 99 +++++++++++++++++++ .../mol-pair-mm3_switch3_coulgauss_long.yaml | 99 +++++++++++++++++++ .../mol-pair-mm3_switch3_coulgauss_table.yaml | 99 +++++++++++++++++++ 4 files changed, 396 insertions(+) create mode 100644 unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_long.yaml create mode 100644 unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_table.yaml create mode 100644 unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_long.yaml create mode 100644 unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_table.yaml diff --git a/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_long.yaml b/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_long.yaml new file mode 100644 index 0000000000..e14044f9a0 --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_long.yaml @@ -0,0 +1,99 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Apr 1 12:05:31 202 +epsilon: 7.5e-14 +prerequisites: ! | + atom full + pair lj/switch3/coulgauss/long + kspace ewald +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic + pair_modify table 0 + kspace_style ewald 1.0e-6 + kspace_modify gewald 0.3 + kspace_modify compute no +input_file: in.fourmol +pair_style: lj/switch3/coulgauss/long 8.0 2.0 +pair_coeff: ! | + 1 1 0.02 2.5 1.0 + 2 2 0.005 1.0 0.7 + 2 4 0.005 0.5 0.7 + 3 3 0.02 3.2 1.3 + 4 4 0.015 3.1 1.2 + 5 5 0.015 3.1 1.2 +extract: ! | + epsilon 2 + sigma 2 + gamma 2 + cut_coul 0 +natoms: 29 +init_vdwl: 749.239201392283 +init_coul: 262.63137433058 +init_stress: ! |2- + 2.1905445805730942e+03 2.1830788072793757e+03 4.6581902800701146e+03 -7.4288115309776367e+02 2.6990012828168151e+01 6.7591505796334252e+02 +init_forces: ! |2 + 1 -2.2440985285095003e+01 2.6839510386427128e+02 3.3548778459373403e+02 + 2 1.6014525975608947e+02 1.2916401608538342e+02 -1.9007855889522560e+02 + 3 -1.3523588460187835e+02 -3.8701969631758487e+02 -1.4563951593124975e+02 + 4 -8.1626375608064503e+00 2.0129840978934559e+00 -5.9838237090267477e+00 + 5 -3.2509810426586694e+00 -3.8006496952690405e+00 1.2238094761779506e+01 + 6 -8.3272100467340556e+02 9.6240884847023358e+02 1.1512799880160530e+03 + 7 5.9109223946129624e+01 -3.3613343492781996e+02 -1.7166010182633938e+03 + 8 1.4374025374023395e+02 -1.0687979059788748e+02 3.9897084761513247e+02 + 9 8.0822098286061347e+01 8.1693084015402164e+01 3.5446319638063176e+02 + 10 5.3122611725677234e+02 -6.1057993090036803e+02 -1.8379536842135653e+02 + 11 -3.0599394771020791e+00 -5.2185583295434022e+00 -1.0179624348800495e+01 + 12 1.9237456341967800e+01 1.0181865500248987e+01 -6.1597937746835436e+00 + 13 8.3909903723672699e+00 -3.3718280449484173e+00 -3.3038121588715319e-01 + 14 -4.1292661630995928e+00 9.9336707464018092e-01 -9.3350058002796388e+00 + 15 4.2168785095757555e-01 8.7977955328786113e+00 2.0699990715180956e+00 + 16 4.6411046171725997e+02 -3.3264571918035432e+02 -1.1912223271773271e+03 + 17 -4.5697820722395699e+02 3.2194358869766086e+02 1.2030903913181610e+03 + 18 -2.9720972086277636e-01 1.7565528490258597e+00 2.4294604263813859e+00 + 19 -2.6658339749427125e+00 -3.5543359860963246e+00 -7.0028176604540848e-01 + 20 2.3030703223874878e+00 1.6788085961460804e+00 8.8715814688464914e-02 + 21 -7.2491063430524989e+01 -8.0704358691908013e+01 2.2713112476019884e+02 + 22 -1.1047017798074540e+02 -2.7622195109041627e+01 -1.7106972908159221e+02 + 23 1.8254515612066885e+02 1.0874225091685935e+02 -5.5558584096022528e+01 + 24 3.7139490938880684e+01 -2.1182968679989389e+02 1.1239472278345924e+02 + 25 -1.5173442669154963e+02 2.2482896227152501e+01 -1.2683235954885029e+02 + 26 1.1404997762743471e+02 1.8910942097520967e+02 1.3865307057956501e+01 + 27 5.1263700969024825e+01 -2.2708329767472884e+02 9.0733209359745530e+01 + 28 -1.8280634435959598e+02 7.6676771027308675e+01 -1.2320543486529729e+02 + 29 1.3193901693998819e+02 1.5040612832512986e+02 3.2448964935598738e+01 +run_vdwl: 719.395943067584 +run_coul: 262.577357625246 +run_stress: ! |2- + 2.1439469903049130e+03 2.1388099416476502e+03 4.3901771762143671e+03 -7.2215136136852652e+02 4.3981220891989977e+01 6.3726346095247902e+02 +run_forces: ! |2 + 1 -1.9342111296614632e+01 2.6536048036936916e+02 3.2628113020689460e+02 + 2 1.5478381002242270e+02 1.2483653341336152e+02 -1.8332859341112297e+02 + 3 -1.3348486669886435e+02 -3.7921582819403795e+02 -1.4287155661999228e+02 + 4 -8.1288301070929982e+00 2.0080316198654273e+00 -5.9722562656827858e+00 + 5 -3.2351829753164845e+00 -3.7719427860922665e+00 1.2190138978995325e+01 + 6 -8.0768848311420356e+02 9.2016491680294996e+02 1.0274658369925041e+03 + 7 5.6698550383493917e+01 -3.1122940570534678e+02 -1.5733988978986536e+03 + 8 1.3387241605110836e+02 -9.8275697925936129e+01 3.8773060932891792e+02 + 9 7.8389121495727082e+01 7.8858365413426057e+01 3.4347185476758511e+02 + 10 5.2128680605857573e+02 -5.9933944295277558e+02 -1.8148565911030960e+02 + 11 -3.0663895518130402e+00 -5.1690166614639725e+00 -1.0127704831021171e+01 + 12 1.9218490979542565e+01 1.0175625089829989e+01 -6.2912885237383334e+00 + 13 8.3443094714464650e+00 -3.3361880724739623e+00 -3.2980152351128239e-01 + 14 -4.0925411684752673e+00 9.7261482089301243e-01 -9.2160488176079518e+00 + 15 4.0396689631175081e-01 8.8125643989717197e+00 2.0895512608739368e+00 + 16 4.3558458306026108e+02 -3.1347365130054965e+02 -1.1153604445579856e+03 + 17 -4.2831293616595980e+02 3.0256033131579363e+02 1.1274168049543377e+03 + 18 -3.0240289244505925e-01 1.7692205043557692e+00 2.4421829464376694e+00 + 19 -2.6549690010635465e+00 -3.5598277436632562e+00 -6.9536112330149602e-01 + 20 2.2933819335528716e+00 1.6713255394851048e+00 7.9301163390346582e-02 + 21 -7.1399138479900728e+01 -7.8808617837125738e+01 2.2288288096726535e+02 + 22 -1.0872540509179575e+02 -2.7364445523270156e+01 -1.6789056923341974e+02 + 23 1.7970587875020576e+02 1.0659054948727307e+02 -5.4485902397030543e+01 + 24 3.8719492068991073e+01 -2.1018768384060851e+02 1.1276643199107306e+02 + 25 -1.5234502496218383e+02 2.2328379592897981e+01 -1.2741458364942766e+02 + 26 1.1307896673604499e+02 1.8762340967163530e+02 1.4075792400442774e+01 + 27 5.0253213702344411e+01 -2.2292638222448988e+02 8.8474597952361989e+01 + 28 -1.7928804250876811e+02 7.5155358290636585e+01 -1.2061205300179266e+02 + 29 1.2943333640446872e+02 1.4777042443708973e+02 3.2113607053518280e+01 +... diff --git a/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_table.yaml b/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_table.yaml new file mode 100644 index 0000000000..973ed7051e --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-lj_switch3_coulgauss_table.yaml @@ -0,0 +1,99 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Apr 1 12:05:32 202 +epsilon: 5e-13 +prerequisites: ! | + atom full + pair lj/switch3/coulgauss/long + kspace ewald +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic + pair_modify table 16 + kspace_style ewald 1.0e-6 + kspace_modify gewald 0.3 + kspace_modify compute no +input_file: in.fourmol +pair_style: lj/switch3/coulgauss/long 8.0 2.0 +pair_coeff: ! | + 1 1 0.02 2.5 1.0 + 2 2 0.005 1.0 0.7 + 2 4 0.005 0.5 0.7 + 3 3 0.02 3.2 1.3 + 4 4 0.015 3.1 1.2 + 5 5 0.015 3.1 1.2 +extract: ! | + epsilon 2 + sigma 2 + gamma 2 + cut_coul 0 +natoms: 29 +init_vdwl: 749.239201392283 +init_coul: 262.631410551483 +init_stress: ! |2- + 2.1905446008358158e+03 2.1830788130354440e+03 4.6581902934947393e+03 -7.4288114980317005e+02 2.6990022323315568e+01 6.7591506205400140e+02 +init_forces: ! |2 + 1 -2.2440986789065228e+01 2.6839510344190973e+02 3.3548778280211798e+02 + 2 1.6014525925595575e+02 1.2916401535280644e+02 -1.9007855755707530e+02 + 3 -1.3523588449321372e+02 -3.8701969643290909e+02 -1.4563951605577458e+02 + 4 -8.1626375642225835e+00 2.0129845605828729e+00 -5.9838235187927911e+00 + 5 -3.2509808748500135e+00 -3.8006487477814463e+00 1.2238094996907998e+01 + 6 -8.3272100512926681e+02 9.6240884941333036e+02 1.1512799862203640e+03 + 7 5.9109223148516158e+01 -3.3613343497406407e+02 -1.7166010203250210e+03 + 8 1.4374025301066052e+02 -1.0687979086260394e+02 3.9897084965667705e+02 + 9 8.0822100084645626e+01 8.1693083424499093e+01 3.5446319827945621e+02 + 10 5.3122611737361080e+02 -6.1057993046376589e+02 -1.8379536902952145e+02 + 11 -3.0599395914956227e+00 -5.2185576282473036e+00 -1.0179624244755713e+01 + 12 1.9237456510724858e+01 1.0181865558167726e+01 -6.1597946782797850e+00 + 13 8.3909904522091470e+00 -3.3718281778746344e+00 -3.3038108557256562e-01 + 14 -4.1292663075103953e+00 9.9336695410995779e-01 -9.3350056582436061e+00 + 15 4.2168780003223016e-01 8.7977952410479840e+00 2.0699996667940117e+00 + 16 4.6411046291217519e+02 -3.3264572037764498e+02 -1.1912223268528312e+03 + 17 -4.5697820745668372e+02 3.2194358895792664e+02 1.2030903912557251e+03 + 18 -2.9720916995537250e-01 1.7565528041526848e+00 2.4294595600637425e+00 + 19 -2.6658359770891962e+00 -3.5543374045750902e+00 -7.0028189781643846e-01 + 20 2.3030721439983917e+00 1.6788097920639553e+00 8.8716903513438167e-02 + 21 -7.2491063802446362e+01 -8.0704358127081790e+01 2.2713112533044830e+02 + 22 -1.1047018068190837e+02 -2.7622196765220032e+01 -1.7106973071745716e+02 + 23 1.8254515931328083e+02 1.0874225209184637e+02 -5.5558583211276250e+01 + 24 3.7139491235265282e+01 -2.1182968640787311e+02 1.1239472233677957e+02 + 25 -1.5173442866720330e+02 2.2482894929853938e+01 -1.2683236039424271e+02 + 26 1.1404997991795076e+02 1.8910942242955088e+02 1.3865308691923977e+01 + 27 5.1263700853661504e+01 -2.2708329750901160e+02 9.0733209165823396e+01 + 28 -1.8280634707113845e+02 7.6676770092406045e+01 -1.2320543608135794e+02 + 29 1.3193901956336219e+02 1.5040612883439849e+02 3.2448966441423750e+01 +run_vdwl: 719.3959430344 +run_coul: 262.577390407319 +run_stress: ! |2- + 2.1439470065972137e+03 2.1388099427650550e+03 4.3901771876285757e+03 -7.2215135528838152e+02 4.3981227731157169e+01 6.3726346514781233e+02 +run_forces: ! |2 + 1 -1.9342112777764044e+01 2.6536047986408227e+02 3.2628112882188066e+02 + 2 1.5478380987853197e+02 1.2483653254176838e+02 -1.8332859191802055e+02 + 3 -1.3348486656752218e+02 -3.7921582829992821e+02 -1.4287155674732023e+02 + 4 -8.1288300595478145e+00 2.0080320707984289e+00 -5.9722560784187575e+00 + 5 -3.2351826602132863e+00 -3.7719418655198664e+00 1.2190139134122882e+01 + 6 -8.0768848338103430e+02 9.2016491733383600e+02 1.0274658351618857e+03 + 7 5.6698550307468736e+01 -3.1122940556308856e+02 -1.5733989002062301e+03 + 8 1.3387241574644310e+02 -9.8275698627583083e+01 3.8773061254696188e+02 + 9 7.8389123166777367e+01 7.8858364582844956e+01 3.4347185682031875e+02 + 10 5.2128680625044581e+02 -5.9933944258147972e+02 -1.8148565985727146e+02 + 11 -3.0663897393660062e+00 -5.1690158790311020e+00 -1.0127704822035417e+01 + 12 1.9218491178640956e+01 1.0175625315025894e+01 -6.2912900026938683e+00 + 13 8.3443096072761875e+00 -3.3361882591914980e+00 -3.2980142478029900e-01 + 14 -4.0925412507338894e+00 9.7261457606495283e-01 -9.2160486509597419e+00 + 15 4.0396659601733209e-01 8.8125640821770475e+00 2.0895518255992327e+00 + 16 4.3558458334132916e+02 -3.1347365174745744e+02 -1.1153604446371062e+03 + 17 -4.2831293628122177e+02 3.0256033223226825e+02 1.1274168046352991e+03 + 18 -3.0240272912362937e-01 1.7692204105371876e+00 2.4421821828695935e+00 + 19 -2.6549708608109603e+00 -3.5598291696654596e+00 -6.9536106786938656e-01 + 20 2.2933837220124476e+00 1.6713266856927325e+00 7.9302040608548133e-02 + 21 -7.1399139014949796e+01 -7.8808617040884513e+01 2.2288288163778361e+02 + 22 -1.0872540740988465e+02 -2.7364447046562592e+01 -1.6789057060588300e+02 + 23 1.7970588157677136e+02 1.0659055047797085e+02 -5.4485901626092641e+01 + 24 3.8719492028250940e+01 -2.1018768371930031e+02 1.1276643093423978e+02 + 25 -1.5234502685835807e+02 2.2328378412375191e+01 -1.2741458439419397e+02 + 26 1.1307896905891306e+02 1.8762341114219453e+02 1.4075794088855011e+01 + 27 5.0253213439313768e+01 -2.2292638208302930e+02 8.8474597770747309e+01 + 28 -1.7928804514846018e+02 7.5155357340410589e+01 -1.2061205423392185e+02 + 29 1.2943333884079848e+02 1.4777042481467481e+02 3.2113608671625300e+01 +... diff --git a/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_long.yaml b/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_long.yaml new file mode 100644 index 0000000000..d74aba7143 --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_long.yaml @@ -0,0 +1,99 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Apr 1 12:40:49 202 +epsilon: 7.5e-14 +prerequisites: ! | + atom full + pair mm3/switch3/coulgauss/long + kspace ewald +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic + pair_modify table 0 + kspace_style ewald 1.0e-6 + kspace_modify gewald 0.3 + kspace_modify compute no +input_file: in.fourmol +pair_style: mm3/switch3/coulgauss/long 8.0 2.0 +pair_coeff: ! | + 1 1 0.02 2.5 1.0 + 2 2 0.005 1.0 0.7 + 2 4 0.005 0.5 0.7 + 3 3 0.02 3.2 1.3 + 4 4 0.015 3.1 1.2 + 5 5 0.015 3.1 1.2 +extract: ! | + epsilon 2 + sigma 2 + gamma 2 + cut_coul 0 +natoms: 29 +init_vdwl: 38.1287498820824 +init_coul: 262.63137433058 +init_stress: ! |- + -9.1891442318066098e+01 -1.3287972066289731e+02 -3.2601698046780012e+02 3.0074181349476991e+01 -4.6650805915669622e+00 -8.2199038214680613e+01 +init_forces: ! |2 + 1 2.0409906927303840e+00 -1.8543276343677643e+01 -3.5869856577020748e+01 + 2 -1.8468129335667530e+01 -1.7027855689261912e+01 2.0713359151753043e+01 + 3 1.0001881298085964e+01 5.9235891506906007e+01 2.4372336208613245e+01 + 4 -4.5761624241138597e+00 -9.8945397153998949e-01 -3.3785801701857485e+00 + 5 -3.6934402656902114e+00 -4.0696606560869748e+00 3.8826787260480975e+00 + 6 7.6754814037515942e+01 -9.5808744511121716e+01 -9.3227045949147495e+01 + 7 -2.1177649780159676e+01 2.8793163914062454e+01 1.2529350681895039e+02 + 8 -2.1450096176689623e+01 1.0356391751725083e+01 -2.8955420955058667e+01 + 9 -8.2497939748793154e+00 -1.3077027567751550e+01 -3.6173491871315754e+01 + 10 -5.3511691146997535e+01 6.0900974965221437e+01 1.8391821307129032e+01 + 11 -1.3170240621133327e+00 -3.2364695484525727e+00 -4.4029422841407655e+00 + 12 2.5797191091185894e+01 -7.5496414014335278e-01 -2.6346161145571760e+00 + 13 3.3781782842360095e+00 -7.7635850626588521e-01 -6.1835215466770443e-01 + 14 -2.5357285341105120e-02 9.3547318559063564e-01 -4.9468893910982210e+00 + 15 4.2707742121454375e+00 4.7941154645598454e+00 -1.2015244265327498e+00 + 16 -3.6573746563916743e+01 1.8565541369425805e+01 1.1446966549457964e+02 + 17 4.3913383545862132e+01 -3.3849656320211224e+01 -9.5337593733730870e+01 + 18 2.6570097579579910e+00 6.2826343323709564e+00 -1.0356872257658154e+00 + 19 -2.6993382209993975e+00 -3.5969189205658059e+00 -6.8072388138355555e-01 + 20 2.3243788182239480e+00 1.6918048474772680e+00 1.0886178998340870e-01 + 21 8.8572294982176594e+00 1.1602893199785523e+01 -3.0057630309158139e+01 + 22 1.2429506519553414e+01 2.1605554971279792e+00 2.1808499086967526e+01 + 23 -2.1432721217228789e+01 -1.3678275101206289e+01 8.4081109687741140e+00 + 24 -3.9016922943010681e+00 2.9074424568745080e+01 -1.3996421656066522e+01 + 25 1.7462841196067998e+01 -4.6818042132561875e+00 1.5548837958928004e+01 + 26 -1.2984517260341663e+01 -2.4211628682033979e+01 -4.8885242451183231e-01 + 27 -7.1989693245110757e+00 3.0862600015720503e+01 -1.2113492397573609e+01 + 28 2.1728885747832702e+01 -1.1241487657358419e+01 1.5185683466068600e+01 + 29 -1.4356735366664552e+01 -1.9712882789785066e+01 -3.0642394558798047e+00 +run_vdwl: 37.7351028273436 +run_coul: 262.634961661768 +run_stress: ! |- + -9.3272108018189712e+01 -1.3382217126586661e+02 -3.2672293936615591e+02 2.9759545957029179e+01 -4.9209094100413031e+00 -8.2642487904188499e+01 +run_forces: ! |2 + 1 2.0020649788635687e+00 -1.8597539511786593e+01 -3.5898845980394640e+01 + 2 -1.8527112215088330e+01 -1.7111766426267462e+01 2.0691354848190322e+01 + 3 1.0099460867786970e+01 5.9365750003142132e+01 2.4423492212473526e+01 + 4 -4.5756546931309785e+00 -9.8171265309239830e-01 -3.3833947541955820e+00 + 5 -3.6935770918861186e+00 -4.0701905608402482e+00 3.8892344342573999e+00 + 6 7.6571694717448139e+01 -9.5745009991872053e+01 -9.3149401161723290e+01 + 7 -2.1146519945476555e+01 2.8805358955193604e+01 1.2508940744689353e+02 + 8 -2.1038405837727929e+01 9.9856756739362105e+00 -2.8916679506818486e+01 + 9 -8.2725059756602182e+00 -1.3032514603603040e+01 -3.6169609418536254e+01 + 10 -5.3760826931047106e+01 6.1170224214358463e+01 1.8495907821099792e+01 + 11 -1.3253792323264064e+00 -3.2541587509559888e+00 -4.4355038136226383e+00 + 12 2.5785718250683153e+01 -7.4878886859791716e-01 -2.6134474044331246e+00 + 13 3.3829109925579108e+00 -7.7854283145617098e-01 -6.1471416338880658e-01 + 14 -4.1269999117458912e-02 9.3253553809356449e-01 -4.9663548861610076e+00 + 15 4.2930245502032669e+00 4.8016878244809185e+00 -1.2067988554549580e+00 + 16 -3.6783956118288792e+01 1.8760442771705005e+01 1.1514035612976591e+02 + 17 4.4141165055486525e+01 -3.4054760176447999e+01 -9.5996384977569576e+01 + 18 2.6593312590300169e+00 6.2866044197349034e+00 -1.0406390620860617e+00 + 19 -2.6868912576483734e+00 -3.5919428389901107e+00 -6.7199629496476021e-01 + 20 2.3122559534773646e+00 1.6848231900639974e+00 1.0223174367536356e-01 + 21 9.0047861017105912e+00 1.1657532054221129e+01 -3.0300252008113389e+01 + 22 1.2602723597354565e+01 2.2333302149108087e+00 2.1993415039821400e+01 + 23 -2.1752703090839589e+01 -1.3807398281546009e+01 8.4647717981317978e+00 + 24 -4.1597044706741348e+00 2.9600068810024190e+01 -1.4377966609809059e+01 + 25 1.8008123772533907e+01 -4.7255601865067156e+00 1.6011744232774660e+01 + 26 -1.3270414090792938e+01 -2.4692000422804888e+01 -5.6774111520305048e-01 + 27 -7.3472295182173077e+00 3.1133794558171346e+01 -1.2191686027733443e+01 + 28 2.2002916813161221e+01 -1.1345147346836630e+01 1.5336216642368582e+01 + 29 -1.4484026442375008e+01 -1.9880794776432037e+01 -3.1367163092441239e+00 +... diff --git a/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_table.yaml b/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_table.yaml new file mode 100644 index 0000000000..e1b11baa5d --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-mm3_switch3_coulgauss_table.yaml @@ -0,0 +1,99 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Thu Apr 1 12:40:49 202 +epsilon: 5e-13 +prerequisites: ! | + atom full + pair mm3/switch3/coulgauss/long + kspace ewald +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic + pair_modify table 16 + kspace_style ewald 1.0e-6 + kspace_modify gewald 0.3 + kspace_modify compute no +input_file: in.fourmol +pair_style: mm3/switch3/coulgauss/long 8.0 2.0 +pair_coeff: ! | + 1 1 0.02 2.5 1.0 + 2 2 0.005 1.0 0.7 + 2 4 0.005 0.5 0.7 + 3 3 0.02 3.2 1.3 + 4 4 0.015 3.1 1.2 + 5 5 0.015 3.1 1.2 +extract: ! | + epsilon 2 + sigma 2 + gamma 2 + cut_coul 0 +natoms: 29 +init_vdwl: 38.1287498820824 +init_coul: 262.631410551483 +init_stress: ! |- + -9.1891422055344222e+01 -1.3287971490682878e+02 -3.2601696704317601e+02 3.0074184644070325e+01 -4.6650710964193243e+00 -8.2199034124021594e+01 +init_forces: ! |2 + 1 2.0409891887601410e+00 -1.8543276766039128e+01 -3.5869858368636784e+01 + 2 -1.8468129835801221e+01 -1.7027856421838862e+01 2.0713360489903284e+01 + 3 1.0001881406750512e+01 5.9235891391581845e+01 2.4372336084088403e+01 + 4 -4.5761624275299884e+00 -9.8945350885057237e-01 -3.3785799799517919e+00 + 5 -3.6934400978815565e+00 -4.0696597085993824e+00 3.8826789611765924e+00 + 6 7.6754813581654659e+01 -9.5808743568025008e+01 -9.3227047744836440e+01 + 7 -2.1177650577773125e+01 2.8793163867818368e+01 1.2529350475732382e+02 + 8 -2.1450096906263081e+01 1.0356391487008732e+01 -2.8955418913514073e+01 + 9 -8.2497921762950064e+00 -1.3077028158654645e+01 -3.6173489972491325e+01 + 10 -5.3511691030159355e+01 6.0900975401823587e+01 1.8391820698964121e+01 + 11 -1.3170241765068751e+00 -3.2364688471564778e+00 -4.4029421800959856e+00 + 12 2.5797191259942942e+01 -7.5496408222462352e-01 -2.6346170181534139e+00 + 13 3.3781783640778875e+00 -7.7635863919210357e-01 -6.1835202435311720e-01 + 14 -2.5357429751907436e-02 9.3547306506041328e-01 -4.9468892490621892e+00 + 15 4.2707741612200945e+00 4.7941151727292111e+00 -1.2015238312568339e+00 + 16 -3.6573745369001358e+01 1.8565540172135101e+01 1.1446966581907569e+02 + 17 4.3913383313135455e+01 -3.3849656059945403e+01 -9.5337593796166914e+01 + 18 2.6570103088653938e+00 6.2826342874977836e+00 -1.0356880920834588e+00 + 19 -2.6993402231458812e+00 -3.5969203390445723e+00 -6.8072401315458542e-01 + 20 2.3243806398348510e+00 1.6918060433951427e+00 1.0886287880838207e-01 + 21 8.8572291262962786e+00 1.1602893764611768e+01 -3.0057629738908702e+01 + 22 1.2429503818390431e+01 2.1605538409495715e+00 2.1808497451102578e+01 + 23 -2.1432718024616804e+01 -1.3678273926219282e+01 8.4081118535203938e+00 + 24 -3.9016919979164766e+00 2.9074424960765882e+01 -1.3996422102746218e+01 + 25 1.7462839220414320e+01 -4.6818055105547502e+00 1.5548837113535589e+01 + 26 -1.2984514969825625e+01 -2.4211627227692777e+01 -4.8885079054435532e-01 + 27 -7.1989694398744213e+00 3.0862600181437756e+01 -1.2113492591495778e+01 + 28 2.1728883036290242e+01 -1.1241488592261051e+01 1.5185682250007966e+01 + 29 -1.4356732743290538e+01 -1.9712882280516450e+01 -3.0642379500547996e+00 +run_vdwl: 37.735102831577 +run_coul: 262.634996567417 +run_stress: ! |- + -9.3272087816450096e+01 -1.3382216892660497e+02 -3.2672292496064199e+02 2.9759550012391575e+01 -4.9209020012813669e+00 -8.2642482482441096e+01 +run_forces: ! |2 + 1 2.0020633315697571e+00 -1.8597540312576371e+01 -3.5898847150887825e+01 + 2 -1.8527112685977595e+01 -1.7111767435468980e+01 2.0691356245503808e+01 + 3 1.0099461000123771e+01 5.9365749899001820e+01 2.4423492074447349e+01 + 4 -4.5756545930134305e+00 -9.8171217238369679e-01 -3.3833945796207656e+00 + 5 -3.6935769629718820e+00 -4.0701894718259650e+00 3.8892346120926988e+00 + 6 7.6571693742405060e+01 -9.5745009619986718e+01 -9.3149402824851791e+01 + 7 -2.1146520723115522e+01 2.8805359357005347e+01 1.2508940510400312e+02 + 8 -2.1038406658511651e+01 9.9856753020536395e+00 -2.8916677199745425e+01 + 9 -8.2725040661224440e+00 -1.3032515389877304e+01 -3.6169607187530971e+01 + 10 -5.3760826866916233e+01 6.1170224662661617e+01 1.8495907188455345e+01 + 11 -1.3253793686585611e+00 -3.2541579724226799e+00 -4.4355037885599886e+00 + 12 2.5785718921609639e+01 -7.4878876652861359e-01 -2.6134482478760357e+00 + 13 3.3829110641517599e+00 -7.7854300168776425e-01 -6.1471395974905052e-01 + 14 -4.1270221660368221e-02 9.3253524130353482e-01 -4.9663546372704301e+00 + 15 4.2930244204525003e+00 4.8016875903370053e+00 -1.2067983339497499e+00 + 16 -3.6783955303667234e+01 1.8760441796324653e+01 1.1514035663250905e+02 + 17 4.4141164796979076e+01 -3.4054759175778408e+01 -9.5996385613193283e+01 + 18 2.6593320216432965e+00 6.2866046080770897e+00 -1.0406402388907743e+00 + 19 -2.6868932719674365e+00 -3.5919446222505456e+00 -6.7199643833073341e-01 + 20 2.3122579672731871e+00 1.6848245740968735e+00 1.0223265461108680e-01 + 21 9.0047857933168434e+00 1.1657532538116142e+01 -3.0300251561127794e+01 + 22 1.2602721079420199e+01 2.2333285795234898e+00 2.1993413545558095e+01 + 23 -2.1752700027690018e+01 -1.3807397168507773e+01 8.4647725463156984e+00 + 24 -4.1597043845955195e+00 2.9600069115788433e+01 -1.4377967328816560e+01 + 25 1.8008122136440438e+01 -4.7255613901672264e+00 1.6011743726111732e+01 + 26 -1.3270411937489305e+01 -2.4691999045812377e+01 -5.6773953378636655e-01 + 27 -7.3472299042491755e+00 3.1133794605717583e+01 -1.2191686159483819e+01 + 28 2.2002914561082278e+01 -1.1345148097691201e+01 1.5336215539418586e+01 + 29 -1.4484023859861420e+01 -1.9880794227041598e+01 -3.1367150853552728e+00 +... From 2dfafe4adb8eb7646f1587c59410681538adabb4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 12:07:43 -0400 Subject: [PATCH 206/370] add is_file() special variable function and unit tests for it --- doc/src/variable.rst | 8 ++++++-- src/variable.cpp | 24 ++++++++++++++++++++++-- unittest/commands/test_variables.cpp | 14 +++++++++++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 6a6cdf9a6d..af324c180f 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -65,8 +65,8 @@ Syntax bound(group,dir,region), gyration(group,region), ke(group,reigon), angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) - special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x) - feature functions = is_active(category,feature,exact), is_defined(category,id,exact) + special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name) + feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id) atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] @@ -821,6 +821,10 @@ Special Functions Special functions take specific kinds of arguments, meaning their arguments cannot be formulas themselves. +The is_file(x) function is a test whether 'x' is a (readable) file +and returns 1 in this case, otherwise it returns 0. For that 'x' +is taken as a literal string and must not have any blanks in it. + The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions each take 1 argument which is of the form "c_ID" or "c_ID[N]" or "f_ID" or "f_ID[N]" or "v_name". The first two are computes and the diff --git a/src/variable.cpp b/src/variable.cpp index 3bf88db55e..1a4feb3573 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -65,7 +65,7 @@ enum{DONE,ADD,SUBTRACT,MULTIPLY,DIVIDE,CARAT,MODULO,UNARY, SQRT,EXP,LN,LOG,ABS,SIN,COS,TAN,ASIN,ACOS,ATAN,ATAN2, RANDOM,NORMAL,CEIL,FLOOR,ROUND,RAMP,STAGGER,LOGFREQ,LOGFREQ2, LOGFREQ3,STRIDE,STRIDE2,VDISPLACE,SWIGGLE,CWIGGLE,GMASK,RMASK, - GRMASK,IS_ACTIVE,IS_DEFINED,IS_AVAILABLE, + GRMASK,IS_ACTIVE,IS_DEFINED,IS_AVAILABLE,IS_FILE, VALUE,ATOMARRAY,TYPEARRAY,INTARRAY,BIGINTARRAY,VECTORARRAY}; // customize by adding a special function @@ -4079,7 +4079,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, strcmp(word,"gmask") && strcmp(word,"rmask") && strcmp(word,"grmask") && strcmp(word,"next") && strcmp(word,"is_active") && strcmp(word,"is_defined") && - strcmp(word,"is_available")) + strcmp(word,"is_available") && strcmp(word,"is_file")) return 0; // parse contents for comma-separated args @@ -4488,6 +4488,26 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // save value in tree or on argstack + if (tree) { + Tree *newtree = new Tree(); + newtree->type = VALUE; + newtree->value = value; + newtree->first = newtree->second = nullptr; + newtree->nextra = 0; + treestack[ntreestack++] = newtree; + } else argstack[nargstack++] = value; + + } else if (strcmp(word,"is_file") == 0) { + if (narg != 1) + print_var_error(FLERR,"Invalid is_file() function in " + "variable formula",ivar); + + FILE *fp = fopen(args[0],"r"); + value = (fp == nullptr) ? 0.0 : 1.0; + if (fp) fclose(fp); + + // save value in tree or on argstack + if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index eb533aee86..97f874a856 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -142,12 +142,13 @@ TEST_F(VariableTest, CreateDelete) command("variable ten2 uloop 4"); command("variable ten3 uloop 4 pad"); command("variable dummy index 0"); + command("variable file equal is_file(MYFILE)"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 17); + ASSERT_EQ(variable->nvar, 18); BEGIN_HIDE_OUTPUT(); command("variable dummy delete"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 16); + ASSERT_EQ(variable->nvar, 17); ASSERT_THAT(variable->retrieve("three"), StrEq("three")); variable->set_string("three", "four"); ASSERT_THAT(variable->retrieve("three"), StrEq("four")); @@ -158,6 +159,13 @@ TEST_F(VariableTest, CreateDelete) ASSERT_THAT(variable->retrieve("eight"), StrEq("")); variable->internal_set(variable->find("ten"), 2.5); ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5")); + ASSERT_THAT(variable->retrieve("file"), StrEq("0")); + FILE *fp = fopen("MYFILE","w"); + fputs(" ",fp); + fclose(fp); + ASSERT_THAT(variable->retrieve("file"), StrEq("1")); + unlink("MYFILE"); + ASSERT_THAT(variable->retrieve("file"), StrEq("0")); ASSERT_EQ(variable->equalstyle(variable->find("one")), 0); ASSERT_EQ(variable->equalstyle(variable->find("two")), 1); @@ -200,7 +208,7 @@ TEST_F(VariableTest, CreateDelete) TEST_F(VariableTest, AtomicSystem) { - command("atom_modify map array"); + HIDE_OUTPUT([&] { command("atom_modify map array"); }); atomic_system(); file_vars(); From 887eb40ad493eedf61f21ca9c19186c8181fb7a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 12:07:59 -0400 Subject: [PATCH 207/370] fix crash when requesting verbose output. --- unittest/testing/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/testing/core.h b/unittest/testing/core.h index deab845573..75b0564d02 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -60,7 +60,7 @@ public: } void BEGIN_CAPTURE_OUTPUT() { - if (!verbose) ::testing::internal::CaptureStdout(); + ::testing::internal::CaptureStdout(); } std::string END_CAPTURE_OUTPUT() { From 366b49c5811316cabae57bfbfbe7dfe810632834 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 12:14:34 -0400 Subject: [PATCH 208/370] copy NeighRequest::id to NeighList::id so we can identify them when a style has multiple requests --- src/neigh_list.cpp | 1 + src/neigh_list.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index 308ecbbf6e..a51ecb7518 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -143,6 +143,7 @@ void NeighList::post_constructor(NeighRequest *nq) respamiddle = nq->respamiddle; respainner = nq->respainner; copy = nq->copy; + id = nq->id; if (nq->copy) { listcopy = neighbor->lists[nq->copylist]; diff --git a/src/neigh_list.h b/src/neigh_list.h index d69b844dc8..ad8e104f2a 100644 --- a/src/neigh_list.h +++ b/src/neigh_list.h @@ -44,6 +44,7 @@ class NeighList : protected Pointers { int copy; // 1 if this list is copied from another list int kk2cpu; // 1 if this list is copied from Kokkos to CPU int copymode; // 1 if this is a Kokkos on-device copy + int id; // copied from neighbor list request // data structs to store neighbor pairs I,J and associated values From d24f74b582408a308bc0fd37fda06e175239b1d8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 12:31:46 -0400 Subject: [PATCH 209/370] add stop on file example to fix halt docs --- doc/src/fix_halt.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/src/fix_halt.rst b/doc/src/fix_halt.rst index 964132518d..06f068bb7d 100644 --- a/doc/src/fix_halt.rst +++ b/doc/src/fix_halt.rst @@ -115,6 +115,18 @@ The version with "bondmax" will just run somewhat faster, due to less overhead in computing bond lengths and not storing them in a separate compute. +A variable can be used to implement a large variety of conditions, +including to stop when a specific file exists. Example: + +.. code-block:: LAMMPS + + variable exit equal is_file(EXIT) + fix 10 all halt 100 v_exit != 0 error soft + +Will stop the current run command when a file ``EXIT`` is created +in the current working directory. The condition can be cleared +by removing the file through the :doc:`shell ` command. + The choice of operators listed above are the usual comparison operators. The XOR operation (exclusive or) is also included as "\|\^". In this context, XOR means that if either the attribute or avalue is From 43735fd3f5c52670b87706076de01c2c8b4ab83e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 13:50:50 -0400 Subject: [PATCH 210/370] update neighbor list library interface to use ID field in neighbor list to uniquely identify lists --- src/library.cpp | 135 ++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 73 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index a950d31e4e..2129ebeff8 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -3914,40 +3914,43 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, // Library functions for accessing neighbor lists // ---------------------------------------------------------------------- -/** Find neighbor list index of pair style neighbor list +/** Find index of a neighbor list requested by a pair style * - * Try finding pair instance that matches style. If exact is set, the pair must - * match style exactly. If exact is 0, style must only be contained. If pair is - * of style pair/hybrid, style is instead matched the nsub-th hybrid sub-style. + * This function determines which of the available neighbor lists for + * pair styles matches the given conditions. It first matches the style + * name. If exact is 1 the name must match exactly, if exact is 0, a + * regular expression or substring match is done. If the pair style is + * hybrid or hybrid/overlay the style is matched against the sub styles + * instead. + * If a the same pair style is used multiple times as a sub-style, the + * nsub argument must be > 0 and represents the nth instance of the sub-style + * (same as for the pair_coeff command, for example). In that case + * nsub=0 will not produce a match and this function will return -1. * - * Once the pair instance has been identified, multiple neighbor list requests - * may be found. Every neighbor list is uniquely identified by its request - * index. Thus, providing this request index ensures that the correct neighbor - * list index is returned. + * The final condition to be checked is the request ID (reqid). This + * will normally be 0, but some pair styles request multiple neighbor + * lists and set the request ID to a value > 0. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param style String used to search for pair style instance * \param exact Flag to control whether style should match exactly or only - * must be contained in pair style name - * \param nsub match nsub-th hybrid sub-style - * \param request request index that specifies which neighbor list should be - * returned, in case there are multiple neighbor lists requests - * for the found pair style + * a regular expression / substring match is applied. + * \param nsub match nsub-th hybrid sub-style instance of the same style + * \param reqid request id to identify neighbor list in case there are + * multiple requests from the same pair style instance * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, int request) { - LAMMPS * lmp = (LAMMPS *) handle; - Pair* pair = lmp->force->pair_match(style, exact, nsub); +int lammps_find_pair_neighlist(void *handle, char *style, int exact, int nsub, int reqid) { + LAMMPS *lmp = (LAMMPS *) handle; + Pair *pair = lmp->force->pair_match(style, exact, nsub); if (pair != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { - NeighList * list = lmp->neighbor->lists[i]; - if (list->requestor_type != NeighList::PAIR || pair != list->requestor) continue; - - if (list->index == request) { - return i; - } + NeighList *list = lmp->neighbor->lists[i]; + if ( (list->requestor_type == NeighList::PAIR) + && (pair == list->requestor) + && (list->id == reqid) ) return i; } } return -1; @@ -3955,74 +3958,60 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, /* ---------------------------------------------------------------------- */ -/** Find neighbor list index of fix neighbor list +/** Find index of a neighbor list requested by a fix + * + * The neighbor list request from a fix is identified by the fix ID and + * the request ID. The request ID is typically 0, but will be > 0 in + * case a fix has multiple neighbor list requests. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param id Identifier of fix instance - * \param request request index that specifies which request should be returned, - * in case there are multiple neighbor lists for this fix + * \param reqid request id to identify neighbor list in case there are + * multiple requests from the same fix * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_fix_neighlist(void* handle, char *id, int request) { - LAMMPS * lmp = (LAMMPS *) handle; - Fix* fix = nullptr; - const int nfix = lmp->modify->nfix; +int lammps_find_fix_neighlist(void *handle, char *id, int reqid) { + LAMMPS *lmp = (LAMMPS *) handle; + const int ifix = lmp->modify->find_fix(id); + if (ifix < 0) return -1; - // find fix with name - for (int ifix = 0; ifix < nfix; ifix++) { - if (strcmp(lmp->modify->fix[ifix]->id, id) == 0) { - fix = lmp->modify->fix[ifix]; - break; - } - } - - if (fix != nullptr) { - // find neigh list - for (int i = 0; i < lmp->neighbor->nlist; i++) { - NeighList * list = lmp->neighbor->lists[i]; - if (list->requestor_type != NeighList::FIX || fix != list->requestor) continue; - - if (list->index == request) { - return i; - } - } + Fix *fix = lmp->modify->fix[ifix]; + // find neigh list + for (int i = 0; i < lmp->neighbor->nlist; i++) { + NeighList *list = lmp->neighbor->lists[i]; + if ( (list->requestor_type == NeighList::FIX) + && (fix == list->requestor) + && (list->id == reqid) ) return i; } return -1; } /* ---------------------------------------------------------------------- */ -/** Find neighbor list index of compute neighbor list +/** Find index of a neighbor list requested by a compute + * + * The neighbor list request from a compute is identified by the compute + * ID and the request ID. The request ID is typically 0, but will be + * > 0 in case a compute has multiple neighbor list requests. * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. - * \param id Identifier of fix instance - * \param request request index that specifies which request should be returned, - * in case there are multiple neighbor lists for this fix + * \param id Identifier of compute instance + * \param reqid request id to identify neighbor list in case there are + * multiple requests from the same compute * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_compute_neighlist(void* handle, char *id, int request) { - LAMMPS * lmp = (LAMMPS *) handle; - Compute* compute = nullptr; - const int ncompute = lmp->modify->ncompute; +int lammps_find_compute_neighlist(void* handle, char *id, int reqid) { + LAMMPS *lmp = (LAMMPS *) handle; + const int icompute = lmp->modify->find_compute(id); + if (icompute < 0) return -1; - // find compute with name - for (int icompute = 0; icompute < ncompute; icompute++) { - if (strcmp(lmp->modify->compute[icompute]->id, id) == 0) { - compute = lmp->modify->compute[icompute]; - break; - } - } - - if (compute != nullptr) { - // find neigh list - for (int i = 0; i < lmp->neighbor->nlist; i++) { - NeighList * list = lmp->neighbor->lists[i]; - if (list->requestor_type != NeighList::COMPUTE || compute != list->requestor) continue; - - if (list->index == request) { - return i; - } - } + Compute *compute = lmp->modify->compute[icompute]; + // find neigh list + for (int i = 0; i < lmp->neighbor->nlist; i++) { + NeighList * list = lmp->neighbor->lists[i]; + if ( (list->requestor_type == NeighList::COMPUTE) + && (compute == list->requestor) + && (list->id == reqid) ) return i; } return -1; } From 5583901b2c77d6882f3a8b762e4ba15500954faf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 13:51:42 -0400 Subject: [PATCH 211/370] should not set neighbor list request id to non-zero when just requesting a single neighbor list --- src/USER-QUIP/pair_quip.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 2d338da158..20a6c98cb8 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -318,7 +318,6 @@ void PairQUIP::init_style() // Initialise neighbor list int irequest_full = neighbor->request(this); - neighbor->requests[irequest_full]->id = 1; neighbor->requests[irequest_full]->half = 0; neighbor->requests[irequest_full]->full = 1; } From c4f59764d43e36b5caa87939c2185e579f5e45fb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 15:28:09 -0400 Subject: [PATCH 212/370] reformat pair_coeff section that got misformatted as string --- .../force-styles/tests/mol-pair-born.yaml | 36 +++++++++---------- .../tests/mol-pair-born_coul_dsf.yaml | 36 +++++++++---------- .../tests/mol-pair-born_coul_long.yaml | 36 +++++++++---------- .../tests/mol-pair-born_coul_msm.yaml | 36 +++++++++---------- .../tests/mol-pair-born_coul_msm_table.yaml | 36 +++++++++---------- .../tests/mol-pair-born_coul_wolf.yaml | 36 +++++++++---------- .../force-styles/tests/mol-pair-morse.yaml | 31 +++++++++------- .../tests/mol-pair-morse_smooth_linear.yaml | 31 +++++++++------- 8 files changed, 144 insertions(+), 134 deletions(-) diff --git a/unittest/force-styles/tests/mol-pair-born.yaml b/unittest/force-styles/tests/mol-pair-born.yaml index 05e77a49b5..f411505f74 100644 --- a/unittest/force-styles/tests/mol-pair-born.yaml +++ b/unittest/force-styles/tests/mol-pair-born.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:43 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -9,22 +9,22 @@ pre_commands: ! "" post_commands: ! "" input_file: in.fourmol pair_style: born 8.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722\n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | a 2 c 2 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml index c139bd0bc2..a3bacb3f7c 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_dsf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:43 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -9,22 +9,22 @@ pre_commands: ! "" post_commands: ! "" input_file: in.fourmol pair_style: born/coul/dsf 0.25 8.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722\n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! "" natoms: 29 init_vdwl: 225.01325775005 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml index e831e0da9c..7f99ac0b15 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_long.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_long.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:43 202 epsilon: 7.5e-14 prerequisites: ! | atom full @@ -14,22 +14,22 @@ post_commands: ! | kspace_modify compute no input_file: in.fourmol pair_style: born/coul/long 8.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml index e0def1f392..e805c24b28 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:43 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -15,22 +15,22 @@ post_commands: ! | kspace_modify pressure/scalar no # required for USER-OMP with msm input_file: in.fourmol pair_style: born/coul/msm 12.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml index fe6a0faf84..75f0f76a44 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_msm_table.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:10 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:43 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -15,22 +15,22 @@ post_commands: ! | kspace_modify pressure/scalar no # required for USER-OMP with msm input_file: in.fourmol pair_style: born/coul/msm 12.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! | cut_coul 0 natoms: 29 diff --git a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml index f3c37e100a..db4ad73e30 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_wolf.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:11 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:14:44 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -9,22 +9,22 @@ pre_commands: ! "" post_commands: ! "" input_file: in.fourmol pair_style: born/coul/wolf 0.25 8.0 -pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 - 141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 - 4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 - 403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 - 303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 - 0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 - 17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 - 0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 - 12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 - 1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 - 778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 - 592.979935420722\n" +pair_coeff: ! | + 1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784 + 1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458 + 1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517 + 1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726 + 2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923 + 2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955 + 2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124 + 2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489 + 3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979 + 3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904 + 4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 + 5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722 extract: ! "" natoms: 29 init_vdwl: 225.01325775005 diff --git a/unittest/force-styles/tests/mol-pair-morse.yaml b/unittest/force-styles/tests/mol-pair-morse.yaml index cf75cd6dbd..61a66d8ac5 100644 --- a/unittest/force-styles/tests/mol-pair-morse.yaml +++ b/unittest/force-styles/tests/mol-pair-morse.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:27:01 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -9,17 +9,22 @@ pre_commands: ! "" post_commands: ! "" input_file: in.fourmol pair_style: morse 8.0 -pair_coeff: ! "1 1 0.0202798941614106 2.78203488021395 2.725417159299 \n1 2 0.0101167811264648 - 3.9793050302425 1.90749569018897 \n1 3 0.0202934330695928 2.43948720203264 3.10711749999622 - \n1 4 0.0175731334238374 2.48316585521317 3.05258880102438 \n1 5 0.0175731334238374 - 2.48316585521317 3.05258880102438 \n2 2 0.00503064360487288 6.98433077606902 1.08960295117864 - \n2 3 0.0101296013842819 3.31380153807866 2.28919067558352 \n2 4 0.00497405122588691 - 14.0508902925745 0.544416409093563 \n2 5 0.00877114211614446 3.39491256196178 2.23466262511073 - \n3 3 0.0203039874239943 2.17204344301477 3.48881895084762 \n3 4 0.0175825321440736 - 2.20660439192238 3.43428999287994 \n3 5 0.0175825321440736 2.20660439192238 3.43428999287994 - \n4 4 0.0152259201379927 2.24227873774009 3.37976131582396 \n4 5 0.0152259201379927 - 2.24227873774009 3.37976131582396 \n5 5 0.0152259201379927 2.24227873774009 3.37976131582396 - \n" +pair_coeff: ! | + 1 1 0.0202798941614106 2.78203488021395 2.725417159299 + 1 2 0.0101167811264648 3.9793050302425 1.90749569018897 + 1 3 0.0202934330695928 2.43948720203264 3.10711749999622 + 1 4 0.0175731334238374 2.48316585521317 3.05258880102438 + 1 5 0.0175731334238374 2.48316585521317 3.05258880102438 + 2 2 0.00503064360487288 6.98433077606902 1.08960295117864 + 2 3 0.0101296013842819 3.31380153807866 2.28919067558352 + 2 4 0.00497405122588691 14.0508902925745 0.544416409093563 + 2 5 0.00877114211614446 3.39491256196178 2.23466262511073 + 3 3 0.0203039874239943 2.17204344301477 3.48881895084762 + 3 4 0.0175825321440736 2.20660439192238 3.43428999287994 + 3 5 0.0175825321440736 2.20660439192238 3.43428999287994 + 4 4 0.0152259201379927 2.24227873774009 3.37976131582396 + 4 5 0.0152259201379927 2.24227873774009 3.37976131582396 + 5 5 0.0152259201379927 2.24227873774009 3.37976131582396 extract: ! | d0 2 r0 2 diff --git a/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml b/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml index e933b47a0b..86d749ba25 100644 --- a/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml +++ b/unittest/force-styles/tests/mol-pair-morse_smooth_linear.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 24 Aug 2020 -date_generated: Tue Sep 15 09:44:19 202 +lammps_version: 10 Mar 2021 +date_generated: Fri Apr 2 15:27:01 202 epsilon: 5e-14 prerequisites: ! | atom full @@ -9,17 +9,22 @@ pre_commands: ! "" post_commands: ! "" input_file: in.fourmol pair_style: morse/smooth/linear 8.0 -pair_coeff: ! "1 1 0.0202798941614106 2.78203488021395 2.725417159299 \n1 2 0.0101167811264648 - 3.9793050302425 1.90749569018897 \n1 3 0.0202934330695928 2.43948720203264 3.10711749999622 - \n1 4 0.0175731334238374 2.48316585521317 3.05258880102438 \n1 5 0.0175731334238374 - 2.48316585521317 3.05258880102438 \n2 2 0.00503064360487288 6.98433077606902 1.08960295117864 - \n2 3 0.0101296013842819 3.31380153807866 2.28919067558352 \n2 4 0.00497405122588691 - 14.0508902925745 0.544416409093563 \n2 5 0.00877114211614446 3.39491256196178 2.23466262511073 - \n3 3 0.0203039874239943 2.17204344301477 3.48881895084762 \n3 4 0.0175825321440736 - 2.20660439192238 3.43428999287994 \n3 5 0.0175825321440736 2.20660439192238 3.43428999287994 - \n4 4 0.0152259201379927 2.24227873774009 3.37976131582396 \n4 5 0.0152259201379927 - 2.24227873774009 3.37976131582396 \n5 5 0.0152259201379927 2.24227873774009 3.37976131582396 - \n" +pair_coeff: ! | + 1 1 0.0202798941614106 2.78203488021395 2.725417159299 + 1 2 0.0101167811264648 3.9793050302425 1.90749569018897 + 1 3 0.0202934330695928 2.43948720203264 3.10711749999622 + 1 4 0.0175731334238374 2.48316585521317 3.05258880102438 + 1 5 0.0175731334238374 2.48316585521317 3.05258880102438 + 2 2 0.00503064360487288 6.98433077606902 1.08960295117864 + 2 3 0.0101296013842819 3.31380153807866 2.28919067558352 + 2 4 0.00497405122588691 14.0508902925745 0.544416409093563 + 2 5 0.00877114211614446 3.39491256196178 2.23466262511073 + 3 3 0.0203039874239943 2.17204344301477 3.48881895084762 + 3 4 0.0175825321440736 2.20660439192238 3.43428999287994 + 3 5 0.0175825321440736 2.20660439192238 3.43428999287994 + 4 4 0.0152259201379927 2.24227873774009 3.37976131582396 + 4 5 0.0152259201379927 2.24227873774009 3.37976131582396 + 5 5 0.0152259201379927 2.24227873774009 3.37976131582396 extract: ! | d0 2 r0 2 From 160f2cc6307cb5c7e7b3179ca93e0d01de7b8b9f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 2 Apr 2021 16:11:23 -0400 Subject: [PATCH 213/370] Update ROCm container definitions --- tools/singularity/ubuntu18.04_amd_rocm.def | 2 +- tools/singularity/ubuntu20.04_amd_rocm.def | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index bb04c738c4..7b06970110 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -94,7 +94,7 @@ From: ubuntu:18.04 ########################################################################### export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git + git clone -b rocm-4.1.x https://github.com/ROCmSoftwarePlatform/hipCUB.git mkdir hipCUB/build cd hipCUB/build CXX=hipcc cmake -D BUILD_TEST=off .. diff --git a/tools/singularity/ubuntu20.04_amd_rocm.def b/tools/singularity/ubuntu20.04_amd_rocm.def index 28d57be341..4eee97ffec 100644 --- a/tools/singularity/ubuntu20.04_amd_rocm.def +++ b/tools/singularity/ubuntu20.04_amd_rocm.def @@ -2,7 +2,7 @@ BootStrap: docker From: ubuntu:20.04 %environment - export PATH=/usr/lib/ccache:/usr/local/cuda-11.0/bin:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 + export PATH=/usr/lib/ccache:${PATH}:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 %post export DEBIAN_FRONTEND=noninteractive apt-get update @@ -90,7 +90,7 @@ From: ubuntu:20.04 ########################################################################### export PATH=$PATH:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin/x86_64 - git clone -b rocm-3.7.x https://github.com/ROCmSoftwarePlatform/hipCUB.git + git clone -b rocm-4.1.x https://github.com/ROCmSoftwarePlatform/hipCUB.git mkdir hipCUB/build cd hipCUB/build CXX=hipcc cmake -D BUILD_TEST=off .. From 79a413aeea135e0968edc9b8dfc1b73b3f6a5886 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 16:15:28 -0400 Subject: [PATCH 214/370] replace calls to sqrt() in constant initializers with precomputed numbers. this also moves those arrays into a separate file and out of the header --- src/USER-PTM/ptm_constants.cpp | 156 +++++++++++++++++++++++ src/USER-PTM/ptm_constants.h | 220 ++++++++------------------------- 2 files changed, 205 insertions(+), 171 deletions(-) create mode 100644 src/USER-PTM/ptm_constants.cpp diff --git a/src/USER-PTM/ptm_constants.cpp b/src/USER-PTM/ptm_constants.cpp new file mode 100644 index 0000000000..82bead2101 --- /dev/null +++ b/src/USER-PTM/ptm_constants.cpp @@ -0,0 +1,156 @@ +/*Copyright (c) 2016 PM Larsen + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "ptm_constants.h" +#include + +const int ptm_num_nbrs[9] = {0, PTM_NUM_NBRS_FCC, PTM_NUM_NBRS_HCP, PTM_NUM_NBRS_BCC, PTM_NUM_NBRS_ICO, PTM_NUM_NBRS_SC, PTM_NUM_NBRS_DCUB, PTM_NUM_NBRS_DHEX, PTM_NUM_NBRS_GRAPHENE}; + +//------------------------------------ +// template structures +//------------------------------------ + +#define MYSQRT2 1.41421356237309504880 +#define MYSQRT3 1.73205080756887729352 +#define MYSQRT5 2.23606797749978969640 +#define MYSQRT6 2.44948974278317809819 +// sqrt((5.0-sqrt(5.0))/10.0): +#define MY5MINUSSQRT5BY10 0.52573111211913360602 +// sqrt((5.0+sqrt(5.0))/10.0): +#define MY5PLUSSQRT5BY10 0.85065080835203993218 +//these point sets have barycentre {0, 0, 0} and are scaled such that the mean neighbour distance is 1 + +const double ptm_template_fcc[PTM_NUM_POINTS_FCC][3] = { + { 0, 0, 0 }, + { MYSQRT2/2, MYSQRT2/2, 0 }, + { 0, MYSQRT2/2, MYSQRT2/2 }, + { MYSQRT2/2, 0, MYSQRT2/2 }, + { -MYSQRT2/2, -MYSQRT2/2, 0 }, + { 0, -MYSQRT2/2, -MYSQRT2/2 }, + { -MYSQRT2/2, 0, -MYSQRT2/2 }, + { -MYSQRT2/2, MYSQRT2/2, 0 }, + { 0, -MYSQRT2/2, MYSQRT2/2 }, + { -MYSQRT2/2, 0, MYSQRT2/2 }, + { MYSQRT2/2, -MYSQRT2/2, 0 }, + { 0, MYSQRT2/2, -MYSQRT2/2 }, + { MYSQRT2/2, 0, -MYSQRT2/2 }, +}; + +const double ptm_template_hcp[PTM_NUM_POINTS_HCP][3] = { + { 0, 0, 0 }, + { 0.5, -MYSQRT3/2, 0 }, + { -1, 0, 0 }, + { -0.5, MYSQRT3/6, -MYSQRT6/3 }, + { 0.5, MYSQRT3/6, -MYSQRT6/3 }, + { 0, -MYSQRT3/3, -MYSQRT6/3 }, + { -0.5, MYSQRT3/2, 0 }, + { 0.5, MYSQRT3/2, 0 }, + { 1, 0, 0 }, + { -0.5, -MYSQRT3/2, 0 }, + { 0, -MYSQRT3/3, MYSQRT6/3 }, + { 0.5, MYSQRT3/6, MYSQRT6/3 }, + { -0.5, MYSQRT3/6, MYSQRT6/3 }, +}; + +const double ptm_template_bcc[PTM_NUM_POINTS_BCC][3] = { + { 0, 0, 0 }, + { 7*MYSQRT3/3-7./2, 7*MYSQRT3/3-7./2, 7*MYSQRT3/3-7./2 }, + { 7./2-7*MYSQRT3/3, 7*MYSQRT3/3-7./2, 7*MYSQRT3/3-7./2 }, + { 7*MYSQRT3/3-7./2, 7*MYSQRT3/3-7./2, 7./2-7*MYSQRT3/3 }, + { 7./2-7*MYSQRT3/3, 7./2-7*MYSQRT3/3, 7*MYSQRT3/3-7./2 }, + { 7*MYSQRT3/3-7./2, 7./2-7*MYSQRT3/3, 7*MYSQRT3/3-7./2 }, + { 7./2-7*MYSQRT3/3, 7*MYSQRT3/3-7./2, 7./2-7*MYSQRT3/3 }, + { 7./2-7*MYSQRT3/3, 7./2-7*MYSQRT3/3, 7./2-7*MYSQRT3/3 }, + { 7*MYSQRT3/3-7./2, 7./2-7*MYSQRT3/3, 7./2-7*MYSQRT3/3 }, + { 14*MYSQRT3/3-7, 0, 0 }, + { 7-14*MYSQRT3/3, 0, 0 }, + { 0, 14*MYSQRT3/3-7, 0 }, + { 0, 7-14*MYSQRT3/3, 0 }, + { 0, 0, 14*MYSQRT3/3-7 }, + { 0, 0, 7-14*MYSQRT3/3 }, +}; + +const double ptm_template_ico[PTM_NUM_POINTS_ICO][3] = { + { 0, 0, 0 }, + { 0, 0, 1 }, + { 0, 0, -1 }, + { -MY5MINUSSQRT5BY10, (5+MYSQRT5)/10, -MYSQRT5/5 }, + { MY5MINUSSQRT5BY10, -(5+MYSQRT5)/10, MYSQRT5/5 }, + { 0, -2*MYSQRT5/5, -MYSQRT5/5 }, + { 0, 2*MYSQRT5/5, MYSQRT5/5 }, + { MY5PLUSSQRT5BY10, -(5-MYSQRT5)/10, -MYSQRT5/5 }, + { -MY5PLUSSQRT5BY10, (5-MYSQRT5)/10, MYSQRT5/5 }, + { -MY5PLUSSQRT5BY10, -(5-MYSQRT5)/10, -MYSQRT5/5 }, + { MY5PLUSSQRT5BY10, (5-MYSQRT5)/10, MYSQRT5/5 }, + { MY5MINUSSQRT5BY10, (5+MYSQRT5)/10, -MYSQRT5/5 }, + { -MY5MINUSSQRT5BY10, -(5+MYSQRT5)/10, MYSQRT5/5 }, +}; + +const double ptm_template_sc[PTM_NUM_POINTS_SC][3] = { + { 0, 0, 0 }, + { 0, 0, -1 }, + { 0, 0, 1 }, + { 0, -1, 0 }, + { 0, 1, 0 }, + { -1, 0, 0 }, + { 1, 0, 0 }, +}; + +const double ptm_template_dcub[PTM_NUM_POINTS_DCUB][3] = { + { 0, 0, 0 }, + { 4/(MYSQRT3+6*MYSQRT2), 4/(MYSQRT3+6*MYSQRT2), 4/(MYSQRT3+6*MYSQRT2) }, + { 4/(MYSQRT3+6*MYSQRT2), -4/(MYSQRT3+6*MYSQRT2), -4/(MYSQRT3+6*MYSQRT2) }, + { -4/(MYSQRT3+6*MYSQRT2), -4/(MYSQRT3+6*MYSQRT2), 4/(MYSQRT3+6*MYSQRT2) }, + { -4/(MYSQRT3+6*MYSQRT2), 4/(MYSQRT3+6*MYSQRT2), -4/(MYSQRT3+6*MYSQRT2) }, + { 8/(MYSQRT3+6*MYSQRT2), 8/(MYSQRT3+6*MYSQRT2), 0 }, + { 0, 8/(MYSQRT3+6*MYSQRT2), 8/(MYSQRT3+6*MYSQRT2) }, + { 8/(MYSQRT3+6*MYSQRT2), 0, 8/(MYSQRT3+6*MYSQRT2) }, + { 0, -8/(MYSQRT3+6*MYSQRT2), -8/(MYSQRT3+6*MYSQRT2) }, + { 8/(MYSQRT3+6*MYSQRT2), -8/(MYSQRT3+6*MYSQRT2), 0 }, + { 8/(MYSQRT3+6*MYSQRT2), 0, -8/(MYSQRT3+6*MYSQRT2) }, + { -8/(MYSQRT3+6*MYSQRT2), -8/(MYSQRT3+6*MYSQRT2), 0 }, + { 0, -8/(MYSQRT3+6*MYSQRT2), 8/(MYSQRT3+6*MYSQRT2) }, + { -8/(MYSQRT3+6*MYSQRT2), 0, 8/(MYSQRT3+6*MYSQRT2) }, + { -8/(MYSQRT3+6*MYSQRT2), 0, -8/(MYSQRT3+6*MYSQRT2) }, + { -8/(MYSQRT3+6*MYSQRT2), 8/(MYSQRT3+6*MYSQRT2), 0 }, + { 0, 8/(MYSQRT3+6*MYSQRT2), -8/(MYSQRT3+6*MYSQRT2) }, +}; + +const double ptm_template_dhex[PTM_NUM_POINTS_DHEX][3] = { + { 0, 0, 0 }, + { -4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), -4*MYSQRT3/(3*MYSQRT3+18*MYSQRT2) }, + { 0, -8*MYSQRT6/(3*MYSQRT3+18*MYSQRT2), -4*MYSQRT3/(3*MYSQRT3+18*MYSQRT2) }, + { 4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), -4*MYSQRT3/(3*MYSQRT3+18*MYSQRT2) }, + { 0, 0, 4*MYSQRT3/(MYSQRT3+6*MYSQRT2) }, + { -8*MYSQRT2/(MYSQRT3+6*MYSQRT2), 0, 0 }, + { -4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), -16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, + { -4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(MYSQRT3+6*MYSQRT2), 0 }, + { 4*MYSQRT2/(MYSQRT3+6*MYSQRT2), -4*MYSQRT6/(MYSQRT3+6*MYSQRT2), 0 }, + { 0, -8*MYSQRT6/(3*MYSQRT3+18*MYSQRT2), -16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, + { -4*MYSQRT2/(MYSQRT3+6*MYSQRT2), -4*MYSQRT6/(MYSQRT3+6*MYSQRT2), 0 }, + { 4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), -16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, + { 4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(MYSQRT3+6*MYSQRT2), 0 }, + { 8*MYSQRT2/(MYSQRT3+6*MYSQRT2), 0, 0 }, + { 0, -8*MYSQRT6/(3*MYSQRT3+18*MYSQRT2), 16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, + { 4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), 16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, + { -4*MYSQRT2/(MYSQRT3+6*MYSQRT2), 4*MYSQRT6/(3*(MYSQRT3+6*MYSQRT2)), 16*MYSQRT3/(3*(MYSQRT3+6*MYSQRT2)) }, +}; + +const double ptm_template_graphene[PTM_NUM_POINTS_GRAPHENE][3] = { + { 0, 0, 0 }, + { 0, -3./11+6*MYSQRT3/11, 0 }, + { -3*MYSQRT3/22+9./11, -3*MYSQRT3/11+3./22, 0 }, + { -9./11+3*MYSQRT3/22, -3*MYSQRT3/11+3./22, 0 }, + { -9./11+3*MYSQRT3/22, -9./22+9*MYSQRT3/11, 0 }, + { -3*MYSQRT3/22+9./11, -9./22+9*MYSQRT3/11, 0 }, + { -3*MYSQRT3/11+18./11, 0, 0 }, + { -3*MYSQRT3/22+9./11, -9*MYSQRT3/11+9./22, 0 }, + { -9./11+3*MYSQRT3/22, -9*MYSQRT3/11+9./22, 0 }, + { -18./11+3*MYSQRT3/11, 0, 0 }, +}; diff --git a/src/USER-PTM/ptm_constants.h b/src/USER-PTM/ptm_constants.h index c3882f622c..898ded6b49 100644 --- a/src/USER-PTM/ptm_constants.h +++ b/src/USER-PTM/ptm_constants.h @@ -10,63 +10,61 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #ifndef PTM_CONSTANTS_H #define PTM_CONSTANTS_H -#include - //------------------------------------ // definitions //------------------------------------ -#define PTM_NO_ERROR 0 +#define PTM_NO_ERROR 0 -#define PTM_CHECK_FCC (1 << 0) -#define PTM_CHECK_HCP (1 << 1) -#define PTM_CHECK_BCC (1 << 2) -#define PTM_CHECK_ICO (1 << 3) -#define PTM_CHECK_SC (1 << 4) -#define PTM_CHECK_DCUB (1 << 5) -#define PTM_CHECK_DHEX (1 << 6) -#define PTM_CHECK_GRAPHENE (1 << 7) -#define PTM_CHECK_DEFAULT (PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_ICO | PTM_CHECK_BCC) +#define PTM_CHECK_FCC (1 << 0) +#define PTM_CHECK_HCP (1 << 1) +#define PTM_CHECK_BCC (1 << 2) +#define PTM_CHECK_ICO (1 << 3) +#define PTM_CHECK_SC (1 << 4) +#define PTM_CHECK_DCUB (1 << 5) +#define PTM_CHECK_DHEX (1 << 6) +#define PTM_CHECK_GRAPHENE (1 << 7) +#define PTM_CHECK_DEFAULT (PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_ICO | PTM_CHECK_BCC) #define PTM_CHECK_ALL (PTM_CHECK_SC | PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_ICO | PTM_CHECK_BCC | PTM_CHECK_DCUB | PTM_CHECK_DHEX | PTM_CHECK_GRAPHENE) -#define PTM_MATCH_NONE 0 -#define PTM_MATCH_FCC 1 -#define PTM_MATCH_HCP 2 -#define PTM_MATCH_BCC 3 -#define PTM_MATCH_ICO 4 -#define PTM_MATCH_SC 5 -#define PTM_MATCH_DCUB 6 -#define PTM_MATCH_DHEX 7 -#define PTM_MATCH_GRAPHENE 8 +#define PTM_MATCH_NONE 0 +#define PTM_MATCH_FCC 1 +#define PTM_MATCH_HCP 2 +#define PTM_MATCH_BCC 3 +#define PTM_MATCH_ICO 4 +#define PTM_MATCH_SC 5 +#define PTM_MATCH_DCUB 6 +#define PTM_MATCH_DHEX 7 +#define PTM_MATCH_GRAPHENE 8 -#define PTM_ALLOY_NONE 0 -#define PTM_ALLOY_PURE 1 -#define PTM_ALLOY_L10 2 -#define PTM_ALLOY_L12_CU 3 -#define PTM_ALLOY_L12_AU 4 -#define PTM_ALLOY_B2 5 -#define PTM_ALLOY_SIC 6 -#define PTM_ALLOY_BN 7 +#define PTM_ALLOY_NONE 0 +#define PTM_ALLOY_PURE 1 +#define PTM_ALLOY_L10 2 +#define PTM_ALLOY_L12_CU 3 +#define PTM_ALLOY_L12_AU 4 +#define PTM_ALLOY_B2 5 +#define PTM_ALLOY_SIC 6 +#define PTM_ALLOY_BN 7 #define PTM_MAX_INPUT_POINTS 19 -#define PTM_MAX_NBRS 16 -#define PTM_MAX_POINTS (PTM_MAX_NBRS + 1) -#define PTM_MAX_FACETS 28 //2 * PTM_MAX_NBRS - 4 -#define PTM_MAX_EDGES 42 //3 * PTM_MAX_NBRS - 6 +#define PTM_MAX_NBRS 16 +#define PTM_MAX_POINTS (PTM_MAX_NBRS + 1) +#define PTM_MAX_FACETS 28 //2 * PTM_MAX_NBRS - 4 +#define PTM_MAX_EDGES 42 //3 * PTM_MAX_NBRS - 6 //------------------------------------ // number of neighbours //------------------------------------ -#define PTM_NUM_NBRS_FCC 12 -#define PTM_NUM_NBRS_HCP 12 -#define PTM_NUM_NBRS_BCC 14 -#define PTM_NUM_NBRS_ICO 12 -#define PTM_NUM_NBRS_SC 6 -#define PTM_NUM_NBRS_DCUB 16 -#define PTM_NUM_NBRS_DHEX 16 -#define PTM_NUM_NBRS_GRAPHENE 9 +#define PTM_NUM_NBRS_FCC 12 +#define PTM_NUM_NBRS_HCP 12 +#define PTM_NUM_NBRS_BCC 14 +#define PTM_NUM_NBRS_ICO 12 +#define PTM_NUM_NBRS_SC 6 +#define PTM_NUM_NBRS_DCUB 16 +#define PTM_NUM_NBRS_DHEX 16 +#define PTM_NUM_NBRS_GRAPHENE 9 #define PTM_NUM_POINTS_FCC (PTM_NUM_NBRS_FCC + 1) #define PTM_NUM_POINTS_HCP (PTM_NUM_NBRS_HCP + 1) @@ -77,142 +75,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #define PTM_NUM_POINTS_DHEX (PTM_NUM_NBRS_DHEX + 1) #define PTM_NUM_POINTS_GRAPHENE (PTM_NUM_NBRS_GRAPHENE + 1) -const int ptm_num_nbrs[9] = {0, PTM_NUM_NBRS_FCC, PTM_NUM_NBRS_HCP, PTM_NUM_NBRS_BCC, PTM_NUM_NBRS_ICO, PTM_NUM_NBRS_SC, PTM_NUM_NBRS_DCUB, PTM_NUM_NBRS_DHEX, PTM_NUM_NBRS_GRAPHENE}; +extern const int ptm_num_nbrs[9]; //------------------------------------ // template structures //------------------------------------ -//these point sets have barycentre {0, 0, 0} and are scaled such that the mean neighbour distance is 1 +// these point sets have barycentre {0, 0, 0} and are scaled such that the mean neighbour distance is 1 -const double ptm_template_fcc[PTM_NUM_POINTS_FCC][3] = { - { 0, 0, 0 }, - { sqrt(2)/2, sqrt(2)/2, 0 }, - { 0, sqrt(2)/2, sqrt(2)/2 }, - { sqrt(2)/2, 0, sqrt(2)/2 }, - { -sqrt(2)/2, -sqrt(2)/2, 0 }, - { 0, -sqrt(2)/2, -sqrt(2)/2 }, - { -sqrt(2)/2, 0, -sqrt(2)/2 }, - { -sqrt(2)/2, sqrt(2)/2, 0 }, - { 0, -sqrt(2)/2, sqrt(2)/2 }, - { -sqrt(2)/2, 0, sqrt(2)/2 }, - { sqrt(2)/2, -sqrt(2)/2, 0 }, - { 0, sqrt(2)/2, -sqrt(2)/2 }, - { sqrt(2)/2, 0, -sqrt(2)/2 }, -}; - -const double ptm_template_hcp[PTM_NUM_POINTS_HCP][3] = { - { 0, 0, 0 }, - { 0.5, -sqrt(3)/2, 0 }, - { -1, 0, 0 }, - { -0.5, sqrt(3)/6, -sqrt(6)/3 }, - { 0.5, sqrt(3)/6, -sqrt(6)/3 }, - { 0, -sqrt(3)/3, -sqrt(6)/3 }, - { -0.5, sqrt(3)/2, 0 }, - { 0.5, sqrt(3)/2, 0 }, - { 1, 0, 0 }, - { -0.5, -sqrt(3)/2, 0 }, - { 0, -sqrt(3)/3, sqrt(6)/3 }, - { 0.5, sqrt(3)/6, sqrt(6)/3 }, - { -0.5, sqrt(3)/6, sqrt(6)/3 }, -}; - -const double ptm_template_bcc[PTM_NUM_POINTS_BCC][3] = { - { 0, 0, 0 }, - { 7*sqrt(3)/3-7./2, 7*sqrt(3)/3-7./2, 7*sqrt(3)/3-7./2 }, - { 7./2-7*sqrt(3)/3, 7*sqrt(3)/3-7./2, 7*sqrt(3)/3-7./2 }, - { 7*sqrt(3)/3-7./2, 7*sqrt(3)/3-7./2, 7./2-7*sqrt(3)/3 }, - { 7./2-7*sqrt(3)/3, 7./2-7*sqrt(3)/3, 7*sqrt(3)/3-7./2 }, - { 7*sqrt(3)/3-7./2, 7./2-7*sqrt(3)/3, 7*sqrt(3)/3-7./2 }, - { 7./2-7*sqrt(3)/3, 7*sqrt(3)/3-7./2, 7./2-7*sqrt(3)/3 }, - { 7./2-7*sqrt(3)/3, 7./2-7*sqrt(3)/3, 7./2-7*sqrt(3)/3 }, - { 7*sqrt(3)/3-7./2, 7./2-7*sqrt(3)/3, 7./2-7*sqrt(3)/3 }, - { 14*sqrt(3)/3-7, 0, 0 }, - { 7-14*sqrt(3)/3, 0, 0 }, - { 0, 14*sqrt(3)/3-7, 0 }, - { 0, 7-14*sqrt(3)/3, 0 }, - { 0, 0, 14*sqrt(3)/3-7 }, - { 0, 0, 7-14*sqrt(3)/3 }, -}; - -const double ptm_template_ico[PTM_NUM_POINTS_ICO][3] = { - { 0, 0, 0 }, - { 0, 0, 1 }, - { 0, 0, -1 }, - { -sqrt((5-sqrt(5))/10), (5+sqrt(5))/10, -sqrt(5)/5 }, - { sqrt((5-sqrt(5))/10), -(5+sqrt(5))/10, sqrt(5)/5 }, - { 0, -2*sqrt(5)/5, -sqrt(5)/5 }, - { 0, 2*sqrt(5)/5, sqrt(5)/5 }, - { sqrt((5+sqrt(5))/10), -(5-sqrt(5))/10, -sqrt(5)/5 }, - { -sqrt((5+sqrt(5))/10), (5-sqrt(5))/10, sqrt(5)/5 }, - { -sqrt((5+sqrt(5))/10), -(5-sqrt(5))/10, -sqrt(5)/5 }, - { sqrt((5+sqrt(5))/10), (5-sqrt(5))/10, sqrt(5)/5 }, - { sqrt((5-sqrt(5))/10), (5+sqrt(5))/10, -sqrt(5)/5 }, - { -sqrt((5-sqrt(5))/10), -(5+sqrt(5))/10, sqrt(5)/5 }, -}; - -const double ptm_template_sc[PTM_NUM_POINTS_SC][3] = { - { 0, 0, 0 }, - { 0, 0, -1 }, - { 0, 0, 1 }, - { 0, -1, 0 }, - { 0, 1, 0 }, - { -1, 0, 0 }, - { 1, 0, 0 }, -}; - -const double ptm_template_dcub[PTM_NUM_POINTS_DCUB][3] = { - { 0, 0, 0 }, - { 4/(sqrt(3)+6*sqrt(2)), 4/(sqrt(3)+6*sqrt(2)), 4/(sqrt(3)+6*sqrt(2)) }, - { 4/(sqrt(3)+6*sqrt(2)), -4/(sqrt(3)+6*sqrt(2)), -4/(sqrt(3)+6*sqrt(2)) }, - { -4/(sqrt(3)+6*sqrt(2)), -4/(sqrt(3)+6*sqrt(2)), 4/(sqrt(3)+6*sqrt(2)) }, - { -4/(sqrt(3)+6*sqrt(2)), 4/(sqrt(3)+6*sqrt(2)), -4/(sqrt(3)+6*sqrt(2)) }, - { 8/(sqrt(3)+6*sqrt(2)), 8/(sqrt(3)+6*sqrt(2)), 0 }, - { 0, 8/(sqrt(3)+6*sqrt(2)), 8/(sqrt(3)+6*sqrt(2)) }, - { 8/(sqrt(3)+6*sqrt(2)), 0, 8/(sqrt(3)+6*sqrt(2)) }, - { 0, -8/(sqrt(3)+6*sqrt(2)), -8/(sqrt(3)+6*sqrt(2)) }, - { 8/(sqrt(3)+6*sqrt(2)), -8/(sqrt(3)+6*sqrt(2)), 0 }, - { 8/(sqrt(3)+6*sqrt(2)), 0, -8/(sqrt(3)+6*sqrt(2)) }, - { -8/(sqrt(3)+6*sqrt(2)), -8/(sqrt(3)+6*sqrt(2)), 0 }, - { 0, -8/(sqrt(3)+6*sqrt(2)), 8/(sqrt(3)+6*sqrt(2)) }, - { -8/(sqrt(3)+6*sqrt(2)), 0, 8/(sqrt(3)+6*sqrt(2)) }, - { -8/(sqrt(3)+6*sqrt(2)), 0, -8/(sqrt(3)+6*sqrt(2)) }, - { -8/(sqrt(3)+6*sqrt(2)), 8/(sqrt(3)+6*sqrt(2)), 0 }, - { 0, 8/(sqrt(3)+6*sqrt(2)), -8/(sqrt(3)+6*sqrt(2)) }, -}; - -const double ptm_template_dhex[PTM_NUM_POINTS_DHEX][3] = { - { 0, 0, 0 }, - { -4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), -4*sqrt(3)/(3*sqrt(3)+18*sqrt(2)) }, - { 0, -8*sqrt(6)/(3*sqrt(3)+18*sqrt(2)), -4*sqrt(3)/(3*sqrt(3)+18*sqrt(2)) }, - { 4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), -4*sqrt(3)/(3*sqrt(3)+18*sqrt(2)) }, - { 0, 0, 4*sqrt(3)/(sqrt(3)+6*sqrt(2)) }, - { -8*sqrt(2)/(sqrt(3)+6*sqrt(2)), 0, 0 }, - { -4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), -16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, - { -4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(sqrt(3)+6*sqrt(2)), 0 }, - { 4*sqrt(2)/(sqrt(3)+6*sqrt(2)), -4*sqrt(6)/(sqrt(3)+6*sqrt(2)), 0 }, - { 0, -8*sqrt(6)/(3*sqrt(3)+18*sqrt(2)), -16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, - { -4*sqrt(2)/(sqrt(3)+6*sqrt(2)), -4*sqrt(6)/(sqrt(3)+6*sqrt(2)), 0 }, - { 4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), -16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, - { 4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(sqrt(3)+6*sqrt(2)), 0 }, - { 8*sqrt(2)/(sqrt(3)+6*sqrt(2)), 0, 0 }, - { 0, -8*sqrt(6)/(3*sqrt(3)+18*sqrt(2)), 16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, - { 4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), 16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, - { -4*sqrt(2)/(sqrt(3)+6*sqrt(2)), 4*sqrt(6)/(3*(sqrt(3)+6*sqrt(2))), 16*sqrt(3)/(3*(sqrt(3)+6*sqrt(2))) }, -}; - -const double ptm_template_graphene[PTM_NUM_POINTS_GRAPHENE][3] = { - { 0, 0, 0 }, - { 0, -3./11+6*sqrt(3)/11, 0 }, - { -3*sqrt(3)/22+9./11, -3*sqrt(3)/11+3./22, 0 }, - { -9./11+3*sqrt(3)/22, -3*sqrt(3)/11+3./22, 0 }, - { -9./11+3*sqrt(3)/22, -9./22+9*sqrt(3)/11, 0 }, - { -3*sqrt(3)/22+9./11, -9./22+9*sqrt(3)/11, 0 }, - { -3*sqrt(3)/11+18./11, 0, 0 }, - { -3*sqrt(3)/22+9./11, -9*sqrt(3)/11+9./22, 0 }, - { -9./11+3*sqrt(3)/22, -9*sqrt(3)/11+9./22, 0 }, - { -18./11+3*sqrt(3)/11, 0, 0 }, -}; +extern const double ptm_template_fcc[PTM_NUM_POINTS_FCC][3]; +extern const double ptm_template_hcp[PTM_NUM_POINTS_HCP][3]; +extern const double ptm_template_bcc[PTM_NUM_POINTS_BCC][3]; +extern const double ptm_template_ico[PTM_NUM_POINTS_ICO][3]; +extern const double ptm_template_sc[PTM_NUM_POINTS_SC][3]; +extern const double ptm_template_dcub[PTM_NUM_POINTS_DCUB][3]; +extern const double ptm_template_dhex[PTM_NUM_POINTS_DHEX][3]; +extern const double ptm_template_graphene[PTM_NUM_POINTS_GRAPHENE][3]; #endif From 7d85461e9798793bc2ecbc8aaba5175de05fe92b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 2 Apr 2021 16:32:25 -0400 Subject: [PATCH 215/370] Prevent compilation from breaking with Python 2 --- src/PYTHON/python_impl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 4c43ca3744..c83385410a 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -56,6 +56,8 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) nfunc = 0; pfuncs = nullptr; +#if PY_MAJOR_VERSION >= 3 +#ifndef Py_LIMITED_API // check for PYTHONUNBUFFERED environment variable const char * PYTHONUNBUFFERED = getenv("PYTHONUNBUFFERED"); @@ -64,6 +66,8 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) // Force the stdout and stderr streams to be unbuffered. Py_UnbufferedStdioFlag = 1; } +#endif +#endif // one-time initialization of Python interpreter // pyMain stores pointer to main module From af6452065fbaa5bedcb3a942115384cf8f88e2e0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 16:48:13 -0400 Subject: [PATCH 216/370] correct URL to XTC file format docs on the gromacs homepage --- doc/src/dump.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/dump.rst b/doc/src/dump.rst index c94d9a8007..a5f11a792a 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -349,7 +349,7 @@ the box size stored with the snapshot. The *xtc* style writes XTC files, a compressed trajectory format used by the GROMACS molecular dynamics package, and described -`here `_. +`here `_. The precision used in XTC files can be adjusted via the :doc:`dump_modify ` command. The default value of 1000 means that coordinates are stored to 1/1000 nanometer accuracy. XTC From 2a10b5ba69010cb7df3901876273984a9ff1bbd7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 17:21:34 -0400 Subject: [PATCH 217/370] fix bug causing segfaults --- src/domain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain.cpp b/src/domain.cpp index abf0d70079..8e666f2a45 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1826,7 +1826,7 @@ void Domain::delete_region(int iregion) // delete and move other Regions down in list one slot delete regions[iregion]; - for (int i = iregion+1; iregion < nregion; ++i) + for (int i = iregion+1; i < nregion; ++i) regions[i-1] = regions[i]; nregion--; } From abfe8bab5915d833fa88c274ce221dbc8612f7dc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 17:32:29 -0400 Subject: [PATCH 218/370] fix uninitialized memory access issues. consolidate enumerators. --- src/GRANULAR/fix_wall_gran.cpp | 45 ++++++++++++++------------- src/GRANULAR/fix_wall_gran.h | 4 +++ src/GRANULAR/fix_wall_gran_region.cpp | 33 +++++++++----------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 5e8d568b7a..2efc189e6d 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -17,29 +17,25 @@ ------------------------------------------------------------------------- */ #include "fix_wall_gran.h" -#include -#include + #include "atom.h" #include "domain.h" -#include "update.h" +#include "error.h" #include "force.h" -#include "modify.h" -#include "respa.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "modify.h" #include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -// XYZ PLANE need to be 0,1,2 - -enum{XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; -enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR}; -enum{NONE,CONSTANT,EQUAL}; - #define PI27SQ 266.47931882941264802866 // 27*PI**2 #define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) #define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) @@ -48,18 +44,20 @@ enum{NONE,CONSTANT,EQUAL}; #define THREEQUARTERS 0.75 // 3/4 #define TWOPI 6.28318530717959 // 2*PI -#define EPSILON 1e-10 - -enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; - #define BIG 1.0e20 #define EPSILON 1e-10 +// XYZ PLANE need to be 0,1,2 + +enum {XPLANE=0,YPLANE=1,ZPLANE=2,ZCYLINDER,REGION}; + +enum {NONE,CONSTANT,EQUAL}; +enum {DAMPING_NONE, VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; +enum {TANGENTIAL_NONE, TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE}; +enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; +enum {ROLL_NONE, ROLL_SDS}; + /* ---------------------------------------------------------------------- */ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : @@ -84,6 +82,10 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : use_history = restart_peratom = 1; if (pairstyle == HOOKE) use_history = restart_peratom = 0; + tangential_history = roll_history = twist_history = 0; + normal_model = NORMAL_NONE; + tangential_model = TANGENTIAL_NONE; + damping_model = DAMPING_NONE; // wall/particle coefficients @@ -120,7 +122,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : iarg = 4; damping_model = VISCOELASTIC; roll_model = twist_model = NONE; - tangential_history = roll_history = twist_history = 0; while (iarg < narg) { if (strcmp(arg[iarg], "hooke") == 0) { if (iarg + 2 >= narg) diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index a81a4c787c..bf4797e960 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -26,6 +26,10 @@ namespace LAMMPS_NS { class FixWallGran : public Fix { public: + + enum {HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR}; + enum {NORMAL_NONE, NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; + FixWallGran(class LAMMPS *, int, char **); virtual ~FixWallGran(); int setmask(); diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 5e670a0a07..b051fbea57 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -16,26 +16,21 @@ ------------------------------------------------------------------------- */ #include "fix_wall_gran_region.h" -#include -#include "region.h" + #include "atom.h" -#include "domain.h" -#include "update.h" -#include "memory.h" -#include "error.h" #include "comm.h" +#include "domain.h" +#include "error.h" +#include "memory.h" #include "neighbor.h" +#include "region.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; -// same as FixWallGran - -enum{HOOKE,HOOKE_HISTORY,HERTZ_HISTORY,GRANULAR}; -enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; - -#define BIG 1.0e20 - /* ---------------------------------------------------------------------- */ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : @@ -186,7 +181,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (mask[i] & groupbit) { if (!region->match(x[i][0],x[i][1],x[i][2])) continue; - if (pairstyle == GRANULAR && normal_model == JKR) { + if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { nc = region->surface(x[i][0],x[i][1],x[i][2], radius[i]+pulloff_distance(radius[i])); } @@ -228,7 +223,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) rsq = region->contact[ic].r*region->contact[ic].r; - if (pairstyle == GRANULAR && normal_model == JKR) { + if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i]*radius[i]) { for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; @@ -264,18 +259,18 @@ void FixWallGranRegion::post_force(int /*vflag*/) else contact = nullptr; - if (pairstyle == HOOKE) + if (pairstyle == FixWallGran::HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], omega[i],torque[i],radius[i],meff, contact); - else if (pairstyle == HOOKE_HISTORY) + else if (pairstyle == FixWallGran::HOOKE_HISTORY) hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i], omega[i],torque[i],radius[i],meff, history_many[i][c2r[ic]], contact); - else if (pairstyle == HERTZ_HISTORY) + else if (pairstyle == FixWallGran::HERTZ_HISTORY) hertz_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius, v[i],f[i],omega[i],torque[i], radius[i],meff,history_many[i][c2r[ic]], contact); - else if (pairstyle == GRANULAR) + else if (pairstyle == FixWallGran::GRANULAR) granular(rsq,dx,dy,dz,vwall,region->contact[ic].radius, v[i],f[i],omega[i],torque[i], radius[i],meff,history_many[i][c2r[ic]],contact); From 2c00136f2219760e961baaa2604cc1f3bab849b2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 17:49:15 -0400 Subject: [PATCH 219/370] used correct suffix when installing plugin binaries for testing --- unittest/commands/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unittest/commands/CMakeLists.txt b/unittest/commands/CMakeLists.txt index a658c8a25d..7cd2687fb7 100644 --- a/unittest/commands/CMakeLists.txt +++ b/unittest/commands/CMakeLists.txt @@ -11,13 +11,13 @@ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND PKG_PLUGIN) -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - BUILD_BYPRODUCTS /morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} - /nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} - /helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS /morse2plugin${CMAKE_SHARED_MODULE_SUFFIX} + /nve2plugin${CMAKE_SHARED_MODULE_SUFFIX} + /helloplugin${CMAKE_SHARED_MODULE_SUFFIX} INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different - /morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} - /nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX} - /helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX} + /morse2plugin${CMAKE_SHARED_MODULE_SUFFIX} + /nve2plugin${CMAKE_SHARED_MODULE_SUFFIX} + /helloplugin${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR} TEST_COMMAND "") endif() From 51212e62d968f441a94bafcc5ee3f59385d99498 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 19:55:53 -0400 Subject: [PATCH 220/370] correct/update docs and parameter names for finding neighbor lists --- python/lammps/core.py | 64 ++++++++++++++++++++++++++++--------------- python/lammps/data.py | 2 +- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 3118cb3d99..823175e65a 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1721,17 +1721,23 @@ class lammps(object): # ------------------------------------------------------------------------- - def find_pair_neighlist(self, style, exact=True, nsub=0, request=0): + def find_pair_neighlist(self, style, exact=True, nsub=0, reqid=0): """Find neighbor list index of pair style neighbor list - Try finding pair instance that matches style. If exact is set, the pair must - match style exactly. If exact is 0, style must only be contained. If pair is - of style pair/hybrid, style is instead matched the nsub-th hybrid sub-style. + Search for a neighbor list requested by a pair style instance that + matches "style". If exact is True, the pair style name must match + exactly. If exact is False, the pair style name is matched against + "style" as regular expression or substring. If the pair style is a + hybrid pair style, the style is instead matched against the hybrid + sub-styles. If the same pair style is used as substyle multiple + types, you must set nsub to a value n > 0 which indicates the nth + instance of that sub-style to be used (same as for the pair_coeff + command). The default value of 0 will fail to match in that case. - Once the pair instance has been identified, multiple neighbor list requests - may be found. Every neighbor list is uniquely identified by its request - index. Thus, providing this request index ensures that the correct neighbor - list index is returned. + Once the pair style instance has been identified, it may have + requested multiple neighbor lists. Those are uniquely identified by + a request ID > 0 as set by the pair style. Otherwise the request + ID is 0. :param style: name of pair style that should be searched for :type style: string @@ -1739,44 +1745,58 @@ class lammps(object): :type exact: bool, optional :param nsub: match nsub-th hybrid sub-style, defaults to 0 :type nsub: int, optional - :param request: index of neighbor list request, in case there are more than one, defaults to 0 - :type request: int, optional + :param reqid: list request id, > 0 in case there are more than one, defaults to 0 + :type reqid: int, optional :return: neighbor list index if found, otherwise -1 :rtype: int - """ + + """ style = style.encode() exact = int(exact) - idx = self.lib.lammps_find_pair_neighlist(self.lmp, style, exact, nsub, request) + idx = self.lib.lammps_find_pair_neighlist(self.lmp, style, exact, nsub, reqid) return idx # ------------------------------------------------------------------------- - def find_fix_neighlist(self, fixid, request=0): + def find_fix_neighlist(self, fixid, reqid=0): """Find neighbor list index of fix neighbor list + The fix instance requesting the neighbor list is uniquely identified + by the fix ID. In case the fix has requested multiple neighbor + lists, those are uniquely identified by a request ID > 0 as set by + the fix. Otherwise the request ID is 0 (the default). + :param fixid: name of fix :type fixid: string - :param request: index of neighbor list request, in case there are more than one, defaults to 0 - :type request: int, optional + :param reqid: id of neighbor list request, in case there are more than one request, defaults to 0 + :type reqid: int, optional :return: neighbor list index if found, otherwise -1 :rtype: int - """ + + """ fixid = fixid.encode() - idx = self.lib.lammps_find_fix_neighlist(self.lmp, fixid, request) + idx = self.lib.lammps_find_fix_neighlist(self.lmp, fixid, reqid) return idx # ------------------------------------------------------------------------- - def find_compute_neighlist(self, computeid, request=0): + def find_compute_neighlist(self, computeid, reqid=0): """Find neighbor list index of compute neighbor list + The compute instance requesting the neighbor list is uniquely + identified by the compute ID. In case the compute has requested + multiple neighbor lists, those are uniquely identified by a request + ID > 0 as set by the compute. Otherwise the request ID is 0 (the + default). + :param computeid: name of compute :type computeid: string - :param request: index of neighbor list request, in case there are more than one, defaults to 0 - :type request: int, optional + :param reqid: index of neighbor list request, in case there are more than one request, defaults to 0 + :type reqid: int, optional :return: neighbor list index if found, otherwise -1 :rtype: int - """ + + """ computeid = computeid.encode() - idx = self.lib.lammps_find_compute_neighlist(self.lmp, computeid, request) + idx = self.lib.lammps_find_compute_neighlist(self.lmp, computeid, reqid) return idx diff --git a/python/lammps/data.py b/python/lammps/data.py index 2cf100ed82..1613936ddf 100644 --- a/python/lammps/data.py +++ b/python/lammps/data.py @@ -52,7 +52,7 @@ class NeighList: def get(self, element): """ - :return: tuple with atom local index, numpy array of neighbor local atom indices + :return: tuple with atom local index, number of neighbors and ctypes pointer to neighbor's local atom indices :rtype: (int, int, ctypes.POINTER(c_int)) """ iatom, numneigh, neighbors = self.lmp.get_neighlist_element_neighbors(self.idx, element) From c74bb9b56bfcce915287937af8c4dcf27cca3eee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 21:00:26 -0400 Subject: [PATCH 221/370] add more unit tests for neighbor list access --- unittest/python/CMakeLists.txt | 1 + unittest/python/python-commands.py | 230 ++++++++++++++++++++++++++--- 2 files changed, 209 insertions(+), 22 deletions(-) diff --git a/unittest/python/CMakeLists.txt b/unittest/python/CMakeLists.txt index d1db17c941..b51d6e340a 100644 --- a/unittest/python/CMakeLists.txt +++ b/unittest/python/CMakeLists.txt @@ -28,6 +28,7 @@ endif() if(Python_EXECUTABLE) # prepare to augment the environment so that the LAMMPS python module and the shared library is found. set(PYTHON_TEST_ENVIRONMENT PYTHONPATH=${LAMMPS_PYTHON_DIR}:$ENV{PYTHONPATH}) + list(APPEND PYTHON_TEST_ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") if(APPLE) list(APPEND PYTHON_TEST_ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}:$ENV{DYLD_LIBRARY_PATH};LAMMPS_CMAKE_CACHE=${CMAKE_BINARY_DIR}/CMakeCache.txt") else() diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 3661feb8a0..1c388460d1 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -1,6 +1,17 @@ import sys,os,unittest -from lammps import lammps, LMP_VAR_ATOM +from lammps import lammps, LMP_VAR_ATOM, LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR + +has_manybody=False +try: + machine=None + if 'LAMMPS_MACHINE_NAME' in os.environ: + machine=os.environ['LAMMPS_MACHINE_NAME'] + lmp=lammps(name=machine) + has_manybody = lmp.has_style("pair","sw") + lmp.close() +except: + pass class PythonCommand(unittest.TestCase): @@ -85,35 +96,34 @@ create_atoms 1 single & natoms = self.lmp.get_natoms() self.assertEqual(natoms,2) - def testNeighborList(self): - self.lmp.command("units lj") - self.lmp.command("atom_style atomic") - self.lmp.command("atom_modify map array") - self.lmp.command("boundary f f f") - self.lmp.command("region box block 0 2 0 2 0 2") - self.lmp.command("create_box 1 box") - - x = [ - 1.0, 1.0, 1.0, - 1.0, 1.0, 1.5 - ] + def testNeighborListSimple(self): + self.lmp.commands_string(""" + units lj + atom_style atomic + atom_modify map array + boundary f f f + region box block 0 2 0 2 0 2 + create_box 1 box""") + x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 ] types = [1, 1] self.assertEqual(self.lmp.create_atoms(2, id=None, type=types, x=x), 2) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 2) - self.lmp.command("mass 1 1.0") - self.lmp.command("velocity all create 3.0 87287") - self.lmp.command("pair_style lj/cut 2.5") - self.lmp.command("pair_coeff 1 1 1.0 1.0 2.5") - self.lmp.command("neighbor 0.1 bin") - self.lmp.command("neigh_modify every 20 delay 0 check no") + self.lmp.commands_string(""" + mass 1 1.0 + velocity all create 3.0 87287 + pair_style lj/cut 2.5 + pair_coeff 1 1 1.0 1.0 2.5 + neighbor 0.1 bin + neigh_modify every 20 delay 0 check no + run 0 post no""") - self.lmp.command("run 0") - - self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"), 0) + idx = self.lmp.find_pair_neighlist("lj/cut") + self.assertEqual(0, 0) + self.assertEqual(self.lmp.find_pair_neighlist("morse"), -1) nlist = self.lmp.get_neighlist(0) self.assertEqual(len(nlist), 2) atom_i, numneigh_i, neighbors_i = nlist[0] @@ -127,6 +137,182 @@ create_atoms 1 single & self.assertEqual(1, neighbors_i[0]) + def testNeighborListHalf(self): + self.lmp.commands_string(""" + boundary f f f + units real + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style lj/cut 4.0 + pair_coeff 1 1 0.2 2.0 + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"),0) + nlist = self.lmp.get_neighlist(0) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(num,nlocal-1-i) + + @unittest.skipIf(not has_manybody,"Full neighbor list test for manybody potential") + def testNeighborListFull(self): + self.lmp.commands_string(""" + boundary f f f + units metal + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style sw + pair_coeff * * Si.sw Si + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + self.assertEqual(self.lmp.find_pair_neighlist("sw"),0) + nlist = self.lmp.get_neighlist(0) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(num,nlocal-1) + + @unittest.skipIf(not has_manybody,"Hybrid neighbor list test for manybody potential") + def testNeighborListHybrid(self): + self.lmp.commands_string(""" + boundary f f f + units metal + region box block -5 5 -5 5 -5 5 + create_box 2 box + mass * 1.0 + pair_style hybrid/overlay morse 4.0 lj/cut 4.0 lj/cut 4.0 sw + pair_coeff * * sw Si.sw Si NULL + pair_coeff 1 2 morse 0.2 2.0 2.0 + pair_coeff 2 2 lj/cut 1 0.1 2.0 + pair_coeff * * lj/cut 2 0.01 2.0 + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 2, 2, 2] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + # valid and invalid lookups + self.assertNotEqual(self.lmp.find_pair_neighlist("sw"),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("morse"),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut",nsub=1),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut",nsub=2),-1) + self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) + self.assertEqual(self.lmp.find_pair_neighlist("hybrid/overlay"),-1) + self.assertNotEqual(self.lmp.get_neighlist(4).size,0) + self.assertEqual(self.lmp.get_neighlist(5).size,-1) + + # full neighbor list for 4 type 1 atoms + # all have 3 type 1 atom neighbors + nlist = self.lmp.get_neighlist(self.lmp.find_pair_neighlist("sw")) + self.assertEqual(nlist.size, 4) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(num,3) + + # half neighbor list for all pairs between type 1 and type 2 + # 4 type 1 atoms with 3 type 2 neighbors and 3 type 2 atoms without neighbors + nlist = self.lmp.get_neighlist(self.lmp.find_pair_neighlist("morse")) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + if (i < 4): self.assertEqual(num,3) + else: self.assertEqual(num,0) + + # half neighbor list between type 2 atoms only + # 3 pairs with 2, 1, 0 neighbors + nlist = self.lmp.get_neighlist(self.lmp.find_pair_neighlist("lj/cut",nsub=1)) + self.assertEqual(nlist.size, 3) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(num,2-i) + + # half neighbor list between all pairs. same as simple lj/cut case + nlist = self.lmp.get_neighlist(self.lmp.find_pair_neighlist("lj/cut",nsub=2)) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(num,nlocal-1-i) + + def testNeighborListCompute(self): + self.lmp.commands_string(""" + boundary f f f + units real + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style lj/cut 4.0 + pair_coeff 1 1 0.2 2.0 + compute dist all pair/local dist + fix dist all ave/histo 1 1 1 0.0 3.0 4 c_dist mode vector + thermo_style custom f_dist[*] + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + # check compute data from histogram summary + nhisto = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=0) + nskip = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=1) + minval = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=2) + maxval = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=3) + # 21 pair distances counted, none skipped, smallest 1.0, largest 2.1 + self.assertEqual(nhisto,21) + self.assertEqual(nskip,0) + self.assertEqual(minval,1.0) + self.assertEqual(maxval,2.1) + + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) + self.assertNotEqual(self.lmp.find_compute_neighlist("dist"),-1) + + # the compute has a half neighbor list + nlist = self.lmp.get_neighlist(self.lmp.find_compute_neighlist("dist")) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, num, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(num,nlocal-1-i) + def test_extract_box_non_periodic(self): self.lmp.command("boundary f f f") self.lmp.command("region box block 0 2 0 2 0 2") From 7e70def4cc64d704866735e6ffbc59448f62e18b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 21:00:42 -0400 Subject: [PATCH 222/370] fix errors/typos in manual --- doc/src/Python_module.rst | 2 +- doc/src/fix_ave_histo.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/Python_module.rst b/doc/src/Python_module.rst index d2564986de..c19d4b0345 100644 --- a/doc/src/Python_module.rst +++ b/doc/src/Python_module.rst @@ -142,7 +142,7 @@ Style Constants Type Constants -------------- -.. py:data:: LMP_TYPE_SCALAR, LMP_TYLE_VECTOR, LMP_TYPE_ARRAY, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS +.. py:data:: LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS :type: int Constants in the :py:mod:`lammps` module to select what type of data diff --git a/doc/src/fix_ave_histo.rst b/doc/src/fix_ave_histo.rst index d50112ac48..3a2857f383 100644 --- a/doc/src/fix_ave_histo.rst +++ b/doc/src/fix_ave_histo.rst @@ -138,8 +138,8 @@ vector or columns of the array had been listed one by one. E.g. these .. code-block:: LAMMPS compute myCOM all com/chunk - fix 1 all ave/histo 100 1 100 c_myCOM[*] file tmp1.com mode vector - fix 2 all ave/histo 100 1 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector + fix 1 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[*] file tmp1.com mode vector + fix 2 all ave/histo 100 1 100 -10.0 10.0 100 c_myCOM[1] c_myCOM[2] c_myCOM[3] file tmp2.com mode vector If the fix ave/histo/weight command is used, exactly two values must be specified. If the values are vectors, they must be the same From 85a5698c1b93d22c5e29de49dcc4fe66518945cf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 21:40:45 -0400 Subject: [PATCH 223/370] add find method to neighbor list wrapper classes --- python/lammps/data.py | 19 +++++++++++++++++++ python/lammps/numpy_wrapper.py | 17 +++++++++++++++++ unittest/python/python-commands.py | 13 +++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/python/lammps/data.py b/python/lammps/data.py index 1613936ddf..892d628356 100644 --- a/python/lammps/data.py +++ b/python/lammps/data.py @@ -52,6 +52,8 @@ class NeighList: def get(self, element): """ + Access a specific neighbor list entry. "element" must be a number from 0 to the size-1 of the list + :return: tuple with atom local index, number of neighbors and ctypes pointer to neighbor's local atom indices :rtype: (int, int, ctypes.POINTER(c_int)) """ @@ -71,3 +73,20 @@ class NeighList: for ii in range(inum): yield self.get(ii) + + def find(self, iatom): + """ + Find the neighbor list for a specific (local) atom iatom. + If there is no list for iatom, (-1, None) is returned. + + :return: tuple with number of neighbors and ctypes pointer to neighbor's local atom indices + :rtype: (int, ctypes.POINTER(c_int)) + """ + + inum = self.size + for ii in range(inum): + idx, numneigh, neighbors = self.get(ii) + if idx == iatom: + return numneigh, neighbors + + return -1, None diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index ce64d68c90..1ecaf3163b 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -331,8 +331,25 @@ class NumPyNeighList(NeighList): def get(self, element): """ + Access a specific neighbor list entry. "element" must be a number from 0 to the size-1 of the list + :return: tuple with atom local index, numpy array of neighbor local atom indices :rtype: (int, numpy.array) """ iatom, neighbors = self.lmp.numpy.get_neighlist_element_neighbors(self.idx, element) return iatom, neighbors + + def find(self, iatom): + """ + Find the neighbor list for a specific (local) atom iatom. + If there is no list for iatom, None is returned. + + :return: numpy array of neighbor local atom indices + :rtype: numpy.array or None + """ + inum = self.size + for ii in range(inum): + idx, neighbors = self.get(ii) + if idx == iatom: + return neighbors + return None diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 1c388460d1..530cea8b13 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -122,9 +122,9 @@ create_atoms 1 single & run 0 post no""") idx = self.lmp.find_pair_neighlist("lj/cut") - self.assertEqual(0, 0) + self.assertNotEqual(idx, -1) self.assertEqual(self.lmp.find_pair_neighlist("morse"), -1) - nlist = self.lmp.get_neighlist(0) + nlist = self.lmp.get_neighlist(idx) self.assertEqual(len(nlist), 2) atom_i, numneigh_i, neighbors_i = nlist[0] atom_j, numneigh_j, _ = nlist[1] @@ -167,6 +167,15 @@ create_atoms 1 single & self.assertEqual(idx,i) self.assertEqual(num,nlocal-1-i) + # look up neighbor list by atom index + num, neighs = nlist.find(2) + self.assertEqual(num,4) + self.assertIsNotNone(neighs,None) + # this one will fail + num, neighs = nlist.find(10) + self.assertEqual(num,-1) + self.assertIsNone(neighs,None) + @unittest.skipIf(not has_manybody,"Full neighbor list test for manybody potential") def testNeighborListFull(self): self.lmp.commands_string(""" From d3b2ccf9dd5b6f0f6265db73b12b5e6115cfd80f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 21:41:26 -0400 Subject: [PATCH 224/370] numpy version of neighbor list tests --- unittest/python/python-numpy.py | 237 +++++++++++++++++++++++++++++--- 1 file changed, 215 insertions(+), 22 deletions(-) diff --git a/unittest/python/python-numpy.py b/unittest/python/python-numpy.py index 9f1d5f12c8..f3a116b91b 100644 --- a/unittest/python/python-numpy.py +++ b/unittest/python/python-numpy.py @@ -4,6 +4,17 @@ from lammps import lammps, LAMMPS_INT, LMP_STYLE_GLOBAL, LMP_STYLE_LOCAL, \ LMP_VAR_ATOM from ctypes import c_void_p +has_manybody=False +try: + machine=None + if 'LAMMPS_MACHINE_NAME' in os.environ: + machine=os.environ['LAMMPS_MACHINE_NAME'] + lmp=lammps(name=machine) + has_manybody = lmp.has_style("pair","sw") + lmp.close() +except: + pass + try: import numpy NUMPY_INSTALLED = True @@ -137,36 +148,34 @@ class PythonNumpy(unittest.TestCase): self.assertTrue((x[1] == (1.0, 1.0, 1.5)).all()) self.assertEqual(len(v), 2) - def testNeighborList(self): - self.lmp.command("units lj") - self.lmp.command("atom_style atomic") - self.lmp.command("atom_modify map array") - self.lmp.command("boundary f f f") - self.lmp.command("region box block 0 2 0 2 0 2") - self.lmp.command("create_box 1 box") - - x = [ - 1.0, 1.0, 1.0, - 1.0, 1.0, 1.5 - ] + def testNeighborListSimple(self): + self.lmp.commands_string(""" + units lj + atom_style atomic + atom_modify map array + boundary f f f + region box block 0 2 0 2 0 2 + create_box 1 box""") + x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 ] types = [1, 1] self.assertEqual(self.lmp.create_atoms(2, id=None, type=types, x=x), 2) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 2) - self.lmp.command("mass 1 1.0") - self.lmp.command("velocity all create 3.0 87287") - self.lmp.command("pair_style lj/cut 2.5") - self.lmp.command("pair_coeff 1 1 1.0 1.0 2.5") - self.lmp.command("neighbor 0.1 bin") - self.lmp.command("neigh_modify every 20 delay 0 check no") + self.lmp.commands_string(""" + mass 1 1.0 + velocity all create 3.0 87287 + pair_style lj/cut 2.5 + pair_coeff 1 1 1.0 1.0 2.5 + neighbor 0.1 bin + neigh_modify every 20 delay 0 check no + run 0 post no""") - self.lmp.command("run 0") - - self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"), 0) - nlist = self.lmp.numpy.get_neighlist(0) + idx = self.lmp.find_pair_neighlist("lj/cut") + self.assertNotEqual(idx, -1) + nlist = self.lmp.numpy.get_neighlist(idx) self.assertEqual(len(nlist), 2) atom_i, neighbors_i = nlist[0] atom_j, neighbors_j = nlist[1] @@ -180,6 +189,190 @@ class PythonNumpy(unittest.TestCase): self.assertIn(1, neighbors_i) self.assertNotIn(0, neighbors_j) + def testNeighborListHalf(self): + self.lmp.commands_string(""" + boundary f f f + units real + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style lj/cut 4.0 + pair_coeff 1 1 0.2 2.0 + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"),0) + nlist = self.lmp.numpy.get_neighlist(0) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(neighs.size,nlocal-1-i) + + # look up neighbor list by atom index + neighs = nlist.find(2) + self.assertEqual(neighs.size,4) + self.assertIsNotNone(neighs,None) + # this one will fail + neighs = nlist.find(10) + self.assertIsNone(neighs,None) + + @unittest.skipIf(not has_manybody,"Full neighbor list test for manybody potential") + def testNeighborListFull(self): + self.lmp.commands_string(""" + boundary f f f + units metal + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style sw + pair_coeff * * Si.sw Si + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + self.assertEqual(self.lmp.find_pair_neighlist("sw"),0) + nlist = self.lmp.numpy.get_neighlist(0) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(neighs.size,nlocal-1) + + @unittest.skipIf(not has_manybody,"Hybrid neighbor list test for manybody potential") + def testNeighborListHybrid(self): + self.lmp.commands_string(""" + boundary f f f + units metal + region box block -5 5 -5 5 -5 5 + create_box 2 box + mass * 1.0 + pair_style hybrid/overlay morse 4.0 lj/cut 4.0 lj/cut 4.0 sw + pair_coeff * * sw Si.sw Si NULL + pair_coeff 1 2 morse 0.2 2.0 2.0 + pair_coeff 2 2 lj/cut 1 0.1 2.0 + pair_coeff * * lj/cut 2 0.01 2.0 + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 2, 2, 2] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + + # valid and invalid lookups + self.assertNotEqual(self.lmp.find_pair_neighlist("sw"),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("morse"),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut",nsub=1),-1) + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut",nsub=2),-1) + self.assertEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) + self.assertEqual(self.lmp.find_pair_neighlist("hybrid/overlay"),-1) + self.assertNotEqual(self.lmp.numpy.get_neighlist(4).size,0) + self.assertEqual(self.lmp.numpy.get_neighlist(5).size,-1) + + # full neighbor list for 4 type 1 atoms + # all have 3 type 1 atom neighbors + nlist = self.lmp.numpy.get_neighlist(self.lmp.find_pair_neighlist("sw")) + self.assertEqual(nlist.size, 4) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(neighs.size,3) + + # half neighbor list for all pairs between type 1 and type 2 + # 4 type 1 atoms with 3 type 2 neighbors and 3 type 2 atoms without neighbors + nlist = self.lmp.numpy.get_neighlist(self.lmp.find_pair_neighlist("morse")) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + if (i < 4): self.assertEqual(neighs.size,3) + else: self.assertEqual(neighs.size,0) + + # half neighbor list between type 2 atoms only + # 3 pairs with 2, 1, 0 neighbors + nlist = self.lmp.numpy.get_neighlist(self.lmp.find_pair_neighlist("lj/cut",nsub=1)) + self.assertEqual(nlist.size, 3) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(neighs.size,2-i) + + # half neighbor list between all pairs. same as simple lj/cut case + nlist = self.lmp.numpy.get_neighlist(self.lmp.find_pair_neighlist("lj/cut",nsub=2)) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(neighs.size,nlocal-1-i) + + def testNeighborListCompute(self): + self.lmp.commands_string(""" + boundary f f f + units real + region box block -5 5 -5 5 -5 5 + create_box 1 box + mass 1 1.0 + pair_style lj/cut 4.0 + pair_coeff 1 1 0.2 2.0 + compute dist all pair/local dist + fix dist all ave/histo 1 1 1 0.0 3.0 4 c_dist mode vector + thermo_style custom f_dist[*] + """) + x = [ 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, + 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0 ] + tags = [1, 2, 3, 4, 5, 6, 7] + types = [1, 1, 1, 1, 1, 1, 1] + + self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + nlocal = self.lmp.extract_global("nlocal") + self.assertEqual(nlocal, 7) + + self.lmp.command("run 0 post no") + # check compute data from histogram summary + nhisto = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=0) + nskip = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=1) + minval = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=2) + maxval = self.lmp.extract_fix("dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,nrow=3) + # 21 pair distances counted, none skipped, smallest 1.0, largest 2.1 + self.assertEqual(nhisto,21) + self.assertEqual(nskip,0) + self.assertEqual(minval,1.0) + self.assertEqual(maxval,2.1) + + self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) + self.assertNotEqual(self.lmp.find_compute_neighlist("dist"),-1) + + # the compute has a half neighbor list + nlist = self.lmp.numpy.get_neighlist(self.lmp.find_compute_neighlist("dist")) + self.assertEqual(nlist.size, 7) + for i in range(0,nlist.size): + idx, neighs = nlist.get(i) + self.assertEqual(idx,i) + self.assertEqual(neighs.size,nlocal-1-i) + def test_extract_variable_equalstyle(self): self.lmp.command("variable a equal 100") a = self.lmp.numpy.extract_variable("a") From 678302bfcb33486ea6cf1320538b203796e02306 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 2 Apr 2021 22:08:39 -0400 Subject: [PATCH 225/370] avoid a floating point exception in RanMars::rayleigh() from taking log(0) --- src/random_mars.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/random_mars.cpp b/src/random_mars.cpp index 621d7d3008..78c6f93ba4 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -136,13 +136,16 @@ double RanMars::gaussian(double mu, double sigma) double RanMars::rayleigh(double sigma) { - double first,v1; + double v1; - if (sigma <= 0) error->all(FLERR,"Invalid Rayleigh parameter"); + if (sigma <= 0.0) error->all(FLERR,"Invalid Rayleigh parameter"); v1 = uniform(); - first = sigma*sqrt(-2.0*log(v1)); - return first; + // avoid a floating point exception due to log(0.0) + // and just return a very big number + if (v1 == 0.0) return 1.0e300; + + return sigma*sqrt(-2.0*log(v1)); } /* ---------------------------------------------------------------------- From b1faf17eeb4ee978e25a034f4804afdf176c2f46 Mon Sep 17 00:00:00 2001 From: Dan Bolintineanu Date: Sat, 3 Apr 2021 00:48:00 -0600 Subject: [PATCH 226/370] Updates fix wall/gran to mirror recent updates to pair granular. Also some minor changes related to the limit_damping option --- doc/src/pair_gran.rst | 4 +- doc/src/pair_granular.rst | 2 +- src/GRANULAR/fix_wall_gran.cpp | 174 ++- src/GRANULAR/pair_gran_hooke_history.cpp | 6 +- src/GRANULAR/pair_granular.cpp | 31 +- src/GRANULAR/pair_granular_corrected.cpp | 1821 ++++++++++++++++++++++ 6 files changed, 1968 insertions(+), 70 deletions(-) create mode 100644 src/GRANULAR/pair_granular_corrected.cpp diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index b918e38da6..7d6189fda1 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -36,7 +36,7 @@ Syntax * xmu = static yield criterion (unitless value between 0.0 and 1.0e4) * dampflag = 0 or 1 if tangential damping force is excluded or included -* keyword = *no_attraction* +* keyword = *limit_damping* .. parsed-literal:: @@ -61,6 +61,8 @@ Examples pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 1 pair_style gran/hooke 200000.0 70000.0 50.0 30.0 0.5 0 + pair_style gran/hooke 200000.0 70000.0 50.0 30.0 0.5 0 limit_damping + Description """"""""""" diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 04c9d45afd..e0a33f31d0 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -24,7 +24,7 @@ Examples pair_coeff * * hooke 1000.0 50.0 tangential linear_history 500.0 1.0 0.4 damping mass_velocity pair_style granular - pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 + pair_coeff * * hertz 1000.0 50.0 tangential mindlin 1000.0 1.0 0.4 limit_damping pair_style granular pair_coeff * * hertz/material 1e8 0.3 0.3 tangential mindlin_rescale NULL 1.0 0.4 damping tsuji diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index c9d00ccdd3..1d27e21162 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -53,7 +53,8 @@ enum{NONE,CONSTANT,EQUAL}; enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE}; + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; enum {ROLL_NONE, ROLL_SDS}; @@ -216,7 +217,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : iarg += 4; } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || (strcmp(arg[iarg+1], "mindlin") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale") == 0)) { + (strcmp(arg[iarg+1], "mindlin_rescale") == 0) || + (strcmp(arg[iarg+1], "mindlin/force") == 0) || + (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0)) { if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for tangential model"); @@ -226,8 +229,14 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : tangential_model = TANGENTIAL_MINDLIN; else if (strcmp(arg[iarg+1], "mindlin_rescale") == 0) tangential_model = TANGENTIAL_MINDLIN_RESCALE; + else if (strcmp(arg[iarg+1], "mindlin/force") == 0) + tangential_model = TANGENTIAL_MINDLIN_FORCE; + else if (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0) + tangential_model = TANGENTIAL_MINDLIN_RESCALE_FORCE; if ((tangential_model == TANGENTIAL_MINDLIN || - tangential_model == TANGENTIAL_MINDLIN_RESCALE) && + tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) && (strcmp(arg[iarg+2], "NULL") == 0)) { if (normal_model == NORMAL_HERTZ || normal_model == NORMAL_HOOKE) { error->all(FLERR, "NULL setting for Mindlin tangential " @@ -306,14 +315,20 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } } size_history = 3*tangential_history + 3*roll_history + twist_history; + //Unlike the pair style, the wall style does not have a 'touch' + //array. Hence, an additional entry in the history is used to + //determine if particles previously contacted for JKR cohesion purposes. if (normal_model == JKR) size_history += 1; - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE) size_history += 1; + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) size_history += 1; } - if(normal_model == JKR) - error->all(FLERR,"Cannot limit damping with JRK model"); - if(normal_model == DMT) - error->all(FLERR,"Cannot limit damping with DMT model"); + if (limit_damping and normal_model == JKR) + error->all(FLERR,"Illegal pair_coeff command, " + "cannot limit damping with JRK model"); + if (limit_damping and normal_model == DMT) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with DMT model"); // wallstyle args @@ -509,7 +524,8 @@ void FixWallGran::init() roll_history_index += 1; twist_history_index += 1; } - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE) { + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { roll_history_index += 1; twist_history_index += 1; } @@ -1120,7 +1136,8 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, double signtwist, magtwist, magtortwist, Mtcrit; double tortwist1, tortwist2, tortwist3; - double shrmag,rsht; + double shrmag,rsht,prjmag; + bool frameupdate; r = sqrt(rsq); E = normal_coeffs[0]; @@ -1195,12 +1212,18 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(limit_damping and Fntot < 0.0) Fntot = 0.0; + if (limit_damping and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects //**************************************** + // For linear, mindlin, mindlin_rescale: + // history = cumulative tangential displacement + // + // For mindlin/force, mindlin_rescale/force: + // history = cumulative tangential elastic force + // tangential component vt1 = vr1 - vn1; vt2 = vr2 - vn2; @@ -1242,69 +1265,115 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, int thist2 = thist1 + 1; if (tangential_history) { - if (tangential_model == TANGENTIAL_MINDLIN) { + if (tangential_model == TANGENTIAL_MINDLIN || + tangential_model == TANGENTIAL_MINDLIN_FORCE) { k_tangential *= a; } - else if (tangential_model == TANGENTIAL_MINDLIN_RESCALE) { + else if (tangential_model == + TANGENTIAL_MINDLIN_RESCALE || + tangential_model == + TANGENTIAL_MINDLIN_RESCALE_FORCE){ k_tangential *= a; - if (a < history[3]) { //On unloading, rescale the shear displacements + // on unloading, rescale the shear displacements/force + if (a < history[thist2+1]) { double factor = a/history[thist2+1]; history[thist0] *= factor; history[thist1] *= factor; history[thist2] *= factor; } } - shrmag = sqrt(history[thist0]*history[thist0] + - history[thist1]*history[thist1] + - history[thist2]*history[thist2]); + // rotate and update displacements. // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 if (history_update) { rsht = history[thist0]*nx + history[thist1]*ny + history[thist2]*nz; - if (fabs(rsht) < EPSILON) rsht = 0; - if (rsht > 0) { - // if rhst == shrmag, contacting pair has rotated 90 deg in one step, - // in which case you deserve a crash! - scalefac = shrmag/(shrmag - rsht); + if (tangential_model == TANGENTIAL_MINDLIN_FORCE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + frameupdate = fabs(rsht) > EPSILON*Fscrit; + else + frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; + if (frameupdate) { + shrmag = sqrt(history[thist0]*history[thist0] + + history[thist1]*history[thist1] + + history[thist2]*history[thist2]); + // projection history[thist0] -= rsht*nx; history[thist1] -= rsht*ny; history[thist2] -= rsht*nz; + // also rescale to preserve magnitude + prjmag = sqrt(history[0]*history[0] + history[1]*history[1] + + history[2]*history[2]); + if (prjmag > 0) scalefac = shrmag/prjmag; + else scalefac = 0; history[thist0] *= scalefac; history[thist1] *= scalefac; history[thist2] *= scalefac; } // update history + if (tangential_model == TANGENTIAL_HISTORY || + tangential_model == TANGENTIAL_MINDLIN || + tangential_model == TANGENTIAL_MINDLIN_RESCALE) { history[thist0] += vtr1*dt; history[thist1] += vtr2*dt; history[thist2] += vtr3*dt; + } else{ + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + history[thist0] -= k_tangential*vtr1*dt; + history[thist1] -= k_tangential*vtr2*dt; + history[thist2] -= k_tangential*vtr3*dt; + } + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) + history[thist2+1] = a; } // tangential forces = history + tangential velocity damping - fs1 = -k_tangential*history[thist0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[thist1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[thist2] - damp_tangential*vtr3; + if (tangential_model == TANGENTIAL_HISTORY || + tangential_model == TANGENTIAL_MINDLIN || + tangential_model == TANGENTIAL_MINDLIN_RESCALE) { + fs1 = -k_tangential*history[thist0] - damp_tangential*vtr1; + fs2 = -k_tangential*history[thist1] - damp_tangential*vtr2; + fs3 = -k_tangential*history[thist2] - damp_tangential*vtr3; + } else { + fs1 = history[thist0] - damp_tangential*vtr1; + fs2 = history[thist1] - damp_tangential*vtr2; + fs3 = history[thist2] - damp_tangential*vtr3; + } // rescale frictional displacements and forces if needed Fscrit = tangential_coeffs[2] * Fncrit; fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); if (fs > Fscrit) { + shrmag = sqrt(history[thist0]*history[thist0] + + history[thist1]*history[thist1] + + history[thist2]*history[thist2]); if (shrmag != 0.0) { - history[thist0] = -1.0/k_tangential*(Fscrit*fs1/fs + - damp_tangential*vtr1); - history[thist1] = -1.0/k_tangential*(Fscrit*fs2/fs + - damp_tangential*vtr2); - history[thist2] = -1.0/k_tangential*(Fscrit*fs3/fs + - damp_tangential*vtr3); + if (tangential_model == TANGENTIAL_HISTORY || + tangential_model == TANGENTIAL_MINDLIN || + tangential_model == + TANGENTIAL_MINDLIN_RESCALE) { + history[thist0] = -1.0/k_tangential*(Fscrit*fs1/fs + + damp_tangential*vtr1); + history[thist1] = -1.0/k_tangential*(Fscrit*fs2/fs + + damp_tangential*vtr2); + history[thist2] = -1.0/k_tangential*(Fscrit*fs3/fs + + damp_tangential*vtr3); + } else { + history[thist0] = Fscrit*fs1/fs + damp_tangential*vtr1; + history[thist1] = Fscrit*fs2/fs + damp_tangential*vtr2; + history[thist2] = Fscrit*fs3/fs + damp_tangential*vtr3; + } fs1 *= Fscrit/fs; fs2 *= Fscrit/fs; fs3 *= Fscrit/fs; } else fs1 = fs2 = fs3 = 0.0; } } else { // classic pair gran/hooke (no history) - fs = meff*damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fne,fs) / vrel; + fs = damp_tangential*vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; else Ft = 0.0; fs1 = -Ft*vtr1; fs2 = -Ft*vtr2; @@ -1315,14 +1384,14 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, // rolling resistance //**************************************** - if (roll_model != ROLL_NONE || twist_model != NONE) { + if (roll_model != ROLL_NONE || twist_model != TWIST_NONE) { relrot1 = omega[0]; relrot2 = omega[1]; relrot3 = omega[2]; } if (roll_model != ROLL_NONE) { - - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // rolling velocity, + // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) // This is different from the Marshall papers, // which use the Bagi/Kuhn formulation // for rolling velocity (see Wang et al for why the latter is wrong) @@ -1334,21 +1403,29 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, int rhist1 = rhist0 + 1; int rhist2 = rhist1 + 1; - // rolling displacement - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - - rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; + k_roll = roll_coeffs[0]; + damp_roll = roll_coeffs[1]; + Frcrit = roll_coeffs[2] * Fncrit; if (history_update) { - if (fabs(rolldotn) < EPSILON) rolldotn = 0; - if (rolldotn > 0) { // rotate into tangential plane - scalefac = rollmag/(rollmag - rolldotn); + rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + if (frameupdate) { // rotate into tangential plane + rollmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + // projection history[rhist0] -= rolldotn*nx; history[rhist1] -= rolldotn*ny; history[rhist2] -= rolldotn*nz; + // also rescale to preserve magnitude + prjmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + + if (prjmag > 0) scalefac = rollmag/prjmag; + else scalefac = 0; history[rhist0] *= scalefac; history[rhist1] *= scalefac; history[rhist2] *= scalefac; @@ -1358,17 +1435,16 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, history[rhist2] += vrl3*dt; } - k_roll = roll_coeffs[0]; - damp_roll = roll_coeffs[1]; fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; // rescale frictional displacements and forces if needed - Frcrit = roll_coeffs[2] * Fncrit; - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); if (fr > Frcrit) { + rollmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); if (rollmag != 0.0) { history[rhist0] = -1.0/k_roll*(Frcrit*fr1/fr + damp_roll*vrl1); history[rhist1] = -1.0/k_roll*(Frcrit*fr2/fr + damp_roll*vrl2); diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index a86af2116e..4f7a6e20ec 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -237,7 +237,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -372,8 +372,8 @@ void PairGranHookeHistory::settings(int narg, char **arg) if (dampflag == 0) gammat = 0.0; limit_damping = 0; - if(narg == 7) { - if(strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; + if (narg == 7) { + if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; else error->all(FLERR,"Illegal pair_style command"); } diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index dc829879e8..8bf9b0c4ed 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -365,13 +365,13 @@ void PairGranular::compute(int eflag, int vflag) damp_normal = a*meff; } else if (damping_model[itype][jtype] == TSUJI) { damp_normal = sqrt(meff*knfac); - } + } else damp_normal = 0.0; damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects @@ -542,20 +542,17 @@ void PairGranular::compute(int eflag, int vflag) relrot1 = omega[i][0] - omega[j][0]; relrot2 = omega[i][1] - omega[j][1]; relrot3 = omega[i][2] - omega[j][2]; - // rolling velocity, - // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - // - 0.5*((radj-radi)/radsum)*vtr1; - // - 0.5*((radj-radi)/radsum)*vtr2; - // - 0.5*((radj-radi)/radsum)*vtr3; } //**************************************** // rolling resistance //**************************************** if (roll_model[itype][jtype] != ROLL_NONE) { + // rolling velocity, + // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, + // which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) vrl1 = Reff*(relrot2*nz - relrot3*ny); vrl2 = Reff*(relrot3*nx - relrot1*nz); vrl3 = Reff*(relrot1*ny - relrot2*nx); @@ -974,12 +971,12 @@ void PairGranular::coeff(int narg, char **arg) } else if (strcmp(arg[iarg], "limit_damping") == 0) { ld_flag = 1; iarg += 1; - } else error->all(FLERR, "Illegal pair coeff command"); + } else error->all(FLERR, "Illegal pair_coeff command"); } // error not to specify normal or tangential model if ((normal_model_one < 0) || (tangential_model_one < 0)) - error->all(FLERR, "Illegal pair coeff command, " + error->all(FLERR, "Illegal pair_coeff command, " "must specify normal or tangential contact model"); int count = 0; @@ -991,11 +988,13 @@ void PairGranular::coeff(int narg, char **arg) 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); } else damp = normal_coeffs_one[1]; - if(ld_flag and normal_model_one == JKR) - error->all(FLERR,"Cannot limit damping with JKR model"); + if (ld_flag and normal_model_one == JKR) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with JKR model"); - if(ld_flag and normal_model_one == DMT) - error->all(FLERR,"Cannot limit damping with DMT model"); + if (ld_flag and normal_model_one == DMT) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with DMT model"); for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { diff --git a/src/GRANULAR/pair_granular_corrected.cpp b/src/GRANULAR/pair_granular_corrected.cpp new file mode 100644 index 0000000000..bcf262aa2c --- /dev/null +++ b/src/GRANULAR/pair_granular_corrected.cpp @@ -0,0 +1,1821 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: + Dan Bolintineanu (SNL), Ishan Srivastava (SNL), Jeremy Lechman(SNL) + Leo Silbert (SNL), Gary Grest (SNL) +----------------------------------------------------------------------- */ + +#include "pair_granular.h" + +#include +#include + +#include "atom.h" +#include "force.h" +#include "update.h" +#include "modify.h" +#include "fix.h" +#include "fix_dummy.h" +#include "fix_neigh_history.h" +#include "comm.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "memory.h" +#include "error.h" +#include "math_const.h" +#include "math_special.h" + + +using namespace LAMMPS_NS; +using namespace MathConst; +using namespace MathSpecial; + +#define PI27SQ 266.47931882941264802866 // 27*PI**2 +#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) +#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) +#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) +#define FOURTHIRDS 4.0/3.0 // 4/3 +#define THREEQUARTERS 0.75 // 3/4 + +#define EPSILON 1e-10 + +enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; +enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; +enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, + TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, + TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; +enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; +enum {ROLL_NONE, ROLL_SDS}; + +/* ---------------------------------------------------------------------- */ + +PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 1; + no_virial_fdotr_compute = 1; + centroidstressflag = CENTROID_NOTAVAIL; + + single_extra = 12; + svector = new double[single_extra]; + + neighprev = 0; + + nmax = 0; + mass_rigid = nullptr; + + onerad_dynamic = nullptr; + onerad_frozen = nullptr; + maxrad_dynamic = nullptr; + maxrad_frozen = nullptr; + + history_transfer_factors = nullptr; + + dt = update->dt; + + // set comm size needed by this Pair if used with fix rigid + + comm_forward = 1; + + use_history = 0; + beyond_contact = 0; + nondefault_history_transfer = 0; + tangential_history_index = 0; + roll_history_index = twist_history_index = 0; + + // create dummy fix as placeholder for FixNeighHistory + // this is so final order of Modify:fix will conform to input script + + fix_history = nullptr; + modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); + fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; +} + +/* ---------------------------------------------------------------------- */ + +PairGranular::~PairGranular() +{ + delete [] svector; + + if (!fix_history) modify->delete_fix("NEIGH_HISTORY_GRANULAR_DUMMY"); + else modify->delete_fix("NEIGH_HISTORY_GRANULAR"); + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cutoff_type); + + memory->destroy(normal_coeffs); + memory->destroy(tangential_coeffs); + memory->destroy(roll_coeffs); + memory->destroy(twist_coeffs); + + memory->destroy(Emod); + memory->destroy(poiss); + + memory->destroy(normal_model); + memory->destroy(damping_model); + memory->destroy(tangential_model); + memory->destroy(roll_model); + memory->destroy(twist_model); + + delete [] onerad_dynamic; + delete [] onerad_frozen; + delete [] maxrad_dynamic; + delete [] maxrad_frozen; + } + + memory->destroy(mass_rigid); +} + +/* ---------------------------------------------------------------------- */ + +void PairGranular::compute(int eflag, int vflag) +{ + int i,j,ii,jj,inum,jnum,itype,jtype; + double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,nx,ny,nz; + double radi,radj,radsum,rsq,r,rinv; + double Reff, delta, dR, dR2, dist_to_contact; + + double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; + double wr1,wr2,wr3; + double vtr1,vtr2,vtr3,vrel; + + double knfac, damp_normal=0.0, damp_normal_prefactor; + double k_tangential, damp_tangential; + double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; + double fs, fs1, fs2, fs3, tor1, tor2, tor3; + + double mi,mj,meff; + double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; + + // for JKR + double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; + double t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3; + + // rolling + double k_roll, damp_roll; + double torroll1, torroll2, torroll3; + double rollmag, rolldotn, scalefac; + double fr, fr1, fr2, fr3; + + // twisting + double k_twist, damp_twist, mu_twist; + double signtwist, magtwist, magtortwist, Mtcrit; + double tortwist1, tortwist2, tortwist3; + + double shrmag,rsht,prjmag; + bool frameupdate; + int *ilist,*jlist,*numneigh,**firstneigh; + int *touch,**firsttouch; + double *history,*allhistory,**firsthistory; + + bool touchflag = false; + const bool historyupdate = (update->setupflag) ? false : true; + + ev_init(eflag,vflag); + + // update rigid body info for owned & ghost atoms if using FixRigid masses + // body[i] = which body atom I is in, -1 if none + // mass_body = mass of each rigid body + + if (fix_rigid && neighbor->ago == 0) { + int tmp; + int *body = (int *) fix_rigid->extract("body",tmp); + double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + if (atom->nmax > nmax) { + memory->destroy(mass_rigid); + nmax = atom->nmax; + memory->create(mass_rigid,nmax,"pair:mass_rigid"); + } + int nlocal = atom->nlocal; + for (i = 0; i < nlocal; i++) + if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]]; + else mass_rigid[i] = 0.0; + comm->forward_comm_pair(this); + } + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + int *type = atom->type; + double **omega = atom->omega; + double **torque = atom->torque; + double *radius = atom->radius; + double *rmass = atom->rmass; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + if (use_history) { + firsttouch = fix_history->firstflag; + firsthistory = fix_history->firstvalue; + } + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + itype = type[i]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + radi = radius[i]; + if (use_history) { + touch = firsttouch[i]; + allhistory = firsthistory[i]; + } + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + jtype = type[j]; + rsq = delx*delx + dely*dely + delz*delz; + radj = radius[j]; + radsum = radi + radj; + + E = normal_coeffs[itype][jtype][0]; + Reff = radi*radj/radsum; + touchflag = false; + + if (normal_model[itype][jtype] == JKR) { + E *= THREEQUARTERS; + if (touch[jj]) { + R2 = Reff*Reff; + coh = normal_coeffs[itype][jtype][3]; + a = cbrt(9.0*MY_PI*coh*R2/(4*E)); + delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); + dist_pulloff = radsum-delta_pulloff; + touchflag = (rsq < dist_pulloff*dist_pulloff); + } else { + touchflag = (rsq < radsum*radsum); + } + } else { + touchflag = (rsq < radsum*radsum); + } + + if (!touchflag) { + // unset non-touching neighbors + if (use_history) { + touch[jj] = 0; + history = &allhistory[size_history*jj]; + for (int k = 0; k < size_history; k++) history[k] = 0.0; + } + } else { + r = sqrt(rsq); + rinv = 1.0/r; + + nx = delx*rinv; + ny = dely*rinv; + nz = delz*rinv; + + // relative translational velocity + + vr1 = v[i][0] - v[j][0]; + vr2 = v[i][1] - v[j][1]; + vr3 = v[i][2] - v[j][2]; + + // normal component + + vnnr = vr1*nx + vr2*ny + vr3*nz; //v_R . n + vn1 = nx*vnnr; + vn2 = ny*vnnr; + vn3 = nz*vnnr; + + // meff = effective mass of pair of particles + // if I or J part of rigid body, use body mass + // if I or J is frozen, meff is other particle + + mi = rmass[i]; + mj = rmass[j]; + if (fix_rigid) { + if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; + if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; + } + + meff = mi*mj / (mi+mj); + if (mask[i] & freeze_group_bit) meff = mj; + if (mask[j] & freeze_group_bit) meff = mi; + + delta = radsum - r; + dR = delta*Reff; + + if (normal_model[itype][jtype] == JKR) { + touch[jj] = 1; + R2=Reff*Reff; + coh = normal_coeffs[itype][jtype][3]; + dR2 = dR*dR; + t0 = coh*coh*R2*R2*E; + t1 = PI27SQ*t0; + t2 = 8*dR*dR2*E*E*E; + t3 = 4*dR2*E; + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0*(t1+2*t2)); + t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); + t5 = t3/t4 + t4/E; + sqrt2 = MAX(0, 2*dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); + a = INVROOT6*(t6 + sqrt(sqrt3)); + a2 = a*a; + knfac = normal_coeffs[itype][jtype][0]*a; + Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); + } else { + knfac = E; // Hooke + Fne = knfac*delta; + a = sqrt(dR); + if (normal_model[itype][jtype] != HOOKE) { + Fne *= a; + knfac *= a; + } + if (normal_model[itype][jtype] == DMT) + Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; + } + + // NOTE: consider restricting Hooke to only have + // 'velocity' as an option for damping? + + if (damping_model[itype][jtype] == VELOCITY) { + damp_normal = 1; + } else if (damping_model[itype][jtype] == MASS_VELOCITY) { + damp_normal = meff; + } else if (damping_model[itype][jtype] == VISCOELASTIC) { + damp_normal = a*meff; + } else if (damping_model[itype][jtype] == TSUJI) { + damp_normal = sqrt(meff*knfac); + } + + damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; + Fdamp = -damp_normal_prefactor*vnnr; + + Fntot = Fne + Fdamp; + + //**************************************** + // tangential force, including history effects + //**************************************** + + // For linear, mindlin, mindlin_rescale: + // history = cumulative tangential displacement + // + // For mindlin/force, mindlin_rescale/force: + // history = cumulative tangential elastic force + + // tangential component + vt1 = vr1 - vn1; + vt2 = vr2 - vn2; + vt3 = vr3 - vn3; + + // relative rotational velocity + wr1 = (radi*omega[i][0] + radj*omega[j][0]); + wr2 = (radi*omega[i][1] + radj*omega[j][1]); + wr3 = (radi*omega[i][2] + radj*omega[j][2]); + + // relative tangential velocities + vtr1 = vt1 - (nz*wr2-ny*wr3); + vtr2 = vt2 - (nx*wr3-nz*wr1); + vtr3 = vt3 - (ny*wr1-nx*wr2); + vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; + vrel = sqrt(vrel); + + // if any history is needed + if (use_history) { + touch[jj] = 1; + history = &allhistory[size_history*jj]; + } + + if (normal_model[itype][jtype] == JKR) { + F_pulloff = 3*MY_PI*coh*Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else if (normal_model[itype][jtype] == DMT) { + F_pulloff = 4*MY_PI*coh*Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else { + Fncrit = fabs(Fntot); + } + Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; + + //------------------------------ + // tangential forces + //------------------------------ + k_tangential = tangential_coeffs[itype][jtype][0]; + damp_tangential = tangential_coeffs[itype][jtype][1] * + damp_normal_prefactor; + + if (tangential_history) { + if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE) { + k_tangential *= a; + } else if (tangential_model[itype][jtype] == + TANGENTIAL_MINDLIN_RESCALE || + tangential_model[itype][jtype] == + TANGENTIAL_MINDLIN_RESCALE_FORCE) { + k_tangential *= a; + // on unloading, rescale the shear displacements/force + if (a < history[3]) { + double factor = a/history[3]; + history[0] *= factor; + history[1] *= factor; + history[2] *= factor; + } + } + // rotate and update displacements / force. + // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 + if (historyupdate) { + rsht = history[0]*nx + history[1]*ny + history[2]*nz; + if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || + tangential_model[itype][jtype] == + TANGENTIAL_MINDLIN_RESCALE_FORCE) + frameupdate = fabs(rsht) > EPSILON*Fscrit; + else + frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; + if (frameupdate) { + shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + + history[2]*history[2]); + // projection + history[0] -= rsht*nx; + history[1] -= rsht*ny; + history[2] -= rsht*nz; + + // also rescale to preserve magnitude + prjmag = sqrt(history[0]*history[0] + history[1]*history[1] + + history[2]*history[2]); + if (prjmag > 0) scalefac = shrmag/prjmag; + else scalefac = 0; + history[0] *= scalefac; + history[1] *= scalefac; + history[2] *= scalefac; + } + // update history + if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { + // tangential displacement + history[0] += vtr1*dt; + history[1] += vtr2*dt; + history[2] += vtr3*dt; + } else { + // tangential force + // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 + history[0] -= k_tangential*vtr1*dt; + history[1] -= k_tangential*vtr2*dt; + history[2] -= k_tangential*vtr3*dt; + } + if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE || + tangential_model[itype][jtype] == + TANGENTIAL_MINDLIN_RESCALE_FORCE) + history[3] = a; + } + + // tangential forces = history + tangential velocity damping + if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { + fs1 = -k_tangential*history[0] - damp_tangential*vtr1; + fs2 = -k_tangential*history[1] - damp_tangential*vtr2; + fs3 = -k_tangential*history[2] - damp_tangential*vtr3; + } else { + fs1 = history[0] - damp_tangential*vtr1; + fs2 = history[1] - damp_tangential*vtr2; + fs3 = history[2] - damp_tangential*vtr3; + } + + // rescale frictional displacements and forces if needed + fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); + if (fs > Fscrit) { + shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + + history[2]*history[2]); + if (shrmag != 0.0) { + if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || + tangential_model[itype][jtype] == + TANGENTIAL_MINDLIN_RESCALE) { + history[0] = -1.0/k_tangential*(Fscrit*fs1/fs + + damp_tangential*vtr1); + history[1] = -1.0/k_tangential*(Fscrit*fs2/fs + + damp_tangential*vtr2); + history[2] = -1.0/k_tangential*(Fscrit*fs3/fs + + damp_tangential*vtr3); + } else { + history[0] = Fscrit*fs1/fs + damp_tangential*vtr1; + history[1] = Fscrit*fs2/fs + damp_tangential*vtr2; + history[2] = Fscrit*fs3/fs + damp_tangential*vtr3; + } + fs1 *= Fscrit/fs; + fs2 *= Fscrit/fs; + fs3 *= Fscrit/fs; + } else fs1 = fs2 = fs3 = 0.0; + } + } else { // classic pair gran/hooke (no history) + fs = damp_tangential*vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; + else Ft = 0.0; + fs1 = -Ft*vtr1; + fs2 = -Ft*vtr2; + fs3 = -Ft*vtr3; + } + + if (roll_model[itype][jtype] != ROLL_NONE || + twist_model[itype][jtype] != TWIST_NONE) { + relrot1 = omega[i][0] - omega[j][0]; + relrot2 = omega[i][1] - omega[j][1]; + relrot3 = omega[i][2] - omega[j][2]; + // rolling velocity, + // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, + // which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + // - 0.5*((radj-radi)/radsum)*vtr1; + // - 0.5*((radj-radi)/radsum)*vtr2; + // - 0.5*((radj-radi)/radsum)*vtr3; + } + //**************************************** + // rolling resistance + //**************************************** + + if (roll_model[itype][jtype] != ROLL_NONE) { + vrl1 = Reff*(relrot2*nz - relrot3*ny); + vrl2 = Reff*(relrot3*nx - relrot1*nz); + vrl3 = Reff*(relrot1*ny - relrot2*nx); + + int rhist0 = roll_history_index; + int rhist1 = rhist0 + 1; + int rhist2 = rhist1 + 1; + + k_roll = roll_coeffs[itype][jtype][0]; + damp_roll = roll_coeffs[itype][jtype][1]; + Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; + + if (historyupdate) { + rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; + frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; + if (frameupdate) { // rotate into tangential plane + rollmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + // projection + history[rhist0] -= rolldotn*nx; + history[rhist1] -= rolldotn*ny; + history[rhist2] -= rolldotn*nz; + // also rescale to preserve magnitude + prjmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + if (prjmag > 0) scalefac = rollmag/prjmag; + else scalefac = 0; + history[rhist0] *= scalefac; + history[rhist1] *= scalefac; + history[rhist2] *= scalefac; + } + history[rhist0] += vrl1*dt; + history[rhist1] += vrl2*dt; + history[rhist2] += vrl3*dt; + } + + fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; + fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; + fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; + + // rescale frictional displacements and forces if needed + + fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); + if (fr > Frcrit) { + rollmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + if (rollmag != 0.0) { + history[rhist0] = -1.0/k_roll*(Frcrit*fr1/fr + damp_roll*vrl1); + history[rhist1] = -1.0/k_roll*(Frcrit*fr2/fr + damp_roll*vrl2); + history[rhist2] = -1.0/k_roll*(Frcrit*fr3/fr + damp_roll*vrl3); + fr1 *= Frcrit/fr; + fr2 *= Frcrit/fr; + fr3 *= Frcrit/fr; + } else fr1 = fr2 = fr3 = 0.0; + } + } + + //**************************************** + // twisting torque, including history effects + //**************************************** + + if (twist_model[itype][jtype] != TWIST_NONE) { + // omega_T (eq 29 of Marshall) + magtwist = relrot1*nx + relrot2*ny + relrot3*nz; + if (twist_model[itype][jtype] == TWIST_MARSHALL) { + k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper + damp_twist = 0.5*damp_tangential*a*a; + mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2]; + } else { + k_twist = twist_coeffs[itype][jtype][0]; + damp_twist = twist_coeffs[itype][jtype][1]; + mu_twist = twist_coeffs[itype][jtype][2]; + } + if (historyupdate) { + history[twist_history_index] += magtwist*dt; + } + magtortwist = -k_twist*history[twist_history_index] - + damp_twist*magtwist; // M_t torque (eq 30) + signtwist = (magtwist > 0) - (magtwist < 0); + Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) + if (fabs(magtortwist) > Mtcrit) { + history[twist_history_index] = 1.0/k_twist*(Mtcrit*signtwist - + damp_twist*magtwist); + magtortwist = -Mtcrit * signtwist; // eq 34 + } + } + + // apply forces & torques + + fx = nx*Fntot + fs1; + fy = ny*Fntot + fs2; + fz = nz*Fntot + fs3; + + f[i][0] += fx; + f[i][1] += fy; + f[i][2] += fz; + + tor1 = ny*fs3 - nz*fs2; + tor2 = nz*fs1 - nx*fs3; + tor3 = nx*fs2 - ny*fs1; + + dist_to_contact = radi-0.5*delta; + torque[i][0] -= dist_to_contact*tor1; + torque[i][1] -= dist_to_contact*tor2; + torque[i][2] -= dist_to_contact*tor3; + + if (twist_model[itype][jtype] != TWIST_NONE) { + tortwist1 = magtortwist * nx; + tortwist2 = magtortwist * ny; + tortwist3 = magtortwist * nz; + + torque[i][0] += tortwist1; + torque[i][1] += tortwist2; + torque[i][2] += tortwist3; + } + + if (roll_model[itype][jtype] != ROLL_NONE) { + torroll1 = Reff*(ny*fr3 - nz*fr2); // n cross fr + torroll2 = Reff*(nz*fr1 - nx*fr3); + torroll3 = Reff*(nx*fr2 - ny*fr1); + + torque[i][0] += torroll1; + torque[i][1] += torroll2; + torque[i][2] += torroll3; + } + + if (force->newton_pair || j < nlocal) { + f[j][0] -= fx; + f[j][1] -= fy; + f[j][2] -= fz; + + dist_to_contact = radj-0.5*delta; + torque[j][0] -= dist_to_contact*tor1; + torque[j][1] -= dist_to_contact*tor2; + torque[j][2] -= dist_to_contact*tor3; + + if (twist_model[itype][jtype] != TWIST_NONE) { + torque[j][0] -= tortwist1; + torque[j][1] -= tortwist2; + torque[j][2] -= tortwist3; + } + if (roll_model[itype][jtype] != ROLL_NONE) { + torque[j][0] -= torroll1; + torque[j][1] -= torroll2; + torque[j][2] -= torroll3; + } + } + if (evflag) ev_tally_xyz(i,j,nlocal,force->newton_pair, + 0.0,0.0,fx,fy,fz,delx,dely,delz); + } + } + } +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairGranular::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); + memory->create(normal_coeffs,n+1,n+1,4,"pair:normal_coeffs"); + memory->create(tangential_coeffs,n+1,n+1,3,"pair:tangential_coeffs"); + memory->create(roll_coeffs,n+1,n+1,3,"pair:roll_coeffs"); + memory->create(twist_coeffs,n+1,n+1,3,"pair:twist_coeffs"); + + memory->create(Emod,n+1,n+1,"pair:Emod"); + memory->create(poiss,n+1,n+1,"pair:poiss"); + + memory->create(normal_model,n+1,n+1,"pair:normal_model"); + memory->create(damping_model,n+1,n+1,"pair:damping_model"); + memory->create(tangential_model,n+1,n+1,"pair:tangential_model"); + memory->create(roll_model,n+1,n+1,"pair:roll_model"); + memory->create(twist_model,n+1,n+1,"pair:twist_model"); + + onerad_dynamic = new double[n+1]; + onerad_frozen = new double[n+1]; + maxrad_dynamic = new double[n+1]; + maxrad_frozen = new double[n+1]; +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairGranular::settings(int narg, char **arg) +{ + if (narg == 1) { + cutoff_global = utils::numeric(FLERR,arg[0],false,lmp); + } else { + cutoff_global = -1; // will be set based on particle sizes, model choice + } + + normal_history = tangential_history = 0; + roll_history = twist_history = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairGranular::coeff(int narg, char **arg) +{ + int normal_model_one, damping_model_one; + int tangential_model_one, roll_model_one, twist_model_one; + + double normal_coeffs_one[4]; + double tangential_coeffs_one[4]; + double roll_coeffs_one[4]; + double twist_coeffs_one[4]; + + double cutoff_one = -1; + + if (narg < 2) + error->all(FLERR,"Incorrect args for pair coefficients"); + + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + + //Defaults + normal_model_one = tangential_model_one = -1; + roll_model_one = ROLL_NONE; + twist_model_one = TWIST_NONE; + damping_model_one = VISCOELASTIC; + + int iarg = 2; + while (iarg < narg) { + if (strcmp(arg[iarg], "hooke") == 0) { + if (iarg + 2 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for Hooke option"); + normal_model_one = HOOKE; + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + iarg += 3; + } else if (strcmp(arg[iarg], "hertz") == 0) { + if (iarg + 2 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for Hertz option"); + normal_model_one = HERTZ; + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + iarg += 3; + } else if (strcmp(arg[iarg], "hertz/material") == 0) { + if (iarg + 3 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for Hertz/material option"); + normal_model_one = HERTZ_MATERIAL; + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio + iarg += 4; + } else if (strcmp(arg[iarg], "dmt") == 0) { + if (iarg + 4 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for Hertz option"); + normal_model_one = DMT; + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio + normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion + iarg += 5; + } else if (strcmp(arg[iarg], "jkr") == 0) { + if (iarg + 4 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for JKR option"); + beyond_contact = 1; + normal_model_one = JKR; + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio + normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion + iarg += 5; + } else if (strcmp(arg[iarg], "damping") == 0) { + if (iarg+1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, " + "not enough parameters provided for damping model"); + if (strcmp(arg[iarg+1], "velocity") == 0) { + damping_model_one = VELOCITY; + iarg += 1; + } else if (strcmp(arg[iarg+1], "mass_velocity") == 0) { + damping_model_one = MASS_VELOCITY; + iarg += 1; + } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) { + damping_model_one = VISCOELASTIC; + iarg += 1; + } else if (strcmp(arg[iarg+1], "tsuji") == 0) { + damping_model_one = TSUJI; + iarg += 1; + } else error->all(FLERR, "Illegal pair_coeff command, " + "unrecognized damping model"); + iarg += 1; + } else if (strcmp(arg[iarg], "tangential") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR,"Illegal pair_coeff command, must specify " + "tangential model after tangential keyword"); + if (strcmp(arg[iarg+1], "linear_nohistory") == 0) { + if (iarg + 3 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for tangential model"); + tangential_model_one = TANGENTIAL_NOHISTORY; + tangential_coeffs_one[0] = 0; + // gammat and friction coeff + tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + iarg += 4; + } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || + (strcmp(arg[iarg+1], "mindlin") == 0) || + (strcmp(arg[iarg+1], "mindlin_rescale") == 0) || + (strcmp(arg[iarg+1], "mindlin/force") == 0) || + (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0)) { + if (iarg + 4 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for tangential model"); + if (strcmp(arg[iarg+1], "linear_history") == 0) + tangential_model_one = TANGENTIAL_HISTORY; + else if (strcmp(arg[iarg+1], "mindlin") == 0) + tangential_model_one = TANGENTIAL_MINDLIN; + else if (strcmp(arg[iarg+1], "mindlin_rescale") == 0) + tangential_model_one = TANGENTIAL_MINDLIN_RESCALE; + else if (strcmp(arg[iarg+1], "mindlin/force") == 0) + tangential_model_one = TANGENTIAL_MINDLIN_FORCE; + else if (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0) + tangential_model_one = TANGENTIAL_MINDLIN_RESCALE_FORCE; + tangential_history = 1; + if ((tangential_model_one == TANGENTIAL_MINDLIN || + tangential_model_one == TANGENTIAL_MINDLIN_RESCALE || + tangential_model_one == TANGENTIAL_MINDLIN_FORCE || + tangential_model_one == TANGENTIAL_MINDLIN_RESCALE_FORCE) && + (strcmp(arg[iarg+2], "NULL") == 0)) { + if (normal_model_one == HERTZ || normal_model_one == HOOKE) { + error->all(FLERR, "NULL setting for Mindlin tangential " + "stiffness requires a normal contact model that " + "specifies material properties"); + } + tangential_coeffs_one[0] = -1; + } else { + tangential_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // kt + } + // gammat and friction coeff + tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + iarg += 5; + } else { + error->all(FLERR, "Illegal pair_coeff command, " + "tangential model not recognized"); + } + } else if (strcmp(arg[iarg], "rolling") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + if (strcmp(arg[iarg+1], "none") == 0) { + roll_model_one = ROLL_NONE; + iarg += 2; + } else if (strcmp(arg[iarg+1], "sds") == 0) { + if (iarg + 4 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for rolling model"); + roll_model_one = ROLL_SDS; + roll_history = 1; + // kR and gammaR and rolling friction coeff + roll_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + roll_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + roll_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + iarg += 5; + } else { + error->all(FLERR, "Illegal pair_coeff command, " + "rolling friction model not recognized"); + } + } else if (strcmp(arg[iarg], "twisting") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + if (strcmp(arg[iarg+1], "none") == 0) { + twist_model_one = TWIST_NONE; + iarg += 2; + } else if (strcmp(arg[iarg+1], "marshall") == 0) { + twist_model_one = TWIST_MARSHALL; + twist_history = 1; + iarg += 2; + } else if (strcmp(arg[iarg+1], "sds") == 0) { + if (iarg + 4 >= narg) + error->all(FLERR,"Illegal pair_coeff command, " + "not enough parameters provided for twist model"); + twist_model_one = TWIST_SDS; + twist_history = 1; + // kt and gammat and friction coeff + twist_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + twist_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + twist_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + iarg += 5; + } else { + error->all(FLERR, "Illegal pair_coeff command, " + "twisting friction model not recognized"); + } + } else if (strcmp(arg[iarg], "cutoff") == 0) { + if (iarg + 1 >= narg) + error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); + cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); + iarg += 2; + } else error->all(FLERR, "Illegal pair coeff command"); + } + + // error not to specify normal or tangential model + if ((normal_model_one < 0) || (tangential_model_one < 0)) + error->all(FLERR, "Illegal pair coeff command, " + "must specify normal or tangential contact model"); + + int count = 0; + double damp; + if (damping_model_one == TSUJI) { + double cor; + cor = normal_coeffs_one[1]; + damp = 1.2728-4.2783*cor+11.087*square(cor)-22.348*cube(cor)+ + 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); + } else damp = normal_coeffs_one[1]; + + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + normal_model[i][j] = normal_model[j][i] = normal_model_one; + normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = damp; + if (normal_model_one != HERTZ && normal_model_one != HOOKE) { + Emod[i][j] = Emod[j][i] = normal_coeffs_one[0]; + poiss[i][j] = poiss[j][i] = normal_coeffs_one[2]; + normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = + FOURTHIRDS*mix_stiffnessE(Emod[i][j],Emod[i][j], + poiss[i][j],poiss[i][j]); + } else { + normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = normal_coeffs_one[0]; + } + if ((normal_model_one == JKR) || (normal_model_one == DMT)) + normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = normal_coeffs_one[3]; + + damping_model[i][j] = damping_model[j][i] = damping_model_one; + + tangential_model[i][j] = tangential_model[j][i] = tangential_model_one; + if (tangential_coeffs_one[0] == -1) { + tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = + 8*mix_stiffnessG(Emod[i][j],Emod[i][j],poiss[i][j],poiss[i][j]); + } else { + tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = + tangential_coeffs_one[0]; + } + for (int k = 1; k < 3; k++) + tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = + tangential_coeffs_one[k]; + + roll_model[i][j] = roll_model[j][i] = roll_model_one; + if (roll_model_one != ROLL_NONE) + for (int k = 0; k < 3; k++) + roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = roll_coeffs_one[k]; + + twist_model[i][j] = twist_model[j][i] = twist_model_one; + if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) + for (int k = 0; k < 3; k++) + twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = twist_coeffs_one[k]; + + cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; + + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairGranular::init_style() +{ + int i; + + // error and warning checks + + if (!atom->radius_flag || !atom->rmass_flag) + error->all(FLERR,"Pair granular requires atom attributes radius, rmass"); + if (comm->ghost_velocity == 0) + error->all(FLERR,"Pair granular requires ghost atoms store velocity"); + + // determine whether we need a granular neigh list, how large it needs to be + + use_history = normal_history || tangential_history || + roll_history || twist_history; + + // for JKR, will need fix/neigh/history to keep track of touch arrays + + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + if (normal_model[i][j] == JKR) use_history = 1; + + size_history = 3*tangential_history + 3*roll_history + twist_history; + + // determine location of tangential/roll/twist histories in array + + if (roll_history) { + if (tangential_history) roll_history_index = 3; + else roll_history_index = 0; + } + if (twist_history) { + if (tangential_history) { + if (roll_history) twist_history_index = 6; + else twist_history_index = 3; + } else { + if (roll_history) twist_history_index = 3; + else twist_history_index = 0; + } + } + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + if (tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE || + tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + size_history += 1; + roll_history_index += 1; + twist_history_index += 1; + nondefault_history_transfer = 1; + history_transfer_factors = new int[size_history]; + for (int ii = 0; ii < size_history; ++ii) + history_transfer_factors[ii] = -1; + history_transfer_factors[3] = 1; + break; + } + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->size = 1; + if (use_history) neighbor->requests[irequest]->history = 1; + + dt = update->dt; + + // if history is stored and first init, create Fix to store history + // it replaces FixDummy, created in the constructor + // this is so its order in the fix list is preserved + + if (use_history && fix_history == nullptr) { + modify->replace_fix("NEIGH_HISTORY_GRANULAR_DUMMY","NEIGH_HISTORY_GRANULAR" + " all NEIGH_HISTORY " + std::to_string(size_history),1); + int ifix = modify->find_fix("NEIGH_HISTORY_GRANULAR"); + fix_history = (FixNeighHistory *) modify->fix[ifix]; + fix_history->pair = this; + } + + // check for FixFreeze and set freeze_group_bit + + for (i = 0; i < modify->nfix; i++) + if (strcmp(modify->fix[i]->style,"freeze") == 0) break; + if (i < modify->nfix) freeze_group_bit = modify->fix[i]->groupbit; + else freeze_group_bit = 0; + + // check for FixRigid so can extract rigid body masses + + fix_rigid = nullptr; + for (i = 0; i < modify->nfix; i++) + if (modify->fix[i]->rigid_flag) break; + if (i < modify->nfix) fix_rigid = modify->fix[i]; + + // check for FixPour and FixDeposit so can extract particle radii + + int ipour; + for (ipour = 0; ipour < modify->nfix; ipour++) + if (strcmp(modify->fix[ipour]->style,"pour") == 0) break; + if (ipour == modify->nfix) ipour = -1; + + int idep; + for (idep = 0; idep < modify->nfix; idep++) + if (strcmp(modify->fix[idep]->style,"deposit") == 0) break; + if (idep == modify->nfix) idep = -1; + + // set maxrad_dynamic and maxrad_frozen for each type + // include future FixPour and FixDeposit particles as dynamic + + int itype; + for (i = 1; i <= atom->ntypes; i++) { + onerad_dynamic[i] = onerad_frozen[i] = 0.0; + if (ipour >= 0) { + itype = i; + double radmax = *((double *) modify->fix[ipour]->extract("radius",itype)); + onerad_dynamic[i] = radmax; + } + if (idep >= 0) { + itype = i; + double radmax = *((double *) modify->fix[idep]->extract("radius",itype)); + onerad_dynamic[i] = radmax; + } + } + + double *radius = atom->radius; + int *mask = atom->mask; + int *type = atom->type; + int nlocal = atom->nlocal; + + for (i = 0; i < nlocal; i++) { + double radius_cut = radius[i]; + if (mask[i] & freeze_group_bit) { + onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]],radius_cut); + } else { + onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]],radius_cut); + } + } + + MPI_Allreduce(&onerad_dynamic[1],&maxrad_dynamic[1],atom->ntypes, + MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&onerad_frozen[1],&maxrad_frozen[1],atom->ntypes, + MPI_DOUBLE,MPI_MAX,world); + + // set fix which stores history info + + if (size_history > 0) { + int ifix = modify->find_fix("NEIGH_HISTORY_GRANULAR"); + if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID"); + fix_history = (FixNeighHistory *) modify->fix[ifix]; + } +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairGranular::init_one(int i, int j) +{ + double cutoff=0.0; + + if (setflag[i][j] == 0) { + if ((normal_model[i][i] != normal_model[j][j]) || + (damping_model[i][i] != damping_model[j][j]) || + (tangential_model[i][i] != tangential_model[j][j]) || + (roll_model[i][i] != roll_model[j][j]) || + (twist_model[i][i] != twist_model[j][j])) { + + char str[512]; + sprintf(str,"Granular pair style functional forms are different, " + "cannot mix coefficients for types %d and %d. \n" + "This combination must be set explicitly " + "via pair_coeff command",i,j); + error->one(FLERR,str); + } + + if (normal_model[i][j] == HERTZ || normal_model[i][j] == HOOKE) + normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = + mix_geom(normal_coeffs[i][i][0], normal_coeffs[j][j][0]); + else + normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = + mix_stiffnessE(Emod[i][i], Emod[j][j], poiss[i][i], poiss[j][j]); + + normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = + mix_geom(normal_coeffs[i][i][1], normal_coeffs[j][j][1]); + if ((normal_model[i][j] == JKR) || (normal_model[i][j] == DMT)) + normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = + mix_geom(normal_coeffs[i][i][3], normal_coeffs[j][j][3]); + + for (int k = 0; k < 3; k++) + tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = + mix_geom(tangential_coeffs[i][i][k], tangential_coeffs[j][j][k]); + + if (roll_model[i][j] != ROLL_NONE) { + for (int k = 0; k < 3; k++) + roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = + mix_geom(roll_coeffs[i][i][k], roll_coeffs[j][j][k]); + } + + if (twist_model[i][j] != TWIST_NONE && twist_model[i][j] != TWIST_MARSHALL) { + for (int k = 0; k < 3; k++) + twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = + mix_geom(twist_coeffs[i][i][k], twist_coeffs[j][j][k]); + } + } + + // It is possible that cut[i][j] at this point is still 0.0. + // This can happen when + // there is a future fix_pour after the current run. A cut[i][j] = 0.0 creates + // problems because neighbor.cpp uses min(cut[i][j]) to decide on the bin size + // To avoid this issue, for cases involving cut[i][j] = 0.0 (possible only + // if there is no current information about radius/cutoff of type i and j). + // we assign cutoff = max(cut[i][j]) for i,j such that cut[i][j] > 0.0. + + double pulloff; + + if (cutoff_type[i][j] < 0 && cutoff_global < 0) { + if (((maxrad_dynamic[i] > 0.0) && (maxrad_dynamic[j] > 0.0)) || + ((maxrad_dynamic[i] > 0.0) && (maxrad_frozen[j] > 0.0)) || + // radius info about both i and j exist + ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { + cutoff = maxrad_dynamic[i]+maxrad_dynamic[j]; + pulloff = 0.0; + if (normal_model[i][j] == JKR) { + pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j], i, j); + cutoff += pulloff; + } + + if (normal_model[i][j] == JKR) + pulloff = pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j], i, j); + cutoff = MAX(cutoff, maxrad_frozen[i]+maxrad_dynamic[j]+pulloff); + + if (normal_model[i][j] == JKR) + pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j], i, j); + cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]+pulloff); + + } else { + + // radius info about either i or j does not exist + // (i.e. not present and not about to get poured; + // set to largest value to not interfere with neighbor list) + + double cutmax = 0.0; + for (int k = 1; k <= atom->ntypes; k++) { + cutmax = MAX(cutmax,2.0*maxrad_dynamic[k]); + cutmax = MAX(cutmax,2.0*maxrad_frozen[k]); + } + cutoff = cutmax; + } + } else if (cutoff_type[i][j] > 0) { + cutoff = cutoff_type[i][j]; + } else if (cutoff_global > 0) { + cutoff = cutoff_global; + } + + return cutoff; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairGranular::write_restart(FILE *fp) +{ + int i,j; + for (i = 1; i <= atom->ntypes; i++) { + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&normal_model[i][j],sizeof(int),1,fp); + fwrite(&damping_model[i][j],sizeof(int),1,fp); + fwrite(&tangential_model[i][j],sizeof(int),1,fp); + fwrite(&roll_model[i][j],sizeof(int),1,fp); + fwrite(&twist_model[i][j],sizeof(int),1,fp); + fwrite(normal_coeffs[i][j],sizeof(double),4,fp); + fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); + fwrite(roll_coeffs[i][j],sizeof(double),3,fp); + fwrite(twist_coeffs[i][j],sizeof(double),3,fp); + fwrite(&cutoff_type[i][j],sizeof(double),1,fp); + } + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairGranular::read_restart(FILE *fp) +{ + allocate(); + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) { + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); + utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); + } + MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(&tangential_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(&roll_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(&twist_model[i][j],1,MPI_INT,0,world); + MPI_Bcast(normal_coeffs[i][j],4,MPI_DOUBLE,0,world); + MPI_Bcast(tangential_coeffs[i][j],3,MPI_DOUBLE,0,world); + MPI_Bcast(roll_coeffs[i][j],3,MPI_DOUBLE,0,world); + MPI_Bcast(twist_coeffs[i][j],3,MPI_DOUBLE,0,world); + MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void PairGranular::reset_dt() +{ + dt = update->dt; +} + +/* ---------------------------------------------------------------------- */ + +double PairGranular::single(int i, int j, int itype, int jtype, + double rsq, double /* factor_coul */, + double /* factor_lj */, double &fforce) +{ + double radi,radj,radsum; + double r,rinv,delx,dely,delz, nx, ny, nz, Reff; + double dR, dR2; + double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3; + double vtr1,vtr2,vtr3,vrel; + double mi,mj,meff; + double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; + + double knfac, damp_normal, damp_normal_prefactor; + double k_tangential, damp_tangential; + double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; + double fs, fs1, fs2, fs3; + + // for JKR + double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; + double delta, t0, t1, t2, t3, t4, t5, t6; + double sqrt1, sqrt2, sqrt3; + + // rolling + double k_roll, damp_roll; + double rollmag; + double fr, fr1, fr2, fr3; + + // twisting + double k_twist, damp_twist, mu_twist; + double signtwist, magtwist, magtortwist, Mtcrit; + + double shrmag; + int jnum; + int *jlist; + double *history,*allhistory; + + int nall = atom->nlocal + atom->nghost; + if ((i >= nall) || (j >= nall)) + error->all(FLERR,"Not enough atoms for pair granular single function"); + + double *radius = atom->radius; + radi = radius[i]; + radj = radius[j]; + radsum = radi + radj; + Reff = (radsum > 0.0) ? radi*radj/radsum : 0.0; + + bool touchflag; + E = normal_coeffs[itype][jtype][0]; + if (normal_model[itype][jtype] == JKR) { + E *= THREEQUARTERS; + R2 = Reff*Reff; + coh = normal_coeffs[itype][jtype][3]; + a = cbrt(9.0*MY_PI*coh*R2/(4*E)); + delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); + dist_pulloff = radsum+delta_pulloff; + touchflag = (rsq <= dist_pulloff*dist_pulloff); + } else touchflag = (rsq <= radsum*radsum); + + if (!touchflag) { + fforce = 0.0; + for (int m = 0; m < single_extra; m++) svector[m] = 0.0; + return 0.0; + } + + double **x = atom->x; + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + r = sqrt(rsq); + rinv = 1.0/r; + + nx = delx*rinv; + ny = dely*rinv; + nz = delz*rinv; + + // relative translational velocity + + double **v = atom->v; + vr1 = v[i][0] - v[j][0]; + vr2 = v[i][1] - v[j][1]; + vr3 = v[i][2] - v[j][2]; + + // normal component + + vnnr = vr1*nx + vr2*ny + vr3*nz; + vn1 = nx*vnnr; + vn2 = ny*vnnr; + vn3 = nz*vnnr; + + // tangential component + + vt1 = vr1 - vn1; + vt2 = vr2 - vn2; + vt3 = vr3 - vn3; + + // relative rotational velocity + + double **omega = atom->omega; + wr1 = (radi*omega[i][0] + radj*omega[j][0]); + wr2 = (radi*omega[i][1] + radj*omega[j][1]); + wr3 = (radi*omega[i][2] + radj*omega[j][2]); + + // meff = effective mass of pair of particles + // if I or J part of rigid body, use body mass + // if I or J is frozen, meff is other particle + + double *rmass = atom->rmass; + int *mask = atom->mask; + + mi = rmass[i]; + mj = rmass[j]; + if (fix_rigid) { + // NOTE: ensure mass_rigid is current for owned+ghost atoms? + if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; + if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; + } + + meff = mi*mj / (mi+mj); + if (mask[i] & freeze_group_bit) meff = mj; + if (mask[j] & freeze_group_bit) meff = mi; + + delta = radsum - r; + dR = delta*Reff; + if (normal_model[itype][jtype] == JKR) { + dR2 = dR*dR; + t0 = coh*coh*R2*R2*E; + t1 = PI27SQ*t0; + t2 = 8*dR*dR2*E*E*E; + t3 = 4*dR2*E; + // in case sqrt(0) < 0 due to precision issues + sqrt1 = MAX(0, t0*(t1+2*t2)); + t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); + t5 = t3/t4 + t4/E; + sqrt2 = MAX(0, 2*dR + t5); + t6 = sqrt(sqrt2); + sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); + a = INVROOT6*(t6 + sqrt(sqrt3)); + a2 = a*a; + knfac = normal_coeffs[itype][jtype][0]*a; + Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); + } else { + knfac = E; + Fne = knfac*delta; + a = sqrt(dR); + if (normal_model[itype][jtype] != HOOKE) { + Fne *= a; + knfac *= a; + } + if (normal_model[itype][jtype] == DMT) + Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; + } + + if (damping_model[itype][jtype] == VELOCITY) { + damp_normal = 1; + } else if (damping_model[itype][jtype] == MASS_VELOCITY) { + damp_normal = meff; + } else if (damping_model[itype][jtype] == VISCOELASTIC) { + damp_normal = a*meff; + } else if (damping_model[itype][jtype] == TSUJI) { + damp_normal = sqrt(meff*knfac); + } else damp_normal = 0.0; + + damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; + Fdamp = -damp_normal_prefactor*vnnr; + + Fntot = Fne + Fdamp; + + jnum = list->numneigh[i]; + jlist = list->firstneigh[i]; + + if (use_history) { + if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) + error->one(FLERR,"Pair granular single computation needs history"); + allhistory = fix_history->firstvalue[i]; + for (int jj = 0; jj < jnum; jj++) { + neighprev++; + if (neighprev >= jnum) neighprev = 0; + if (jlist[neighprev] == j) break; + } + history = &allhistory[size_history*neighprev]; + } + + //**************************************** + // tangential force, including history effects + //**************************************** + + // For linear, mindlin, mindlin_rescale: + // history = cumulative tangential displacement + // + // For mindlin/force, mindlin_rescale/force: + // history = cumulative tangential elastic force + + // tangential component + vt1 = vr1 - vn1; + vt2 = vr2 - vn2; + vt3 = vr3 - vn3; + + // relative rotational velocity + wr1 = (radi*omega[i][0] + radj*omega[j][0]); + wr2 = (radi*omega[i][1] + radj*omega[j][1]); + wr3 = (radi*omega[i][2] + radj*omega[j][2]); + + // relative tangential velocities + vtr1 = vt1 - (nz*wr2-ny*wr3); + vtr2 = vt2 - (nx*wr3-nz*wr1); + vtr3 = vt3 - (ny*wr1-nx*wr2); + vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; + vrel = sqrt(vrel); + + if (normal_model[itype][jtype] == JKR) { + F_pulloff = 3*MY_PI*coh*Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else if (normal_model[itype][jtype] == DMT) { + F_pulloff = 4*MY_PI*coh*Reff; + Fncrit = fabs(Fne + 2*F_pulloff); + } else { + Fncrit = fabs(Fntot); + } + Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; + + //------------------------------ + // tangential forces + //------------------------------ + k_tangential = tangential_coeffs[itype][jtype][0]; + damp_tangential = tangential_coeffs[itype][jtype][1]*damp_normal_prefactor; + + if (tangential_history) { + if (tangential_model[itype][jtype] != TANGENTIAL_HISTORY) { + k_tangential *= a; + } + + shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + + history[2]*history[2]); + + // tangential forces = history + tangential velocity damping + if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || + tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { + fs1 = -k_tangential*history[0] - damp_tangential*vtr1; + fs2 = -k_tangential*history[1] - damp_tangential*vtr2; + fs3 = -k_tangential*history[2] - damp_tangential*vtr3; + } else { + fs1 = history[0] - damp_tangential*vtr1; + fs2 = history[1] - damp_tangential*vtr2; + fs3 = history[2] - damp_tangential*vtr3; + } + + // rescale frictional forces if needed + fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); + if (fs > Fscrit) { + if (shrmag != 0.0) { + fs1 *= Fscrit/fs; + fs2 *= Fscrit/fs; + fs3 *= Fscrit/fs; + fs *= Fscrit/fs; + } else fs1 = fs2 = fs3 = fs = 0.0; + } + + // classic pair gran/hooke (no history) + } else { + fs = damp_tangential*vrel; + if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; + else Ft = 0.0; + fs1 = -Ft*vtr1; + fs2 = -Ft*vtr2; + fs3 = -Ft*vtr3; + fs = Ft*vrel; + } + + //**************************************** + // rolling resistance + //**************************************** + + if ((roll_model[itype][jtype] != ROLL_NONE) + || (twist_model[itype][jtype] != TWIST_NONE)) { + relrot1 = omega[i][0] - omega[j][0]; + relrot2 = omega[i][1] - omega[j][1]; + relrot3 = omega[i][2] - omega[j][2]; + + // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) + // this is different from the Marshall papers, + // which use the Bagi/Kuhn formulation + // for rolling velocity (see Wang et al for why the latter is wrong) + + vrl1 = Reff*(relrot2*nz - relrot3*ny); //- 0.5*((radj-radi)/radsum)*vtr1; + vrl2 = Reff*(relrot3*nx - relrot1*nz); //- 0.5*((radj-radi)/radsum)*vtr2; + vrl3 = Reff*(relrot1*ny - relrot2*nx); //- 0.5*((radj-radi)/radsum)*vtr3; + + int rhist0 = roll_history_index; + int rhist1 = rhist0 + 1; + int rhist2 = rhist1 + 1; + + // rolling displacement + rollmag = sqrt(history[rhist0]*history[rhist0] + + history[rhist1]*history[rhist1] + + history[rhist2]*history[rhist2]); + + k_roll = roll_coeffs[itype][jtype][0]; + damp_roll = roll_coeffs[itype][jtype][1]; + fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; + fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; + fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; + + // rescale frictional displacements and forces if needed + Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; + + fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); + if (fr > Frcrit) { + if (rollmag != 0.0) { + fr1 *= Frcrit/fr; + fr2 *= Frcrit/fr; + fr3 *= Frcrit/fr; + fr *= Frcrit/fr; + } else fr1 = fr2 = fr3 = fr = 0.0; + } + } else fr1 = fr2 = fr3 = fr = 0.0; + + //**************************************** + // twisting torque, including history effects + //**************************************** + + if (twist_model[itype][jtype] != TWIST_NONE) { + // omega_T (eq 29 of Marshall) + magtwist = relrot1*nx + relrot2*ny + relrot3*nz; + if (twist_model[itype][jtype] == TWIST_MARSHALL) { + k_twist = 0.5*k_tangential*a*a;; //eq 32 + damp_twist = 0.5*damp_tangential*a*a; + mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2];; + } else { + k_twist = twist_coeffs[itype][jtype][0]; + damp_twist = twist_coeffs[itype][jtype][1]; + mu_twist = twist_coeffs[itype][jtype][2]; + } + // M_t torque (eq 30) + magtortwist = -k_twist*history[twist_history_index] - damp_twist*magtwist; + signtwist = (magtwist > 0) - (magtwist < 0); + Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) + if (fabs(magtortwist) > Mtcrit) { + magtortwist = -Mtcrit * signtwist; // eq 34 + } else magtortwist = 0.0; + } else magtortwist = 0.0; + + // set force and return no energy + + fforce = Fntot*rinv; + + // set single_extra quantities + + svector[0] = fs1; + svector[1] = fs2; + svector[2] = fs3; + svector[3] = fs; + svector[4] = fr1; + svector[5] = fr2; + svector[6] = fr3; + svector[7] = fr; + svector[8] = magtortwist; + svector[9] = delx; + svector[10] = dely; + svector[11] = delz; + return 0.0; +} + +/* ---------------------------------------------------------------------- */ + +int PairGranular::pack_forward_comm(int n, int *list, double *buf, + int /* pbc_flag */, int * /* pbc */) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = mass_rigid[j]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void PairGranular::unpack_forward_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) + mass_rigid[i] = buf[m++]; +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based arrays +------------------------------------------------------------------------- */ + +double PairGranular::memory_usage() +{ + double bytes = (double)nmax * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + mixing of Young's modulus (E) +------------------------------------------------------------------------- */ + +double PairGranular::mix_stiffnessE(double Eii, double Ejj, + double poisii, double poisjj) +{ + return 1/((1-poisii*poisii)/Eii+(1-poisjj*poisjj)/Ejj); +} + +/* ---------------------------------------------------------------------- + mixing of shear modulus (G) +------------------------------------------------------------------------ */ + +double PairGranular::mix_stiffnessG(double Eii, double Ejj, + double poisii, double poisjj) +{ + return 1/((2*(2-poisii)*(1+poisii)/Eii) + (2*(2-poisjj)*(1+poisjj)/Ejj)); +} + +/* ---------------------------------------------------------------------- + mixing of everything else +------------------------------------------------------------------------- */ + +double PairGranular::mix_geom(double valii, double valjj) +{ + return sqrt(valii*valjj); +} + + +/* ---------------------------------------------------------------------- + compute pull-off distance (beyond contact) for a given radius and atom type +------------------------------------------------------------------------- */ + +double PairGranular::pulloff_distance(double radi, double radj, + int itype, int jtype) +{ + double E, coh, a, Reff; + Reff = radi*radj/(radi+radj); + if (Reff <= 0) return 0; + coh = normal_coeffs[itype][jtype][3]; + E = normal_coeffs[itype][jtype][0]*THREEQUARTERS; + a = cbrt(9*MY_PI*coh*Reff*Reff/(4*E)); + return a*a/Reff - 2*sqrt(MY_PI*coh*a/E); +} + +/* ---------------------------------------------------------------------- + transfer history during fix/neigh/history exchange + only needed if any history entries i-j are not just negative of j-i entries +------------------------------------------------------------------------- */ + +void PairGranular::transfer_history(double* source, double* target) +{ + for (int i = 0; i < size_history; i++) + target[i] = history_transfer_factors[i]*source[i]; +} From 46f98ec4dc85d04d0f5e65cb2155e6b3e3a24fcb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 10:23:16 -0400 Subject: [PATCH 227/370] make compatible with const data pointers as arguments --- src/library.cpp | 18 +++++++++++------- src/library.h | 14 +++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index 7dbe5f9467..ac059f53ae 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -3822,8 +3822,8 @@ X(1),Y(1),Z(1),X(2),Y(2),Z(2),...,X(N),Y(N),Z(N). * \return number of atoms created on success; -1 on failure (no box, no atom IDs, etc.) */ -int lammps_create_atoms(void *handle, int n, tagint *id, int *type, - double *x, double *v, imageint *image, +int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, + const double *x, const double *v, const imageint *image, int bexpand) { LAMMPS *lmp = (LAMMPS *) handle; @@ -3859,13 +3859,17 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, int nlocal_prev = nlocal; double xdata[3]; + imageint idata, *img; for (int i = 0; i < n; i++) { xdata[0] = x[3*i]; xdata[1] = x[3*i+1]; xdata[2] = x[3*i+2]; - imageint * img = image ? image + i : nullptr; - tagint tag = id ? id[i] : 0; + if (image) { + idata = image[i]; + img = &idata; + } else img = nullptr; + const tagint tag = id ? id[i] : 0; // create atom only on MPI rank that would own it @@ -3943,7 +3947,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, * multiple requests from the same pair style instance * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_pair_neighlist(void *handle, char *style, int exact, int nsub, int reqid) { +int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int nsub, int reqid) { LAMMPS *lmp = (LAMMPS *) handle; Pair *pair = lmp->force->pair_match(style, exact, nsub); @@ -3973,7 +3977,7 @@ int lammps_find_pair_neighlist(void *handle, char *style, int exact, int nsub, i * multiple requests from the same fix * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_fix_neighlist(void *handle, char *id, int reqid) { +int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { LAMMPS *lmp = (LAMMPS *) handle; const int ifix = lmp->modify->find_fix(id); if (ifix < 0) return -1; @@ -4003,7 +4007,7 @@ int lammps_find_fix_neighlist(void *handle, char *id, int reqid) { * multiple requests from the same compute * \return return neighbor list index if found, otherwise -1 */ -int lammps_find_compute_neighlist(void* handle, char *id, int reqid) { +int lammps_find_compute_neighlist(void* handle, const char *id, int reqid) { LAMMPS *lmp = (LAMMPS *) handle; const int icompute = lmp->modify->find_compute(id); if (icompute < 0) return -1; diff --git a/src/library.h b/src/library.h index 11cd72388a..3500e1b65e 100644 --- a/src/library.h +++ b/src/library.h @@ -160,20 +160,20 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data); void lammps_scatter_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data); #if !defined(LAMMPS_BIGBIG) -int lammps_create_atoms(void *handle, int n, int *id, int *type, - double *x, double *v, int *image, int bexpand); +int lammps_create_atoms(void *handle, int n, const int *id, const int *type, + const double *x, const double *v, const int *image, int bexpand); #else -int lammps_create_atoms(void *handle, int n, int64_t *id, int *type, - double *x, double *v, int64_t* image, int bexpand); +int lammps_create_atoms(void *handle, int n, const int64_t *id, const int *type, + const double *x, const double *v, const int64_t* image, int bexpand); #endif /* ---------------------------------------------------------------------- * Library functions for accessing neighbor lists * ---------------------------------------------------------------------- */ -int lammps_find_pair_neighlist(void *handle, char *style, int exact, int nsub, int request); -int lammps_find_fix_neighlist(void *handle, char *id, int request); -int lammps_find_compute_neighlist(void *handle, char *id, int request); +int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int nsub, int request); +int lammps_find_fix_neighlist(void *handle, const char *id, int request); +int lammps_find_compute_neighlist(void *handle, const char *id, int request); int lammps_neighlist_num_elements(void *handle, int idx); void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *iatom, int *numneigh, int **neighbors); From 432ccffb3e7a719d5b0db9cc8a992ef105f2266a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 09:58:20 -0400 Subject: [PATCH 228/370] find manybody potentials --- unittest/c-library/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 121c42f7fd..3c24cdcff4 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -11,6 +11,7 @@ add_executable(test_library_properties test_library_properties.cpp test_main.cpp target_link_libraries(test_library_properties PRIVATE lammps GTest::GTest GTest::GMock) target_compile_definitions(test_library_properties PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) add_test(LibraryProperties test_library_properties) +set_tests_properties(LibraryProperties PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") set(TEST_CONFIG_DEFS "-DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR};-DLAMMPS_${LAMMPS_SIZES}") set(PKG_COUNT 0) From 5520d6edd737af74792386e0c7f4759757a9ff90 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 10:24:46 -0400 Subject: [PATCH 229/370] confirm that no incompatible neighbor lists are found --- unittest/python/python-commands.py | 2 ++ unittest/python/python-numpy.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 530cea8b13..f3526d6d4b 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -313,6 +313,8 @@ create_atoms 1 single & self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) self.assertNotEqual(self.lmp.find_compute_neighlist("dist"),-1) + self.assertEqual(self.lmp.find_compute_neighlist("xxx"),-1) + self.assertEqual(self.lmp.find_fix_neighlist("dist"),-1) # the compute has a half neighbor list nlist = self.lmp.get_neighlist(self.lmp.find_compute_neighlist("dist")) diff --git a/unittest/python/python-numpy.py b/unittest/python/python-numpy.py index f3a116b91b..dc121691ab 100644 --- a/unittest/python/python-numpy.py +++ b/unittest/python/python-numpy.py @@ -364,6 +364,8 @@ class PythonNumpy(unittest.TestCase): self.assertNotEqual(self.lmp.find_pair_neighlist("lj/cut"),-1) self.assertNotEqual(self.lmp.find_compute_neighlist("dist"),-1) + self.assertEqual(self.lmp.find_compute_neighlist("xxx"),-1) + self.assertEqual(self.lmp.find_fix_neighlist("dist"),-1) # the compute has a half neighbor list nlist = self.lmp.numpy.get_neighlist(self.lmp.find_compute_neighlist("dist")) From cea4298946f8be5a7c605e6d1f9d55abb32ca8cd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 09:59:09 -0400 Subject: [PATCH 230/370] silence LAMMPS output, if requested --- unittest/c-library/test_library_properties.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 182beee7d0..2b2b1cd58e 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -160,7 +160,9 @@ TEST_F(LibraryProperties, box) boxlo[0] = -6.1; boxhi[1] = 7.3; xy = 0.1; + if (!verbose) ::testing::internal::CaptureStdout(); lammps_reset_box(lmp, boxlo, boxhi, xy, yz, xz); + if (!verbose) ::testing::internal::GetCapturedStdout(); lammps_extract_box(lmp, boxlo, boxhi, &xy, &yz, &xz, pflags, &boxflag); EXPECT_DOUBLE_EQ(boxlo[0], -6.1); EXPECT_DOUBLE_EQ(boxlo[1], -7.692866); From 1a48667026821125717e3410d268e96cf428747b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 10:00:14 -0400 Subject: [PATCH 231/370] add minimal test for neighbor list functions --- .../c-library/test_library_properties.cpp | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 2b2b1cd58e..19e881e32b 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -315,6 +315,60 @@ TEST_F(LibraryProperties, global) EXPECT_DOUBLE_EQ((*d_ptr), 0.1); }; +TEST_F(LibraryProperties, neighlist) +{ + if (!lammps_has_style(lmp, "pair", "sw")) GTEST_SKIP(); + const char sysinit[] = "boundary f f f\n" + "units real\n" + "region box block -5 5 -5 5 -5 5\n" + "create_box 2 box\n" + "mass 1 1.0\n" + "mass 2 1.0\n" + "pair_style hybrid/overlay lj/cut 4.0 lj/cut 4.0 morse 4.0 sw\n" + "pair_coeff * * sw Si.sw Si NULL\n" + "pair_coeff 1 2 morse 0.2 2.0 2.0\n" + "pair_coeff 2 2 lj/cut 1 0.1 2.0\n" + "pair_coeff * * lj/cut 2 0.01 2.0\n" + "compute dist all pair/local dist\n" + "fix dist all ave/histo 1 1 1 0.0 3.0 4 c_dist mode vector\n" + "thermo_style custom f_dist[*]"; + + const double pos[] = {0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, + 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.1, 0.0, 0.0, 1.0}; + const tagint ids[] = {1, 2, 3, 4, 5, 6, 7}; + const int types[] = {1, 1, 1, 1, 2, 2, 2}; + + const int numatoms = sizeof(ids) / sizeof(tagint); + + if (!verbose) ::testing::internal::CaptureStdout(); + lammps_commands_string(lmp, sysinit); + lammps_create_atoms(lmp, numatoms, ids, types, pos, nullptr, nullptr, 0); + lammps_command(lmp, "run 0 post no"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + + int nhisto = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,0,0); + int nskip = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,1,0); + double minval = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,2,0); + double maxval = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,3,0); + // 21 pair distances counted, none skipped, smallest 1.0, largest 2.1 + EXPECT_EQ(nhisto,21); + EXPECT_EQ(nskip,0); + EXPECT_DOUBLE_EQ(minval,1.0); + EXPECT_DOUBLE_EQ(maxval,2.1); + + const int nlocal = lammps_extract_setting(lmp, "nlocal"); + EXPECT_EQ(nlocal, numatoms); + EXPECT_NE(lammps_find_pair_neighlist(lmp, "sw", 1, 0, 0), -1); + EXPECT_NE(lammps_find_pair_neighlist(lmp, "morse", 1, 0, 0), -1); + EXPECT_NE(lammps_find_pair_neighlist(lmp, "lj/cut", 1, 1, 0), -1); + EXPECT_NE(lammps_find_pair_neighlist(lmp, "lj/cut", 1, 2, 0), -1); + EXPECT_EQ(lammps_find_pair_neighlist(lmp, "lj/cut", 1, 0, 0), -1); + EXPECT_EQ(lammps_find_pair_neighlist(lmp, "hybrid/overlay", 1, 0, 0), -1); + EXPECT_NE(lammps_find_compute_neighlist(lmp, "dist", 0),-1); + EXPECT_EQ(lammps_find_fix_neighlist(lmp, "dist", 0),-1); + EXPECT_EQ(lammps_find_compute_neighlist(lmp, "xxx", 0),-1); +}; + class AtomProperties : public ::testing::Test { protected: void *lmp; From 6205375c0317ec93fe1bb4715cef61bff1f969eb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 10:04:16 -0400 Subject: [PATCH 232/370] allow const char for compute/fix id arguments --- src/library.cpp | 4 ++-- src/library.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/library.cpp b/src/library.cpp index ac059f53ae..8f23ffcb6c 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -1615,7 +1615,7 @@ lists the available options. * \return pointer (cast to ``void *``) to the location of the * requested data or ``NULL`` if not found. */ -void *lammps_extract_compute(void *handle, char *id, int style, int type) +void *lammps_extract_compute(void *handle, const char *id, int style, int type) { LAMMPS *lmp = (LAMMPS *) handle; @@ -1801,7 +1801,7 @@ The following table lists the available options. * \return pointer (cast to ``void *``) to the location of the * requested data or ``NULL`` if not found. */ -void *lammps_extract_fix(void *handle, char *id, int style, int type, +void *lammps_extract_fix(void *handle, const char *id, int style, int type, int nrow, int ncol) { LAMMPS *lmp = (LAMMPS *) handle; diff --git a/src/library.h b/src/library.h index 3500e1b65e..8db19f7eb2 100644 --- a/src/library.h +++ b/src/library.h @@ -138,8 +138,8 @@ void *lammps_extract_atom(void *handle, const char *name); * Library functions to access data from computes, fixes, variables in LAMMPS * ---------------------------------------------------------------------- */ -void *lammps_extract_compute(void *handle, char *id, int, int); -void *lammps_extract_fix(void *handle, char *, int, int, int, int); +void *lammps_extract_compute(void *handle, const char *, int, int); +void *lammps_extract_fix(void *handle, const char *, int, int, int, int); void *lammps_extract_variable(void *handle, const char *, const char *); int lammps_set_variable(void *, char *, char *); From cfc39b5a7338e8e621542cfaea10c29adbbd08c7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 10:44:07 -0400 Subject: [PATCH 233/370] complete porting python neighborlist test to c-library version --- .../c-library/test_library_properties.cpp | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 19e881e32b..de40c85617 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -367,6 +367,62 @@ TEST_F(LibraryProperties, neighlist) EXPECT_NE(lammps_find_compute_neighlist(lmp, "dist", 0),-1); EXPECT_EQ(lammps_find_fix_neighlist(lmp, "dist", 0),-1); EXPECT_EQ(lammps_find_compute_neighlist(lmp, "xxx", 0),-1); + + // full neighbor list for 4 type 1 atoms + // all have 3 type 1 atom neighbors + int idx = lammps_find_pair_neighlist(lmp, "sw", 1, 0, 0); + int num = lammps_neighlist_num_elements(lmp, idx); + EXPECT_EQ(num, 4); + int iatom, inum, *neighbors; + for (int i=0; i < num; ++i) { + lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); + EXPECT_EQ(iatom,i); + EXPECT_EQ(inum,3); + EXPECT_NE(neighbors,nullptr); + } + + // half neighbor list for all pairs between type 1 and type 2 + // 4 type 1 atoms with 3 type 2 neighbors and 3 type 2 atoms without neighbors + idx = lammps_find_pair_neighlist(lmp, "morse", 0, 0, 0); + num = lammps_neighlist_num_elements(lmp, idx); + EXPECT_EQ(num, nlocal); + for (int i=0; i < num; ++i) { + lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); + if (i < 4) EXPECT_EQ(inum, 3); + else EXPECT_EQ(inum,0); + EXPECT_NE(neighbors,nullptr); + } + + // half neighbor list between type 2 atoms only + // 3 pairs with 2, 1, 0 neighbors + idx = lammps_find_pair_neighlist(lmp, "lj/cut", 1, 1, 0); + num = lammps_neighlist_num_elements(lmp, idx); + EXPECT_EQ(num, 3); + for (int i=0; i < num; ++i) { + lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); + EXPECT_EQ(inum,2-i); + EXPECT_NE(neighbors,nullptr); + } + + // half neighbor list between all pairs. same as simple lj/cut case + idx = lammps_find_pair_neighlist(lmp, "lj/cut", 1, 2, 0); + num = lammps_neighlist_num_elements(lmp, idx); + EXPECT_EQ(num, nlocal); + for (int i=0; i < num; ++i) { + lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); + EXPECT_EQ(inum,nlocal-1-i); + EXPECT_NE(neighbors,nullptr); + } + + // the compute has a half neighbor list + idx = lammps_find_compute_neighlist(lmp, "dist", 0); + num = lammps_neighlist_num_elements(lmp, idx); + EXPECT_EQ(num, nlocal); + for (int i=0; i < num; ++i) { + lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); + EXPECT_EQ(inum,nlocal-1-i); + EXPECT_NE(neighbors,nullptr); + } }; class AtomProperties : public ::testing::Test { From 7244ccf8b14c784aef356735df242f92368db681 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 11:04:02 -0400 Subject: [PATCH 234/370] update format --- .../c-library/test_library_properties.cpp | 61 ++++++++++--------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index de40c85617..07e920bda7 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -346,15 +346,18 @@ TEST_F(LibraryProperties, neighlist) lammps_command(lmp, "run 0 post no"); if (!verbose) ::testing::internal::GetCapturedStdout(); - int nhisto = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,0,0); - int nskip = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,1,0); - double minval = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,2,0); - double maxval = *(double *)lammps_extract_fix(lmp,"dist",LMP_STYLE_GLOBAL,LMP_TYPE_VECTOR,3,0); + int nhisto = + *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, 0); + int nskip = *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, 0); + double minval = + *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, 0); + double maxval = + *(double *)lammps_extract_fix(lmp, "dist", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 3, 0); // 21 pair distances counted, none skipped, smallest 1.0, largest 2.1 - EXPECT_EQ(nhisto,21); - EXPECT_EQ(nskip,0); - EXPECT_DOUBLE_EQ(minval,1.0); - EXPECT_DOUBLE_EQ(maxval,2.1); + EXPECT_EQ(nhisto, 21); + EXPECT_EQ(nskip, 0); + EXPECT_DOUBLE_EQ(minval, 1.0); + EXPECT_DOUBLE_EQ(maxval, 2.1); const int nlocal = lammps_extract_setting(lmp, "nlocal"); EXPECT_EQ(nlocal, numatoms); @@ -364,9 +367,9 @@ TEST_F(LibraryProperties, neighlist) EXPECT_NE(lammps_find_pair_neighlist(lmp, "lj/cut", 1, 2, 0), -1); EXPECT_EQ(lammps_find_pair_neighlist(lmp, "lj/cut", 1, 0, 0), -1); EXPECT_EQ(lammps_find_pair_neighlist(lmp, "hybrid/overlay", 1, 0, 0), -1); - EXPECT_NE(lammps_find_compute_neighlist(lmp, "dist", 0),-1); - EXPECT_EQ(lammps_find_fix_neighlist(lmp, "dist", 0),-1); - EXPECT_EQ(lammps_find_compute_neighlist(lmp, "xxx", 0),-1); + EXPECT_NE(lammps_find_compute_neighlist(lmp, "dist", 0), -1); + EXPECT_EQ(lammps_find_fix_neighlist(lmp, "dist", 0), -1); + EXPECT_EQ(lammps_find_compute_neighlist(lmp, "xxx", 0), -1); // full neighbor list for 4 type 1 atoms // all have 3 type 1 atom neighbors @@ -374,11 +377,11 @@ TEST_F(LibraryProperties, neighlist) int num = lammps_neighlist_num_elements(lmp, idx); EXPECT_EQ(num, 4); int iatom, inum, *neighbors; - for (int i=0; i < num; ++i) { + for (int i = 0; i < num; ++i) { lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); - EXPECT_EQ(iatom,i); - EXPECT_EQ(inum,3); - EXPECT_NE(neighbors,nullptr); + EXPECT_EQ(iatom, i); + EXPECT_EQ(inum, 3); + EXPECT_NE(neighbors, nullptr); } // half neighbor list for all pairs between type 1 and type 2 @@ -386,11 +389,13 @@ TEST_F(LibraryProperties, neighlist) idx = lammps_find_pair_neighlist(lmp, "morse", 0, 0, 0); num = lammps_neighlist_num_elements(lmp, idx); EXPECT_EQ(num, nlocal); - for (int i=0; i < num; ++i) { + for (int i = 0; i < num; ++i) { lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); - if (i < 4) EXPECT_EQ(inum, 3); - else EXPECT_EQ(inum,0); - EXPECT_NE(neighbors,nullptr); + if (i < 4) + EXPECT_EQ(inum, 3); + else + EXPECT_EQ(inum, 0); + EXPECT_NE(neighbors, nullptr); } // half neighbor list between type 2 atoms only @@ -398,30 +403,30 @@ TEST_F(LibraryProperties, neighlist) idx = lammps_find_pair_neighlist(lmp, "lj/cut", 1, 1, 0); num = lammps_neighlist_num_elements(lmp, idx); EXPECT_EQ(num, 3); - for (int i=0; i < num; ++i) { + for (int i = 0; i < num; ++i) { lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); - EXPECT_EQ(inum,2-i); - EXPECT_NE(neighbors,nullptr); + EXPECT_EQ(inum, 2 - i); + EXPECT_NE(neighbors, nullptr); } // half neighbor list between all pairs. same as simple lj/cut case idx = lammps_find_pair_neighlist(lmp, "lj/cut", 1, 2, 0); num = lammps_neighlist_num_elements(lmp, idx); EXPECT_EQ(num, nlocal); - for (int i=0; i < num; ++i) { + for (int i = 0; i < num; ++i) { lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); - EXPECT_EQ(inum,nlocal-1-i); - EXPECT_NE(neighbors,nullptr); + EXPECT_EQ(inum, nlocal - 1 - i); + EXPECT_NE(neighbors, nullptr); } // the compute has a half neighbor list idx = lammps_find_compute_neighlist(lmp, "dist", 0); num = lammps_neighlist_num_elements(lmp, idx); EXPECT_EQ(num, nlocal); - for (int i=0; i < num; ++i) { + for (int i = 0; i < num; ++i) { lammps_neighlist_element_neighbors(lmp, idx, i, &iatom, &inum, &neighbors); - EXPECT_EQ(inum,nlocal-1-i); - EXPECT_NE(neighbors,nullptr); + EXPECT_EQ(inum, nlocal - 1 - i); + EXPECT_NE(neighbors, nullptr); } }; From a4a23f3ef18cf0a82de27208e13e09ad2fea3011 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 11:04:24 -0400 Subject: [PATCH 235/370] add an example for looking up and looping over a neighbor list --- doc/src/Python_neighbor.rst | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/src/Python_neighbor.rst b/doc/src/Python_neighbor.rst index cba117ad20..416fcb30a8 100644 --- a/doc/src/Python_neighbor.rst +++ b/doc/src/Python_neighbor.rst @@ -1,6 +1,43 @@ Neighbor list access ==================== +Access to neighbor lists is handled through a couple of wrapper classes +that allows to treat it like either a python list or a NumPy array. The +access procedure is similar to that of the C-library interface: use one +of the "find" functions to look up the index of the neighbor list in the +global table of neighbor lists and then get access to the neigbor list +data. The code sample below demonstrates reading the neighbor list data +using the NumPy access method. + +.. code-block:: python + + from lammps import lammps + import numpy as np + + lmp = lammps() + lmp.commands_string(""" + region box block -2 2 -2 2 -2 2 + lattice fcc 1.0 + create_box 1 box + create_atoms 1 box + mass 1 1.0 + pair_style lj/cut 2.5 + pair_coeff 1 1 1.0 1.0 + run 0 post no""") + + # look up the neighbor list + nlidx = lmp.find_pair_neighlist('lj/cut') + nl = lmp.numpy.get_neighlist(nlidx) + tags = lmp.extract_atom('id') + print("half neighbor list with {} entries".format(nl.size)) + # print neighbor list contents + for i in range(0,nl.size): + idx, nlist = nl.get(i) + print("\natom {} with ID {} has {} neighbors:".format(idx,tags[idx],nlist.size)) + if nlist.size > 0: + for n in np.nditer(nlist): + print(" atom {} with ID {}".format(n,tags[n])) + **Methods:** * :py:meth:`lammps.get_neighlist() `: Get neighbor list for given index From 17355f967a383968d7f618afde28b38ecbe4bce4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 11:11:18 -0400 Subject: [PATCH 236/370] address spelling and manual processing issues --- doc/src/Library_scatter.rst | 2 +- doc/src/Python_neighbor.rst | 2 +- doc/utils/sphinx-config/false_positives.txt | 1 + python/lammps/core.py | 4 ++-- src/library.cpp | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/src/Library_scatter.rst b/doc/src/Library_scatter.rst index 40a79c2d9b..b45f45f6fb 100644 --- a/doc/src/Library_scatter.rst +++ b/doc/src/Library_scatter.rst @@ -76,7 +76,7 @@ It documents the following functions: ----------------------- -.. doxygenfunction:: lammps_create_atoms(void *handle, int n, int *id, int *type, double *x, double *v, int *image, int bexpand) +.. doxygenfunction:: lammps_create_atoms(void *handle, int n, const int *id, const int *type, const double *x, const double *v, const int *image, int bexpand) :project: progguide diff --git a/doc/src/Python_neighbor.rst b/doc/src/Python_neighbor.rst index 416fcb30a8..00c4cc8996 100644 --- a/doc/src/Python_neighbor.rst +++ b/doc/src/Python_neighbor.rst @@ -5,7 +5,7 @@ Access to neighbor lists is handled through a couple of wrapper classes that allows to treat it like either a python list or a NumPy array. The access procedure is similar to that of the C-library interface: use one of the "find" functions to look up the index of the neighbor list in the -global table of neighbor lists and then get access to the neigbor list +global table of neighbor lists and then get access to the neighbor list data. The code sample below demonstrates reading the neighbor list data using the NumPy access method. diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 38a6971f4c..c10e978428 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -2681,6 +2681,7 @@ representable Reproducibility reproducibility repuls +reqid rescale rescaled rescales diff --git a/python/lammps/core.py b/python/lammps/core.py index 11adecdca1..1f606f67f4 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1753,9 +1753,9 @@ class lammps(object): Search for a neighbor list requested by a pair style instance that matches "style". If exact is True, the pair style name must match exactly. If exact is False, the pair style name is matched against - "style" as regular expression or substring. If the pair style is a + "style" as regular expression or sub-string. If the pair style is a hybrid pair style, the style is instead matched against the hybrid - sub-styles. If the same pair style is used as substyle multiple + sub-styles. If the same pair style is used as sub-style multiple types, you must set nsub to a value n > 0 which indicates the nth instance of that sub-style to be used (same as for the pair_coeff command). The default value of 0 will fail to match in that case. diff --git a/src/library.cpp b/src/library.cpp index 8f23ffcb6c..b72c8d7220 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -3926,7 +3926,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, * This function determines which of the available neighbor lists for * pair styles matches the given conditions. It first matches the style * name. If exact is 1 the name must match exactly, if exact is 0, a - * regular expression or substring match is done. If the pair style is + * regular expression or sub-string match is done. If the pair style is * hybrid or hybrid/overlay the style is matched against the sub styles * instead. * If a the same pair style is used multiple times as a sub-style, the @@ -3941,7 +3941,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. * \param style String used to search for pair style instance * \param exact Flag to control whether style should match exactly or only - * a regular expression / substring match is applied. + * a regular expression / sub-string match is applied. * \param nsub match nsub-th hybrid sub-style instance of the same style * \param reqid request id to identify neighbor list in case there are * multiple requests from the same pair style instance From b2e9ffa67371f340ebae59e1285b26e1945b8f07 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 3 Apr 2021 11:15:00 -0400 Subject: [PATCH 237/370] add missing entry to standard packages list --- doc/src/Packages_standard.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/Packages_standard.rst b/doc/src/Packages_standard.rst index ab9be69ab3..81623c8d4a 100644 --- a/doc/src/Packages_standard.rst +++ b/doc/src/Packages_standard.rst @@ -71,6 +71,8 @@ package: +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`PERI ` | Peridynamics models | :doc:`pair_style peri ` | peri | no | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ +| :ref:`PLUGIN ` | Plugin loader command | :doc:`plugin ` | plugins | no | ++----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`POEMS ` | coupled rigid body motion | :doc:`fix poems ` | rigid | int | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`PYTHON ` | embed Python code in an input script | :doc:`python ` | python | sys | From 5e0b017d30281b7fb94e23a4c53d84defb7467d2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 20:51:58 -0400 Subject: [PATCH 238/370] update information about adding unit tests to reflect recent changes --- doc/src/Developer_unittest.rst | 45 ++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/doc/src/Developer_unittest.rst b/doc/src/Developer_unittest.rst index 4487dff11c..52753ee1b4 100644 --- a/doc/src/Developer_unittest.rst +++ b/doc/src/Developer_unittest.rst @@ -4,10 +4,10 @@ Adding tests for unit testing This section discusses adding or expanding tests for the unit test infrastructure included into the LAMMPS source code distribution. Unlike example inputs, unit tests focus on testing the "local" behavior -of individual features, tend to run very fast, and should be set up to -cover as much of the added code as possible. When contributing code to -the distribution, the LAMMPS developers will appreciate if additions -to the integrated unit test facility are included. +of individual features, tend to run fast, and should be set up to cover +as much of the added code as possible. When contributing code to the +distribution, the LAMMPS developers will appreciate if additions to the +integrated unit test facility are included. Given the complex nature of MD simulations where many operations can only be performed when suitable "real" simulation environment has been @@ -50,6 +50,9 @@ available: * - File name: - Test name: - Description: + * - ``test_argutils.cpp`` + - ArgInfo + - Tests for ``ArgInfo`` class used by LAMMPS * - ``test_fmtlib.cpp`` - FmtLib - Tests for ``fmtlib::`` functions used by LAMMPS @@ -155,23 +158,27 @@ have the desired effect: { ASSERT_EQ(lmp->update->ntimestep, 0); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_timestep 10"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + BEGIN_HIDE_OUTPUT(); + command("reset_timestep 10"); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->ntimestep, 10); - if (!verbose) ::testing::internal::CaptureStdout(); - lmp->input->one("reset_timestep 0"); - if (!verbose) ::testing::internal::GetCapturedStdout(); + BEGIN_HIDE_OUTPUT(); + command("reset_timestep 0"); + END_HIDE_OUTPUT(); ASSERT_EQ(lmp->update->ntimestep, 0); + + TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10");); + TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep");); + TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep 10 10");); + TEST_FAILURE(".*ERROR: Expected integer .*", command("reset_timestep xxx");); } -Please note the use of the (global) verbose variable to control whether -the LAMMPS command will be silent by capturing the output or not. In -the default case, verbose == false, the test output will be compact and -not mixed with LAMMPS output. However setting the verbose flag (via -setting the ``TEST_ARGS`` environment variable, ``TEST_ARGS=-v``) can be -helpful to understand why tests fail unexpectedly. +Please note the use of the ``BEGIN_HIDE_OUTPUT`` and ``END_HIDE_OUTPUT`` +functions that will capture output from running LAMMPS. This is normally +discarded but by setting the verbose flag (via setting the ``TEST_ARGS`` +environment variable, ``TEST_ARGS=-v``) it can be printed and used to +understand why tests fail unexpectedly. Another complexity of these tests stems from the need to capture situations where LAMMPS will stop with an error, i.e. handle so-called @@ -210,6 +217,12 @@ The following test programs are currently available: * - ``test_lattice_region.cpp`` - LatticeRegion - Tests to validate the :doc:`lattice ` and :doc:`region ` commands + * - ``test_groups.cpp`` + - GroupTest + - Tests to validate the :doc:`group ` command + * - ``test_variables.cpp`` + - VariableTest + - Tests to validate the :doc:`variable ` command * - ``test_kim_commands.cpp`` - KimCommands - Tests for several commands from the :ref:`KIM package ` From d1b6aaa3f3a6e1524864c6d582b9a0220ea5980c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 20:57:29 -0400 Subject: [PATCH 239/370] plugins also have a .so suffix on MacOS (unlike shared libs) --- unittest/commands/test_simple_commands.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 9173909806..9bd6e74c9b 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -328,11 +328,7 @@ TEST_F(SimpleCommandsTest, Units) #if defined(LMP_PLUGIN) TEST_F(SimpleCommandsTest, Plugin) { -#if defined(__APPLE__) - std::string loadfmt("plugin load {}plugin.dylib"); -#else std::string loadfmt("plugin load {}plugin.so"); -#endif ::testing::internal::CaptureStdout(); lmp->input->one(fmt::format(loadfmt, "hello")); auto text = ::testing::internal::GetCapturedStdout(); From 36c6410fd8fff5a583b8429f4a1c78cecdb87772 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 21:14:12 -0400 Subject: [PATCH 240/370] make skip() function argument optional and default to 1 --- src/tokenizer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tokenizer.h b/src/tokenizer.h index 2db9870866..b3bbf05296 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -41,7 +41,7 @@ public: Tokenizer& operator=(Tokenizer&&) = default; void reset(); - void skip(int n); + void skip(int n=1); bool has_next() const; bool contains(const std::string &str) const; std::string next(); @@ -104,7 +104,7 @@ public: bool has_next() const; bool contains(const std::string &value) const; - void skip(int ntokens); + void skip(int ntokens=1); size_t count(); }; From 1e7e930d55ca27103cdc601860c6c53fbfaeef8f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 21:14:40 -0400 Subject: [PATCH 241/370] generalize match to fit all rigid/small derived fixes --- src/velocity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/velocity.cpp b/src/velocity.cpp index b8d2e5229a..f4483074aa 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -108,7 +108,7 @@ void Velocity::command(int narg, char **arg) int initcomm = 0; if (style == ZERO && rfix >= 0 && - utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) initcomm = 1; + utils::strmatch(modify->fix[rfix]->style,"^rigid.*/small.*")) initcomm = 1; if ((style == CREATE || style == SET) && temperature && strcmp(temperature->style,"temp/cs") == 0) initcomm = 1; From 67d4302fc7befe67ff157b4e1584067efabea171 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 21:51:06 -0400 Subject: [PATCH 242/370] add tests for tokenizer skip() function and throwing an exception --- unittest/utils/test_tokenizer.cpp | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/unittest/utils/test_tokenizer.cpp b/unittest/utils/test_tokenizer.cpp index 69ec7a55d2..ec097abf62 100644 --- a/unittest/utils/test_tokenizer.cpp +++ b/unittest/utils/test_tokenizer.cpp @@ -43,6 +43,18 @@ TEST(Tokenizer, two_words) ASSERT_EQ(t.count(), 2); } +TEST(Tokenizer, skip) +{ + Tokenizer t("test word", " "); + ASSERT_TRUE(t.has_next()); + t.skip(); + ASSERT_TRUE(t.has_next()); + t.skip(1); + ASSERT_FALSE(t.has_next()); + ASSERT_EQ(t.count(), 2); + ASSERT_THROW(t.skip(), TokenizerException); +} + TEST(Tokenizer, prefix_separators) { Tokenizer t(" test word", " "); @@ -63,6 +75,18 @@ TEST(Tokenizer, iterate_words) ASSERT_EQ(t.count(), 2); } +TEST(Tokenizer, copy_constructor) +{ + Tokenizer t(" test word ", " "); + ASSERT_THAT(t.next(), Eq("test")); + ASSERT_THAT(t.next(), Eq("word")); + ASSERT_EQ(t.count(), 2); + Tokenizer u(t); + ASSERT_THAT(u.next(), Eq("test")); + ASSERT_THAT(u.next(), Eq("word")); + ASSERT_EQ(u.count(), 2); +} + TEST(Tokenizer, no_separator_path) { Tokenizer t("one", ":"); @@ -139,6 +163,26 @@ TEST(ValueTokenizer, empty_string) ASSERT_FALSE(values.has_next()); } +TEST(ValueTokenizer, two_words) +{ + ValueTokenizer t("test word", " "); + ASSERT_THAT(t.next_string(), Eq("test")); + ASSERT_THAT(t.next_string(), Eq("word")); + ASSERT_THROW(t.next_string(), TokenizerException); +} + +TEST(ValueTokenizer, skip) +{ + ValueTokenizer t("test word", " "); + ASSERT_TRUE(t.has_next()); + t.skip(); + ASSERT_TRUE(t.has_next()); + t.skip(1); + ASSERT_FALSE(t.has_next()); + ASSERT_EQ(t.count(), 2); + ASSERT_THROW(t.skip(), TokenizerException); +} + TEST(ValueTokenizer, bad_integer) { ValueTokenizer values("f10"); From a858c07e8a7ff8c11a939fbb6a9c3e9430634ca9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 21:51:48 -0400 Subject: [PATCH 243/370] add unit tests for empty id, invalid timespecs, and merge sort --- unittest/utils/test_utils.cpp | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index 81dda11615..0c6e38e342 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -331,6 +331,11 @@ TEST(Utils, valid_id7) ASSERT_TRUE(utils::is_id("___")); } +TEST(Utils, empty_id) +{ + ASSERT_FALSE(utils::is_id("")); +} + TEST(Utils, invalid_id1) { ASSERT_FALSE(utils::is_id("+abc")); @@ -780,6 +785,11 @@ TEST(Utils, unit_conversion) ASSERT_DOUBLE_EQ(factor, 1.0 / 23.060549); } +TEST(Utils, timespec2seconds_off) +{ + ASSERT_DOUBLE_EQ(utils::timespec2seconds("off"), -1.0); +} + TEST(Utils, timespec2seconds_ss) { ASSERT_DOUBLE_EQ(utils::timespec2seconds("45"), 45.0); @@ -795,6 +805,11 @@ TEST(Utils, timespec2seconds_hhmmss) ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:10:45"), 7845.0); } +TEST(Utils, timespec2seconds_invalid) +{ + ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:aa:45"), -1.0); +} + TEST(Utils, date2num) { ASSERT_EQ(utils::date2num("1Jan05"), 20050101); @@ -810,3 +825,32 @@ TEST(Utils, date2num) ASSERT_EQ(utils::date2num("30November 02"), 20021130); ASSERT_EQ(utils::date2num("31December100"), 1001231); } + +static int compare(int a, int b, void *) +{ + if (a < b) + return -1; + else if (a > b) + return 1; + else + return 0; +} + +TEST(Utils, merge_sort) +{ + int data[] = {773, 405, 490, 830, 632, 96, 428, 728, 912, 840, 878, 745, 213, 219, 249, 380, + 894, 758, 575, 690, 61, 849, 19, 577, 338, 569, 898, 873, 448, 940, 431, 780, + 472, 289, 65, 491, 641, 37, 367, 33, 407, 854, 594, 611, 845, 136, 107, 592, + 275, 865, 158, 626, 399, 703, 686, 734, 188, 559, 781, 558, 737, 281, 638, 664, + 533, 529, 62, 969, 595, 661, 837, 463, 624, 568, 615, 936, 206, 637, 91, 694, + 214, 872, 468, 66, 775, 949, 486, 576, 255, 961, 480, 138, 177, 509, 333, 705, + 10, 375, 321, 952, 210, 111, 475, 268, 708, 864, 244, 121, 988, 540, 942, 682, + 750, 473, 478, 714, 955, 911, 482, 384, 144, 757, 697, 791, 420, 605, 447, 320}; + + const int num = sizeof(data) / sizeof(int); + utils::merge_sort(data, num, nullptr, &compare); + bool sorted = true; + for (int i = 1; i < num; ++i) + if (data[i - 1] > data[i]) sorted = false; + ASSERT_TRUE(sorted); +} From e00e2676fca98a56f87775fa7820aab19a6019b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Apr 2021 22:23:13 -0400 Subject: [PATCH 244/370] add tests for utils::open_potential() --- .../formats/test_potential_file_reader.cpp | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 1e3d96d6d7..f270f6e1f1 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -28,6 +28,7 @@ #include "potential_file_reader.h" #include "gmock/gmock.h" #include "gtest/gtest.h" + #include "../testing/core.h" #include @@ -257,6 +258,67 @@ TEST_F(PotentialFileReaderTest, UnitConvert) delete reader; } +class OpenPotentialTest : public LAMMPSTest { +}; + +// open for native units +TEST_F(OpenPotentialTest, Sw_native) +{ + int convert_flag = utils::get_supported_conversions(utils::ENERGY); + BEGIN_CAPTURE_OUTPUT(); + command("units metal"); + FILE *fp = utils::open_potential("Si.sw", lmp, &convert_flag); + auto text = END_CAPTURE_OUTPUT(); + double conv = utils::get_conversion_factor(utils::ENERGY, convert_flag); + + ASSERT_NE(fp, nullptr); + ASSERT_DOUBLE_EQ(conv, 1.0); + fclose(fp); +} + +// open with supported conversion enabled +TEST_F(OpenPotentialTest, Sw_conv) +{ + int convert_flag = utils::get_supported_conversions(utils::ENERGY); + ASSERT_EQ(convert_flag, utils::METAL2REAL | utils::REAL2METAL); + BEGIN_HIDE_OUTPUT(); + command("units real"); + FILE *fp = utils::open_potential("Si.sw", lmp, &convert_flag); + auto text = END_CAPTURE_OUTPUT(); + double conv = utils::get_conversion_factor(utils::ENERGY, convert_flag); + + ASSERT_NE(fp, nullptr); + ASSERT_EQ(convert_flag, utils::METAL2REAL); + ASSERT_DOUBLE_EQ(conv, 23.060549); + fclose(fp); +} + +// open with conversion disabled +TEST_F(OpenPotentialTest, Sw_noconv) +{ + BEGIN_HIDE_OUTPUT(); + command("units real"); + END_HIDE_OUTPUT(); + TEST_FAILURE(".*potential.*requires metal units but real.*", + utils::open_potential("Si.sw", lmp, nullptr);); + BEGIN_HIDE_OUTPUT(); + command("units lj"); + END_HIDE_OUTPUT(); + int convert_flag = utils::get_supported_conversions(utils::UNKNOWN); + ASSERT_EQ(convert_flag, utils::NOCONVERT); +} + +// open non-existing potential +TEST_F(OpenPotentialTest, No_file) +{ + int convert_flag = utils::get_supported_conversions(utils::ENERGY); + BEGIN_HIDE_OUTPUT(); + command("units metal"); + FILE *fp = utils::open_potential("Unknown.sw", lmp, &convert_flag); + END_HIDE_OUTPUT(); + ASSERT_EQ(fp,nullptr); +} + int main(int argc, char **argv) { MPI_Init(&argc, &argv); From 773ec40d3a83008e0e9bcfc0d51443ba9b6e2dd0 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Mon, 5 Apr 2021 11:37:35 -0600 Subject: [PATCH 245/370] Misc small fixes --- src/GRANULAR/fix_wall_gran.cpp | 11 +- src/GRANULAR/pair_gran_hertz_history.cpp | 4 +- src/GRANULAR/pair_gran_hooke.cpp | 4 +- src/GRANULAR/pair_granular.cpp | 2 +- src/GRANULAR/pair_granular_corrected.cpp | 1821 ---------------------- 5 files changed, 10 insertions(+), 1832 deletions(-) delete mode 100644 src/GRANULAR/pair_granular_corrected.cpp diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 1d27e21162..7ce8e49008 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -376,7 +376,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : wiggle = 0; wshear = 0; peratom_flag = 0; - limit_damping = 0; while (iarg < narg) { if (strcmp(arg[iarg],"wiggle") == 0) { @@ -792,7 +791,7 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -885,7 +884,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -1017,7 +1016,7 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -1303,8 +1302,8 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, history[thist2] -= rsht*nz; // also rescale to preserve magnitude - prjmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); + prjmag = sqrt(history[thist0]*history[thist0] + + history[thist1]*history[thist1] + history[thist2]*history[thist2]); if (prjmag > 0) scalefac = shrmag/prjmag; else scalefac = 0; history[thist0] *= scalefac; diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 40c6c3a41d..e21ec727d6 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -181,7 +181,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -389,7 +389,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 0e3ffc7293..c28bbd007f 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -158,7 +158,7 @@ void PairGranHooke::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities @@ -300,7 +300,7 @@ double PairGranHooke::single(int i, int j, int /*itype*/, int /*jtype*/, double damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping and ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 8bf9b0c4ed..ac98a6e27c 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -1547,7 +1547,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if(limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; jnum = list->numneigh[i]; jlist = list->firstneigh[i]; diff --git a/src/GRANULAR/pair_granular_corrected.cpp b/src/GRANULAR/pair_granular_corrected.cpp deleted file mode 100644 index bcf262aa2c..0000000000 --- a/src/GRANULAR/pair_granular_corrected.cpp +++ /dev/null @@ -1,1821 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://lammps.sandia.gov/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- - Contributing authors: - Dan Bolintineanu (SNL), Ishan Srivastava (SNL), Jeremy Lechman(SNL) - Leo Silbert (SNL), Gary Grest (SNL) ------------------------------------------------------------------------ */ - -#include "pair_granular.h" - -#include -#include - -#include "atom.h" -#include "force.h" -#include "update.h" -#include "modify.h" -#include "fix.h" -#include "fix_dummy.h" -#include "fix_neigh_history.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "memory.h" -#include "error.h" -#include "math_const.h" -#include "math_special.h" - - -using namespace LAMMPS_NS; -using namespace MathConst; -using namespace MathSpecial; - -#define PI27SQ 266.47931882941264802866 // 27*PI**2 -#define THREEROOT3 5.19615242270663202362 // 3*sqrt(3) -#define SIXROOT6 14.69693845669906728801 // 6*sqrt(6) -#define INVROOT6 0.40824829046386307274 // 1/sqrt(6) -#define FOURTHIRDS 4.0/3.0 // 4/3 -#define THREEQUARTERS 0.75 // 3/4 - -#define EPSILON 1e-10 - -enum {HOOKE, HERTZ, HERTZ_MATERIAL, DMT, JKR}; -enum {VELOCITY, MASS_VELOCITY, VISCOELASTIC, TSUJI}; -enum {TANGENTIAL_NOHISTORY, TANGENTIAL_HISTORY, - TANGENTIAL_MINDLIN, TANGENTIAL_MINDLIN_RESCALE, - TANGENTIAL_MINDLIN_FORCE, TANGENTIAL_MINDLIN_RESCALE_FORCE}; -enum {TWIST_NONE, TWIST_SDS, TWIST_MARSHALL}; -enum {ROLL_NONE, ROLL_SDS}; - -/* ---------------------------------------------------------------------- */ - -PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) -{ - single_enable = 1; - no_virial_fdotr_compute = 1; - centroidstressflag = CENTROID_NOTAVAIL; - - single_extra = 12; - svector = new double[single_extra]; - - neighprev = 0; - - nmax = 0; - mass_rigid = nullptr; - - onerad_dynamic = nullptr; - onerad_frozen = nullptr; - maxrad_dynamic = nullptr; - maxrad_frozen = nullptr; - - history_transfer_factors = nullptr; - - dt = update->dt; - - // set comm size needed by this Pair if used with fix rigid - - comm_forward = 1; - - use_history = 0; - beyond_contact = 0; - nondefault_history_transfer = 0; - tangential_history_index = 0; - roll_history_index = twist_history_index = 0; - - // create dummy fix as placeholder for FixNeighHistory - // this is so final order of Modify:fix will conform to input script - - fix_history = nullptr; - modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); - fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; -} - -/* ---------------------------------------------------------------------- */ - -PairGranular::~PairGranular() -{ - delete [] svector; - - if (!fix_history) modify->delete_fix("NEIGH_HISTORY_GRANULAR_DUMMY"); - else modify->delete_fix("NEIGH_HISTORY_GRANULAR"); - - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - memory->destroy(cutoff_type); - - memory->destroy(normal_coeffs); - memory->destroy(tangential_coeffs); - memory->destroy(roll_coeffs); - memory->destroy(twist_coeffs); - - memory->destroy(Emod); - memory->destroy(poiss); - - memory->destroy(normal_model); - memory->destroy(damping_model); - memory->destroy(tangential_model); - memory->destroy(roll_model); - memory->destroy(twist_model); - - delete [] onerad_dynamic; - delete [] onerad_frozen; - delete [] maxrad_dynamic; - delete [] maxrad_frozen; - } - - memory->destroy(mass_rigid); -} - -/* ---------------------------------------------------------------------- */ - -void PairGranular::compute(int eflag, int vflag) -{ - int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,nx,ny,nz; - double radi,radj,radsum,rsq,r,rinv; - double Reff, delta, dR, dR2, dist_to_contact; - - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; - double wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; - - double knfac, damp_normal=0.0, damp_normal_prefactor; - double k_tangential, damp_tangential; - double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double fs, fs1, fs2, fs3, tor1, tor2, tor3; - - double mi,mj,meff; - double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; - - // for JKR - double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; - double t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; - - // rolling - double k_roll, damp_roll; - double torroll1, torroll2, torroll3; - double rollmag, rolldotn, scalefac; - double fr, fr1, fr2, fr3; - - // twisting - double k_twist, damp_twist, mu_twist; - double signtwist, magtwist, magtortwist, Mtcrit; - double tortwist1, tortwist2, tortwist3; - - double shrmag,rsht,prjmag; - bool frameupdate; - int *ilist,*jlist,*numneigh,**firstneigh; - int *touch,**firsttouch; - double *history,*allhistory,**firsthistory; - - bool touchflag = false; - const bool historyupdate = (update->setupflag) ? false : true; - - ev_init(eflag,vflag); - - // update rigid body info for owned & ghost atoms if using FixRigid masses - // body[i] = which body atom I is in, -1 if none - // mass_body = mass of each rigid body - - if (fix_rigid && neighbor->ago == 0) { - int tmp; - int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); - if (atom->nmax > nmax) { - memory->destroy(mass_rigid); - nmax = atom->nmax; - memory->create(mass_rigid,nmax,"pair:mass_rigid"); - } - int nlocal = atom->nlocal; - for (i = 0; i < nlocal; i++) - if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]]; - else mass_rigid[i] = 0.0; - comm->forward_comm_pair(this); - } - - double **x = atom->x; - double **v = atom->v; - double **f = atom->f; - int *type = atom->type; - double **omega = atom->omega; - double **torque = atom->torque; - double *radius = atom->radius; - double *rmass = atom->rmass; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - if (use_history) { - firsttouch = fix_history->firstflag; - firsthistory = fix_history->firstvalue; - } - - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - itype = type[i]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - radi = radius[i]; - if (use_history) { - touch = firsttouch[i]; - allhistory = firsthistory[i]; - } - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - jtype = type[j]; - rsq = delx*delx + dely*dely + delz*delz; - radj = radius[j]; - radsum = radi + radj; - - E = normal_coeffs[itype][jtype][0]; - Reff = radi*radj/radsum; - touchflag = false; - - if (normal_model[itype][jtype] == JKR) { - E *= THREEQUARTERS; - if (touch[jj]) { - R2 = Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - a = cbrt(9.0*MY_PI*coh*R2/(4*E)); - delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); - dist_pulloff = radsum-delta_pulloff; - touchflag = (rsq < dist_pulloff*dist_pulloff); - } else { - touchflag = (rsq < radsum*radsum); - } - } else { - touchflag = (rsq < radsum*radsum); - } - - if (!touchflag) { - // unset non-touching neighbors - if (use_history) { - touch[jj] = 0; - history = &allhistory[size_history*jj]; - for (int k = 0; k < size_history; k++) history[k] = 0.0; - } - } else { - r = sqrt(rsq); - rinv = 1.0/r; - - nx = delx*rinv; - ny = dely*rinv; - nz = delz*rinv; - - // relative translational velocity - - vr1 = v[i][0] - v[j][0]; - vr2 = v[i][1] - v[j][1]; - vr3 = v[i][2] - v[j][2]; - - // normal component - - vnnr = vr1*nx + vr2*ny + vr3*nz; //v_R . n - vn1 = nx*vnnr; - vn2 = ny*vnnr; - vn3 = nz*vnnr; - - // meff = effective mass of pair of particles - // if I or J part of rigid body, use body mass - // if I or J is frozen, meff is other particle - - mi = rmass[i]; - mj = rmass[j]; - if (fix_rigid) { - if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; - if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; - } - - meff = mi*mj / (mi+mj); - if (mask[i] & freeze_group_bit) meff = mj; - if (mask[j] & freeze_group_bit) meff = mi; - - delta = radsum - r; - dR = delta*Reff; - - if (normal_model[itype][jtype] == JKR) { - touch[jj] = 1; - R2=Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - dR2 = dR*dR; - t0 = coh*coh*R2*R2*E; - t1 = PI27SQ*t0; - t2 = 8*dR*dR2*E*E*E; - t3 = 4*dR2*E; - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0*(t1+2*t2)); - t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); - t5 = t3/t4 + t4/E; - sqrt2 = MAX(0, 2*dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); - a = INVROOT6*(t6 + sqrt(sqrt3)); - a2 = a*a; - knfac = normal_coeffs[itype][jtype][0]*a; - Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); - } else { - knfac = E; // Hooke - Fne = knfac*delta; - a = sqrt(dR); - if (normal_model[itype][jtype] != HOOKE) { - Fne *= a; - knfac *= a; - } - if (normal_model[itype][jtype] == DMT) - Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; - } - - // NOTE: consider restricting Hooke to only have - // 'velocity' as an option for damping? - - if (damping_model[itype][jtype] == VELOCITY) { - damp_normal = 1; - } else if (damping_model[itype][jtype] == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model[itype][jtype] == VISCOELASTIC) { - damp_normal = a*meff; - } else if (damping_model[itype][jtype] == TSUJI) { - damp_normal = sqrt(meff*knfac); - } - - damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; - Fdamp = -damp_normal_prefactor*vnnr; - - Fntot = Fne + Fdamp; - - //**************************************** - // tangential force, including history effects - //**************************************** - - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - // tangential component - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); - - // relative tangential velocities - vtr1 = vt1 - (nz*wr2-ny*wr3); - vtr2 = vt2 - (nx*wr3-nz*wr1); - vtr3 = vt3 - (ny*wr1-nx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - // if any history is needed - if (use_history) { - touch[jj] = 1; - history = &allhistory[size_history*jj]; - } - - if (normal_model[itype][jtype] == JKR) { - F_pulloff = 3*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else if (normal_model[itype][jtype] == DMT) { - F_pulloff = 4*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else { - Fncrit = fabs(Fntot); - } - Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; - - //------------------------------ - // tangential forces - //------------------------------ - k_tangential = tangential_coeffs[itype][jtype][0]; - damp_tangential = tangential_coeffs[itype][jtype][1] * - damp_normal_prefactor; - - if (tangential_history) { - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE) { - k_tangential *= a; - } else if (tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) { - k_tangential *= a; - // on unloading, rescale the shear displacements/force - if (a < history[3]) { - double factor = a/history[3]; - history[0] *= factor; - history[1] *= factor; - history[2] *= factor; - } - } - // rotate and update displacements / force. - // see e.g. eq. 17 of Luding, Gran. Matter 2008, v10,p235 - if (historyupdate) { - rsht = history[0]*nx + history[1]*ny + history[2]*nz; - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_FORCE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) - frameupdate = fabs(rsht) > EPSILON*Fscrit; - else - frameupdate = fabs(rsht)*k_tangential > EPSILON*Fscrit; - if (frameupdate) { - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - // projection - history[0] -= rsht*nx; - history[1] -= rsht*ny; - history[2] -= rsht*nz; - - // also rescale to preserve magnitude - prjmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - if (prjmag > 0) scalefac = shrmag/prjmag; - else scalefac = 0; - history[0] *= scalefac; - history[1] *= scalefac; - history[2] *= scalefac; - } - // update history - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - // tangential displacement - history[0] += vtr1*dt; - history[1] += vtr2*dt; - history[2] += vtr3*dt; - } else { - // tangential force - // see e.g. eq. 18 of Thornton et al, Pow. Tech. 2013, v223,p30-46 - history[0] -= k_tangential*vtr1*dt; - history[1] -= k_tangential*vtr2*dt; - history[2] -= k_tangential*vtr3*dt; - } - if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE_FORCE) - history[3] = a; - } - - // tangential forces = history + tangential velocity damping - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - fs1 = -k_tangential*history[0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[2] - damp_tangential*vtr3; - } else { - fs1 = history[0] - damp_tangential*vtr1; - fs2 = history[1] - damp_tangential*vtr2; - fs3 = history[2] - damp_tangential*vtr3; - } - - // rescale frictional displacements and forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - if (fs > Fscrit) { - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - if (shrmag != 0.0) { - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == - TANGENTIAL_MINDLIN_RESCALE) { - history[0] = -1.0/k_tangential*(Fscrit*fs1/fs + - damp_tangential*vtr1); - history[1] = -1.0/k_tangential*(Fscrit*fs2/fs + - damp_tangential*vtr2); - history[2] = -1.0/k_tangential*(Fscrit*fs3/fs + - damp_tangential*vtr3); - } else { - history[0] = Fscrit*fs1/fs + damp_tangential*vtr1; - history[1] = Fscrit*fs2/fs + damp_tangential*vtr2; - history[2] = Fscrit*fs3/fs + damp_tangential*vtr3; - } - fs1 *= Fscrit/fs; - fs2 *= Fscrit/fs; - fs3 *= Fscrit/fs; - } else fs1 = fs2 = fs3 = 0.0; - } - } else { // classic pair gran/hooke (no history) - fs = damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; - else Ft = 0.0; - fs1 = -Ft*vtr1; - fs2 = -Ft*vtr2; - fs3 = -Ft*vtr3; - } - - if (roll_model[itype][jtype] != ROLL_NONE || - twist_model[itype][jtype] != TWIST_NONE) { - relrot1 = omega[i][0] - omega[j][0]; - relrot2 = omega[i][1] - omega[j][1]; - relrot3 = omega[i][2] - omega[j][2]; - // rolling velocity, - // see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - // - 0.5*((radj-radi)/radsum)*vtr1; - // - 0.5*((radj-radi)/radsum)*vtr2; - // - 0.5*((radj-radi)/radsum)*vtr3; - } - //**************************************** - // rolling resistance - //**************************************** - - if (roll_model[itype][jtype] != ROLL_NONE) { - vrl1 = Reff*(relrot2*nz - relrot3*ny); - vrl2 = Reff*(relrot3*nx - relrot1*nz); - vrl3 = Reff*(relrot1*ny - relrot2*nx); - - int rhist0 = roll_history_index; - int rhist1 = rhist0 + 1; - int rhist2 = rhist1 + 1; - - k_roll = roll_coeffs[itype][jtype][0]; - damp_roll = roll_coeffs[itype][jtype][1]; - Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; - - if (historyupdate) { - rolldotn = history[rhist0]*nx + history[rhist1]*ny + history[rhist2]*nz; - frameupdate = fabs(rolldotn)*k_roll > EPSILON*Frcrit; - if (frameupdate) { // rotate into tangential plane - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - // projection - history[rhist0] -= rolldotn*nx; - history[rhist1] -= rolldotn*ny; - history[rhist2] -= rolldotn*nz; - // also rescale to preserve magnitude - prjmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - if (prjmag > 0) scalefac = rollmag/prjmag; - else scalefac = 0; - history[rhist0] *= scalefac; - history[rhist1] *= scalefac; - history[rhist2] *= scalefac; - } - history[rhist0] += vrl1*dt; - history[rhist1] += vrl2*dt; - history[rhist2] += vrl3*dt; - } - - fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; - fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; - fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; - - // rescale frictional displacements and forces if needed - - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); - if (fr > Frcrit) { - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - if (rollmag != 0.0) { - history[rhist0] = -1.0/k_roll*(Frcrit*fr1/fr + damp_roll*vrl1); - history[rhist1] = -1.0/k_roll*(Frcrit*fr2/fr + damp_roll*vrl2); - history[rhist2] = -1.0/k_roll*(Frcrit*fr3/fr + damp_roll*vrl3); - fr1 *= Frcrit/fr; - fr2 *= Frcrit/fr; - fr3 *= Frcrit/fr; - } else fr1 = fr2 = fr3 = 0.0; - } - } - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model[itype][jtype] != TWIST_NONE) { - // omega_T (eq 29 of Marshall) - magtwist = relrot1*nx + relrot2*ny + relrot3*nz; - if (twist_model[itype][jtype] == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; // eq 32 of Marshall paper - damp_twist = 0.5*damp_tangential*a*a; - mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2]; - } else { - k_twist = twist_coeffs[itype][jtype][0]; - damp_twist = twist_coeffs[itype][jtype][1]; - mu_twist = twist_coeffs[itype][jtype][2]; - } - if (historyupdate) { - history[twist_history_index] += magtwist*dt; - } - magtortwist = -k_twist*history[twist_history_index] - - damp_twist*magtwist; // M_t torque (eq 30) - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - history[twist_history_index] = 1.0/k_twist*(Mtcrit*signtwist - - damp_twist*magtwist); - magtortwist = -Mtcrit * signtwist; // eq 34 - } - } - - // apply forces & torques - - fx = nx*Fntot + fs1; - fy = ny*Fntot + fs2; - fz = nz*Fntot + fs3; - - f[i][0] += fx; - f[i][1] += fy; - f[i][2] += fz; - - tor1 = ny*fs3 - nz*fs2; - tor2 = nz*fs1 - nx*fs3; - tor3 = nx*fs2 - ny*fs1; - - dist_to_contact = radi-0.5*delta; - torque[i][0] -= dist_to_contact*tor1; - torque[i][1] -= dist_to_contact*tor2; - torque[i][2] -= dist_to_contact*tor3; - - if (twist_model[itype][jtype] != TWIST_NONE) { - tortwist1 = magtortwist * nx; - tortwist2 = magtortwist * ny; - tortwist3 = magtortwist * nz; - - torque[i][0] += tortwist1; - torque[i][1] += tortwist2; - torque[i][2] += tortwist3; - } - - if (roll_model[itype][jtype] != ROLL_NONE) { - torroll1 = Reff*(ny*fr3 - nz*fr2); // n cross fr - torroll2 = Reff*(nz*fr1 - nx*fr3); - torroll3 = Reff*(nx*fr2 - ny*fr1); - - torque[i][0] += torroll1; - torque[i][1] += torroll2; - torque[i][2] += torroll3; - } - - if (force->newton_pair || j < nlocal) { - f[j][0] -= fx; - f[j][1] -= fy; - f[j][2] -= fz; - - dist_to_contact = radj-0.5*delta; - torque[j][0] -= dist_to_contact*tor1; - torque[j][1] -= dist_to_contact*tor2; - torque[j][2] -= dist_to_contact*tor3; - - if (twist_model[itype][jtype] != TWIST_NONE) { - torque[j][0] -= tortwist1; - torque[j][1] -= tortwist2; - torque[j][2] -= tortwist3; - } - if (roll_model[itype][jtype] != ROLL_NONE) { - torque[j][0] -= torroll1; - torque[j][1] -= torroll2; - torque[j][2] -= torroll3; - } - } - if (evflag) ev_tally_xyz(i,j,nlocal,force->newton_pair, - 0.0,0.0,fx,fy,fz,delx,dely,delz); - } - } - } -} - -/* ---------------------------------------------------------------------- - allocate all arrays -------------------------------------------------------------------------- */ - -void PairGranular::allocate() -{ - allocated = 1; - int n = atom->ntypes; - - memory->create(setflag,n+1,n+1,"pair:setflag"); - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - memory->create(cutsq,n+1,n+1,"pair:cutsq"); - memory->create(cutoff_type,n+1,n+1,"pair:cutoff_type"); - memory->create(normal_coeffs,n+1,n+1,4,"pair:normal_coeffs"); - memory->create(tangential_coeffs,n+1,n+1,3,"pair:tangential_coeffs"); - memory->create(roll_coeffs,n+1,n+1,3,"pair:roll_coeffs"); - memory->create(twist_coeffs,n+1,n+1,3,"pair:twist_coeffs"); - - memory->create(Emod,n+1,n+1,"pair:Emod"); - memory->create(poiss,n+1,n+1,"pair:poiss"); - - memory->create(normal_model,n+1,n+1,"pair:normal_model"); - memory->create(damping_model,n+1,n+1,"pair:damping_model"); - memory->create(tangential_model,n+1,n+1,"pair:tangential_model"); - memory->create(roll_model,n+1,n+1,"pair:roll_model"); - memory->create(twist_model,n+1,n+1,"pair:twist_model"); - - onerad_dynamic = new double[n+1]; - onerad_frozen = new double[n+1]; - maxrad_dynamic = new double[n+1]; - maxrad_frozen = new double[n+1]; -} - -/* ---------------------------------------------------------------------- - global settings -------------------------------------------------------------------------- */ - -void PairGranular::settings(int narg, char **arg) -{ - if (narg == 1) { - cutoff_global = utils::numeric(FLERR,arg[0],false,lmp); - } else { - cutoff_global = -1; // will be set based on particle sizes, model choice - } - - normal_history = tangential_history = 0; - roll_history = twist_history = 0; -} - -/* ---------------------------------------------------------------------- - set coeffs for one or more type pairs -------------------------------------------------------------------------- */ - -void PairGranular::coeff(int narg, char **arg) -{ - int normal_model_one, damping_model_one; - int tangential_model_one, roll_model_one, twist_model_one; - - double normal_coeffs_one[4]; - double tangential_coeffs_one[4]; - double roll_coeffs_one[4]; - double twist_coeffs_one[4]; - - double cutoff_one = -1; - - if (narg < 2) - error->all(FLERR,"Incorrect args for pair coefficients"); - - if (!allocated) allocate(); - - int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); - utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - - //Defaults - normal_model_one = tangential_model_one = -1; - roll_model_one = ROLL_NONE; - twist_model_one = TWIST_NONE; - damping_model_one = VISCOELASTIC; - - int iarg = 2; - while (iarg < narg) { - if (strcmp(arg[iarg], "hooke") == 0) { - if (iarg + 2 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hooke option"); - normal_model_one = HOOKE; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - iarg += 3; - } else if (strcmp(arg[iarg], "hertz") == 0) { - if (iarg + 2 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz option"); - normal_model_one = HERTZ; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - iarg += 3; - } else if (strcmp(arg[iarg], "hertz/material") == 0) { - if (iarg + 3 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz/material option"); - normal_model_one = HERTZ_MATERIAL; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - iarg += 4; - } else if (strcmp(arg[iarg], "dmt") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for Hertz option"); - normal_model_one = DMT; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "jkr") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for JKR option"); - beyond_contact = 1; - normal_model_one = JKR; - normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E - normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping - normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio - normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion - iarg += 5; - } else if (strcmp(arg[iarg], "damping") == 0) { - if (iarg+1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, " - "not enough parameters provided for damping model"); - if (strcmp(arg[iarg+1], "velocity") == 0) { - damping_model_one = VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "mass_velocity") == 0) { - damping_model_one = MASS_VELOCITY; - iarg += 1; - } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) { - damping_model_one = VISCOELASTIC; - iarg += 1; - } else if (strcmp(arg[iarg+1], "tsuji") == 0) { - damping_model_one = TSUJI; - iarg += 1; - } else error->all(FLERR, "Illegal pair_coeff command, " - "unrecognized damping model"); - iarg += 1; - } else if (strcmp(arg[iarg], "tangential") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR,"Illegal pair_coeff command, must specify " - "tangential model after tangential keyword"); - if (strcmp(arg[iarg+1], "linear_nohistory") == 0) { - if (iarg + 3 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - tangential_model_one = TANGENTIAL_NOHISTORY; - tangential_coeffs_one[0] = 0; - // gammat and friction coeff - tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - iarg += 4; - } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || - (strcmp(arg[iarg+1], "mindlin") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale") == 0) || - (strcmp(arg[iarg+1], "mindlin/force") == 0) || - (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0)) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for tangential model"); - if (strcmp(arg[iarg+1], "linear_history") == 0) - tangential_model_one = TANGENTIAL_HISTORY; - else if (strcmp(arg[iarg+1], "mindlin") == 0) - tangential_model_one = TANGENTIAL_MINDLIN; - else if (strcmp(arg[iarg+1], "mindlin_rescale") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_RESCALE; - else if (strcmp(arg[iarg+1], "mindlin/force") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_FORCE; - else if (strcmp(arg[iarg+1], "mindlin_rescale/force") == 0) - tangential_model_one = TANGENTIAL_MINDLIN_RESCALE_FORCE; - tangential_history = 1; - if ((tangential_model_one == TANGENTIAL_MINDLIN || - tangential_model_one == TANGENTIAL_MINDLIN_RESCALE || - tangential_model_one == TANGENTIAL_MINDLIN_FORCE || - tangential_model_one == TANGENTIAL_MINDLIN_RESCALE_FORCE) && - (strcmp(arg[iarg+2], "NULL") == 0)) { - if (normal_model_one == HERTZ || normal_model_one == HOOKE) { - error->all(FLERR, "NULL setting for Mindlin tangential " - "stiffness requires a normal contact model that " - "specifies material properties"); - } - tangential_coeffs_one[0] = -1; - } else { - tangential_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // kt - } - // gammat and friction coeff - tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "tangential model not recognized"); - } - } else if (strcmp(arg[iarg], "rolling") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - roll_model_one = ROLL_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for rolling model"); - roll_model_one = ROLL_SDS; - roll_history = 1; - // kR and gammaR and rolling friction coeff - roll_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - roll_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - roll_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "rolling friction model not recognized"); - } - } else if (strcmp(arg[iarg], "twisting") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - if (strcmp(arg[iarg+1], "none") == 0) { - twist_model_one = TWIST_NONE; - iarg += 2; - } else if (strcmp(arg[iarg+1], "marshall") == 0) { - twist_model_one = TWIST_MARSHALL; - twist_history = 1; - iarg += 2; - } else if (strcmp(arg[iarg+1], "sds") == 0) { - if (iarg + 4 >= narg) - error->all(FLERR,"Illegal pair_coeff command, " - "not enough parameters provided for twist model"); - twist_model_one = TWIST_SDS; - twist_history = 1; - // kt and gammat and friction coeff - twist_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); - twist_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); - twist_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); - iarg += 5; - } else { - error->all(FLERR, "Illegal pair_coeff command, " - "twisting friction model not recognized"); - } - } else if (strcmp(arg[iarg], "cutoff") == 0) { - if (iarg + 1 >= narg) - error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); - iarg += 2; - } else error->all(FLERR, "Illegal pair coeff command"); - } - - // error not to specify normal or tangential model - if ((normal_model_one < 0) || (tangential_model_one < 0)) - error->all(FLERR, "Illegal pair coeff command, " - "must specify normal or tangential contact model"); - - int count = 0; - double damp; - if (damping_model_one == TSUJI) { - double cor; - cor = normal_coeffs_one[1]; - damp = 1.2728-4.2783*cor+11.087*square(cor)-22.348*cube(cor)+ - 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); - } else damp = normal_coeffs_one[1]; - - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { - normal_model[i][j] = normal_model[j][i] = normal_model_one; - normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = damp; - if (normal_model_one != HERTZ && normal_model_one != HOOKE) { - Emod[i][j] = Emod[j][i] = normal_coeffs_one[0]; - poiss[i][j] = poiss[j][i] = normal_coeffs_one[2]; - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - FOURTHIRDS*mix_stiffnessE(Emod[i][j],Emod[i][j], - poiss[i][j],poiss[i][j]); - } else { - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = normal_coeffs_one[0]; - } - if ((normal_model_one == JKR) || (normal_model_one == DMT)) - normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = normal_coeffs_one[3]; - - damping_model[i][j] = damping_model[j][i] = damping_model_one; - - tangential_model[i][j] = tangential_model[j][i] = tangential_model_one; - if (tangential_coeffs_one[0] == -1) { - tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = - 8*mix_stiffnessG(Emod[i][j],Emod[i][j],poiss[i][j],poiss[i][j]); - } else { - tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = - tangential_coeffs_one[0]; - } - for (int k = 1; k < 3; k++) - tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = - tangential_coeffs_one[k]; - - roll_model[i][j] = roll_model[j][i] = roll_model_one; - if (roll_model_one != ROLL_NONE) - for (int k = 0; k < 3; k++) - roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = roll_coeffs_one[k]; - - twist_model[i][j] = twist_model[j][i] = twist_model_one; - if (twist_model_one != TWIST_NONE && twist_model_one != TWIST_MARSHALL) - for (int k = 0; k < 3; k++) - twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = twist_coeffs_one[k]; - - cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; - - setflag[i][j] = 1; - count++; - } - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); -} - -/* ---------------------------------------------------------------------- - init specific to this pair style -------------------------------------------------------------------------- */ - -void PairGranular::init_style() -{ - int i; - - // error and warning checks - - if (!atom->radius_flag || !atom->rmass_flag) - error->all(FLERR,"Pair granular requires atom attributes radius, rmass"); - if (comm->ghost_velocity == 0) - error->all(FLERR,"Pair granular requires ghost atoms store velocity"); - - // determine whether we need a granular neigh list, how large it needs to be - - use_history = normal_history || tangential_history || - roll_history || twist_history; - - // for JKR, will need fix/neigh/history to keep track of touch arrays - - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - if (normal_model[i][j] == JKR) use_history = 1; - - size_history = 3*tangential_history + 3*roll_history + twist_history; - - // determine location of tangential/roll/twist histories in array - - if (roll_history) { - if (tangential_history) roll_history_index = 3; - else roll_history_index = 0; - } - if (twist_history) { - if (tangential_history) { - if (roll_history) twist_history_index = 6; - else twist_history_index = 3; - } else { - if (roll_history) twist_history_index = 3; - else twist_history_index = 0; - } - } - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - if (tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE || - tangential_model[i][j] == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - size_history += 1; - roll_history_index += 1; - twist_history_index += 1; - nondefault_history_transfer = 1; - history_transfer_factors = new int[size_history]; - for (int ii = 0; ii < size_history; ++ii) - history_transfer_factors[ii] = -1; - history_transfer_factors[3] = 1; - break; - } - - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->size = 1; - if (use_history) neighbor->requests[irequest]->history = 1; - - dt = update->dt; - - // if history is stored and first init, create Fix to store history - // it replaces FixDummy, created in the constructor - // this is so its order in the fix list is preserved - - if (use_history && fix_history == nullptr) { - modify->replace_fix("NEIGH_HISTORY_GRANULAR_DUMMY","NEIGH_HISTORY_GRANULAR" - " all NEIGH_HISTORY " + std::to_string(size_history),1); - int ifix = modify->find_fix("NEIGH_HISTORY_GRANULAR"); - fix_history = (FixNeighHistory *) modify->fix[ifix]; - fix_history->pair = this; - } - - // check for FixFreeze and set freeze_group_bit - - for (i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"freeze") == 0) break; - if (i < modify->nfix) freeze_group_bit = modify->fix[i]->groupbit; - else freeze_group_bit = 0; - - // check for FixRigid so can extract rigid body masses - - fix_rigid = nullptr; - for (i = 0; i < modify->nfix; i++) - if (modify->fix[i]->rigid_flag) break; - if (i < modify->nfix) fix_rigid = modify->fix[i]; - - // check for FixPour and FixDeposit so can extract particle radii - - int ipour; - for (ipour = 0; ipour < modify->nfix; ipour++) - if (strcmp(modify->fix[ipour]->style,"pour") == 0) break; - if (ipour == modify->nfix) ipour = -1; - - int idep; - for (idep = 0; idep < modify->nfix; idep++) - if (strcmp(modify->fix[idep]->style,"deposit") == 0) break; - if (idep == modify->nfix) idep = -1; - - // set maxrad_dynamic and maxrad_frozen for each type - // include future FixPour and FixDeposit particles as dynamic - - int itype; - for (i = 1; i <= atom->ntypes; i++) { - onerad_dynamic[i] = onerad_frozen[i] = 0.0; - if (ipour >= 0) { - itype = i; - double radmax = *((double *) modify->fix[ipour]->extract("radius",itype)); - onerad_dynamic[i] = radmax; - } - if (idep >= 0) { - itype = i; - double radmax = *((double *) modify->fix[idep]->extract("radius",itype)); - onerad_dynamic[i] = radmax; - } - } - - double *radius = atom->radius; - int *mask = atom->mask; - int *type = atom->type; - int nlocal = atom->nlocal; - - for (i = 0; i < nlocal; i++) { - double radius_cut = radius[i]; - if (mask[i] & freeze_group_bit) { - onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]],radius_cut); - } else { - onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]],radius_cut); - } - } - - MPI_Allreduce(&onerad_dynamic[1],&maxrad_dynamic[1],atom->ntypes, - MPI_DOUBLE,MPI_MAX,world); - MPI_Allreduce(&onerad_frozen[1],&maxrad_frozen[1],atom->ntypes, - MPI_DOUBLE,MPI_MAX,world); - - // set fix which stores history info - - if (size_history > 0) { - int ifix = modify->find_fix("NEIGH_HISTORY_GRANULAR"); - if (ifix < 0) error->all(FLERR,"Could not find pair fix neigh history ID"); - fix_history = (FixNeighHistory *) modify->fix[ifix]; - } -} - -/* ---------------------------------------------------------------------- - init for one type pair i,j and corresponding j,i -------------------------------------------------------------------------- */ - -double PairGranular::init_one(int i, int j) -{ - double cutoff=0.0; - - if (setflag[i][j] == 0) { - if ((normal_model[i][i] != normal_model[j][j]) || - (damping_model[i][i] != damping_model[j][j]) || - (tangential_model[i][i] != tangential_model[j][j]) || - (roll_model[i][i] != roll_model[j][j]) || - (twist_model[i][i] != twist_model[j][j])) { - - char str[512]; - sprintf(str,"Granular pair style functional forms are different, " - "cannot mix coefficients for types %d and %d. \n" - "This combination must be set explicitly " - "via pair_coeff command",i,j); - error->one(FLERR,str); - } - - if (normal_model[i][j] == HERTZ || normal_model[i][j] == HOOKE) - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - mix_geom(normal_coeffs[i][i][0], normal_coeffs[j][j][0]); - else - normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = - mix_stiffnessE(Emod[i][i], Emod[j][j], poiss[i][i], poiss[j][j]); - - normal_coeffs[i][j][1] = normal_coeffs[j][i][1] = - mix_geom(normal_coeffs[i][i][1], normal_coeffs[j][j][1]); - if ((normal_model[i][j] == JKR) || (normal_model[i][j] == DMT)) - normal_coeffs[i][j][3] = normal_coeffs[j][i][3] = - mix_geom(normal_coeffs[i][i][3], normal_coeffs[j][j][3]); - - for (int k = 0; k < 3; k++) - tangential_coeffs[i][j][k] = tangential_coeffs[j][i][k] = - mix_geom(tangential_coeffs[i][i][k], tangential_coeffs[j][j][k]); - - if (roll_model[i][j] != ROLL_NONE) { - for (int k = 0; k < 3; k++) - roll_coeffs[i][j][k] = roll_coeffs[j][i][k] = - mix_geom(roll_coeffs[i][i][k], roll_coeffs[j][j][k]); - } - - if (twist_model[i][j] != TWIST_NONE && twist_model[i][j] != TWIST_MARSHALL) { - for (int k = 0; k < 3; k++) - twist_coeffs[i][j][k] = twist_coeffs[j][i][k] = - mix_geom(twist_coeffs[i][i][k], twist_coeffs[j][j][k]); - } - } - - // It is possible that cut[i][j] at this point is still 0.0. - // This can happen when - // there is a future fix_pour after the current run. A cut[i][j] = 0.0 creates - // problems because neighbor.cpp uses min(cut[i][j]) to decide on the bin size - // To avoid this issue, for cases involving cut[i][j] = 0.0 (possible only - // if there is no current information about radius/cutoff of type i and j). - // we assign cutoff = max(cut[i][j]) for i,j such that cut[i][j] > 0.0. - - double pulloff; - - if (cutoff_type[i][j] < 0 && cutoff_global < 0) { - if (((maxrad_dynamic[i] > 0.0) && (maxrad_dynamic[j] > 0.0)) || - ((maxrad_dynamic[i] > 0.0) && (maxrad_frozen[j] > 0.0)) || - // radius info about both i and j exist - ((maxrad_frozen[i] > 0.0) && (maxrad_dynamic[j] > 0.0))) { - cutoff = maxrad_dynamic[i]+maxrad_dynamic[j]; - pulloff = 0.0; - if (normal_model[i][j] == JKR) { - pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_dynamic[j], i, j); - cutoff += pulloff; - } - - if (normal_model[i][j] == JKR) - pulloff = pulloff_distance(maxrad_frozen[i], maxrad_dynamic[j], i, j); - cutoff = MAX(cutoff, maxrad_frozen[i]+maxrad_dynamic[j]+pulloff); - - if (normal_model[i][j] == JKR) - pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j], i, j); - cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]+pulloff); - - } else { - - // radius info about either i or j does not exist - // (i.e. not present and not about to get poured; - // set to largest value to not interfere with neighbor list) - - double cutmax = 0.0; - for (int k = 1; k <= atom->ntypes; k++) { - cutmax = MAX(cutmax,2.0*maxrad_dynamic[k]); - cutmax = MAX(cutmax,2.0*maxrad_frozen[k]); - } - cutoff = cutmax; - } - } else if (cutoff_type[i][j] > 0) { - cutoff = cutoff_type[i][j]; - } else if (cutoff_global > 0) { - cutoff = cutoff_global; - } - - return cutoff; -} - -/* ---------------------------------------------------------------------- - proc 0 writes to restart file -------------------------------------------------------------------------- */ - -void PairGranular::write_restart(FILE *fp) -{ - int i,j; - for (i = 1; i <= atom->ntypes; i++) { - for (j = i; j <= atom->ntypes; j++) { - fwrite(&setflag[i][j],sizeof(int),1,fp); - if (setflag[i][j]) { - fwrite(&normal_model[i][j],sizeof(int),1,fp); - fwrite(&damping_model[i][j],sizeof(int),1,fp); - fwrite(&tangential_model[i][j],sizeof(int),1,fp); - fwrite(&roll_model[i][j],sizeof(int),1,fp); - fwrite(&twist_model[i][j],sizeof(int),1,fp); - fwrite(normal_coeffs[i][j],sizeof(double),4,fp); - fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); - fwrite(roll_coeffs[i][j],sizeof(double),3,fp); - fwrite(twist_coeffs[i][j],sizeof(double),3,fp); - fwrite(&cutoff_type[i][j],sizeof(double),1,fp); - } - } - } -} - -/* ---------------------------------------------------------------------- - proc 0 reads from restart file, bcasts -------------------------------------------------------------------------- */ - -void PairGranular::read_restart(FILE *fp) -{ - allocate(); - int i,j; - int me = comm->me; - for (i = 1; i <= atom->ntypes; i++) { - for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); - MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); - if (setflag[i][j]) { - if (me == 0) { - utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); - utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); - utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); - } - MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&tangential_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&roll_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(&twist_model[i][j],1,MPI_INT,0,world); - MPI_Bcast(normal_coeffs[i][j],4,MPI_DOUBLE,0,world); - MPI_Bcast(tangential_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(roll_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(twist_coeffs[i][j],3,MPI_DOUBLE,0,world); - MPI_Bcast(&cutoff_type[i][j],1,MPI_DOUBLE,0,world); - } - } - } -} - -/* ---------------------------------------------------------------------- */ - -void PairGranular::reset_dt() -{ - dt = update->dt; -} - -/* ---------------------------------------------------------------------- */ - -double PairGranular::single(int i, int j, int itype, int jtype, - double rsq, double /* factor_coul */, - double /* factor_lj */, double &fforce) -{ - double radi,radj,radsum; - double r,rinv,delx,dely,delz, nx, ny, nz, Reff; - double dR, dR2; - double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3,wr1,wr2,wr3; - double vtr1,vtr2,vtr3,vrel; - double mi,mj,meff; - double relrot1,relrot2,relrot3,vrl1,vrl2,vrl3; - - double knfac, damp_normal, damp_normal_prefactor; - double k_tangential, damp_tangential; - double Fne, Ft, Fdamp, Fntot, Fncrit, Fscrit, Frcrit; - double fs, fs1, fs2, fs3; - - // for JKR - double R2, coh, F_pulloff, delta_pulloff, dist_pulloff, a, a2, E; - double delta, t0, t1, t2, t3, t4, t5, t6; - double sqrt1, sqrt2, sqrt3; - - // rolling - double k_roll, damp_roll; - double rollmag; - double fr, fr1, fr2, fr3; - - // twisting - double k_twist, damp_twist, mu_twist; - double signtwist, magtwist, magtortwist, Mtcrit; - - double shrmag; - int jnum; - int *jlist; - double *history,*allhistory; - - int nall = atom->nlocal + atom->nghost; - if ((i >= nall) || (j >= nall)) - error->all(FLERR,"Not enough atoms for pair granular single function"); - - double *radius = atom->radius; - radi = radius[i]; - radj = radius[j]; - radsum = radi + radj; - Reff = (radsum > 0.0) ? radi*radj/radsum : 0.0; - - bool touchflag; - E = normal_coeffs[itype][jtype][0]; - if (normal_model[itype][jtype] == JKR) { - E *= THREEQUARTERS; - R2 = Reff*Reff; - coh = normal_coeffs[itype][jtype][3]; - a = cbrt(9.0*MY_PI*coh*R2/(4*E)); - delta_pulloff = a*a/Reff - 2*sqrt(MY_PI*coh*a/E); - dist_pulloff = radsum+delta_pulloff; - touchflag = (rsq <= dist_pulloff*dist_pulloff); - } else touchflag = (rsq <= radsum*radsum); - - if (!touchflag) { - fforce = 0.0; - for (int m = 0; m < single_extra; m++) svector[m] = 0.0; - return 0.0; - } - - double **x = atom->x; - delx = x[i][0] - x[j][0]; - dely = x[i][1] - x[j][1]; - delz = x[i][2] - x[j][2]; - r = sqrt(rsq); - rinv = 1.0/r; - - nx = delx*rinv; - ny = dely*rinv; - nz = delz*rinv; - - // relative translational velocity - - double **v = atom->v; - vr1 = v[i][0] - v[j][0]; - vr2 = v[i][1] - v[j][1]; - vr3 = v[i][2] - v[j][2]; - - // normal component - - vnnr = vr1*nx + vr2*ny + vr3*nz; - vn1 = nx*vnnr; - vn2 = ny*vnnr; - vn3 = nz*vnnr; - - // tangential component - - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - - double **omega = atom->omega; - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); - - // meff = effective mass of pair of particles - // if I or J part of rigid body, use body mass - // if I or J is frozen, meff is other particle - - double *rmass = atom->rmass; - int *mask = atom->mask; - - mi = rmass[i]; - mj = rmass[j]; - if (fix_rigid) { - // NOTE: ensure mass_rigid is current for owned+ghost atoms? - if (mass_rigid[i] > 0.0) mi = mass_rigid[i]; - if (mass_rigid[j] > 0.0) mj = mass_rigid[j]; - } - - meff = mi*mj / (mi+mj); - if (mask[i] & freeze_group_bit) meff = mj; - if (mask[j] & freeze_group_bit) meff = mi; - - delta = radsum - r; - dR = delta*Reff; - if (normal_model[itype][jtype] == JKR) { - dR2 = dR*dR; - t0 = coh*coh*R2*R2*E; - t1 = PI27SQ*t0; - t2 = 8*dR*dR2*E*E*E; - t3 = 4*dR2*E; - // in case sqrt(0) < 0 due to precision issues - sqrt1 = MAX(0, t0*(t1+2*t2)); - t4 = cbrt(t1+t2+THREEROOT3*MY_PI*sqrt(sqrt1)); - t5 = t3/t4 + t4/E; - sqrt2 = MAX(0, 2*dR + t5); - t6 = sqrt(sqrt2); - sqrt3 = MAX(0, 4*dR - t5 + SIXROOT6*coh*MY_PI*R2/(E*t6)); - a = INVROOT6*(t6 + sqrt(sqrt3)); - a2 = a*a; - knfac = normal_coeffs[itype][jtype][0]*a; - Fne = knfac*a2/Reff - MY_2PI*a2*sqrt(4*coh*E/(MY_PI*a)); - } else { - knfac = E; - Fne = knfac*delta; - a = sqrt(dR); - if (normal_model[itype][jtype] != HOOKE) { - Fne *= a; - knfac *= a; - } - if (normal_model[itype][jtype] == DMT) - Fne -= 4*MY_PI*normal_coeffs[itype][jtype][3]*Reff; - } - - if (damping_model[itype][jtype] == VELOCITY) { - damp_normal = 1; - } else if (damping_model[itype][jtype] == MASS_VELOCITY) { - damp_normal = meff; - } else if (damping_model[itype][jtype] == VISCOELASTIC) { - damp_normal = a*meff; - } else if (damping_model[itype][jtype] == TSUJI) { - damp_normal = sqrt(meff*knfac); - } else damp_normal = 0.0; - - damp_normal_prefactor = normal_coeffs[itype][jtype][1]*damp_normal; - Fdamp = -damp_normal_prefactor*vnnr; - - Fntot = Fne + Fdamp; - - jnum = list->numneigh[i]; - jlist = list->firstneigh[i]; - - if (use_history) { - if ((fix_history == nullptr) || (fix_history->firstvalue == nullptr)) - error->one(FLERR,"Pair granular single computation needs history"); - allhistory = fix_history->firstvalue[i]; - for (int jj = 0; jj < jnum; jj++) { - neighprev++; - if (neighprev >= jnum) neighprev = 0; - if (jlist[neighprev] == j) break; - } - history = &allhistory[size_history*neighprev]; - } - - //**************************************** - // tangential force, including history effects - //**************************************** - - // For linear, mindlin, mindlin_rescale: - // history = cumulative tangential displacement - // - // For mindlin/force, mindlin_rescale/force: - // history = cumulative tangential elastic force - - // tangential component - vt1 = vr1 - vn1; - vt2 = vr2 - vn2; - vt3 = vr3 - vn3; - - // relative rotational velocity - wr1 = (radi*omega[i][0] + radj*omega[j][0]); - wr2 = (radi*omega[i][1] + radj*omega[j][1]); - wr3 = (radi*omega[i][2] + radj*omega[j][2]); - - // relative tangential velocities - vtr1 = vt1 - (nz*wr2-ny*wr3); - vtr2 = vt2 - (nx*wr3-nz*wr1); - vtr3 = vt3 - (ny*wr1-nx*wr2); - vrel = vtr1*vtr1 + vtr2*vtr2 + vtr3*vtr3; - vrel = sqrt(vrel); - - if (normal_model[itype][jtype] == JKR) { - F_pulloff = 3*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else if (normal_model[itype][jtype] == DMT) { - F_pulloff = 4*MY_PI*coh*Reff; - Fncrit = fabs(Fne + 2*F_pulloff); - } else { - Fncrit = fabs(Fntot); - } - Fscrit = tangential_coeffs[itype][jtype][2] * Fncrit; - - //------------------------------ - // tangential forces - //------------------------------ - k_tangential = tangential_coeffs[itype][jtype][0]; - damp_tangential = tangential_coeffs[itype][jtype][1]*damp_normal_prefactor; - - if (tangential_history) { - if (tangential_model[itype][jtype] != TANGENTIAL_HISTORY) { - k_tangential *= a; - } - - shrmag = sqrt(history[0]*history[0] + history[1]*history[1] + - history[2]*history[2]); - - // tangential forces = history + tangential velocity damping - if (tangential_model[itype][jtype] == TANGENTIAL_HISTORY || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN || - tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) { - fs1 = -k_tangential*history[0] - damp_tangential*vtr1; - fs2 = -k_tangential*history[1] - damp_tangential*vtr2; - fs3 = -k_tangential*history[2] - damp_tangential*vtr3; - } else { - fs1 = history[0] - damp_tangential*vtr1; - fs2 = history[1] - damp_tangential*vtr2; - fs3 = history[2] - damp_tangential*vtr3; - } - - // rescale frictional forces if needed - fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); - if (fs > Fscrit) { - if (shrmag != 0.0) { - fs1 *= Fscrit/fs; - fs2 *= Fscrit/fs; - fs3 *= Fscrit/fs; - fs *= Fscrit/fs; - } else fs1 = fs2 = fs3 = fs = 0.0; - } - - // classic pair gran/hooke (no history) - } else { - fs = damp_tangential*vrel; - if (vrel != 0.0) Ft = MIN(Fscrit,fs) / vrel; - else Ft = 0.0; - fs1 = -Ft*vtr1; - fs2 = -Ft*vtr2; - fs3 = -Ft*vtr3; - fs = Ft*vrel; - } - - //**************************************** - // rolling resistance - //**************************************** - - if ((roll_model[itype][jtype] != ROLL_NONE) - || (twist_model[itype][jtype] != TWIST_NONE)) { - relrot1 = omega[i][0] - omega[j][0]; - relrot2 = omega[i][1] - omega[j][1]; - relrot3 = omega[i][2] - omega[j][2]; - - // rolling velocity, see eq. 31 of Wang et al, Particuology v 23, p 49 (2015) - // this is different from the Marshall papers, - // which use the Bagi/Kuhn formulation - // for rolling velocity (see Wang et al for why the latter is wrong) - - vrl1 = Reff*(relrot2*nz - relrot3*ny); //- 0.5*((radj-radi)/radsum)*vtr1; - vrl2 = Reff*(relrot3*nx - relrot1*nz); //- 0.5*((radj-radi)/radsum)*vtr2; - vrl3 = Reff*(relrot1*ny - relrot2*nx); //- 0.5*((radj-radi)/radsum)*vtr3; - - int rhist0 = roll_history_index; - int rhist1 = rhist0 + 1; - int rhist2 = rhist1 + 1; - - // rolling displacement - rollmag = sqrt(history[rhist0]*history[rhist0] + - history[rhist1]*history[rhist1] + - history[rhist2]*history[rhist2]); - - k_roll = roll_coeffs[itype][jtype][0]; - damp_roll = roll_coeffs[itype][jtype][1]; - fr1 = -k_roll*history[rhist0] - damp_roll*vrl1; - fr2 = -k_roll*history[rhist1] - damp_roll*vrl2; - fr3 = -k_roll*history[rhist2] - damp_roll*vrl3; - - // rescale frictional displacements and forces if needed - Frcrit = roll_coeffs[itype][jtype][2] * Fncrit; - - fr = sqrt(fr1*fr1 + fr2*fr2 + fr3*fr3); - if (fr > Frcrit) { - if (rollmag != 0.0) { - fr1 *= Frcrit/fr; - fr2 *= Frcrit/fr; - fr3 *= Frcrit/fr; - fr *= Frcrit/fr; - } else fr1 = fr2 = fr3 = fr = 0.0; - } - } else fr1 = fr2 = fr3 = fr = 0.0; - - //**************************************** - // twisting torque, including history effects - //**************************************** - - if (twist_model[itype][jtype] != TWIST_NONE) { - // omega_T (eq 29 of Marshall) - magtwist = relrot1*nx + relrot2*ny + relrot3*nz; - if (twist_model[itype][jtype] == TWIST_MARSHALL) { - k_twist = 0.5*k_tangential*a*a;; //eq 32 - damp_twist = 0.5*damp_tangential*a*a; - mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2];; - } else { - k_twist = twist_coeffs[itype][jtype][0]; - damp_twist = twist_coeffs[itype][jtype][1]; - mu_twist = twist_coeffs[itype][jtype][2]; - } - // M_t torque (eq 30) - magtortwist = -k_twist*history[twist_history_index] - damp_twist*magtwist; - signtwist = (magtwist > 0) - (magtwist < 0); - Mtcrit = mu_twist*Fncrit; // critical torque (eq 44) - if (fabs(magtortwist) > Mtcrit) { - magtortwist = -Mtcrit * signtwist; // eq 34 - } else magtortwist = 0.0; - } else magtortwist = 0.0; - - // set force and return no energy - - fforce = Fntot*rinv; - - // set single_extra quantities - - svector[0] = fs1; - svector[1] = fs2; - svector[2] = fs3; - svector[3] = fs; - svector[4] = fr1; - svector[5] = fr2; - svector[6] = fr3; - svector[7] = fr; - svector[8] = magtortwist; - svector[9] = delx; - svector[10] = dely; - svector[11] = delz; - return 0.0; -} - -/* ---------------------------------------------------------------------- */ - -int PairGranular::pack_forward_comm(int n, int *list, double *buf, - int /* pbc_flag */, int * /* pbc */) -{ - int i,j,m; - - m = 0; - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = mass_rigid[j]; - } - return m; -} - -/* ---------------------------------------------------------------------- */ - -void PairGranular::unpack_forward_comm(int n, int first, double *buf) -{ - int i,m,last; - - m = 0; - last = first + n; - for (i = first; i < last; i++) - mass_rigid[i] = buf[m++]; -} - -/* ---------------------------------------------------------------------- - memory usage of local atom-based arrays -------------------------------------------------------------------------- */ - -double PairGranular::memory_usage() -{ - double bytes = (double)nmax * sizeof(double); - return bytes; -} - -/* ---------------------------------------------------------------------- - mixing of Young's modulus (E) -------------------------------------------------------------------------- */ - -double PairGranular::mix_stiffnessE(double Eii, double Ejj, - double poisii, double poisjj) -{ - return 1/((1-poisii*poisii)/Eii+(1-poisjj*poisjj)/Ejj); -} - -/* ---------------------------------------------------------------------- - mixing of shear modulus (G) ------------------------------------------------------------------------- */ - -double PairGranular::mix_stiffnessG(double Eii, double Ejj, - double poisii, double poisjj) -{ - return 1/((2*(2-poisii)*(1+poisii)/Eii) + (2*(2-poisjj)*(1+poisjj)/Ejj)); -} - -/* ---------------------------------------------------------------------- - mixing of everything else -------------------------------------------------------------------------- */ - -double PairGranular::mix_geom(double valii, double valjj) -{ - return sqrt(valii*valjj); -} - - -/* ---------------------------------------------------------------------- - compute pull-off distance (beyond contact) for a given radius and atom type -------------------------------------------------------------------------- */ - -double PairGranular::pulloff_distance(double radi, double radj, - int itype, int jtype) -{ - double E, coh, a, Reff; - Reff = radi*radj/(radi+radj); - if (Reff <= 0) return 0; - coh = normal_coeffs[itype][jtype][3]; - E = normal_coeffs[itype][jtype][0]*THREEQUARTERS; - a = cbrt(9*MY_PI*coh*Reff*Reff/(4*E)); - return a*a/Reff - 2*sqrt(MY_PI*coh*a/E); -} - -/* ---------------------------------------------------------------------- - transfer history during fix/neigh/history exchange - only needed if any history entries i-j are not just negative of j-i entries -------------------------------------------------------------------------- */ - -void PairGranular::transfer_history(double* source, double* target) -{ - for (int i = 0; i < size_history; i++) - target[i] = history_transfer_factors[i]*source[i]; -} From 6bdf0138acbeb53101bc7ac3b2e42cfd995470da Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Mon, 5 Apr 2021 11:50:53 -0600 Subject: [PATCH 246/370] Typos in documentation --- doc/src/pair_gran.rst | 2 +- doc/src/pair_granular.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index 7d6189fda1..5bccdfd8b4 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -219,7 +219,7 @@ potential. If two particles are moving away from each other while in contact, there is a possibility that the particles could experience an effective attractive -force due to damping. If the *limit_damping* keyword is used, this fix +force due to damping. If the *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective attractive force. diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index e0a33f31d0..a9ca437370 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -625,7 +625,7 @@ Finally, the twisting torque on each particle is given by: If two particles are moving away from each other while in contact, there is a possibility that the particles could experience an effective attractive -force due to damping. If the optional *limit_damping* keyword is used, this fix +force due to damping. If the optional *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective attractive force. This keyword cannot be used with the JKR or DMT models. @@ -667,7 +667,7 @@ atom types. If two particles are moving away from each other while in contact, there is a possibility that the particles could experience an effective attractive -force due to damping. If the *no_attraction* keyword is used, this fix +force due to damping. If the *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective attractive force. This keyword cannot be used with the JKR or DMT models. From f323fb29b3cc6e96a643b9de94c73472c3f9bccd Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Mon, 5 Apr 2021 11:53:49 -0600 Subject: [PATCH 247/370] Reverting no_attraction option in wall gran region docu --- doc/src/fix_wall_gran_region.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index b7a9ff6bd7..35fe1fab72 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -36,14 +36,12 @@ Syntax * wallstyle = region (see :doc:`fix wall/gran ` for options for other kinds of walls) * region-ID = region whose boundary will act as wall -* keyword = *contacts* or *no_attraction* +* keyword = *contacts* .. parsed-literal:: *contacts* value = none generate contact information for each particle - *no_attraction* value = none - turn off possibility of attractive interactions Examples """""""" From 4e4a571dbda05a29dff342d163f4059b0aac5117 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:31:13 -0400 Subject: [PATCH 248/370] Add advanced LAMMPS_DOWNLOADS_URL cmake option --- cmake/CMakeLists.txt | 5 +++++ cmake/Modules/LAMMPSUtils.cmake | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 21d965ebba..4c94a5037a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -22,6 +22,11 @@ set(LAMMPS_TOOLS_DIR ${LAMMPS_DIR}/tools) set(LAMMPS_PYTHON_DIR ${LAMMPS_DIR}/python) set(LAMMPS_POTENTIALS_DIR ${LAMMPS_DIR}/potentials) +set(LAMMPS_DOWNLOADS_URL "https://download.lammps.org" CACHE STRING "Base URL for LAMMPS downloads") +set(LAMMPS_POTENTIALS_URL "${LAMMPS_DOWNLOADS_URL}/potentials") +set(LAMMPS_THIRDPARTY_URL "${LAMMPS_DOWNLOADS_URL}/thirdparty") +mark_as_advanced(LAMMPS_DOWNLOADS_URL) + find_package(Git) # by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index 37275843fa..acaef19498 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -86,7 +86,6 @@ endfunction(GenerateBinaryHeader) # fetch missing potential files function(FetchPotentials pkgfolder potfolder) if (EXISTS "${pkgfolder}/potentials.txt") - set(LAMMPS_POTENTIALS_URL "https://download.lammps.org/potentials") file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].") foreach(line ${linelist}) string(FIND ${line} " " blank) From 8533bb17e7cf3913600f139de54edaab2cf01108 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:36:38 -0400 Subject: [PATCH 249/370] Update cmake/Modules/OpenCLLoader.cmake --- cmake/Modules/OpenCLLoader.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/OpenCLLoader.cmake b/cmake/Modules/OpenCLLoader.cmake index 5ab121f841..54eaab4795 100644 --- a/cmake/Modules/OpenCLLoader.cmake +++ b/cmake/Modules/OpenCLLoader.cmake @@ -1,11 +1,13 @@ message(STATUS "Downloading and building OpenCL loader library") +set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball") +set(OPENCL_LOADER_MD5 "011cdcbd41030be94f3fced6d763a52a" CACHE STRING "MD5 checksum of OpenCL loader tarball") +mark_as_advanced(OPENCL_LOADER_URL) +mark_as_advanced(OPENCL_LOADER_MD5) include(ExternalProject) -set(OPENCL_LOADER_URL "https://download.lammps.org/thirdparty/opencl-loader-2020.12.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball") -mark_as_advanced(OPENCL_LOADER_URL) ExternalProject_Add(opencl_loader - URL ${OPENCL_LOADER_URL} - URL_MD5 011cdcbd41030be94f3fced6d763a52a + URL ${OPENCL_LOADER_URL} + URL_MD5 ${OPENCL_LOADER_MD5} SOURCE_DIR "${CMAKE_BINARY_DIR}/opencl_loader-src" BINARY_DIR "${CMAKE_BINARY_DIR}/opencl_loader-build" CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_OPENCL_LOADER_OPTS} From 3b14606f063f8fa72470697a495a3441df2e00ca Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:43:05 -0400 Subject: [PATCH 250/370] Update cmake/Modules/MPI4WIN.cmake --- cmake/Modules/MPI4WIN.cmake | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/MPI4WIN.cmake b/cmake/Modules/MPI4WIN.cmake index 529cefeab0..aa0c9e1833 100644 --- a/cmake/Modules/MPI4WIN.cmake +++ b/cmake/Modules/MPI4WIN.cmake @@ -1,16 +1,25 @@ # Download and configure custom MPICH files for Windows message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows") +set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball") +set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball") +set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball") +set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball") +mark_as_advanced(MPICH2_WIN64_DEVEL_URL) +mark_as_advanced(MPICH2_WIN32_DEVEL_URL) +mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) +mark_as_advanced(MPICH2_WIN32_DEVEL_MD5) + include(ExternalProject) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") ExternalProject_Add(mpi4win_build - URL https://download.lammps.org/thirdparty/mpich2-win64-devel.tar.gz - URL_MD5 4939fdb59d13182fd5dd65211e469f14 + URL ${MPICH2_WIN64_DEVEL_URL} + URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" BUILD_BYPRODUCTS /lib/libmpi.a) else() ExternalProject_Add(mpi4win_build - URL https://download.lammps.org/thirdparty/mpich2-win32-devel.tar.gz - URL_MD5 a61d153500dce44e21b755ee7257e031 + URL ${MPICH2_WIN32_DEVEL_URL} + URL_MD5 ${MPICH2_WIN32_DEVEL_MD5} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" BUILD_BYPRODUCTS /lib/libmpi.a) endif() From 614411130b2aa3312b5ab12a02db3132f31a56ec Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:44:27 -0400 Subject: [PATCH 251/370] Update cmake/Modules/Documentation.cmake --- cmake/Modules/Documentation.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 5a42244b9e..c0028676b7 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -55,11 +55,15 @@ if(BUILD_DOC) COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade ) + set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz" CACHE STRING "URL for MathJax tarball") + set(MATHJAX_MD5 "a4a6a093a89bc2ccab1452d766b98e53" CACHE STRING "MD5 checksum of MathJax tarball") + mark_as_advanced(MATHJAX_URL) + # download mathjax distribution and unpack to folder "mathjax" if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5) - file(DOWNLOAD "https://github.com/mathjax/MathJax/archive/3.1.2.tar.gz" + file(DOWNLOAD ${MATHJAX_URL} "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" - EXPECTED_MD5 a4a6a093a89bc2ccab1452d766b98e53) + EXPECTED_MD5 ${MATHJAX_MD5}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*) execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax) From 192ee276b16c3d67838ce58d50f9a85c41abe141 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:46:50 -0400 Subject: [PATCH 252/370] Update cmake/Modules/Packages/KOKKOS.cmake --- cmake/Modules/Packages/KOKKOS.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 1dfb0bf389..1f00516e08 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -37,9 +37,13 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "08201d1c7cf5bc458ce0f5b44a629d5a" CACHE STRING "MD5 checksum of KOKKOS tarball") + mark_as_advanced(KOKKOS_URL) + mark_as_advanced(KOKKOS_MD5) ExternalProject_Add(kokkos_build - URL https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz - URL_MD5 08201d1c7cf5bc458ce0f5b44a629d5a + URL ${KOKKOS_URL} + URL_MD5 ${KOKKOS_MD5} CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS} BUILD_BYPRODUCTS /lib/libkokkoscore.a ) From 42ca8c5ba09762c43602614feee0363a25f9273d Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:55:56 -0400 Subject: [PATCH 253/370] Update cmake/Modules/Packages/VORONOI.cmake --- cmake/Modules/Packages/VORONOI.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/VORONOI.cmake b/cmake/Modules/Packages/VORONOI.cmake index 1d6893a978..7feea4c52e 100644 --- a/cmake/Modules/Packages/VORONOI.cmake +++ b/cmake/Modules/Packages/VORONOI.cmake @@ -7,6 +7,11 @@ endif() option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" ${DOWNLOAD_VORO_DEFAULT}) if(DOWNLOAD_VORO) message(STATUS "Voro++ download requested - we will build our own") + set(VORO_URL "${LAMMPS_THIRDPARTY_URL}/voro++-0.4.6.tar.gz" CACHE STRING "URL for Voro++ tarball") + set(VORO_MD5 "2338b824c3b7b25590e18e8df5d68af9" CACHE STRING "MD5 checksum for Voro++ tarball") + mark_as_advanced(VORO_URL) + mark_as_advanced(VORO_MD5) + include(ExternalProject) if(BUILD_SHARED_LIBS) @@ -22,8 +27,8 @@ if(DOWNLOAD_VORO) endif() ExternalProject_Add(voro_build - URL https://download.lammps.org/thirdparty/voro++-0.4.6.tar.gz - URL_MD5 2338b824c3b7b25590e18e8df5d68af9 + URL ${VORO_URL} + URL_MD5 ${VORO_MD5} PATCH_COMMAND patch -b -p0 < ${LAMMPS_LIB_SOURCE_DIR}/voronoi/voro-make.patch CONFIGURE_COMMAND "" BUILD_COMMAND make ${VORO_BUILD_OPTIONS} From 725332614a95131a855cfc8bc74edd98dcb5dccd Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 14:56:47 -0400 Subject: [PATCH 254/370] Update cmake/Modules/Packages/MSCG.cmake --- cmake/Modules/Packages/MSCG.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/MSCG.cmake b/cmake/Modules/Packages/MSCG.cmake index 6cb389fb13..6ac62cb012 100644 --- a/cmake/Modules/Packages/MSCG.cmake +++ b/cmake/Modules/Packages/MSCG.cmake @@ -7,10 +7,15 @@ else() endif() option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT}) if(DOWNLOAD_MSCG) + set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" CACHE STRING "URL for MSCG tarball") + set(MSCG_MD5 "8c45e269ee13f60b303edd7823866a91" CACHE STRING "MD5 checksum of MSCG tarball") + mark_as_advanced(MSCG_URL) + mark_as_advanced(MSCG_MD5) + include(ExternalProject) ExternalProject_Add(mscg_build - URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz - URL_MD5 8c45e269ee13f60b303edd7823866a91 + URL ${MSCG_URL} + URL_MD5 ${MSCG_MD5} SOURCE_SUBDIR src/CMake CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} From 0277883fb2271a31ed0d07f4b64098ee4655b436 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:00:06 -0400 Subject: [PATCH 255/370] Update cmake/Modules/Packages/USER-SCAFACOS.cmake --- cmake/Modules/Packages/USER-SCAFACOS.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages/USER-SCAFACOS.cmake b/cmake/Modules/Packages/USER-SCAFACOS.cmake index dc5c400c36..fd355420c3 100644 --- a/cmake/Modules/Packages/USER-SCAFACOS.cmake +++ b/cmake/Modules/Packages/USER-SCAFACOS.cmake @@ -14,15 +14,19 @@ endif() option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT}) if(DOWNLOAD_SCAFACOS) message(STATUS "ScaFaCoS download requested - we will build our own") + set(SCAFACOS_URL "https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz" CACHE STRING "URL for SCAFACOS tarball") + set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball") + mark_as_advanced(SCAFACOS_URL) + mark_as_advanced(SCAFACOS_MD5) # version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later. - file(DOWNLOAD https://download.lammps.org/thirdparty/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff + file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff EXPECTED_HASH MD5=4baa1333bb28fcce102d505e1992d032) include(ExternalProject) ExternalProject_Add(scafacos_build - URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz - URL_MD5 bd46d74e3296bd8a444d731bb10c1738 + URL ${SCAFACOS_URL} + URL_MD5 ${SCAFACOS_MD5} PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff CONFIGURE_COMMAND /configure --prefix= --disable-doc --enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m From 8ccc19bb2a272ec593da61515a1a313e1ff6d35f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:03:05 -0400 Subject: [PATCH 256/370] Update cmake/Modules/Packages/LATTE.cmake --- cmake/Modules/Packages/LATTE.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/LATTE.cmake b/cmake/Modules/Packages/LATTE.cmake index e66f83fa43..ddf31a68ed 100644 --- a/cmake/Modules/Packages/LATTE.cmake +++ b/cmake/Modules/Packages/LATTE.cmake @@ -15,10 +15,14 @@ endif() option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT}) if(DOWNLOAD_LATTE) message(STATUS "LATTE download requested - we will build our own") + set(LATTE_URL "https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" CACHE STRING "URL for LATTE tarball") + set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball") + mark_as_advanced(LATTE_URL) + mark_as_advanced(LATTE_MD5) include(ExternalProject) ExternalProject_Add(latte_build - URL https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz - URL_MD5 820e73a457ced178c08c71389a385de7 + URL ${LATTE_URL} + URL_MD5 ${LATTE_MD5} SOURCE_SUBDIR cmake CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib -DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES} From b718903efc36ce9d15218f425cc74a4f180170d6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:10:01 -0400 Subject: [PATCH 257/370] Update cmake/Modules/Packages/USER-PLUMED.cmake --- cmake/Modules/Packages/USER-PLUMED.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/USER-PLUMED.cmake b/cmake/Modules/Packages/USER-PLUMED.cmake index 53abf5771a..8719e8179d 100644 --- a/cmake/Modules/Packages/USER-PLUMED.cmake +++ b/cmake/Modules/Packages/USER-PLUMED.cmake @@ -53,10 +53,16 @@ if(DOWNLOAD_PLUMED) elseif(PLUMED_MODE STREQUAL "RUNTIME") set(PLUMED_BUILD_BYPRODUCTS "/lib/libplumedWrapper.a") endif() + + set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz" CACHE STRING "URL for PLUMED tarball") + set(PLUMED_MD5 "95f29dd0c067577f11972ff90dfc7d12" CACHE STRING "MD5 checksum of PLUMED tarball") + mark_as_advanced(PLUMED_URL) + mark_as_advanced(PLUMED_MD5) + include(ExternalProject) ExternalProject_Add(plumed_build - URL https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz - URL_MD5 95f29dd0c067577f11972ff90dfc7d12 + URL ${PLUMED_URL} + URL_MD5 ${PLUMED_MD5} BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} From 88b9e99707c95bd6ede9f47672536ded23fe66d0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:26:58 -0400 Subject: [PATCH 258/370] Update cmake/Modules/Packages/GPU.cmake --- cmake/Modules/Packages/GPU.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 9aa917144b..115d81af2a 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -338,11 +338,16 @@ elseif(GPU_API STREQUAL "HIP") if(DOWNLOAD_CUB) message(STATUS "CUB download requested") + set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball") + set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball") + mark_as_advanced(CUB_URL) + mark_as_advanced(CUB_MD5) + include(ExternalProject) ExternalProject_Add(CUB - GIT_REPOSITORY https://github.com/NVlabs/cub - TIMEOUT 5 + URL ${CUB_URL} + URL_MD5 ${CUB_MD5} PREFIX "${CMAKE_CURRENT_BINARY_DIR}" CONFIGURE_COMMAND "" BUILD_COMMAND "" @@ -354,7 +359,7 @@ elseif(GPU_API STREQUAL "HIP") else() find_package(CUB) if(NOT CUB_FOUND) - message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it") + message(FATAL_ERROR "CUB library not found. Help CMake to find it by setting CUB_INCLUDE_DIR, or set DOWNLOAD_CUB=ON to download it") endif() endif() From 2509190daec63d7942334ed5556ff72abc175574 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:29:33 -0400 Subject: [PATCH 259/370] Update cmake/Modules/YAML.cmake --- cmake/Modules/YAML.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/YAML.cmake b/cmake/Modules/YAML.cmake index f2ba34e1b6..c50773568c 100644 --- a/cmake/Modules/YAML.cmake +++ b/cmake/Modules/YAML.cmake @@ -2,10 +2,13 @@ message(STATUS "Downloading and building YAML library") include(ExternalProject) set(YAML_URL "https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz" CACHE STRING "URL for libyaml tarball") +set(YAML_MD5 "bb15429d8fb787e7d3f1c83ae129a999" CACHE STRING "MD5 checksum of libyaml tarball") mark_as_advanced(YAML_URL) +mark_as_advanced(YAML_MD5) + ExternalProject_Add(libyaml URL ${YAML_URL} - URL_MD5 bb15429d8fb787e7d3f1c83ae129a999 + URL_MD5 ${YAML_MD5} SOURCE_DIR "${CMAKE_BINARY_DIR}/yaml-src" BINARY_DIR "${CMAKE_BINARY_DIR}/yaml-build" CONFIGURE_COMMAND /configure ${CONFIGURE_REQUEST_PIC} From d4550dbb4b218541af2754bba41db856ad227f6e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:32:18 -0400 Subject: [PATCH 260/370] Update cmake/Modules/Packages/USER-SMD.cmake --- cmake/Modules/Packages/USER-SMD.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/USER-SMD.cmake b/cmake/Modules/Packages/USER-SMD.cmake index 67f4aae99d..6d941f9798 100644 --- a/cmake/Modules/Packages/USER-SMD.cmake +++ b/cmake/Modules/Packages/USER-SMD.cmake @@ -7,10 +7,14 @@ endif() option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" ${DOWNLOAD_EIGEN3_DEFAULT}) if(DOWNLOAD_EIGEN3) message(STATUS "Eigen3 download requested - we will build our own") + set(EIGEN3_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz" CACHE STRING "URL for Eigen3 tarball") + set(EIGEN3_MD5 "9e30f67e8531477de4117506fe44669b" CACHE STRING "MD5 checksum of Eigen3 tarball") + mark_as_advanced(EIGEN3_URL) + mark_as_advanced(EIGEN3_MD5) include(ExternalProject) ExternalProject_Add(Eigen3_build - URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz - URL_MD5 9e30f67e8531477de4117506fe44669b + URL ${EIGEN3_URL} + URL_MD5 ${EIGEN3_MD5} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) ExternalProject_get_property(Eigen3_build SOURCE_DIR) From cbd439692ebfb2c070ed307998471b4e15523849 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 15:36:14 -0400 Subject: [PATCH 261/370] Update cmake/Modules/Packages/KIM.cmake --- cmake/Modules/Packages/KIM.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/KIM.cmake b/cmake/Modules/Packages/KIM.cmake index 5482d3071c..2a2a1cde78 100644 --- a/cmake/Modules/Packages/KIM.cmake +++ b/cmake/Modules/Packages/KIM.cmake @@ -35,9 +35,13 @@ if(DOWNLOAD_KIM) include(ExternalProject) enable_language(C) enable_language(Fortran) + set(KIM_URL "https://s3.openkim.org/kim-api/kim-api-2.2.1.txz" CACHE STRING "URL for KIM tarball") + set(KIM_MD5 "ae1ddda2ef7017ea07934e519d023dca" CACHE STRING "MD5 checksum of KIM tarball") + mark_as_advanced(KIM_URL) + mark_as_advanced(KIM_MD5) ExternalProject_Add(kim_build - URL https://s3.openkim.org/kim-api/kim-api-2.2.1.txz - URL_MD5 ae1ddda2ef7017ea07934e519d023dca + URL ${KIM_URL} + URL_MD5 ${KIM_MD5} BINARY_DIR build CMAKE_ARGS ${CMAKE_REQUEST_PIC} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} From fc6e10921d26c5c9e0a446cec7246dad005324f6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 5 Apr 2021 15:38:59 -0400 Subject: [PATCH 262/370] add post yes/no keyword to rerun commmand (with default to no) --- doc/src/rerun.rst | 9 +++++++-- src/rerun.cpp | 12 +++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/src/rerun.rst b/doc/src/rerun.rst index 7d51fba868..e9e23afba8 100644 --- a/doc/src/rerun.rst +++ b/doc/src/rerun.rst @@ -15,7 +15,7 @@ Syntax .. parsed-literal:: - keyword = *first* or *last* or *every* or *skip* or *start* or *stop* or *dump* + keyword = *first* or *last* or *every* or *skip* or *start* or *stop* or *post* or *dump* *first* args = Nfirst Nfirst = dump timestep to start on *last* args = Nlast @@ -28,6 +28,7 @@ Syntax Nstart = timestep on which pseudo run will start *stop* args = Nstop Nstop = timestep to which pseudo run will end + *post* value = *yes* or *no* *dump* args = same as :doc:`read_dump ` command starting with its field arguments Examples @@ -154,6 +155,10 @@ Also note that an error will occur if you read a snapshot from the dump file with a timestep value larger than the *stop* setting you have specified. +The *post* keyword can be used to minimize the output to the screen that +happens after a *rerun* command, similar to the post keyword of the +:doc:`run command `. It is set to *no* by default. + The *dump* keyword is required and must be the last keyword specified. Its arguments are passed internally to the :doc:`read_dump ` command. The first argument following the *dump* keyword should be @@ -226,4 +231,4 @@ Default The option defaults are first = 0, last = a huge value (effectively infinity), start = same as first, stop = same as last, every = 0, skip -= 1; += 1, post = no; diff --git a/src/rerun.cpp b/src/rerun.cpp index 648874420a..8615b02d95 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -51,6 +51,7 @@ void Rerun::command(int narg, char **arg) if (strcmp(arg[iarg],"start") == 0) break; if (strcmp(arg[iarg],"stop") == 0) break; if (strcmp(arg[iarg],"dump") == 0) break; + if (strcmp(arg[iarg],"post") == 0) break; iarg++; } int nfile = iarg; @@ -65,6 +66,7 @@ void Rerun::command(int narg, char **arg) int nskip = 1; int startflag = 0; int stopflag = 0; + int postflag = 0; bigint start = -1; bigint stop = -1; @@ -101,6 +103,14 @@ void Rerun::command(int narg, char **arg) stop = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (stop < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; + } else if (strcmp(arg[iarg],"post") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); + if (strcmp(arg[iarg+1],"yes") == 0) { + postflag = 1; + } else if (strcmp(arg[iarg+1],"no") == 0) { + postflag = 0; + } else error->all(FLERR,"Illegal rerun command"); + iarg += 2; } else if (strcmp(arg[iarg],"dump") == 0) { break; } else error->all(FLERR,"Illegal rerun command"); @@ -182,7 +192,7 @@ void Rerun::command(int narg, char **arg) update->nsteps = ndump; Finish finish(lmp); - finish.end(1); + finish.end(postflag); update->whichflag = 0; update->firststep = update->laststep = 0; From 7e57d6a334b0493698827f4a78b204ec5e064de9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 5 Apr 2021 15:39:31 -0400 Subject: [PATCH 263/370] add tests for "rerun" --- unittest/formats/test_dump_atom.cpp | 50 ++++++++++++++++-- unittest/formats/test_dump_custom.cpp | 73 +++++++++++++++++++++++++-- 2 files changed, 115 insertions(+), 8 deletions(-) diff --git a/unittest/formats/test_dump_atom.cpp b/unittest/formats/test_dump_atom.cpp index 46c6b7dfa7..5161eece3e 100644 --- a/unittest/formats/test_dump_atom.cpp +++ b/unittest/formats/test_dump_atom.cpp @@ -15,6 +15,8 @@ #include "../testing/systems/melt.h" #include "../testing/utils.h" #include "fmt/format.h" +#include "output.h" +#include "thermo.h" #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -24,7 +26,7 @@ using ::testing::Eq; char *BINARY2TXT_BINARY = nullptr; -bool verbose = false; +bool verbose = false; class DumpAtomTest : public MeltTest { std::string dump_style = "atom"; @@ -46,7 +48,14 @@ public: command(fmt::format("dump_modify id {}", dump_modify_options)); } - command(fmt::format("run {}", ntimesteps)); + command(fmt::format("run {} post no", ntimesteps)); + END_HIDE_OUTPUT(); + } + + void continue_dump(int ntimesteps) + { + BEGIN_HIDE_OUTPUT(); + command(fmt::format("run {} pre no post no", ntimesteps)); END_HIDE_OUTPUT(); } @@ -62,7 +71,7 @@ public: command(fmt::format("dump_modify id1 {}", dump_modify_options)); } - command(fmt::format("run {}", ntimesteps)); + command(fmt::format("run {} post no", ntimesteps)); END_HIDE_OUTPUT(); } @@ -446,13 +455,16 @@ TEST_F(DumpAtomTest, binary_triclinic_with_image_run0) delete_file(converted_file); } -TEST_F(DumpAtomTest, run1) +TEST_F(DumpAtomTest, run1plus1) { - auto dump_file = "dump_run1.melt"; + auto dump_file = "dump_run1plus1.melt"; generate_dump(dump_file, "", 1); ASSERT_FILE_EXISTS(dump_file); ASSERT_EQ(count_lines(dump_file), 82); + continue_dump(1); + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 123); delete_file(dump_file); } @@ -466,6 +478,34 @@ TEST_F(DumpAtomTest, run2) delete_file(dump_file); } +TEST_F(DumpAtomTest, rerun) +{ + auto dump_file = "dump_rerun.melt"; + HIDE_OUTPUT([&] { + command("fix 1 all nve"); + }); + generate_dump(dump_file, "format line \"%d %d %20.15g %20.15g %20.15g\"", 1); + double pe_1, pe_2, pe_rerun; + lmp->output->thermo->evaluate_keyword("pe", &pe_1); + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 82); + continue_dump(1); + lmp->output->thermo->evaluate_keyword("pe", &pe_2); + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 123); + HIDE_OUTPUT([&] { + command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file)); + }); + lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); + ASSERT_DOUBLE_EQ(pe_1, pe_rerun); + HIDE_OUTPUT([&] { + command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file)); + }); + lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); + ASSERT_DOUBLE_EQ(pe_2, pe_rerun); + delete_file(dump_file); +} + TEST_F(DumpAtomTest, multi_file_run1) { auto dump_file = "dump_run1_*.melt"; diff --git a/unittest/formats/test_dump_custom.cpp b/unittest/formats/test_dump_custom.cpp index b90d77e966..f8a55bb2fb 100644 --- a/unittest/formats/test_dump_custom.cpp +++ b/unittest/formats/test_dump_custom.cpp @@ -15,6 +15,8 @@ #include "../testing/systems/melt.h" #include "../testing/utils.h" #include "fmt/format.h" +#include "output.h" +#include "thermo.h" #include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -22,7 +24,7 @@ using ::testing::Eq; char *BINARY2TXT_BINARY = nullptr; -bool verbose = false; +bool verbose = false; class DumpCustomTest : public MeltTest { std::string dump_style = "custom"; @@ -45,7 +47,14 @@ public: command(fmt::format("dump_modify id {}", dump_modify_options)); } - command(fmt::format("run {}", ntimesteps)); + command(fmt::format("run {} post no", ntimesteps)); + END_HIDE_OUTPUT(); + } + + void continue_dump(int ntimesteps) + { + BEGIN_HIDE_OUTPUT(); + command(fmt::format("run {} pre no post no", ntimesteps)); END_HIDE_OUTPUT(); } @@ -62,7 +71,7 @@ public: command(fmt::format("dump_modify id1 {}", dump_modify_options)); } - command(fmt::format("run {}", ntimesteps)); + command(fmt::format("run {} post no", ntimesteps)); END_HIDE_OUTPUT(); } @@ -262,6 +271,64 @@ TEST_F(DumpCustomTest, with_variable_run1) delete_file(dump_file); } +TEST_F(DumpCustomTest, run1plus1) +{ + auto dump_file = "dump_custom_run1plus1.melt"; + auto fields = "id type x y z"; + + generate_dump(dump_file, fields, "units yes", 1); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 84); + continue_dump(1); + ASSERT_FILE_EXISTS(dump_file); + lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 125); + delete_file(dump_file); +} + +TEST_F(DumpCustomTest, run2) +{ + auto dump_file = "dump_custom_run2.melt"; + auto fields = "id type x y z"; + generate_dump(dump_file, fields, "", 2); + + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 123); + delete_file(dump_file); +} + +TEST_F(DumpCustomTest, rerun) +{ + auto dump_file = "dump_rerun.melt"; + auto fields = "id type xs ys zs"; + + HIDE_OUTPUT([&] { + command("fix 1 all nve"); + }); + generate_dump(dump_file, fields, "format float %20.15g", 1); + double pe_1, pe_2, pe_rerun; + lmp->output->thermo->evaluate_keyword("pe", &pe_1); + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 82); + continue_dump(1); + lmp->output->thermo->evaluate_keyword("pe", &pe_2); + ASSERT_FILE_EXISTS(dump_file); + ASSERT_EQ(count_lines(dump_file), 123); + HIDE_OUTPUT([&] { + command(fmt::format("rerun {} first 1 last 1 every 1 post no dump x y z", dump_file)); + }); + lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); + ASSERT_DOUBLE_EQ(pe_1, pe_rerun); + HIDE_OUTPUT([&] { + command(fmt::format("rerun {} first 2 last 2 every 1 post yes dump x y z", dump_file)); + }); + lmp->output->thermo->evaluate_keyword("pe", &pe_rerun); + ASSERT_DOUBLE_EQ(pe_2, pe_rerun); + delete_file(dump_file); +} + int main(int argc, char **argv) { MPI_Init(&argc, &argv); From 94068cc4c7b8465dc3beb91dde1eecfc0cbeb33e Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 5 Apr 2021 16:17:41 -0400 Subject: [PATCH 264/370] Add missing GTEST_MD5 --- cmake/Modules/GTest.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/GTest.cmake b/cmake/Modules/GTest.cmake index 0c62291d5e..677ed5f4af 100644 --- a/cmake/Modules/GTest.cmake +++ b/cmake/Modules/GTest.cmake @@ -8,10 +8,12 @@ endif() include(ExternalProject) set(GTEST_URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" CACHE STRING "URL for GTest tarball") +set(GTEST_MD5 "ecd1fa65e7de707cd5c00bdac56022cd" CACHE STRING "MD5 checksum of GTest tarball") mark_as_advanced(GTEST_URL) +mark_as_advanced(GTEST_MD5) ExternalProject_Add(googletest - URL ${GTEST_URL} - URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd + URL ${GTEST_URL} + URL_MD5 ${GTEST_MD5} SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest-src" BINARY_DIR "${CMAKE_BINARY_DIR}/gtest-build" CMAKE_ARGS ${CMAKE_REQUEST_PIC} ${CMAKE_EXTRA_GTEST_OPTS} From 2fc9734fab1ea44a50505f383a69104b965b6953 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 5 Apr 2021 23:51:11 -0500 Subject: [PATCH 265/370] Fixed a bug with rigid/*/small when starting with an empty group of rigid bodies such as when using fix deposit --- src/RIGID/fix_rigid_nh_small.cpp | 19 ++++--------------- src/RIGID/fix_rigid_nh_small.h | 2 -- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 454f240bb4..242c33eb3a 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -754,6 +754,8 @@ void FixRigidNHSmall::final_integrate() void FixRigidNHSmall::nhc_temp_integrate() { + if (g_f == 0) return; + int i,j,k; double kt,gfkt_t,gfkt_r,tmp,ms,s,s2; @@ -1148,6 +1150,8 @@ void FixRigidNHSmall::compute_press_target() void FixRigidNHSmall::nh_epsilon_dot() { + if (g_f == 0) return; + int i; double volume,scale,f_epsilon; @@ -1204,8 +1208,6 @@ void FixRigidNHSmall::compute_dof() nf_r = nfall[1]; g_f = nf_t + nf_r; - onednft = 1.0 + (double)(dimension) / (double)g_f; - onednfr = (double) (dimension) / (double)g_f; } /* ---------------------------------------------------------------------- @@ -1367,19 +1369,6 @@ int FixRigidNHSmall::modify_param(int narg, char **arg) return FixRigidSmall::modify_param(narg,arg); } -/* ---------------------------------------------------------------------- - disallow using fix rigid/n??/small fixes with fix deposit - we would need custom functionality to update data structures - used by all fixes derived from this class but not fix rigid/small -------------------------------------------------------------------------- */ - -void FixRigidNHSmall::set_molecule(int, tagint, int, - double *, double *, double *) -{ - error->all(FLERR,fmt::format("Molecule update not (yet) implemented for " - "fix {}", style)); -} - /* ---------------------------------------------------------------------- */ void FixRigidNHSmall::allocate_chain() diff --git a/src/RIGID/fix_rigid_nh_small.h b/src/RIGID/fix_rigid_nh_small.h index 32c4c1ab74..899cec1122 100644 --- a/src/RIGID/fix_rigid_nh_small.h +++ b/src/RIGID/fix_rigid_nh_small.h @@ -38,7 +38,6 @@ class FixRigidNHSmall : public FixRigidSmall { int dimension; // # of dimensions int nf_t,nf_r; // trans/rot degrees of freedom - double onednft,onednfr; // factors 1 + dimension/trans(rot) degrees of freedom double *w,*wdti1,*wdti2,*wdti4; // Yoshida-Suzuki coefficients double *q_t,*q_r; // trans/rot thermostat masses double *eta_t,*eta_r; // trans/rot thermostat positions @@ -80,7 +79,6 @@ class FixRigidNHSmall : public FixRigidSmall { void nh_epsilon_dot(); void compute_dof(); - void set_molecule(int, tagint, int, double *, double *, double *); void allocate_chain(); void allocate_order(); void deallocate_chain(); From 8e28252ac936efea29e20a92a99ccedddfa8f1ed Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 6 Apr 2021 00:19:20 -0500 Subject: [PATCH 266/370] Updated fix rigid/nh for the (g_f == 0) case --- src/RIGID/fix_rigid_nh.cpp | 6 ++++-- src/RIGID/fix_rigid_nh.h | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 6fb2bd7a94..4dec04370e 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -234,8 +234,6 @@ void FixRigidNH::init() } g_f = nf_t + nf_r; - onednft = 1.0 + (double)(dimension) / (double)g_f; - onednfr = (double) (dimension) / (double)g_f; // see Table 1 in Kamberaj et al @@ -719,6 +717,8 @@ void FixRigidNH::final_integrate() void FixRigidNH::nhc_temp_integrate() { + if (g_f == 0) return; + int i,j,k; double kt,gfkt_t,gfkt_r,tmp,ms,s,s2; @@ -1063,6 +1063,8 @@ void FixRigidNH::compute_press_target() void FixRigidNH::nh_epsilon_dot() { + if (g_f == 0) return; + int i; double volume,scale,f_epsilon; diff --git a/src/RIGID/fix_rigid_nh.h b/src/RIGID/fix_rigid_nh.h index a8850413eb..10ad9b24fb 100644 --- a/src/RIGID/fix_rigid_nh.h +++ b/src/RIGID/fix_rigid_nh.h @@ -38,8 +38,6 @@ class FixRigidNH : public FixRigid { double boltz,nktv2p,mvv2e; // boltzman constant, conversion factors int nf_t,nf_r; // trans/rot degrees of freedom - double onednft,onednfr; // factors 1 + dimension/trans(rot) - // degrees of freedom double *w,*wdti1,*wdti2,*wdti4; // Yoshida-Suzuki coefficients double *q_t,*q_r; // trans/rot thermostat masses double *eta_t,*eta_r; // trans/rot thermostat positions From 1fe284dbba8aeb980ce9ef6658bb4b1c4c343ab5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 07:55:43 -0400 Subject: [PATCH 267/370] add examples for using fix rigid/nv?/small with fix deposit --- .../in.deposit.molecule.rigid-nve-small | 56 +++++ .../in.deposit.molecule.rigid-nvt-small | 56 +++++ ...r21.deposit.molecule.rigid-nve-small.g++.1 | 218 ++++++++++++++++++ ...r21.deposit.molecule.rigid-nve-small.g++.4 | 218 ++++++++++++++++++ ...r21.deposit.molecule.rigid-nvt-small.g++.1 | 218 ++++++++++++++++++ ...r21.deposit.molecule.rigid-nvt-small.g++.4 | 218 ++++++++++++++++++ 6 files changed, 984 insertions(+) create mode 100644 examples/deposit/in.deposit.molecule.rigid-nve-small create mode 100644 examples/deposit/in.deposit.molecule.rigid-nvt-small create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.1 create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.4 create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.1 create mode 100644 examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.4 diff --git a/examples/deposit/in.deposit.molecule.rigid-nve-small b/examples/deposit/in.deposit.molecule.rigid-nve-small new file mode 100644 index 0000000000..b2af77ac00 --- /dev/null +++ b/examples/deposit/in.deposit.molecule.rigid-nve-small @@ -0,0 +1,56 @@ +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +region slab block 0 5 0 5 8 9 + +group addatoms empty +region mobile block 0 5 0 5 2 INF +group mobile region mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nve/small molecule mol dimer +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 & + mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 diff --git a/examples/deposit/in.deposit.molecule.rigid-nvt-small b/examples/deposit/in.deposit.molecule.rigid-nvt-small new file mode 100644 index 0000000000..9ceb1b3984 --- /dev/null +++ b/examples/deposit/in.deposit.molecule.rigid-nvt-small @@ -0,0 +1,56 @@ +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +region slab block 0 5 0 5 8 9 + +group addatoms empty +region mobile block 0 5 0 5 2 INF +group mobile region mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nvt/small molecule temp 0.1 0.1 0.1 mol dimer +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 & + mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type & +# axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.1 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.1 new file mode 100644 index 0000000000..792d3954c1 --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.1 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 1 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.001 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nve/small molecule mol dimer + create bodies CPU = 0.000 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.929 | 5.929 | 5.929 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8875167 -6.8803581 -0.73353914 + 200 354 1.0081552 -6.8594643 -6.8452248 -0.70421276 + 300 356 1.0085803 -6.8171524 -6.7959042 -0.6917826 + 400 358 1.0099188 -6.7852701 -6.7570601 -0.70371699 + 500 360 1.0140221 -6.7493429 -6.7141338 -0.68415307 + 600 362 1.026148 -6.7105231 -6.6680032 -0.68314418 + 700 364 1.0683344 -6.6725162 -6.621154 -0.65747369 + 800 366 1.0958953 -6.6412275 -6.5813425 -0.68789615 + 900 368 1.1250034 -6.6101882 -6.541404 -0.66674346 + 1000 370 1.2326365 -6.5993719 -6.5160856 -0.69688655 + 1100 372 1.1397444 -6.5912865 -6.5070312 -0.6333041 + 1200 374 1.0514447 -6.5905753 -6.5062348 -0.71020272 + 1300 376 1.0033284 -6.5747792 -6.4880554 -0.65459641 + 1400 378 0.82996548 -6.5681806 -6.4913319 -0.60438595 + 1500 380 0.90239071 -6.5752982 -6.4862465 -0.66528503 + 1600 382 0.86403681 -6.5692212 -6.4787461 -0.65027922 + 1700 384 0.64748046 -6.5644242 -6.4927629 -0.63046709 + 1800 386 0.74288742 -6.5515741 -6.4649681 -0.67770665 + 1900 388 0.72584537 -6.5565195 -6.4676596 -0.66175025 + 2000 390 0.73351281 -6.5631154 -6.4690753 -0.64686647 + 2100 392 0.76490681 -6.5573734 -6.4549305 -0.68861526 + 2200 394 0.65926638 -6.5511574 -6.4591279 -0.71726284 + 2300 396 0.70267414 -6.5728555 -6.4708258 -0.64360436 + 2400 398 0.60523691 -6.5845973 -6.4933555 -0.63956839 + 2500 400 0.5103586 -6.5812006 -6.5014571 -0.68698448 + 2600 402 0.52401744 -6.6003358 -6.5156066 -0.68987222 + 2700 404 0.46421291 -6.5662747 -6.4887143 -0.72872856 + 2800 406 0.48254258 -6.5724266 -6.4892296 -0.75447872 + 2900 408 0.53073083 -6.5809842 -6.4866754 -0.67592283 + 3000 410 0.55314547 -6.5922077 -6.4910226 -0.74646953 + 3100 412 0.47150308 -6.5907273 -6.5020344 -0.64994935 + 3200 414 0.43047803 -6.5836315 -6.5004473 -0.79764713 + 3300 416 0.46289353 -6.5739439 -6.4821441 -0.76441674 + 3400 418 0.59724106 -6.5980575 -6.4766089 -0.73735626 + 3500 420 0.43571285 -6.5955972 -6.5048237 -0.64145941 + 3600 422 0.42461639 -6.6060271 -6.5154691 -0.70124484 + 3700 424 0.44323254 -6.6059723 -6.5092766 -0.74498147 + 3800 426 0.4037907 -6.592043 -6.5019958 -0.72171799 + 3900 428 0.41668443 -6.5975302 -6.5026079 -0.68327878 + 4000 430 0.44895183 -6.5958671 -6.4914597 -0.73939433 + 4100 432 0.39798052 -6.5952115 -6.5007833 -0.74871822 + 4200 434 0.45156734 -6.6237274 -6.5144772 -0.75111778 + 4300 436 0.48297356 -6.6395283 -6.5204465 -0.76105913 + 4400 438 0.43595234 -6.6347133 -6.5252276 -0.72858275 + 4500 440 0.44683726 -6.6385398 -6.5242916 -0.74280051 + 4600 442 0.47875512 -6.6419903 -6.5174274 -0.75579572 + 4700 444 0.43972605 -6.6406078 -6.5242388 -0.72196509 + 4800 446 0.43572615 -6.6495404 -6.5323047 -0.7135049 + 4900 448 0.38063437 -6.6432385 -6.5391588 -0.77087429 + 5000 450 0.4239223 -6.6617795 -6.5440233 -0.784531 + 5100 452 0.37201988 -6.6581813 -6.5532421 -0.74611403 + 5200 454 0.41765777 -6.6661321 -6.5465385 -0.75422239 + 5300 456 0.38015287 -6.6606624 -6.5502013 -0.78866702 + 5400 458 0.40549607 -6.6807118 -6.5611878 -0.78932883 + 5500 460 0.34444407 -6.6720564 -6.5690976 -0.77859171 + 5600 462 0.36572308 -6.6730078 -6.5621827 -0.85672419 + 5700 464 0.40055073 -6.6976989 -6.574685 -0.74251563 + 5800 466 0.36037213 -6.7022014 -6.5900685 -0.66239625 + 5900 468 0.32810921 -6.6952135 -6.591803 -0.83981757 + 6000 470 0.35110886 -6.6986862 -6.5866302 -0.82474047 + 6100 472 0.29965884 -6.6839503 -6.5871326 -0.7864913 + 6200 474 0.32402637 -6.6902745 -6.5843165 -0.74531083 + 6300 476 0.35042653 -6.6990084 -6.5830585 -0.74839967 + 6400 478 0.32695511 -6.6909459 -6.5815048 -0.76549489 + 6500 480 0.35209088 -6.6902987 -6.5711013 -0.71281516 + 6600 482 0.354106 -6.6890268 -6.567808 -0.81897158 + 6700 484 0.3504816 -6.681739 -6.5604463 -0.811609 + 6800 486 0.37396733 -6.7018369 -6.5710253 -0.80383296 + 6900 488 0.36435774 -6.7010114 -6.5722169 -0.72063651 + 7000 490 0.35631012 -6.7089806 -6.581727 -0.74152078 + 7100 492 0.37646659 -6.719154 -6.5833352 -0.77739001 + 7200 494 0.36546269 -6.7223269 -6.5891623 -0.8288767 + 7300 496 0.37688206 -6.7457243 -6.607053 -0.80062121 + 7400 498 0.30331409 -6.7284953 -6.6158184 -0.79894584 + 7500 500 0.30382936 -6.7333804 -6.6194444 -0.86924602 + 7600 502 0.30163143 -6.7294737 -6.6153104 -0.7689497 + 7700 504 0.30281215 -6.7233976 -6.6077402 -0.8557548 + 7800 506 0.33378009 -6.7244958 -6.5958651 -0.82584084 + 7900 508 0.31843128 -6.7250998 -6.6013002 -0.82424684 + 8000 510 0.35912946 -6.7399052 -6.5990701 -0.81879575 + 8100 512 0.31405017 -6.733487 -6.6092777 -0.72940457 + 8200 514 0.30475 -6.7271485 -6.6056043 -0.87958287 + 8300 516 0.30717434 -6.7277574 -6.6042329 -0.81700937 + 8400 518 0.33032462 -6.7382165 -6.6043011 -0.75436496 + 8500 520 0.32218568 -6.7351971 -6.6035347 -0.77661738 + 8600 522 0.30922651 -6.7275431 -6.6001797 -0.85334327 + 8700 524 0.30728021 -6.7237477 -6.5962029 -0.94977016 + 8800 526 0.31061903 -6.7181672 -6.5882505 -0.86132456 + 8900 528 0.33543344 -6.728929 -6.5875768 -0.87545919 + 9000 530 0.31887735 -6.7265066 -6.5911341 -0.76892061 + 9100 532 0.31888326 -6.7216274 -6.5852629 -0.83190298 + 9200 534 0.33310892 -6.7111349 -6.567661 -0.94282671 + 9300 536 0.34737171 -6.722515 -6.5718361 -0.95235602 + 9400 538 0.32752858 -6.7246204 -6.5815549 -0.86227131 + 9500 540 0.30665764 -6.7225391 -6.5876665 -0.87144326 + 9600 542 0.32747382 -6.7149245 -6.5699176 -0.86863105 + 9700 544 0.32463079 -6.7205757 -6.5758643 -0.85393932 + 9800 546 0.31517825 -6.7178961 -6.5764699 -0.81017759 + 9900 548 0.33649933 -6.7380644 -6.5860871 -0.80769312 + 10000 550 0.37394555 -6.7612874 -6.5913121 -0.82102213 +Loop time of 16.7275 on 1 procs for 10000 steps with 550 atoms + +Performance: 258256.688 tau/day, 597.816 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 9.2508 | 9.2508 | 9.2508 | 0.0 | 55.30 +Bond | 0.021603 | 0.021603 | 0.021603 | 0.0 | 0.13 +Neigh | 4.5325 | 4.5325 | 4.5325 | 0.0 | 27.10 +Comm | 0.62777 | 0.62777 | 0.62777 | 0.0 | 3.75 +Output | 0.006916 | 0.006916 | 0.006916 | 0.0 | 0.04 +Modify | 2.218 | 2.218 | 2.218 | 0.0 | 13.26 +Other | | 0.07002 | | | 0.42 + +Nlocal: 550.000 ave 550 max 550 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2344.00 ave 2344 max 2344 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 36607.0 ave 36607 max 36607 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 36607 +Ave neighs/atom = 66.558182 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 847 +Dangerous builds = 0 +Total wall time: 0:00:16 diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.4 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.4 new file mode 100644 index 0000000000..e9158cd7ec --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nve-small.g++.4 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 4 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.002 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nve/small molecule mol dimer + create bodies CPU = 0.000 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.255 | 5.852 | 6.302 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8946578 -6.8874992 -0.73775337 + 200 354 1.0081552 -6.8645575 -6.850318 -0.69629729 + 300 356 1.0085803 -6.821677 -6.8004288 -0.69532657 + 400 358 1.0099188 -6.7837923 -6.7555822 -0.68879568 + 500 360 1.0140221 -6.7446709 -6.7094618 -0.72991641 + 600 362 1.026146 -6.7129201 -6.6704003 -0.67063836 + 700 364 1.0683193 -6.6776523 -6.6262908 -0.65572472 + 800 366 1.0958894 -6.6402029 -6.5803182 -0.66307282 + 900 368 1.1231769 -6.6050912 -6.5364187 -0.64076928 + 1000 370 1.1976289 -6.5942508 -6.51333 -0.69249047 + 1100 372 1.05061 -6.5772306 -6.4995645 -0.6307289 + 1200 374 0.93723829 -6.5732962 -6.4981166 -0.64963821 + 1300 376 0.93899122 -6.5578418 -6.476679 -0.65096688 + 1400 378 0.87050694 -6.546852 -6.4662495 -0.67613401 + 1500 380 0.84462904 -6.5400883 -6.4567368 -0.64376986 + 1600 382 0.92417795 -6.5611292 -6.4643567 -0.62092779 + 1700 384 0.67296541 -6.5589985 -6.4845167 -0.6779111 + 1800 386 0.87159158 -6.5655058 -6.4638954 -0.6582786 + 1900 388 0.67504975 -6.5772537 -6.4946123 -0.665098 + 2000 390 0.65034978 -6.5717854 -6.4884072 -0.73162072 + 2100 392 0.63389859 -6.5652907 -6.4803935 -0.64937411 + 2200 394 0.6265637 -6.5582412 -6.4707767 -0.70819854 + 2300 396 0.85352983 -6.5750751 -6.4511408 -0.69995918 + 2400 398 0.69792348 -6.5938659 -6.4886513 -0.63755214 + 2500 400 0.45320495 -6.595022 -6.5242087 -0.70462183 + 2600 402 0.46824374 -6.5697613 -6.4940502 -0.75497893 + 2700 404 0.46605975 -6.5599272 -6.4820583 -0.66778506 + 2800 406 0.50637604 -6.5700492 -6.482743 -0.63812082 + 2900 408 0.55335921 -6.5873352 -6.4890054 -0.62891652 + 3000 410 0.51731142 -6.5890566 -6.4944264 -0.64305355 + 3100 412 0.59439734 -6.6003127 -6.4885025 -0.67140541 + 3200 414 0.53413632 -6.595564 -6.4923492 -0.76242248 + 3300 416 0.49221593 -6.5990831 -6.5014681 -0.71330819 + 3400 418 0.55006126 -6.6015725 -6.4897179 -0.72044309 + 3500 420 0.49065348 -6.6329864 -6.5307669 -0.65775397 + 3600 422 0.41907335 -6.6219753 -6.5325995 -0.75936391 + 3700 424 0.38720116 -6.6153349 -6.5308629 -0.74166397 + 3800 426 0.40625994 -6.6150209 -6.5244231 -0.7595111 + 3900 428 0.40460547 -6.6122642 -6.5200936 -0.70484465 + 4000 430 0.45014991 -6.6254404 -6.5207544 -0.70069933 + 4100 432 0.44820466 -6.640222 -6.5338771 -0.805972 + 4200 434 0.39767521 -6.6450316 -6.5488199 -0.72841414 + 4300 436 0.4155331 -6.6547917 -6.5523381 -0.6894484 + 4400 438 0.43034353 -6.6615074 -6.5534303 -0.74026062 + 4500 440 0.38062977 -6.6541618 -6.5568417 -0.85911194 + 4600 442 0.39357419 -6.6522517 -6.5498512 -0.66232114 + 4700 444 0.40296801 -6.6647029 -6.5580616 -0.67307577 + 4800 446 0.38194993 -6.6510248 -6.548258 -0.77887746 + 4900 448 0.40739835 -6.6601751 -6.5487771 -0.84146416 + 5000 450 0.38392807 -6.6560665 -6.5494198 -0.77343399 + 5100 452 0.35209286 -6.6481476 -6.5488294 -0.68065755 + 5200 454 0.41355143 -6.6615988 -6.543181 -0.81611092 + 5300 456 0.42200484 -6.6627494 -6.5401273 -0.7774134 + 5400 458 0.37764326 -6.661431 -6.550117 -0.72187808 + 5500 460 0.41857405 -6.6674232 -6.542306 -0.74929745 + 5600 462 0.41682611 -6.6710961 -6.5447852 -0.7557454 + 5700 464 0.44396148 -6.6924346 -6.5560887 -0.78018312 + 5800 466 0.37058077 -6.6865013 -6.5711919 -0.74146125 + 5900 468 0.346812 -6.681215 -6.57191 -0.81184233 + 6000 470 0.34919462 -6.6827931 -6.571348 -0.87330821 + 6100 472 0.39360936 -6.6933359 -6.5661634 -0.79237598 + 6200 474 0.33270778 -6.6847095 -6.5759127 -0.77978526 + 6300 476 0.35973804 -6.6951254 -6.5760944 -0.80340174 + 6400 478 0.38124318 -6.7045984 -6.5769857 -0.81628407 + 6500 480 0.41188302 -6.7133356 -6.573896 -0.7940289 + 6600 482 0.36998039 -6.7079555 -6.5813025 -0.75055442 + 6700 484 0.37615026 -6.722917 -6.592741 -0.76534055 + 6800 486 0.3466597 -6.7188712 -6.5976116 -0.77986211 + 6900 488 0.32902492 -6.7247054 -6.6084005 -0.75702458 + 7000 490 0.31856427 -6.7167709 -6.6029979 -0.76014555 + 7100 492 0.30233891 -6.7144406 -6.6053651 -0.96246708 + 7200 494 0.32557309 -6.7315347 -6.6129049 -0.8122153 + 7300 496 0.29919611 -6.7186327 -6.6085455 -0.71917931 + 7400 498 0.29778169 -6.7259455 -6.6153238 -0.88199391 + 7500 500 0.35535305 -6.7419073 -6.6086499 -0.90344083 + 7600 502 0.31979187 -6.7326802 -6.6116434 -0.78324572 + 7700 504 0.30821359 -6.72895 -6.6112295 -0.81363335 + 7800 506 0.31374993 -6.7255461 -6.6046346 -0.89904197 + 7900 508 0.29072338 -6.7177355 -6.6047082 -0.81423073 + 8000 510 0.30557494 -6.7208283 -6.600995 -0.85853575 + 8100 512 0.30521237 -6.726874 -6.6061601 -0.75361257 + 8200 514 0.29622226 -6.7152225 -6.5970794 -0.85766132 + 8300 516 0.28337698 -6.7023552 -6.5884003 -0.8985415 + 8400 518 0.32860902 -6.7211074 -6.5878875 -0.89758921 + 8500 520 0.35483743 -6.7406183 -6.5956126 -0.77602077 + 8600 522 0.32928486 -6.7326607 -6.5970358 -0.75070137 + 8700 524 0.36008106 -6.7474714 -6.5980103 -0.87093836 + 8800 526 0.36082301 -6.743579 -6.5926644 -0.90132107 + 8900 528 0.35010285 -6.7501553 -6.6026214 -0.85238959 + 9000 530 0.31513985 -6.7411795 -6.6073937 -0.75884529 + 9100 532 0.30895083 -6.7421063 -6.6099891 -0.74482692 + 9200 534 0.33631849 -6.751265 -6.6064087 -0.95632911 + 9300 536 0.33306096 -6.759187 -6.6147156 -0.76275935 + 9400 538 0.34582537 -6.7706766 -6.619619 -0.72251598 + 9500 540 0.32003146 -6.772057 -6.6313024 -0.88195851 + 9600 542 0.32439637 -6.7743569 -6.6307127 -0.90233104 + 9700 544 0.33988235 -6.7763721 -6.624862 -0.85185581 + 9800 546 0.32877587 -6.7744977 -6.62697 -0.8550905 + 9900 548 0.29570051 -6.7623752 -6.6288243 -1.0371157 + 10000 550 0.33675914 -6.7757315 -6.6226591 -1.0082157 +Loop time of 16.2553 on 4 procs for 10000 steps with 550 atoms + +Performance: 265759.101 tau/day, 615.183 timesteps/s +97.0% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0034051 | 2.6646 | 8.0317 | 200.7 | 16.39 +Bond | 0.0022626 | 0.0072971 | 0.019437 | 8.3 | 0.04 +Neigh | 0.018657 | 1.218 | 3.7621 | 137.5 | 7.49 +Comm | 1.1497 | 6.7957 | 12.192 | 164.2 | 41.81 +Output | 0.010692 | 0.01431 | 0.019901 | 3.2 | 0.09 +Modify | 3.1502 | 5.3779 | 11.342 | 149.0 | 33.08 +Other | | 0.1775 | | | 1.09 + +Nlocal: 137.500 ave 299 max 2 min +Histogram: 2 0 0 0 0 0 0 1 0 1 +Nghost: 1903.75 ave 2686 max 529 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Neighs: 9209.75 ave 23206 max 0 min +Histogram: 2 0 0 0 0 1 0 0 0 1 + +Total # of neighbors = 36839 +Ave neighs/atom = 66.980000 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 829 +Dangerous builds = 0 +Total wall time: 0:00:16 diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.1 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.1 new file mode 100644 index 0000000000..5abc557d8b --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.1 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 1 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.001 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nvt/small molecule temp 0.1 0.1 0.1 mol dimer + create bodies CPU = 0.000 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.929 | 5.929 | 5.929 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8875167 -6.8803581 -0.73353914 + 200 354 1.0081552 -6.8594643 -6.8452248 -0.70421276 + 300 356 1.0085803 -6.8171524 -6.7959042 -0.6917826 + 400 358 1.0099188 -6.7852701 -6.7570601 -0.70371699 + 500 360 1.0140221 -6.7493429 -6.7141338 -0.68415307 + 600 362 1.026148 -6.7105231 -6.6680032 -0.68314418 + 700 364 1.0683344 -6.6725162 -6.621154 -0.65747369 + 800 366 1.0958953 -6.6412275 -6.5813425 -0.68789615 + 900 368 1.1250034 -6.6101882 -6.541404 -0.66674346 + 1000 370 1.2326365 -6.5993719 -6.5160856 -0.69688655 + 1100 372 1.1397444 -6.5912865 -6.5070312 -0.6333041 + 1200 374 1.0514447 -6.5905753 -6.5062348 -0.71020272 + 1300 376 1.0033284 -6.5747792 -6.4880554 -0.65459641 + 1400 378 0.82996548 -6.5681806 -6.4913319 -0.60438595 + 1500 380 0.90239071 -6.5752982 -6.4862465 -0.66528503 + 1600 382 0.86403681 -6.5692212 -6.4787461 -0.65027922 + 1700 384 0.64748046 -6.5644242 -6.4927629 -0.63046709 + 1800 386 0.74288742 -6.5515741 -6.4649681 -0.67770665 + 1900 388 0.72584537 -6.5565195 -6.4676596 -0.66175025 + 2000 390 0.73351281 -6.5631154 -6.4690753 -0.64686647 + 2100 392 0.76490681 -6.5573734 -6.4549305 -0.68861526 + 2200 394 0.65926638 -6.5511574 -6.4591279 -0.71726284 + 2300 396 0.70267414 -6.5728555 -6.4708258 -0.64360436 + 2400 398 0.60523691 -6.5845973 -6.4933555 -0.63956839 + 2500 400 0.5103586 -6.5812006 -6.5014571 -0.68698448 + 2600 402 0.52401744 -6.6003358 -6.5156066 -0.68987222 + 2700 404 0.46421291 -6.5662747 -6.4887143 -0.72872856 + 2800 406 0.48254258 -6.5724266 -6.4892296 -0.75447872 + 2900 408 0.53073083 -6.5809842 -6.4866754 -0.67592283 + 3000 410 0.55314547 -6.5922077 -6.4910226 -0.74646953 + 3100 412 0.47150308 -6.5907273 -6.5020344 -0.64994935 + 3200 414 0.43047803 -6.5836315 -6.5004473 -0.79764713 + 3300 416 0.46289353 -6.5739439 -6.4821441 -0.76441674 + 3400 418 0.59724106 -6.5980575 -6.4766089 -0.73735626 + 3500 420 0.43571285 -6.5955972 -6.5048237 -0.64145941 + 3600 422 0.42461639 -6.6060271 -6.5154691 -0.70124484 + 3700 424 0.44323254 -6.6059723 -6.5092766 -0.74498147 + 3800 426 0.4037907 -6.592043 -6.5019958 -0.72171799 + 3900 428 0.41668443 -6.5975302 -6.5026079 -0.68327878 + 4000 430 0.44895183 -6.5958671 -6.4914597 -0.73939433 + 4100 432 0.39798052 -6.5952115 -6.5007833 -0.74871822 + 4200 434 0.45156734 -6.6237274 -6.5144772 -0.75111778 + 4300 436 0.48297356 -6.6395283 -6.5204465 -0.76105913 + 4400 438 0.43595234 -6.6347133 -6.5252276 -0.72858275 + 4500 440 0.44683726 -6.6385398 -6.5242916 -0.74280051 + 4600 442 0.47875512 -6.6419903 -6.5174274 -0.75579572 + 4700 444 0.43972605 -6.6406078 -6.5242388 -0.72196509 + 4800 446 0.43572615 -6.6495404 -6.5323047 -0.7135049 + 4900 448 0.38063437 -6.6432385 -6.5391588 -0.77087429 + 5000 450 0.4239223 -6.6617795 -6.5440233 -0.784531 + 5100 452 0.37201988 -6.6581813 -6.5532421 -0.74611403 + 5200 454 0.41765777 -6.6661321 -6.5465385 -0.75422239 + 5300 456 0.38015287 -6.6606624 -6.5502013 -0.78866702 + 5400 458 0.40549607 -6.6807118 -6.5611878 -0.78932883 + 5500 460 0.34444407 -6.6720564 -6.5690976 -0.77859171 + 5600 462 0.36572308 -6.6730078 -6.5621827 -0.85672419 + 5700 464 0.40055073 -6.6976989 -6.574685 -0.74251563 + 5800 466 0.36037213 -6.7022014 -6.5900685 -0.66239625 + 5900 468 0.32810921 -6.6952135 -6.591803 -0.83981757 + 6000 470 0.35110886 -6.6986862 -6.5866302 -0.82474047 + 6100 472 0.29965884 -6.6839503 -6.5871326 -0.7864913 + 6200 474 0.32402637 -6.6902745 -6.5843165 -0.74531083 + 6300 476 0.35042653 -6.6990084 -6.5830585 -0.74839967 + 6400 478 0.32695511 -6.6909459 -6.5815048 -0.76549489 + 6500 480 0.35209088 -6.6902987 -6.5711013 -0.71281516 + 6600 482 0.354106 -6.6890268 -6.567808 -0.81897158 + 6700 484 0.3504816 -6.681739 -6.5604463 -0.811609 + 6800 486 0.37396733 -6.7018369 -6.5710253 -0.80383296 + 6900 488 0.36435774 -6.7010114 -6.5722169 -0.72063651 + 7000 490 0.35631012 -6.7089806 -6.581727 -0.74152078 + 7100 492 0.37646659 -6.719154 -6.5833352 -0.77739001 + 7200 494 0.36546269 -6.7223269 -6.5891623 -0.8288767 + 7300 496 0.37688206 -6.7457243 -6.607053 -0.80062121 + 7400 498 0.30331409 -6.7284953 -6.6158184 -0.79894584 + 7500 500 0.30382936 -6.7333804 -6.6194444 -0.86924602 + 7600 502 0.30163143 -6.7294737 -6.6153104 -0.7689497 + 7700 504 0.30281215 -6.7233976 -6.6077402 -0.8557548 + 7800 506 0.33378009 -6.7244958 -6.5958651 -0.82584084 + 7900 508 0.31843128 -6.7250998 -6.6013002 -0.82424684 + 8000 510 0.35912946 -6.7399052 -6.5990701 -0.81879575 + 8100 512 0.31405017 -6.733487 -6.6092777 -0.72940457 + 8200 514 0.30475 -6.7271485 -6.6056043 -0.87958287 + 8300 516 0.30717434 -6.7277574 -6.6042329 -0.81700937 + 8400 518 0.33032462 -6.7382165 -6.6043011 -0.75436496 + 8500 520 0.32218568 -6.7351971 -6.6035347 -0.77661738 + 8600 522 0.30922651 -6.7275431 -6.6001797 -0.85334327 + 8700 524 0.30728021 -6.7237477 -6.5962029 -0.94977016 + 8800 526 0.31061903 -6.7181672 -6.5882505 -0.86132456 + 8900 528 0.33543344 -6.728929 -6.5875768 -0.87545919 + 9000 530 0.31887735 -6.7265066 -6.5911341 -0.76892061 + 9100 532 0.31888326 -6.7216274 -6.5852629 -0.83190298 + 9200 534 0.33310892 -6.7111349 -6.567661 -0.94282671 + 9300 536 0.34737171 -6.722515 -6.5718361 -0.95235602 + 9400 538 0.32752858 -6.7246204 -6.5815549 -0.86227131 + 9500 540 0.30665764 -6.7225391 -6.5876665 -0.87144326 + 9600 542 0.32747382 -6.7149245 -6.5699176 -0.86863105 + 9700 544 0.32463079 -6.7205757 -6.5758643 -0.85393932 + 9800 546 0.31517825 -6.7178961 -6.5764699 -0.81017759 + 9900 548 0.33649933 -6.7380644 -6.5860871 -0.80769312 + 10000 550 0.37394555 -6.7612874 -6.5913121 -0.82102213 +Loop time of 16.6615 on 1 procs for 10000 steps with 550 atoms + +Performance: 259279.806 tau/day, 600.185 timesteps/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 9.2639 | 9.2639 | 9.2639 | 0.0 | 55.60 +Bond | 0.021559 | 0.021559 | 0.021559 | 0.0 | 0.13 +Neigh | 4.544 | 4.544 | 4.544 | 0.0 | 27.27 +Comm | 0.62792 | 0.62792 | 0.62792 | 0.0 | 3.77 +Output | 0.0069666 | 0.0069666 | 0.0069666 | 0.0 | 0.04 +Modify | 2.1282 | 2.1282 | 2.1282 | 0.0 | 12.77 +Other | | 0.06897 | | | 0.41 + +Nlocal: 550.000 ave 550 max 550 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2344.00 ave 2344 max 2344 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 36607.0 ave 36607 max 36607 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 36607 +Ave neighs/atom = 66.558182 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 847 +Dangerous builds = 0 +Total wall time: 0:00:16 diff --git a/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.4 b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.4 new file mode 100644 index 0000000000..7239fc9bb9 --- /dev/null +++ b/examples/deposit/log.10Mar21.deposit.molecule.rigid-nvt-small.g++.4 @@ -0,0 +1,218 @@ +LAMMPS (10 Mar 2021) + using 1 OpenMP thread(s) per MPI task +# sample surface deposition script for molecules + +units lj +atom_style bond +boundary p p f + +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block 0 5 0 5 0 10 +create_box 3 box bond/types 1 extra/bond/per/atom 1 +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (7.9370053 7.9370053 15.874011) + 1 by 1 by 4 MPI processor grid + +region substrate block INF INF INF INF INF 3 +create_atoms 1 region substrate +Created 350 atoms + create_atoms CPU = 0.002 seconds + +pair_style lj/cut 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 2 1.0 1.0 5.0 +mass * 1.0 + +bond_style harmonic +bond_coeff 1 5.0 1.0 + +neigh_modify delay 0 + +molecule dimer molecule.dimer +Read molecule template dimer: + 1 molecules + 2 atoms with max type 3 + 1 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region slab block 0 5 0 5 8 9 + +group addatoms empty +0 atoms in group addatoms +region mobile block 0 5 0 5 2 INF +group mobile region mobile +150 atoms in group mobile + +compute add addatoms temp +compute_modify add dynamic/dof yes extra/dof 0 + +fix 1 addatoms rigid/nvt/small molecule temp 0.1 0.1 0.1 mol dimer + create bodies CPU = 0.000 seconds + 0 rigid bodies with 0 atoms + 1.0000000 = max distance from body owner to body atom +fix 2 mobile langevin 0.1 0.1 0.1 587283 +fix 3 mobile nve + +fix 4 addatoms deposit 100 0 100 12345 region slab near 1.0 mol dimer vz -1.0 -1.0 rigid 1 +fix 5 addatoms wall/reflect zhi EDGE + +thermo_style custom step atoms temp epair etotal press +thermo 100 +thermo_modify temp add lost/bond ignore lost warn +WARNING: Temperature for thermo pressure is not for group all (src/thermo.cpp:468) + +#dump 1 all atom 50 dump.deposit.atom + +#dump 2 all image 50 image.*.jpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 2 pad 5 + +#dump 3 all movie 50 tmp.mpg type type # axes yes 0.8 0.02 view 80 -30 +#dump_modify 3 pad 5 + +run 10000 +WARNING: Should not allow rigid bodies to bounce off relecting walls (src/fix_wall_reflect.cpp:182) +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.3 + ghost atom cutoff = 5.3 + binsize = 2.65, bins = 3 3 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.255 | 5.852 | 6.302 Mbytes +Step Atoms Temp E_pair TotEng Press + 0 350 0 -6.9215833 -6.9215833 -1.0052629 + 100 352 1.0079368 -6.8946578 -6.8874992 -0.73775337 + 200 354 1.0081552 -6.8645575 -6.850318 -0.69629729 + 300 356 1.0085803 -6.821677 -6.8004288 -0.69532657 + 400 358 1.0099188 -6.7837923 -6.7555822 -0.68879568 + 500 360 1.0140221 -6.7446709 -6.7094618 -0.72991641 + 600 362 1.026146 -6.7129201 -6.6704003 -0.67063836 + 700 364 1.0683193 -6.6776523 -6.6262908 -0.65572472 + 800 366 1.0958894 -6.6402029 -6.5803182 -0.66307282 + 900 368 1.1231769 -6.6050912 -6.5364187 -0.64076928 + 1000 370 1.1976289 -6.5942508 -6.51333 -0.69249047 + 1100 372 1.05061 -6.5772306 -6.4995645 -0.6307289 + 1200 374 0.93723829 -6.5732962 -6.4981166 -0.64963821 + 1300 376 0.93899122 -6.5578418 -6.476679 -0.65096688 + 1400 378 0.87050694 -6.546852 -6.4662495 -0.67613401 + 1500 380 0.84462904 -6.5400883 -6.4567368 -0.64376986 + 1600 382 0.92417795 -6.5611292 -6.4643567 -0.62092779 + 1700 384 0.67296541 -6.5589985 -6.4845167 -0.6779111 + 1800 386 0.87159158 -6.5655058 -6.4638954 -0.6582786 + 1900 388 0.67504975 -6.5772537 -6.4946123 -0.665098 + 2000 390 0.65034978 -6.5717854 -6.4884072 -0.73162072 + 2100 392 0.63389859 -6.5652907 -6.4803935 -0.64937411 + 2200 394 0.6265637 -6.5582412 -6.4707767 -0.70819854 + 2300 396 0.85352983 -6.5750751 -6.4511408 -0.69995918 + 2400 398 0.69792348 -6.5938659 -6.4886513 -0.63755214 + 2500 400 0.45320495 -6.595022 -6.5242087 -0.70462183 + 2600 402 0.46824374 -6.5697613 -6.4940502 -0.75497893 + 2700 404 0.46605975 -6.5599272 -6.4820583 -0.66778506 + 2800 406 0.50637604 -6.5700492 -6.482743 -0.63812082 + 2900 408 0.55335921 -6.5873352 -6.4890054 -0.62891652 + 3000 410 0.51731142 -6.5890566 -6.4944264 -0.64305355 + 3100 412 0.59439734 -6.6003127 -6.4885025 -0.67140541 + 3200 414 0.53413632 -6.595564 -6.4923492 -0.76242248 + 3300 416 0.49221593 -6.5990831 -6.5014681 -0.71330819 + 3400 418 0.55006126 -6.6015725 -6.4897179 -0.72044309 + 3500 420 0.49065348 -6.6329864 -6.5307669 -0.65775397 + 3600 422 0.41907335 -6.6219753 -6.5325995 -0.75936391 + 3700 424 0.38720116 -6.6153349 -6.5308629 -0.74166397 + 3800 426 0.40625994 -6.6150209 -6.5244231 -0.7595111 + 3900 428 0.40460547 -6.6122642 -6.5200936 -0.70484465 + 4000 430 0.45014991 -6.6254404 -6.5207544 -0.70069933 + 4100 432 0.44820466 -6.640222 -6.5338771 -0.805972 + 4200 434 0.39767521 -6.6450316 -6.5488199 -0.72841414 + 4300 436 0.4155331 -6.6547917 -6.5523381 -0.6894484 + 4400 438 0.43034353 -6.6615074 -6.5534303 -0.74026062 + 4500 440 0.38062977 -6.6541618 -6.5568417 -0.85911194 + 4600 442 0.39357419 -6.6522517 -6.5498512 -0.66232114 + 4700 444 0.40296801 -6.6647029 -6.5580616 -0.67307577 + 4800 446 0.38194993 -6.6510248 -6.548258 -0.77887746 + 4900 448 0.40739835 -6.6601751 -6.5487771 -0.84146416 + 5000 450 0.38392807 -6.6560665 -6.5494198 -0.77343399 + 5100 452 0.35209286 -6.6481476 -6.5488294 -0.68065755 + 5200 454 0.41355143 -6.6615988 -6.543181 -0.81611092 + 5300 456 0.42200484 -6.6627494 -6.5401273 -0.7774134 + 5400 458 0.37764326 -6.661431 -6.550117 -0.72187808 + 5500 460 0.41857405 -6.6674232 -6.542306 -0.74929745 + 5600 462 0.41682611 -6.6710961 -6.5447852 -0.7557454 + 5700 464 0.44396148 -6.6924346 -6.5560887 -0.78018312 + 5800 466 0.37058077 -6.6865013 -6.5711919 -0.74146125 + 5900 468 0.346812 -6.681215 -6.57191 -0.81184233 + 6000 470 0.34919462 -6.6827931 -6.571348 -0.87330821 + 6100 472 0.39360936 -6.6933359 -6.5661634 -0.79237598 + 6200 474 0.33270778 -6.6847095 -6.5759127 -0.77978526 + 6300 476 0.35973804 -6.6951254 -6.5760944 -0.80340174 + 6400 478 0.38124318 -6.7045984 -6.5769857 -0.81628407 + 6500 480 0.41188302 -6.7133356 -6.573896 -0.7940289 + 6600 482 0.36998039 -6.7079555 -6.5813025 -0.75055442 + 6700 484 0.37615026 -6.722917 -6.592741 -0.76534055 + 6800 486 0.3466597 -6.7188712 -6.5976116 -0.77986211 + 6900 488 0.32902492 -6.7247054 -6.6084005 -0.75702458 + 7000 490 0.31856427 -6.7167709 -6.6029979 -0.76014555 + 7100 492 0.30233891 -6.7144406 -6.6053651 -0.96246708 + 7200 494 0.32557309 -6.7315347 -6.6129049 -0.8122153 + 7300 496 0.29919611 -6.7186327 -6.6085455 -0.71917931 + 7400 498 0.29778169 -6.7259455 -6.6153238 -0.88199391 + 7500 500 0.35535305 -6.7419073 -6.6086499 -0.90344083 + 7600 502 0.31979187 -6.7326802 -6.6116434 -0.78324572 + 7700 504 0.30821359 -6.72895 -6.6112295 -0.81363335 + 7800 506 0.31374993 -6.7255461 -6.6046346 -0.89904197 + 7900 508 0.29072338 -6.7177355 -6.6047082 -0.81423073 + 8000 510 0.30557494 -6.7208283 -6.600995 -0.85853575 + 8100 512 0.30521237 -6.726874 -6.6061601 -0.75361257 + 8200 514 0.29622226 -6.7152225 -6.5970794 -0.85766132 + 8300 516 0.28337698 -6.7023552 -6.5884003 -0.8985415 + 8400 518 0.32860902 -6.7211074 -6.5878875 -0.89758921 + 8500 520 0.35483743 -6.7406183 -6.5956126 -0.77602077 + 8600 522 0.32928486 -6.7326607 -6.5970358 -0.75070137 + 8700 524 0.36008106 -6.7474714 -6.5980103 -0.87093836 + 8800 526 0.36082301 -6.743579 -6.5926644 -0.90132107 + 8900 528 0.35010285 -6.7501553 -6.6026214 -0.85238959 + 9000 530 0.31513985 -6.7411795 -6.6073937 -0.75884529 + 9100 532 0.30895083 -6.7421063 -6.6099891 -0.74482692 + 9200 534 0.33631849 -6.751265 -6.6064087 -0.95632911 + 9300 536 0.33306096 -6.759187 -6.6147156 -0.76275935 + 9400 538 0.34582537 -6.7706766 -6.619619 -0.72251598 + 9500 540 0.32003146 -6.772057 -6.6313024 -0.88195851 + 9600 542 0.32439637 -6.7743569 -6.6307127 -0.90233104 + 9700 544 0.33988235 -6.7763721 -6.624862 -0.85185581 + 9800 546 0.32877587 -6.7744977 -6.62697 -0.8550905 + 9900 548 0.29570051 -6.7623752 -6.6288243 -1.0371157 + 10000 550 0.33675914 -6.7757315 -6.6226591 -1.0082157 +Loop time of 16.1559 on 4 procs for 10000 steps with 550 atoms + +Performance: 267395.139 tau/day, 618.970 timesteps/s +96.1% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0035574 | 2.5467 | 7.5373 | 192.6 | 15.76 +Bond | 0.0022929 | 0.0073138 | 0.019471 | 8.3 | 0.05 +Neigh | 0.018645 | 1.2357 | 3.8167 | 138.4 | 7.65 +Comm | 1.1946 | 6.6335 | 11.87 | 158.8 | 41.06 +Output | 0.010714 | 0.014391 | 0.020006 | 3.2 | 0.09 +Modify | 3.4474 | 5.6081 | 11.47 | 143.2 | 34.71 +Other | | 0.1102 | | | 0.68 + +Nlocal: 137.500 ave 299 max 2 min +Histogram: 2 0 0 0 0 0 0 1 0 1 +Nghost: 1903.75 ave 2686 max 529 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Neighs: 9209.75 ave 23206 max 0 min +Histogram: 2 0 0 0 0 1 0 0 0 1 + +Total # of neighbors = 36839 +Ave neighs/atom = 66.980000 +Ave special neighs/atom = 0.36363636 +Neighbor list builds = 829 +Dangerous builds = 0 +Total wall time: 0:00:16 From 11d62b71c382ef202cee84602e35984b3e0b98a7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 11:11:01 -0400 Subject: [PATCH 268/370] use clang preset when compiling on MacOS --- .github/workflows/unittest-macos.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml index a65db7636b..f62b3046c9 100644 --- a/.github/workflows/unittest-macos.yml +++ b/.github/workflows/unittest-macos.yml @@ -24,7 +24,9 @@ jobs: shell: bash working-directory: ${{github.workspace}}/build run: | - cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake \ + cmake -C $GITHUB_WORKSPACE/cmake/presets/clang.cmake \ + -C $GITHUB_WORKSPACE/cmake/presets/most.cmake \ + $GITHUB_WORKSPACE/cmake \ -DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON cmake --build . --parallel 2 From 6a99f5b5c54e0385aa314afd1e7f1c3d187196ce Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Tue, 6 Apr 2021 17:24:54 +0200 Subject: [PATCH 269/370] WIP: - no auto-download of user-pace src yet - lib/pace/*.cpp,*.h are provided explicitly yet. - implement CMake integration in USER-PACE.cmake and in CMakeLists.txt --- cmake/CMakeLists.txt | 6 +- cmake/Modules/Packages/USER-PACE.cmake | 14 + lib/pace/Install.py | 1 + lib/pace/LICENSE | 674 ++++++++ lib/pace/README | 0 lib/pace/TODO | 30 + lib/pace/ace_abstract_basis.cpp | 184 +++ lib/pace/ace_abstract_basis.h | 169 ++ lib/pace/ace_array2dlm.h | 579 +++++++ lib/pace/ace_arraynd.h | 1949 ++++++++++++++++++++++++ lib/pace/ace_c_basis.cpp | 980 ++++++++++++ lib/pace/ace_c_basis.h | 155 ++ lib/pace/ace_c_basisfunction.h | 251 +++ lib/pace/ace_complex.h | 266 ++++ lib/pace/ace_contigous_array.h | 249 +++ lib/pace/ace_evaluator.cpp | 660 ++++++++ lib/pace/ace_evaluator.h | 230 +++ lib/pace/ace_flatten_basis.cpp | 130 ++ lib/pace/ace_flatten_basis.h | 135 ++ lib/pace/ace_radial.cpp | 566 +++++++ lib/pace/ace_radial.h | 324 ++++ lib/pace/ace_recursive.cpp | 1340 ++++++++++++++++ lib/pace/ace_recursive.h | 247 +++ lib/pace/ace_spherical_cart.cpp | 221 +++ lib/pace/ace_spherical_cart.h | 134 ++ lib/pace/ace_timing.h | 126 ++ lib/pace/ace_types.h | 45 + lib/pace/ace_version.h | 39 + lib/pace/ships_radial.cpp | 388 +++++ lib/pace/ships_radial.h | 158 ++ src/Makefile | 4 +- src/USER-PACE/Install.sh | 68 + src/USER-PACE/LICENSE | 674 ++++++++ src/USER-PACE/pair_pace.cpp | 458 ++++++ src/USER-PACE/pair_pace.h | 97 ++ 35 files changed, 11546 insertions(+), 5 deletions(-) create mode 100644 cmake/Modules/Packages/USER-PACE.cmake create mode 100644 lib/pace/Install.py create mode 100644 lib/pace/LICENSE create mode 100644 lib/pace/README create mode 100644 lib/pace/TODO create mode 100644 lib/pace/ace_abstract_basis.cpp create mode 100644 lib/pace/ace_abstract_basis.h create mode 100644 lib/pace/ace_array2dlm.h create mode 100644 lib/pace/ace_arraynd.h create mode 100644 lib/pace/ace_c_basis.cpp create mode 100644 lib/pace/ace_c_basis.h create mode 100644 lib/pace/ace_c_basisfunction.h create mode 100644 lib/pace/ace_complex.h create mode 100644 lib/pace/ace_contigous_array.h create mode 100644 lib/pace/ace_evaluator.cpp create mode 100644 lib/pace/ace_evaluator.h create mode 100644 lib/pace/ace_flatten_basis.cpp create mode 100644 lib/pace/ace_flatten_basis.h create mode 100644 lib/pace/ace_radial.cpp create mode 100644 lib/pace/ace_radial.h create mode 100644 lib/pace/ace_recursive.cpp create mode 100644 lib/pace/ace_recursive.h create mode 100644 lib/pace/ace_spherical_cart.cpp create mode 100644 lib/pace/ace_spherical_cart.h create mode 100644 lib/pace/ace_timing.h create mode 100644 lib/pace/ace_types.h create mode 100644 lib/pace/ace_version.h create mode 100644 lib/pace/ships_radial.cpp create mode 100644 lib/pace/ships_radial.h create mode 100644 src/USER-PACE/Install.sh create mode 100644 src/USER-PACE/LICENSE create mode 100644 src/USER-PACE/pair_pace.cpp create mode 100644 src/USER-PACE/pair_pace.h diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 21d965ebba..4bd5ea8fec 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -119,7 +119,7 @@ set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REACTION USER-REAXC USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH - USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF) + USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-PACE) set(SUFFIX_PACKAGES CORESHELL GPU KOKKOS OPT USER-INTEL USER-OMP) @@ -382,9 +382,9 @@ else() endif() foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-MOLFILE USER-NETCDF USER-PLUMED USER-QMMM - USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS) + USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS USER-PACE) if(PKG_${PKG_WITH_INCL}) - include(Packages/${PKG_WITH_INCL}) + include(Packages/${PKG_WITH_INCL}) endif() endforeach() diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake new file mode 100644 index 0000000000..c9e8e1bcfe --- /dev/null +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -0,0 +1,14 @@ +set(PACE_EVALUATOR_PATH ${LAMMPS_LIB_SOURCE_DIR}/pace) +message("CMakeLists.txt DEBUG: PACE_EVALUATOR_PATH=${PACE_EVALUATOR_PATH}") +set(PACE_EVALUATOR_SRC_PATH ${PACE_EVALUATOR_PATH}) + +FILE(GLOB PACE_EVALUATOR_SOURCE_FILES ${PACE_EVALUATOR_SRC_PATH}/*.cpp) +set(PACE_EVALUATOR_INCLUDE_DIR ${PACE_EVALUATOR_SRC_PATH}) + + +##### aceevaluator ##### +add_library(aceevaluator ${PACE_EVALUATOR_SOURCE_FILES}) +target_include_directories(aceevaluator PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) +target_compile_options(aceevaluator PRIVATE -O2) +set_target_properties(aceevaluator PROPERTIES OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) +target_link_libraries(lammps PRIVATE aceevaluator) \ No newline at end of file diff --git a/lib/pace/Install.py b/lib/pace/Install.py new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/lib/pace/Install.py @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/lib/pace/LICENSE b/lib/pace/LICENSE new file mode 100644 index 0000000000..f288702d2f --- /dev/null +++ b/lib/pace/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/lib/pace/README b/lib/pace/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/pace/TODO b/lib/pace/TODO new file mode 100644 index 0000000000..8021916923 --- /dev/null +++ b/lib/pace/TODO @@ -0,0 +1,30 @@ +[TODO/DONE] pair_pace.cpp and pair_pace.h will have to go into src/USER-PACE and thus also need to conform to our requirements. + +[TODO] also src/USER-PACE would need to have an Install.sh file that integrates the settings from the lib folder into the conventional build process. +[TODO] there would have to be a lib/pace folder for building/interfacing to the library. + +[TODO] how you organize your repo is up to you. a better way to describe what you would have to do is to point you to examples. +which of the examples is relevant depends on what build system you are using for your "PACE" external package. + +If you are using CMake to build it, you can look at the KIM package +If you are using autoconf/automake, you can look at the USER-PLUMED package +If you are using neither (just a plain Makefile), you can look at the VORONOI or QUIP package +The following additional modifications are needed: + +[TODO] lib/pace: needs one or more Makefile.lammps, a README and an Install.py file +[TODO] src/Makefile: needs support for the USER-PACE package and compiling via lib-pace. Also the package needs to be added to the PACKEXT and PACKLIB variables + +[DONE] cmake/Modules/Packages/USER-PACE.cmake needs to be added +[DONE] cmake/CMakeLists.txt needs to include it in case the package is enabled. + +[TODO] doc/src/Build_extra.rst needs to include the build instructions for CMake and traditional make +[TODO] doc/src/Package_user.rst and doc/src/Package_details.rst needs to contain relevant information and links + + +Because of the different build systems, there are different steps required, but each of the examples I've pointed out are tested and used regularly and thus should be working sufficiently well. +Mind you the QUIP package is set up in such a way, that no automatic download is possible and a manual download and compilation is required. So that is the least preferred and least convenient option. + +We are happy to provide more details, but that requires that you first have something that already is following either of the suggested variants, so that we don't have to discuss in all generality. + +I would also suggest to close this pull request here, leave all files in place, but then start a new branch from the current master and then move the few things over you need to retain, +add the build environment files and then start working on getting it to do what it should. \ No newline at end of file diff --git a/lib/pace/ace_abstract_basis.cpp b/lib/pace/ace_abstract_basis.cpp new file mode 100644 index 0000000000..3d8afafdaf --- /dev/null +++ b/lib/pace/ace_abstract_basis.cpp @@ -0,0 +1,184 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Lysogorskiy Yury on 28.04.2020. + +#include "ace_abstract_basis.h" + +////embedding function +////case nemb = 1 only implementation +////F = sign(x)*( ( 1 - exp(-(w*x)^3) )*abs(x)^m + ((1/w)^(m-1))*exp(-(w*x)^3)*abs(x) ) +//// !! no prefactor wpre +void Fexp(DOUBLE_TYPE x, DOUBLE_TYPE m, DOUBLE_TYPE &F, DOUBLE_TYPE &DF) { + DOUBLE_TYPE w = 1.e6; + DOUBLE_TYPE eps = 1e-10; + + DOUBLE_TYPE lambda = pow(1.0 / w, m - 1.0); + if (abs(x) > eps) { + DOUBLE_TYPE g; + DOUBLE_TYPE a = abs(x); + DOUBLE_TYPE am = pow(a, m); + DOUBLE_TYPE w3x3 = pow(w * a, 3); + DOUBLE_TYPE sign_factor = (signbit(x) ? -1 : 1); + if (w3x3 > 30.0) + g = 0.0; + else + g = exp(-w3x3); + + DOUBLE_TYPE omg = 1.0 - g; + F = sign_factor * (omg * am + lambda * g * a); + DOUBLE_TYPE dg = -3.0 * w * w * w * a * a * g; + DF = m * pow(a, m - 1.0) * omg - am * dg + lambda * dg * a + lambda * g; + } else { + F = lambda * x; + DF = lambda; + } +} + + +//Scaled-shifted embedding function +//F = sign(x)*( ( 1 - exp(-(w*x)^3) )*abs(x)^m + ((1/w)^(m-1))*exp(-(w*x)^3)*abs(x) ) +// !! no prefactor wpre +void FexpShiftedScaled(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF) { + DOUBLE_TYPE eps = 1e-10; + DOUBLE_TYPE a, xoff, yoff, nx, exprho; + + if (abs(mexp - 1.0) < eps) { + F = rho; + DF = 1; + } else { + a = abs(rho); + exprho = exp(-a); + nx = 1. / mexp; + xoff = pow(nx, (nx / (1.0 - nx))) * exprho; + yoff = pow(nx, (1 / (1.0 - nx))) * exprho; + DOUBLE_TYPE sign_factor = (signbit(rho) ? -1 : 1); + F = sign_factor * (pow(xoff + a, mexp) - yoff); + DF = yoff + mexp * (-xoff + 1.0) * pow(xoff + a, mexp - 1.); + } +} + +void ACEAbstractBasisSet::inner_cutoff(DOUBLE_TYPE rho_core, DOUBLE_TYPE rho_cut, DOUBLE_TYPE drho_cut, + DOUBLE_TYPE &fcut, DOUBLE_TYPE &dfcut) { + + DOUBLE_TYPE rho_low = rho_cut - drho_cut; + if (rho_core >= rho_cut) { + fcut = 0; + dfcut = 0; + } else if (rho_core <= rho_low) { + fcut = 1; + dfcut = 0; + } else { + fcut = 0.5 * (1 + cos(M_PI * (rho_core - rho_low) / drho_cut)); + dfcut = -0.5 * sin(M_PI * (rho_core - rho_low) / drho_cut) * M_PI / drho_cut; + } +} + +void ACEAbstractBasisSet::FS_values_and_derivatives(Array1D &rhos, DOUBLE_TYPE &value, + Array1D &derivatives, DENSITY_TYPE ndensity) { + DOUBLE_TYPE F, DF = 0, wpre, mexp; + for (int p = 0; p < ndensity; p++) { + wpre = FS_parameters.at(p * ndensity + 0); + mexp = FS_parameters.at(p * ndensity + 1); + if (this->npoti == "FinnisSinclair") + Fexp(rhos(p), mexp, F, DF); + else if (this->npoti == "FinnisSinclairShiftedScaled") + FexpShiftedScaled(rhos(p), mexp, F, DF); + value += F * wpre; // * weight (wpre) + derivatives(p) = DF * wpre;// * weight (wpre) + } +} + +void ACEAbstractBasisSet::_clean() { + + delete[] elements_name; + elements_name = nullptr; + delete radial_functions; + radial_functions = nullptr; +} + +ACEAbstractBasisSet::ACEAbstractBasisSet(const ACEAbstractBasisSet &other) { + ACEAbstractBasisSet::_copy_scalar_memory(other); + ACEAbstractBasisSet::_copy_dynamic_memory(other); +} + +ACEAbstractBasisSet &ACEAbstractBasisSet::operator=(const ACEAbstractBasisSet &other) { + if (this != &other) { + // deallocate old memory + ACEAbstractBasisSet::_clean(); + //copy scalar values + ACEAbstractBasisSet::_copy_scalar_memory(other); + //copy dynamic memory + ACEAbstractBasisSet::_copy_dynamic_memory(other); + } + return *this; +} + +ACEAbstractBasisSet::~ACEAbstractBasisSet() { + ACEAbstractBasisSet::_clean(); +} + +void ACEAbstractBasisSet::_copy_scalar_memory(const ACEAbstractBasisSet &src) { + deltaSplineBins = src.deltaSplineBins; + FS_parameters = src.FS_parameters; + npoti = src.npoti; + + nelements = src.nelements; + rankmax = src.rankmax; + ndensitymax = src.ndensitymax; + nradbase = src.nradbase; + lmax = src.lmax; + nradmax = src.nradmax; + cutoffmax = src.cutoffmax; + + spherical_harmonics = src.spherical_harmonics; + + rho_core_cutoffs = src.rho_core_cutoffs; + drho_core_cutoffs = src.drho_core_cutoffs; + + + E0vals = src.E0vals; +} + +void ACEAbstractBasisSet::_copy_dynamic_memory(const ACEAbstractBasisSet &src) {//allocate new memory + if (src.elements_name == nullptr) + throw runtime_error("Could not copy ACEAbstractBasisSet::elements_name - array not initialized"); + elements_name = new string[nelements]; + //copy + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + elements_name[mu] = src.elements_name[mu]; + } + radial_functions = src.radial_functions->clone(); +} + +SPECIES_TYPE ACEAbstractBasisSet::get_species_index_by_name(const string &elemname) { + for (SPECIES_TYPE t = 0; t < nelements; t++) { + if (this->elements_name[t] == elemname) + return t; + } + return -1; +} \ No newline at end of file diff --git a/lib/pace/ace_abstract_basis.h b/lib/pace/ace_abstract_basis.h new file mode 100644 index 0000000000..165ea9496f --- /dev/null +++ b/lib/pace/ace_abstract_basis.h @@ -0,0 +1,169 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Lysogorskiy Yury on 28.04.2020. + +#ifndef ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H +#define ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H + +#include +#include + +#include "ace_c_basisfunction.h" +#include "ace_contigous_array.h" +#include "ace_radial.h" +#include "ace_spherical_cart.h" +#include "ace_types.h" + +using namespace std; + +/** + * Abstract basis set class + */ +class ACEAbstractBasisSet { +public: + SPECIES_TYPE nelements = 0; ///< number of elements in basis set + RANK_TYPE rankmax = 0; ///< maximum value of rank + DENSITY_TYPE ndensitymax = 0; ///< maximum number of densities \f$ \rho^{(p)} \f$ + NS_TYPE nradbase = 0; ///< maximum number of radial \f$\textbf{basis}\f$ function \f$ g_{k}(r) \f$ + LS_TYPE lmax = 0; ///< \f$ l_\textrm{max} \f$ - maximum value of orbital moment \f$ l \f$ + NS_TYPE nradmax = 0; ///< maximum number \f$ n \f$ of radial function \f$ R_{nl}(r) \f$ + DOUBLE_TYPE cutoffmax = 0; ///< maximum value of cutoff distance among all species in basis set + DOUBLE_TYPE deltaSplineBins = 0; ///< Spline interpolation density + + string npoti = "FinnisSinclair"; ///< FS and embedding function combination + + string *elements_name = nullptr; ///< Array of elements name for mapping from index (0..nelements-1) to element symbol (string) + + AbstractRadialBasis *radial_functions = nullptr; ///< object to work with radial functions + ACECartesianSphericalHarmonics spherical_harmonics; ///< object to work with spherical harmonics in Cartesian representation + + + Array1D rho_core_cutoffs; ///< energy-based inner cut-off + Array1D drho_core_cutoffs; ///< decay of energy-based inner cut-off + + vector FS_parameters; ///< parameters for cluster functional, see Eq.(3) in implementation notes or Eq.(53) in PRB 99, 014104 (2019) + + // E0 values + Array1D E0vals; + + /** + * Default empty constructor + */ + ACEAbstractBasisSet() = default; + + // copy constructor, operator= and destructor (see. Rule of Three) + + /** + * Copy constructor (see. Rule of Three) + * @param other + */ + ACEAbstractBasisSet(const ACEAbstractBasisSet &other); + + /** + * operator= (see. Rule of Three) + * @param other + * @return + */ + ACEAbstractBasisSet &operator=(const ACEAbstractBasisSet &other); + + /** + * virtual destructor (see. Rule of Three) + */ + virtual ~ACEAbstractBasisSet(); + + /** + * Computing cluster functional \f$ F(\rho_i^{(1)}, \dots, \rho_i^{(P)}) \f$ + * and its derivatives \f$ (\partial F/\partial\rho_i^{(1)}, \dots, \partial F/\partial \rho_i^{(P)} ) \f$ + * @param rhos array with densities \f$ \rho^{(p)} \f$ + * @param value (out) return value of cluster functional + * @param derivatives (out) array of derivatives \f$ (\partial F/\partial\rho_i^{(1)}, \dots, \partial F/\partial \rho_i^{(P)} ) \f$ + * @param ndensity number \f$ P \f$ of densities to use + */ + void FS_values_and_derivatives(Array1D &rhos, DOUBLE_TYPE &value, Array1D &derivatives, + DENSITY_TYPE ndensity); + + /** + * Computing hard core pairwise repulsive potential \f$ f_{cut}(\rho_i^{(\textrm{core})})\f$ and its derivative, + * see Eq.(29) of implementation notes + * @param rho_core value of \f$ \rho_i^{(\textrm{core})} \f$ + * @param rho_cut \f$ \rho_{cut}^{\mu_i} \f$ value + * @param drho_cut \f$ \Delta_{cut}^{\mu_i} \f$ value + * @param fcut (out) return inner cutoff function + * @param dfcut (out) return derivative of inner cutoff function + */ + static void inner_cutoff(DOUBLE_TYPE rho_core, DOUBLE_TYPE rho_cut, DOUBLE_TYPE drho_cut, DOUBLE_TYPE &fcut, + DOUBLE_TYPE &dfcut); + + + /** + * Virtual method to save potential to file + * @param filename file name + */ + virtual void save(const string &filename) = 0; + + /** + * Virtual method to load potential from file + * @param filename file name + */ + virtual void load(const string filename) = 0; + + /** + * Get the species index by its element name + * @param elemname element name + * @return species index + */ + SPECIES_TYPE get_species_index_by_name(const string &elemname); + + + // routines for copying and cleaning dynamic memory of the class (see. Rule of Three) + + /** + * Routine for clean the dynamically allocated memory\n + * IMPORTANT! It must be idempotent for safety. + */ + virtual void _clean(); + + /** + * Copy dynamic memory from src. Must be override and extended in derived classes! + * @param src source object to copy from + */ + virtual void _copy_dynamic_memory(const ACEAbstractBasisSet &src); + + /** + * Copy scalar values from src. Must be override and extended in derived classes! + * @param src source object to copy from + */ + virtual void _copy_scalar_memory(const ACEAbstractBasisSet &src); +}; + +void Fexp(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF); + +void FexpShiftedScaled(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF); + +#endif //ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H diff --git a/lib/pace/ace_array2dlm.h b/lib/pace/ace_array2dlm.h new file mode 100644 index 0000000000..2b38602bc7 --- /dev/null +++ b/lib/pace/ace_array2dlm.h @@ -0,0 +1,579 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Yury Lysogorskiy on 11.01.20. + + +#ifndef ACE_ARRAY2DLM_H +#define ACE_ARRAY2DLM_H + +#include +#include + +#include "ace_arraynd.h" +#include "ace_contigous_array.h" +#include "ace_types.h" + +using namespace std; + +/** + * Contiguous array to organize values by \f$ (l,m) \f$ indiced (orbital moment and its projection). + * Only \f$ l_\textrm{max}\f$ should be provided, \f$ m = -l, \dots,l \f$ + * for \f$ l = 0, \dots, l_\textrm{max}\f$ + * @tparam T type of values to store + */ +template +class Array2DLM : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + + LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ + + bool is_proxy = false; ///< flag to show, if object is owning the memory or just represent it (proxying)dimensions + +public: + /** + * Default empty constructor + */ + Array2DLM() = default; + + /** + * Parametrized constructor + * @param lmax maximum value of \f$ l \f$ + * @param array_name name of the array + */ + explicit Array2DLM(LS_TYPE lmax, string array_name = "Array2DLM") { + init(lmax, array_name); + } + + + /** + * Constructor to create slices-proxy array, i.e. to provide access to the memory, but not to own it. + * @param lmax maximum value of \f$ l \f$ + * @param data_ptr pointer to original data + * @param array_name name of the array + */ + Array2DLM(LS_TYPE lmax, T *data_ptr, string array_name = "Array2DLM") { + this->lmax = lmax; + this->size = (lmax + 1) * (lmax + 1); + this->data = data_ptr; + this->array_name = array_name; + is_proxy = true; + }; + + /** + * Destructor + */ + ~Array2DLM() { + if (!is_proxy) { + if (data != nullptr) delete[] data; + } + data = nullptr; + } + + /** + * Initialize array, allocate memory + * @param lmax maximum value of l + * @param array_name name of the array + */ + void init(LS_TYPE lmax, string array_name = "Array2DLM") { + if (is_proxy) { + char s[1024]; + sprintf(s, "Could not re-initialize proxy-array %s\n", this->array_name.c_str()); + throw logic_error(s); + } + this->lmax = lmax; + this->array_name = array_name; + //for m = -l .. l + if (size != (lmax + 1) * (lmax + 1)) { + size = (lmax + 1) * (lmax + 1); + if (data) delete[] data; + data = new T[size]{}; + memset(data, 0.0, size * sizeof(T)); + } else { + memset(data, 0, size * sizeof(T)); + } + } + +#ifdef MULTIARRAY_INDICES_CHECK +/** + * Check if indices (l,m) are within array + */ + void check_indices(LS_TYPE l, MS_TYPE m) const { + + if ((l < 0) | (l > lmax)) { + fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); + exit(EXIT_FAILURE); + } + + if ((m < -l) | (m > l)) { + fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); + exit(EXIT_FAILURE); + } + size_t ii = l * (l + 1) + m; + if (ii >= size) { + fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); + exit(EXIT_FAILURE); + } + } +#endif + + /** + * Accessing the array value by index (l,m) for reading + * @param l + * @param m + * @return array value + */ + inline const T &operator()(LS_TYPE l, MS_TYPE m) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(l, m); +#endif + //l^2 + l + m + return data[l * (l + 1) + m]; + } + + /** + * Accessing the array value by index (l,m) for writing + * @param l + * @param m + * @return array value + */ + inline T &operator()(LS_TYPE l, MS_TYPE m) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(l, m); +#endif + //l^2 + l + m + return data[l * (l + 1) + m]; + } + + /** + * Convert array to STL vector> container + * @return vector> container + */ + vector> to_vector() const { + vector> res; + res.resize(lmax + 1); + + for (int i = 0; i < lmax + 1; i++) { + res[i].resize(i + 1); + for (int j = 0; j < i + 1; j++) { + res[i][j] = operator()(i, j); + } + } + return res; + } +}; + +/** + * Contiguous array to organize values by \f$ (i_0, l , m) \f$ indices. + * Only \f$ d_{0}, l_\textrm{max}\f$ should be provided: \f$ m = -l, \dots,l \f$ + * for \f$ l = 0, \dots, l_\textrm{max}\f$ + * @tparam T type of values to store + */ +template +class Array3DLM : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + + LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ + + + size_t dim[1] = {0}; ///< linear dimension \f$ d_{0} \f$ + + size_t s[1] = {0}; ///< strides for linear dimensions + + Array1D *> _proxy_slices; ///< slices representation +public: + /** + * Default empty constructor + */ + Array3DLM() = default; + + /** + * Parametrized constructor + * @param array_name name of the array + */ + Array3DLM(string array_name) { + this->array_name = array_name; + }; + + /** + * Parametrized constructor + * @param d0 maximum value of \f$ i_0 \f$ + * @param lmax maximum value of \f$ l \f$ + * @param array_name name of the array + */ + explicit Array3DLM(size_t d0, LS_TYPE lmax, string array_name = "Array3DLM") { + init(d0, lmax, array_name); + } + + /** + * Initialize array and its slices + * @param d0 maximum value of \f$ i_0 \f$ + * @param lmax maximum value of \f$ l \f$ + * @param array_name name of the array + */ + void init(size_t d0, LS_TYPE lmax, string array_name = "Array3DLM") { + this->array_name = array_name; + this->lmax = lmax; + dim[0] = d0; + s[0] = lmax * lmax; + if (size != s[0] * dim[0]) { + size = s[0] * dim[0]; + if (data) delete[] data; + data = new T[size]{}; + memset(data, 0, size * sizeof(T)); + } else { + memset(data, 0, size * sizeof(T)); + } + + _proxy_slices.set_array_name(array_name + "_proxy"); + //arrange proxy-slices + _clear_proxies(); + _proxy_slices.resize(dim[0]); + for (size_t i0 = 0; i0 < dim[0]; ++i0) { + _proxy_slices(i0) = new Array2DLM(this->lmax, &this->data[i0 * s[0]], + array_name + "_slice"); + } + } + + /** + * Release pointers to slices + */ + void _clear_proxies() { + for (size_t i0 = 0; i0 < _proxy_slices.get_dim(0); ++i0) { + delete _proxy_slices(i0); + _proxy_slices(i0) = nullptr; + } + } + + /** + * Destructor, clear proxies + */ + ~Array3DLM() { + _clear_proxies(); + } + + /** + * Resize array to new dimensions + * @param d0 + * @param lmax + */ + void resize(size_t d0, LS_TYPE lmax) { + _clear_proxies(); + init(d0, lmax, this->array_name); + } + + /** + * Get array dimensions + * @param d dimension index + * @return dimension along axis 'd' + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + /** + * Check if indices (i0, l,m) are within array + */ + void check_indices(size_t i0, LS_TYPE l, MS_TYPE m) const { + if ((l < 0) | (l > lmax)) { + fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); + exit(EXIT_FAILURE); + } + + if ((m < -l) | (m > l)) { + fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); + exit(EXIT_FAILURE); + } + + if ((i0 < 0) | (i0 >= dim[0])) { + fprintf(stderr, "%s: index i0 = %ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + exit(EXIT_FAILURE); + } + + size_t ii = i0 * s[0] + l * (l + 1) + m; + if (ii >= size) { + fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); + exit(EXIT_FAILURE); + } + } +#endif + + /** + * Accessing the array value by index (i0,l,m) for reading + * @param i0 + * @param l + * @param m + * @return array value + */ + inline const T &operator()(size_t i0, LS_TYPE l, MS_TYPE m) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, l, m); +#endif + return data[i0 * s[0] + l * (l + 1) + m]; + } + + /** + * Accessing the array value by index (i0,l,m) for writing + * @param i0 + * @param l + * @param m + * @return array value + */ + inline T &operator()(size_t i0, LS_TYPE l, MS_TYPE m) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, l, m); +#endif + return data[i0 * s[0] + l * (l + 1) + m]; + } + + /** + * Return proxy Array2DLM pointing to i0, l=0, m=0 to read + * @param i0 + * @return proxy Array2DLM pointing to i0, l=0, m=0 + */ + inline const Array2DLM &operator()(size_t i0) const { + return *_proxy_slices(i0); + } + + /** + * Return proxy Array2DLM pointing to i0, l=0, m=0 to write + * @param i0 + * @return proxy Array2DLM pointing to i0, l=0, m=0 + */ + inline Array2DLM &operator()(size_t i0) { + return *_proxy_slices(i0); + } +}; + + +/** + * Contiguous array to organize values by \f$ (i_0, i_1, l , m) \f$ indices. + * Only \f$ d_{0}, d_{1}, l_\textrm{max}\f$ should be provided: \f$ m = -l, \dots,l \f$ + * for \f$ l = 0, \dots, l_\textrm{max}\f$ + * @tparam T type of values to store + */ +template +class Array4DLM : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + + LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ + size_t dim[2] = {0, 0}; ///< linear dimension \f$ d_{0}, d_{1} \f$ + size_t s[2] = {0, 0}; ///< strides for linear dimensions + + Array2D *> _proxy_slices; ///< slices representation +public: + /** + * Default empty constructor + */ + Array4DLM() = default; + + /** + * Parametrized constructor + * @param array_name name of the array + */ + Array4DLM(string array_name) { + this->array_name = array_name; + }; + + /** + * Parametrized constructor + * @param d0 maximum value of \f$ i_0 \f$ + * @param d1 maximum value of \f$ i_1 \f$ + * @param lmax maximum value of \f$ l \f$ + * @param array_name name of the array + */ + explicit Array4DLM(size_t d0, size_t d1, LS_TYPE lmax, string array_name = "Array4DLM") { + init(d0, d1, lmax, array_name); + } + + /** + * Initialize array, reallocate memory and its slices + * @param d0 maximum value of \f$ i_0 \f$ + * @param d1 maximum value of \f$ i_1 \f$ + * @param lmax maximum value of \f$ l \f$ + * @param array_name name of the array + */ + void init(size_t d0, size_t d1, LS_TYPE lmax, string array_name = "Array4DLM") { + this->array_name = array_name; + this->lmax = lmax; + dim[1] = d1; + dim[0] = d0; + s[1] = lmax * lmax; + s[0] = s[1] * dim[1]; + if (size != s[0] * dim[0]) { + size = s[0] * dim[0]; + if (data) delete[] data; + data = new T[size]{}; + memset(data, 0, size * sizeof(T)); + } else { + memset(data, 0, size * sizeof(T)); + } + + _proxy_slices.set_array_name(array_name + "_proxy"); + //release old memory if there is any + _clear_proxies(); + //arrange proxy-slices + _proxy_slices.resize(dim[0], dim[1]); + for (size_t i0 = 0; i0 < dim[0]; ++i0) + for (size_t i1 = 0; i1 < dim[1]; ++i1) { + _proxy_slices(i0, i1) = new Array2DLM(this->lmax, &this->data[i0 * s[0] + i1 * s[1]], + array_name + "_slice"); + } + } + + /** + * Release pointers to slices + */ + void _clear_proxies() { + + for (size_t i0 = 0; i0 < _proxy_slices.get_dim(0); ++i0) + for (size_t i1 = 0; i1 < _proxy_slices.get_dim(1); ++i1) { + delete _proxy_slices(i0, i1); + _proxy_slices(i0, i1) = nullptr; + } + } + + /** + * Destructor, clear proxies + */ + ~Array4DLM() { + _clear_proxies(); + } + + /** + * Deallocate memory, reallocate with the new dimensions + * @param d0 + * @param lmax + */ + void resize(size_t d0, size_t d1, LS_TYPE lmax) { + _clear_proxies(); + init(d0, d1, lmax, this->array_name); + } + + /** + * Get array dimensions + * @param d dimension index + * @return dimension along axis 'd' + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + /** + * Check if indices (i0, l,m) are within array + */ + void check_indices(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) const { + if ((l < 0) | (l > lmax)) { + fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); + exit(EXIT_FAILURE); + } + + if ((m < -l) | (m > l)) { + fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); + exit(EXIT_FAILURE); + } + + if ((i0 < 0) | (i0 >= dim[0])) { + fprintf(stderr, "%s: index i0 = %ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + exit(EXIT_FAILURE); + } + + + if ((i1 < 0) | (i1 >= dim[1])) { + fprintf(stderr, "%s: index i1 = %ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + exit(EXIT_FAILURE); + } + + size_t ii = i0 * s[0] + i1 * s[1] + l * (l + 1) + m; + if (ii >= size) { + fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); + exit(EXIT_FAILURE); + } + } +#endif + + /** + * Accessing the array value by index (i0,l,m) for reading + * @param i0 + * @param i1 + * @param l + * @param m + * @return array value + */ + inline const T &operator()(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, l, m); +#endif + return data[i0 * s[0] + i1 * s[1] + l * (l + 1) + m]; + } + + /** + * Accessing the array value by index (i0,l,m) for writing + * @param i0 + * @param i1 + * @param l + * @param m + * @return array value + */ + inline T &operator()(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, l, m); +#endif + return data[i0 * s[0] + i1 * s[1] + l * (l + 1) + m]; + } + + /** + * Return proxy Array2DLM pointing to i0, i1, l=0, m=0 to read + * @param i0 + * @param i1 + * @return proxy Array2DLM pointing to i0, l=0, m=0 + */ + inline const Array2DLM &operator()(size_t i0, size_t i1) const { + return *_proxy_slices(i0, i1); + } + + /** + * Return proxy Array2DLM pointing to i0, i1, l=0, m=0 to write + * @param i0 + * @param i1 + * @return proxy Array2DLM pointing to i0, l=0, m=0 + */ + inline Array2DLM &operator()(size_t i0, size_t i1) { + return *_proxy_slices(i0, i1); + } +}; + +#endif //ACE_ARRAY2DLM_H \ No newline at end of file diff --git a/lib/pace/ace_arraynd.h b/lib/pace/ace_arraynd.h new file mode 100644 index 0000000000..1044b5654e --- /dev/null +++ b/lib/pace/ace_arraynd.h @@ -0,0 +1,1949 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +//automatically generate source code + +#ifndef ACE_MULTIARRAY_H +#define ACE_MULTIARRAY_H + +#include +#include +#include + +#include "ace_contigous_array.h" + +using namespace std; + + +/** + * Multidimensional (1 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array1D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[1] = {0}; ///< dimensions + size_t s[1] = {0}; ///< strides + int ndim = 1; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array1D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array1D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array1D(size_t d0, const string &array_name = "Array1D", T *new_data = nullptr) { + init(d0, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0) { + + dim[0] = d0; + + s[0] = 1; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, const string &array_name = "Array1D", T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0) { + init(d0, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0) { + //check data size consistency + size_t new_size = d0; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0); +#endif + + return data[i0]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0); +#endif + + return data[i0]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array1D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector to_vector() const { + vector res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0] = operator()(i0); + + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector &vec) { + size_t d0 = 0; + d0 = vec.size(); + + + init(d0, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + operator()(i0) = vec.at(i0); + + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array1D(const vector &vec, const string &array_name = "Array1D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array1D &operator=(const vector &vec) { + this->set_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +/** + * Multidimensional (2 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array2D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[2] = {0}; ///< dimensions + size_t s[2] = {0}; ///< strides + int ndim = 2; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array2D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array2D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array2D(size_t d0, size_t d1, const string &array_name = "Array2D", T *new_data = nullptr) { + init(d0, d1, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0, size_t d1) { + + dim[0] = d0; + dim[1] = d1; + + s[1] = 1; + s[0] = s[1] * dim[1]; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, size_t d1, const string &array_name = "Array2D", T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0, d1); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0, size_t d1) { + init(d0, d1, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0, size_t d1) { + //check data size consistency + size_t new_size = d0 * d1; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0, d1); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0, size_t i1) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + if ((i1 < 0) | (i1 >= dim[1])) { + char buf[1024]; + sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0, size_t i1) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1); +#endif + + return data[i0 * s[0] + i1]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0, size_t i1) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1); +#endif + + return data[i0 * s[0] + i1]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array2D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector> to_vector() const { + vector> res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0].resize(dim[1]); + + + for (int i1 = 0; i1 < dim[1]; i1++) { + res[i0][i1] = operator()(i0, i1); + + } + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector> &vec) { + size_t d0 = 0; + size_t d1 = 0; + d0 = vec.size(); + + if (d0 > 0) { + d1 = vec.at(0).size(); + + + } + + init(d0, d1, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + if (vec.at(i0).size() != d1) + throw std::invalid_argument("Vector size is not constant at dimension 1"); + + for (int i1 = 0; i1 < dim[1]; i1++) { + operator()(i0, i1) = vec.at(i0).at(i1); + + } + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array2D(const vector> &vec, const string &array_name = "Array2D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array2D &operator=(const vector> &vec) { + this->set_vector(vec); + return *this; + } + + + /** + * operator= to flatten vector container + * @param vec container + */ + Array2D &operator=(const vector &vec) { + this->set_flatten_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +/** + * Multidimensional (3 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array3D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[3] = {0}; ///< dimensions + size_t s[3] = {0}; ///< strides + int ndim = 3; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array3D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array3D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array3D(size_t d0, size_t d1, size_t d2, const string &array_name = "Array3D", T *new_data = nullptr) { + init(d0, d1, d2, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0, size_t d1, size_t d2) { + + dim[0] = d0; + dim[1] = d1; + dim[2] = d2; + + s[2] = 1; + s[1] = s[2] * dim[2]; + s[0] = s[1] * dim[1]; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, size_t d1, size_t d2, const string &array_name = "Array3D", T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0, d1, d2); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0, size_t d1, size_t d2) { + init(d0, d1, d2, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0, size_t d1, size_t d2) { + //check data size consistency + size_t new_size = d0 * d1 * d2; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0, d1, d2); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0, size_t i1, size_t i2) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + if ((i1 < 0) | (i1 >= dim[1])) { + char buf[1024]; + sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + throw std::out_of_range(buf); + } + + if ((i2 < 0) | (i2 >= dim[2])) { + char buf[1024]; + sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0, size_t i1, size_t i2) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0, size_t i1, size_t i2) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array3D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector>> to_vector() const { + vector>> res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0].resize(dim[1]); + + + for (int i1 = 0; i1 < dim[1]; i1++) { + res[i0][i1].resize(dim[2]); + + + for (int i2 = 0; i2 < dim[2]; i2++) { + res[i0][i1][i2] = operator()(i0, i1, i2); + + } + } + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector>> &vec) { + size_t d0 = 0; + size_t d1 = 0; + size_t d2 = 0; + d0 = vec.size(); + + if (d0 > 0) { + d1 = vec.at(0).size(); + if (d1 > 0) { + d2 = vec.at(0).at(0).size(); + + + } + } + + init(d0, d1, d2, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + if (vec.at(i0).size() != d1) + throw std::invalid_argument("Vector size is not constant at dimension 1"); + + for (int i1 = 0; i1 < dim[1]; i1++) { + if (vec.at(i0).at(i1).size() != d2) + throw std::invalid_argument("Vector size is not constant at dimension 2"); + + for (int i2 = 0; i2 < dim[2]; i2++) { + operator()(i0, i1, i2) = vec.at(i0).at(i1).at(i2); + + } + } + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array3D(const vector>> &vec, const string &array_name = "Array3D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array3D &operator=(const vector>> &vec) { + this->set_vector(vec); + return *this; + } + + + /** + * operator= to flatten vector container + * @param vec container + */ + Array3D &operator=(const vector &vec) { + this->set_flatten_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +/** + * Multidimensional (4 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array4D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[4] = {0}; ///< dimensions + size_t s[4] = {0}; ///< strides + int ndim = 4; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array4D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array4D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array4D(size_t d0, size_t d1, size_t d2, size_t d3, const string &array_name = "Array4D", T *new_data = nullptr) { + init(d0, d1, d2, d3, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3) { + + dim[0] = d0; + dim[1] = d1; + dim[2] = d2; + dim[3] = d3; + + s[3] = 1; + s[2] = s[3] * dim[3]; + s[1] = s[2] * dim[2]; + s[0] = s[1] * dim[1]; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, size_t d1, size_t d2, size_t d3, const string &array_name = "Array4D", T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0, d1, d2, d3); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0, size_t d1, size_t d2, size_t d3) { + init(d0, d1, d2, d3, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0, size_t d1, size_t d2, size_t d3) { + //check data size consistency + size_t new_size = d0 * d1 * d2 * d3; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0, d1, d2, d3); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0, size_t i1, size_t i2, size_t i3) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + if ((i1 < 0) | (i1 >= dim[1])) { + char buf[1024]; + sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + throw std::out_of_range(buf); + } + + if ((i2 < 0) | (i2 >= dim[2])) { + char buf[1024]; + sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); + throw std::out_of_range(buf); + } + + if ((i3 < 0) | (i3 >= dim[3])) { + char buf[1024]; + sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array4D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector>>> to_vector() const { + vector>>> res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0].resize(dim[1]); + + + for (int i1 = 0; i1 < dim[1]; i1++) { + res[i0][i1].resize(dim[2]); + + + for (int i2 = 0; i2 < dim[2]; i2++) { + res[i0][i1][i2].resize(dim[3]); + + + for (int i3 = 0; i3 < dim[3]; i3++) { + res[i0][i1][i2][i3] = operator()(i0, i1, i2, i3); + + } + } + } + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector>>> &vec) { + size_t d0 = 0; + size_t d1 = 0; + size_t d2 = 0; + size_t d3 = 0; + d0 = vec.size(); + + if (d0 > 0) { + d1 = vec.at(0).size(); + if (d1 > 0) { + d2 = vec.at(0).at(0).size(); + if (d2 > 0) { + d3 = vec.at(0).at(0).at(0).size(); + + + } + } + } + + init(d0, d1, d2, d3, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + if (vec.at(i0).size() != d1) + throw std::invalid_argument("Vector size is not constant at dimension 1"); + + for (int i1 = 0; i1 < dim[1]; i1++) { + if (vec.at(i0).at(i1).size() != d2) + throw std::invalid_argument("Vector size is not constant at dimension 2"); + + for (int i2 = 0; i2 < dim[2]; i2++) { + if (vec.at(i0).at(i1).at(i2).size() != d3) + throw std::invalid_argument("Vector size is not constant at dimension 3"); + + for (int i3 = 0; i3 < dim[3]; i3++) { + operator()(i0, i1, i2, i3) = vec.at(i0).at(i1).at(i2).at(i3); + + } + } + } + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array4D(const vector>>> &vec, const string &array_name = "Array4D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array4D &operator=(const vector>>> &vec) { + this->set_vector(vec); + return *this; + } + + + /** + * operator= to flatten vector container + * @param vec container + */ + Array4D &operator=(const vector &vec) { + this->set_flatten_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +/** + * Multidimensional (5 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array5D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[5] = {0}; ///< dimensions + size_t s[5] = {0}; ///< strides + int ndim = 5; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array5D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array5D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array5D(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, const string &array_name = "Array5D", + T *new_data = nullptr) { + init(d0, d1, d2, d3, d4, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { + + dim[0] = d0; + dim[1] = d1; + dim[2] = d2; + dim[3] = d3; + dim[4] = d4; + + s[4] = 1; + s[3] = s[4] * dim[4]; + s[2] = s[3] * dim[3]; + s[1] = s[2] * dim[2]; + s[0] = s[1] * dim[1]; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, const string &array_name = "Array5D", + T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0, d1, d2, d3, d4); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { + init(d0, d1, d2, d3, d4, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { + //check data size consistency + size_t new_size = d0 * d1 * d2 * d3 * d4; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0, d1, d2, d3, d4); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + if ((i1 < 0) | (i1 >= dim[1])) { + char buf[1024]; + sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + throw std::out_of_range(buf); + } + + if ((i2 < 0) | (i2 >= dim[2])) { + char buf[1024]; + sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); + throw std::out_of_range(buf); + } + + if ((i3 < 0) | (i3 >= dim[3])) { + char buf[1024]; + sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); + throw std::out_of_range(buf); + } + + if ((i4 < 0) | (i4 >= dim[4])) { + char buf[1024]; + sprintf(buf, "%s: index i4=%ld out of range (0, %ld)\n", array_name.c_str(), i4, dim[4] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3, i4); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3, i4); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array5D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector>>>> to_vector() const { + vector>>>> res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0].resize(dim[1]); + + + for (int i1 = 0; i1 < dim[1]; i1++) { + res[i0][i1].resize(dim[2]); + + + for (int i2 = 0; i2 < dim[2]; i2++) { + res[i0][i1][i2].resize(dim[3]); + + + for (int i3 = 0; i3 < dim[3]; i3++) { + res[i0][i1][i2][i3].resize(dim[4]); + + + for (int i4 = 0; i4 < dim[4]; i4++) { + res[i0][i1][i2][i3][i4] = operator()(i0, i1, i2, i3, i4); + + } + } + } + } + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector>>>> &vec) { + size_t d0 = 0; + size_t d1 = 0; + size_t d2 = 0; + size_t d3 = 0; + size_t d4 = 0; + d0 = vec.size(); + + if (d0 > 0) { + d1 = vec.at(0).size(); + if (d1 > 0) { + d2 = vec.at(0).at(0).size(); + if (d2 > 0) { + d3 = vec.at(0).at(0).at(0).size(); + if (d3 > 0) { + d4 = vec.at(0).at(0).at(0).at(0).size(); + + + } + } + } + } + + init(d0, d1, d2, d3, d4, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + if (vec.at(i0).size() != d1) + throw std::invalid_argument("Vector size is not constant at dimension 1"); + + for (int i1 = 0; i1 < dim[1]; i1++) { + if (vec.at(i0).at(i1).size() != d2) + throw std::invalid_argument("Vector size is not constant at dimension 2"); + + for (int i2 = 0; i2 < dim[2]; i2++) { + if (vec.at(i0).at(i1).at(i2).size() != d3) + throw std::invalid_argument("Vector size is not constant at dimension 3"); + + for (int i3 = 0; i3 < dim[3]; i3++) { + if (vec.at(i0).at(i1).at(i2).at(i3).size() != d4) + throw std::invalid_argument("Vector size is not constant at dimension 4"); + + for (int i4 = 0; i4 < dim[4]; i4++) { + operator()(i0, i1, i2, i3, i4) = vec.at(i0).at(i1).at(i2).at(i3).at(i4); + + } + } + } + } + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array5D(const vector>>>> &vec, const string &array_name = "Array5D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array5D &operator=(const vector>>>> &vec) { + this->set_vector(vec); + return *this; + } + + + /** + * operator= to flatten vector container + * @param vec container + */ + Array5D &operator=(const vector &vec) { + this->set_flatten_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +/** + * Multidimensional (6 - dimensional) array of type T with contiguous memory layout. + * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @tparam T data type + */ +template +class Array6D : public ContiguousArrayND { + using ContiguousArrayND::array_name; + using ContiguousArrayND::data; + using ContiguousArrayND::size; + using ContiguousArrayND::is_proxy_; + + size_t dim[6] = {0}; ///< dimensions + size_t s[6] = {0}; ///< strides + int ndim = 6; ///< number of dimensions +public: + + /** + * Default empty constructor + */ + Array6D() = default; + + /** + * Parametrized constructor with array name + * @param array_name name of array (for error logging) + */ + Array6D(const string &array_name) { this->array_name = array_name; } + + /** + * Parametrized constructor + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + Array6D(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5, const string &array_name = "Array6D", + T *new_data = nullptr) { + init(d0, d1, d2, d3, d4, d5, array_name, new_data); + } + + /** + * Setup the dimensions and strides of array + * @param d0,... array sizes for different dimensions + */ + void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { + + dim[0] = d0; + dim[1] = d1; + dim[2] = d2; + dim[3] = d3; + dim[4] = d4; + dim[5] = d5; + + s[5] = 1; + s[4] = s[5] * dim[5]; + s[3] = s[4] * dim[4]; + s[2] = s[3] * dim[3]; + s[1] = s[2] * dim[2]; + s[0] = s[1] * dim[1]; + + size = s[0] * dim[0]; + }; + + /** + * Initialize array storage, dimensions and strides + * @param d0,... array sizes for different dimensions + * @param array_name string name of the array + */ + void init(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5, const string &array_name = "Array6D", + T *new_data = nullptr) { + this->array_name = array_name; + + size_t old_size = size; + set_dimensions(d0, d1, d2, d3, d4, d5); + + bool new_is_proxy = (new_data != nullptr); + + if (new_is_proxy) { + if (!is_proxy_) delete[] data; + data = new_data; + } else { + if (size != old_size) { + T *old_data = data; //preserve the pointer to the old data + data = new T[size]; // allocate new data + if (old_data != nullptr) { // + size_t min_size = old_size < size ? old_size : size; + memcpy(data, old_data, min_size * sizeof(T)); + if (!is_proxy_) delete[] old_data; + } + //memset(data, 0, size * sizeof(T)); + } else { + //memset(data, 0, size * sizeof(T)); + } + } + + is_proxy_ = new_is_proxy; + } + + /** + * Resize array + * @param d0,... array sizes for different dimensions + */ + void resize(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { + init(d0, d1, d2, d3, d4, d5, this->array_name); + } + + /** + * Reshape array without reset the data + * @param d0,... array sizes for different dimensions + */ + void reshape(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { + //check data size consistency + size_t new_size = d0 * d1 * d2 * d3 * d4 * d5; + if (new_size != size) + throw invalid_argument("Couldn't reshape array when the size is not conserved"); + set_dimensions(d0, d1, d2, d3, d4, d5); + } + + /** + * Get array size in dimension "d" + * @param d dimension index + */ + size_t get_dim(int d) const { + return dim[d]; + } + +#ifdef MULTIARRAY_INDICES_CHECK + + /** + * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + void check_indices(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const { + + if ((i0 < 0) | (i0 >= dim[0])) { + char buf[1024]; + sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); + throw std::out_of_range(buf); + } + + if ((i1 < 0) | (i1 >= dim[1])) { + char buf[1024]; + sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); + throw std::out_of_range(buf); + } + + if ((i2 < 0) | (i2 >= dim[2])) { + char buf[1024]; + sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); + throw std::out_of_range(buf); + } + + if ((i3 < 0) | (i3 >= dim[3])) { + char buf[1024]; + sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); + throw std::out_of_range(buf); + } + + if ((i4 < 0) | (i4 >= dim[4])) { + char buf[1024]; + sprintf(buf, "%s: index i4=%ld out of range (0, %ld)\n", array_name.c_str(), i4, dim[4] - 1); + throw std::out_of_range(buf); + } + + if ((i5 < 0) | (i5 >= dim[5])) { + char buf[1024]; + sprintf(buf, "%s: index i5=%ld out of range (0, %ld)\n", array_name.c_str(), i5, dim[5] - 1); + throw std::out_of_range(buf); + } + + } + +#endif + + /** + * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3, i4, i5); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4 * s[4] + i5]; + + } + + /** + * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will + * be performed before accessing memory. By default this is turned off. + * @param i0,... indices + */ + inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) { +#ifdef MULTIARRAY_INDICES_CHECK + check_indices(i0, i1, i2, i3, i4, i5); +#endif + + return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4 * s[4] + i5]; + + } + + /** + * Array comparison operator + * @param other + */ + bool operator==(const Array6D &other) const { + //compare dimensions + for (int d = 0; d < ndim; d++) { + if (this->dim[d] != other.dim[d]) + return false; + } + return ContiguousArrayND::operator==(other); + } + + /** + * Convert to nested vector> container + * @return vector container + */ + vector>>>>> to_vector() const { + vector>>>>> res; + + res.resize(dim[0]); + + for (int i0 = 0; i0 < dim[0]; i0++) { + res[i0].resize(dim[1]); + + + for (int i1 = 0; i1 < dim[1]; i1++) { + res[i0][i1].resize(dim[2]); + + + for (int i2 = 0; i2 < dim[2]; i2++) { + res[i0][i1][i2].resize(dim[3]); + + + for (int i3 = 0; i3 < dim[3]; i3++) { + res[i0][i1][i2][i3].resize(dim[4]); + + + for (int i4 = 0; i4 < dim[4]; i4++) { + res[i0][i1][i2][i3][i4].resize(dim[5]); + + + for (int i5 = 0; i5 < dim[5]; i5++) { + res[i0][i1][i2][i3][i4][i5] = operator()(i0, i1, i2, i3, i4, i5); + + } + } + } + } + } + } + + + return res; + } // end to_vector() + + + /** + * Set values to vector> container + * @param vec container + */ + void set_vector(const vector>>>>> &vec) { + size_t d0 = 0; + size_t d1 = 0; + size_t d2 = 0; + size_t d3 = 0; + size_t d4 = 0; + size_t d5 = 0; + d0 = vec.size(); + + if (d0 > 0) { + d1 = vec.at(0).size(); + if (d1 > 0) { + d2 = vec.at(0).at(0).size(); + if (d2 > 0) { + d3 = vec.at(0).at(0).at(0).size(); + if (d3 > 0) { + d4 = vec.at(0).at(0).at(0).at(0).size(); + if (d4 > 0) { + d5 = vec.at(0).at(0).at(0).at(0).at(0).size(); + + + } + } + } + } + } + + init(d0, d1, d2, d3, d4, d5, array_name); + for (int i0 = 0; i0 < dim[0]; i0++) { + if (vec.at(i0).size() != d1) + throw std::invalid_argument("Vector size is not constant at dimension 1"); + + for (int i1 = 0; i1 < dim[1]; i1++) { + if (vec.at(i0).at(i1).size() != d2) + throw std::invalid_argument("Vector size is not constant at dimension 2"); + + for (int i2 = 0; i2 < dim[2]; i2++) { + if (vec.at(i0).at(i1).at(i2).size() != d3) + throw std::invalid_argument("Vector size is not constant at dimension 3"); + + for (int i3 = 0; i3 < dim[3]; i3++) { + if (vec.at(i0).at(i1).at(i2).at(i3).size() != d4) + throw std::invalid_argument("Vector size is not constant at dimension 4"); + + for (int i4 = 0; i4 < dim[4]; i4++) { + if (vec.at(i0).at(i1).at(i2).at(i3).at(i4).size() != d5) + throw std::invalid_argument("Vector size is not constant at dimension 5"); + + for (int i5 = 0; i5 < dim[5]; i5++) { + operator()(i0, i1, i2, i3, i4, i5) = vec.at(i0).at(i1).at(i2).at(i3).at(i4).at(i5); + + } + } + } + } + } + } + + } + + /** + * Parametrized constructor from vector> container + * @param vec container + * @param array_name array name + */ + Array6D(const vector>>>>> &vec, const string &array_name = "Array6D") { + this->set_vector(vec); + this->array_name = array_name; + } + + /** + * operator= to vector> container + * @param vec container + */ + Array6D &operator=(const vector>>>>> &vec) { + this->set_vector(vec); + return *this; + } + + + /** + * operator= to flatten vector container + * @param vec container + */ + Array6D &operator=(const vector &vec) { + this->set_flatten_vector(vec); + return *this; + } + + + vector get_shape() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = dim[d]; + return sh; + } + + vector get_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d]; + return sh; + } + + vector get_memory_strides() const { + vector sh(ndim); + for (int d = 0; d < ndim; d++) + sh[d] = s[d] * sizeof(T); + return sh; + } +}; + + +#endif //ACE_MULTIARRAY_H diff --git a/lib/pace/ace_c_basis.cpp b/lib/pace/ace_c_basis.cpp new file mode 100644 index 0000000000..d1c55700b7 --- /dev/null +++ b/lib/pace/ace_c_basis.cpp @@ -0,0 +1,980 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 1.04.20. + +#include "ace_c_basis.h" +#include "ships_radial.h" + +using namespace std; + +ACECTildeBasisSet::ACECTildeBasisSet(string filename) { + load(filename); +} + +ACECTildeBasisSet::ACECTildeBasisSet(const ACECTildeBasisSet &other) { + ACECTildeBasisSet::_copy_scalar_memory(other); + ACECTildeBasisSet::_copy_dynamic_memory(other); + pack_flatten_basis(); +} + + +ACECTildeBasisSet &ACECTildeBasisSet::operator=(const ACECTildeBasisSet &other) { + if (this != &other) { + _clean(); + _copy_scalar_memory(other); + _copy_dynamic_memory(other); + pack_flatten_basis(); + } + return *this; +} + + +ACECTildeBasisSet::~ACECTildeBasisSet() { + ACECTildeBasisSet::_clean(); +} + +void ACECTildeBasisSet::_clean() { + // call parent method + ACEFlattenBasisSet::_clean(); + _clean_contiguous_arrays(); + _clean_basis_arrays(); +} + +void ACECTildeBasisSet::_copy_scalar_memory(const ACECTildeBasisSet &src) { + ACEFlattenBasisSet::_copy_scalar_memory(src); + num_ctilde_max = src.num_ctilde_max; +} + +void ACECTildeBasisSet::_copy_dynamic_memory(const ACECTildeBasisSet &src) {//allocate new memory + ACEFlattenBasisSet::_copy_dynamic_memory(src); + + if (src.basis_rank1 == nullptr) + throw runtime_error("Could not copy ACECTildeBasisSet::basis_rank1 - array not initialized"); + if (src.basis == nullptr) throw runtime_error("Could not copy ACECTildeBasisSet::basis - array not initialized"); + + + basis_rank1 = new ACECTildeBasisFunction *[src.nelements]; + basis = new ACECTildeBasisFunction *[src.nelements]; + + //copy basis arrays + for (SPECIES_TYPE mu = 0; mu < src.nelements; ++mu) { + basis_rank1[mu] = new ACECTildeBasisFunction[src.total_basis_size_rank1[mu]]; + + for (size_t i = 0; i < src.total_basis_size_rank1[mu]; i++) { + basis_rank1[mu][i] = src.basis_rank1[mu][i]; + } + + + basis[mu] = new ACECTildeBasisFunction[src.total_basis_size[mu]]; + for (size_t i = 0; i < src.total_basis_size[mu]; i++) { + basis[mu][i] = src.basis[mu][i]; + } + } + //DON"T COPY CONTIGUOUS ARRAY, REBUILD THEM +} + +void ACECTildeBasisSet::_clean_contiguous_arrays() { + ACEFlattenBasisSet::_clean_contiguous_arrays(); + + delete[] full_c_tildes_rank1; + full_c_tildes_rank1 = nullptr; + + delete[] full_c_tildes; + full_c_tildes = nullptr; +} + +//re-pack the constituent dynamic arrays of all basis functions in contiguous arrays +void ACECTildeBasisSet::pack_flatten_basis() { + compute_array_sizes(basis_rank1, basis); + + //1. clean contiguous arrays + _clean_contiguous_arrays(); + //2. allocate contiguous arrays + delete[] full_ns_rank1; + full_ns_rank1 = new NS_TYPE[rank_array_total_size_rank1]; + delete[] full_ls_rank1; + full_ls_rank1 = new NS_TYPE[rank_array_total_size_rank1]; + delete[] full_mus_rank1; + full_mus_rank1 = new SPECIES_TYPE[rank_array_total_size_rank1]; + delete[] full_ms_rank1; + full_ms_rank1 = new MS_TYPE[rank_array_total_size_rank1]; + + delete[] full_c_tildes_rank1; + full_c_tildes_rank1 = new DOUBLE_TYPE[coeff_array_total_size_rank1]; + + + delete[] full_ns; + full_ns = new NS_TYPE[rank_array_total_size]; + delete[] full_ls; + full_ls = new LS_TYPE[rank_array_total_size]; + delete[] full_mus; + full_mus = new SPECIES_TYPE[rank_array_total_size]; + delete[] full_ms; + full_ms = new MS_TYPE[ms_array_total_size]; + + delete[] full_c_tildes; + full_c_tildes = new DOUBLE_TYPE[coeff_array_total_size]; + + + //3. copy the values from private C_tilde_B_basis_function arrays to new contigous space + //4. clean private memory + //5. reassign private array pointers + + //r = 0, rank = 1 + size_t rank_array_ind_rank1 = 0; + size_t coeff_array_ind_rank1 = 0; + size_t ms_array_ind_rank1 = 0; + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + for (int func_ind_r1 = 0; func_ind_r1 < total_basis_size_rank1[mu]; ++func_ind_r1) { + ACECTildeBasisFunction &func = basis_rank1[mu][func_ind_r1]; + + //copy values ns from c_tilde_basis_function private memory to contigous memory part + full_ns_rank1[rank_array_ind_rank1] = func.ns[0]; + + //copy values ls from c_tilde_basis_function private memory to contigous memory part + full_ls_rank1[rank_array_ind_rank1] = func.ls[0]; + + //copy values mus from c_tilde_basis_function private memory to contigous memory part + full_mus_rank1[rank_array_ind_rank1] = func.mus[0]; + + //copy values ctildes from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_c_tildes_rank1[coeff_array_ind_rank1], func.ctildes, + func.ndensity * sizeof(DOUBLE_TYPE)); + + + //copy values mus from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_ms_rank1[ms_array_ind_rank1], func.ms_combs, + func.num_ms_combs * + func.rank * sizeof(MS_TYPE)); + + //release memory of each ACECTildeBasisFunction if it is not proxy + func._clean(); + + func.mus = &full_mus_rank1[rank_array_ind_rank1]; + func.ns = &full_ns_rank1[rank_array_ind_rank1]; + func.ls = &full_ls_rank1[rank_array_ind_rank1]; + func.ms_combs = &full_ms_rank1[ms_array_ind_rank1]; + func.ctildes = &full_c_tildes_rank1[coeff_array_ind_rank1]; + func.is_proxy = true; + + rank_array_ind_rank1 += func.rank; + ms_array_ind_rank1 += func.rank * + func.num_ms_combs; + coeff_array_ind_rank1 += func.num_ms_combs * func.ndensity; + + } + } + + + //rank>1, r>0 + size_t rank_array_ind = 0; + size_t coeff_array_ind = 0; + size_t ms_array_ind = 0; + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + for (int func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { + ACECTildeBasisFunction &func = basis[mu][func_ind]; + + //copy values mus from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_mus[rank_array_ind], func.mus, + func.rank * sizeof(SPECIES_TYPE)); + + //copy values ns from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_ns[rank_array_ind], func.ns, + func.rank * sizeof(NS_TYPE)); + //copy values ls from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_ls[rank_array_ind], func.ls, + func.rank * sizeof(LS_TYPE)); + //copy values mus from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_ms[ms_array_ind], func.ms_combs, + func.num_ms_combs * + func.rank * sizeof(MS_TYPE)); + + //copy values ctildes from c_tilde_basis_function private memory to contigous memory part + memcpy(&full_c_tildes[coeff_array_ind], func.ctildes, + func.num_ms_combs * func.ndensity * sizeof(DOUBLE_TYPE)); + + + //release memory of each ACECTildeBasisFunction if it is not proxy + func._clean(); + + func.ns = &full_ns[rank_array_ind]; + func.ls = &full_ls[rank_array_ind]; + func.mus = &full_mus[rank_array_ind]; + func.ctildes = &full_c_tildes[coeff_array_ind]; + func.ms_combs = &full_ms[ms_array_ind]; + func.is_proxy = true; + + rank_array_ind += func.rank; + ms_array_ind += func.rank * + func.num_ms_combs; + coeff_array_ind += func.num_ms_combs * func.ndensity; + } + } +} + +void fwrite_c_tilde_b_basis_func(FILE *fptr, ACECTildeBasisFunction &func) { + RANK_TYPE r; + fprintf(fptr, "ctilde_basis_func: "); + fprintf(fptr, "rank=%d ndens=%d mu0=%d ", func.rank, func.ndensity, func.mu0); + + fprintf(fptr, "mu=("); + for (r = 0; r < func.rank; ++r) + fprintf(fptr, " %d ", func.mus[r]); + fprintf(fptr, ")\n"); + + fprintf(fptr, "n=("); + for (r = 0; r < func.rank; ++r) + fprintf(fptr, " %d ", func.ns[r]); + fprintf(fptr, ")\n"); + + fprintf(fptr, "l=("); + for (r = 0; r < func.rank; ++r) + fprintf(fptr, " %d ", func.ls[r]); + fprintf(fptr, ")\n"); + + fprintf(fptr, "num_ms=%d\n", func.num_ms_combs); + + for (int m_ind = 0; m_ind < func.num_ms_combs; m_ind++) { + fprintf(fptr, "<"); + for (r = 0; r < func.rank; ++r) + fprintf(fptr, " %d ", func.ms_combs[m_ind * func.rank + r]); + fprintf(fptr, ">: "); + for (DENSITY_TYPE p = 0; p < func.ndensity; p++) + fprintf(fptr, " %.18f ", func.ctildes[m_ind * func.ndensity + p]); + fprintf(fptr, "\n"); + } + +} + +void ACECTildeBasisSet::save(const string &filename) { + FILE *fptr; + fptr = fopen(filename.c_str(), "w"); + + fprintf(fptr, "nelements=%d\n", nelements); + + //elements mapping + fprintf(fptr, "elements:"); + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) + fprintf(fptr, " %s", elements_name[mu].c_str()); + fprintf(fptr, "\n\n"); + + fprintf(fptr, "lmax=%d\n\n", lmax); + + fprintf(fptr, "embedding-function: %s\n", npoti.c_str()); + + fprintf(fptr, "%ld FS parameters: ", FS_parameters.size()); + for (int i = 0; i < FS_parameters.size(); ++i) { + fprintf(fptr, " %f", FS_parameters.at(i)); + } + fprintf(fptr, "\n"); + + //hard-core energy cutoff repulsion + fprintf(fptr, "core energy-cutoff parameters: "); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + fprintf(fptr, "%.18f %.18f\n", rho_core_cutoffs(mu_i), drho_core_cutoffs(mu_i)); + + // save E0 values + fprintf(fptr, "E0:"); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + fprintf(fptr, " %.18f", E0vals(mu_i)); + fprintf(fptr, "\n"); + + + fprintf(fptr, "\n"); + + + fprintf(fptr, "radbasename=%s\n", radial_functions->radbasename.c_str()); + fprintf(fptr, "nradbase=%d\n", nradbase); + fprintf(fptr, "nradmax=%d\n", nradmax); + + + fprintf(fptr, "cutoffmax=%f\n", cutoffmax); + + fprintf(fptr, "deltaSplineBins=%f\n", deltaSplineBins); + + //hard-core repulsion + fprintf(fptr, "core repulsion parameters: "); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) + fprintf(fptr, "%.18f %.18f\n", radial_functions->prehc(mu_i, mu_j), radial_functions->lambdahc(mu_j, mu_j)); + + + + + + //TODO: radial functions + //radparameter + fprintf(fptr, "radparameter="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) + fprintf(fptr, " %.18f", radial_functions->lambda(mu_i, mu_j)); + fprintf(fptr, "\n"); + + fprintf(fptr, "cutoff="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) + fprintf(fptr, " %.18f", radial_functions->cut(mu_i, mu_j)); + fprintf(fptr, "\n"); + + fprintf(fptr, "dcut="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) + fprintf(fptr, " %.18f", radial_functions->dcut(mu_i, mu_j)); + fprintf(fptr, "\n"); + + fprintf(fptr, "crad="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { + for (NS_TYPE k = 0; k < nradbase; k++) { + for (NS_TYPE n = 0; n < nradmax; n++) { + for (LS_TYPE l = 0; l <= lmax; l++) { + fprintf(fptr, " %.18f", radial_functions->crad(mu_i, mu_j, n, l, k)); + } + fprintf(fptr, "\n"); + } + } + } + + fprintf(fptr, "\n"); + + fprintf(fptr, "rankmax=%d\n", rankmax); + fprintf(fptr, "ndensitymax=%d\n", ndensitymax); + fprintf(fptr, "\n"); + + //num_c_tilde_max + fprintf(fptr, "num_c_tilde_max=%d\n", num_ctilde_max); + fprintf(fptr, "num_ms_combinations_max=%d\n", num_ms_combinations_max); + + + //write total_basis_size and total_basis_size_rank1 + fprintf(fptr, "total_basis_size_rank1: "); + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + fprintf(fptr, "%d ", total_basis_size_rank1[mu]); + } + fprintf(fptr, "\n"); + + for (SPECIES_TYPE mu = 0; mu < nelements; mu++) + for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size_rank1[mu]; ++func_ind) + fwrite_c_tilde_b_basis_func(fptr, basis_rank1[mu][func_ind]); + + fprintf(fptr, "total_basis_size: "); + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + fprintf(fptr, "%d ", total_basis_size[mu]); + } + fprintf(fptr, "\n"); + + for (SPECIES_TYPE mu = 0; mu < nelements; mu++) + for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) + fwrite_c_tilde_b_basis_func(fptr, basis[mu][func_ind]); + + + fclose(fptr); +} + +void fread_c_tilde_b_basis_func(FILE *fptr, ACECTildeBasisFunction &func) { + RANK_TYPE r; + int res; + char buf[3][128]; + + res = fscanf(fptr, " ctilde_basis_func: "); + + res = fscanf(fptr, "rank=%s ndens=%s mu0=%s ", buf[0], buf[1], buf[2]); + if (res != 3) + throw invalid_argument("Could not read C-tilde basis function"); + + func.rank = (RANK_TYPE) stol(buf[0]); + func.ndensity = (DENSITY_TYPE) stol(buf[1]); + func.mu0 = (SPECIES_TYPE) stol(buf[2]); + + func.mus = new SPECIES_TYPE[func.rank]; + func.ns = new NS_TYPE[func.rank]; + func.ls = new LS_TYPE[func.rank]; + + res = fscanf(fptr, " mu=("); + for (r = 0; r < func.rank; ++r) { + res = fscanf(fptr, "%s", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + func.mus[r] = (SPECIES_TYPE) stol(buf[0]); + } + res = fscanf(fptr, " )"); // ")" + + res = fscanf(fptr, " n=("); // "n=" + for (r = 0; r < func.rank; ++r) { + res = fscanf(fptr, "%s", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + + func.ns[r] = (NS_TYPE) stol(buf[0]); + } + res = fscanf(fptr, " )"); + + res = fscanf(fptr, " l=("); + for (r = 0; r < func.rank; ++r) { + res = fscanf(fptr, "%s", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + func.ls[r] = (NS_TYPE) stol(buf[0]); + } + res = fscanf(fptr, " )"); + + res = fscanf(fptr, " num_ms=%s\n", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + + func.num_ms_combs = (SHORT_INT_TYPE) stoi(buf[0]); + + func.ms_combs = new MS_TYPE[func.rank * func.num_ms_combs]; + func.ctildes = new DOUBLE_TYPE[func.ndensity * func.num_ms_combs]; + + for (int m_ind = 0; m_ind < func.num_ms_combs; m_ind++) { + res = fscanf(fptr, " <"); + for (r = 0; r < func.rank; ++r) { + res = fscanf(fptr, "%s", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + func.ms_combs[m_ind * func.rank + r] = stoi(buf[0]); + } + res = fscanf(fptr, " >:"); + for (DENSITY_TYPE p = 0; p < func.ndensity; p++) { + res = fscanf(fptr, "%s", buf[0]); + if (res != 1) + throw invalid_argument("Could not read C-tilde basis function"); + func.ctildes[m_ind * func.ndensity + p] = stod(buf[0]); + } + } +} + +string +format_error_message(const char *buffer, const string &filename, const string &var_name, const string &expected) { + string err_message = "File '" + filename + "': couldn't read '" + var_name + "'"; + if (buffer) + err_message = err_message + ", read:'" + buffer + "'"; + if (!expected.empty()) + err_message = err_message + ". Expected format: '" + expected + "'"; + return err_message; +} + +void throw_error(const string &filename, const string &var_name, const string expected = "") { + throw invalid_argument(format_error_message(nullptr, filename, var_name, expected)); +} + +DOUBLE_TYPE stod_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { + try { + return stod(buffer); + } catch (invalid_argument &exc) { + throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); + } +} + +int stoi_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { + try { + return stoi(buffer); + } catch (invalid_argument &exc) { + throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); + } +} + +long int stol_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { + try { + return stol(buffer); + } catch (invalid_argument &exc) { + throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); + } +} + +void ACECTildeBasisSet::load(const string filename) { + int res; + char buffer[1024], buffer2[1024]; + string radbasename = "ChebExpCos"; + + FILE *fptr; + fptr = fopen(filename.c_str(), "r"); + if (fptr == NULL) + throw invalid_argument("Could not open file " + filename); + + //read number of elements + res = fscanf(fptr, " nelements="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "nelements", "nelements=[number]"); + nelements = stoi_err(buffer, filename, "nelements", "nelements=[number]"); + + //elements mapping + elements_name = new string[nelements]; + res = fscanf(fptr, " elements:"); + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "elements", "elements: Ele1 Ele2 ..."); + elements_name[mu] = buffer; + } + + // load angular basis - only need spherical harmonics parameter + res = fscanf(fptr, " lmax=%s\n", buffer); + if (res != 1) + throw_error(filename, "lmax", "lmax=[number]"); + lmax = stoi_err(buffer, filename, "lmax", "lmax=[number]"); + spherical_harmonics.init(lmax); + + + // reading "embedding-function:" + bool is_embedding_function_specified = false; + res = fscanf(fptr, " embedding-function: %s", buffer); + if (res == 0) { + //throw_error(filename, "E0", " E0: E0-species1 E0-species2 ..."); + this->npoti = "FinnisSinclair"; // default values + //printf("Warning! No embedding-function is specified, embedding-function: FinnisSinclair would be assumed\n"); + is_embedding_function_specified = false; + } else { + this->npoti = buffer; + is_embedding_function_specified = true; + } + int parameters_size; + res = fscanf(fptr, "%s FS parameters:", buffer); + if (res != 1) + throw_error(filename, "FS parameters size", "[number] FS parameters: par1 par2 ..."); + parameters_size = stoi_err(buffer, filename, "FS parameters size", "[number] FS parameters"); + FS_parameters.resize(parameters_size); + for (int i = 0; i < FS_parameters.size(); ++i) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "FS parameter", "[number] FS parameters: [par1] [par2] ..."); + FS_parameters[i] = stod_err(buffer, filename, "FS parameter", "[number] FS parameters: [par1] [par2] ..."); + } + + if (!is_embedding_function_specified) { + // assuming non-linear potential, and embedding function type is important + for (int j = 1; j < parameters_size; j += 2) + if (FS_parameters[j] != 1.0) { //if not ensure linearity of embedding function parameters + printf("ERROR! Your potential is non-linear\n"); + printf("Please specify 'embedding-function: FinnisSinclair' or 'embedding-function: FinnisSinclairShiftedScaled' before 'FS parameters size' line\n"); + throw_error(filename, "embedding-function", "FinnisSinclair or FinnisSinclairShiftedScaled"); + } + printf("Notice! No embedding-function is specified, but potential has linear embedding, default embedding-function: FinnisSinclair would be assumed\n"); + } + + //hard-core energy cutoff repulsion + res = fscanf(fptr, " core energy-cutoff parameters:"); + if (res != 0) + throw_error(filename, "core energy-cutoff parameters", "core energy-cutoff parameters: [par1] [par2]"); + + rho_core_cutoffs.init(nelements, "rho_core_cutoffs"); + drho_core_cutoffs.init(nelements, "drho_core_cutoffs"); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) { + res = fscanf(fptr, "%s %s", buffer, buffer2); + if (res != 2) + throw_error(filename, "core energy-cutoff parameters", + "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); + rho_core_cutoffs(mu_i) = stod_err(buffer, filename, "rho core cutoff", + "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); + drho_core_cutoffs(mu_i) = stod_err(buffer2, filename, "drho_core_cutoff", + "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); + } + + // atom energy shift E0 (energy of isolated atom) + E0vals.init(nelements); + + // reading "E0:" + res = fscanf(fptr, " E0: %s", buffer); + if (res == 0) { + //throw_error(filename, "E0", " E0: E0-species1 E0-species2 ..."); + E0vals.fill(0.0); + } else { + double E0 = atof(buffer); + E0vals(0) = E0; + + for (SPECIES_TYPE mu_i = 1; mu_i < nelements; ++mu_i) { + res = fscanf(fptr, " %lf", &E0); + if (res != 1) + throw_error(filename, "E0", " couldn't read one of the E0 values"); + E0vals(mu_i) = E0; + } + res = fscanf(fptr, "\n"); + if (res != 0) + printf("file %s : format seems broken near E0; trying to continue...\n", filename.c_str()); + } + + // check which radial basis we need to load + res = fscanf(fptr, " radbasename=%s\n", buffer); + if (res != 1) { + throw_error(filename, "radbasename", "rabbasename=ChebExpCos|ChebPow|ACE.jl.Basic"); + } else { + radbasename = buffer; + } + +// printf("radbasename = `%s`\n", radbasename.c_str()); + if (radbasename == "ChebExpCos" | radbasename == "ChebPow") { + _load_radial_ACERadial(fptr, filename, radbasename); + } else if (radbasename == "ACE.jl.Basic") { + _load_radial_SHIPsBasic(fptr, filename, radbasename); + } else { + throw invalid_argument( + ("File '" + filename + "': I don't know how to read radbasename = " + radbasename).c_str()); + } + + res = fscanf(fptr, " rankmax="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "rankmax", "rankmax=[number]"); + rankmax = stoi_err(buffer, filename, "rankmax", "rankmax=[number]"); + + res = fscanf(fptr, " ndensitymax="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "ndensitymax", "ndensitymax=[number]"); + ndensitymax = stoi_err(buffer, filename, "ndensitymax", "ndensitymax=[number]"); + + // read the list of correlations to be put into the basis + //num_c_tilde_max + res = fscanf(fptr, " num_c_tilde_max="); + res = fscanf(fptr, "%s\n", buffer); + if (res != 1) + throw_error(filename, "num_c_tilde_max", "num_c_tilde_max=[number]"); + num_ctilde_max = stol_err(buffer, filename, "num_c_tilde_max", "num_c_tilde_max=[number]"); + + res = fscanf(fptr, " num_ms_combinations_max="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "num_ms_combinations_max", "num_ms_combinations_max=[number]"); +// throw invalid_argument(("File '" + filename + "': couldn't read num_ms_combinations_max").c_str()); + num_ms_combinations_max = stol_err(buffer, filename, "num_ms_combinations_max", "num_ms_combinations_max=[number]"); + + //read total_basis_size_rank1 + total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; + basis_rank1 = new ACECTildeBasisFunction *[nelements]; + res = fscanf(fptr, " total_basis_size_rank1: "); + + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "total_basis_size_rank1", "total_basis_size_rank1: [size_ele1] [size_ele2] ..."); +// throw invalid_argument(("File '" + filename + "': couldn't read total_basis_size_rank1").c_str()); + total_basis_size_rank1[mu] = stoi_err(buffer, filename, "total_basis_size_rank1", + "total_basis_size_rank1: [size_ele1] [size_ele2] ..."); + basis_rank1[mu] = new ACECTildeBasisFunction[total_basis_size_rank1[mu]]; + } + for (SPECIES_TYPE mu = 0; mu < nelements; mu++) + for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size_rank1[mu]; ++func_ind) { + fread_c_tilde_b_basis_func(fptr, basis_rank1[mu][func_ind]); + } + + //read total_basis_size + res = fscanf(fptr, " total_basis_size: "); + total_basis_size = new SHORT_INT_TYPE[nelements]; + basis = new ACECTildeBasisFunction *[nelements]; + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "total_basis_size", "total_basis_size: [size_ele1] [size_ele2] ..."); + total_basis_size[mu] = stoi_err(buffer, filename, "total_basis_size", + "total_basis_size: [size_ele1] [size_ele2] ..."); + basis[mu] = new ACECTildeBasisFunction[total_basis_size[mu]]; + } + for (SPECIES_TYPE mu = 0; mu < nelements; mu++) + for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { + fread_c_tilde_b_basis_func(fptr, basis[mu][func_ind]); + } + + fclose(fptr); + +// radial_functions->radbasename = radbasename; + radial_functions->setuplookupRadspline(); + pack_flatten_basis(); +} + +void ACECTildeBasisSet::compute_array_sizes(ACECTildeBasisFunction **basis_rank1, ACECTildeBasisFunction **basis) { + //compute arrays sizes + rank_array_total_size_rank1 = 0; + //ms_array_total_size_rank1 = rank_array_total_size_rank1; + coeff_array_total_size_rank1 = 0; + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + if (total_basis_size_rank1[mu] > 0) { + rank_array_total_size_rank1 += total_basis_size_rank1[mu]; + + ACEAbstractBasisFunction &func = basis_rank1[mu][0];//TODO: get total density instead of density from first function + coeff_array_total_size_rank1 += total_basis_size_rank1[mu] * func.ndensity; + } + } + + rank_array_total_size = 0; + coeff_array_total_size = 0; + + ms_array_total_size = 0; + max_dB_array_size = 0; + + + max_B_array_size = 0; + + size_t cur_ms_size = 0; + size_t cur_ms_rank_size = 0; + + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + + cur_ms_size = 0; + cur_ms_rank_size = 0; + for (int func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { + auto &func = basis[mu][func_ind]; + rank_array_total_size += func.rank; + ms_array_total_size += func.rank * func.num_ms_combs; + coeff_array_total_size += func.ndensity * func.num_ms_combs; + + cur_ms_size += func.num_ms_combs; + cur_ms_rank_size += func.rank * func.num_ms_combs; + } + + if (cur_ms_size > max_B_array_size) + max_B_array_size = cur_ms_size; + + if (cur_ms_rank_size > max_dB_array_size) + max_dB_array_size = cur_ms_rank_size; + } +} + +void ACECTildeBasisSet::_clean_basis_arrays() { + if (basis_rank1 != nullptr) + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + delete[] basis_rank1[mu]; + basis_rank1[mu] = nullptr; + } + + if (basis != nullptr) + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + delete[] basis[mu]; + basis[mu] = nullptr; + } + delete[] basis; + basis = nullptr; + + delete[] basis_rank1; + basis_rank1 = nullptr; +} + +//pack into 1D array with all basis functions +void ACECTildeBasisSet::flatten_basis(C_tilde_full_basis_vector2d &mu0_ctilde_basis_vector) { + + _clean_basis_arrays(); + basis_rank1 = new ACECTildeBasisFunction *[nelements]; + basis = new ACECTildeBasisFunction *[nelements]; + + delete[] total_basis_size_rank1; + delete[] total_basis_size; + total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; + total_basis_size = new SHORT_INT_TYPE[nelements]; + + + size_t tot_size_rank1 = 0; + size_t tot_size = 0; + + for (SPECIES_TYPE mu = 0; mu < this->nelements; ++mu) { + tot_size = 0; + tot_size_rank1 = 0; + + for (auto &func: mu0_ctilde_basis_vector[mu]) { + if (func.rank == 1) tot_size_rank1 += 1; + else tot_size += 1; + } + + total_basis_size_rank1[mu] = tot_size_rank1; + basis_rank1[mu] = new ACECTildeBasisFunction[tot_size_rank1]; + + total_basis_size[mu] = tot_size; + basis[mu] = new ACECTildeBasisFunction[tot_size]; + } + + + for (SPECIES_TYPE mu = 0; mu < this->nelements; ++mu) { + size_t ind_rank1 = 0; + size_t ind = 0; + + for (auto &func: mu0_ctilde_basis_vector[mu]) { + if (func.rank == 1) { //r=0, rank=1 + basis_rank1[mu][ind_rank1] = func; + ind_rank1 += 1; + } else { //r>0, rank>1 + basis[mu][ind] = func; + ind += 1; + } + } + + } +} + + +void ACECTildeBasisSet::_load_radial_ACERadial(FILE *fptr, + const string filename, + const string radbasename) { + int res; + char buffer[1024], buffer2[1024]; + + res = fscanf(fptr, " nradbase="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "nradbase", "nradbase=[number]"); +// throw invalid_argument(("File '" + filename + "': couldn't read nradbase").c_str()); + nradbase = stoi_err(buffer, filename, "nradbase", "nradbase=[number]"); + + res = fscanf(fptr, " nradmax="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "nradmax", "nradmax=[number]"); + nradmax = stoi_err(buffer, filename, "nradmax", "nradmax=[number]"); + + res = fscanf(fptr, " cutoffmax="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "cutoffmax", "cutoffmax=[number]"); + cutoffmax = stod_err(buffer, filename, "cutoffmax", "cutoffmax=[number]"); + + + res = fscanf(fptr, " deltaSplineBins="); + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "deltaSplineBins", "deltaSplineBins=[spline density, Angstroms]"); +// throw invalid_argument(("File '" + filename + "': couldn't read ntot").c_str()); + deltaSplineBins = stod_err(buffer, filename, "deltaSplineBins", "deltaSplineBins=[spline density, Angstroms]"); + + + if (radial_functions == nullptr) + radial_functions = new ACERadialFunctions(nradbase, lmax, nradmax, + deltaSplineBins, + nelements, + cutoffmax, radbasename); + else + radial_functions->init(nradbase, lmax, nradmax, + deltaSplineBins, + nelements, + cutoffmax, radbasename); + + + //hard-core repulsion + res = fscanf(fptr, " core repulsion parameters:"); + if (res != 0) + throw_error(filename, "core repulsion parameters", "core repulsion parameters: [prehc lambdahc] ..."); +// throw invalid_argument(("File '" + filename + "': couldn't read core repulsion parameters").c_str()); + + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { + res = fscanf(fptr, "%s %s", buffer, buffer2); + if (res != 2) + throw_error(filename, "core repulsion parameters", "core repulsion parameters: [prehc lambdahc] ..."); + radial_functions->prehc(mu_i, mu_j) = stod_err(buffer, filename, "core repulsion parameters", + "core repulsion parameters: [prehc lambdahc] ..."); + radial_functions->lambdahc(mu_i, mu_j) = stod_err(buffer2, filename, "core repulsion parameters", + "core repulsion parameters: [prehc lambdahc] ..."); + } + + + + //read radial functions parameter + res = fscanf(fptr, " radparameter="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "radparameter", "radparameter=[param_ele1] [param_ele2]"); + radial_functions->lambda(mu_i, mu_j) = stod_err(buffer, filename, "radparameter", + "radparameter=[param_ele1] [param_ele2]"); + } + + + res = fscanf(fptr, " cutoff="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "cutoff", "cutoff=[param_ele1] [param_ele2]"); + radial_functions->cut(mu_i, mu_j) = stod_err(buffer, filename, "cutoff", + "cutoff=[param_ele1] [param_ele2]"); + } + + + res = fscanf(fptr, " dcut="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { + res = fscanf(fptr, " %s", buffer); + if (res != 1) + throw_error(filename, "dcut", "dcut=[param_ele1] [param_ele2]"); + radial_functions->dcut(mu_i, mu_j) = stod_err(buffer, filename, "dcut", "dcut=[param_ele1] [param_ele2]"); + } + + + res = fscanf(fptr, " crad="); + for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) + for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) + for (NS_TYPE k = 0; k < nradbase; k++) + for (NS_TYPE n = 0; n < nradmax; n++) + for (LS_TYPE l = 0; l <= lmax; l++) { + res = fscanf(fptr, "%s", buffer); + if (res != 1) + throw_error(filename, "crad", "crad=[crad_]...[crad_knl]: nradbase*nrad*(l+1) times"); + radial_functions->crad(mu_i, mu_j, n, l, k) = stod_err(buffer, filename, "crad", + "crad=[crad_]...[crad_knl]: nradbase*nrad*(l+1) times"); + } +} + +void ACECTildeBasisSet::_load_radial_SHIPsBasic(FILE *fptr, + const string filename, + const string radbasename) { + // create a radial basis object, and read it from the file pointer + SHIPsRadialFunctions *ships_radial_functions = new SHIPsRadialFunctions(); + ships_radial_functions->fread(fptr); + + //mimic ships_radial_functions to ACERadialFunctions + ships_radial_functions->nradial = ships_radial_functions->get_maxn(); + ships_radial_functions->nradbase = ships_radial_functions->get_maxn(); + + nradbase = ships_radial_functions->get_maxn(); + nradmax = ships_radial_functions->get_maxn(); + cutoffmax = ships_radial_functions->get_rcut(); + deltaSplineBins = 0.001; + + ships_radial_functions->init(nradbase, lmax, nradmax, + deltaSplineBins, + nelements, + cutoffmax, radbasename); + + + if (radial_functions) delete radial_functions; + radial_functions = ships_radial_functions; + radial_functions->prehc.fill(0); + radial_functions->lambdahc.fill(1); + radial_functions->lambda.fill(0); + + + radial_functions->cut.fill(ships_radial_functions->get_rcut()); + radial_functions->dcut.fill(0); + + radial_functions->crad.fill(0); + +} \ No newline at end of file diff --git a/lib/pace/ace_c_basis.h b/lib/pace/ace_c_basis.h new file mode 100644 index 0000000000..ec6b9e8afc --- /dev/null +++ b/lib/pace/ace_c_basis.h @@ -0,0 +1,155 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 1.04.20. + +#ifndef ACE_C_BASIS_H +#define ACE_C_BASIS_H + +#include "ace_flatten_basis.h" + +typedef vector> C_tilde_full_basis_vector2d; + +/** + * ACE basis set of C-tilde basis functions + */ +class ACECTildeBasisSet : public ACEFlattenBasisSet { +public: + + ACECTildeBasisFunction **basis_rank1 = nullptr; ///< two-dimensional array of first-rank basis function with indices: [species index][func index] + ACECTildeBasisFunction **basis = nullptr; ///< two-dimensional array of higher rank basis function with indices: [species index][func index] + + DOUBLE_TYPE *full_c_tildes_rank1 = nullptr; ///< C_tilde coefficients contiguous package, size: coeff_array_total_size_rank1 + DOUBLE_TYPE *full_c_tildes = nullptr; ///< C_tilde coefficients contiguous package, size: coeff_array_total_size + + //TODO: remove? + SHORT_INT_TYPE num_ctilde_max = 0; + + + /** + * Default constructor + */ + ACECTildeBasisSet() = default; + + /** + * Constructor from .ace file + */ + ACECTildeBasisSet(const string filename); + + /** + * Copy constructor (see. Rule of Three) + * @param other + */ + ACECTildeBasisSet(const ACECTildeBasisSet &other); + + /** + * operator= (see. Rule of Three) + * @param other + * @return + */ + ACECTildeBasisSet &operator=(const ACECTildeBasisSet &other); + + /** + * Destructor (see. Rule of Three) + */ + ~ACECTildeBasisSet() override; + + /** + * Cleaning dynamic memory of the class (see. Rule of Three) + */ + void _clean() override; + + /** + * Copying and cleaning dynamic memory of the class (see. Rule of Three) + * @param src + */ + void _copy_dynamic_memory(const ACECTildeBasisSet &src); + + /** + * Copying scalar variables + * @param src + */ + void _copy_scalar_memory(const ACECTildeBasisSet &src); + + /** + * Clean contiguous arrays (full_c_tildes_rank1, full_c_tildes) and those of base class + */ + void _clean_contiguous_arrays() override ; + + /** + * Save potential to .ace file + * @param filename .ace file name + */ + void save(const string &filename) override; + + /** + * Load potential from .ace + * @param filename .ace file name + */ + void load(const string filename) override; + + /** + * Load the ACE type radial basis + */ + void _load_radial_ACERadial(FILE *fptr, + const string filename, + const string radbasename); + + void _load_radial_SHIPsBasic(FILE * fptr, + const string filename, + const string radbasename ); + + /** + * Re-pack the constituent dynamic arrays of all basis functions in contiguous arrays + */ + void pack_flatten_basis() override; + + /** + * Computes flatten array sizes + * @param basis_rank1 two-dimensional array of first-rank ACECTildeBasisFunctions + * @param basis two-dimensional array of higher-rank ACECTildeBasisFunctions + */ + void compute_array_sizes(ACECTildeBasisFunction** basis_rank1, ACECTildeBasisFunction** basis); + + /** + * Clean basis arrays 'basis_rank1' and 'basis' + */ + void _clean_basis_arrays(); + + /** + * Pack two-dimensional vector of ACECTildeBasisFunction into 1D dynami array with all basis functions + * @param mu0_ctilde_basis_vector vector> + */ + void flatten_basis(C_tilde_full_basis_vector2d& mu0_ctilde_basis_vector); + + /** + * Empty stub implementation + */ + void flatten_basis() override{}; +}; + +#endif //ACE_C_BASIS_H diff --git a/lib/pace/ace_c_basisfunction.h b/lib/pace/ace_c_basisfunction.h new file mode 100644 index 0000000000..4e2795590e --- /dev/null +++ b/lib/pace/ace_c_basisfunction.h @@ -0,0 +1,251 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 26.02.20. + +#ifndef ACE_C_BASISFUNCTION_H +#define ACE_C_BASISFUNCTION_H + +#include +#include +#include +#include + +#include "ace_types.h" + +//macros for copying the member-array from "other" object for C-tilde and B-basis +#define basis_mem_copy(other, array, size, type) if(other.array) { \ + if(!is_proxy) delete[] array;\ + array = new type[(size)];\ + is_proxy = false;\ + memcpy(array, other.array, (size) * sizeof(type));\ +} + +/** + * Abstract basis function, that stores general quantities + */ +struct ACEAbstractBasisFunction { + /** + * flattened array of computed combinations of (m1, m2, ..., m_rank) + * which have non-zero general Clebsch-Gordan coefficient: + * \f$ \mathbf{m}_1, \dots, \mathbf{m}_\mathrm{num ms combs}\f$ = + * \f$ (m_1, m_2, \dots, m_{rank})_1, \dots, (m_1, m_2, \dots, m_{rank})_{\mathrm{num ms combs}} \f$, + * size = num_ms_combs * rank, + * effective shape: [num_ms_combs][rank] + */ + MS_TYPE *ms_combs = nullptr; + + /** + * species types of neighbours atoms \f$ \mathbf{\mu} = (\mu_1, \mu_2, \dots, \mu_{rank}) \f$, + * should be lexicographically sorted, + * size = rank, + * effective shape: [rank] + */ + SPECIES_TYPE *mus = nullptr; + + /** + * indices for radial part \f$ \mathbf{n} = (n_1, n_2, \dots, n_{rank}) \f$, + * should be lexicographically sorted, + * size = rank, + * effective shape: [rank] + */ + NS_TYPE *ns = nullptr; + + + /** + * indices for radial part \f$ \mathbf{l} = (l_1, l_2, \dots, l_{rank}) \f$, + * should be lexicographically sorted, + * size = rank, + * effective shape: [rank] + */ + LS_TYPE *ls = nullptr; + + SHORT_INT_TYPE num_ms_combs = 0; ///< number of different ms-combinations + + RANK_TYPE rank = 0; ///< number of atomic base functions "A"s in basis function product B + + DENSITY_TYPE ndensity = 0; ///< number of densities + + SPECIES_TYPE mu0 = 0; ///< species type of central atom + + /** + * whether ms array contains only "non-negative" ms-combinations. + * positive ms-combination is when the first non-zero m is positive (0 1 -1) + * negative ms-combination is when the first non-zero m is negative (0 -1 1) + */ + bool is_half_ms_basis = false; + + /* + * flag, whether object is "owner" (i.e. responsible for memory cleaning) of + * the ms, ns, ls, mus and other dynamically allocated arrases or just a proxy for them + */ + bool is_proxy = false; + + /** + * Copying static and dynamic memory variables from another ACEAbstractBasisFunction. + * Always copy the dynamic memory, even if the source is a proxy object + * @param other + */ + virtual void _copy_from(const ACEAbstractBasisFunction &other) { + rank = other.rank; + ndensity = other.ndensity; + mu0 = other.mu0; + num_ms_combs = other.num_ms_combs; + is_half_ms_basis = other.is_half_ms_basis; + is_proxy = false; + + basis_mem_copy(other, mus, rank, SPECIES_TYPE) + basis_mem_copy(other, ns, rank, NS_TYPE) + basis_mem_copy(other, ls, rank, LS_TYPE) + basis_mem_copy(other, ms_combs, num_ms_combs * rank, MS_TYPE) + } + + /** + * Clean the dynamically allocated memory if object is responsible for it + */ + virtual void _clean() { + //release memory if the structure is not proxy + if (!is_proxy) { + delete[] mus; + delete[] ns; + delete[] ls; + delete[] ms_combs; + } + + mus = nullptr; + ns = nullptr; + ls = nullptr; + ms_combs = nullptr; + } + +}; + +/** + * Representation of C-tilde basis function, i.e. the function that is summed up over a group of B-functions + * that differs only by intermediate coupling orbital moment \f$ L \f$ and coefficients. + */ +struct ACECTildeBasisFunction : public ACEAbstractBasisFunction { + + /** + * c_tilde coefficients for all densities, + * size = num_ms_combs*ndensity, + * effective shape [num_ms_combs][ndensity] + */ + DOUBLE_TYPE *ctildes = nullptr; + + /* + * Default constructor + */ + ACECTildeBasisFunction() = default; + + // Because the ACECTildeBasisFunction contains dynamically allocated arrays, the Rule of Three should be + // fulfilled, i.e. copy constructor (copy the dynamic arrays), operator= (release previous arrays and + // copy the new dynamic arrays) and destructor (release all dynamically allocated memory) + + /** + * Copy constructor, to fulfill the Rule of Three. + * Always copy the dynamic memory, even if the source is a proxy object. + */ + ACECTildeBasisFunction(const ACECTildeBasisFunction &other) { + _copy_from(other); + } + + /* + * operator=, to fulfill the Rule of Three. + * Always copy the dynamic memory, even if the source is a proxy object + */ + ACECTildeBasisFunction &operator=(const ACECTildeBasisFunction &other) { + _clean(); + _copy_from(other); + return *this; + } + + /* + * Destructor + */ + ~ACECTildeBasisFunction() { + _clean(); + } + + /** + * Copy from another object, always copy the memory, even if the source is a proxy object + * @param other + */ + void _copy_from(const ACECTildeBasisFunction &other) { + ACEAbstractBasisFunction::_copy_from(other); + is_proxy = false; + basis_mem_copy(other, ctildes, num_ms_combs * ndensity, DOUBLE_TYPE) + } + + /** + * Clean the dynamically allocated memory if object is responsible for it + */ + void _clean() override { + ACEAbstractBasisFunction::_clean(); + //release memory if the structure is not proxy + if (!is_proxy) { + delete[] ctildes; + } + ctildes = nullptr; + } + + /** + * Print the information about basis function to cout, in order to ease the output redirection. + */ + void print() const { + using namespace std; + cout << "ACECTildeBasisFunction: ndensity= " << (int) this->ndensity << ", mu0 = " << (int) this->mu0 << " "; + cout << " mus=("; + for (RANK_TYPE r = 0; r < this->rank; r++) + cout << (int) this->mus[r] << " "; + cout << "), ns=("; + for (RANK_TYPE r = 0; r < this->rank; r++) + cout << this->ns[r] << " "; + cout << "), ls=("; + for (RANK_TYPE r = 0; r < this->rank; r++) + cout << this->ls[r] << " "; + + cout << "), " << this->num_ms_combs << " m_s combinations: {" << endl; + + for (int i = 0; i < this->num_ms_combs; i++) { + cout << "\t< "; + for (RANK_TYPE r = 0; r < this->rank; r++) + cout << this->ms_combs[i * this->rank + r] << " "; + cout << " >: c_tilde="; + for (DENSITY_TYPE p = 0; p < this->ndensity; ++p) + cout << " " << this->ctildes[i * this->ndensity + p] << " "; + cout << endl; + } + if (this->is_proxy) + cout << "proxy "; + if (this->is_half_ms_basis) + cout << "half_ms_basis"; + cout << "}" << endl; + } +}; + +#endif //ACE_C_BASISFUNCTION_H diff --git a/lib/pace/ace_complex.h b/lib/pace/ace_complex.h new file mode 100644 index 0000000000..5fdb4b5b93 --- /dev/null +++ b/lib/pace/ace_complex.h @@ -0,0 +1,266 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 26.02.20. + +#ifndef ACE_COMPLEX_H +#define ACE_COMPLEX_H + + +/** +A custom data structure for complex numbers and overloaded operations with them. +*/ +struct ACEComplex { +public: + /** + Double, real part of the complex number + */ + DOUBLE_TYPE real; + /** + Double, imaginary part of the complex number + */ + DOUBLE_TYPE img; + + ACEComplex &operator=(const ACEComplex &rhs) = default; + + ACEComplex &operator=(const DOUBLE_TYPE &rhs) { + this->real = rhs; + this->img = 0.; + return *this; + } + + /** + Overloading of arithmetical operator += ACEComplex + */ + ACEComplex &operator+=(const ACEComplex &rhs) { + this->real += rhs.real; + this->img += rhs.img; + return *this; // return the result by reference + } + + /** + Overloading of arithmetical operator += DOUBLE_TYPE + */ + ACEComplex &operator+=(const DOUBLE_TYPE &rhs) { + this->real += rhs; + return *this; // return the result by reference + } + + /** + Overloading of arithmetical operator *= DOUBLE_TYPE + */ + ACEComplex &operator*=(const DOUBLE_TYPE &rhs) { + this->real *= rhs; + this->img *= rhs; + return *this; // return the result by reference + } + + /** + Overloading of arithmetical operator *= ACEComplex + */ + ACEComplex &operator*=(const ACEComplex &rhs) { + DOUBLE_TYPE old_real = this->real; + this->real = old_real * rhs.real - this->img * rhs.img; + this->img = old_real * rhs.img + this->img * rhs.real; + return *this; // return the result by reference + } + + /** + Overloading of arithmetical operator * ACEComplex + */ + ACEComplex operator*(const ACEComplex &cm2) const { + ACEComplex res{real * cm2.real - img * cm2.img, + real * cm2.img + img * cm2.real}; + return res; + } + + /* + * Return complex conjugated copy of itself + */ + ACEComplex conjugated() const { + ACEComplex res{real, -img}; + return res; + } + + /* + * Complex conjugate itself inplace + */ + void conjugate() { + img = -img; + } + + /* + * Multiplication by ACEComplex and return real-part only + */ + DOUBLE_TYPE real_part_product(const ACEComplex &cm2) const { + return real * cm2.real - img * cm2.img; + } + + /* + * Multiplication by DOUBLE_TYPE and return real-part only + */ + DOUBLE_TYPE real_part_product(const DOUBLE_TYPE &cm2) const { + return real * cm2; + } + + /* + * Overloading of arithmetical operator * by DOUBLE_TYPE + */ + ACEComplex operator*(const DOUBLE_TYPE &cm2) const { + ACEComplex res{real * cm2, + img * cm2}; + return res; + } + + /* + * Overloading of arithmetical operator + ACEComplex + */ + ACEComplex operator+(const ACEComplex &cm2) const { + ACEComplex res{real + cm2.real, + img + cm2.img}; + return res; + } + + /* + * Overloading of arithmetical operator + with DOUBLE_TYPE + */ + ACEComplex operator+(const DOUBLE_TYPE &cm2) const { + ACEComplex res{real + cm2, img}; + return res; + } + + /* + * Overloading of arithmetical operator == ACEComplex + */ + bool operator==(const ACEComplex &c2) const { + return (real == c2.real) && (img == c2.img); + } + + /* + * Overloading of arithmetical operator == DOUBLE_TYPE + */ + bool operator==(const DOUBLE_TYPE &d2) const { + return (real == d2) && (img == 0.); + } + + /* + * Overloading of arithmetical operator != ACEComplex + */ + bool operator!=(const ACEComplex &c2) const { + return (real != c2.real) || (img != c2.img); + } + + /* + * Overloading of arithmetical operator != DOUBLE_TYPE + */ + bool operator!=(const DOUBLE_TYPE &d2) const { + return (real != d2) || (img != 0.); + } + +}; + +/* + * double * complex for commutativity with complex * double + */ +inline ACEComplex operator*(const DOUBLE_TYPE &real, const ACEComplex &cm) { + return cm * real; +} + +/* + * double + complex for commutativity with complex + double + */ +inline ACEComplex operator+(const DOUBLE_TYPE &real, const ACEComplex &cm) { + return cm + real; +} + +/** +A structure to store the derivative of \f$ Y_{lm} \f$ +*/ +struct ACEDYcomponent { +public: + /** + complex, contains the three components of derivative of Ylm, + \f$ \frac{dY_{lm}}{dx}, \frac{dY_{lm}}{dy} and \frac{dY_{lm}}{dz}\f$ + */ + ACEComplex a[3]; + + /* + * Overloading of arithmetical operator*= DOUBLE_TYPE + */ + ACEDYcomponent &operator*=(const DOUBLE_TYPE &rhs) { + this->a[0] *= rhs; + this->a[1] *= rhs; + this->a[2] *= rhs; + return *this; + } + + /* + * Overloading of arithmetical operator * ACEComplex + */ + ACEDYcomponent operator*(const ACEComplex &rhs) const { + ACEDYcomponent res; + res.a[0] = this->a[0] * rhs; + res.a[1] = this->a[1] * rhs; + res.a[2] = this->a[2] * rhs; + return res; + } + + /* + * Overloading of arithmetical operator * DOUBLE_TYPE + */ + ACEDYcomponent operator*(const DOUBLE_TYPE &rhs) const { + ACEDYcomponent res; + res.a[0] = this->a[0] * rhs; + res.a[1] = this->a[1] * rhs; + res.a[2] = this->a[2] * rhs; + return res; + } + + /* + * Return conjugated copy of itself + */ + ACEDYcomponent conjugated() const { + ACEDYcomponent res; + res.a[0] = this->a[0].conjugated(); + res.a[1] = this->a[1].conjugated(); + res.a[2] = this->a[2].conjugated(); + return res; + } + + /* + * Conjugated itself in-place + */ + void conjugate() { + this->a[0].conjugate(); + this->a[1].conjugate(); + this->a[2].conjugate(); + } + +}; + + +#endif //ACE_COMPLEX_H diff --git a/lib/pace/ace_contigous_array.h b/lib/pace/ace_contigous_array.h new file mode 100644 index 0000000000..f008fa203f --- /dev/null +++ b/lib/pace/ace_contigous_array.h @@ -0,0 +1,249 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Yury Lysogorskiy on 11.01.20. +#ifndef ACE_CONTIGUOUSARRAYND_H +#define ACE_CONTIGUOUSARRAYND_H + +#include + +#include "ace_types.h" + +using namespace std; + +/** + * Common predecessor class to represent multidimensional array of type T + * and store it in memory contiguous form + * + * @tparam T data type + */ +template +class ContiguousArrayND { +protected: + T *data = nullptr; ///< pointer to contiguous data + size_t size = 0; ///< total array size + string array_name = "Array"; /// 0) { + data = new T[size]; + for (size_t ind = 0; ind < size; ind++) + data[ind] = other.data[ind]; + } + } else { //is proxy, then copy the pointer + data = other.data; + } + } + + /** + * Overload operator= + * @param other another ContiguousArrayND + * @return itself + */ + + ContiguousArrayND &operator=(const ContiguousArrayND &other) { +#ifdef MULTIARRAY_LIFE_CYCLE + cout< 0) { + + if(data!=nullptr) delete[] data; + data = new T[size]; + + for (size_t ind = 0; ind < size; ind++) + data[ind] = other.data[ind]; + } + } else { //is proxy, then copy the pointer + data = other.data; + } + } + return *this; + } + + + //TODO: make destructor virtual, check the destructors in inherited classes + + /** + * Destructor + */ + ~ContiguousArrayND() { +#ifdef MULTIARRAY_LIFE_CYCLE + cout<array_name = name; + } + + /** + * Get total number of elements in array (its size) + * @return array size + */ + size_t get_size() const { + return size; + } + + /** + * Fill array with value + * @param value value to fill + */ + void fill(T value) { + for (size_t ind = 0; ind < size; ind++) + data[ind] = value; + } + + /** + * Get array data at absolute index ind for reading + * @param ind absolute index + * @return array value + */ + inline const T &get_data(size_t ind) const { +#ifdef MULTIARRAY_INDICES_CHECK + if ((ind < 0) | (ind >= size)) { + printf("%s: get_data ind=%d out of range (0, %d)\n", array_name, ind, size); + exit(EXIT_FAILURE); + } +#endif + return data[ind]; + } + + /** + * Get array data at absolute index ind for writing + * @param ind absolute index + * @return array value + */ + inline T &get_data(size_t ind) { +#ifdef MULTIARRAY_INDICES_CHECK + if ((ind < 0) | (ind >= size)) { + printf("%s: get_data ind=%ld out of range (0, %ld)\n", array_name.c_str(), ind, size); + exit(EXIT_FAILURE); + } +#endif + return data[ind]; + } + + /** + * Get array data pointer + * @return data array pointer + */ + inline T* get_data() const { + return data; + } + + /** + * Overload comparison operator== + * Compare the total size and array values elementwise. + * + * @param other another array + * @return + */ + bool operator==(const ContiguousArrayND &other) const { + if (this->size != other.size) + return false; + + for (size_t i = 0; i < this->size; ++i) + if (this->data[i] != other.data[i]) + return false; + + return true; + } + + + /** + * Convert to flatten vector container + * @return vector container + */ + vector to_flatten_vector() const { + vector res; + + res.resize(size); + size_t vec_ind = 0; + + for (int vec_ind = 0; vec_ind < size; vec_ind++) + res.at(vec_ind) = data[vec_ind]; + + return res; + } // end to_flatten_vector() + + + /** + * Set values from flatten vector container + * @param vec container + */ + void set_flatten_vector(const vector &vec) { + if (vec.size() != size) + throw std::invalid_argument("Flatten vector size is not consistent with expected size"); + for (size_t i = 0; i < size; i++) { + data[i] = vec[i]; + } + } + + bool is_proxy(){ + return is_proxy_; + } + +}; + + +#endif //ACE_CONTIGUOUSARRAYND_H \ No newline at end of file diff --git a/lib/pace/ace_evaluator.cpp b/lib/pace/ace_evaluator.cpp new file mode 100644 index 0000000000..987f4502bf --- /dev/null +++ b/lib/pace/ace_evaluator.cpp @@ -0,0 +1,660 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 31.01.20. + +#include "ace_evaluator.h" + +#include "ace_abstract_basis.h" +#include "ace_types.h" + +void ACEEvaluator::init(ACEAbstractBasisSet *basis_set) { + A.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, "A"); + A_rank1.init(basis_set->nelements, basis_set->nradbase, "A_rank1"); + + rhos.init(basis_set->ndensitymax + 1, "rhos"); // +1 density for core repulsion + dF_drho.init(basis_set->ndensitymax + 1, "dF_drho"); // +1 density for core repulsion +} + +void ACEEvaluator::init_timers() { + loop_over_neighbour_timer.init(); + forces_calc_loop_timer.init(); + forces_calc_neighbour_timer.init(); + energy_calc_timer.init(); + per_atom_calc_timer.init(); + total_time_calc_timer.init(); +} + +//================================================================================================================ + +void ACECTildeEvaluator::set_basis(ACECTildeBasisSet &bas) { + basis_set = &bas; + init(basis_set); +} + +void ACECTildeEvaluator::init(ACECTildeBasisSet *basis_set) { + + ACEEvaluator::init(basis_set); + + + weights.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, + "weights"); + + weights_rank1.init(basis_set->nelements, basis_set->nradbase, "weights_rank1"); + + + DG_cache.init(1, basis_set->nradbase, "DG_cache"); + DG_cache.fill(0); + + R_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "R_cache"); + R_cache.fill(0); + + DR_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "DR_cache"); + DR_cache.fill(0); + + Y_cache.init(1, basis_set->lmax + 1, "Y_cache"); + Y_cache.fill({0, 0}); + + DY_cache.init(1, basis_set->lmax + 1, "dY_dense_cache"); + DY_cache.fill({0.}); + + //hard-core repulsion + DCR_cache.init(1, "DCR_cache"); + DCR_cache.fill(0); + dB_flatten.init(basis_set->max_dB_array_size, "dB_flatten"); + + +} + +void ACECTildeEvaluator::resize_neighbours_cache(int max_jnum) { + if(basis_set== nullptr) { + throw std::invalid_argument("ACECTildeEvaluator: basis set is not assigned"); + } + if (R_cache.get_dim(0) < max_jnum) { + + //TODO: implement grow + R_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); + R_cache.fill(0); + + DR_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); + DR_cache.fill(0); + + DG_cache.resize(max_jnum, basis_set->nradbase); + DG_cache.fill(0); + + Y_cache.resize(max_jnum, basis_set->lmax + 1); + Y_cache.fill({0, 0}); + + DY_cache.resize(max_jnum, basis_set->lmax + 1); + DY_cache.fill({0}); + + //hard-core repulsion + DCR_cache.init(max_jnum, "DCR_cache"); + DCR_cache.fill(0); + } +} + + + +// double** r - atomic coordinates of atom I +// int* types - atomic types if atom I +// int **firstneigh - ptr to 1st J int value of each I atom. Usage: jlist = firstneigh[i]; +// Usage: j = jlist_of_i[jj]; +// jnum - number of J neighbors for each I atom. jnum = numneigh[i]; + +void +ACECTildeEvaluator::compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) { + if(basis_set== nullptr) { + throw std::invalid_argument("ACECTildeEvaluator: basis set is not assigned"); + } + per_atom_calc_timer.start(); +#ifdef PRINT_MAIN_STEPS + printf("\n ATOM: ind = %d r_norm=(%f, %f, %f)\n",i, x[i][0], x[i][1], x[i][2]); +#endif + DOUBLE_TYPE evdwl = 0, evdwl_cut = 0, rho_core = 0; + DOUBLE_TYPE r_norm; + DOUBLE_TYPE xn, yn, zn, r_xyz; + DOUBLE_TYPE R, GR, DGR, R_over_r, DR, DCR; + DOUBLE_TYPE *r_hat; + + SPECIES_TYPE mu_j; + RANK_TYPE r, rank, t; + NS_TYPE n; + LS_TYPE l; + MS_TYPE m, m_t; + + SPECIES_TYPE *mus; + NS_TYPE *ns; + LS_TYPE *ls; + MS_TYPE *ms; + + int j, jj, func_ind, ms_ind; + SHORT_INT_TYPE factor; + + ACEComplex Y{0}, Y_DR{0.}; + ACEComplex B{0.}; + ACEComplex dB{0}; + ACEComplex A_cache[basis_set->rankmax]; + + dB_flatten.fill({0.}); + + ACEDYcomponent grad_phi_nlm{0}, DY{0.}; + + //size is +1 of max to avoid out-of-boundary array access in double-triangular scheme + ACEComplex A_forward_prod[basis_set->rankmax + 1]; + ACEComplex A_backward_prod[basis_set->rankmax + 1]; + + DOUBLE_TYPE inv_r_norm; + DOUBLE_TYPE r_norms[jnum]; + DOUBLE_TYPE inv_r_norms[jnum]; + DOUBLE_TYPE rhats[jnum][3];//normalized vector + SPECIES_TYPE elements[jnum]; + const DOUBLE_TYPE xtmp = x[i][0]; + const DOUBLE_TYPE ytmp = x[i][1]; + const DOUBLE_TYPE ztmp = x[i][2]; + DOUBLE_TYPE f_ji[3]; + + bool is_element_mapping = element_type_mapping.get_size() > 0; + SPECIES_TYPE mu_i; + if (is_element_mapping) + mu_i = element_type_mapping(type[i]); + else + mu_i = type[i]; + + const SHORT_INT_TYPE total_basis_size_rank1 = basis_set->total_basis_size_rank1[mu_i]; + const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; + + ACECTildeBasisFunction *basis_rank1 = basis_set->basis_rank1[mu_i]; + ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; + + DOUBLE_TYPE rho_cut, drho_cut, fcut, dfcut; + DOUBLE_TYPE dF_drho_core; + + //TODO: lmax -> lmaxi (get per-species type) + const LS_TYPE lmaxi = basis_set->lmax; + + //TODO: nradmax -> nradiali (get per-species type) + const NS_TYPE nradiali = basis_set->nradmax; + + //TODO: nradbase -> nradbasei (get per-species type) + const NS_TYPE nradbasei = basis_set->nradbase; + + //TODO: get per-species type number of densities + const DENSITY_TYPE ndensity= basis_set->ndensitymax; + + neighbours_forces.resize(jnum, 3); + neighbours_forces.fill(0); + + //TODO: shift nullifications to place where arrays are used + weights.fill({0}); + weights_rank1.fill(0); + A.fill({0}); + A_rank1.fill(0); + rhos.fill(0); + dF_drho.fill(0); + +#ifdef EXTRA_C_PROJECTIONS + basis_projections_rank1.init(total_basis_size_rank1, ndensity, "c_projections_rank1"); + basis_projections.init(total_basis_size, ndensity, "c_projections"); +#endif + + //proxy references to spherical harmonics and radial functions arrays + const Array2DLM &ylm = basis_set->spherical_harmonics.ylm; + const Array2DLM &dylm = basis_set->spherical_harmonics.dylm; + + const Array2D &fr = basis_set->radial_functions->fr; + const Array2D &dfr = basis_set->radial_functions->dfr; + + const Array1D &gr = basis_set->radial_functions->gr; + const Array1D &dgr = basis_set->radial_functions->dgr; + + loop_over_neighbour_timer.start(); + + int jj_actual = 0; + SPECIES_TYPE type_j = 0; + int neighbour_index_mapping[jnum]; // jj_actual -> jj + //loop over neighbours, compute distance, consider only atoms within with rradial_functions->cut(mu_i, mu_j); + r_xyz = sqrt(xn * xn + yn * yn + zn * zn); + + if (r_xyz >= current_cutoff) + continue; + + inv_r_norm = 1 / r_xyz; + + r_norms[jj_actual] = r_xyz; + inv_r_norms[jj_actual] = inv_r_norm; + rhats[jj_actual][0] = xn * inv_r_norm; + rhats[jj_actual][1] = yn * inv_r_norm; + rhats[jj_actual][2] = zn * inv_r_norm; + elements[jj_actual] = mu_j; + neighbour_index_mapping[jj_actual] = jj; + jj_actual++; + } + + int jnum_actual = jj_actual; + + //ALGORITHM 1: Atomic base A + for (jj = 0; jj < jnum_actual; ++jj) { + r_norm = r_norms[jj]; + mu_j = elements[jj]; + r_hat = rhats[jj]; + + //proxies + Array2DLM &Y_jj = Y_cache(jj); + Array2DLM &DY_jj = DY_cache(jj); + + + basis_set->radial_functions->evaluate(r_norm, basis_set->nradbase, nradiali, mu_i, mu_j); + basis_set->spherical_harmonics.compute_ylm(r_hat[0], r_hat[1], r_hat[2], lmaxi); + //loop for computing A's + //rank = 1 + for (n = 0; n < basis_set->nradbase; n++) { + GR = gr(n); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("-neigh atom %d\n", jj); + printf("gr(n=%d)(r=%f) = %f\n", n, r_norm, gr(n)); + printf("dgr(n=%d)(r=%f) = %f\n", n, r_norm, dgr(n)); +#endif + DG_cache(jj, n) = dgr(n); + A_rank1(mu_j, n) += GR * Y00; + } + //loop for computing A's + // for rank > 1 + for (n = 0; n < nradiali; n++) { + auto &A_lm = A(mu_j, n); + for (l = 0; l <= lmaxi; l++) { + R = fr(n, l); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("R(nl=%d,%d)(r=%f)=%f\n", n + 1, l, r_norm, R); +#endif + + DR_cache(jj, n, l) = dfr(n, l); + R_cache(jj, n, l) = R; + + for (m = 0; m <= l; m++) { + Y = ylm(l, m); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("Y(lm=%d,%d)=(%f, %f)\n", l, m, Y.real, Y.img); +#endif + A_lm(l, m) += R * Y; //accumulation sum over neighbours + Y_jj(l, m) = Y; + DY_jj(l, m) = dylm(l, m); + } + } + } + + //hard-core repulsion + rho_core += basis_set->radial_functions->cr; + DCR_cache(jj) = basis_set->radial_functions->dcr; + + } //end loop over neighbours + + //complex conjugate A's (for NEGATIVE (-m) terms) + // for rank > 1 + for (mu_j = 0; mu_j < basis_set->nelements; mu_j++) { + for (n = 0; n < nradiali; n++) { + auto &A_lm = A(mu_j, n); + for (l = 0; l <= lmaxi; l++) { + //fill in -m part in the outer loop using the same m <-> -m symmetry as for Ylm + for (m = 1; m <= l; m++) { + factor = m % 2 == 0 ? 1 : -1; + A_lm(l, -m) = A_lm(l, m).conjugated() * factor; + } + } + } + } //now A's are constructed + loop_over_neighbour_timer.stop(); + + // ==================== ENERGY ==================== + + energy_calc_timer.start(); +#ifdef EXTRA_C_PROJECTIONS + basis_projections_rank1.fill(0); + basis_projections.fill(0); +#endif + + //ALGORITHM 2: Basis functions B with iterative product and density rho(p) calculation + //rank=1 + for (int func_rank1_ind = 0; func_rank1_ind < total_basis_size_rank1; ++func_rank1_ind) { + ACECTildeBasisFunction *func = &basis_rank1[func_rank1_ind]; +// ndensity = func->ndensity; +#ifdef PRINT_LOOPS_INDICES + printf("Num density = %d r = 0\n",(int) ndensity ); + print_C_tilde_B_basis_function(*func); +#endif + double A_cur = A_rank1(func->mus[0], func->ns[0] - 1); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("A_r=1(x=%d, n=%d)=(%f)\n", func->mus[0], func->ns[0], A_cur); + printf(" coeff[0] = %f\n", func->ctildes[0]); +#endif + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 + rhos(p) += func->ctildes[p] * A_cur; +#ifdef EXTRA_C_PROJECTIONS + //aggregate C-projections separately + basis_projections_rank1(func_rank1_ind, p)+= func->ctildes[p] * A_cur; +#endif + } + } // end loop for rank=1 + + //rank>1 + int func_ms_ind = 0; + int func_ms_t_ind = 0;// index for dB + + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; + //TODO: check if func->ctildes are zero, then skip +// ndensity = func->ndensity; + rank = func->rank; + r = rank - 1; +#ifdef PRINT_LOOPS_INDICES + printf("Num density = %d r = %d\n",(int) ndensity, (int)r ); + print_C_tilde_B_basis_function(*func); +#endif + mus = func->mus; + ns = func->ns; + ls = func->ls; + + //loop over {ms} combinations in sum + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * rank]; // current ms-combination (of length = rank) + + //loop over m, collect B = product of A with given ms + A_forward_prod[0] = 1; + A_backward_prod[r] = 1; + + //fill forward A-product triangle + for (t = 0; t < rank; t++) { + //TODO: optimize ns[t]-1 -> ns[t] during functions construction + A_cache[t] = A(mus[t], ns[t] - 1, ls[t], ms[t]); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("A(x=%d, n=%d, l=%d, m=%d)=(%f,%f)\n", mus[t], ns[t], ls[t], ms[t], A_cache[t].real, + A_cache[t].img); +#endif + A_forward_prod[t + 1] = A_forward_prod[t] * A_cache[t]; + } + + B = A_forward_prod[t]; + +#ifdef DEBUG_FORCES_CALCULATIONS + printf("B = (%f, %f)\n", (B).real, (B).img); +#endif + //fill backward A-product triangle + for (t = r; t >= 1; t--) { + A_backward_prod[t - 1] = + A_backward_prod[t] * A_cache[t]; + } + + for (t = 0; t < rank; ++t, ++func_ms_t_ind) { + dB = A_forward_prod[t] * A_backward_prod[t]; //dB - product of all A's except t-th + dB_flatten(func_ms_t_ind) = dB; +#ifdef DEBUG_FORCES_CALCULATIONS + m_t = ms[t]; + printf("dB(n,l,m)(%d,%d,%d) = (%f, %f)\n", ns[t], ls[t], m_t, (dB).real, (dB).img); +#endif + } + + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + //real-part only multiplication + rhos(p) += B.real_part_product(func->ctildes[ms_ind * ndensity + p]); + +#ifdef EXTRA_C_PROJECTIONS + //aggregate C-projections separately + basis_projections(func_ind, p)+=B.real_part_product(func->ctildes[ms_ind * ndensity + p]); +#endif + +#ifdef PRINT_INTERMEDIATE_VALUES + printf("rhos(%d) += %f\n", p, B.real_part_product(func->ctildes[ms_ind * ndensity + p])); + printf("Rho[i = %d][p = %d] = %f\n", i , p , rhos(p)); +#endif + } + }//end of loop over {ms} combinations in sum + }// end loop for rank>1 + +#ifdef DEBUG_FORCES_CALCULATIONS + printf("rhos = "); + for(DENSITY_TYPE p =0; prho_core_cutoffs(mu_i); + drho_cut = basis_set->drho_core_cutoffs(mu_i); + + basis_set->inner_cutoff(rho_core, rho_cut, drho_cut, fcut, dfcut); + basis_set->FS_values_and_derivatives(rhos, evdwl, dF_drho, ndensity); + + dF_drho_core = evdwl * dfcut + 1; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) + dF_drho(p) *= fcut; + evdwl_cut = evdwl * fcut + rho_core; + + // E0 shift + evdwl_cut += basis_set->E0vals(mu_i); + +#ifdef DEBUG_FORCES_CALCULATIONS + printf("dFrhos = "); + for(DENSITY_TYPE p =0; pndensity; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 + weights_rank1(func->mus[0], func->ns[0] - 1) += dF_drho(p) * func->ctildes[p]; + } + } + + // rank>1 + func_ms_ind = 0; + func_ms_t_ind = 0;// index for dB + DOUBLE_TYPE theta = 0; + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; +// ndensity = func->ndensity; + rank = func->rank; + mus = func->mus; + ns = func->ns; + ls = func->ls; + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * rank]; + theta = 0; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + theta += dF_drho(p) * func->ctildes[ms_ind * ndensity + p]; +#ifdef DEBUG_FORCES_CALCULATIONS + printf("(p=%d) theta += dF_drho[p] * func.ctildes[ms_ind * ndensity + p] = %f * %f = %f\n",p, dF_drho(p), func->ctildes[ms_ind * ndensity + p],dF_drho(p)*func->ctildes[ms_ind * ndensity + p]); + printf("theta=%f\n",theta); +#endif + } + + theta *= 0.5; // 0.5 factor due to possible double counting ??? + for (t = 0; t < rank; ++t, ++func_ms_t_ind) { + m_t = ms[t]; + factor = (m_t % 2 == 0 ? 1 : -1); + dB = dB_flatten(func_ms_t_ind); + weights(mus[t], ns[t] - 1, ls[t], m_t) += theta * dB; //Theta_array(func_ms_ind); + // update -m_t (that could also be positive), because the basis is half_basis + weights(mus[t], ns[t] - 1, ls[t], -m_t) += + theta * (dB).conjugated() * factor;// Theta_array(func_ms_ind); +#ifdef DEBUG_FORCES_CALCULATIONS + printf("dB(n,l,m)(%d,%d,%d) = (%f, %f)\n", ns[t], ls[t], m_t, (dB).real, (dB).img); + printf("theta = %f\n",theta); + printf("weights(n,l,m)(%d,%d,%d) += (%f, %f)\n", ns[t], ls[t], m_t, (theta * dB * 0.5).real, + (theta * dB * 0.5).img); + printf("weights(n,l,-m)(%d,%d,%d) += (%f, %f)\n", ns[t], ls[t], -m_t, + ( theta * (dB).conjugated() * factor * 0.5).real, + ( theta * (dB).conjugated() * factor * 0.5).img); +#endif + } + } + } + energy_calc_timer.stop(); + +// ==================== FORCES ==================== +#ifdef PRINT_MAIN_STEPS + printf("\nFORCE CALCULATION\n"); + printf("loop over neighbours\n"); +#endif + + forces_calc_loop_timer.start(); +// loop over neighbour atoms for force calculations + for (jj = 0; jj < jnum_actual; ++jj) { + mu_j = elements[jj]; + r_hat = rhats[jj]; + inv_r_norm = inv_r_norms[jj]; + + Array2DLM &Y_cache_jj = Y_cache(jj); + Array2DLM &DY_cache_jj = DY_cache(jj); + +#ifdef PRINT_LOOPS_INDICES + printf("\nneighbour atom #%d\n", jj); + printf("rhat = (%f, %f, %f)\n", r_hat[0], r_hat[1], r_hat[2]); +#endif + + forces_calc_neighbour_timer.start(); + + f_ji[0] = f_ji[1] = f_ji[2] = 0; + +//for rank = 1 + for (n = 0; n < nradbasei; ++n) { + if (weights_rank1(mu_j, n) == 0) + continue; + auto &DG = DG_cache(jj, n); + DGR = DG * Y00; + DGR *= weights_rank1(mu_j, n); +#ifdef DEBUG_FORCES_CALCULATIONS + printf("r=1: (n,l,m)=(%d, 0, 0)\n",n+1); + printf("\tGR(n=%d, r=%f)=%f\n",n+1,r_norm, gr(n)); + printf("\tDGR(n=%d, r=%f)=%f\n",n+1,r_norm, dgr(n)); + printf("\tdF+=(%f, %f, %f)\n",DGR * r_hat[0], DGR * r_hat[1], DGR * r_hat[2]); +#endif + f_ji[0] += DGR * r_hat[0]; + f_ji[1] += DGR * r_hat[1]; + f_ji[2] += DGR * r_hat[2]; + } + +//for rank > 1 + for (n = 0; n < nradiali; n++) { + for (l = 0; l <= lmaxi; l++) { + R_over_r = R_cache(jj, n, l) * inv_r_norm; + DR = DR_cache(jj, n, l); + + // for m>=0 + for (m = 0; m <= l; m++) { + ACEComplex w = weights(mu_j, n, l, m); + if (w == 0) + continue; + //counting for -m cases if m>0 + if (m > 0) w *= 2; + + DY = DY_cache_jj(l, m); + Y_DR = Y_cache_jj(l, m) * DR; + + grad_phi_nlm.a[0] = Y_DR * r_hat[0] + DY.a[0] * R_over_r; + grad_phi_nlm.a[1] = Y_DR * r_hat[1] + DY.a[1] * R_over_r; + grad_phi_nlm.a[2] = Y_DR * r_hat[2] + DY.a[2] * R_over_r; +#ifdef DEBUG_FORCES_CALCULATIONS + printf("d_phi(n=%d, l=%d, m=%d) = ((%f,%f), (%f,%f), (%f,%f))\n",n+1,l,m, + grad_phi_nlm.a[0].real, grad_phi_nlm.a[0].img, + grad_phi_nlm.a[1].real, grad_phi_nlm.a[1].img, + grad_phi_nlm.a[2].real, grad_phi_nlm.a[2].img); + + printf("weights(n,l,m)(%d,%d,%d) = (%f,%f)\n", n+1, l, m,w.real, w.img); + //if (m>0) w*=2; + printf("dF(n,l,m)(%d, %d, %d) += (%f, %f, %f)\n", n + 1, l, m, + w.real_part_product(grad_phi_nlm.a[0]), + w.real_part_product(grad_phi_nlm.a[1]), + w.real_part_product(grad_phi_nlm.a[2]) + ); +#endif +// real-part multiplication only + f_ji[0] += w.real_part_product(grad_phi_nlm.a[0]); + f_ji[1] += w.real_part_product(grad_phi_nlm.a[1]); + f_ji[2] += w.real_part_product(grad_phi_nlm.a[2]); + } + } + } + + +#ifdef PRINT_INTERMEDIATE_VALUES + printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, + f_ji[0], f_ji[1], f_ji[2] + ); +#endif + + //hard-core repulsion + DCR = DCR_cache(jj); +#ifdef DEBUG_FORCES_CALCULATIONS + printf("DCR = %f\n",DCR); +#endif + f_ji[0] += dF_drho_core * DCR * r_hat[0]; + f_ji[1] += dF_drho_core * DCR * r_hat[1]; + f_ji[2] += dF_drho_core * DCR * r_hat[2]; +#ifdef PRINT_INTERMEDIATE_VALUES + printf("with core-repulsion\n"); + printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, + f_ji[0], f_ji[1], f_ji[2] + ); + printf("neighbour_index_mapping[jj=%d]=%d\n",jj,neighbour_index_mapping[jj]); +#endif + + neighbours_forces(neighbour_index_mapping[jj], 0) = f_ji[0]; + neighbours_forces(neighbour_index_mapping[jj], 1) = f_ji[1]; + neighbours_forces(neighbour_index_mapping[jj], 2) = f_ji[2]; + + forces_calc_neighbour_timer.stop(); + }// end loop over neighbour atoms for forces + + forces_calc_loop_timer.stop(); + + //now, energies and forces are ready + //energies(i) = evdwl + rho_core; + e_atom = evdwl_cut; + +#ifdef PRINT_INTERMEDIATE_VALUES + printf("energies(i) = FS(...rho_p_accum...) = %f\n", evdwl); +#endif + per_atom_calc_timer.stop(); +} \ No newline at end of file diff --git a/lib/pace/ace_evaluator.h b/lib/pace/ace_evaluator.h new file mode 100644 index 0000000000..356ea52563 --- /dev/null +++ b/lib/pace/ace_evaluator.h @@ -0,0 +1,230 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Yury Lysogorskiy on 31.01.20. + +#ifndef ACE_EVALUATOR_H +#define ACE_EVALUATOR_H + +#include "ace_abstract_basis.h" +#include "ace_arraynd.h" +#include "ace_array2dlm.h" +#include "ace_c_basis.h" +#include "ace_complex.h" +#include "ace_timing.h" +#include "ace_types.h" + +/** + * Basic evaluator class, that should accept the basis set and implement the "compute_atom" method using given basis set. + */ +class ACEEvaluator { +protected: + + Array2D A_rank1 = Array2D("A_rank1"); ///< 2D-array for storing A's for rank=1, shape: A(mu_j,n) + Array4DLM A = Array4DLM("A"); ///< 4D array with (l,m) last indices for storing A's for rank>1: A(mu_j, n, l, m) + + Array1D rhos = Array1D("rhos"); ///< densities \f$ \rho^{(p)} \f$(ndensity), p = 0 .. ndensity-1 + Array1D dF_drho = Array1D("dF_drho"); ///< derivatives of cluster functional wrt. densities, index = 0 .. ndensity-1 + + /** + * Initialize internal arrays according to basis set sizes + * @param basis_set + */ + void init(ACEAbstractBasisSet *basis_set); + +public: + // set of timers for code profiling + + ACETimer loop_over_neighbour_timer; ///< timer for loop over neighbours when constructing A's for single central atom + ACETimer per_atom_calc_timer; ///< timer for single compute_atom call + + + ACETimer forces_calc_loop_timer; ///< timer for forces calculations for single central atom + ACETimer forces_calc_neighbour_timer; ///< timer for loop over neighbour atoms for force calculations + + ACETimer energy_calc_timer; ///< timer for energy calculation + ACETimer total_time_calc_timer; ///< timer for total calculations of all atoms within given atomic environment system + + /** + * Initialize all timers + */ + void init_timers(); + + /** + * Mapping from external atoms types, i.e. LAMMPS, to internal SPECIES_TYPE, used in basis functions + */ + Array1D element_type_mapping = Array1D("element_type_mapping"); + + + DOUBLE_TYPE e_atom = 0; ///< energy of current atom, including core-repulsion + + /** + * temporary array for the pair forces between current atom_i and its neighbours atom_k + * neighbours_forces(k,3), k = 0..num_of_neighbours(atom_i)-1 + */ + Array2D neighbours_forces = Array2D("neighbours_forces"); + + ACEEvaluator() = default; + + virtual ~ACEEvaluator() = default; + + /** + * The key method to compute energy and forces for atom 'i'. + * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array + * + * @param i atom index + * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] + * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] + * @param jnum number of neighbours of atom_i + * @param jlist array of neighbour indices, shape: [jnum] + */ + virtual void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) = 0; + + /** + * Resize all caches over neighbours atoms + * @param max_jnum maximum number of neighbours + */ + virtual void resize_neighbours_cache(int max_jnum) = 0; + +#ifdef EXTRA_C_PROJECTIONS + /** + * 2D array to store projections of basis function for rank = 1, shape: [func_ind][ndensity] + */ + Array2D basis_projections_rank1 = Array2D("basis_projections_rank1"); + + /** + * 2D array to store projections of basis function for rank > 1, shape: [func_ind][ndensity] + */ + Array2D basis_projections = Array2D("basis_projections"); +#endif +}; + +//TODO: split into separate file +/** + * Evaluator for C-tilde basis set, that should accept the basis set and implement the "compute_atom" method using given basis set. + */ +class ACECTildeEvaluator : public ACEEvaluator { + + /** + * Weights \f$ \omega_{i \mu n 0 0} \f$ for rank = 1, see Eq.(10) from implementation notes, + * 'i' is fixed for the current atom, shape: [nelements][nradbase] + */ + Array2D weights_rank1 = Array2D("weights_rank1"); + + /** + * Weights \f$ \omega_{i \mu n l m} \f$ for rank > 1, see Eq.(10) from implementation notes, + * 'i' is fixed for the current atom, shape: [nelements][nradbase][l=0..lmax, m] + */ + Array4DLM weights = Array4DLM("weights"); + + /** + * cache for gradients of \f$ g(r)\f$: grad_phi(jj,n)=A2DLM(l,m) + * shape:[max_jnum][nradbase] + */ + Array2D DG_cache = Array2D("DG_cache"); + + + /** + * cache for \f$ R_{nl}(r)\f$ + * shape:[max_jnum][nradbase][0..lmax] + */ + Array3D R_cache = Array3D("R_cache"); + /** + * cache for derivatives of \f$ R_{nl}(r)\f$ + * shape:[max_jnum][nradbase][0..lmax] + */ + Array3D DR_cache = Array3D("DR_cache"); + /** + * cache for \f$ Y_{lm}(\hat{r})\f$ + * shape:[max_jnum][0..lmax][m] + */ + Array3DLM Y_cache = Array3DLM("Y_cache"); + /** + * cache for \f$ \nabla Y_{lm}(\hat{r})\f$ + * shape:[max_jnum][0..lmax][m] + */ + Array3DLM DY_cache = Array3DLM("dY_dense_cache"); + + /** + * cache for derivatives of hard-core repulsion + * shape:[max_jnum] + */ + Array1D DCR_cache = Array1D("DCR_cache"); + + /** + * Partial derivatives \f$ dB_{i \mu n l m t}^{(r)} \f$ with sequential numbering over [func_ind][ms_ind][r], + * shape:[func_ms_r_ind] + */ + Array1D dB_flatten = Array1D("dB_flatten"); + + /** + * pointer to the ACEBasisSet object + */ + ACECTildeBasisSet *basis_set = nullptr; + + /** + * Initialize internal arrays according to basis set sizes + * @param basis_set + */ + void init(ACECTildeBasisSet *basis_set); + +public: + + ACECTildeEvaluator() = default; + + explicit ACECTildeEvaluator(ACECTildeBasisSet &bas) { + set_basis(bas); + } + + /** + * set the basis function to the ACE evaluator + * @param bas + */ + void set_basis(ACECTildeBasisSet &bas); + + /** + * The key method to compute energy and forces for atom 'i'. + * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array + * + * @param i atom index + * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] + * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] + * @param jnum number of neighbours of atom_i + * @param jlist array of neighbour indices, shape: [jnum] + */ + void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) override; + + /** + * Resize all caches over neighbours atoms + * @param max_jnum maximum number of neighbours + */ + void resize_neighbours_cache(int max_jnum) override; +}; + + +#endif //ACE_EVALUATOR_H \ No newline at end of file diff --git a/lib/pace/ace_flatten_basis.cpp b/lib/pace/ace_flatten_basis.cpp new file mode 100644 index 0000000000..541785a202 --- /dev/null +++ b/lib/pace/ace_flatten_basis.cpp @@ -0,0 +1,130 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by yury on 28.04.2020. + +#include "ace_flatten_basis.h" + +ACEFlattenBasisSet::ACEFlattenBasisSet(const ACEFlattenBasisSet &other) { + _copy_scalar_memory(other); + _copy_dynamic_memory(other); +} + +ACEFlattenBasisSet &ACEFlattenBasisSet::operator=(const ACEFlattenBasisSet &other) { + if (this != &other) { + _clean(); + _copy_scalar_memory(other); + _copy_dynamic_memory(other); + } + return *this; +} + + +ACEFlattenBasisSet::~ACEFlattenBasisSet() { + ACEFlattenBasisSet::_clean(); +} + +void ACEFlattenBasisSet::_clean() { + //chained call of base class method + ACEAbstractBasisSet::_clean(); + _clean_contiguous_arrays(); + _clean_basissize_arrays(); + +} + +void ACEFlattenBasisSet::_clean_basissize_arrays() { + delete[] total_basis_size; + total_basis_size = nullptr; + + delete[] total_basis_size_rank1; + total_basis_size_rank1 = nullptr; +} + +void ACEFlattenBasisSet::_clean_contiguous_arrays() { + delete[] full_ns_rank1; + full_ns_rank1 = nullptr; + + delete[] full_ls_rank1; + full_ls_rank1 = nullptr; + + delete[] full_mus_rank1; + full_mus_rank1 = nullptr; + + delete[] full_ms_rank1; + full_ms_rank1 = nullptr; + + ////// + + delete[] full_ns; + full_ns = nullptr; + + delete[] full_ls; + full_ls = nullptr; + + delete[] full_mus; + full_mus = nullptr; + + delete[] full_ms; + full_ms = nullptr; +} + +void ACEFlattenBasisSet::_copy_scalar_memory(const ACEFlattenBasisSet &src) { + ACEAbstractBasisSet::_copy_scalar_memory(src); + + rank_array_total_size_rank1 = src.rank_array_total_size_rank1; + coeff_array_total_size_rank1 = src.coeff_array_total_size_rank1; + rank_array_total_size = src.rank_array_total_size; + ms_array_total_size = src.ms_array_total_size; + coeff_array_total_size = src.coeff_array_total_size; + + max_B_array_size = src.max_B_array_size; + max_dB_array_size = src.max_dB_array_size; + num_ms_combinations_max = src.num_ms_combinations_max; +} + +void ACEFlattenBasisSet::_copy_dynamic_memory(const ACEFlattenBasisSet &src) { //allocate new memory + + ACEAbstractBasisSet::_copy_dynamic_memory(src); + + if (src.total_basis_size_rank1 == nullptr) + throw runtime_error("Could not copy ACEFlattenBasisSet::total_basis_size_rank1 - array not initialized"); + if (src.total_basis_size == nullptr) + throw runtime_error("Could not copy ACEFlattenBasisSet::total_basis_size - array not initialized"); + + delete[] total_basis_size_rank1; + total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; + delete[] total_basis_size; + total_basis_size = new SHORT_INT_TYPE[nelements]; + + //copy + for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { + total_basis_size_rank1[mu] = src.total_basis_size_rank1[mu]; + total_basis_size[mu] = src.total_basis_size[mu]; + } +} + diff --git a/lib/pace/ace_flatten_basis.h b/lib/pace/ace_flatten_basis.h new file mode 100644 index 0000000000..e21cbb749a --- /dev/null +++ b/lib/pace/ace_flatten_basis.h @@ -0,0 +1,135 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Lysogroskiy Yury on 28.04.2020. + +#ifndef ACE_EVALUATOR_ACE_FLATTEN_BASIS_H +#define ACE_EVALUATOR_ACE_FLATTEN_BASIS_H + + +#include "ace_abstract_basis.h" +#include "ace_c_basisfunction.h" +#include "ace_radial.h" +#include "ace_spherical_cart.h" +#include "ace_types.h" + +/** + * Basis set with basis function attributes, i.e. \f$ \mathbf{n}, \mathbf{l}, \mathbf{m}\f$, etc. + * packed into contiguous arrays for the cache-friendly memory layout. + */ +class ACEFlattenBasisSet : public ACEAbstractBasisSet { +public: + //arrays and its sizes for rank = 1 basis functions for packed basis + + size_t rank_array_total_size_rank1 = 0; ///< size for full_ns_rank1, full_ls_rank1, full_Xs_rank1 + size_t coeff_array_total_size_rank1 = 0; ///< size for full coefficients array (depends on B or C-Tilde basis) + + NS_TYPE *full_ns_rank1 = nullptr; ///< ns contiguous package [rank_array_total_size_rank1] + LS_TYPE *full_ls_rank1 = nullptr; ///< ls contiguous package [rank_array_total_size_rank1] + SPECIES_TYPE *full_mus_rank1 = nullptr; ///< mus contiguous package [rank_array_total_size_rank1] + MS_TYPE *full_ms_rank1 = nullptr; ///< m_s contiguous package[rank_array_total_size_rank1] + + //arrays and its sizes for rank > 1 basis functions for packed basis + size_t rank_array_total_size = 0; ///< size for full_ns, full_ls, full_Xs + size_t ms_array_total_size = 0; ///< size for full_ms array + size_t coeff_array_total_size = 0;///< size for full coefficients arrays (depends on B- or C- basis) + + NS_TYPE *full_ns = nullptr; ///< ns contiguous package [rank_array_total_size] + LS_TYPE *full_ls = nullptr; ///< ls contiguous package [rank_array_total_size] + SPECIES_TYPE *full_mus = nullptr; ///< mus contiguous package [rank_array_total_size] + MS_TYPE *full_ms = nullptr; ///< //m_s contiguous package [ms_array_total_size] + + /** + * Rearrange basis functions in contiguous memory to optimize cache access + */ + virtual void pack_flatten_basis() = 0; + + virtual void flatten_basis() = 0; + + //1D flat array basis representation: [mu] + SHORT_INT_TYPE *total_basis_size_rank1 = nullptr; ///< per-species type array of total_basis_rank1[mu] sizes + SHORT_INT_TYPE *total_basis_size = nullptr; ///< per-species type array of total_basis[mu] sizes + + size_t max_B_array_size = 0; ///< maximum over elements array size for B[func_ind][ms_ind] + size_t max_dB_array_size = 0; ///< maximum over elements array size for dB[func_ind][ms_ind][r] + + SHORT_INT_TYPE num_ms_combinations_max = 0; ///< maximum number of ms combinations among all basis functions + + /** + * Default constructor + */ + ACEFlattenBasisSet() = default; + + /** + * Copy constructor (see Rule of Three) + * @param other + */ + ACEFlattenBasisSet(const ACEFlattenBasisSet &other); + + /** + * operator= (see Rule of Three) + * @param other + * @return + */ + ACEFlattenBasisSet &operator=(const ACEFlattenBasisSet &other); + + /** + * Destructor (see Rule of Three) + */ + ~ACEFlattenBasisSet() override; + + // routines for copying and cleaning dynamic memory of the class (see Rule of Three) + /** + * Cleaning dynamic memory of the class (see. Rule of Three), + * must be idempotent for safety + */ + void _clean() override; + + /** + * Copying scalar variables + * @param src + */ + void _copy_scalar_memory(const ACEFlattenBasisSet &src); + + /** + * Copying and cleaning dynamic memory of the class (see. Rule of Three) + * @param src + */ + void _copy_dynamic_memory(const ACEFlattenBasisSet &src); + + /** + * Clean contiguous arrays + */ + virtual void _clean_contiguous_arrays(); + + /** + * Release dynamic arrays with basis set sizes + */ + void _clean_basissize_arrays(); +}; + +#endif //ACE_EVALUATOR_ACE_FLATTEN_BASIS_H diff --git a/lib/pace/ace_radial.cpp b/lib/pace/ace_radial.cpp new file mode 100644 index 0000000000..01348a719c --- /dev/null +++ b/lib/pace/ace_radial.cpp @@ -0,0 +1,566 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include +#include +#include + +#include "ace_radial.h" + +const DOUBLE_TYPE pi = 3.14159265358979323846264338327950288419; // pi + +ACERadialFunctions::ACERadialFunctions(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, + SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, string radbasename) { + init(nradb, lmax, nradial, deltaSplineBins, nelements, cutoff, radbasename); +} + +void ACERadialFunctions::init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, + SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, string radbasename) { + this->nradbase = nradb; + this->lmax = lmax; + this->nradial = nradial; + this->deltaSplineBins = deltaSplineBins; + this->nelements = nelements; + this->cutoff = cutoff; + this->radbasename = radbasename; + + gr.init(nradbase, "gr"); + dgr.init(nradbase, "dgr"); + d2gr.init(nradbase, "d2gr"); + + + fr.init(nradial, lmax + 1, "fr"); + dfr.init(nradial, lmax + 1, "dfr"); + d2fr.init(nradial, lmax + 1, "d2fr"); + + + cheb.init(nradbase + 1, "cheb"); + dcheb.init(nradbase + 1, "dcheb"); + cheb2.init(nradbase + 1, "cheb2"); + + + splines_gk.init(nelements, nelements, "splines_gk"); + splines_rnl.init(nelements, nelements, "splines_rnl"); + splines_hc.init(nelements, nelements, "splines_hc"); + + lambda.init(nelements, nelements, "lambda"); + lambda.fill(1.); + + cut.init(nelements, nelements, "cut"); + cut.fill(1.); + + dcut.init(nelements, nelements, "dcut"); + dcut.fill(1.); + + crad.init(nelements, nelements, nradial, (lmax + 1), nradbase, "crad"); + crad.fill(0.); + + //hard-core repulsion + prehc.init(nelements, nelements, "prehc"); + prehc.fill(0.); + + lambdahc.init(nelements, nelements, "lambdahc"); + lambdahc.fill(1.); + +} + + +/** +Function that computes Chebyshev polynomials of first and second kind + to setup the radial functions and the derivatives + +@param n, x + +@returns cheb1, dcheb1 +*/ +void ACERadialFunctions::calcCheb(NS_TYPE n, DOUBLE_TYPE x) { + if (n < 0) { + char s[1024]; + sprintf(s, "The order n of the polynomials should be positive %d\n", n); + throw std::invalid_argument(s); + } + DOUBLE_TYPE twox = 2.0 * x; + cheb(0) = 1.; + dcheb(0) = 0.; + cheb2(0) = 1.; + + if (nradbase > 1) { + cheb(1) = x; + cheb2(1) = twox; + } + for (NS_TYPE m = 1; m <= n - 1; m++) { + cheb(m + 1) = twox * cheb(m) - cheb(m - 1); + cheb2(m + 1) = twox * cheb2(m) - cheb2(m - 1); + } + for (NS_TYPE m = 1; m <= n; m++) { + dcheb(m) = m * cheb2(m - 1); + } +#ifdef DEBUG_RADIAL + for ( NS_TYPE m=0; m<=n; m++ ) { + printf(" m %d cheb %f dcheb %f \n", m, cheb(m), dcheb(m)); + } +#endif +} + +/** +Function that computes radial basis. + +@param lam, nradbase, cut, dcut, r + +@returns gr, dgr +*/ +void ACERadialFunctions::radbase(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { + /*lam is given by the formula (24), that contains cut */ + + if (r < cut) { + if (radbasename == "ChebExpCos") { + chebExpCos(lam, cut, dcut, r); + } else if (radbasename == "ChebPow") { + chebPow(lam, cut, dcut, r); + } else if (radbasename == "ChebLinear") { + chebLinear(lam, cut, dcut, r); + } else { + throw invalid_argument("Unknown radial basis function name: " + radbasename); + } + } else { + gr.fill(0); + dgr.fill(0); + } +} + +/*** + * Radial function: ChebExpCos, cheb exp scaling including cos envelope + * @param lam function parameter + * @param cut cutoff distance + * @param r function input argument + * @return fills in gr and dgr arrays + */ +void +ACERadialFunctions::chebExpCos(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { + DOUBLE_TYPE y2, y1, x, dx; + DOUBLE_TYPE env, denv, fcut, dfcut; + /* scaled distance x and derivative*/ + y1 = exp(-lam * r / cut); + y2 = exp(-lam); + x = 1.0 - 2.0 * ((y1 - y2) / (1 - y2)); + dx = 2 * (lam / cut) * (y1 / (1 - y2)); + /* calculation of Chebyshev polynomials from the recursion */ + calcCheb(nradbase - 1, x); + gr(0) = cheb(0); + dgr(0) = dcheb(0) * dx; + for (NS_TYPE n = 2; n <= nradbase; n++) { + gr(n - 1) = 0.5 - 0.5 * cheb(n - 1); + dgr(n - 1) = -0.5 * dcheb(n - 1) * dx; + } + env = 0.5 * (1.0 + cos(M_PI * r / cut)); + denv = -0.5 * sin(M_PI * r / cut) * M_PI / cut; + for (NS_TYPE n = 0; n < nradbase; n++) { + dgr(n) = gr(n) * denv + dgr(n) * env; + gr(n) = gr(n) * env; + } + // for radtype = 3 a smooth cut is already included in the basis function + dx = cut - dcut; + if (r > dx) { + fcut = 0.5 * (1.0 + cos(M_PI * (r - dx) / dcut)); + dfcut = -0.5 * sin(M_PI * (r - dx) / dcut) * M_PI / dcut; + for (NS_TYPE n = 0; n < nradbase; n++) { + dgr(n) = gr(n) * dfcut + dgr(n) * fcut; + gr(n) = gr(n) * fcut; + } + } +} + +/*** +* Radial function: ChebPow, Radial function: ChebPow +* - argument of Chebyshev polynomials +* x = 2.0*( 1.0 - (1.0 - r/rcut)^lam ) - 1.0 +* - radial function +* gr(n) = ( 1.0 - Cheb(n) )/2.0, n = 1,...,nradbase +* - the function fulfills: +* gr(n) = 0 at rcut +* dgr(n) = 0 at rcut for lam >= 1 +* second derivative zero at rcut for lam >= 2 +* -> the radial function does not require a separate cutoff function +* - corresponds to radial basis radtype=5 in Fortran code +* +* @param lam function parameter +* @param cut cutoff distance +* @param r function input argument +* @return fills in gr and dgr arrays +*/ +void +ACERadialFunctions::chebPow(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { + DOUBLE_TYPE y, dy, x, dx; + /* scaled distance x and derivative*/ + y = (1.0 - r / cut); + dy = pow(y, (lam - 1.0)); + y = dy * y; + dy = -lam / cut * dy; + + x = 2.0 * (1.0 - y) - 1.0; + dx = -2.0 * dy; + calcCheb(nradbase, x); + for (NS_TYPE n = 1; n <= nradbase; n++) { + gr(n - 1) = 0.5 - 0.5 * cheb(n); + dgr(n - 1) = -0.5 * dcheb(n) * dx; + } +} + + +void +ACERadialFunctions::chebLinear(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { + DOUBLE_TYPE x, dx; + /* scaled distance x and derivative*/ + x = (1.0 - r / cut); + dx = -1 / cut; + calcCheb(nradbase, x); + for (NS_TYPE n = 1; n <= nradbase; n++) { + gr(n - 1) = 0.5 - 0.5 * cheb(n); + dgr(n - 1) = -0.5 * dcheb(n) * dx; + } +} + +/** +Function that computes radial functions. + +@param nradbase, nelements, elei, elej + +@returns fr, dfr +*/ +void ACERadialFunctions::radfunc(SPECIES_TYPE elei, SPECIES_TYPE elej) { + DOUBLE_TYPE frval, dfrval; + for (NS_TYPE n = 0; n < nradial; n++) { + for (LS_TYPE l = 0; l <= lmax; l++) { + frval = 0.0; + dfrval = 0.0; + for (NS_TYPE k = 0; k < nradbase; k++) { + frval += crad(elei, elej, n, l, k) * gr(k); + dfrval += crad(elei, elej, n, l, k) * dgr(k); + } + fr(n, l) = frval; + dfr(n, l) = dfrval; + } + } +} + + +void ACERadialFunctions::all_radfunc(SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, DOUBLE_TYPE r) { + DOUBLE_TYPE lam = lambda(mu_i, mu_j); + DOUBLE_TYPE r_cut = cut(mu_i, mu_j); + DOUBLE_TYPE dr_cut = dcut(mu_i, mu_j); + // set up radial functions + radbase(lam, r_cut, dr_cut, r); //update gr, dgr + radfunc(mu_i, mu_j); // update fr(nr, l), dfr(nr, l) +} + + +void ACERadialFunctions::setuplookupRadspline() { + using namespace std::placeholders; + DOUBLE_TYPE lam, r_cut, dr_cut; + DOUBLE_TYPE cr_c, dcr_c, pre, lamhc; + + // at r = rcut + eps the function and its derivatives is zero + for (SPECIES_TYPE elei = 0; elei < nelements; elei++) { + for (SPECIES_TYPE elej = 0; elej < nelements; elej++) { + + lam = lambda(elei, elej); + r_cut = cut(elei, elej); + dr_cut = dcut(elei, elej); + + splines_gk(elei, elej).setupSplines(gr.get_size(), + std::bind(&ACERadialFunctions::radbase, this, lam, r_cut, dr_cut, + _1),//update gr, dgr + gr.get_data(), + dgr.get_data(), deltaSplineBins, cutoff); + + splines_rnl(elei, elej).setupSplines(fr.get_size(), + std::bind(&ACERadialFunctions::all_radfunc, this, elei, elej, + _1), // update fr(nr, l), dfr(nr, l) + fr.get_data(), + dfr.get_data(), deltaSplineBins, cutoff); + + + pre = prehc(elei, elej); + lamhc = lambdahc(elei, elej); +// radcore(r, pre, lamhc, cutoff, cr_c, dcr_c); + splines_hc(elei, elej).setupSplines(1, + std::bind(&ACERadialFunctions::radcore, _1, pre, lamhc, cutoff, + std::ref(cr_c), std::ref(dcr_c)), + &cr_c, + &dcr_c, deltaSplineBins, cutoff); + } + } + +} + +/** +Function that gets radial function from look-up table using splines. + +@param r, nradbase_c, nradial_c, lmax, mu_i, mu_j + +@returns fr, dfr, gr, dgr, cr, dcr +*/ +void +ACERadialFunctions::evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, + SPECIES_TYPE mu_j, bool calc_second_derivatives) { + auto &spline_gk = splines_gk(mu_i, mu_j); + auto &spline_rnl = splines_rnl(mu_i, mu_j); + auto &spline_hc = splines_hc(mu_i, mu_j); + + spline_gk.calcSplines(r, calc_second_derivatives); // populate splines_gk.values, splines_gk.derivatives; + for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { + gr(nr) = spline_gk.values(nr); + dgr(nr) = spline_gk.derivatives(nr); + if (calc_second_derivatives) + d2gr(nr) = spline_gk.second_derivatives(nr); + } + + spline_rnl.calcSplines(r, calc_second_derivatives); + for (size_t ind = 0; ind < fr.get_size(); ind++) { + fr.get_data(ind) = spline_rnl.values.get_data(ind); + dfr.get_data(ind) = spline_rnl.derivatives.get_data(ind); + if (calc_second_derivatives) + d2fr.get_data(ind) = spline_rnl.second_derivatives.get_data(ind); + } + + spline_hc.calcSplines(r, calc_second_derivatives); + cr = spline_hc.values(0); + dcr = spline_hc.derivatives(0); + if (calc_second_derivatives) + d2cr = spline_hc.second_derivatives(0); +} + + +void +ACERadialFunctions::radcore(DOUBLE_TYPE r, DOUBLE_TYPE pre, DOUBLE_TYPE lambda, DOUBLE_TYPE cutoff, DOUBLE_TYPE &cr, + DOUBLE_TYPE &dcr) { +/* pseudocode for hard core repulsion +in: + r: distance + pre: prefactor: read from input, depends on pair of atoms mu_i mu_j + lambda: exponent: read from input, depends on pair of atoms mu_i mu_j + cutoff: cutoff distance: read from input, depends on pair of atoms mu_i mu_j +out: +cr: hard core repulsion +dcr: derivative of hard core repulsion + + function + \$f f_{core} = pre \exp( - \lambda r^2 ) / r \$f + +*/ + + DOUBLE_TYPE r2, lr2, y, x0, env, denv; + +// repulsion strictly positive and decaying + pre = abs(pre); + lambda = abs(lambda); + + r2 = r * r; + lr2 = lambda * r2; + if (lr2 < 50.0) { + y = exp(-lr2); + cr = pre * y / r; + dcr = -pre * y * (2.0 * lr2 + 1.0) / r2; + + x0 = r / cutoff; + env = 0.5 * (1.0 + cos(pi * x0)); + denv = -0.5 * sin(pi * x0) * pi / cutoff; + dcr = cr * denv + dcr * env; + cr = cr * env; + } else { + cr = 0.0; + dcr = 0.0; + } + +} + +void +ACERadialFunctions::evaluate_range(vector r_vec, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, + SPECIES_TYPE mu_j) { + if (nradbase_c > nradbase) + throw invalid_argument("nradbase_c couldn't be larger than nradbase"); + if (nradial_c > nradial) + throw invalid_argument("nradial_c couldn't be larger than nradial"); + if (mu_i > nelements) + throw invalid_argument("mu_i couldn't be larger than nelements"); + if (mu_j > nelements) + throw invalid_argument("mu_j couldn't be larger than nelements"); + + gr_vec.resize(r_vec.size(), nradbase_c); + dgr_vec.resize(r_vec.size(), nradbase_c); + d2gr_vec.resize(r_vec.size(), nradbase_c); + + fr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); + dfr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); + d2fr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); + + for (size_t i = 0; i < r_vec.size(); i++) { + DOUBLE_TYPE r = r_vec[i]; + this->evaluate(r, nradbase_c, nradial_c, mu_i, mu_j, true); + for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { + gr_vec(i, nr) = gr(nr); + dgr_vec(i, nr) = dgr(nr); + d2gr_vec(i, nr) = d2gr(nr); + } + + for (NS_TYPE nr = 0; nr < nradial_c; nr++) { + for (LS_TYPE l = 0; l <= lmax; l++) { + fr_vec(i, nr, l) = fr(nr, l); + dfr_vec(i, nr, l) = dfr(nr, l); + d2fr_vec(i, nr, l) = d2fr(nr, l); + + } + } + } + +} + +void SplineInterpolator::setupSplines(int num_of_functions, RadialFunctions func, + DOUBLE_TYPE *values, + DOUBLE_TYPE *dvalues, DOUBLE_TYPE deltaSplineBins, DOUBLE_TYPE cutoff) { + + this->deltaSplineBins = deltaSplineBins; + this->cutoff = cutoff; + this->ntot = static_cast(cutoff / deltaSplineBins); + + DOUBLE_TYPE r, c[4]; + this->num_of_functions = num_of_functions; + this->values.resize(num_of_functions); + this->derivatives.resize(num_of_functions); + this->second_derivatives.resize(num_of_functions); + + Array1D f1g(num_of_functions); + Array1D f1gd1(num_of_functions); + f1g.fill(0); + f1gd1.fill(0); + + nlut = ntot; + DOUBLE_TYPE f0, f1, f0d1, f1d1; + int idx; + + // cutoff is global cutoff + rscalelookup = (DOUBLE_TYPE) nlut / cutoff; + invrscalelookup = 1.0 / rscalelookup; + + lookupTable.init(ntot + 1, num_of_functions, 4); + if (values == nullptr & num_of_functions > 0) + throw invalid_argument("SplineInterpolator::setupSplines: values could not be null"); + if (dvalues == nullptr & num_of_functions > 0) + throw invalid_argument("SplineInterpolator::setupSplines: dvalues could not be null"); + + for (int n = nlut; n >= 1; n--) { + r = invrscalelookup * DOUBLE_TYPE(n); + func(r); //populate values and dvalues arrays + for (int func_id = 0; func_id < num_of_functions; func_id++) { + f0 = values[func_id]; + f1 = f1g(func_id); + f0d1 = dvalues[func_id] * invrscalelookup; + f1d1 = f1gd1(func_id); + // evaluate coefficients + c[0] = f0; + c[1] = f0d1; + c[2] = 3.0 * (f1 - f0) - f1d1 - 2.0 * f0d1; + c[3] = -2.0 * (f1 - f0) + f1d1 + f0d1; + // store coefficients + for (idx = 0; idx <= 3; idx++) + lookupTable(n, func_id, idx) = c[idx]; + + // evaluate function values and derivatives at current position + f1g(func_id) = c[0]; + f1gd1(func_id) = c[1]; + } + } + + +} + + +void SplineInterpolator::calcSplines(DOUBLE_TYPE r, bool calc_second_derivatives) { + DOUBLE_TYPE wl, wl2, wl3, w2l1, w3l2, w4l2; + DOUBLE_TYPE c[4]; + int func_id, idx; + DOUBLE_TYPE x = r * rscalelookup; + int nl = static_cast(floor(x)); + + if (nl <= 0) + throw std::invalid_argument("Encountered very small distance. Stopping."); + + if (nl < nlut) { + wl = x - DOUBLE_TYPE(nl); + wl2 = wl * wl; + wl3 = wl2 * wl; + w2l1 = 2.0 * wl; + w3l2 = 3.0 * wl2; + w4l2 = 6.0 * wl; + for (func_id = 0; func_id < num_of_functions; func_id++) { + for (idx = 0; idx <= 3; idx++) { + c[idx] = lookupTable(nl, func_id, idx); + } + values(func_id) = c[0] + c[1] * wl + c[2] * wl2 + c[3] * wl3; + derivatives(func_id) = (c[1] + c[2] * w2l1 + c[3] * w3l2) * rscalelookup; + if (calc_second_derivatives) + second_derivatives(func_id) = (c[2] + c[3] * w4l2) * rscalelookup * rscalelookup * 2; + } + } else { // fill with zeroes + values.fill(0); + derivatives.fill(0); + if (calc_second_derivatives) + second_derivatives.fill(0); + } +} + +void SplineInterpolator::calcSplines(DOUBLE_TYPE r, SHORT_INT_TYPE func_ind) { + DOUBLE_TYPE wl, wl2, wl3, w2l1, w3l2; + DOUBLE_TYPE c[4]; + int idx; + DOUBLE_TYPE x = r * rscalelookup; + int nl = static_cast(floor(x)); + + if (nl <= 0) + throw std::invalid_argument("Encountered very small distance. Stopping."); + + if (nl < nlut) { + wl = x - DOUBLE_TYPE(nl); + wl2 = wl * wl; + wl3 = wl2 * wl; + w2l1 = 2.0 * wl; + w3l2 = 3.0 * wl2; + + for (idx = 0; idx <= 3; idx++) { + c[idx] = lookupTable(nl, func_ind, idx); + } + values(func_ind) = c[0] + c[1] * wl + c[2] * wl2 + c[3] * wl3; + derivatives(func_ind) = (c[1] + c[2] * w2l1 + c[3] * w3l2) * rscalelookup; + + } else { // fill with zeroes + values(func_ind) = 0; + derivatives(func_ind) = 0; + } +} diff --git a/lib/pace/ace_radial.h b/lib/pace/ace_radial.h new file mode 100644 index 0000000000..e45cfaec79 --- /dev/null +++ b/lib/pace/ace_radial.h @@ -0,0 +1,324 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef ACE_RADIAL_FUNCTIONS_H +#define ACE_RADIAL_FUNCTIONS_H + +#include "ace_arraynd.h" +#include "ace_types.h" +#include + +using namespace std; + +//typedef void (*RadialFunctions)(DOUBLE_TYPE x); +typedef std::function RadialFunctions; + +/** + * Class that implement spline interpolation and caching for radial functions + */ +class SplineInterpolator { +public: + DOUBLE_TYPE cutoff = 0; ///< cutoff + DOUBLE_TYPE deltaSplineBins = 0.001; + int ntot = 10000; ///< Number of bins for look-up tables. + int nlut = 10000; ///< number of nodes in look-up table + DOUBLE_TYPE invrscalelookup = 1; ///< inverse of conversion coefficient from distance to lookup table within cutoff range + DOUBLE_TYPE rscalelookup = 1; ///< conversion coefficient from distance to lookup table within cutoff range + int num_of_functions = 0;///< number of functions to spline-interpolation + + Array1D values;// = Array1D("values"); ///< shape: [func_ind] + Array1D derivatives;// = Array1D("derivatives");///< shape: [func_ind] + Array1D second_derivatives;// = Array1D("second_derivatives");///< shape: [func_ind] + + Array3D lookupTable = Array3D("lookupTable");///< shape: [ntot+1][func_ind][4] + + /** + * Setup splines + * + * @param num_of_functions number of functions + * @param func subroutine, that update `values` and `dvalues` arrays + * @param values values + * @param dvalues derivatives + */ + void setupSplines(int num_of_functions, RadialFunctions func, + DOUBLE_TYPE *values, + DOUBLE_TYPE *dvalues, DOUBLE_TYPE deltaSplineBins, DOUBLE_TYPE cutoff); + + /** + * Populate `values` and `derivatives` arrays with a spline-interpolation for + * all functions + * + * @param r + * + * @return: populate 'values' and 'derivatives' + */ + void calcSplines(DOUBLE_TYPE r, bool calc_second_derivatives = false); + + /** + * Populate `values` and `derivatives` arrays with a spline-interpolation for + * all functions + * + * @param r + * + * @return: populate 'values' and 'derivatives' + */ + void calcSplines(DOUBLE_TYPE r, SHORT_INT_TYPE func_ind); +}; + +/** + * Interface class for radial basis functions with rank=1 (g_k), R_nl (rank>1) and hard-core repulsion radial functions + */ +class AbstractRadialBasis { +public: + SPECIES_TYPE nelements = 0; ///< number of elements + Array2D cut = Array2D("cut"); ///< cutoffs, shape: [nelements][nelements] + Array2D dcut = Array2D("dcut"); ///< decay of cutoff, shape: [nelements][nelements] + DOUBLE_TYPE cutoff = 0; ///< cutoff + +// int ntot = 10000; ///< Number of bins for look-up tables. + DOUBLE_TYPE deltaSplineBins; + LS_TYPE lmax = 0; ///< maximum value of `l` + NS_TYPE nradial = 0; ///< maximum number `n` of radial functions \f$ R_{nl}(r) \f$ + NS_TYPE nradbase = 0; ///< number of radial basis functions \f$ g_k(r) \f$ + + // Arrays for look-up tables. + Array2D splines_gk; ///< array of spline interpolator to store g_k, shape: [nelements][nelements] + Array2D splines_rnl; ///< array of spline interpolator to store R_nl, shape: [nelements][nelements] + Array2D splines_hc; ///< array of spline interpolator to store R_nl shape: [nelements][nelements] + //-------------------------------------------------------------------------- + + string radbasename = "ChebExpCos"; ///< type of radial basis functions \f$ g_{k}(r) \f$ (default="ChebExpCos") + + /** + Arrays to store radial functions. + */ + Array1D gr = Array1D("gr"); ///< g_k(r) functions, shape: [nradbase] + Array1D dgr = Array1D("dgr"); ///< derivatives of g_k(r) functions, shape: [nradbase] + Array1D d2gr = Array1D("d2gr"); ///< derivatives of g_k(r) functions, shape: [nradbase] + + Array2D fr = Array2D("fr"); ///< R_nl(r) functions, shape: [nradial][lmax+1] + Array2D dfr = Array2D( + "dfr"); ///< derivatives of R_nl(r) functions, shape: [nradial][lmax+1] + Array2D d2fr = Array2D( + "d2fr"); ///< derivatives of R_nl(r) functions, shape: [nradial][lmax+1] + + + + DOUBLE_TYPE cr; ///< hard-core repulsion + DOUBLE_TYPE dcr; ///< derivative of hard-core repulsion + DOUBLE_TYPE d2cr; ///< derivative of hard-core repulsion + + Array5D crad = Array5D( + "crad"); ///< expansion coefficients of radial functions into radial basis function, see Eq. (27) of PRB, shape: [nelements][nelements][lmax + 1][nradial][nradbase] + Array2D lambda = Array2D( + "lambda"); ///< distance scaling parameter Eq.(24) of PRB, shape: [nelements][nelements] + + Array2D prehc = Array2D( + "prehc"); ///< hard-core repulsion coefficients (prefactor), shape: [nelements][nelements] + Array2D lambdahc = Array2D( + "lambdahc");; ///< hard-core repulsion coefficients (lambdahc), shape: [nelements][nelements] + + virtual void + evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, + bool calc_second_derivatives = false) = 0; + + virtual void + init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, + string radbasename = "ChebExpCos") = 0; + + /** + * Function that sets up the look-up tables for spline-representation of radial functions. + */ + virtual void setuplookupRadspline() = 0; + + virtual AbstractRadialBasis *clone() const = 0; + + virtual ~AbstractRadialBasis() = default; +}; + + +/** +Class to store radial functions and their associated functions. \n +*/ +class ACERadialFunctions final : public AbstractRadialBasis { +public: + + //-------------------------------------------------------------------------- + + /** + Arrays to store Chebyshev polynomials. + */ + Array1D cheb = Array1D( + "cheb"); ///< Chebyshev polynomials of the first kind, shape: [nradbase+1] + Array1D dcheb = Array1D( + "dcheb"); ///< derivatives Chebyshev polynomials of the first kind, shape: [nradbase+1] + Array1D cheb2 = Array1D( + "cheb2"); ///< Chebyshev polynomials of the second kind, shape: [nradbase+1] + + //-------------------------------------------------------------------------- + + Array2D gr_vec; + Array2D dgr_vec; + Array2D d2gr_vec; + + Array3D fr_vec; + Array3D dfr_vec; + Array3D d2fr_vec; + //------------------------------------------------------------------------ + /** + * Default constructor + */ + ACERadialFunctions() = default; + + /** + * Parametrized constructor + * + * @param nradb number of radial basis function \f$ g_k(r) \f$ - nradbase + * @param lmax maximum orbital moment - lmax + * @param nradial maximum n-index of radial functions \f$ R_{nl}(r) \f$ - nradial + * @param ntot Number of bins for spline look-up tables. + * @param nelements numer of elements + * @param cutoff cutoff + * @param radbasename type of radial basis function \f$ g_k(r) \f$ (default: "ChebExpCos") + */ + ACERadialFunctions(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, + SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, string radbasename = "ChebExpCos"); + + /** + * Initialize arrays for given parameters + * + * @param nradb number of radial basis function \f$ g_k(r) \f$ - nradbase + * @param lmax maximum orbital moment - lmax + * @param nradial maximum n-index of radial functions \f$ R_{nl}(r) \f$ - nradial + * @param ntot Number of bins for spline look-up tables. + * @param nelements numer of elements + * @param cutoff cutoff + * @param radbasename type of radial basis function \f$ g_k(r) \f$ (default: "ChebExpCos") + */ + void init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, + string radbasename = "ChebExpCos") final; + + /** + * Destructor + */ + ~ACERadialFunctions() final = default; + + /** + * Function that computes Chebyshev polynomials of first and second kind + * to setup the radial functions and the derivatives + * + * @param n maximum polynom order + * @param x + * + * @returns fills cheb, dcheb and cheb2 arrays + */ + void calcCheb(NS_TYPE n, DOUBLE_TYPE x); + + /** + * Function that computes radial basis functions \$f g_k(r) \$f, see Eq.(21) of PRB paper + * @param lam \$f \lambda \$f parameter, see eq. (24) of PRB paper + * @param cut cutoff + * @param dcut cutoff decay + * @param r distance + * + * @return function fills gr and dgr arrays + */ + void radbase(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); + + /** + * Function that computes radial core repulsion \$f f_{core} = pre \exp( - \lambda r^2 ) / r \$f, + * and its derivative, see Eq.(27) of implementation notes. + * + * @param r distance + * @param pre prefactor: read from input, depends on pair of atoms mu_i mu_j + * @param lambda exponent: read from input, depends on pair of atoms mu_i mu_j + * @param cutoff cutoff distance: read from input, depends on pair of atoms mu_i mu_j + * @param cr (out) hard core repulsion + * @param dcr (out) derivative of hard core repulsion + */ + static void radcore(DOUBLE_TYPE r, DOUBLE_TYPE pre, DOUBLE_TYPE lambda, DOUBLE_TYPE cutoff, DOUBLE_TYPE &cr, + DOUBLE_TYPE &dcr); + + /** + * Function that sets up the look-up tables for spline-representation of radial functions. + */ + void setuplookupRadspline() final; + + /** + * Function that computes radial functions \f$ R_{nl}(r)\f$ (see Eq. 27 from PRB paper) + * and its derivatives for all range of n,l, + * ONLY if radial basis functions (gr and dgr) are computed. + * @param elei first species type + * @param elej second species type + * + * @return fills in fr, dfr arrays + */ + void radfunc(SPECIES_TYPE elei, SPECIES_TYPE elej); + + /** + * Compute all radial functions R_nl(r), radial basis functions g_k(r) and hard-core repulsion function hc(r) + * + * @param r distance + * @param nradbase_c + * @param nradial_c + * @param mu_i + * @param mu_j + * + * @return update gr(k), dgr(k), fr(n,l), dfr(n,l), cr, dcr + */ + void evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, + bool calc_second_derivatives = false) final; + + + void + evaluate_range(vector r_vec, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, + SPECIES_TYPE mu_j); + + void chebExpCos(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); + + void chebPow(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); + + void chebLinear(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); + + /** + * Setup all radial functions for element pair mu_i-mu_j and distance r + * @param mu_i first specie type + * @param mu_j second specie type + * @param r distance + * @return update fr(nr, l), dfr(nr, l) + */ + void all_radfunc(SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, DOUBLE_TYPE r); + + ACERadialFunctions *clone() const override { + return new ACERadialFunctions(*this); + }; +}; + +#endif \ No newline at end of file diff --git a/lib/pace/ace_recursive.cpp b/lib/pace/ace_recursive.cpp new file mode 100644 index 0000000000..c895418943 --- /dev/null +++ b/lib/pace/ace_recursive.cpp @@ -0,0 +1,1340 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Christoph Ortner on 20.12.2020 + +#include "ace_recursive.h" + +#include "ace_abstract_basis.h" +#include "ace_types.h" + +/* ------------------------------------------------------------ + * ACEDAG Implementation + * (just the DAG construction, not the traversal) + * ------------------------------------------------------------ */ + +/* Notes on different Tags: + * rec1 - first basic implementation + * rec2 - avoid index arithmetic, contiguous layout, + * canonical evaluator in ACE.jl format + * rec3 - split nodes into interior and leaf nodes + */ + +void ACEDAG::init(Array2D xAspec, + Array2D AAspec, + Array1D orders, + Array2D jl_coeffs, + int _heuristic ) { + + // remember which heuristic we want to use! + heuristic = _heuristic; + + /* stage one of the graph is just extracting the A basis from + * the tensor product format into the linear list; all information + * for that is already stored in Aspec, and the only thing to do here is + * to construct zero-coefficients. Still we have to copy Aspec, since + * the one we have here will (may?) be deleted. */ + int num1 = xAspec.get_dim(0); + Aspec = xAspec; //YL: just copying the multiarray: Aspec = xAspec; + + /* fill the one-particle basis into the DAGmap + * DAGmap[ (i1,...,in) ] = iAA index where the (i1,...,in) basis functions + * lives. + */ + TDAGMAP DAGmap; + for (int iA = 0; iA < num1; iA++) { + vector a(1); + a[0] = iA; + DAGmap[a] = iA; + } + + /* For stage 2 we now want to construct the actual recursion; the + recursion info will be stored in DAGspec, while the + coefficients go into DAGcoeffs. These arrays are initialized to + length `num2`, but they will have to grow as we add additional + artificial nodes into the graph. + + initially we treat all nodes as having children, but then in a + second stage below we reorganize. */ + int num2 = AAspec.get_dim(0); + int ndensity = jl_coeffs.get_dim(1); + nodes_pre.resize(2*num2, 2); + coeffs_pre.resize(2*num2, ndensity); + + /* the first basis function we construct will get index num1, + * since there are already num1 one-particle basis functions + * to collect during stage 1 */ + dag_idx = num1; + /* main loop over AA basis set to transform into DAG */ + for (int iAA = 0; iAA < num2; iAA++) { + // create a vector representing the current basis function + int ord = orders(iAA); + vector aa(ord); + for (int t = 0; t < ord; t++) aa[t] = AAspec(iAA, t); + vector c(ndensity); + for (int p = 0; p < ndensity; p++) c[p] = jl_coeffs(iAA, p); + insert_node(DAGmap, aa, c); + } + + /* convert to 3-stage format through reordering + * interior nodes first, then leaf nodes */ + + // allocate storage + num_nodes = dag_idx; // store total size of dag + // num_nodes - num1 = number of many-body nodes. + nodes.resize(num_nodes - num1, 2); + coeffs.resize(num_nodes - num1, ndensity); + + // find out which nodes have children + haschild.resize(num_nodes - num1); + haschild.fill(false); + for (int iAA = 0; iAA < num_nodes - num1; iAA++) { + if (nodes_pre(iAA, 0) >= num1) + haschild(nodes_pre(iAA, 0)-num1) = true; + if (nodes_pre(iAA, 1) >= num1) + haschild(nodes_pre(iAA, 1)-num1) = true; + } + + // to reorder the graph we need a fresh map from preordered indices to + // postordered indices; for the 1-particle basis the order remains the same. + // TODO: doesn't need to be a map, could be a vector. + map neworder; + for (int iA = 0; iA < num1; iA++) + neworder[iA] = iA; + + // insert all interior nodes + num2_int = 0; + num2_leaf = 0; + dag_idx = num1; + int i1, i2, i1pre, i2pre; + for (int iAA = 0; iAA < num_nodes - num1; iAA++) { + if (haschild(iAA)) { + num2_int += 1; + // indices into AAbuf before reordering + i1pre = nodes_pre(iAA, 0); + i2pre = nodes_pre(iAA, 1); + // indices into AAbuf after reordering + i1 = neworder[i1pre]; + i2 = neworder[i2pre]; + // insert the current node : iAA is old order, dag_idx is new order + neworder[num1+iAA] = dag_idx; + nodes(dag_idx-num1, 0) = i1; + nodes(dag_idx-num1, 1) = i2; + for (int t = 0; t < ndensity; t++) + coeffs(dag_idx-num1, t) = coeffs_pre(iAA, t); + dag_idx++; + } + } + + // insert all leaf nodes + for (int iAA = 0; iAA < num_nodes - num1; iAA++) { + if (!haschild(iAA)) { + num2_leaf += 1; + // indices into AAbuf before reordering + i1pre = nodes_pre(iAA, 0); + i2pre = nodes_pre(iAA, 1); + // insert the current node : no need to remember the new order now + nodes(dag_idx-num1, 0) = neworder[i1pre]; + nodes(dag_idx-num1, 1) = neworder[i2pre]; + for (int t = 0; t < ndensity; t++) + coeffs(dag_idx-num1, t) = coeffs_pre(iAA, t); + dag_idx++; + } + } +#ifdef DEBUG + cout << "num2_int = " << num2_int << "; num2_leaf = " << num2_leaf << "\n"; +#endif + // free up memory that is no longer needed + nodes_pre.resize(0, 0); + coeffs_pre.resize(0, 0); + haschild.resize(0); + + /* finalize dag: allocate buffer storage */ + AAbuf.resize(num1 + num2_int); + w.resize(num_nodes); + // TODO: technically only need num1 + num2_int for w, this can save one + // memory access later, probably not worth the crazy code duplication. +} + +void ACEDAG::insert_node(TDAGMAP &DAGmap, vector a, vector c) { + /* start with a list of all possible partitions into 2 groups + * and check whether any of these nodes are already in the dag */ + auto partitions = find_2partitions(a); + int ndensity = c.size(); + int num1 = get_num1(); + + // TODO: first try to find partitions into nodes that are already parents + // that way we will get more leaf nodes! + for (TPARTITION const& p : partitions) { + /* this is the good case; the parent nodes are both already in the + * graph; add the new node and return. This is also the only place in the + * code where an actual insert happens. */ + if (DAGmap.count(p.first) && DAGmap.count(p.second)) { + if (nodes_pre.get_dim(0) < dag_idx + 1) { //check if array is sufficiently large + int newsize = (dag_idx * 3) / 2; + nodes_pre.resize(newsize, 2); // grow arrays if necessary + coeffs_pre.resize(newsize, ndensity); + } + int i1 = DAGmap[p.first]; + int i2 = DAGmap[p.second]; + nodes_pre(dag_idx - num1, 0) = i1; + nodes_pre(dag_idx - num1, 1) = i2; + DAGmap[a] = dag_idx; + for (int p = 0; p < ndensity; p++) + coeffs_pre(dag_idx - num1, p) = c[p]; + dag_idx += 1; + return; + } + } + + /* if we are here, then this means, the new node cannot yet be inserted. + * We first need to insert some intermediate auxiliary nodes. For this + * we use a simple heuristic: + * try to find a partition where one of the two nodes are already + * in the graph, if there are several, then we remember the longest + * (this is a very greedy heuristic!!) + * .... (continue below) .... + */ + TPARTITION longest; + int longest_length = 0; + for (auto const& p : partitions) { + int len = 0; + if (DAGmap.count(p.first)) { + len = p.first.size(); + } else if (DAGmap.count(p.second)) { + len = p.second.size(); + } + if ((len > 0) && (len > longest_length)) { + longest_length = len; + longest = p; + } + } + + /* sanity check */ + if (longest_length == 0) { + std::stringstream error_message; + error_message << "WARNING : something has gone horribly wrong! `longest_length == 0`! \n"; + error_message << "a = ["; + for (int t = 0; t < a.size(); t++) + error_message << a[t] << ", "; + error_message << "]\n"; + throw std::logic_error(error_message.str()); +// return; + } + + /* If there is a partition with one component already in the graph, + * then we only need to add in the other component. Note that there will + * always be at least one such partition, namely all those containing + * a one-element node e.g. (1,2,3,4) -> (1,) (2,3,4) then (1,) is + * a one-particle basis function and hence always in the graph. + * If heuristic == 0, then we just take one of those partitionas and move on. + * + * We also accept the found partition if longest_length > 1. + * And we also accept it if we have a 2- or 3-correlation. + */ + + if ( (heuristic == 0) + || (longest_length > 1) + || (a.size() <= 3)) { + /* insert the other node that isn't in the DAG yet + * this is an artificial node so it gets zero-coefficients + * This step is recursive, so more than one node might be inserted here */ + vector cz(ndensity); + for (int i = 0; i < ndensity; i++) cz[i] = 0.0; + TPARTITION p = longest; + if (DAGmap.count(p.first)) + insert_node(DAGmap, p.second, cz); + else + insert_node(DAGmap, p.first, cz); + } + + /* Second heuristic : heuristic == 1 + * Focus on inserting artificial 2-correlations + */ + else if (heuristic == 1) { + // and we also know that longest_length == 1 and nu = a.size >= 4. + int nu = a.size(); + // generate an artificial partition + vector a1(2); + for (int i = 0; i < 2; i++) a1[i] = a[i]; + vector a2(nu - 2); + for (int i = 0; i < nu - 2; i++) a2[i] = a[2 + i]; + vector cz(ndensity); + for (int i = 0; i < cz.size(); i++) cz[i] = 0.0; + // and insert both (we know neither are in the DAG yet) + insert_node(DAGmap, a1, cz); + insert_node(DAGmap, a2, cz); + } else { + cout << "WARNING : something has gone horribly wrong! \n"; + // TODO: Throw and error here?!? + return; + } + + + + /* now we should be ready to insert the entire tuple `a` since there is now + * an eligible parent pair. Here we recompute the partition of `a`, but + * that's a small price to pay for a clearer code. Maybe this can be + * optimized a bit by wrapping it all into a while loop or having a second + * version of `insert_node` ... */ + insert_node(DAGmap, a, c); +} + +TPARTITIONS ACEDAG::find_2partitions(vector v) { + int N = v.size(); + int zo; + TPARTITIONS partitions; + TPARTITION part; + /* This is a fun little hack to extract all subsets of the indices 1:N + * the number i will have binary representation with each digit indicating + * whether or not that index belongs to the selected subset */ + for (int i = 1; i < (1< v1(N1); + vector v2(N2); + int i1 =0, i2 = 0; + p = 1; + for (int n = 0; n < N; n++) { + zo = ((i / p) % 2); + p *= 2; + if (zo == 1) { + v1[i1] = v[n]; + i1 += 1; + } else { + v2[i2] = v[n]; + i2 += 1; + } + } + part = make_pair(v1, v2); + partitions.push_back(part); + } + return partitions; +} + +void ACEDAG::print() { + cout << "DAG Specification: \n" ; + cout << " n1 : " << get_num1() << "\n"; + cout << " n2 : " << get_num2() << "\n"; + cout << " num_nodes : " << num_nodes << "\n"; + cout << "--------------------\n"; + cout << "A-spec: \n"; + for (int iA = 0; iA < get_num1(); iA++) { + cout << iA << " : " << Aspec(iA, 0) << + Aspec(iA, 1) << Aspec(iA, 2) << Aspec(iA, 3) << "\n"; + } + + cout << "-----------\n"; + cout << "AA-tree\n"; + + for (int iAA = 0; iAA < get_num2(); iAA++) { + cout << iAA + get_num1() << " : " << + nodes(iAA, 0) << ", " << nodes(iAA, 1) << "\n"; + } +} + + +/* ------------------------------------------------------------ + * ACERecursiveEvaluator + * ------------------------------------------------------------ */ + + +void ACERecursiveEvaluator::set_basis(ACECTildeBasisSet &bas, int heuristic) { + basis_set = &bas; + init(basis_set, heuristic); +} + +void ACERecursiveEvaluator::init(ACECTildeBasisSet *basis_set, int heuristic) { + + ACEEvaluator::init(basis_set); + + + weights.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, + "weights"); + + weights_rank1.init(basis_set->nelements, basis_set->nradbase, "weights_rank1"); + + + DG_cache.init(1, basis_set->nradbase, "DG_cache"); + DG_cache.fill(0); + + R_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "R_cache"); + R_cache.fill(0); + + DR_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "DR_cache"); + DR_cache.fill(0); + + Y_cache.init(1, basis_set->lmax + 1, "Y_cache"); + Y_cache.fill({0, 0}); + + DY_cache.init(1, basis_set->lmax + 1, "dY_dense_cache"); + DY_cache.fill({0.}); + + //hard-core repulsion + DCR_cache.init(1, "DCR_cache"); + DCR_cache.fill(0); + dB_flatten.init(basis_set->max_dB_array_size, "dB_flatten"); + + /* convert to ACE.jl format to prepare for construction of DAG + * This will fill the arrays jl_Aspec, jl_AAspec, jl_orders + */ + acejlformat(); + + // test_acejlformat(); + + // now pass this info into the DAG + dag.init(jl_Aspec, jl_AAspec, jl_orders, jl_coeffs, heuristic); + + // finally empty the temporary arrays to clear up the memory... + // TODO +} + + +void ACERecursiveEvaluator::acejlformat() { + + int func_ms_ind = 0; + int func_ms_t_ind = 0;// index for dB + int j, jj, func_ind, ms_ind; + + SPECIES_TYPE mu_i = 0;//TODO: multispecies + const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; + ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; + + int AAidx = 0; + RANK_TYPE order, t; + SPECIES_TYPE *mus; + NS_TYPE *ns; + LS_TYPE *ls; + MS_TYPE *ms; + + /* transform basis into new format: + [A1 ... A_num1] + [(i1,i2)(i1,i2)(...)(i1,i2,i3)(...)] + where each ia represents an A_{ia} + */ + + /* compute max values for mu, n, l, m */ + SPECIES_TYPE maxmu = 0; //TODO: multispecies + NS_TYPE maxn = basis_set->nradmax; + LS_TYPE maxl = basis_set->lmax; + RANK_TYPE maxorder = basis_set->rankmax; + const DENSITY_TYPE ndensity = basis_set->ndensitymax; + + int num1 = 0; + + + /* create a 4D lookup table for the 1-p basis + * TODO: replace with a map?? + */ + Array4D A_lookup(int(maxmu+1), int(maxn), int(maxl+1), int(2*maxl+1)); + for (int mu = 0; mu < maxmu+1; mu++) + for (int n = 0; n < maxn; n++) + for (int l = 0; l < maxl+1; l++) + for (int m = 0; m < 2*maxl+1; m++) + A_lookup(mu, n, l, m) = -1; + int A_idx = 0; // linear index of A basis function (1-particle) + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; +// func->print(); + order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * order]; + for (t = 0; t < order; t++) { + int iA = A_lookup(mus[t], ns[t]-1, ls[t], ms[t]+ls[t]); + if (iA == -1) { + A_lookup(mus[t], ns[t] - 1, ls[t], ms[t] + ls[t]) = A_idx; + A_idx += 1; + } + } + } + } + + /* create the reverse list: linear indixes to mu,l,m,n + this keeps only the basis functions we really need */ + num1 = A_idx; + Array2D & Aspec = jl_Aspec; + Aspec.resize(num1, 4); + // Array2D Aspec(num1, 4); + for (int mu = 0; mu <= maxmu; mu++) + for (int n = 1; n <= maxn; n++) + for (int l = 0; l <= maxl; l++) + for (int m = -l; m <= l; m++) { + int iA = A_lookup(mu, n-1, l, l+m); + if (iA != -1) { + Aspec(iA, 0) = mu; + Aspec(iA, 1) = n; + Aspec(iA, 2) = l; + Aspec(iA, 3) = m; + } + } + + /* ============ HALF-BASIS TRICK START ============ */ + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; + order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; + if (!( (mus[0] <= maxmu) && (ns[0] <= maxn) && (ls[0] <= maxl) )) + continue; + + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * order]; + + // find first positive and negative index + int pos_idx = order + 1; + int neg_idx = order + 1; + for (t = order-1; t >= 0; t--) + if (ms[t] > 0) pos_idx = t; + else if (ms[t] < 0) neg_idx = t; + + // if neg_idx < pos_idx then this means that ms is non-zero + // and that the first non-zero index is negative, hence this is + // a negative-sign tuple which we want to combine into + // its opposite. + if (neg_idx < pos_idx) { + // find the opposite tuple + int ms_ind2 = 0; + MS_TYPE *ms2; + bool found_opposite = false; + for (ms_ind2 = 0; ms_ind2 < func->num_ms_combs; ++ms_ind2) { + ms2 = &func->ms_combs[ms_ind2 * order]; + bool isopposite = true; + for (t = 0; t < order; t++) + if (ms[t] != -ms2[t]) { + isopposite = false; + break; + } + if (isopposite) { + found_opposite = true; + break; + } + } + + if (ms_ind == ms_ind2) { + cout << "WARNING - ms_ind == ms_ind2 \n"; + } + + // now we need to overwrite the coefficients + if (found_opposite) { + int sig = 1; + for (t = 0; t < order; t++) + if (ms[t] < 0) + sig *= -1; + for (int p = 0; p < ndensity; ++p) { + func->ctildes[ms_ind2 * ndensity + p] += + func->ctildes[ms_ind * ndensity + p]; + func->ctildes[ms_ind * ndensity + p] = 0.0; + } + } + } + } + } + + // /* ============ HALF-BASIS TRICK END ============ */ + + + /* count number of basis functions, keep only non-zero!! */ + int num2 = 0; + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; + for (ms_ind = 0; ms_ind < (&basis[func_ind])->num_ms_combs; ++ms_ind, ++func_ms_ind) { + // check that the coefficients are actually non-zero + bool isnonzero = false; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) + if (func->ctildes[ms_ind * ndensity + p] != 0.0) + isnonzero = true; + if (isnonzero) + num2++; + } + } + + + /* Now create the AA basis links into the A basis */ + num1 = A_idx; // total number of A-basis functions that we keep + // Array1D AAorders(num2); + Array1D & AAorders = jl_orders; + AAorders.resize(num2); + // Array2D AAspec(num2, maxorder); // specs of AA basis functions + Array2D & AAspec = jl_AAspec; + AAspec.resize(num2, maxorder); + jl_coeffs.resize(num2, ndensity); + AAidx = 0; // linear index into AA basis function + int len_flat = 0; + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; + order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; + if (!((mus[0] <= maxmu) && (ns[0] <= maxn) && (ls[0] <= maxl))) //fool-proofing of functions + continue; + + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * order]; + + // check that the coefficients are actually non-zero + bool iszero = true; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) + if (func->ctildes[ms_ind * ndensity + p] != 0.0) + iszero = false; + if (iszero) continue; + + AAorders(AAidx) = order; + for (t = 0; t < order; t++) { + int Ait = A_lookup(int(mus[t]), int(ns[t]-1), int(ls[t]), int(ms[t])+int(ls[t])); + AAspec(AAidx, t) = Ait; + len_flat += 1; + } + for (t = order; t < maxorder; t++) AAspec(AAidx, t) = -1; + /* copy over the coefficients */ + for (DENSITY_TYPE p = 0; p < ndensity; ++p) + jl_coeffs(AAidx, p) = func->ctildes[ms_ind * ndensity + p]; + AAidx += 1; + } + } + + // flatten the AAspec array + jl_AAspec_flat.resize(len_flat); + int idx_spec = 0; + for (int AAidx = 0; AAidx < jl_AAspec.get_dim(0); AAidx++) + for (int p = 0; p < jl_orders(AAidx); p++, idx_spec++) + jl_AAspec_flat(idx_spec) = jl_AAspec(AAidx, p); + +} + +void ACERecursiveEvaluator::test_acejlformat() { + + Array2D AAspec = jl_AAspec; + Array2D Aspec = jl_Aspec; + Array1D AAorders = jl_orders; + cout << "num2 = " << AAorders.get_dim(0) << "\n"; + int func_ms_ind = 0; + int func_ms_t_ind = 0;// index for dB + int j, jj, func_ind, ms_ind; + + SPECIES_TYPE mu_i = 0; + const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; + ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; + + RANK_TYPE order, t; + SPECIES_TYPE *mus; + NS_TYPE *ns; + LS_TYPE *ls; + MS_TYPE *ms; + + /* ==== test by printing the basis spec ====*/ + // TODO: convert this into an automatic consistency test + int iAA = 0; + for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { + ACECTildeBasisFunction *func = &basis[func_ind]; + order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; + // func->print(); + //loop over {ms} combinations in sum + for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { + ms = &func->ms_combs[ms_ind * order]; + + + cout << iAA << " : |"; + for (t = 0; t < order; t++) + cout << mus[t] << ";" << ns[t] << "," << ls[t] << "," << ms[t] << "|"; + cout << "\n"; + + cout << " ["; + for (t = 0; t < AAorders(iAA); t++) + cout << AAspec(iAA, int(t)) << ","; + cout << "]\n"; + cout << " |"; + for (t = 0; t < AAorders(iAA); t++) { + int iA = AAspec(iAA, t); + // cout << iA << ","; + cout << Aspec(iA, 0) << ";" + << Aspec(iA, 1) << "," + << Aspec(iA, 2) << "," + << Aspec(iA, 3) << "|"; + } + cout << "\n"; + iAA += 1; + } + } + /* ==== END TEST ==== */ + + +} + + + + +void ACERecursiveEvaluator::resize_neighbours_cache(int max_jnum) { + if(basis_set== nullptr) { + throw std::invalid_argument("ACERecursiveEvaluator: basis set is not assigned"); + } + if (R_cache.get_dim(0) < max_jnum) { + + //TODO: implement grow + R_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); + R_cache.fill(0); + + DR_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); + DR_cache.fill(0); + + DG_cache.resize(max_jnum, basis_set->nradbase); + DG_cache.fill(0); + + Y_cache.resize(max_jnum, basis_set->lmax + 1); + Y_cache.fill({0, 0}); + + DY_cache.resize(max_jnum, basis_set->lmax + 1); + DY_cache.fill({0}); + + //hard-core repulsion + DCR_cache.init(max_jnum, "DCR_cache"); + DCR_cache.fill(0); + } +} + + + +// double** r - atomic coordinates of atom I +// int* types - atomic types if atom I +// int **firstneigh - ptr to 1st J int value of each I atom. Usage: jlist = firstneigh[i]; +// Usage: j = jlist_of_i[jj]; +// jnum - number of J neighbors for each I atom. jnum = numneigh[i]; + +void +ACERecursiveEvaluator::compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) { + if(basis_set== nullptr) { + throw std::invalid_argument("ACERecursiveEvaluator: basis set is not assigned"); + } + per_atom_calc_timer.start(); +#ifdef PRINT_MAIN_STEPS + printf("\n ATOM: ind = %d r_norm=(%f, %f, %f)\n",i, x[i][0], x[i][1], x[i][2]); +#endif + DOUBLE_TYPE evdwl = 0, evdwl_cut = 0, rho_core = 0; + DOUBLE_TYPE r_norm; + DOUBLE_TYPE xn, yn, zn, r_xyz; + DOUBLE_TYPE R, GR, DGR, R_over_r, DR, DCR; + DOUBLE_TYPE *r_hat; + + SPECIES_TYPE mu_j; + RANK_TYPE r, rank, t; + NS_TYPE n; + LS_TYPE l; + MS_TYPE m, m_t; + + SPECIES_TYPE *mus; + NS_TYPE *ns; + LS_TYPE *ls; + MS_TYPE *ms; + + int j, jj, func_ind, ms_ind; + SHORT_INT_TYPE factor; + + ACEComplex Y{0}, Y_DR{0.}; + ACEComplex B{0.}; + ACEComplex dB{0}; + ACEComplex A_cache[basis_set->rankmax]; + + ACEComplex dA[basis_set->rankmax]; + int spec[basis_set->rankmax]; + + dB_flatten.fill({0.}); + + ACEDYcomponent grad_phi_nlm{0}, DY{0.}; + + //size is +1 of max to avoid out-of-boundary array access in double-triangular scheme + ACEComplex A_forward_prod[basis_set->rankmax + 1]; + ACEComplex A_backward_prod[basis_set->rankmax + 1]; + + DOUBLE_TYPE inv_r_norm; + DOUBLE_TYPE r_norms[jnum]; + DOUBLE_TYPE inv_r_norms[jnum]; + DOUBLE_TYPE rhats[jnum][3];//normalized vector + SPECIES_TYPE elements[jnum]; + const DOUBLE_TYPE xtmp = x[i][0]; + const DOUBLE_TYPE ytmp = x[i][1]; + const DOUBLE_TYPE ztmp = x[i][2]; + DOUBLE_TYPE f_ji[3]; + + bool is_element_mapping = element_type_mapping.get_size() > 0; + SPECIES_TYPE mu_i; + if (is_element_mapping) + mu_i = element_type_mapping(type[i]); + else + mu_i = type[i]; + + const SHORT_INT_TYPE total_basis_size_rank1 = basis_set->total_basis_size_rank1[mu_i]; + const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; + + ACECTildeBasisFunction *basis_rank1 = basis_set->basis_rank1[mu_i]; + ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; + + DOUBLE_TYPE rho_cut, drho_cut, fcut, dfcut; + DOUBLE_TYPE dF_drho_core; + + //TODO: lmax -> lmaxi (get per-species type) + const LS_TYPE lmaxi = basis_set->lmax; + + //TODO: nradmax -> nradiali (get per-species type) + const NS_TYPE nradiali = basis_set->nradmax; + + //TODO: nradbase -> nradbasei (get per-species type) + const NS_TYPE nradbasei = basis_set->nradbase; + + //TODO: get per-species type number of densities + const DENSITY_TYPE ndensity= basis_set->ndensitymax; + + neighbours_forces.resize(jnum, 3); + neighbours_forces.fill(0); + + //TODO: shift nullifications to place where arrays are used + weights.fill({0}); + weights_rank1.fill(0); + A.fill({0}); + A_rank1.fill(0); + rhos.fill(0); + dF_drho.fill(0); + +#ifdef EXTRA_C_PROJECTIONS + basis_projections_rank1.init(total_basis_size_rank1, ndensity, "c_projections_rank1"); + basis_projections.init(total_basis_size, ndensity, "c_projections"); +#endif + + //proxy references to spherical harmonics and radial functions arrays + const Array2DLM &ylm = basis_set->spherical_harmonics.ylm; + const Array2DLM &dylm = basis_set->spherical_harmonics.dylm; + + const Array2D &fr = basis_set->radial_functions->fr; + const Array2D &dfr = basis_set->radial_functions->dfr; + + const Array1D &gr = basis_set->radial_functions->gr; + const Array1D &dgr = basis_set->radial_functions->dgr; + + loop_over_neighbour_timer.start(); + + int jj_actual = 0; + SPECIES_TYPE type_j = 0; + int neighbour_index_mapping[jnum]; // jj_actual -> jj + //loop over neighbours, compute distance, consider only atoms within with rradial_functions->cut(mu_i, mu_j); + r_xyz = sqrt(xn * xn + yn * yn + zn * zn); + + if (r_xyz >= current_cutoff) + continue; + + inv_r_norm = 1 / r_xyz; + + r_norms[jj_actual] = r_xyz; + inv_r_norms[jj_actual] = inv_r_norm; + rhats[jj_actual][0] = xn * inv_r_norm; + rhats[jj_actual][1] = yn * inv_r_norm; + rhats[jj_actual][2] = zn * inv_r_norm; + elements[jj_actual] = mu_j; + neighbour_index_mapping[jj_actual] = jj; + jj_actual++; + } + + int jnum_actual = jj_actual; + + //ALGORITHM 1: Atomic base A + for (jj = 0; jj < jnum_actual; ++jj) { + r_norm = r_norms[jj]; + mu_j = elements[jj]; + r_hat = rhats[jj]; + + //proxies + Array2DLM &Y_jj = Y_cache(jj); + Array2DLM &DY_jj = DY_cache(jj); + + + basis_set->radial_functions->evaluate(r_norm, basis_set->nradbase, nradiali, mu_i, mu_j); + basis_set->spherical_harmonics.compute_ylm(r_hat[0], r_hat[1], r_hat[2], lmaxi); + //loop for computing A's + //rank = 1 + for (n = 0; n < basis_set->nradbase; n++) { + GR = gr(n); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("-neigh atom %d\n", jj); + printf("gr(n=%d)(r=%f) = %f\n", n, r_norm, gr(n)); + printf("dgr(n=%d)(r=%f) = %f\n", n, r_norm, dgr(n)); +#endif + DG_cache(jj, n) = dgr(n); + A_rank1(mu_j, n) += GR * Y00; + } + //loop for computing A's + // for rank > 1 + for (n = 0; n < nradiali; n++) { + auto &A_lm = A(mu_j, n); + for (l = 0; l <= lmaxi; l++) { + R = fr(n, l); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("R(nl=%d,%d)(r=%f)=%f\n", n + 1, l, r_norm, R); +#endif + + DR_cache(jj, n, l) = dfr(n, l); + R_cache(jj, n, l) = R; + + for (m = 0; m <= l; m++) { + Y = ylm(l, m); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("Y(lm=%d,%d)=(%f, %f)\n", l, m, Y.real, Y.img); +#endif + A_lm(l, m) += R * Y; //accumulation sum over neighbours + Y_jj(l, m) = Y; + DY_jj(l, m) = dylm(l, m); + } + } + } + + //hard-core repulsion + rho_core += basis_set->radial_functions->cr; + DCR_cache(jj) = basis_set->radial_functions->dcr; + + } //end loop over neighbours + + //complex conjugate A's (for NEGATIVE (-m) terms) + // for rank > 1 + for (mu_j = 0; mu_j < basis_set->nelements; mu_j++) { + for (n = 0; n < nradiali; n++) { + auto &A_lm = A(mu_j, n); + for (l = 0; l <= lmaxi; l++) { + //fill in -m part in the outer loop using the same m <-> -m symmetry as for Ylm + for (m = 1; m <= l; m++) { + factor = m % 2 == 0 ? 1 : -1; + A_lm(l, -m) = A_lm(l, m).conjugated() * factor; + } + } + } + } //now A's are constructed + loop_over_neighbour_timer.stop(); + + // ==================== ENERGY ==================== + + energy_calc_timer.start(); +#ifdef EXTRA_C_PROJECTIONS + basis_projections_rank1.fill(0); + basis_projections.fill(0); +#endif + + //ALGORITHM 2: Basis functions B with iterative product and density rho(p) calculation + //rank=1 + for (int func_rank1_ind = 0; func_rank1_ind < total_basis_size_rank1; ++func_rank1_ind) { + ACECTildeBasisFunction *func = &basis_rank1[func_rank1_ind]; +// ndensity = func->ndensity; +#ifdef PRINT_LOOPS_INDICES + printf("Num density = %d r = 0\n",(int) ndensity ); + print_C_tilde_B_basis_function(*func); +#endif + double A_cur = A_rank1(func->mus[0], func->ns[0] - 1); +#ifdef DEBUG_ENERGY_CALCULATIONS + printf("A_r=1(x=%d, n=%d)=(%f)\n", func->mus[0], func->ns[0], A_cur); + printf(" coeff[0] = %f\n", func->ctildes[0]); +#endif + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 + rhos(p) += func->ctildes[p] * A_cur; +#ifdef EXTRA_C_PROJECTIONS + //aggregate C-projections separately + basis_projections_rank1(func_rank1_ind, p)+= func->ctildes[p] * A_cur; +#endif + } + } // end loop for rank=1 + + // ================ START RECURSIVE EVALUATOR ==================== + // (rank > 1 only) + + /* STAGE 1: + * 1-particle basis is already evaluated, so we only need to + * copy it into the AA value buffer + */ + int num1 = dag.get_num1(); + for (int idx = 0; idx < num1; idx++) + dag.AAbuf(idx) = A( dag.Aspec(idx, 0), + dag.Aspec(idx, 1)-1, + dag.Aspec(idx, 2), + dag.Aspec(idx, 3) ); + + + if (recursive) { + /* STAGE 2: FORWARD PASS + * Forward pass: go through the dag and store all intermediate results + */ + + // rhos.fill(0); note the rhos are already reset and started filling above! + ACEComplex AAcur{0.0}; + int i1, i2; + + int * dag_nodes = dag.nodes.get_data(); + int idx_nodes = 0; + + DOUBLE_TYPE * dag_coefs = dag.coeffs.get_data(); + int idx_coefs = 0; + + int num2_int = dag.get_num2_int(); + int num2_leaf = dag.get_num2_leaf(); + + // interior nodes (save AA) + for (int idx = num1; idx < num1+num2_int; idx++) { + i1 = dag_nodes[idx_nodes]; idx_nodes++; + i2 = dag_nodes[idx_nodes]; idx_nodes++; + AAcur = dag.AAbuf(i1) * dag.AAbuf(i2); + dag.AAbuf(idx) = AAcur; + for (int p = 0; p < ndensity; p++, idx_coefs++) + rhos(p) += AAcur.real_part_product(dag_coefs[idx_coefs]); + } + + // leaf nodes -> no need to store in AAbuf + DOUBLE_TYPE AAcur_re = 0.0; + for (int _idx = 0; _idx < num2_leaf; _idx++) { + i1 = dag_nodes[idx_nodes]; idx_nodes++; + i2 = dag_nodes[idx_nodes]; idx_nodes++; + AAcur_re = dag.AAbuf(i1).real_part_product(dag.AAbuf(i2)); + for (int p = 0; p < ndensity; p++, idx_coefs++) + rhos(p) += AAcur_re * dag_coefs[idx_coefs]; + } + + } else { + + /* non-recursive Julia-style evaluator implementation */ + // TODO: fix array access to enable bounds checking again??? + ACEComplex AAcur{1.0}; + int *AAspec = jl_AAspec_flat.get_data(); + DOUBLE_TYPE *coeffs = jl_coeffs.get_data(); + int idx_spec = 0; + int idx_coefs = 0; + int order = 0; + int max_order = jl_AAspec.get_dim(1); + for (int iAA = 0; iAA < jl_AAspec.get_dim(0); iAA ++) { + AAcur = 1.0; + order = jl_orders(iAA); + for (int r = 0; r < order; r++, idx_spec++) + AAcur *= dag.AAbuf( AAspec[idx_spec] ); + for (int p = 0; p < ndensity; p++, idx_coefs++) + rhos(p) += AAcur.real_part_product(coeffs[idx_coefs]); + } + } + + /* we now have rho and can evaluate lots of things. + -------- this is back to the original PACE code --------- */ + +#ifdef DEBUG_FORCES_CALCULATIONS + printf("rhos = "); + for(DENSITY_TYPE p =0; prho_core_cutoffs(mu_i); + drho_cut = basis_set->drho_core_cutoffs(mu_i); + + basis_set->inner_cutoff(rho_core, rho_cut, drho_cut, fcut, dfcut); + basis_set->FS_values_and_derivatives(rhos, evdwl, dF_drho, ndensity); + + dF_drho_core = evdwl * dfcut + 1; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) + dF_drho(p) *= fcut; + evdwl_cut = evdwl * fcut + rho_core; + + // E0 shift + evdwl_cut += basis_set->E0vals(mu_i); + + /* I've moved this from below the weight calculation + since I believe it only times the energy? the weights + are only needed for the forces? + But I believe we could add a third timer for computing just + the weights; this will allow us to check better where the + bottleneck is. + */ + energy_calc_timer.stop(); + + forces_calc_loop_timer.start(); + + +#ifdef DEBUG_FORCES_CALCULATIONS + printf("dFrhos = "); + for(DENSITY_TYPE p =0; pndensity; + for (DENSITY_TYPE p = 0; p < ndensity; ++p) { + //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 + weights_rank1(func->mus[0], func->ns[0] - 1) += dF_drho(p) * func->ctildes[p]; + } + } + + /* --------- we now continue with the recursive code --------- */ + + if (recursive) { + /* STAGE 2: BACKWARD PASS */ + int i1, i2; + ACEComplex AA1{0.0}; + ACEComplex AA2{0.0}; + ACEComplex wcur{0.0}; + int num2_int = dag.get_num2_int(); + int num2_leaf = dag.get_num2_leaf(); + /* to prepare for the backward we first need to zero the weights */ + dag.w.fill({0.0}); + + int * dag_nodes = dag.nodes.get_data(); + int idx_nodes = 2 * (num2_int + num2_leaf) - 1; + + DOUBLE_TYPE * dag_coefs = dag.coeffs.get_data(); + int idx_coefs = ndensity * (num2_int + num2_leaf) - 1; + + for (int idx = num1+num2_int+num2_leaf - 1; idx >= num1; idx--) { + i2 = dag_nodes[idx_nodes]; idx_nodes--; + i1 = dag_nodes[idx_nodes]; idx_nodes--; + AA1 = dag.AAbuf(i1); + AA2 = dag.AAbuf(i2); + wcur = dag.w(idx); // [***] + for (int p = ndensity-1; p >= 0; p--, idx_coefs--) + wcur += dF_drho(p) * dag_coefs[idx_coefs]; + dag.w(i1) += wcur * AA2; // TODO: replace with explicit muladd? + dag.w(i2) += wcur * AA1; + } + + /* [***] + * Note that these weights don't really need to be stored for the + * leaf nodes. We tested splitting this for loop into two where + * for the leaf nodes the weight would just be initialized to 0.0 + * instead of reading from an array. The improvement was barely + * measurable, ca 3%, so we reverted to this simpler algorithm + */ + + + } else { + + // non-recursive ACE.jl style implemenation of gradients, but with + // a backward differentiation approach to the prod-A + // (cf. Algorithm 3 in the manuscript) + + dag.w.fill({0.0}); + ACEComplex AAf{1.0}, AAb{1.0}, theta{0.0}; + + int *AAspec = jl_AAspec_flat.get_data(); + DOUBLE_TYPE *coeffs = jl_coeffs.get_data(); + int idx_spec = 0; + int idx_coefs = 0; + int order = 0; + int max_order = jl_AAspec.get_dim(1); + for (int iAA = 0; iAA < jl_AAspec.get_dim(0); iAA ++ ) { + order = jl_orders(iAA); + theta = 0.0; + for (int p = 0; p < ndensity; p++, idx_coefs++) + theta += dF_drho(p) * coeffs[idx_coefs]; + dA[0] = 1.0; + AAf = 1.0; + for (int t = 0; t < order-1; t++, idx_spec++) { + spec[t] = AAspec[idx_spec]; + A_cache[t] = dag.AAbuf(spec[t]); + AAf *= A_cache[t]; + dA[t+1] = AAf; + } + spec[order-1] = AAspec[idx_spec]; idx_spec++; + A_cache[order-1] = dag.AAbuf(spec[order-1]); + AAb = 1.0; + for (int t = order-1; t >= 1; t--) { + AAb *= A_cache[t]; + dA[t-1] *= AAb; + dag.w(spec[t]) += theta * dA[t]; + } + dag.w(spec[0]) += theta * dA[0]; + } + + } + + /* STAGE 3: + * get the gradients from the 1-particle basis gradients and write them + * into the dF/drho derivatives. + */ + /* In order to reuse the original PACE code, we copy the weights back + * into the the PACE datastructure. */ + + for (int idx = 0; idx < num1; idx++) { + int m = dag.Aspec(idx, 3); + if (m >= 0) { + weights(dag.Aspec(idx, 0), // mu + dag.Aspec(idx, 1) - 1, // n + dag.Aspec(idx, 2), // l + m ) += dag.w(idx); + } else { + int factor = (m % 2 == 0 ? 1 : -1); + weights(dag.Aspec(idx, 0), // mu + dag.Aspec(idx, 1) - 1, // n + dag.Aspec(idx, 2), // l + -m ) += factor * dag.w(idx).conjugated(); + } + } + + + /* ------ From here we are now back to the original PACE code ---- */ + +// ==================== FORCES ==================== +#ifdef PRINT_MAIN_STEPS + printf("\nFORCE CALCULATION\n"); + printf("loop over neighbours\n"); +#endif + +// loop over neighbour atoms for force calculations + for (jj = 0; jj < jnum_actual; ++jj) { + mu_j = elements[jj]; + r_hat = rhats[jj]; + inv_r_norm = inv_r_norms[jj]; + + Array2DLM &Y_cache_jj = Y_cache(jj); + Array2DLM &DY_cache_jj = DY_cache(jj); + +#ifdef PRINT_LOOPS_INDICES + printf("\nneighbour atom #%d\n", jj); + printf("rhat = (%f, %f, %f)\n", r_hat[0], r_hat[1], r_hat[2]); +#endif + + forces_calc_neighbour_timer.start(); + + f_ji[0] = f_ji[1] = f_ji[2] = 0; + +//for rank = 1 + for (n = 0; n < nradbasei; ++n) { + if (weights_rank1(mu_j, n) == 0) + continue; + auto &DG = DG_cache(jj, n); + DGR = DG * Y00; + DGR *= weights_rank1(mu_j, n); +#ifdef DEBUG_FORCES_CALCULATIONS + printf("r=1: (n,l,m)=(%d, 0, 0)\n",n+1); + printf("\tGR(n=%d, r=%f)=%f\n",n+1,r_norm, gr(n)); + printf("\tDGR(n=%d, r=%f)=%f\n",n+1,r_norm, dgr(n)); + printf("\tdF+=(%f, %f, %f)\n",DGR * r_hat[0], DGR * r_hat[1], DGR * r_hat[2]); +#endif + f_ji[0] += DGR * r_hat[0]; + f_ji[1] += DGR * r_hat[1]; + f_ji[2] += DGR * r_hat[2]; + } + +//for rank > 1 + for (n = 0; n < nradiali; n++) { + for (l = 0; l <= lmaxi; l++) { + R_over_r = R_cache(jj, n, l) * inv_r_norm; + DR = DR_cache(jj, n, l); + + // for m>=0 + for (m = 0; m <= l; m++) { + ACEComplex w = weights(mu_j, n, l, m); + if (w == 0) + continue; + //counting for -m cases if m>0 + // if (m > 0) w *= 2; // not needed for recursive eval + + DY = DY_cache_jj(l, m); + Y_DR = Y_cache_jj(l, m) * DR; + + grad_phi_nlm.a[0] = Y_DR * r_hat[0] + DY.a[0] * R_over_r; + grad_phi_nlm.a[1] = Y_DR * r_hat[1] + DY.a[1] * R_over_r; + grad_phi_nlm.a[2] = Y_DR * r_hat[2] + DY.a[2] * R_over_r; +#ifdef DEBUG_FORCES_CALCULATIONS + printf("d_phi(n=%d, l=%d, m=%d) = ((%f,%f), (%f,%f), (%f,%f))\n",n+1,l,m, + grad_phi_nlm.a[0].real, grad_phi_nlm.a[0].img, + grad_phi_nlm.a[1].real, grad_phi_nlm.a[1].img, + grad_phi_nlm.a[2].real, grad_phi_nlm.a[2].img); + + printf("weights(n,l,m)(%d,%d,%d) = (%f,%f)\n", n+1, l, m, w.real, w.img); + //if (m>0) w*=2; + printf("dF(n,l,m)(%d, %d, %d) += (%f, %f, %f)\n", n + 1, l, m, + w.real_part_product(grad_phi_nlm.a[0]), + w.real_part_product(grad_phi_nlm.a[1]), + w.real_part_product(grad_phi_nlm.a[2]) + ); +#endif +// real-part multiplication only + f_ji[0] += w.real_part_product(grad_phi_nlm.a[0]); + f_ji[1] += w.real_part_product(grad_phi_nlm.a[1]); + f_ji[2] += w.real_part_product(grad_phi_nlm.a[2]); + } + } + } + + +#ifdef PRINT_INTERMEDIATE_VALUES + printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, + f_ji[0], f_ji[1], f_ji[2] + ); +#endif + + //hard-core repulsion + DCR = DCR_cache(jj); +#ifdef DEBUG_FORCES_CALCULATIONS + printf("DCR = %f\n",DCR); +#endif + f_ji[0] += dF_drho_core * DCR * r_hat[0]; + f_ji[1] += dF_drho_core * DCR * r_hat[1]; + f_ji[2] += dF_drho_core * DCR * r_hat[2]; +#ifdef PRINT_INTERMEDIATE_VALUES + printf("with core-repulsion\n"); + printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, + f_ji[0], f_ji[1], f_ji[2] + ); + printf("neighbour_index_mapping[jj=%d]=%d\n",jj,neighbour_index_mapping[jj]); +#endif + + neighbours_forces(neighbour_index_mapping[jj], 0) = f_ji[0]; + neighbours_forces(neighbour_index_mapping[jj], 1) = f_ji[1]; + neighbours_forces(neighbour_index_mapping[jj], 2) = f_ji[2]; + + forces_calc_neighbour_timer.stop(); + }// end loop over neighbour atoms for forces + + forces_calc_loop_timer.stop(); + + //now, energies and forces are ready + //energies(i) = evdwl + rho_core; + e_atom = evdwl_cut; + +#ifdef PRINT_INTERMEDIATE_VALUES + printf("energies(i) = FS(...rho_p_accum...) = %f\n", evdwl); +#endif + per_atom_calc_timer.stop(); +} \ No newline at end of file diff --git a/lib/pace/ace_recursive.h b/lib/pace/ace_recursive.h new file mode 100644 index 0000000000..78e74feb86 --- /dev/null +++ b/lib/pace/ace_recursive.h @@ -0,0 +1,247 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Christoph Ortner on 20.12.2020 + +#ifndef ACE_RECURSIVE_H +#define ACE_RECURSIVE_H + +#include "ace_abstract_basis.h" +#include "ace_arraynd.h" +#include "ace_array2dlm.h" +#include "ace_c_basis.h" +#include "ace_complex.h" +#include "ace_timing.h" +#include "ace_types.h" +#include "ace_evaluator.h" + +#include +#include +#include +#include +#include + +using namespace std; + + +typedef pair, vector > TPARTITION; +typedef list TPARTITIONS; + +typedef map, int> TDAGMAP; + +class ACEDAG { + + TPARTITIONS find_2partitions(vector v); + + void insert_node(TDAGMAP &dagmap, + vector node, + vector c); + + // the following fields are used only for *construction*, not evaluation + int dag_idx; // current index of dag node + Array2D nodes_pre; //TODO: YL: better to use vector<> + Array2D coeffs_pre; //TODO: YL: better to use vector<> + Array1D haschild; //TODO: YL: better to use vector<> + + /* which heuristic to choose for DAG construction? + * 0 : the simple original heuristic + * 1 : prioritize 2-correlation nodes and build the rest from those + */ + int heuristic = 0; + +public: + + ACEDAG() = default; + + void init(Array2D Aspec, Array2D AAspec, + Array1D orders, Array2D coeffs, + int heuristic ); + + Array1D AAbuf; + Array1D w; + + Array2D Aspec; + + // nodes in the graph + Array2D nodes; + Array2D coeffs; + + // total number of nodes in the dag + int num_nodes; + // number of interior nodes (with children) + int num2_int; + // number of leaf nodes (nc = no child) + int num2_leaf; + + + // number of 1-particle basis functions + // (these will be stored in the first num1 entries of AAbuf) + int get_num1() { return Aspec.get_dim(0); }; + // total number of n-correlation basis functions n > 1. + int get_num2() { return num_nodes - get_num1(); }; + int get_num2_int() { return num2_int; }; // with children + int get_num2_leaf() { return num2_leaf; }; // without children + + // debugging tool + void print(); +}; + + +/** + * Recursive Variant of the ACETildeEvaluator; should be 100% compatible + */ +class ACERecursiveEvaluator : public ACEEvaluator { + + /** + * Weights \f$ \omega_{i \mu n 0 0} \f$ for rank = 1, see Eq.(10) from implementation notes, + * 'i' is fixed for the current atom, shape: [nelements][nradbase] + */ + Array2D weights_rank1 = Array2D("weights_rank1"); + + /** + * Weights \f$ \omega_{i \mu n l m} \f$ for rank > 1, see Eq.(10) from implementation notes, + * 'i' is fixed for the current atom, shape: [nelements][nradbase][l=0..lmax, m] + */ + Array4DLM weights = Array4DLM("weights"); + + /** + * cache for gradients of \f$ g(r)\f$: grad_phi(jj,n)=A2DLM(l,m) + * shape:[max_jnum][nradbase] + */ + Array2D DG_cache = Array2D("DG_cache"); + + + /** + * cache for \f$ R_{nl}(r)\f$ + * shape:[max_jnum][nradbase][0..lmax] + */ + Array3D R_cache = Array3D("R_cache"); + /** + * cache for derivatives of \f$ R_{nl}(r)\f$ + * shape:[max_jnum][nradbase][0..lmax] + */ + Array3D DR_cache = Array3D("DR_cache"); + /** + * cache for \f$ Y_{lm}(\hat{r})\f$ + * shape:[max_jnum][0..lmax][m] + */ + Array3DLM Y_cache = Array3DLM("Y_cache"); + /** + * cache for \f$ \nabla Y_{lm}(\hat{r})\f$ + * shape:[max_jnum][0..lmax][m] + */ + Array3DLM DY_cache = Array3DLM("dY_dense_cache"); + + /** + * cache for derivatives of hard-core repulsion + * shape:[max_jnum] + */ + Array1D DCR_cache = Array1D("DCR_cache"); + + /** + * Partial derivatives \f$ dB_{i \mu n l m t}^{(r)} \f$ with sequential numbering over [func_ind][ms_ind][r], + * shape:[func_ms_r_ind] + */ + Array1D dB_flatten = Array1D("dB_flatten"); + + /** + * pointer to the ACEBasisSet object + */ + ACECTildeBasisSet *basis_set = nullptr; + + /** + * Initialize internal arrays according to basis set sizes + * @param basis_set + */ + void init(ACECTildeBasisSet *basis_set, int heuristic); + + /* convert the PACE to the ACE.jl format to prepare for DAG construction*/ + Array2D jl_Aspec; + Array2D jl_AAspec; + Array1D jl_AAspec_flat; + Array1D jl_orders; + Array2D jl_coeffs; + void acejlformat(); + + /* the main event : the computational graph */ + ACEDAG dag; + + bool recursive = true; + +public: + + + ACERecursiveEvaluator() = default; + + explicit ACERecursiveEvaluator(ACECTildeBasisSet &bas, + bool recursive = true) { + set_recursive(recursive); + set_basis(bas); + } + + /** + * set the basis function to the ACE evaluator + * @param bas + */ + void set_basis(ACECTildeBasisSet &bas, int heuristic = 0); + + /** + * The key method to compute energy and forces for atom 'i'. + * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array + * + * @param i atom index + * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] + * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] + * @param jnum number of neighbours of atom_i + * @param jlist array of neighbour indices, shape: [jnum] + */ + void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) override; + + /** + * Resize all caches over neighbours atoms + * @param max_jnum maximum number of neighbours + */ + void resize_neighbours_cache(int max_jnum) override; + + /******* public functions related to recursive evaluator ********/ + + // print out the DAG for visual inspection + void print_dag() {dag.print();} + + // print out the jl format for visual inspection + // should be converted into a proper test + void test_acejlformat(); + + void set_recursive(bool tf) { recursive = tf; } + + /********************************/ + +}; + + +#endif //ACE_RECURSIVE_H \ No newline at end of file diff --git a/lib/pace/ace_spherical_cart.cpp b/lib/pace/ace_spherical_cart.cpp new file mode 100644 index 0000000000..f1f0fccced --- /dev/null +++ b/lib/pace/ace_spherical_cart.cpp @@ -0,0 +1,221 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Ralf Drautz, Yury Lysogorskiy + +#include + +#include "ace_spherical_cart.h" + +ACECartesianSphericalHarmonics::ACECartesianSphericalHarmonics(LS_TYPE lm) { + init(lm); +} + +void ACECartesianSphericalHarmonics::init(LS_TYPE lm) { + lmax = lm; + + alm.init(lmax, "alm"); + blm.init(lmax, "blm"); + cl.init(lmax + 1); + dl.init(lmax + 1); + + plm.init(lmax, "plm"); + dplm.init(lmax, "dplm"); + + ylm.init(lmax, "ylm"); + dylm.init(lmax, "dylm"); + + pre_compute(); +} + +/** +Destructor for ACECartesianSphericalHarmonics. + +@param None + +@returns None +*/ +ACECartesianSphericalHarmonics::~ACECartesianSphericalHarmonics() {} + + +void ACECartesianSphericalHarmonics::pre_compute() { + + DOUBLE_TYPE a, b; + DOUBLE_TYPE lsq, ld, l1, l2; + DOUBLE_TYPE msq; + + for (LS_TYPE l = 1; l <= lmax; l++) { + lsq = l * l; + ld = 2 * l; + l1 = (4 * lsq - 1); + l2 = lsq - ld + 1; + for (MS_TYPE m = 0; m < l - 1; m++) { + msq = m * m; + a = sqrt((DOUBLE_TYPE(l1)) / (DOUBLE_TYPE(lsq - msq))); + b = -sqrt((DOUBLE_TYPE(l2 - msq)) / (DOUBLE_TYPE(4 * l2 - 1))); + alm(l, m) = a; + blm(l, m) = b; + } + } + + for (LS_TYPE l = 1; l <= lmax; l++) { + cl(l) = -sqrt(1.0 + 0.5 / (DOUBLE_TYPE(l))); + dl(l) = sqrt(DOUBLE_TYPE(2 * (l - 1) + 3)); + } +} + + +void ACECartesianSphericalHarmonics::compute_barplm(DOUBLE_TYPE rz, LS_TYPE lmaxi) { + + // requires -1 <= rz <= 1 , NO CHECKING IS PERFORMED !!!!!!!!! + // prefactors include 1/sqrt(2) factor compared to reference + DOUBLE_TYPE t; + + // l=0, m=0 + //plm(0, 0) = Y00/sq1o4pi; //= sq1o4pi; + plm(0, 0) = Y00; //= 1; + dplm(0, 0) = 0.0; + + if (lmaxi > 0) { + + // l=1, m=0 + plm(1, 0) = Y00 * sq3 * rz; + dplm(1, 0) = Y00 * sq3; + + // l=1, m=1 + plm(1, 1) = -sq3o2 * Y00; + dplm(1, 1) = 0.0; + + // loop l = 2, lmax + for (LS_TYPE l = 2; l <= lmaxi; l++) { + for (MS_TYPE m = 0; m < l - 1; m++) { + plm(l, m) = alm(l, m) * (rz * plm(l - 1, m) + blm(l, m) * plm(l - 2, m)); + dplm(l, m) = alm(l, m) * (plm(l - 1, m) + rz * dplm(l - 1, m) + blm(l, m) * dplm(l - 2, m)); + } + t = dl(l) * plm(l - 1, l - 1); + plm(l, l - 1) = t * rz; + dplm(l, l - 1) = t; + plm(l, l) = cl(l) * plm(l - 1, l - 1); + dplm(l, l) = 0.0; + } + } +} //end compute_barplm + + +void ACECartesianSphericalHarmonics::compute_ylm(DOUBLE_TYPE rx, DOUBLE_TYPE ry, DOUBLE_TYPE rz, LS_TYPE lmaxi) { + + // requires rx^2 + ry^2 + rz^2 = 1 , NO CHECKING IS PERFORMED !!!!!!!!! + + DOUBLE_TYPE real; + DOUBLE_TYPE img; + MS_TYPE m; + ACEComplex phase; + ACEComplex phasem, mphasem1; + ACEComplex dyx, dyy, dyz; + ACEComplex rdy; + + phase.real = rx; + phase.img = ry; + //compute barplm + compute_barplm(rz, lmaxi); + + //m = 0 + m = 0; + for (LS_TYPE l = 0; l <= lmaxi; l++) { + + ylm(l, m).real = plm(l, m); + ylm(l, m).img = 0.0; + + dyz.real = dplm(l, m); + rdy.real = dyz.real * rz; + + dylm(l, m).a[0].real = -rdy.real * rx; + dylm(l, m).a[0].img = 0.0; + dylm(l, m).a[1].real = -rdy.real * ry; + dylm(l, m).a[1].img = 0.0; + dylm(l, m).a[2].real = dyz.real - rdy.real * rz; + dylm(l, m).a[2].img = 0; + } + //m = 0 + m = 1; + for (LS_TYPE l = 1; l <= lmaxi; l++) { + + ylm(l, m) = phase * plm(l, m); + +// std::cout << "Re ylm(" << l << "," << m <<")= " << ylm(l, m).real << std::endl; +// std::cout << "Im ylm(" << l << "," << m <<")= " << ylm(l, m).img << std::endl; + + dyx.real = plm(l, m); + dyx.img = 0.0; + dyy.real = 0.0; + dyy.img = plm(l, m); + dyz.real = phase.real * dplm(l, m); + dyz.img = phase.img * dplm(l, m); + + rdy.real = rx * dyx.real + +rz * dyz.real; + rdy.img = ry * dyy.img + rz * dyz.img; + + dylm(l, m).a[0].real = dyx.real - rdy.real * rx; + dylm(l, m).a[0].img = -rdy.img * rx; + dylm(l, m).a[1].real = -rdy.real * ry; + dylm(l, m).a[1].img = dyy.img - rdy.img * ry; + dylm(l, m).a[2].real = dyz.real - rdy.real * rz; + dylm(l, m).a[2].img = dyz.img - rdy.img * rz; + } + + // m > 1 + phasem = phase; + for (MS_TYPE m = 2; m <= lmaxi; m++) { + + mphasem1.real = phasem.real * DOUBLE_TYPE(m); + mphasem1.img = phasem.img * DOUBLE_TYPE(m); + phasem = phasem * phase; + + for (LS_TYPE l = m; l <= lmaxi; l++) { + + ylm(l, m).real = phasem.real * plm(l, m); + ylm(l, m).img = phasem.img * plm(l, m); + + dyx = mphasem1 * plm(l, m); + dyy.real = -dyx.img; + dyy.img = dyx.real; + dyz = phasem * dplm(l, m); + + rdy.real = rx * dyx.real + ry * dyy.real + rz * dyz.real; + rdy.img = rx * dyx.img + ry * dyy.img + rz * dyz.img; + + dylm(l, m).a[0].real = dyx.real - rdy.real * rx; + dylm(l, m).a[0].img = dyx.img - rdy.img * rx; + dylm(l, m).a[1].real = dyy.real - rdy.real * ry; + dylm(l, m).a[1].img = dyy.img - rdy.img * ry; + dylm(l, m).a[2].real = dyz.real - rdy.real * rz; + dylm(l, m).a[2].img = dyz.img - rdy.img * rz; + } + } + +} + diff --git a/lib/pace/ace_spherical_cart.h b/lib/pace/ace_spherical_cart.h new file mode 100644 index 0000000000..b2a0cb5913 --- /dev/null +++ b/lib/pace/ace_spherical_cart.h @@ -0,0 +1,134 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Ralf Drautz, Yury Lysogorskiy + +#ifndef ACE_SPHERICAL_CART_H +#define ACE_SPHERICAL_CART_H + +#include + +#include "ace_arraynd.h" +#include "ace_array2dlm.h" +#include "ace_complex.h" +#include "ace_types.h" + + +using namespace std; + +const DOUBLE_TYPE sq1o4pi = 0.28209479177387814347; // sqrt(1/(4*pi)) +const DOUBLE_TYPE sq4pi = 3.54490770181103176384; // sqrt(4*pi) +const DOUBLE_TYPE sq3 = 1.73205080756887719318;//sqrt(3), numpy +const DOUBLE_TYPE sq3o2 = 1.22474487139158894067;//sqrt(3/2), numpy + +//definition of common factor for spherical harmonics = Y00 +//const DOUBLE_TYPE Y00 = sq1o4pi; +const DOUBLE_TYPE Y00 = 1; + +/** +Class to store spherical harmonics and their associated functions. \n +All the associated members such as \f$ P_{lm}, Y_{lm}\f$ etc are one dimensional arrays of length (L+1)*(L+2)/2. \n +The value that corresponds to a particular l, m configuration can be accessed through a \code ylm(l,m) \endcode \n +*/ +class ACECartesianSphericalHarmonics { +public: + + /** + int, the number of spherical harmonics to be found + */ + LS_TYPE lmax; + + /** + * Default constructor + */ + ACECartesianSphericalHarmonics() = default; + + /** + * Parametrized constructor. Dynamically initialises all the arrays. + * @param lmax maximum orbital moment + */ + explicit ACECartesianSphericalHarmonics(LS_TYPE lmax); + + /** + * Initialize internal arrays and precompute necessary coefficients + * @param lm maximum orbital moment + */ + void init(LS_TYPE lm); + + /** + * Destructor + */ + ~ACECartesianSphericalHarmonics(); + + /** + * Precompute necessaary helper arrays Precomputes the value of \f$ a_{lm}, b_{lm}, c_l, d_l \f$ + */ + void pre_compute(); + + /** + Function that computes \f$ \bar{P}_{lm} \f$ for the corresponding lmax value + Input is \f$ \hat{r}_z \f$ which is the $z$-component of the bond direction. + + For each \f$ \hat{r}_z \f$, this computes the whole range of \f$ \bar{P}_{lm} \f$ values + and its derivatives upto the lmax specified, which is a member of the class. + + @param rz, DOUBLE_TYPE + + @returns None + */ + void compute_barplm(DOUBLE_TYPE rz, LS_TYPE lmaxi); + + /** + Function that computes \f$ Y_{lm} \f$ for the corresponding lmax value + Input is the bond-directon vector \f$ \hat{r}_x, \hat{r}_y, \hat{r}_z \f$ + + Each \f$ Y_{lm} \f$ value is a ACEComplex object with real and imaginary parts. This function also + finds the derivatives, which are stored in the Dycomponent class, with each component being a + ACEComplex object. + + @param rx, DOUBLE_TYPE + @param ry, DOUBLE_TYPE + @param rz, DOUBLE_TYPE + @param lmaxi, int + */ + void compute_ylm(DOUBLE_TYPE rx, DOUBLE_TYPE ry, DOUBLE_TYPE rz, LS_TYPE lmaxi); + + Array2DLM alm; + Array2DLM blm; + Array1D cl; + Array1D dl; + + Array2DLM plm; + Array2DLM dplm; + + Array2DLM ylm; ///< Values of all spherical harmonics after \code compute_ylm(rx,ry,rz, lmaxi) \endcode call + Array2DLM dylm;///< Values of gradients of all spherical harmonics after \code compute_ylm(rx,ry,rz, lmaxi) \endcode call + +}; + + +#endif diff --git a/lib/pace/ace_timing.h b/lib/pace/ace_timing.h new file mode 100644 index 0000000000..7f5243eb99 --- /dev/null +++ b/lib/pace/ace_timing.h @@ -0,0 +1,126 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Yury Lysogorskiy on 19.02.20. + +#ifndef ACE_TIMING_H +#define ACE_TIMING_H + +#include + +using namespace std::chrono; +using Clock = std::chrono::high_resolution_clock; +using TimePoint = std::chrono::time_point; +using Duration = Clock::duration; + +////////////////////////////////////////// +#ifdef FINE_TIMING +/** + * Helper class for timing the code. + * The timer should be initialized to reset measured time and + * then call "start" and "stop" before and after measured code. + * The measured time is stored in "duration" variable + */ +struct ACETimer { + Duration duration; ///< measured duration + TimePoint start_moment; ///< start moment of current measurement + + ACETimer() { init(); }; + + /** + * Reset timer + */ + void init() { duration = std::chrono::nanoseconds(0); } + + /** + * Start timer + */ + void start() { start_moment = Clock::now(); } + + /** + * Stop timer, update measured "duration" + */ + void stop() { duration += Clock::now() - start_moment; } + + /** + * Get duration in microseconds + */ + long as_microseconds() { return std::chrono::duration_cast(duration).count(); } + + /** + * Get duration in nanoseconds + */ + long as_nanoseconds() { return std::chrono::duration_cast(duration).count(); } + +}; + +#else // EMPTY Definitions +/** + * Helper class for timing the code. + * The timer should be initialized to reset measured time and + * then call "start" and "stop" before and after measured code. + * The measured time is stored in "duration" variable + */ +struct ACETimer { + Duration duration; ///< measured duration + TimePoint start_moment; ///< start moment of current measurement + + ACETimer() {}; + + /** + * Reset timer + */ + void init() {} + + /** + * Start timer + */ + void start() {} + + /** + * Stop timer, update measured "duration" + */ + void stop() {} + + /** + * Get duration in microseconds + */ + long as_microseconds() {return 0; } + + /** + * Get duration in nanoseconds + */ + long as_nanoseconds() {return 0; } + +}; + +#endif +////////////////////////////////////////// + + +#endif //ACE_TIMING_H diff --git a/lib/pace/ace_types.h b/lib/pace/ace_types.h new file mode 100644 index 0000000000..f9b3cf7267 --- /dev/null +++ b/lib/pace/ace_types.h @@ -0,0 +1,45 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Yury Lysogorskiy on 20.01.20. + +#ifndef ACE_TYPES_H +#define ACE_TYPES_H + +typedef char RANK_TYPE; +typedef int SPECIES_TYPE; +typedef short int NS_TYPE; +typedef short int LS_TYPE; + +typedef short int DENSITY_TYPE; + +typedef short int MS_TYPE; + +typedef short int SHORT_INT_TYPE; +typedef double DOUBLE_TYPE; + +#endif \ No newline at end of file diff --git a/lib/pace/ace_version.h b/lib/pace/ace_version.h new file mode 100644 index 0000000000..9d61e5c505 --- /dev/null +++ b/lib/pace/ace_version.h @@ -0,0 +1,39 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Lysogorskiy Yury on 07.04.2020. + +#ifndef ACE_VERSION_H +#define ACE_VERSION_H + +#define VERSION_YEAR 2021 +#define VERSION_MONTH 2 +#define VERSION_DAY 3 + +#endif //ACE_VERSION_Hls + diff --git a/lib/pace/ships_radial.cpp b/lib/pace/ships_radial.cpp new file mode 100644 index 0000000000..e948f03f21 --- /dev/null +++ b/lib/pace/ships_radial.cpp @@ -0,0 +1,388 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Created by Christoph Ortner on 03.06.2020 + +#include "ships_radial.h" + +#include +#include +#include + + +using namespace std; + +void SHIPsRadPolyBasis::_init(DOUBLE_TYPE r0, int p, DOUBLE_TYPE rcut, + DOUBLE_TYPE xl, DOUBLE_TYPE xr, + int pl, int pr, size_t maxn) { + this->p = p; + this->r0 = r0; + this->rcut = rcut; + this->xl = xl; + this->xr = xr; + this->pl = pl; + this->pr = pr; + this->maxn = maxn; + this->A.resize(maxn); + this->B.resize(maxn); + this->C.resize(maxn); + this->P.resize(maxn); + this->dP_dr.resize(maxn); +} + + +void SHIPsRadPolyBasis::fread(FILE *fptr) +{ + int res; //for fscanf result + int maxn, p, pl, pr, ntests; + double r0, xl, xr, a, b, c, rcut; + + // transform parameters + res = fscanf(fptr, "transform parameters: p=%d r0=%lf\n", &p, &r0); + if (res != 2) + throw invalid_argument("Couldn't read line: transform parameters: p=%d r0=%lf"); + // cutoff parameters + res = fscanf(fptr, "cutoff parameters: rcut=%lf xl=%lf xr=%lf pl=%d pr=%d\n", + &rcut, &xl, &xr, &pl, &pr); + if (res != 5) + throw invalid_argument("Couldn't read cutoff parameters: rcut=%lf xl=%lf xr=%lf pl=%d pr=%d"); + // basis size + res = fscanf(fptr, "recursion coefficients: maxn = %d\n", &maxn); + if (res != 1) + throw invalid_argument("Couldn't read recursion coefficients: maxn = %d"); + // initialize and allocate + this->_init(r0, p, rcut, xl, xr, pl, pr, maxn); + + // read basis coefficients + for (int i = 0; i < maxn; i++) { + res = fscanf(fptr, " %lf %lf %lf\n", &a, &b, &c); + if (res != 3) + throw invalid_argument("Couldn't read line: A_n B_n C_n"); + this->A(i) = DOUBLE_TYPE(a); + this->B(i) = DOUBLE_TYPE(b); + this->C(i) = DOUBLE_TYPE(c); + } + + // // check there are no consistency tests (I don't have time to fix this now) + // res = fscanf(fptr, "tests: ntests = %d\n", &ntests); + // if (res != 1) + // throw invalid_argument("Couldn't read line: tests: ntests = %d"); + // if (ntests != 0) + // throw invalid_argument("must have ntests = 0!"); + + // --------------------------------------------------------------------- + // run the consistency test this could be moved into a separate function + double r, Pn, dPn; + double err = 0.0; + + res = fscanf(fptr, "tests: ntests = %d\n", &ntests); + if (res != 1) + throw invalid_argument("Couldn't read line: tests: ntests = %d"); + for (size_t itest = 0; itest < ntests; itest++) { + // read an r argument + res = fscanf(fptr, " r=%lf\n", &r); + // printf("r = %lf \n", r); + if (res != 1) + throw invalid_argument("Couldn't read line: r=%lf"); + // printf("test %d, r=%f, maxn=%d \n", itest, r, maxn); + // evaluate the basis + this->calcP(r, maxn, SPECIES_TYPE(0), SPECIES_TYPE(0)); + // compare against the stored values + for (size_t n = 0; n < maxn; n++) { + res = fscanf(fptr, " %lf %lf\n", &Pn, &dPn); + if (res != 2) + throw invalid_argument("Couldn't read test value line: %lf %lf"); + err = max(err, abs(Pn - this->P(n)) + abs(dPn - this->dP_dr(n))); + // printf(" %d %e %e \n", int(n), + // abs(Pn - this->P(n)), + // abs(dPn - this->dP_dr(n))); + } + } + if (ntests > 0) + printf("Maximum Test error = %e\n", err); + // --------------------------------------------------------------------- + +} + + + + +size_t SHIPsRadPolyBasis::get_maxn() +{ + return this->maxn; +} + + +// Julia code: ((1+r0)/(1+r))^p +void SHIPsRadPolyBasis::transform(const DOUBLE_TYPE r, DOUBLE_TYPE &x_out, DOUBLE_TYPE &dx_out) const { + x_out = pow((1 + r0) / (1 + r), p); // ==pow( (1 + r) / (1 + r0), -p ); + dx_out = -p * pow((1 + r) / (1 + r0), -p - 1) / (1 + r0); +} + +void SHIPsRadPolyBasis::fcut(const DOUBLE_TYPE x, DOUBLE_TYPE &f_out, DOUBLE_TYPE &df_out) const { + if ( ((x < xl) && (pl > 0)) || ((x > xr) && (pr > 0)) ) { + f_out = 0.0; + df_out = 0.0; + } else { + f_out = pow(x - xl, pl) * pow(x - xr, pr); + df_out = pl * pow(x - xl, pl - 1) * pow(x - xr, pr) + pow(x - xl, pl) * pr * pow(x - xr, pr - 1); + } +} + + /* ------------------------------------------------------------------------ +Julia Code +P[1] = J.A[1] * _fcut_(J.pl, J.tl, J.pr, J.tr, t) +if length(J) == 1; return P; end +P[2] = (J.A[2] * t + J.B[2]) * P[1] +@inbounds for n = 3:length(J) + P[n] = (J.A[n] * t + J.B[n]) * P[n-1] + J.C[n] * P[n-2] +end +return P +------------------------------------------------------------------------ */ + +void SHIPsRadPolyBasis::calcP(DOUBLE_TYPE r, size_t maxn, + SPECIES_TYPE z1, SPECIES_TYPE z2) { + if (maxn > this->maxn) + throw invalid_argument("Given maxn couldn't be larger than global maxn"); + + if (maxn > P.get_size()) + throw invalid_argument("Given maxn couldn't be larger than global length of P"); + + DOUBLE_TYPE x, dx_dr; // dx -> dx/dr + transform(r, x, dx_dr); + // printf("r = %f, x = %f, fcut = %f \n", r, x, fcut(x)); + DOUBLE_TYPE f, df_dx; + fcut(x, f, df_dx); // df -> df/dx + + //fill with zeros + P.fill(0); + dP_dr.fill(0); + + P(0) = A(0) * f; + dP_dr(0) = A(0) * df_dx * dx_dr; // dP/dr; chain rule: df_cut/dr = df_cut/dx * dx/dr + if (maxn > 0) { + P(1) = (A(1) * x + B(1)) * P(0); + dP_dr(1) = A(1) * dx_dr * P(0) + (A(1) * x + B(1)) * dP_dr(0); + } + for (size_t n = 2; n < maxn; n++) { + P(n) = (A(n) * x + B(n)) * P(n - 1) + C(n) * P(n - 2); + dP_dr(n) = A(n) * dx_dr * P(n - 1) + (A(n) * x + B(n)) * dP_dr(n - 1) + C(n) * dP_dr(n - 2); + } +} + + +// ==================================================================== + + +bool SHIPsRadialFunctions::has_pair() { + return this->haspair; +} + +void SHIPsRadialFunctions::load(string fname) { + FILE * fptr = fopen(fname.data(), "r"); + size_t res = fscanf(fptr, "radbasename=ACE.jl.Basic\n"); + if (res != 0) + throw("SHIPsRadialFunctions::load : couldnt read radbasename=ACE.jl.Basic"); + this->fread(fptr); + fclose(fptr); +} + +void SHIPsRadialFunctions::fread(FILE *fptr){ + int res; + size_t maxn; + char hasE0, haspair; + DOUBLE_TYPE c; + + // check whether we have a pair potential + res = fscanf(fptr, "haspair: %c\n", &haspair); + if (res != 1) + throw("SHIPsRadialFunctions::load : couldn't read haspair"); + + // read the radial basis + this->radbasis.fread(fptr); + + // read the pair potential + if (haspair == 't') { + this->haspair=true; + fscanf(fptr, "begin repulsive potential\n"); + fscanf(fptr, "begin polypairpot\n"); + // read the basis parameters + pairbasis.fread(fptr); + maxn = pairbasis.get_maxn(); + // read the coefficients + fscanf(fptr, "coefficients\n"); + paircoeffs.resize(maxn); + for (size_t n = 0; n < maxn; n++) { + fscanf(fptr, "%lf\n", &c); + paircoeffs(n) = c; + } + fscanf(fptr, "end polypairpot\n"); + // read the spline parameters + fscanf(fptr, "spline parameters\n"); + fscanf(fptr, " e_0 + B exp(-A*(r/ri-1)) * (ri/r)\n"); + fscanf(fptr, "ri=%lf\n", &(this->ri)); + fscanf(fptr, "e0=%lf\n", &(this->e0)); + fscanf(fptr, "A=%lf\n", &(this->A)); + fscanf(fptr, "B=%lf\n", &(this->B)); + fscanf(fptr, "end repulsive potential\n"); + } +} + + +size_t SHIPsRadialFunctions::get_maxn() +{ + return this->radbasis.get_maxn(); +} + +DOUBLE_TYPE SHIPsRadialFunctions::get_rcut() +{ + return max(radbasis.rcut, pairbasis.rcut); +} + + +void SHIPsRadialFunctions::fill_gk(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2) { + radbasis.calcP(r, maxn, z1, z2); + for (NS_TYPE n = 0; n < maxn; n++) { + gr(n) = radbasis.P(n); + dgr(n) = radbasis.dP_dr(n); + } +} + + +void SHIPsRadialFunctions::fill_Rnl(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2) { + radbasis.calcP(r, maxn, z1, z2); + for (NS_TYPE n = 0; n < maxn; n++) { + for (LS_TYPE l = 0; l <= lmax; l++) { + fr(n, l) = radbasis.P(n); + dfr(n, l) = radbasis.dP_dr(n); + } + } +} + + +void SHIPsRadialFunctions::setuplookupRadspline() { +} + + +void SHIPsRadialFunctions::init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, + SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, string radbasename) { + //mimic ACERadialFunctions::init + this->nradbase = nradb; + this->lmax = lmax; + this->nradial = nradial; + this->deltaSplineBins = deltaSplineBins; + this->nelements = nelements; + this->cutoff = cutoff; + this->radbasename = radbasename; + + gr.init(nradbase, "gr"); + dgr.init(nradbase, "dgr"); + + + fr.init(nradial, lmax + 1, "fr"); + dfr.init(nradial, lmax + 1, "dfr"); + + splines_gk.init(nelements, nelements, "splines_gk"); + splines_rnl.init(nelements, nelements, "splines_rnl"); + splines_hc.init(nelements, nelements, "splines_hc"); + + lambda.init(nelements, nelements, "lambda"); + lambda.fill(1.); + + cut.init(nelements, nelements, "cut"); + cut.fill(1.); + + dcut.init(nelements, nelements, "dcut"); + dcut.fill(1.); + + crad.init(nelements, nelements, (lmax + 1), nradial, nradbase, "crad"); + crad.fill(0.); + + //hard-core repulsion + prehc.init(nelements, nelements, "prehc"); + prehc.fill(0.); + + lambdahc.init(nelements, nelements, "lambdahc"); + lambdahc.fill(1.); +} + + +void SHIPsRadialFunctions::evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, + SPECIES_TYPE mu_j, bool calc_second_derivatives) { + if (calc_second_derivatives) + throw invalid_argument("SHIPsRadialFunctions has not `calc_second_derivatives` option"); + + radbasis.calcP(r, nradbase_c, mu_i, mu_j); + for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { + gr(nr) = radbasis.P(nr); + dgr(nr) = radbasis.dP_dr(nr); + } + for (NS_TYPE nr = 0; nr < nradial_c; nr++) { + for (LS_TYPE l = 0; l <= this->lmax; l++) { + fr(nr, l) = radbasis.P(nr); + dfr(nr, l) = radbasis.dP_dr(nr); + } + } + + if (this->has_pair()) + this->evaluate_pair(r, mu_i, mu_j); + else { + cr = 0; + dcr = 0; + } +} + +void SHIPsRadialFunctions::evaluate_pair(DOUBLE_TYPE r, + SPECIES_TYPE mu_i, + SPECIES_TYPE mu_j, + bool calc_second_derivatives) { + // spline_hc.calcSplines(r); + // cr = spline_hc.values(0); + // dcr = spline_hc.derivatives(0); + + // the outer polynomial potential + if (r > ri) { + pairbasis.calcP(r, pairbasis.get_maxn(), mu_i, mu_j); + cr = 0; + dcr = 0; + for (size_t n = 0; n < pairbasis.get_maxn(); n++) { + cr += paircoeffs(n) * pairbasis.P(n); + dcr += paircoeffs(n) * pairbasis.dP_dr(n); + } + } + else { // the repulsive core part + cr = e0 + B * exp(-A * (r/ri - 1)) * (ri/r); + dcr = B * exp( - A * (r/ri-1) ) * ri * ( - A / ri / r - 1/(r*r) ); + } + // fix double-counting + cr *= 0.5; + dcr *= 0.5; +} + + + diff --git a/lib/pace/ships_radial.h b/lib/pace/ships_radial.h new file mode 100644 index 0000000000..60a82448cd --- /dev/null +++ b/lib/pace/ships_radial.h @@ -0,0 +1,158 @@ +/* + * Performant implementation of atomic cluster expansion and interface to LAMMPS + * + * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + * + * ^1: Ruhr-University Bochum, Bochum, Germany + * ^2: University of Cambridge, Cambridge, United Kingdom + * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + * ^4: University of British Columbia, Vancouver, BC, Canada + * + * + * See the LICENSE file. + * This FILENAME is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +// Created by Christoph Ortner on 03.06.2020 + +#ifndef SHIPs_RADIAL_FUNCTIONS_H +#define SHIPs_RADIAL_FUNCTIONS_H + +#include "ace_arraynd.h" +#include "ace_types.h" +#include "ace_radial.h" + +class SHIPsRadPolyBasis { + +public: + + // transform parameters + int p = 0; + DOUBLE_TYPE r0 = 0.0; + + // cutoff parameters + DOUBLE_TYPE rcut = 0.0; + DOUBLE_TYPE xl = 0.0; + DOUBLE_TYPE xr = 0.0; + int pl = 0; + int pr = 0; + + // basis size + size_t maxn = 0; + + // recursion parameters + Array1D A = Array1D("SHIPs radial basis: A"); + Array1D B = Array1D("SHIPs radial basis: B"); + Array1D C = Array1D("SHIPs radial basis: C"); + + // temporary storage for evaluating the basis + Array1D P = Array1D("SHIPs radial basis: P"); + Array1D dP_dr = Array1D("SHIPs radial basis: dP"); + +////////////////////////////////// + + SHIPsRadPolyBasis() = default; + + ~SHIPsRadPolyBasis() = default; + + // distance transform + void transform(const DOUBLE_TYPE r, DOUBLE_TYPE &x_out, DOUBLE_TYPE &dx_out) const; + + // cutoff function + void fcut(const DOUBLE_TYPE x, DOUBLE_TYPE &f_out, DOUBLE_TYPE &df_out) const; + + void fread(FILE *fptr); + + void _init(DOUBLE_TYPE r0, int p, DOUBLE_TYPE rcut, + DOUBLE_TYPE xl, DOUBLE_TYPE xr, + int pl, int pr, size_t maxn); + + void calcP(DOUBLE_TYPE r, size_t maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); + + size_t get_maxn(); + +}; + + + + +class SHIPsRadialFunctions : public AbstractRadialBasis { +public: + + // radial basis + SHIPsRadPolyBasis radbasis; + + // pair potential basis + bool haspair = false; + SHIPsRadPolyBasis pairbasis; + + // pair potential coefficients + Array1D paircoeffs = Array1D("SHIPs pairpot coeffs: paircoeffs"); + + // spline parameters for repulsive core + DOUBLE_TYPE ri = 0.0; + DOUBLE_TYPE e0 = 0.0; + DOUBLE_TYPE A = 0.0; + DOUBLE_TYPE B = 0.0; + +////////////////////////////////// + + SHIPsRadialFunctions() = default; + + ~SHIPsRadialFunctions() override = default; + + + void fread(FILE *fptr); + + void load(string fname); + + size_t get_maxn(); + DOUBLE_TYPE get_rcut(); + + bool has_pair(); + + void init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, + DOUBLE_TYPE cutoff, + string radbasename) override; + + void + evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, + bool calc_second_derivatives = false) override; + + void + evaluate_pair(DOUBLE_TYPE r, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, + bool calc_second_derivatives = false); + + void setuplookupRadspline() override; + + SHIPsRadialFunctions *clone() const override { + return new SHIPsRadialFunctions(*this); + }; + + /** + * Helper method, that populate `fr` and `dfr` 2D-arrays (n,l) with P(n), dP_dr for given coordinate r + * @param r + * @param maxn + * @param z1 + * @param z2 + */ + void fill_Rnl(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); + + void fill_gk(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); +}; + + +#endif diff --git a/src/Makefile b/src/Makefile index a63c49e344..bec0a2b16b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -63,7 +63,7 @@ PACKLIB = compress gpu kim kokkos latte message mpiio mscg poems \ python voronoi \ user-adios user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \ user-netcdf user-plumed user-qmmm user-quip user-scafacos \ - user-smd user-vtk user-mesont + user-smd user-vtk user-mesont user-pace PACKSYS = compress mpiio python user-lb @@ -71,7 +71,7 @@ PACKINT = gpu kokkos message poems user-atc user-awpmd user-colvars user-mesont PACKEXT = kim latte mscg voronoi \ user-adios user-h5md user-molfile user-netcdf user-plumed user-qmmm user-quip \ - user-smd user-vtk + user-smd user-vtk user-pace PACKALL = $(PACKAGE) $(PACKUSER) diff --git a/src/USER-PACE/Install.sh b/src/USER-PACE/Install.sh new file mode 100644 index 0000000000..4d87b0e3ed --- /dev/null +++ b/src/USER-PACE/Install.sh @@ -0,0 +1,68 @@ +# Install.sh file that integrates the settings from the lib folder into the conventional build process (make build?) + +# COPIED FROM src/KIM/Install.sh: + +# # Install/unInstall package files in LAMMPS +# # mode = 0/1/2 for uninstall/install/update + +# mode=$1 + +# # enforce using portable C locale +# LC_ALL=C +# export LC_ALL + +# # arg1 = file, arg2 = file it depends on + +# action () { +# if (test $mode = 0) then +# rm -f ../$1 +# elif (! cmp -s $1 ../$1) then +# if (test -z "$2" || test -e ../$2) then +# cp $1 .. +# if (test $mode = 2) then +# echo " updating src/$1" +# fi +# fi +# elif (test -n "$2") then +# if (test ! -e ../$2) then +# rm -f ../$1 +# fi +# fi +# } + +# # all package files with no dependencies + +# for file in *.cpp *.h; do +# test -f ${file} && action $file +# done + +# # edit 2 Makefile.package files to include/exclude package info + +# if (test $1 = 1) then + +# if (test -e ../Makefile.package) then +# sed -i -e 's/[^ \t]*kim[^ \t]* //' ../Makefile.package +# sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(kim_SYSINC) |' ../Makefile.package +# sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(kim_SYSLIB) |' ../Makefile.package +# sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(kim_SYSPATH) |' ../Makefile.package +# fi + +# if (test -e ../Makefile.package.settings) then +# sed -i -e '/^include.*kim.*$/d' ../Makefile.package.settings +# # multiline form needed for BSD sed on Macs +# sed -i -e '4 i \ +# include ..\/..\/lib\/kim\/Makefile.lammps +# ' ../Makefile.package.settings +# fi + +# elif (test $1 = 0) then + +# if (test -e ../Makefile.package) then +# sed -i -e 's/[^ \t]*kim[^ \t]* //' ../Makefile.package +# fi + +# if (test -e ../Makefile.package.settings) then +# sed -i -e '/^include.*kim.*$/d' ../Makefile.package.settings +# fi + +# fi diff --git a/src/USER-PACE/LICENSE b/src/USER-PACE/LICENSE new file mode 100644 index 0000000000..f288702d2f --- /dev/null +++ b/src/USER-PACE/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp new file mode 100644 index 0000000000..a515b7b4b0 --- /dev/null +++ b/src/USER-PACE/pair_pace.cpp @@ -0,0 +1,458 @@ +/* +Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + +^1: Ruhr-University Bochum, Bochum, Germany +^2: University of Cambridge, Cambridge, United Kingdom +^3: Sandia National Laboratories, Albuquerque, New Mexico, USA +^4: University of British Columbia, Vancouver, BC, Canada + + + This FILENAME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + + +// +// Created by Lysogorskiy Yury on 27.02.20. +// + +#include +#include +#include +#include +#include "pair_pace.h" +#include "atom.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "force.h" +#include "comm.h" +#include "memory.h" +#include "error.h" + + +#include "math_const.h" + +#include "ace_version.h" + +using namespace LAMMPS_NS; +using namespace MathConst; + +#define MAXLINE 1024 +#define DELTA 4 + +//added YL + +//keywords for ACE evaluator style +#define RECURSIVE_KEYWORD "recursive" +#define PRODUCT_KEYWORD "product" + + +int elements_num_pace = 104; +char const *const elements_pace[104] = {"X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", + "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", + "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", + "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", + "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", + "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", + "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", + "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr" +}; + +int AtomicNumberByName_pace(char *elname) { + for (int i = 1; i < elements_num_pace; i++) + if (strcmp(elname, elements_pace[i]) == 0) + return i; + return -1; +} + + +/* ---------------------------------------------------------------------- */ +PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) { + //single_enable = 0; + restartinfo = 0; + one_coeff = 1; + manybody_flag = 1; + + nelements = 0; + + ace = NULL; + potential_file_name = NULL; + elements = NULL; + map = NULL; +} + +/* ---------------------------------------------------------------------- + check if allocated, since class can be destructed when incomplete +------------------------------------------------------------------------- */ + +PairPACE::~PairPACE() { + if (copymode) return; + + if (elements) + for (int i = 0; i < nelements; i++) delete[] elements[i]; + delete[] elements; + + + delete[] potential_file_name; + + delete basis_set; + delete ace; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(map); + memory->destroy(scale); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairPACE::compute(int eflag, int vflag) { + int i, j, ii, jj, inum, jnum; + double delx, dely, delz, evdwl; + double fij[3]; + int *ilist, *jlist, *numneigh, **firstneigh; + + ev_init(eflag, vflag); + + // downwards modified by YL + + double **x = atom->x; + double **f = atom->f; + tagint *tag = atom->tag; + int *type = atom->type; + + // number of atoms in cell + int nlocal = atom->nlocal; + + int newton_pair = force->newton_pair; + + // number of atoms including ghost atoms + int nall = nlocal + atom->nghost; + + // inum: length of the neighborlists list + inum = list->inum; + + // ilist: list of "i" atoms for which neighbor lists exist + ilist = list->ilist; + + //numneigh: the length of each these neigbor list + numneigh = list->numneigh; + + // the pointer to the list of neighbors of "i" + firstneigh = list->firstneigh; + + if (inum != nlocal) { + char str[128]; + snprintf(str,128,"inum: %d nlocal: %d are different",inum, nlocal); + error->all(FLERR,str); + } + + + // Aidan Thompson told RD (26 July 2019) that practically always holds: + // inum = nlocal + // i = ilist(ii) < inum + // j = jlist(jj) < nall + // neighborlist contains neighbor atoms plus skin atoms, + // skin atoms can be removed by setting skin to zero but here + // they are disregarded anyway + + + //determine the maximum number of neighbours + int max_jnum = -1; + int nei = 0; + for (ii = 0; ii < list->inum; ii++) { + i = ilist[ii]; + jnum = numneigh[i]; + nei = nei + jnum; + if (jnum > max_jnum) + max_jnum = jnum; + } + + ace->resize_neighbours_cache(max_jnum); + + //loop over atoms + for (ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + // checking if neighbours are actually within cutoff range is done inside compute_atom + // mapping from LAMMPS atom types ('type' array) to ACE species is done inside compute_atom + // by using 'ace->element_type_mapping' array + // x: [r0 ,r1, r2, ..., r100] + // i = 0 ,1 + // jnum(0) = 50 + // jlist(neigh ind of 0-atom) = [1,2,10,7,99,25, .. 50 element in total] + try { + ace->compute_atom(i, x, type, jnum, jlist); + } catch (exception &e) { + error->all(FLERR, e.what()); + exit(EXIT_FAILURE); + } + // 'compute_atom' will update the `ace->e_atom` and `ace->neighbours_forces(jj, alpha)` arrays + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + const int jtype = type[j]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + + fij[0] = scale[itype][jtype]*ace->neighbours_forces(jj, 0); + fij[1] = scale[itype][jtype]*ace->neighbours_forces(jj, 1); + fij[2] = scale[itype][jtype]*ace->neighbours_forces(jj, 2); + + + f[i][0] += fij[0]; + f[i][1] += fij[1]; + f[i][2] += fij[2]; + f[j][0] -= fij[0]; + f[j][1] -= fij[1]; + f[j][2] -= fij[2]; + + // tally per-atom virial contribution + if (vflag) + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, + fij[0], fij[1], fij[2], + -delx, -dely, -delz); + } + + // tally energy contribution + if (eflag) { + // evdwl = energy of atom I + evdwl = scale[1][1]*ace->e_atom; + ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); + } + } + + if (vflag_fdotr) virial_fdotr_compute(); + + + // end modifications YL +} + +/* ---------------------------------------------------------------------- */ + +void PairPACE::allocate() { + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag, n + 1, n + 1, "pair:setflag"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); + memory->create(map, n + 1, "pair:map"); + memory->create(scale, n + 1, n + 1,"pair:scale"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairPACE::settings(int narg, char **arg) { + if (narg > 1) { + error->all(FLERR, + "Illegal pair_style command. Correct form:\n\tpair_style pace\nor\n\tpair_style pace "); + error->all(FLERR, RECURSIVE_KEYWORD); + error->all(FLERR, "or\n\tpair_style pace "); + error->all(FLERR, PRODUCT_KEYWORD); + } + recursive = true; // default evaluator style: RECURSIVE + if (narg > 0) { + if (strcmp(arg[0], RECURSIVE_KEYWORD) == 0) + recursive = true; + else if (strcmp(arg[0], PRODUCT_KEYWORD) == 0) { + recursive = false; + } else { + error->all(FLERR, + "Illegal pair_style command: pair_style pace "); + error->all(FLERR, arg[0]); + error->all(FLERR, "\nCorrect form:\n\tpair_style pace\nor\n\tpair_style pace recursive"); + } + } + + if (comm->me == 0) { + if (screen) fprintf(screen, "ACE version: %d.%d.%d\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); + if (logfile) fprintf(logfile, "ACE version: %d.%d.%d\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); + + if (recursive) { + if (screen) fprintf(screen, "Recursive evaluator is used\n"); + if (logfile) fprintf(logfile, "Recursive evaluator is used\n"); + } else { + if (screen) fprintf(screen, "Product evaluator is used\n"); + if (logfile) fprintf(logfile, "Product evaluator is used\n"); + } + } + + +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairPACE::coeff(int narg, char **arg) { + + if (narg < 4) + error->all(FLERR, + "Incorrect args for pair coefficients. Correct form:\npair_coeff * * elem1 elem2 ..."); + + if (!allocated) allocate(); + + //number of provided elements in pair_coeff line + int ntypes_coeff = narg - 3; + + if (ntypes_coeff != atom->ntypes) { + char error_message[1024]; + snprintf(error_message, 1024, + "Incorrect args for pair coefficients. You provided %d elements in pair_coeff, but structure has %d atom types", + ntypes_coeff, atom->ntypes); + error->all(FLERR, error_message); + } + + char *type1 = arg[0]; + char *type2 = arg[1]; + char *potential_file_name = arg[2]; + char **elemtypes = &arg[3]; + + // insure I,J args are * * + + if (strcmp(type1, "*") != 0 || strcmp(type2, "*") != 0) + error->all(FLERR, "Incorrect args for pair coefficients"); + + + //load potential file + basis_set = new ACECTildeBasisSet(); + if (comm->me == 0) { + if (screen) fprintf(screen, "Loading %s\n", potential_file_name); + if (logfile) fprintf(logfile, "Loading %s\n", potential_file_name); + } + basis_set->load(potential_file_name); + + if (comm->me == 0) { + if (screen) fprintf(screen, "Total number of basis functions\n"); + if (logfile) fprintf(logfile, "Total number of basis functions\n"); + + for (SPECIES_TYPE mu = 0; mu < basis_set->nelements; mu++) { + int n_r1 = basis_set->total_basis_size_rank1[mu]; + int n = basis_set->total_basis_size[mu]; + if (screen) fprintf(screen, "\t%s: %d (r=1) %d (r>1)\n", basis_set->elements_name[mu].c_str(), n_r1, n); + if (logfile) fprintf(logfile, "\t%s: %d (r=1) %d (r>1)\n", basis_set->elements_name[mu].c_str(), n_r1, n); + } + } + + // read args that map atom types to pACE elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used + + ace = new ACERecursiveEvaluator(); + ace->set_recursive(recursive); + ace->element_type_mapping.init(atom->ntypes + 1); + + for (int i = 1; i <= atom->ntypes; i++) { + char *elemname = elemtypes[i - 1]; + int atomic_number = AtomicNumberByName_pace(elemname); + if (atomic_number == -1) { + char error_msg[1024]; + snprintf(error_msg, 1024, "String '%s' is not a valid element\n", elemname); + error->all(FLERR, error_msg); + } + SPECIES_TYPE mu = basis_set->get_species_index_by_name(elemname); + if (mu != -1) { + if (comm->me == 0) { + if (screen) + fprintf(screen, "Mapping LAMMPS atom type #%d(%s) -> ACE species type #%d\n", i, elemname, mu); + if (logfile) + fprintf(logfile, "Mapping LAMMPS atom type #%d(%s) -> ACE species type #%d\n", i, elemname, mu); + } + map[i] = mu; + ace->element_type_mapping(i) = mu; // set up LAMMPS atom type to ACE species mapping for ace evaluator + } else { + char error_msg[1024]; + snprintf(error_msg, 1024, "Element %s is not supported by ACE-potential from file %s", elemname, + potential_file_name); + error->all(FLERR, error_msg); + } + } + + // clear setflag since coeff() called once with I,J = * * + int n = atom->ntypes; + for (int i = 1; i <= n; i++) { + for (int j = i; j <= n; j++) { + setflag[i][j] = 1; + scale[i][j] = 1.0; + } + } + + // set setflag i,j for type pairs where both are mapped to elements + + int count = 1; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + if (map[i] >= 0 && map[j] >= 0) { + setflag[i][j] = 1; + count++; + } + + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); + + ace->set_basis(*basis_set, 1); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairPACE::init_style() { + if (atom->tag_enable == 0) + error->all(FLERR, "Pair style pACE requires atom IDs"); + if (force->newton_pair == 0) + error->all(FLERR, "Pair style pACE requires newton pair on"); + + // request a full neighbor list + int irequest = neighbor->request(this, instance_me); + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairPACE::init_one(int i, int j) { + if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); + //cutoff from the basis set's radial functions settings + scale[j][i] = scale[i][j]; + return basis_set->radial_functions->cut(map[i], map[j]); +} + +/* ---------------------------------------------------------------------- + extract method for extracting value of scale variable + ---------------------------------------------------------------------- */ +void *PairPACE::extract(const char *str, int &dim) +{ + dim = 2; + if (strcmp(str,"scale") == 0) return (void *) scale; + return NULL; +} + diff --git a/src/USER-PACE/pair_pace.h b/src/USER-PACE/pair_pace.h new file mode 100644 index 0000000000..3fccbd98f0 --- /dev/null +++ b/src/USER-PACE/pair_pace.h @@ -0,0 +1,97 @@ +/* +Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, + Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, + Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 + +^1: Ruhr-University Bochum, Bochum, Germany +^2: University of Cambridge, Cambridge, United Kingdom +^3: Sandia National Laboratories, Albuquerque, New Mexico, USA +^4: University of British Columbia, Vancouver, BC, Canada + + + This FILENAME is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + + +// +// Created by Lysogorskiy Yury on 27.02.20. +// + + +#ifdef PAIR_CLASS + +PairStyle(pace,PairPACE) + +#else + +#ifndef LMP_PAIR_PACE_H +#define LMP_PAIR_PACE_H + +#include "pair.h" +#include "ace_evaluator.h" +#include "ace_recursive.h" +#include "ace_c_basis.h" + +namespace LAMMPS_NS { + + class PairPACE : public Pair { + public: + PairPACE(class LAMMPS *); + + virtual ~PairPACE(); + + virtual void compute(int, int); + + void settings(int, char **); + + void coeff(int, char **); + + virtual void init_style(); + + double init_one(int, int); + + void *extract(const char *, int &); + + // virtual double memory_usage(); + + protected: + ACECTildeBasisSet *basis_set = nullptr; + + ACERecursiveEvaluator *ace = nullptr; + + char *potential_file_name; + + virtual void allocate(); + + void read_files(char *, char *); + + inline int equal(double *x, double *y); + + + double rcutmax; // max cutoff for all elements + int nelements; // # of unique elements + char **elements; // names of unique elements + + int *map; // mapping from atom types to elements + int *jlist_local; + int *type_local; + double **scale; + + bool recursive = false; // "recursive" option for ACERecursiveEvaluator + }; + +} + +#endif +#endif \ No newline at end of file From d346c539147ae666741494657646a8d885741312 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 11:28:19 -0400 Subject: [PATCH 270/370] silence compiler warnings about formats --- src/USER-REAXC/reaxc_tool_box.cpp | 45 +++++++++++++++---------------- src/USER-REAXC/reaxc_traj.h | 16 ++++++----- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index f0171d2108..abab3f2b43 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -25,10 +25,11 @@ ----------------------------------------------------------------------*/ #include "reaxc_tool_box.h" +#include "reaxc_defs.h" + #include #include #include -#include "reaxc_defs.h" #include "error.h" @@ -49,62 +50,58 @@ int Tokenize( char* s, char*** tok ) return count; } - - /* safe malloc */ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) { void *ptr; - char errmsg[256]; if (n <= 0) { - snprintf(errmsg, 256, "Trying to allocate %ld bytes for array %s. " - "returning NULL.", n, name); + auto errmsg = fmt::format("Trying to allocate {} bytes for array {}. " + "returning NULL.", n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); return nullptr; } ptr = malloc( n ); if (ptr == nullptr) { - snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); + auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", + n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); } return ptr; } - /* safe calloc */ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const char *name ) { void *ptr; - char errmsg[256]; if (n <= 0) { - snprintf(errmsg, 256, "Trying to allocate %ld elements for array %s. " - "returning NULL.\n", n, name ); + auto errmsg = fmt::format("Trying to allocate {} elements for array {}. " + "returning NULL.\n", n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); return nullptr; } if (size <= 0) { - snprintf(errmsg, 256, "Elements size for array %s is %ld. " - "returning NULL", name, size ); + auto errmsg = fmt::format("Elements size for array {} is {}. " + "returning NULL", name, size); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); return nullptr; } ptr = calloc( n, size ); if (ptr == nullptr) { - char errmsg[256]; - snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); + auto errmsg = fmt::format("Failed to allocate {} bytes for array {}", + n*size, name); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); } return ptr; @@ -115,14 +112,14 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) { if (ptr == nullptr) { - char errmsg[256]; - snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); + auto errmsg = fmt::format("Trying to free the already free()'d pointer {}", + name); if (error_ptr) error_ptr->one(FLERR,errmsg); - else fputs(errmsg,stderr); + else fputs(errmsg.c_str(),stderr); return; } - free( ptr ); + free(ptr); ptr = nullptr; } diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 4966bf11d8..2ff5995204 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -36,14 +36,18 @@ #define HEADER_LINE_LEN 62 #define STR_LINE "%-37s%-24s\n" #define INT_LINE "%-37s%-24d\n" -#define BIGINT_LINE "%-37s%-24ld\n" +#if defined(LAMMPS_SMALLSMALL) +#define BIGINT_LINE "%-37s%-24d\n" +#else +#define BIGINT_LINE "%-37s%-24lld\n" +#endif #define INT2_LINE "%-36s%-12d,%-12d\n" #define REAL_LINE "%-37s%-24.3f\n" #define SCI_LINE "%-37s%-24g\n" #define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n" #if defined(LAMMPS_BIGBIG) -#define INIT_DESC "%9ld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass +#define INIT_DESC "%9lld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass #else #define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass #endif @@ -56,7 +60,7 @@ #define SIZE_INFO_LEN3 31 #if defined(LAMMPS_BIGBIG) -#define ATOM_BASIC "%9ld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge +#define ATOM_BASIC "%9lld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge #define ATOM_wV "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge #define ATOM_wF "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge #define ATOM_FULL "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge @@ -72,9 +76,9 @@ #define ATOM_FULL_LEN 110 #if defined(LAMMPS_BIGBIG) -#define BOND_BASIC "%9ld%9ld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO -#define BOND_FULL "%9ld%9ld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 -#define ANGLE_BASIC "%9ld%9ld%9ld%10.3f\n" // Atom1 Atom2 Atom3 Theta +#define BOND_BASIC "%9lld%9lld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO +#define BOND_FULL "%9lld%9lld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 +#define ANGLE_BASIC "%9lld%9lld%9lld%10.3f\n" // Atom1 Atom2 Atom3 Theta #else #define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO #define BOND_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 From db400c91aec560f8b04a83c8de4141724d1df89e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 11:37:59 -0400 Subject: [PATCH 271/370] relax error a little bit to avoid failure on macos --- unittest/force-styles/tests/fix-timestep-adapt_coul.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml index 4bf25f3b33..cd7f9aa87d 100644 --- a/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml +++ b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Thu Mar 25 14:07:45 202 -epsilon: 1e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full fix adapt From e01e0298cb9587cac513face286643ff1e7d6b07 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 13:25:24 -0400 Subject: [PATCH 272/370] fix uninitialized data access after restart bug in USER-YAFF pair styles also fix some source formatting issues --- src/KSPACE/pair_lj_cut_coul_long.cpp | 16 +++++++------- .../pair_lj_switch3_coulgauss_long.cpp | 22 ++++++++++--------- .../pair_mm3_switch3_coulgauss_long.cpp | 20 +++++++++-------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index fcb39b8c6e..5d04fd1cfb 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -17,21 +17,21 @@ #include "pair_lj_cut_coul_long.h" -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 6e4c0587f7..2247a9467c 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -106,6 +106,7 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) firstneigh = list->firstneigh; // loop over neighbors of my atoms + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; qtmp = q[i]; @@ -193,7 +194,7 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) offset[itype][jtype]; } else evdwl = 0.0; - // Truncation, see Yaff Switch33 + // Truncation, see Yaff Switch3 if (truncw>0) { if (rsq < cut_ljsq[itype][jtype]) { if (r>cut_lj[itype][jtype]-truncw) { @@ -262,19 +263,18 @@ void PairLJSwitch3CoulGaussLong::allocate() void PairLJSwitch3CoulGaussLong::settings(int narg, char **arg) { - if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); + if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) { cut_coul = cut_lj_global; truncw = utils::numeric(FLERR,arg[1],false,lmp); - } - else { + } else { cut_coul = utils::numeric(FLERR,arg[1],false,lmp); truncw = utils::numeric(FLERR,arg[2],false,lmp); } - if (truncw>0.0) truncwi = 1.0/truncw; - else truncwi = 0.0; + // reset cutoffs that have been explicitly set if (allocated) { @@ -332,6 +332,9 @@ void PairLJSwitch3CoulGaussLong::init_style() cut_coulsq = cut_coul * cut_coul; + if (truncw>0.0) truncwi = 1.0/truncw; + else truncwi = 0.0; + // insure use of KSpace long-range solver, set g_ewald if (force->kspace == nullptr) @@ -375,8 +378,7 @@ double PairLJSwitch3CoulGaussLong::init_one(int i, int j) double r6inv = r2inv*r2inv*r2inv; double r12inv = r6inv*r6inv; offset[i][j] = lj3[i][j]*r12inv-lj4[i][j]*r6inv; - } - else {offset[i][j] = 0.0;} + } else {offset[i][j] = 0.0;} } else offset[i][j] = 0.0; cut_ljsq[j][i] = cut_ljsq[i][j]; @@ -431,8 +433,7 @@ double PairLJSwitch3CoulGaussLong::init_one(int i, int j) double t71 = -0.4e1 * cg * (0.2e1 * t10 * t11 - 0.2e1 * t10 * t14 + (cg5 - 0.2e1 * cg1) * t58 * cg5) * t26 / t4 / t41 / t9; etail_ij = 2.0*MY_PI*all[0]*all[1]*t71; ptail_ij = 2.0*MY_PI*all[0]*all[1]*t71; - } - else { + } else { double t1 = pow(cg3, 0.2e1); double t2 = t1 * t1; double t3 = t2 * t1; @@ -618,6 +619,7 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; + prefactor2 = 0.0; } else { r = sqrt(rsq); rrij = lj2[itype][jtype]*r; diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 67a322ca24..c7fcac855a 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -106,6 +106,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag) firstneigh = list->firstneigh; // loop over neighbors of my atoms + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; qtmp = q[i]; @@ -170,6 +171,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag) expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; + prefactor2 = 0.0; } else { rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); @@ -263,19 +265,18 @@ void PairMM3Switch3CoulGaussLong::allocate() void PairMM3Switch3CoulGaussLong::settings(int narg, char **arg) { - if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); + if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) { cut_coul = cut_lj_global; truncw = utils::numeric(FLERR,arg[1],false,lmp); - } - else { + } else { cut_coul = utils::numeric(FLERR,arg[1],false,lmp); truncw = utils::numeric(FLERR,arg[2],false,lmp); } - if (truncw>0.0) truncwi = 1.0/truncw; - else truncwi = 0.0; + // reset cutoffs that have been explicitly set if (allocated) { @@ -333,6 +334,9 @@ void PairMM3Switch3CoulGaussLong::init_style() cut_coulsq = cut_coul * cut_coul; + if (truncw>0.0) truncwi = 1.0/truncw; + else truncwi = 0.0; + // insure use of KSpace long-range solver, set g_ewald if (force->kspace == nullptr) @@ -375,8 +379,7 @@ double PairMM3Switch3CoulGaussLong::init_one(int i, int j) double r6inv = r2inv*r2inv*r2inv; double expb = lj3[i][j]*exp(-lj1[i][j]*r); offset[i][j] = expb-lj4[i][j]*r6inv; - } - else {offset[i][j] = 0.0;} + } else {offset[i][j] = 0.0;} } else offset[i][j] = 0.0; cut_ljsq[j][i] = cut_ljsq[i][j]; @@ -426,8 +429,7 @@ double PairMM3Switch3CoulGaussLong::init_one(int i, int j) double t64 = cg * (0.6388888889e3 * ((-t3 + (0.7e1 / 0.36e2 * cg5 - t5) * t1 - 0.2e1 / 0.3e1 * t8 * (cg5 - cg1 / 0.4e1) * cg3 + cg5 * t14) * t20 + t3 + (cg5 / 0.12e2 + t5) * t1 + (cg5 + cg1 / 0.3e1) * cg1 * cg3 / 0.2e1 + t30 * cg5) * t2 * t36 * t39 - 0.225e1 * (0.2e1 * t43 * t44 - 0.2e1 * t43 * t47 + cg5 * (cg5 - 0.2e1 * cg1)) * t54 * t1 / cg1 / t8 * t39); etail_ij = 2.0*MY_PI*all[0]*all[1]*t64; ptail_ij = 2.0*MY_PI*all[0]*all[1]*t64; - } - else { + } else { double t2 = pow(cg3, 0.2e1); double t3 = t2 * t2; double t7 = 0.12e2 / cg3 * cg1; From 698b9b9519000b8976084714a977a6ce25a880d3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 13:36:27 -0400 Subject: [PATCH 273/370] relax epsilon some more --- unittest/force-styles/tests/fix-timestep-adapt_coul.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml index cd7f9aa87d..f0ec2f1292 100644 --- a/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml +++ b/unittest/force-styles/tests/fix-timestep-adapt_coul.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Thu Mar 25 14:07:45 202 -epsilon: 7.5e-14 +epsilon: 5e-13 prerequisites: ! | atom full fix adapt From e5a665c1d97f48041e8be7760dcfe53aae509233 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 14:45:07 -0400 Subject: [PATCH 274/370] Add utilities for Python code --- src/PYTHON/python_utils.h | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/PYTHON/python_utils.h diff --git a/src/PYTHON/python_utils.h b/src/PYTHON/python_utils.h new file mode 100644 index 0000000000..82422916ff --- /dev/null +++ b/src/PYTHON/python_utils.h @@ -0,0 +1,42 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_PYTHON_UTILS_H +#define LMP_PYTHON_UTILS_H + +#include + +namespace LAMMPS_NS { + +namespace PyUtils { + +class GIL { + PyGILState_STATE gstate; +public: + GIL() : gstate(PyGILState_Ensure()) { + } + ~GIL() { + PyGILState_Release(gstate); + } +}; + +static void Print_Errors() { + PyErr_Print(); + PyErr_Clear(); +} + +} + +} + +#endif From da5bd578ad826a6f83542251e3f9bd61d552afd9 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 14:46:35 -0400 Subject: [PATCH 275/370] Simplify python_impl.cpp --- src/PYTHON/python_impl.cpp | 62 ++++++++++++++------------------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index c83385410a..7e46da4c49 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -21,6 +21,7 @@ #include "input.h" #include "memory.h" #include "python_compat.h" +#include "python_utils.h" #include "variable.h" #include @@ -91,13 +92,12 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) } #endif - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *pModule = PyImport_AddModule("__main__"); if (!pModule) error->all(FLERR,"Could not initialize embedded Python"); pyMain = (void *) pModule; - PyGILState_Release(gstate); } /* ---------------------------------------------------------------------- */ @@ -106,23 +106,19 @@ PythonImpl::~PythonImpl() { if (pyMain) { // clean up - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; for (int i = 0; i < nfunc; i++) { delete [] pfuncs[i].name; deallocate(i); - PyObject *pFunc = (PyObject *) pfuncs[i].pFunc; - Py_XDECREF(pFunc); + Py_CLEAR(pfuncs[i].pFunc); } + } - // shutdown Python interpreter - - if (!external_interpreter) { - Py_Finalize(); - } - else { - PyGILState_Release(gstate); - } + // shutdown Python interpreter + if (!external_interpreter) { + PyGILState_STATE gstate = PyGILState_Ensure(); + Py_Finalize(); } memory->sfree(pfuncs); @@ -228,7 +224,7 @@ void PythonImpl::command(int narg, char **arg) int ifunc = create_entry(arg[0]); - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; // send Python code to Python interpreter // file: read the file via PyRun_SimpleFile() @@ -239,14 +235,14 @@ void PythonImpl::command(int narg, char **arg) FILE *fp = fopen(pyfile,"r"); if (fp == nullptr) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not open Python file"); } int err = PyRun_SimpleFile(fp,pyfile); if (err) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not process Python file"); } @@ -255,7 +251,7 @@ void PythonImpl::command(int narg, char **arg) int err = PyRun_SimpleString(herestr); if (err) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not process Python string"); } } @@ -266,13 +262,13 @@ void PythonImpl::command(int narg, char **arg) PyObject *pFunc = PyObject_GetAttrString(pModule,pfuncs[ifunc].name); if (!pFunc) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,fmt::format("Could not find Python function {}", pfuncs[ifunc].name)); } if (!PyCallable_Check(pFunc)) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,fmt::format("Python function {} is not callable", pfuncs[ifunc].name)); } @@ -284,14 +280,13 @@ void PythonImpl::command(int narg, char **arg) delete [] istr; delete [] format; delete [] pyfile; - PyGILState_Release(gstate); } /* ------------------------------------------------------------------ */ void PythonImpl::invoke_function(int ifunc, char *result) { - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *pValue; char *str; @@ -303,7 +298,6 @@ void PythonImpl::invoke_function(int ifunc, char *result) PyObject *pArgs = PyTuple_New(ninput); if (!pArgs) { - PyGILState_Release(gstate); error->all(FLERR,"Could not create Python function arguments"); } @@ -314,7 +308,6 @@ void PythonImpl::invoke_function(int ifunc, char *result) str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); if (!str) { - PyGILState_Release(gstate); error->all(FLERR,"Could not evaluate Python function input variable"); } @@ -327,7 +320,6 @@ void PythonImpl::invoke_function(int ifunc, char *result) str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); if (!str) { - PyGILState_Release(gstate); error->all(FLERR,"Could not evaluate Python function input variable"); } @@ -339,7 +331,6 @@ void PythonImpl::invoke_function(int ifunc, char *result) if (pfuncs[ifunc].ivarflag[i]) { str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); if (!str) { - PyGILState_Release(gstate); error->all(FLERR,"Could not evaluate Python function input variable"); } @@ -350,7 +341,6 @@ void PythonImpl::invoke_function(int ifunc, char *result) } else if (itype == PTR) { pValue = PY_VOID_POINTER(lmp); } else { - PyGILState_Release(gstate); error->all(FLERR,"Unsupported variable type"); } PyTuple_SetItem(pArgs,i,pValue); @@ -360,15 +350,13 @@ void PythonImpl::invoke_function(int ifunc, char *result) // error check with one() since only some procs may fail pValue = PyObject_CallObject(pFunc,pArgs); + Py_CLEAR(pArgs); if (!pValue) { - PyErr_Print(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->one(FLERR,"Python function evaluation failed"); } - Py_DECREF(pArgs); - // function returned a value // assign it to result string stored by python-style variable // or if user specified a length, assign it to longstr @@ -385,10 +373,8 @@ void PythonImpl::invoke_function(int ifunc, char *result) strncpy(pfuncs[ifunc].longstr,pystr,pfuncs[ifunc].length_longstr); else strncpy(result,pystr,VALUELENGTH-1); } - Py_DECREF(pValue); } - - PyGILState_Release(gstate); + Py_CLEAR(pValue); } /* ------------------------------------------------------------------ */ @@ -523,11 +509,8 @@ int PythonImpl::create_entry(char *name) int PythonImpl::execute_string(char *cmd) { - PyGILState_STATE gstate = PyGILState_Ensure(); - int err = PyRun_SimpleString(cmd); - PyGILState_Release(gstate); - - return err; + PyUtils::GIL lock; + return PyRun_SimpleString(cmd); } /* ---------------------------------------------------------------------- */ @@ -537,9 +520,8 @@ int PythonImpl::execute_file(char *fname) FILE *fp = fopen(fname,"r"); if (fp == nullptr) return -1; - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; int err = PyRun_SimpleFile(fp,fname); - PyGILState_Release(gstate); if (fp) fclose(fp); return err; From 5ee24c5b8994bd12555e40f3a9717c1d6d0cd96c Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 14:47:20 -0400 Subject: [PATCH 276/370] Update fix_python_invoke --- src/PYTHON/fix_python_invoke.cpp | 49 ++++++++++++++++++-------------- src/PYTHON/fix_python_invoke.h | 4 ++- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 23c4197dca..6483e21f91 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -21,6 +21,7 @@ #include "error.h" #include "lmppython.h" #include "python_compat.h" +#include "python_utils.h" #include "update.h" #include @@ -51,12 +52,12 @@ FixPythonInvoke::FixPythonInvoke(LAMMPS *lmp, int narg, char **arg) : } // get Python function - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *pyMain = PyImport_AddModule("__main__"); if (!pyMain) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not initialize embedded Python"); } @@ -64,11 +65,19 @@ FixPythonInvoke::FixPythonInvoke(LAMMPS *lmp, int narg, char **arg) : pFunc = PyObject_GetAttrString(pyMain, fname); if (!pFunc) { - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not find Python function"); } - PyGILState_Release(gstate); + lmpPtr = PY_VOID_POINTER(lmp); +} + +/* ---------------------------------------------------------------------- */ + +FixPythonInvoke::~FixPythonInvoke() +{ + PyUtils::GIL lock; + Py_CLEAR(lmpPtr); } /* ---------------------------------------------------------------------- */ @@ -82,18 +91,16 @@ int FixPythonInvoke::setmask() void FixPythonInvoke::end_of_step() { - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; - PyObject *ptr = PY_VOID_POINTER(lmp); - PyObject *arglist = Py_BuildValue("(O)", ptr); + PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "O", (PyObject*)lmpPtr); - PyObject *result = PyEval_CallObject((PyObject*)pFunc, arglist); - Py_DECREF(arglist); - if (!result && (comm->me == 0)) PyErr_Print(); - - PyGILState_Release(gstate); - if (!result) + if (!result) { + PyUtils::Print_Errors(); error->all(FLERR,"Fix python/invoke end_of_step() method failed"); + } + + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ @@ -102,16 +109,14 @@ void FixPythonInvoke::post_force(int vflag) { if (update->ntimestep % nevery != 0) return; - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; - PyObject *ptr = PY_VOID_POINTER(lmp); - PyObject *arglist = Py_BuildValue("(Oi)", ptr, vflag); + PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "Oi", (PyObject*)lmpPtr, vflag); - PyObject *result = PyEval_CallObject((PyObject*)pFunc, arglist); - Py_DECREF(arglist); - if (!result && (comm->me == 0)) PyErr_Print(); - - PyGILState_Release(gstate); - if (!result) + if (!result) { + PyUtils::Print_Errors(); error->all(FLERR,"Fix python/invoke post_force() method failed"); + } + + Py_CLEAR(result); } diff --git a/src/PYTHON/fix_python_invoke.h b/src/PYTHON/fix_python_invoke.h index 89310eeded..48fb0b404f 100644 --- a/src/PYTHON/fix_python_invoke.h +++ b/src/PYTHON/fix_python_invoke.h @@ -21,6 +21,7 @@ FixStyle(python,FixPythonInvoke) #ifndef LMP_FIX_PYTHON_INVOKE_H #define LMP_FIX_PYTHON_INVOKE_H + #include "fix.h" namespace LAMMPS_NS { @@ -28,12 +29,13 @@ namespace LAMMPS_NS { class FixPythonInvoke : public Fix { public: FixPythonInvoke(class LAMMPS *, int, char **); - virtual ~FixPythonInvoke() {} + virtual ~FixPythonInvoke(); int setmask(); virtual void end_of_step(); virtual void post_force(int); private: + void * lmpPtr; void * pFunc; int selected_callback; }; From 7e9fa25121a4f1e5ed1c2a25f0e8486c9c1d8076 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 14:48:44 -0400 Subject: [PATCH 277/370] Update fix_python_move.cpp --- src/PYTHON/fix_python_move.cpp | 177 +++++++++++---------------------- 1 file changed, 59 insertions(+), 118 deletions(-) diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index 5425b78193..e04a32afe4 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -21,8 +21,9 @@ #include "error.h" #include "lmppython.h" #include "python_compat.h" +#include "python_utils.h" -#include +#include #include // IWYU pragma: export using namespace LAMMPS_NS; @@ -40,7 +41,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : py_move = nullptr; - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; // add current directory to PYTHONPATH PyObject *py_path = PySys_GetObject((char *)"path"); @@ -48,70 +49,50 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : // create integrator instance - char *full_cls_name = arg[3]; - char *lastpos = strrchr(full_cls_name, '.'); + std::string full_cls_name = arg[3]; + size_t lastpos = full_cls_name.rfind("."); - if (lastpos == nullptr) { + if (lastpos == std::string::npos) { error->all(FLERR,"Fix python/integrate requires fully qualified class name"); } - size_t module_name_length = strlen(full_cls_name) - strlen(lastpos); - size_t cls_name_length = strlen(lastpos)-1; + std::string module_name = full_cls_name.substr(0, lastpos); + std::string cls_name = full_cls_name.substr(lastpos+1); - char *module_name = new char[module_name_length+1]; - char *cls_name = new char[cls_name_length+1]; - strncpy(module_name, full_cls_name, module_name_length); - module_name[module_name_length] = 0; - - strcpy(cls_name, lastpos+1); - - PyObject *pModule = PyImport_ImportModule(module_name); + PyObject *pModule = PyImport_ImportModule(module_name.c_str()); if (!pModule) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Loading python integrator module failure"); } // create LAMMPS atom type to potential file type mapping in python class // by calling 'lammps_pair_style.map_coeff(name,type)' - PyObject *py_move_type = PyObject_GetAttrString(pModule, cls_name); + PyObject *py_move_type = PyObject_GetAttrString(pModule, cls_name.c_str()); if (!py_move_type) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not find integrator class in module'"); } - delete [] module_name; - delete [] cls_name; - PyObject *ptr = PY_VOID_POINTER(lmp); - PyObject *arglist = Py_BuildValue("(O)", ptr); - PyObject *py_move_obj = PyObject_CallObject(py_move_type, arglist); - Py_DECREF(arglist); + PyObject *py_move_obj = PyObject_CallFunction(py_move_type, "O", ptr); + Py_CLEAR(ptr); if (!py_move_obj) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not instantiate instance of integrator class'"); } // check object interface py_move = (void *) py_move_obj; - - PyGILState_Release(gstate); } /* ---------------------------------------------------------------------- */ FixPythonMove::~FixPythonMove() { - PyGILState_STATE gstate = PyGILState_Ensure(); - if (py_move) Py_DECREF((PyObject*) py_move); - PyGILState_Release(gstate); + PyUtils::GIL lock; + Py_CLEAR(py_move); } /* ---------------------------------------------------------------------- */ @@ -130,122 +111,82 @@ int FixPythonMove::setmask() void FixPythonMove::init() { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_init = PyObject_GetAttrString(py_move_obj,(char *)"init"); - if (!py_init) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'init()' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject *)py_move, "init", nullptr); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move init() method failed"); } - PyObject *result = PyEval_CallObject(py_init, nullptr); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move init() method failed"); + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ void FixPythonMove::initial_integrate(int vflag) { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_initial_integrate = PyObject_GetAttrString(py_move_obj,"initial_integrate"); - if (!py_initial_integrate) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'initial_integrate' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate", "i", vflag); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move initial_integrate() method failed"); } - PyObject *arglist = Py_BuildValue("(i)", vflag); - PyObject *result = PyEval_CallObject(py_initial_integrate, arglist); - Py_DECREF(arglist); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move initial_integrate() " - "method failed"); + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ void FixPythonMove::final_integrate() { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_final_integrate = PyObject_GetAttrString(py_move_obj,"final_integrate"); - if (!py_final_integrate) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'final_integrate' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate", nullptr); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move final_integrate() method failed"); } - PyObject *result = PyEval_CallObject(py_final_integrate, nullptr); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move final_integrate() method " - "failed"); + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop) { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_initial_integrate_respa = PyObject_GetAttrString(py_move_obj,"initial_integrate_respa"); - if (!py_initial_integrate_respa) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'initial_integrate_respa' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate_respa", "iii", vflag, ilevel, iloop); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move initial_integrate_respa() method failed"); } - PyObject *arglist = Py_BuildValue("(iii)", vflag, ilevel, iloop); - PyObject *result = PyEval_CallObject(py_initial_integrate_respa, arglist); - Py_DECREF(arglist); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move initial_integrate_respa() " - "method failed"); + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ void FixPythonMove::final_integrate_respa(int ilevel, int iloop) { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_final_integrate_respa = PyObject_GetAttrString(py_move_obj,"final_integrate_respa"); - if (!py_final_integrate_respa) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'final_integrate_respa' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate_respa", "ii", ilevel, iloop); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move final_integrate_respa() method failed"); } - PyObject *arglist = Py_BuildValue("(ii)", ilevel, iloop); - PyObject *result = PyEval_CallObject(py_final_integrate_respa, arglist); - Py_DECREF(arglist); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move final_integrate_respa() " - "method failed"); + Py_CLEAR(result); } /* ---------------------------------------------------------------------- */ void FixPythonMove::reset_dt() { - PyGILState_STATE gstate = PyGILState_Ensure(); - PyObject *py_move_obj = (PyObject *) py_move; - PyObject *py_reset_dt = PyObject_GetAttrString(py_move_obj,"reset_dt"); - if (!py_reset_dt) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'reset_dt' method'"); + PyUtils::GIL lock; + PyObject * result = PyObject_CallMethod((PyObject*)py_move, "reset_dt", nullptr); + + if (!result) { + PyUtils::Print_Errors(); + error->all(FLERR,"Fix python/move reset_dt() method failed"); } - PyObject *result = PyEval_CallObject(py_reset_dt, nullptr); - if (!result && (comm->me == 0)) PyErr_Print(); - PyGILState_Release(gstate); - if (!result) error->all(FLERR,"Fix python/move reset_dt() method failed"); + Py_CLEAR(result); } From 0aa9aa96f69e8e9fbdb5384827f52acd99df91f4 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 14:50:08 -0400 Subject: [PATCH 278/370] Update pair_python --- src/PYTHON/pair_python.cpp | 237 +++++++++++-------------------------- src/PYTHON/pair_python.h | 1 + 2 files changed, 70 insertions(+), 168 deletions(-) diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index b5d6021e1e..f3a16612b6 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -24,9 +24,10 @@ #include "memory.h" #include "neigh_list.h" #include "python_compat.h" +#include "python_utils.h" #include "update.h" -#include +#include #include // IWYU pragma: export using namespace LAMMPS_NS; @@ -50,7 +51,7 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { // add current directory to PYTHONPATH - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *py_path = PySys_GetObject((char *)"path"); PyList_Append(py_path, PY_STRING_FROM_STRING(".")); @@ -61,14 +62,14 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); } - PyGILState_Release(gstate); } /* ---------------------------------------------------------------------- */ PairPython::~PairPython() { - if (py_potential) Py_DECREF((PyObject*) py_potential); + PyUtils::GIL lock; + Py_CLEAR(py_potential); delete[] skip_types; if (allocated) { @@ -103,41 +104,31 @@ void PairPython::compute(int eflag, int vflag) // prepare access to compute_force and compute_energy functions - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *py_pair_instance = (PyObject *) py_potential; PyObject *py_compute_force = PyObject_GetAttrString(py_pair_instance,"compute_force"); if (!py_compute_force) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not find 'compute_force' method'"); } if (!PyCallable_Check(py_compute_force)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Python 'compute_force' is not callable"); } PyObject *py_compute_energy = PyObject_GetAttrString(py_pair_instance,"compute_energy"); if (!py_compute_energy) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not find 'compute_energy' method'"); } if (!PyCallable_Check(py_compute_energy)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Python 'compute_energy' is not callable"); } PyObject *py_compute_args = PyTuple_New(3); if (!py_compute_args) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not create tuple for 'compute' function arguments"); } @@ -179,13 +170,11 @@ void PairPython::compute(int eflag, int vflag) PyTuple_SetItem(py_compute_args,0,py_rsq); py_value = PyObject_CallObject(py_compute_force,py_compute_args); if (!py_value) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Calling 'compute_force' function failed"); } fpair = factor_lj*PyFloat_AsDouble(py_value); - Py_DECREF(py_value); + Py_CLEAR(py_value); f[i][0] += delx*fpair; f[i][1] += dely*fpair; @@ -198,8 +187,12 @@ void PairPython::compute(int eflag, int vflag) if (eflag) { py_value = PyObject_CallObject(py_compute_energy,py_compute_args); + if (!py_value) { + PyUtils::Print_Errors(); + error->all(FLERR,"Calling 'compute_energy' function failed"); + } evdwl = factor_lj*PyFloat_AsDouble(py_value); - Py_DECREF(py_value); + Py_CLEAR(py_value); } else evdwl = 0.0; if (evflag) ev_tally(i,j,nlocal,newton_pair, @@ -207,8 +200,7 @@ void PairPython::compute(int eflag, int vflag) } } } - Py_DECREF(py_compute_args); - PyGILState_Release(gstate); + Py_CLEAR(py_compute_args); if (vflag_fdotr) virial_fdotr_compute(); } @@ -261,112 +253,49 @@ void PairPython::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // check if python potential file exists and source it - char * full_cls_name = arg[2]; - char * lastpos = strrchr(full_cls_name, '.'); + std::string full_cls_name = arg[2]; + size_t lastpos = full_cls_name.rfind("."); - if (lastpos == nullptr) { + if (lastpos == std::string::npos) { error->all(FLERR,"Python pair style requires fully qualified class name"); } - size_t module_name_length = strlen(full_cls_name) - strlen(lastpos); - size_t cls_name_length = strlen(lastpos)-1; + std::string module_name = full_cls_name.substr(0, lastpos); + std::string cls_name = full_cls_name.substr(lastpos+1); - char * module_name = new char[module_name_length+1]; - char * cls_name = new char[cls_name_length+1]; - strncpy(module_name, full_cls_name, module_name_length); - module_name[module_name_length] = 0; + PyUtils::GIL lock; - strcpy(cls_name, lastpos+1); - - PyGILState_STATE gstate = PyGILState_Ensure(); - - PyObject * pModule = PyImport_ImportModule(module_name); + PyObject * pModule = PyImport_ImportModule(module_name.c_str()); if (!pModule) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Loading python pair style module failure"); } // create LAMMPS atom type to potential file type mapping in python class // by calling 'lammps_pair_style.map_coeff(name,type)' - PyObject *py_pair_type = PyObject_GetAttrString(pModule, cls_name); + PyObject *py_pair_type = PyObject_GetAttrString(pModule, cls_name.c_str()); if (!py_pair_type) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not find pair style class in module'"); } - delete [] module_name; - delete [] cls_name; - PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, nullptr); if (!py_pair_instance) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not instantiate instance of pair style class'"); } py_potential = (void *) py_pair_instance; - PyObject *py_check_units = PyObject_GetAttrString(py_pair_instance,"check_units"); - if (!py_check_units) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'check_units' method'"); - } - if (!PyCallable_Check(py_check_units)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Python 'check_units' is not callable"); - } - PyObject *py_units_args = PyTuple_New(1); - if (!py_units_args) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not create tuple for 'check_units' function arguments"); - } - - PyObject *py_name = PY_STRING_FROM_STRING(update->unit_style); - PyTuple_SetItem(py_units_args,0,py_name); - PyObject *py_value = PyObject_CallObject(py_check_units,py_units_args); + PyObject *py_value = PyObject_CallMethod(py_pair_instance, "check_units", "s", update->unit_style); if (!py_value) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Calling 'check_units' function failed"); } - Py_DECREF(py_units_args); + Py_CLEAR(py_value); - PyObject *py_map_coeff = PyObject_GetAttrString(py_pair_instance,"map_coeff"); - if (!py_map_coeff) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'map_coeff' method'"); - } - if (!PyCallable_Check(py_map_coeff)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Python 'map_coeff' is not callable"); - } - - PyObject *py_map_args = PyTuple_New(2); - if (!py_map_args) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not create tuple for 'map_coeff' function arguments"); - } - delete[] skip_types; skip_types = new int[ntypes+1]; skip_types[0] = 1; @@ -375,25 +304,20 @@ void PairPython::coeff(int narg, char **arg) skip_types[i] = 1; continue; } else skip_types[i] = 0; - PyObject *py_type = PY_INT_FROM_LONG(i); - py_name = PY_STRING_FROM_STRING(arg[2+i]); - PyTuple_SetItem(py_map_args,0,py_name); - PyTuple_SetItem(py_map_args,1,py_type); - py_value = PyObject_CallObject(py_map_coeff,py_map_args); + const int type = i; + const char * name = arg[2+i]; + py_value = PyObject_CallMethod(py_pair_instance, "map_coeff", "si", name, type); if (!py_value) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Calling 'map_coeff' function failed"); } + Py_CLEAR(py_value); for (int j = i; j <= ntypes ; j++) { setflag[i][j] = 1; cutsq[i][j] = cut_global*cut_global; } } - Py_DECREF(py_map_args); - PyGILState_Release(gstate); } /* ---------------------------------------------------------------------- */ @@ -417,76 +341,53 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, // prepare access to compute_force and compute_energy functions - PyGILState_STATE gstate = PyGILState_Ensure(); + PyUtils::GIL lock; PyObject *py_pair_instance = (PyObject *) py_potential; - PyObject *py_compute_force - = PyObject_GetAttrString(py_pair_instance,"compute_force"); - if (!py_compute_force) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'compute_force' method'"); - } - if (!PyCallable_Check(py_compute_force)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Python 'compute_force' is not callable"); - } + PyObject *py_compute_force = (PyObject *) get_member_function("compute_force"); + PyObject *py_compute_energy = (PyObject *) get_member_function("compute_energy"); + PyObject *py_compute_args = Py_BuildValue("(dii)", rsq, itype, jtype); - PyObject *py_compute_energy - = PyObject_GetAttrString(py_pair_instance,"compute_energy"); - if (!py_compute_energy) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Could not find 'compute_energy' method'"); - } - if (!PyCallable_Check(py_compute_energy)) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); - error->all(FLERR,"Python 'compute_energy' is not callable"); - } - - PyObject *py_rsq, *py_itype, *py_jtype, *py_value; - PyObject *py_compute_args = PyTuple_New(3); if (!py_compute_args) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Could not create tuple for 'compute' function arguments"); } - py_itype = PY_INT_FROM_LONG(itype); - PyTuple_SetItem(py_compute_args,1,py_itype); - py_jtype = PY_INT_FROM_LONG(jtype); - PyTuple_SetItem(py_compute_args,2,py_jtype); - py_rsq = PyFloat_FromDouble(rsq); - PyTuple_SetItem(py_compute_args,0,py_rsq); - - py_value = PyObject_CallObject(py_compute_force,py_compute_args); + PyObject * py_value = PyObject_CallObject(py_compute_force, py_compute_args); if (!py_value) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Calling 'compute_force' function failed"); } fforce = factor_lj*PyFloat_AsDouble(py_value); - Py_DECREF(py_value); + Py_CLEAR(py_value); - py_value = PyObject_CallObject(py_compute_energy,py_compute_args); + py_value = PyObject_CallObject(py_compute_energy, py_compute_args); if (!py_value) { - PyErr_Print(); - PyErr_Clear(); - PyGILState_Release(gstate); + PyUtils::Print_Errors(); error->all(FLERR,"Calling 'compute_energy' function failed"); } double evdwl = factor_lj*PyFloat_AsDouble(py_value); - Py_DECREF(py_value); - Py_DECREF(py_compute_args); - PyGILState_Release(gstate); + Py_CLEAR(py_value); + Py_CLEAR(py_compute_args); return evdwl; } + + +/* ---------------------------------------------------------------------- */ + +void * PairPython::get_member_function(const char * name) +{ + PyUtils::GIL lock; + PyObject *py_pair_instance = (PyObject *) py_potential; + PyObject * py_mfunc = PyObject_GetAttrString(py_pair_instance, name); + if (!py_mfunc) { + PyUtils::Print_Errors(); + error->all(FLERR, fmt::format("Could not find '{}' method'", name)); + } + if (!PyCallable_Check(py_mfunc)) { + PyUtils::Print_Errors(); + error->all(FLERR, fmt::format("Python '{}' is not callable", name)); + } + return py_mfunc; +} diff --git a/src/PYTHON/pair_python.h b/src/PYTHON/pair_python.h index 4c3c00a70d..881bfe2835 100644 --- a/src/PYTHON/pair_python.h +++ b/src/PYTHON/pair_python.h @@ -50,6 +50,7 @@ class PairPython : public Pair { int * skip_types; virtual void allocate(); + void * get_member_function(const char *); }; } From 80a65150c22c186e230cb7d2902f2951065dc83a Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Tue, 6 Apr 2021 13:08:48 -0600 Subject: [PATCH 279/370] Patching uninitialized values, replacing lines in documentation --- doc/src/fix_wall_gran.rst | 2 + src/GRANULAR/fix_wall_gran.cpp | 76 ++++++++++++------------ src/GRANULAR/pair_gran_hertz_history.cpp | 8 ++- src/GRANULAR/pair_granular.cpp | 2 +- 4 files changed, 49 insertions(+), 39 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 02d52ef1a6..95a4b5d818 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -177,6 +177,8 @@ the clockwise direction for *vshear* > 0 or counter-clockwise for *vshear* < 0. In this case, *vshear* is the tangential velocity of the wall at whatever *radius* has been defined. + +Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" This fix writes the shear friction state of atoms interacting with the diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index d746923ab0..f9840c9d5e 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -71,6 +71,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix wall/gran requires atom style sphere"); create_attribute = 1; + limit_damping = 0; // set interaction style // disable bonded/history option for now @@ -91,7 +92,6 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wall/particle coefficients int iarg; - if (pairstyle != GRANULAR) { size_history = 3; if (narg < 11) error->all(FLERR,"Illegal fix wall/gran command"); @@ -322,14 +322,14 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : if (normal_model == JKR) size_history += 1; if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) size_history += 1; - } - if (limit_damping and normal_model == JKR) - error->all(FLERR,"Illegal pair_coeff command, " - "cannot limit damping with JRK model"); - if (limit_damping and normal_model == DMT) - error->all(FLERR,"Illegal pair_coeff command, " - "Cannot limit damping with DMT model"); + if (limit_damping and normal_model == JKR) + error->all(FLERR,"Illegal pair_coeff command, " + "cannot limit damping with JRK model"); + if (limit_damping and normal_model == DMT) + error->all(FLERR,"Illegal pair_coeff command, " + "Cannot limit damping with DMT model"); + } // wallstyle args @@ -504,37 +504,39 @@ void FixWallGran::init() if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; - tangential_history_index = 0; - if (roll_history) { - if (tangential_history) roll_history_index = 3; - else roll_history_index = 0; - } - if (twist_history) { - if (tangential_history) { - if (roll_history) twist_history_index = 6; - else twist_history_index = 3; + if(pairstyle == GRANULAR) { + tangential_history_index = 0; + if (roll_history) { + if (tangential_history) roll_history_index = 3; + else roll_history_index = 0; } - else{ - if (roll_history) twist_history_index = 3; - else twist_history_index = 0; + if (twist_history) { + if (tangential_history) { + if (roll_history) twist_history_index = 6; + else twist_history_index = 3; + } + else{ + if (roll_history) twist_history_index = 3; + else twist_history_index = 0; + } + } + if (normal_model == JKR) { + tangential_history_index += 1; + roll_history_index += 1; + twist_history_index += 1; + } + if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || + tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { + roll_history_index += 1; + twist_history_index += 1; + } + + if (damping_model == TSUJI) { + double cor = normal_coeffs[1]; + normal_coeffs[1] = 1.2728-4.2783*cor+11.087*pow(cor,2)-22.348*pow(cor,3)+ + 27.467*pow(cor,4)-18.022*pow(cor,5)+ + 4.8218*pow(cor,6); } - } - if (normal_model == JKR) { - tangential_history_index += 1; - roll_history_index += 1; - twist_history_index += 1; - } - if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || - tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) { - roll_history_index += 1; - twist_history_index += 1; - } - - if (damping_model == TSUJI) { - double cor = normal_coeffs[1]; - normal_coeffs[1] = 1.2728-4.2783*cor+11.087*pow(cor,2)-22.348*pow(cor,3)+ - 27.467*pow(cor,4)-18.022*pow(cor,5)+ - 4.8218*pow(cor,6); } } diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index e21ec727d6..be2a3c2558 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -278,7 +278,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) void PairGranHertzHistory::settings(int narg, char **arg) { - if (narg != 6) error->all(FLERR,"Illegal pair_style command"); + if (narg != 6 and narg != 7) error->all(FLERR,"Illegal pair_style command"); kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; @@ -296,6 +296,12 @@ void PairGranHertzHistory::settings(int narg, char **arg) xmu < 0.0 || xmu > 10000.0 || dampflag < 0 || dampflag > 1) error->all(FLERR,"Illegal pair_style command"); + limit_damping = 0; + if (narg == 7) { + if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; + else error->all(FLERR,"Illegal pair_style command"); + } + // convert Kn and Kt from pressure units to force/distance^2 kn /= force->nktv2p; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index ac98a6e27c..653d5c70a1 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -1038,7 +1038,7 @@ void PairGranular::coeff(int narg, char **arg) cutoff_type[i][j] = cutoff_type[j][i] = cutoff_one; - limit_damping[i][j] = ld_flag; + limit_damping[i][j] = limit_damping[j][i] = ld_flag; setflag[i][j] = 1; count++; From 8e43d58faba0bcb520bdaa0e21c9a5f1eb601017 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Tue, 6 Apr 2021 13:48:56 -0600 Subject: [PATCH 280/370] Switching logical operators to match preferred style --- src/GRANULAR/fix_wall_gran.cpp | 12 ++++++------ src/GRANULAR/pair_gran_hertz_history.cpp | 6 +++--- src/GRANULAR/pair_gran_hooke.cpp | 4 ++-- src/GRANULAR/pair_gran_hooke_history.cpp | 6 +++--- src/GRANULAR/pair_granular.cpp | 8 ++++---- src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index f9840c9d5e..11cf0a9bc9 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -323,10 +323,10 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : if (tangential_model == TANGENTIAL_MINDLIN_RESCALE || tangential_model == TANGENTIAL_MINDLIN_RESCALE_FORCE) size_history += 1; - if (limit_damping and normal_model == JKR) + if (limit_damping && normal_model == JKR) error->all(FLERR,"Illegal pair_coeff command, " "cannot limit damping with JRK model"); - if (limit_damping and normal_model == DMT) + if (limit_damping && normal_model == DMT) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with DMT model"); } @@ -794,7 +794,7 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -887,7 +887,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -1019,7 +1019,7 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -1214,7 +1214,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping and Fntot < 0.0) Fntot = 0.0; + if (limit_damping && Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index be2a3c2558..e40a9be2bd 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -181,7 +181,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -278,7 +278,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) void PairGranHertzHistory::settings(int narg, char **arg) { - if (narg != 6 and narg != 7) error->all(FLERR,"Illegal pair_style command"); + if (narg != 6 && narg != 7) error->all(FLERR,"Illegal pair_style command"); kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; @@ -395,7 +395,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index c28bbd007f..0f45fadca9 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -158,7 +158,7 @@ void PairGranHooke::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -300,7 +300,7 @@ double PairGranHooke::single(int i, int j, int /*itype*/, int /*jtype*/, double damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 4f7a6e20ec..48c30c761e 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -237,7 +237,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping and ccel < 0.0) ccel = 0.0; + if (limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities @@ -357,7 +357,7 @@ void PairGranHookeHistory::allocate() void PairGranHookeHistory::settings(int narg, char **arg) { - if (narg != 6 and narg != 7) error->all(FLERR,"Illegal pair_style command"); + if (narg != 6 && narg != 7) error->all(FLERR,"Illegal pair_style command"); kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; @@ -693,7 +693,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping and ccel < 0.0) ccel = 0.0; + if(limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 653d5c70a1..e787e305ff 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -371,7 +371,7 @@ void PairGranular::compute(int eflag, int vflag) Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] && Fntot < 0.0) Fntot = 0.0; //**************************************** // tangential force, including history effects @@ -988,11 +988,11 @@ void PairGranular::coeff(int narg, char **arg) 27.467*powint(cor,4)-18.022*powint(cor,5)+4.8218*powint(cor,6); } else damp = normal_coeffs_one[1]; - if (ld_flag and normal_model_one == JKR) + if (ld_flag && normal_model_one == JKR) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with JKR model"); - if (ld_flag and normal_model_one == DMT) + if (ld_flag && normal_model_one == DMT) error->all(FLERR,"Illegal pair_coeff command, " "Cannot limit damping with DMT model"); @@ -1547,7 +1547,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] and Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] && Fntot < 0.0) Fntot = 0.0; jnum = list->numneigh[i]; jlist = list->firstneigh[i]; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index 8d853b7dae..95be9843b9 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -392,7 +392,7 @@ void PairGranHookeHistoryKokkos::operator()(TagPairGranHookeHistoryC F_FLOAT damp = meff*gamman*vnnr*rsqinv; F_FLOAT ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping & ccel < 0.0) ccel = 0.0; + if(limit_damping && ccel < 0.0) ccel = 0.0; // relative velocities From c44b8f18ee49326cf63bf14410bb1c4493cfb700 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Tue, 6 Apr 2021 13:54:11 -0600 Subject: [PATCH 281/370] Adding explicit parentheses to logical operations --- src/GRANULAR/fix_wall_gran.cpp | 8 ++++---- src/GRANULAR/pair_gran_hertz_history.cpp | 4 ++-- src/GRANULAR/pair_gran_hooke.cpp | 4 ++-- src/GRANULAR/pair_gran_hooke_history.cpp | 4 ++-- src/GRANULAR/pair_granular.cpp | 4 ++-- src/KOKKOS/pair_gran_hooke_history_kokkos.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 11cf0a9bc9..0611a54efd 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -794,7 +794,7 @@ void FixWallGran::hooke(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -887,7 +887,7 @@ void FixWallGran::hooke_history(double rsq, double dx, double dy, double dz, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radius-r)*rinv - damp; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -1019,7 +1019,7 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, if (rwall == 0.0) polyhertz = sqrt((radius-r)*radius); else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -1214,7 +1214,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping && Fntot < 0.0) Fntot = 0.0; + if (limit_damping && (Fntot < 0.0)) Fntot = 0.0; //**************************************** // tangential force, including history effects diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index e40a9be2bd..56e9691fad 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -181,7 +181,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -395,7 +395,7 @@ double PairGranHertzHistory::single(int i, int j, int /*itype*/, int /*jtype*/, ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 0f45fadca9..eb5ccec680 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -158,7 +158,7 @@ void PairGranHooke::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -300,7 +300,7 @@ double PairGranHooke::single(int i, int j, int /*itype*/, int /*jtype*/, double damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 48c30c761e..0f9682a133 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -237,7 +237,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if (limit_damping && ccel < 0.0) ccel = 0.0; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities @@ -693,7 +693,7 @@ double PairGranHookeHistory::single(int i, int j, int /*itype*/, int /*jtype*/, damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping && ccel < 0.0) ccel = 0.0; + if(limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index e787e305ff..dc367dcc0a 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -371,7 +371,7 @@ void PairGranular::compute(int eflag, int vflag) Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] && Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] && (Fntot < 0.0)) Fntot = 0.0; //**************************************** // tangential force, including history effects @@ -1547,7 +1547,7 @@ double PairGranular::single(int i, int j, int itype, int jtype, Fdamp = -damp_normal_prefactor*vnnr; Fntot = Fne + Fdamp; - if (limit_damping[itype][jtype] && Fntot < 0.0) Fntot = 0.0; + if (limit_damping[itype][jtype] && (Fntot < 0.0)) Fntot = 0.0; jnum = list->numneigh[i]; jlist = list->firstneigh[i]; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index 95be9843b9..01ac1ea54f 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -392,7 +392,7 @@ void PairGranHookeHistoryKokkos::operator()(TagPairGranHookeHistoryC F_FLOAT damp = meff*gamman*vnnr*rsqinv; F_FLOAT ccel = kn*(radsum-r)*rinv - damp; - if(limit_damping && ccel < 0.0) ccel = 0.0; + if(limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities From 5af294d49edb013699863b48cc24f374de641389 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 16:47:06 -0400 Subject: [PATCH 282/370] Update test_potential_file_reader.cpp --- .../formats/test_potential_file_reader.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 1e3d96d6d7..6331db28a7 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -42,18 +42,20 @@ using utils::split_words; // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; -const int LAMMPS_NS::PairSW::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairComb::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairComb3::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairTersoff::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairTersoffMOD::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairTersoffMODC::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairTersoffZBL::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairGW::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairGWZBL::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairNb3bHarmonic::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE; -const int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE; +#if __cplusplus < 201703L +constexpr int LAMMPS_NS::PairSW::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairComb::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairComb3::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairTersoff::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairTersoffMOD::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairTersoffMODC::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairTersoffZBL::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairGW::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairGWZBL::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairNb3bHarmonic::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE; +constexpr int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE; +#endif class PotentialFileReaderTest : public LAMMPSTest { }; From b6776ca3debf462dcaf2320015d80337a83ae483 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 16:48:18 -0400 Subject: [PATCH 283/370] Remove GCC optimization pragma for GCC < 4.9 due to compiler segfault --- unittest/formats/test_atom_styles.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 8166a5d1f0..8a031fe308 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -40,11 +40,7 @@ #elif defined(__GNUC__) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) #pragma GCC optimize("no-var-tracking-assignments", "O0") -#else -#pragma GCC optimize("no-var-tracking-assignments") #endif -#else -#define _do_nothing #endif #endif From 0ae75aabcd4c1b72945092618e4039e01a1a02d5 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 6 Apr 2021 17:10:16 -0400 Subject: [PATCH 284/370] Remove unused variables --- src/PYTHON/pair_python.cpp | 1 - src/PYTHON/python_impl.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index f3a16612b6..b147c9cb79 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -342,7 +342,6 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, // prepare access to compute_force and compute_energy functions PyUtils::GIL lock; - PyObject *py_pair_instance = (PyObject *) py_potential; PyObject *py_compute_force = (PyObject *) get_member_function("compute_force"); PyObject *py_compute_energy = (PyObject *) get_member_function("compute_energy"); PyObject *py_compute_args = Py_BuildValue("(dii)", rsq, itype, jtype); diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 7e46da4c49..c84d04b4b7 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -117,7 +117,7 @@ PythonImpl::~PythonImpl() // shutdown Python interpreter if (!external_interpreter) { - PyGILState_STATE gstate = PyGILState_Ensure(); + PyGILState_Ensure(); Py_Finalize(); } From 932ea80b253e89c826b97c53bc5ffe22f00989a9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 18:39:37 -0400 Subject: [PATCH 285/370] update reference data for angle style cosine/periodic --- unittest/force-styles/tests/angle-cosine_periodic.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/force-styles/tests/angle-cosine_periodic.yaml b/unittest/force-styles/tests/angle-cosine_periodic.yaml index 55beb13fdd..1c6cb7158d 100644 --- a/unittest/force-styles/tests/angle-cosine_periodic.yaml +++ b/unittest/force-styles/tests/angle-cosine_periodic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 10 Feb 2021 -date_generated: Fri Feb 26 23:09:23 2021 +lammps_version: 10 Mar 2021 +date_generated: Tue Apr 6 18:38:56 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -14,7 +14,7 @@ angle_coeff: ! | 2 45.0 1 2 3 50.0 -1 3 4 100.0 -1 4 -equilibrium: 4 3.141592653589793 3.141592653589793 3.141592653589793 3.141592653589793 +equilibrium: 4 1.5707963267948966 1.5707963267948966 0 0 extract: ! "" natoms: 29 init_energy: 946.676664091363 From 717faa65155e5071c2ef6c09b8bc525af573cf78 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 6 Apr 2021 19:12:28 -0400 Subject: [PATCH 286/370] correctly detect GPU package with CUDA api --- cmake/Modules/Packages/GPU.cmake | 2 +- lib/gpu/lal_device.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 74a023685d..b706537825 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -131,7 +131,7 @@ if(GPU_API STREQUAL "CUDA") add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS}) target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS}) - target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS}) + target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS}) if(CUDPP_OPT) target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini) target_compile_definitions(gpu PRIVATE -DUSE_CUDPP) diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index a65c3d8810..b42aa8e21d 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -1061,7 +1061,7 @@ bool lmp_gpu_config(const std::string &category, const std::string &setting) return setting == "opencl"; #elif defined(USE_HIP) return setting == "hip"; -#elif defined(USE_CUDA) +#elif defined(USE_CUDA) || defined(USE_CUDART) return setting == "cuda"; #endif return false; From 3de33027677ec318fe2d0f2f80a63ac35671ca07 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 7 Apr 2021 12:20:24 +0200 Subject: [PATCH 287/370] remove source files from lib/pace; add lib/pace/Install.py to automatically download the source files from github/ICAMS/lammps-user-pace; add lib/pace/CMakeLists.txt to build libpace.a add lib/pace/README update src/USER-PACE/Install.sh --- lib/pace/CMakeLists.txt | 19 + lib/pace/Install.py | 112 +- lib/pace/LICENSE | 674 ----------- lib/pace/README | 9 + lib/pace/ace_abstract_basis.cpp | 184 --- lib/pace/ace_abstract_basis.h | 169 --- lib/pace/ace_array2dlm.h | 579 --------- lib/pace/ace_arraynd.h | 1949 ------------------------------- lib/pace/ace_c_basis.cpp | 980 ---------------- lib/pace/ace_c_basis.h | 155 --- lib/pace/ace_c_basisfunction.h | 251 ---- lib/pace/ace_complex.h | 266 ----- lib/pace/ace_contigous_array.h | 249 ---- lib/pace/ace_evaluator.cpp | 660 ----------- lib/pace/ace_evaluator.h | 230 ---- lib/pace/ace_flatten_basis.cpp | 130 --- lib/pace/ace_flatten_basis.h | 135 --- lib/pace/ace_radial.cpp | 566 --------- lib/pace/ace_radial.h | 324 ----- lib/pace/ace_recursive.cpp | 1340 --------------------- lib/pace/ace_recursive.h | 247 ---- lib/pace/ace_spherical_cart.cpp | 221 ---- lib/pace/ace_spherical_cart.h | 134 --- lib/pace/ace_timing.h | 126 -- lib/pace/ace_types.h | 45 - lib/pace/ace_version.h | 39 - lib/pace/ships_radial.cpp | 388 ------ lib/pace/ships_radial.h | 158 --- src/USER-PACE/Install.sh | 104 +- 29 files changed, 189 insertions(+), 10254 deletions(-) create mode 100644 lib/pace/CMakeLists.txt delete mode 100644 lib/pace/LICENSE delete mode 100644 lib/pace/ace_abstract_basis.cpp delete mode 100644 lib/pace/ace_abstract_basis.h delete mode 100644 lib/pace/ace_array2dlm.h delete mode 100644 lib/pace/ace_arraynd.h delete mode 100644 lib/pace/ace_c_basis.cpp delete mode 100644 lib/pace/ace_c_basis.h delete mode 100644 lib/pace/ace_c_basisfunction.h delete mode 100644 lib/pace/ace_complex.h delete mode 100644 lib/pace/ace_contigous_array.h delete mode 100644 lib/pace/ace_evaluator.cpp delete mode 100644 lib/pace/ace_evaluator.h delete mode 100644 lib/pace/ace_flatten_basis.cpp delete mode 100644 lib/pace/ace_flatten_basis.h delete mode 100644 lib/pace/ace_radial.cpp delete mode 100644 lib/pace/ace_radial.h delete mode 100644 lib/pace/ace_recursive.cpp delete mode 100644 lib/pace/ace_recursive.h delete mode 100644 lib/pace/ace_spherical_cart.cpp delete mode 100644 lib/pace/ace_spherical_cart.h delete mode 100644 lib/pace/ace_timing.h delete mode 100644 lib/pace/ace_types.h delete mode 100644 lib/pace/ace_version.h delete mode 100644 lib/pace/ships_radial.cpp delete mode 100644 lib/pace/ships_radial.h diff --git a/lib/pace/CMakeLists.txt b/lib/pace/CMakeLists.txt new file mode 100644 index 0000000000..2884c83cb9 --- /dev/null +++ b/lib/pace/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.7) # CMake version check +project(aceevaluator) +set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard + + +set(PACE_EVALUATOR_PATH ${CMAKE_CURRENT_LIST_DIR}/src/USER-PACE) +# message("CMakeLists.txt DEBUG: PACE_EVALUATOR_PATH=${PACE_EVALUATOR_PATH}") +set(PACE_EVALUATOR_SRC_PATH ${PACE_EVALUATOR_PATH}) + +FILE(GLOB PACE_EVALUATOR_SOURCE_FILES ${PACE_EVALUATOR_SRC_PATH}/*.cpp) +list(FILTER PACE_EVALUATOR_SOURCE_FILES EXCLUDE REGEX ".*pair_pace.*") +set(PACE_EVALUATOR_INCLUDE_DIR ${PACE_EVALUATOR_SRC_PATH}) + + +##### aceevaluator ##### +add_library(aceevaluator ${PACE_EVALUATOR_SOURCE_FILES}) +target_include_directories(aceevaluator PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) +target_compile_options(aceevaluator PRIVATE -O3) +set_target_properties(aceevaluator PROPERTIES OUTPUT_NAME pace${LAMMPS_MACHINE}) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index f87f5c14cb..640971e011 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -1 +1,111 @@ -# TODO \ No newline at end of file +# TODO#!/usr/bin/env python + +""" +Install.py tool to download, compile, and setup the pace library +used to automate the steps described in the README file in this dir +""" + +from __future__ import print_function +import sys, os, subprocess, shutil +from argparse import ArgumentParser + +sys.path.append('..') +from install_helpers import fullpath, geturl, checkmd5sum + +parser = ArgumentParser(prog='Install.py', + description="LAMMPS library build wrapper script") + +# settings + +thisdir = fullpath('.') +version = "v.2021.2.3" + +# known checksums for different PACE versions. used to validate the download. +checksums = { \ + 'v.2021.2.3' : '9ebb087cba7e4ca041fde52f7e9e640c', \ + } + + +# help message + +HELP = """ +Syntax from src dir: make lib-pace args="-b" + or: make lib-pace args="-b -v version" +Syntax from lib dir: python Install.py -b + or: python Install.py -b -v version + +Examples: + +make lib-pace args="-b" # install default version of PACE lib +make lib-pace args="-b -v version" # install specified version of PACE lib + + +""" + +pgroup = parser.add_mutually_exclusive_group() +pgroup.add_argument("-b", "--build", action="store_true", + help="download and build base PACE library") +parser.add_argument("-v", "--version", default=version, choices=checksums.keys(), + help="set version of PACE library to download and build (default: %s)" % version) +parser.add_argument("-vv", "--verbose", action="store_true", + help="be more verbose about is happening while this script runs") + +args = parser.parse_args() + +# print help message and exit, if neither build nor path options are given +if not args.build: + parser.print_help() + sys.exit(HELP) + +buildflag = args.build + +verboseflag = args.verbose +version = args.version + + +archive_extension = "tar.gz" +url = "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/%s.%s" % (version, archive_extension) +unarchived_folder_name = "lammps-user-pace-%s"%(version) + +# download PACE tarball, unpack, build PACE +if buildflag: + + # download entire tarball + + print("Downloading pace tarball ...") + archive_filename = "%s.%s" % (version, archive_extension) + download_filename = "%s/%s" % (thisdir, archive_filename) + print("Downloading from ",url," to ",download_filename, end=" ") + geturl(url, download_filename) + print(" done") + + # verify downloaded archive integrity via md5 checksum, if known. + if version in checksums: + if not checkmd5sum(checksums[version], archive_filename): + sys.exit("Checksum for pace library does not match") + + print("Unpacking pace tarball ...") + src_folder = thisdir+"/src" + cmd = 'cd "%s"; rm -rf "%s"; tar -xvf %s; mv %s %s' % (thisdir, src_folder, archive_filename, unarchived_folder_name, src_folder) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + + # configure + + build_folder = "%s/build"%(thisdir) + print("Configuring libpace ...") + cmd = 'cd %s && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release' % (thisdir) + txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) + if verboseflag: print(txt.decode("UTF-8")) + + # build + print("Building libpace ...") + cmd = 'cd "%s" && make -j2 && cp libpace.a %s/' % (build_folder, thisdir) + txt = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + if verboseflag: + print(txt.decode("UTF-8")) + +# remove source files + + print("Removing pace build files and archive ...") + cmd = 'rm %s; rm -rf %s' % (download_filename, build_folder) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) \ No newline at end of file diff --git a/lib/pace/LICENSE b/lib/pace/LICENSE deleted file mode 100644 index f288702d2f..0000000000 --- a/lib/pace/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/lib/pace/README b/lib/pace/README index e69de29bb2..e9a1ab820a 100644 --- a/lib/pace/README +++ b/lib/pace/README @@ -0,0 +1,9 @@ +This directory contains files required to use the USER-PACE package. + +You can type "make lib-pace" from the src directory to see help on +how to download and build this library via make commands, or you can +do the same thing by typing "python Install.py" from within this +directory. + + + diff --git a/lib/pace/ace_abstract_basis.cpp b/lib/pace/ace_abstract_basis.cpp deleted file mode 100644 index 3d8afafdaf..0000000000 --- a/lib/pace/ace_abstract_basis.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Lysogorskiy Yury on 28.04.2020. - -#include "ace_abstract_basis.h" - -////embedding function -////case nemb = 1 only implementation -////F = sign(x)*( ( 1 - exp(-(w*x)^3) )*abs(x)^m + ((1/w)^(m-1))*exp(-(w*x)^3)*abs(x) ) -//// !! no prefactor wpre -void Fexp(DOUBLE_TYPE x, DOUBLE_TYPE m, DOUBLE_TYPE &F, DOUBLE_TYPE &DF) { - DOUBLE_TYPE w = 1.e6; - DOUBLE_TYPE eps = 1e-10; - - DOUBLE_TYPE lambda = pow(1.0 / w, m - 1.0); - if (abs(x) > eps) { - DOUBLE_TYPE g; - DOUBLE_TYPE a = abs(x); - DOUBLE_TYPE am = pow(a, m); - DOUBLE_TYPE w3x3 = pow(w * a, 3); - DOUBLE_TYPE sign_factor = (signbit(x) ? -1 : 1); - if (w3x3 > 30.0) - g = 0.0; - else - g = exp(-w3x3); - - DOUBLE_TYPE omg = 1.0 - g; - F = sign_factor * (omg * am + lambda * g * a); - DOUBLE_TYPE dg = -3.0 * w * w * w * a * a * g; - DF = m * pow(a, m - 1.0) * omg - am * dg + lambda * dg * a + lambda * g; - } else { - F = lambda * x; - DF = lambda; - } -} - - -//Scaled-shifted embedding function -//F = sign(x)*( ( 1 - exp(-(w*x)^3) )*abs(x)^m + ((1/w)^(m-1))*exp(-(w*x)^3)*abs(x) ) -// !! no prefactor wpre -void FexpShiftedScaled(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF) { - DOUBLE_TYPE eps = 1e-10; - DOUBLE_TYPE a, xoff, yoff, nx, exprho; - - if (abs(mexp - 1.0) < eps) { - F = rho; - DF = 1; - } else { - a = abs(rho); - exprho = exp(-a); - nx = 1. / mexp; - xoff = pow(nx, (nx / (1.0 - nx))) * exprho; - yoff = pow(nx, (1 / (1.0 - nx))) * exprho; - DOUBLE_TYPE sign_factor = (signbit(rho) ? -1 : 1); - F = sign_factor * (pow(xoff + a, mexp) - yoff); - DF = yoff + mexp * (-xoff + 1.0) * pow(xoff + a, mexp - 1.); - } -} - -void ACEAbstractBasisSet::inner_cutoff(DOUBLE_TYPE rho_core, DOUBLE_TYPE rho_cut, DOUBLE_TYPE drho_cut, - DOUBLE_TYPE &fcut, DOUBLE_TYPE &dfcut) { - - DOUBLE_TYPE rho_low = rho_cut - drho_cut; - if (rho_core >= rho_cut) { - fcut = 0; - dfcut = 0; - } else if (rho_core <= rho_low) { - fcut = 1; - dfcut = 0; - } else { - fcut = 0.5 * (1 + cos(M_PI * (rho_core - rho_low) / drho_cut)); - dfcut = -0.5 * sin(M_PI * (rho_core - rho_low) / drho_cut) * M_PI / drho_cut; - } -} - -void ACEAbstractBasisSet::FS_values_and_derivatives(Array1D &rhos, DOUBLE_TYPE &value, - Array1D &derivatives, DENSITY_TYPE ndensity) { - DOUBLE_TYPE F, DF = 0, wpre, mexp; - for (int p = 0; p < ndensity; p++) { - wpre = FS_parameters.at(p * ndensity + 0); - mexp = FS_parameters.at(p * ndensity + 1); - if (this->npoti == "FinnisSinclair") - Fexp(rhos(p), mexp, F, DF); - else if (this->npoti == "FinnisSinclairShiftedScaled") - FexpShiftedScaled(rhos(p), mexp, F, DF); - value += F * wpre; // * weight (wpre) - derivatives(p) = DF * wpre;// * weight (wpre) - } -} - -void ACEAbstractBasisSet::_clean() { - - delete[] elements_name; - elements_name = nullptr; - delete radial_functions; - radial_functions = nullptr; -} - -ACEAbstractBasisSet::ACEAbstractBasisSet(const ACEAbstractBasisSet &other) { - ACEAbstractBasisSet::_copy_scalar_memory(other); - ACEAbstractBasisSet::_copy_dynamic_memory(other); -} - -ACEAbstractBasisSet &ACEAbstractBasisSet::operator=(const ACEAbstractBasisSet &other) { - if (this != &other) { - // deallocate old memory - ACEAbstractBasisSet::_clean(); - //copy scalar values - ACEAbstractBasisSet::_copy_scalar_memory(other); - //copy dynamic memory - ACEAbstractBasisSet::_copy_dynamic_memory(other); - } - return *this; -} - -ACEAbstractBasisSet::~ACEAbstractBasisSet() { - ACEAbstractBasisSet::_clean(); -} - -void ACEAbstractBasisSet::_copy_scalar_memory(const ACEAbstractBasisSet &src) { - deltaSplineBins = src.deltaSplineBins; - FS_parameters = src.FS_parameters; - npoti = src.npoti; - - nelements = src.nelements; - rankmax = src.rankmax; - ndensitymax = src.ndensitymax; - nradbase = src.nradbase; - lmax = src.lmax; - nradmax = src.nradmax; - cutoffmax = src.cutoffmax; - - spherical_harmonics = src.spherical_harmonics; - - rho_core_cutoffs = src.rho_core_cutoffs; - drho_core_cutoffs = src.drho_core_cutoffs; - - - E0vals = src.E0vals; -} - -void ACEAbstractBasisSet::_copy_dynamic_memory(const ACEAbstractBasisSet &src) {//allocate new memory - if (src.elements_name == nullptr) - throw runtime_error("Could not copy ACEAbstractBasisSet::elements_name - array not initialized"); - elements_name = new string[nelements]; - //copy - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - elements_name[mu] = src.elements_name[mu]; - } - radial_functions = src.radial_functions->clone(); -} - -SPECIES_TYPE ACEAbstractBasisSet::get_species_index_by_name(const string &elemname) { - for (SPECIES_TYPE t = 0; t < nelements; t++) { - if (this->elements_name[t] == elemname) - return t; - } - return -1; -} \ No newline at end of file diff --git a/lib/pace/ace_abstract_basis.h b/lib/pace/ace_abstract_basis.h deleted file mode 100644 index 165ea9496f..0000000000 --- a/lib/pace/ace_abstract_basis.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Lysogorskiy Yury on 28.04.2020. - -#ifndef ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H -#define ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H - -#include -#include - -#include "ace_c_basisfunction.h" -#include "ace_contigous_array.h" -#include "ace_radial.h" -#include "ace_spherical_cart.h" -#include "ace_types.h" - -using namespace std; - -/** - * Abstract basis set class - */ -class ACEAbstractBasisSet { -public: - SPECIES_TYPE nelements = 0; ///< number of elements in basis set - RANK_TYPE rankmax = 0; ///< maximum value of rank - DENSITY_TYPE ndensitymax = 0; ///< maximum number of densities \f$ \rho^{(p)} \f$ - NS_TYPE nradbase = 0; ///< maximum number of radial \f$\textbf{basis}\f$ function \f$ g_{k}(r) \f$ - LS_TYPE lmax = 0; ///< \f$ l_\textrm{max} \f$ - maximum value of orbital moment \f$ l \f$ - NS_TYPE nradmax = 0; ///< maximum number \f$ n \f$ of radial function \f$ R_{nl}(r) \f$ - DOUBLE_TYPE cutoffmax = 0; ///< maximum value of cutoff distance among all species in basis set - DOUBLE_TYPE deltaSplineBins = 0; ///< Spline interpolation density - - string npoti = "FinnisSinclair"; ///< FS and embedding function combination - - string *elements_name = nullptr; ///< Array of elements name for mapping from index (0..nelements-1) to element symbol (string) - - AbstractRadialBasis *radial_functions = nullptr; ///< object to work with radial functions - ACECartesianSphericalHarmonics spherical_harmonics; ///< object to work with spherical harmonics in Cartesian representation - - - Array1D rho_core_cutoffs; ///< energy-based inner cut-off - Array1D drho_core_cutoffs; ///< decay of energy-based inner cut-off - - vector FS_parameters; ///< parameters for cluster functional, see Eq.(3) in implementation notes or Eq.(53) in PRB 99, 014104 (2019) - - // E0 values - Array1D E0vals; - - /** - * Default empty constructor - */ - ACEAbstractBasisSet() = default; - - // copy constructor, operator= and destructor (see. Rule of Three) - - /** - * Copy constructor (see. Rule of Three) - * @param other - */ - ACEAbstractBasisSet(const ACEAbstractBasisSet &other); - - /** - * operator= (see. Rule of Three) - * @param other - * @return - */ - ACEAbstractBasisSet &operator=(const ACEAbstractBasisSet &other); - - /** - * virtual destructor (see. Rule of Three) - */ - virtual ~ACEAbstractBasisSet(); - - /** - * Computing cluster functional \f$ F(\rho_i^{(1)}, \dots, \rho_i^{(P)}) \f$ - * and its derivatives \f$ (\partial F/\partial\rho_i^{(1)}, \dots, \partial F/\partial \rho_i^{(P)} ) \f$ - * @param rhos array with densities \f$ \rho^{(p)} \f$ - * @param value (out) return value of cluster functional - * @param derivatives (out) array of derivatives \f$ (\partial F/\partial\rho_i^{(1)}, \dots, \partial F/\partial \rho_i^{(P)} ) \f$ - * @param ndensity number \f$ P \f$ of densities to use - */ - void FS_values_and_derivatives(Array1D &rhos, DOUBLE_TYPE &value, Array1D &derivatives, - DENSITY_TYPE ndensity); - - /** - * Computing hard core pairwise repulsive potential \f$ f_{cut}(\rho_i^{(\textrm{core})})\f$ and its derivative, - * see Eq.(29) of implementation notes - * @param rho_core value of \f$ \rho_i^{(\textrm{core})} \f$ - * @param rho_cut \f$ \rho_{cut}^{\mu_i} \f$ value - * @param drho_cut \f$ \Delta_{cut}^{\mu_i} \f$ value - * @param fcut (out) return inner cutoff function - * @param dfcut (out) return derivative of inner cutoff function - */ - static void inner_cutoff(DOUBLE_TYPE rho_core, DOUBLE_TYPE rho_cut, DOUBLE_TYPE drho_cut, DOUBLE_TYPE &fcut, - DOUBLE_TYPE &dfcut); - - - /** - * Virtual method to save potential to file - * @param filename file name - */ - virtual void save(const string &filename) = 0; - - /** - * Virtual method to load potential from file - * @param filename file name - */ - virtual void load(const string filename) = 0; - - /** - * Get the species index by its element name - * @param elemname element name - * @return species index - */ - SPECIES_TYPE get_species_index_by_name(const string &elemname); - - - // routines for copying and cleaning dynamic memory of the class (see. Rule of Three) - - /** - * Routine for clean the dynamically allocated memory\n - * IMPORTANT! It must be idempotent for safety. - */ - virtual void _clean(); - - /** - * Copy dynamic memory from src. Must be override and extended in derived classes! - * @param src source object to copy from - */ - virtual void _copy_dynamic_memory(const ACEAbstractBasisSet &src); - - /** - * Copy scalar values from src. Must be override and extended in derived classes! - * @param src source object to copy from - */ - virtual void _copy_scalar_memory(const ACEAbstractBasisSet &src); -}; - -void Fexp(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF); - -void FexpShiftedScaled(DOUBLE_TYPE rho, DOUBLE_TYPE mexp, DOUBLE_TYPE &F, DOUBLE_TYPE &DF); - -#endif //ACE_EVALUATOR_ACE_ABSTRACT_BASIS_H diff --git a/lib/pace/ace_array2dlm.h b/lib/pace/ace_array2dlm.h deleted file mode 100644 index 2b38602bc7..0000000000 --- a/lib/pace/ace_array2dlm.h +++ /dev/null @@ -1,579 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Yury Lysogorskiy on 11.01.20. - - -#ifndef ACE_ARRAY2DLM_H -#define ACE_ARRAY2DLM_H - -#include -#include - -#include "ace_arraynd.h" -#include "ace_contigous_array.h" -#include "ace_types.h" - -using namespace std; - -/** - * Contiguous array to organize values by \f$ (l,m) \f$ indiced (orbital moment and its projection). - * Only \f$ l_\textrm{max}\f$ should be provided, \f$ m = -l, \dots,l \f$ - * for \f$ l = 0, \dots, l_\textrm{max}\f$ - * @tparam T type of values to store - */ -template -class Array2DLM : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - - LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ - - bool is_proxy = false; ///< flag to show, if object is owning the memory or just represent it (proxying)dimensions - -public: - /** - * Default empty constructor - */ - Array2DLM() = default; - - /** - * Parametrized constructor - * @param lmax maximum value of \f$ l \f$ - * @param array_name name of the array - */ - explicit Array2DLM(LS_TYPE lmax, string array_name = "Array2DLM") { - init(lmax, array_name); - } - - - /** - * Constructor to create slices-proxy array, i.e. to provide access to the memory, but not to own it. - * @param lmax maximum value of \f$ l \f$ - * @param data_ptr pointer to original data - * @param array_name name of the array - */ - Array2DLM(LS_TYPE lmax, T *data_ptr, string array_name = "Array2DLM") { - this->lmax = lmax; - this->size = (lmax + 1) * (lmax + 1); - this->data = data_ptr; - this->array_name = array_name; - is_proxy = true; - }; - - /** - * Destructor - */ - ~Array2DLM() { - if (!is_proxy) { - if (data != nullptr) delete[] data; - } - data = nullptr; - } - - /** - * Initialize array, allocate memory - * @param lmax maximum value of l - * @param array_name name of the array - */ - void init(LS_TYPE lmax, string array_name = "Array2DLM") { - if (is_proxy) { - char s[1024]; - sprintf(s, "Could not re-initialize proxy-array %s\n", this->array_name.c_str()); - throw logic_error(s); - } - this->lmax = lmax; - this->array_name = array_name; - //for m = -l .. l - if (size != (lmax + 1) * (lmax + 1)) { - size = (lmax + 1) * (lmax + 1); - if (data) delete[] data; - data = new T[size]{}; - memset(data, 0.0, size * sizeof(T)); - } else { - memset(data, 0, size * sizeof(T)); - } - } - -#ifdef MULTIARRAY_INDICES_CHECK -/** - * Check if indices (l,m) are within array - */ - void check_indices(LS_TYPE l, MS_TYPE m) const { - - if ((l < 0) | (l > lmax)) { - fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); - exit(EXIT_FAILURE); - } - - if ((m < -l) | (m > l)) { - fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); - exit(EXIT_FAILURE); - } - size_t ii = l * (l + 1) + m; - if (ii >= size) { - fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); - exit(EXIT_FAILURE); - } - } -#endif - - /** - * Accessing the array value by index (l,m) for reading - * @param l - * @param m - * @return array value - */ - inline const T &operator()(LS_TYPE l, MS_TYPE m) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(l, m); -#endif - //l^2 + l + m - return data[l * (l + 1) + m]; - } - - /** - * Accessing the array value by index (l,m) for writing - * @param l - * @param m - * @return array value - */ - inline T &operator()(LS_TYPE l, MS_TYPE m) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(l, m); -#endif - //l^2 + l + m - return data[l * (l + 1) + m]; - } - - /** - * Convert array to STL vector> container - * @return vector> container - */ - vector> to_vector() const { - vector> res; - res.resize(lmax + 1); - - for (int i = 0; i < lmax + 1; i++) { - res[i].resize(i + 1); - for (int j = 0; j < i + 1; j++) { - res[i][j] = operator()(i, j); - } - } - return res; - } -}; - -/** - * Contiguous array to organize values by \f$ (i_0, l , m) \f$ indices. - * Only \f$ d_{0}, l_\textrm{max}\f$ should be provided: \f$ m = -l, \dots,l \f$ - * for \f$ l = 0, \dots, l_\textrm{max}\f$ - * @tparam T type of values to store - */ -template -class Array3DLM : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - - LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ - - - size_t dim[1] = {0}; ///< linear dimension \f$ d_{0} \f$ - - size_t s[1] = {0}; ///< strides for linear dimensions - - Array1D *> _proxy_slices; ///< slices representation -public: - /** - * Default empty constructor - */ - Array3DLM() = default; - - /** - * Parametrized constructor - * @param array_name name of the array - */ - Array3DLM(string array_name) { - this->array_name = array_name; - }; - - /** - * Parametrized constructor - * @param d0 maximum value of \f$ i_0 \f$ - * @param lmax maximum value of \f$ l \f$ - * @param array_name name of the array - */ - explicit Array3DLM(size_t d0, LS_TYPE lmax, string array_name = "Array3DLM") { - init(d0, lmax, array_name); - } - - /** - * Initialize array and its slices - * @param d0 maximum value of \f$ i_0 \f$ - * @param lmax maximum value of \f$ l \f$ - * @param array_name name of the array - */ - void init(size_t d0, LS_TYPE lmax, string array_name = "Array3DLM") { - this->array_name = array_name; - this->lmax = lmax; - dim[0] = d0; - s[0] = lmax * lmax; - if (size != s[0] * dim[0]) { - size = s[0] * dim[0]; - if (data) delete[] data; - data = new T[size]{}; - memset(data, 0, size * sizeof(T)); - } else { - memset(data, 0, size * sizeof(T)); - } - - _proxy_slices.set_array_name(array_name + "_proxy"); - //arrange proxy-slices - _clear_proxies(); - _proxy_slices.resize(dim[0]); - for (size_t i0 = 0; i0 < dim[0]; ++i0) { - _proxy_slices(i0) = new Array2DLM(this->lmax, &this->data[i0 * s[0]], - array_name + "_slice"); - } - } - - /** - * Release pointers to slices - */ - void _clear_proxies() { - for (size_t i0 = 0; i0 < _proxy_slices.get_dim(0); ++i0) { - delete _proxy_slices(i0); - _proxy_slices(i0) = nullptr; - } - } - - /** - * Destructor, clear proxies - */ - ~Array3DLM() { - _clear_proxies(); - } - - /** - * Resize array to new dimensions - * @param d0 - * @param lmax - */ - void resize(size_t d0, LS_TYPE lmax) { - _clear_proxies(); - init(d0, lmax, this->array_name); - } - - /** - * Get array dimensions - * @param d dimension index - * @return dimension along axis 'd' - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - /** - * Check if indices (i0, l,m) are within array - */ - void check_indices(size_t i0, LS_TYPE l, MS_TYPE m) const { - if ((l < 0) | (l > lmax)) { - fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); - exit(EXIT_FAILURE); - } - - if ((m < -l) | (m > l)) { - fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); - exit(EXIT_FAILURE); - } - - if ((i0 < 0) | (i0 >= dim[0])) { - fprintf(stderr, "%s: index i0 = %ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - exit(EXIT_FAILURE); - } - - size_t ii = i0 * s[0] + l * (l + 1) + m; - if (ii >= size) { - fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); - exit(EXIT_FAILURE); - } - } -#endif - - /** - * Accessing the array value by index (i0,l,m) for reading - * @param i0 - * @param l - * @param m - * @return array value - */ - inline const T &operator()(size_t i0, LS_TYPE l, MS_TYPE m) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, l, m); -#endif - return data[i0 * s[0] + l * (l + 1) + m]; - } - - /** - * Accessing the array value by index (i0,l,m) for writing - * @param i0 - * @param l - * @param m - * @return array value - */ - inline T &operator()(size_t i0, LS_TYPE l, MS_TYPE m) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, l, m); -#endif - return data[i0 * s[0] + l * (l + 1) + m]; - } - - /** - * Return proxy Array2DLM pointing to i0, l=0, m=0 to read - * @param i0 - * @return proxy Array2DLM pointing to i0, l=0, m=0 - */ - inline const Array2DLM &operator()(size_t i0) const { - return *_proxy_slices(i0); - } - - /** - * Return proxy Array2DLM pointing to i0, l=0, m=0 to write - * @param i0 - * @return proxy Array2DLM pointing to i0, l=0, m=0 - */ - inline Array2DLM &operator()(size_t i0) { - return *_proxy_slices(i0); - } -}; - - -/** - * Contiguous array to organize values by \f$ (i_0, i_1, l , m) \f$ indices. - * Only \f$ d_{0}, d_{1}, l_\textrm{max}\f$ should be provided: \f$ m = -l, \dots,l \f$ - * for \f$ l = 0, \dots, l_\textrm{max}\f$ - * @tparam T type of values to store - */ -template -class Array4DLM : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - - LS_TYPE lmax = 0; ///< orbital dimension \f$ l_{max} \f$ - size_t dim[2] = {0, 0}; ///< linear dimension \f$ d_{0}, d_{1} \f$ - size_t s[2] = {0, 0}; ///< strides for linear dimensions - - Array2D *> _proxy_slices; ///< slices representation -public: - /** - * Default empty constructor - */ - Array4DLM() = default; - - /** - * Parametrized constructor - * @param array_name name of the array - */ - Array4DLM(string array_name) { - this->array_name = array_name; - }; - - /** - * Parametrized constructor - * @param d0 maximum value of \f$ i_0 \f$ - * @param d1 maximum value of \f$ i_1 \f$ - * @param lmax maximum value of \f$ l \f$ - * @param array_name name of the array - */ - explicit Array4DLM(size_t d0, size_t d1, LS_TYPE lmax, string array_name = "Array4DLM") { - init(d0, d1, lmax, array_name); - } - - /** - * Initialize array, reallocate memory and its slices - * @param d0 maximum value of \f$ i_0 \f$ - * @param d1 maximum value of \f$ i_1 \f$ - * @param lmax maximum value of \f$ l \f$ - * @param array_name name of the array - */ - void init(size_t d0, size_t d1, LS_TYPE lmax, string array_name = "Array4DLM") { - this->array_name = array_name; - this->lmax = lmax; - dim[1] = d1; - dim[0] = d0; - s[1] = lmax * lmax; - s[0] = s[1] * dim[1]; - if (size != s[0] * dim[0]) { - size = s[0] * dim[0]; - if (data) delete[] data; - data = new T[size]{}; - memset(data, 0, size * sizeof(T)); - } else { - memset(data, 0, size * sizeof(T)); - } - - _proxy_slices.set_array_name(array_name + "_proxy"); - //release old memory if there is any - _clear_proxies(); - //arrange proxy-slices - _proxy_slices.resize(dim[0], dim[1]); - for (size_t i0 = 0; i0 < dim[0]; ++i0) - for (size_t i1 = 0; i1 < dim[1]; ++i1) { - _proxy_slices(i0, i1) = new Array2DLM(this->lmax, &this->data[i0 * s[0] + i1 * s[1]], - array_name + "_slice"); - } - } - - /** - * Release pointers to slices - */ - void _clear_proxies() { - - for (size_t i0 = 0; i0 < _proxy_slices.get_dim(0); ++i0) - for (size_t i1 = 0; i1 < _proxy_slices.get_dim(1); ++i1) { - delete _proxy_slices(i0, i1); - _proxy_slices(i0, i1) = nullptr; - } - } - - /** - * Destructor, clear proxies - */ - ~Array4DLM() { - _clear_proxies(); - } - - /** - * Deallocate memory, reallocate with the new dimensions - * @param d0 - * @param lmax - */ - void resize(size_t d0, size_t d1, LS_TYPE lmax) { - _clear_proxies(); - init(d0, d1, lmax, this->array_name); - } - - /** - * Get array dimensions - * @param d dimension index - * @return dimension along axis 'd' - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - /** - * Check if indices (i0, l,m) are within array - */ - void check_indices(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) const { - if ((l < 0) | (l > lmax)) { - fprintf(stderr, "%s: Index l = %d out of range (0, %d)\n", array_name.c_str(), l, lmax); - exit(EXIT_FAILURE); - } - - if ((m < -l) | (m > l)) { - fprintf(stderr, "%s: Index m = %d out of range (%d, %d)\n", array_name.c_str(), m, -l, l); - exit(EXIT_FAILURE); - } - - if ((i0 < 0) | (i0 >= dim[0])) { - fprintf(stderr, "%s: index i0 = %ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - exit(EXIT_FAILURE); - } - - - if ((i1 < 0) | (i1 >= dim[1])) { - fprintf(stderr, "%s: index i1 = %ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - exit(EXIT_FAILURE); - } - - size_t ii = i0 * s[0] + i1 * s[1] + l * (l + 1) + m; - if (ii >= size) { - fprintf(stderr, "%s: index = %ld out of range %ld\n", array_name.c_str(), ii, size); - exit(EXIT_FAILURE); - } - } -#endif - - /** - * Accessing the array value by index (i0,l,m) for reading - * @param i0 - * @param i1 - * @param l - * @param m - * @return array value - */ - inline const T &operator()(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, l, m); -#endif - return data[i0 * s[0] + i1 * s[1] + l * (l + 1) + m]; - } - - /** - * Accessing the array value by index (i0,l,m) for writing - * @param i0 - * @param i1 - * @param l - * @param m - * @return array value - */ - inline T &operator()(size_t i0, size_t i1, LS_TYPE l, MS_TYPE m) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, l, m); -#endif - return data[i0 * s[0] + i1 * s[1] + l * (l + 1) + m]; - } - - /** - * Return proxy Array2DLM pointing to i0, i1, l=0, m=0 to read - * @param i0 - * @param i1 - * @return proxy Array2DLM pointing to i0, l=0, m=0 - */ - inline const Array2DLM &operator()(size_t i0, size_t i1) const { - return *_proxy_slices(i0, i1); - } - - /** - * Return proxy Array2DLM pointing to i0, i1, l=0, m=0 to write - * @param i0 - * @param i1 - * @return proxy Array2DLM pointing to i0, l=0, m=0 - */ - inline Array2DLM &operator()(size_t i0, size_t i1) { - return *_proxy_slices(i0, i1); - } -}; - -#endif //ACE_ARRAY2DLM_H \ No newline at end of file diff --git a/lib/pace/ace_arraynd.h b/lib/pace/ace_arraynd.h deleted file mode 100644 index 1044b5654e..0000000000 --- a/lib/pace/ace_arraynd.h +++ /dev/null @@ -1,1949 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -//automatically generate source code - -#ifndef ACE_MULTIARRAY_H -#define ACE_MULTIARRAY_H - -#include -#include -#include - -#include "ace_contigous_array.h" - -using namespace std; - - -/** - * Multidimensional (1 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array1D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[1] = {0}; ///< dimensions - size_t s[1] = {0}; ///< strides - int ndim = 1; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array1D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array1D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array1D(size_t d0, const string &array_name = "Array1D", T *new_data = nullptr) { - init(d0, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0) { - - dim[0] = d0; - - s[0] = 1; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, const string &array_name = "Array1D", T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0) { - init(d0, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0) { - //check data size consistency - size_t new_size = d0; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0); -#endif - - return data[i0]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0); -#endif - - return data[i0]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array1D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector to_vector() const { - vector res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0] = operator()(i0); - - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector &vec) { - size_t d0 = 0; - d0 = vec.size(); - - - init(d0, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - operator()(i0) = vec.at(i0); - - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array1D(const vector &vec, const string &array_name = "Array1D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array1D &operator=(const vector &vec) { - this->set_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -/** - * Multidimensional (2 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array2D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[2] = {0}; ///< dimensions - size_t s[2] = {0}; ///< strides - int ndim = 2; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array2D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array2D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array2D(size_t d0, size_t d1, const string &array_name = "Array2D", T *new_data = nullptr) { - init(d0, d1, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0, size_t d1) { - - dim[0] = d0; - dim[1] = d1; - - s[1] = 1; - s[0] = s[1] * dim[1]; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, size_t d1, const string &array_name = "Array2D", T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0, d1); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0, size_t d1) { - init(d0, d1, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0, size_t d1) { - //check data size consistency - size_t new_size = d0 * d1; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0, d1); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0, size_t i1) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - if ((i1 < 0) | (i1 >= dim[1])) { - char buf[1024]; - sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0, size_t i1) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1); -#endif - - return data[i0 * s[0] + i1]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0, size_t i1) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1); -#endif - - return data[i0 * s[0] + i1]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array2D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector> to_vector() const { - vector> res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0].resize(dim[1]); - - - for (int i1 = 0; i1 < dim[1]; i1++) { - res[i0][i1] = operator()(i0, i1); - - } - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector> &vec) { - size_t d0 = 0; - size_t d1 = 0; - d0 = vec.size(); - - if (d0 > 0) { - d1 = vec.at(0).size(); - - - } - - init(d0, d1, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - if (vec.at(i0).size() != d1) - throw std::invalid_argument("Vector size is not constant at dimension 1"); - - for (int i1 = 0; i1 < dim[1]; i1++) { - operator()(i0, i1) = vec.at(i0).at(i1); - - } - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array2D(const vector> &vec, const string &array_name = "Array2D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array2D &operator=(const vector> &vec) { - this->set_vector(vec); - return *this; - } - - - /** - * operator= to flatten vector container - * @param vec container - */ - Array2D &operator=(const vector &vec) { - this->set_flatten_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -/** - * Multidimensional (3 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array3D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[3] = {0}; ///< dimensions - size_t s[3] = {0}; ///< strides - int ndim = 3; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array3D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array3D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array3D(size_t d0, size_t d1, size_t d2, const string &array_name = "Array3D", T *new_data = nullptr) { - init(d0, d1, d2, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0, size_t d1, size_t d2) { - - dim[0] = d0; - dim[1] = d1; - dim[2] = d2; - - s[2] = 1; - s[1] = s[2] * dim[2]; - s[0] = s[1] * dim[1]; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, size_t d1, size_t d2, const string &array_name = "Array3D", T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0, d1, d2); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0, size_t d1, size_t d2) { - init(d0, d1, d2, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0, size_t d1, size_t d2) { - //check data size consistency - size_t new_size = d0 * d1 * d2; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0, d1, d2); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0, size_t i1, size_t i2) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - if ((i1 < 0) | (i1 >= dim[1])) { - char buf[1024]; - sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - throw std::out_of_range(buf); - } - - if ((i2 < 0) | (i2 >= dim[2])) { - char buf[1024]; - sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0, size_t i1, size_t i2) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0, size_t i1, size_t i2) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array3D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector>> to_vector() const { - vector>> res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0].resize(dim[1]); - - - for (int i1 = 0; i1 < dim[1]; i1++) { - res[i0][i1].resize(dim[2]); - - - for (int i2 = 0; i2 < dim[2]; i2++) { - res[i0][i1][i2] = operator()(i0, i1, i2); - - } - } - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector>> &vec) { - size_t d0 = 0; - size_t d1 = 0; - size_t d2 = 0; - d0 = vec.size(); - - if (d0 > 0) { - d1 = vec.at(0).size(); - if (d1 > 0) { - d2 = vec.at(0).at(0).size(); - - - } - } - - init(d0, d1, d2, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - if (vec.at(i0).size() != d1) - throw std::invalid_argument("Vector size is not constant at dimension 1"); - - for (int i1 = 0; i1 < dim[1]; i1++) { - if (vec.at(i0).at(i1).size() != d2) - throw std::invalid_argument("Vector size is not constant at dimension 2"); - - for (int i2 = 0; i2 < dim[2]; i2++) { - operator()(i0, i1, i2) = vec.at(i0).at(i1).at(i2); - - } - } - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array3D(const vector>> &vec, const string &array_name = "Array3D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array3D &operator=(const vector>> &vec) { - this->set_vector(vec); - return *this; - } - - - /** - * operator= to flatten vector container - * @param vec container - */ - Array3D &operator=(const vector &vec) { - this->set_flatten_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -/** - * Multidimensional (4 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array4D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[4] = {0}; ///< dimensions - size_t s[4] = {0}; ///< strides - int ndim = 4; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array4D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array4D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array4D(size_t d0, size_t d1, size_t d2, size_t d3, const string &array_name = "Array4D", T *new_data = nullptr) { - init(d0, d1, d2, d3, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3) { - - dim[0] = d0; - dim[1] = d1; - dim[2] = d2; - dim[3] = d3; - - s[3] = 1; - s[2] = s[3] * dim[3]; - s[1] = s[2] * dim[2]; - s[0] = s[1] * dim[1]; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, size_t d1, size_t d2, size_t d3, const string &array_name = "Array4D", T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0, d1, d2, d3); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0, size_t d1, size_t d2, size_t d3) { - init(d0, d1, d2, d3, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0, size_t d1, size_t d2, size_t d3) { - //check data size consistency - size_t new_size = d0 * d1 * d2 * d3; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0, d1, d2, d3); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0, size_t i1, size_t i2, size_t i3) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - if ((i1 < 0) | (i1 >= dim[1])) { - char buf[1024]; - sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - throw std::out_of_range(buf); - } - - if ((i2 < 0) | (i2 >= dim[2])) { - char buf[1024]; - sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); - throw std::out_of_range(buf); - } - - if ((i3 < 0) | (i3 >= dim[3])) { - char buf[1024]; - sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array4D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector>>> to_vector() const { - vector>>> res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0].resize(dim[1]); - - - for (int i1 = 0; i1 < dim[1]; i1++) { - res[i0][i1].resize(dim[2]); - - - for (int i2 = 0; i2 < dim[2]; i2++) { - res[i0][i1][i2].resize(dim[3]); - - - for (int i3 = 0; i3 < dim[3]; i3++) { - res[i0][i1][i2][i3] = operator()(i0, i1, i2, i3); - - } - } - } - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector>>> &vec) { - size_t d0 = 0; - size_t d1 = 0; - size_t d2 = 0; - size_t d3 = 0; - d0 = vec.size(); - - if (d0 > 0) { - d1 = vec.at(0).size(); - if (d1 > 0) { - d2 = vec.at(0).at(0).size(); - if (d2 > 0) { - d3 = vec.at(0).at(0).at(0).size(); - - - } - } - } - - init(d0, d1, d2, d3, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - if (vec.at(i0).size() != d1) - throw std::invalid_argument("Vector size is not constant at dimension 1"); - - for (int i1 = 0; i1 < dim[1]; i1++) { - if (vec.at(i0).at(i1).size() != d2) - throw std::invalid_argument("Vector size is not constant at dimension 2"); - - for (int i2 = 0; i2 < dim[2]; i2++) { - if (vec.at(i0).at(i1).at(i2).size() != d3) - throw std::invalid_argument("Vector size is not constant at dimension 3"); - - for (int i3 = 0; i3 < dim[3]; i3++) { - operator()(i0, i1, i2, i3) = vec.at(i0).at(i1).at(i2).at(i3); - - } - } - } - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array4D(const vector>>> &vec, const string &array_name = "Array4D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array4D &operator=(const vector>>> &vec) { - this->set_vector(vec); - return *this; - } - - - /** - * operator= to flatten vector container - * @param vec container - */ - Array4D &operator=(const vector &vec) { - this->set_flatten_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -/** - * Multidimensional (5 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array5D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[5] = {0}; ///< dimensions - size_t s[5] = {0}; ///< strides - int ndim = 5; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array5D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array5D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array5D(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, const string &array_name = "Array5D", - T *new_data = nullptr) { - init(d0, d1, d2, d3, d4, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { - - dim[0] = d0; - dim[1] = d1; - dim[2] = d2; - dim[3] = d3; - dim[4] = d4; - - s[4] = 1; - s[3] = s[4] * dim[4]; - s[2] = s[3] * dim[3]; - s[1] = s[2] * dim[2]; - s[0] = s[1] * dim[1]; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, const string &array_name = "Array5D", - T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0, d1, d2, d3, d4); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { - init(d0, d1, d2, d3, d4, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4) { - //check data size consistency - size_t new_size = d0 * d1 * d2 * d3 * d4; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0, d1, d2, d3, d4); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - if ((i1 < 0) | (i1 >= dim[1])) { - char buf[1024]; - sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - throw std::out_of_range(buf); - } - - if ((i2 < 0) | (i2 >= dim[2])) { - char buf[1024]; - sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); - throw std::out_of_range(buf); - } - - if ((i3 < 0) | (i3 >= dim[3])) { - char buf[1024]; - sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); - throw std::out_of_range(buf); - } - - if ((i4 < 0) | (i4 >= dim[4])) { - char buf[1024]; - sprintf(buf, "%s: index i4=%ld out of range (0, %ld)\n", array_name.c_str(), i4, dim[4] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3, i4); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3, i4); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array5D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector>>>> to_vector() const { - vector>>>> res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0].resize(dim[1]); - - - for (int i1 = 0; i1 < dim[1]; i1++) { - res[i0][i1].resize(dim[2]); - - - for (int i2 = 0; i2 < dim[2]; i2++) { - res[i0][i1][i2].resize(dim[3]); - - - for (int i3 = 0; i3 < dim[3]; i3++) { - res[i0][i1][i2][i3].resize(dim[4]); - - - for (int i4 = 0; i4 < dim[4]; i4++) { - res[i0][i1][i2][i3][i4] = operator()(i0, i1, i2, i3, i4); - - } - } - } - } - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector>>>> &vec) { - size_t d0 = 0; - size_t d1 = 0; - size_t d2 = 0; - size_t d3 = 0; - size_t d4 = 0; - d0 = vec.size(); - - if (d0 > 0) { - d1 = vec.at(0).size(); - if (d1 > 0) { - d2 = vec.at(0).at(0).size(); - if (d2 > 0) { - d3 = vec.at(0).at(0).at(0).size(); - if (d3 > 0) { - d4 = vec.at(0).at(0).at(0).at(0).size(); - - - } - } - } - } - - init(d0, d1, d2, d3, d4, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - if (vec.at(i0).size() != d1) - throw std::invalid_argument("Vector size is not constant at dimension 1"); - - for (int i1 = 0; i1 < dim[1]; i1++) { - if (vec.at(i0).at(i1).size() != d2) - throw std::invalid_argument("Vector size is not constant at dimension 2"); - - for (int i2 = 0; i2 < dim[2]; i2++) { - if (vec.at(i0).at(i1).at(i2).size() != d3) - throw std::invalid_argument("Vector size is not constant at dimension 3"); - - for (int i3 = 0; i3 < dim[3]; i3++) { - if (vec.at(i0).at(i1).at(i2).at(i3).size() != d4) - throw std::invalid_argument("Vector size is not constant at dimension 4"); - - for (int i4 = 0; i4 < dim[4]; i4++) { - operator()(i0, i1, i2, i3, i4) = vec.at(i0).at(i1).at(i2).at(i3).at(i4); - - } - } - } - } - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array5D(const vector>>>> &vec, const string &array_name = "Array5D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array5D &operator=(const vector>>>> &vec) { - this->set_vector(vec); - return *this; - } - - - /** - * operator= to flatten vector container - * @param vec container - */ - Array5D &operator=(const vector &vec) { - this->set_flatten_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -/** - * Multidimensional (6 - dimensional) array of type T with contiguous memory layout. - * If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @tparam T data type - */ -template -class Array6D : public ContiguousArrayND { - using ContiguousArrayND::array_name; - using ContiguousArrayND::data; - using ContiguousArrayND::size; - using ContiguousArrayND::is_proxy_; - - size_t dim[6] = {0}; ///< dimensions - size_t s[6] = {0}; ///< strides - int ndim = 6; ///< number of dimensions -public: - - /** - * Default empty constructor - */ - Array6D() = default; - - /** - * Parametrized constructor with array name - * @param array_name name of array (for error logging) - */ - Array6D(const string &array_name) { this->array_name = array_name; } - - /** - * Parametrized constructor - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - Array6D(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5, const string &array_name = "Array6D", - T *new_data = nullptr) { - init(d0, d1, d2, d3, d4, d5, array_name, new_data); - } - - /** - * Setup the dimensions and strides of array - * @param d0,... array sizes for different dimensions - */ - void set_dimensions(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { - - dim[0] = d0; - dim[1] = d1; - dim[2] = d2; - dim[3] = d3; - dim[4] = d4; - dim[5] = d5; - - s[5] = 1; - s[4] = s[5] * dim[5]; - s[3] = s[4] * dim[4]; - s[2] = s[3] * dim[3]; - s[1] = s[2] * dim[2]; - s[0] = s[1] * dim[1]; - - size = s[0] * dim[0]; - }; - - /** - * Initialize array storage, dimensions and strides - * @param d0,... array sizes for different dimensions - * @param array_name string name of the array - */ - void init(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5, const string &array_name = "Array6D", - T *new_data = nullptr) { - this->array_name = array_name; - - size_t old_size = size; - set_dimensions(d0, d1, d2, d3, d4, d5); - - bool new_is_proxy = (new_data != nullptr); - - if (new_is_proxy) { - if (!is_proxy_) delete[] data; - data = new_data; - } else { - if (size != old_size) { - T *old_data = data; //preserve the pointer to the old data - data = new T[size]; // allocate new data - if (old_data != nullptr) { // - size_t min_size = old_size < size ? old_size : size; - memcpy(data, old_data, min_size * sizeof(T)); - if (!is_proxy_) delete[] old_data; - } - //memset(data, 0, size * sizeof(T)); - } else { - //memset(data, 0, size * sizeof(T)); - } - } - - is_proxy_ = new_is_proxy; - } - - /** - * Resize array - * @param d0,... array sizes for different dimensions - */ - void resize(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { - init(d0, d1, d2, d3, d4, d5, this->array_name); - } - - /** - * Reshape array without reset the data - * @param d0,... array sizes for different dimensions - */ - void reshape(size_t d0, size_t d1, size_t d2, size_t d3, size_t d4, size_t d5) { - //check data size consistency - size_t new_size = d0 * d1 * d2 * d3 * d4 * d5; - if (new_size != size) - throw invalid_argument("Couldn't reshape array when the size is not conserved"); - set_dimensions(d0, d1, d2, d3, d4, d5); - } - - /** - * Get array size in dimension "d" - * @param d dimension index - */ - size_t get_dim(int d) const { - return dim[d]; - } - -#ifdef MULTIARRAY_INDICES_CHECK - - /** - * Check indices validity. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - void check_indices(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const { - - if ((i0 < 0) | (i0 >= dim[0])) { - char buf[1024]; - sprintf(buf, "%s: index i0=%ld out of range (0, %ld)\n", array_name.c_str(), i0, dim[0] - 1); - throw std::out_of_range(buf); - } - - if ((i1 < 0) | (i1 >= dim[1])) { - char buf[1024]; - sprintf(buf, "%s: index i1=%ld out of range (0, %ld)\n", array_name.c_str(), i1, dim[1] - 1); - throw std::out_of_range(buf); - } - - if ((i2 < 0) | (i2 >= dim[2])) { - char buf[1024]; - sprintf(buf, "%s: index i2=%ld out of range (0, %ld)\n", array_name.c_str(), i2, dim[2] - 1); - throw std::out_of_range(buf); - } - - if ((i3 < 0) | (i3 >= dim[3])) { - char buf[1024]; - sprintf(buf, "%s: index i3=%ld out of range (0, %ld)\n", array_name.c_str(), i3, dim[3] - 1); - throw std::out_of_range(buf); - } - - if ((i4 < 0) | (i4 >= dim[4])) { - char buf[1024]; - sprintf(buf, "%s: index i4=%ld out of range (0, %ld)\n", array_name.c_str(), i4, dim[4] - 1); - throw std::out_of_range(buf); - } - - if ((i5 < 0) | (i5 >= dim[5])) { - char buf[1024]; - sprintf(buf, "%s: index i5=%ld out of range (0, %ld)\n", array_name.c_str(), i5, dim[5] - 1); - throw std::out_of_range(buf); - } - - } - -#endif - - /** - * Array access operator() for reading. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline const T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) const { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3, i4, i5); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4 * s[4] + i5]; - - } - - /** - * Array access operator() for writing. If preprocessor macro MULTIARRAY_INDICES_CHECK is defined, then the check of index will - * be performed before accessing memory. By default this is turned off. - * @param i0,... indices - */ - inline T &operator()(size_t i0, size_t i1, size_t i2, size_t i3, size_t i4, size_t i5) { -#ifdef MULTIARRAY_INDICES_CHECK - check_indices(i0, i1, i2, i3, i4, i5); -#endif - - return data[i0 * s[0] + i1 * s[1] + i2 * s[2] + i3 * s[3] + i4 * s[4] + i5]; - - } - - /** - * Array comparison operator - * @param other - */ - bool operator==(const Array6D &other) const { - //compare dimensions - for (int d = 0; d < ndim; d++) { - if (this->dim[d] != other.dim[d]) - return false; - } - return ContiguousArrayND::operator==(other); - } - - /** - * Convert to nested vector> container - * @return vector container - */ - vector>>>>> to_vector() const { - vector>>>>> res; - - res.resize(dim[0]); - - for (int i0 = 0; i0 < dim[0]; i0++) { - res[i0].resize(dim[1]); - - - for (int i1 = 0; i1 < dim[1]; i1++) { - res[i0][i1].resize(dim[2]); - - - for (int i2 = 0; i2 < dim[2]; i2++) { - res[i0][i1][i2].resize(dim[3]); - - - for (int i3 = 0; i3 < dim[3]; i3++) { - res[i0][i1][i2][i3].resize(dim[4]); - - - for (int i4 = 0; i4 < dim[4]; i4++) { - res[i0][i1][i2][i3][i4].resize(dim[5]); - - - for (int i5 = 0; i5 < dim[5]; i5++) { - res[i0][i1][i2][i3][i4][i5] = operator()(i0, i1, i2, i3, i4, i5); - - } - } - } - } - } - } - - - return res; - } // end to_vector() - - - /** - * Set values to vector> container - * @param vec container - */ - void set_vector(const vector>>>>> &vec) { - size_t d0 = 0; - size_t d1 = 0; - size_t d2 = 0; - size_t d3 = 0; - size_t d4 = 0; - size_t d5 = 0; - d0 = vec.size(); - - if (d0 > 0) { - d1 = vec.at(0).size(); - if (d1 > 0) { - d2 = vec.at(0).at(0).size(); - if (d2 > 0) { - d3 = vec.at(0).at(0).at(0).size(); - if (d3 > 0) { - d4 = vec.at(0).at(0).at(0).at(0).size(); - if (d4 > 0) { - d5 = vec.at(0).at(0).at(0).at(0).at(0).size(); - - - } - } - } - } - } - - init(d0, d1, d2, d3, d4, d5, array_name); - for (int i0 = 0; i0 < dim[0]; i0++) { - if (vec.at(i0).size() != d1) - throw std::invalid_argument("Vector size is not constant at dimension 1"); - - for (int i1 = 0; i1 < dim[1]; i1++) { - if (vec.at(i0).at(i1).size() != d2) - throw std::invalid_argument("Vector size is not constant at dimension 2"); - - for (int i2 = 0; i2 < dim[2]; i2++) { - if (vec.at(i0).at(i1).at(i2).size() != d3) - throw std::invalid_argument("Vector size is not constant at dimension 3"); - - for (int i3 = 0; i3 < dim[3]; i3++) { - if (vec.at(i0).at(i1).at(i2).at(i3).size() != d4) - throw std::invalid_argument("Vector size is not constant at dimension 4"); - - for (int i4 = 0; i4 < dim[4]; i4++) { - if (vec.at(i0).at(i1).at(i2).at(i3).at(i4).size() != d5) - throw std::invalid_argument("Vector size is not constant at dimension 5"); - - for (int i5 = 0; i5 < dim[5]; i5++) { - operator()(i0, i1, i2, i3, i4, i5) = vec.at(i0).at(i1).at(i2).at(i3).at(i4).at(i5); - - } - } - } - } - } - } - - } - - /** - * Parametrized constructor from vector> container - * @param vec container - * @param array_name array name - */ - Array6D(const vector>>>>> &vec, const string &array_name = "Array6D") { - this->set_vector(vec); - this->array_name = array_name; - } - - /** - * operator= to vector> container - * @param vec container - */ - Array6D &operator=(const vector>>>>> &vec) { - this->set_vector(vec); - return *this; - } - - - /** - * operator= to flatten vector container - * @param vec container - */ - Array6D &operator=(const vector &vec) { - this->set_flatten_vector(vec); - return *this; - } - - - vector get_shape() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = dim[d]; - return sh; - } - - vector get_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d]; - return sh; - } - - vector get_memory_strides() const { - vector sh(ndim); - for (int d = 0; d < ndim; d++) - sh[d] = s[d] * sizeof(T); - return sh; - } -}; - - -#endif //ACE_MULTIARRAY_H diff --git a/lib/pace/ace_c_basis.cpp b/lib/pace/ace_c_basis.cpp deleted file mode 100644 index d1c55700b7..0000000000 --- a/lib/pace/ace_c_basis.cpp +++ /dev/null @@ -1,980 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 1.04.20. - -#include "ace_c_basis.h" -#include "ships_radial.h" - -using namespace std; - -ACECTildeBasisSet::ACECTildeBasisSet(string filename) { - load(filename); -} - -ACECTildeBasisSet::ACECTildeBasisSet(const ACECTildeBasisSet &other) { - ACECTildeBasisSet::_copy_scalar_memory(other); - ACECTildeBasisSet::_copy_dynamic_memory(other); - pack_flatten_basis(); -} - - -ACECTildeBasisSet &ACECTildeBasisSet::operator=(const ACECTildeBasisSet &other) { - if (this != &other) { - _clean(); - _copy_scalar_memory(other); - _copy_dynamic_memory(other); - pack_flatten_basis(); - } - return *this; -} - - -ACECTildeBasisSet::~ACECTildeBasisSet() { - ACECTildeBasisSet::_clean(); -} - -void ACECTildeBasisSet::_clean() { - // call parent method - ACEFlattenBasisSet::_clean(); - _clean_contiguous_arrays(); - _clean_basis_arrays(); -} - -void ACECTildeBasisSet::_copy_scalar_memory(const ACECTildeBasisSet &src) { - ACEFlattenBasisSet::_copy_scalar_memory(src); - num_ctilde_max = src.num_ctilde_max; -} - -void ACECTildeBasisSet::_copy_dynamic_memory(const ACECTildeBasisSet &src) {//allocate new memory - ACEFlattenBasisSet::_copy_dynamic_memory(src); - - if (src.basis_rank1 == nullptr) - throw runtime_error("Could not copy ACECTildeBasisSet::basis_rank1 - array not initialized"); - if (src.basis == nullptr) throw runtime_error("Could not copy ACECTildeBasisSet::basis - array not initialized"); - - - basis_rank1 = new ACECTildeBasisFunction *[src.nelements]; - basis = new ACECTildeBasisFunction *[src.nelements]; - - //copy basis arrays - for (SPECIES_TYPE mu = 0; mu < src.nelements; ++mu) { - basis_rank1[mu] = new ACECTildeBasisFunction[src.total_basis_size_rank1[mu]]; - - for (size_t i = 0; i < src.total_basis_size_rank1[mu]; i++) { - basis_rank1[mu][i] = src.basis_rank1[mu][i]; - } - - - basis[mu] = new ACECTildeBasisFunction[src.total_basis_size[mu]]; - for (size_t i = 0; i < src.total_basis_size[mu]; i++) { - basis[mu][i] = src.basis[mu][i]; - } - } - //DON"T COPY CONTIGUOUS ARRAY, REBUILD THEM -} - -void ACECTildeBasisSet::_clean_contiguous_arrays() { - ACEFlattenBasisSet::_clean_contiguous_arrays(); - - delete[] full_c_tildes_rank1; - full_c_tildes_rank1 = nullptr; - - delete[] full_c_tildes; - full_c_tildes = nullptr; -} - -//re-pack the constituent dynamic arrays of all basis functions in contiguous arrays -void ACECTildeBasisSet::pack_flatten_basis() { - compute_array_sizes(basis_rank1, basis); - - //1. clean contiguous arrays - _clean_contiguous_arrays(); - //2. allocate contiguous arrays - delete[] full_ns_rank1; - full_ns_rank1 = new NS_TYPE[rank_array_total_size_rank1]; - delete[] full_ls_rank1; - full_ls_rank1 = new NS_TYPE[rank_array_total_size_rank1]; - delete[] full_mus_rank1; - full_mus_rank1 = new SPECIES_TYPE[rank_array_total_size_rank1]; - delete[] full_ms_rank1; - full_ms_rank1 = new MS_TYPE[rank_array_total_size_rank1]; - - delete[] full_c_tildes_rank1; - full_c_tildes_rank1 = new DOUBLE_TYPE[coeff_array_total_size_rank1]; - - - delete[] full_ns; - full_ns = new NS_TYPE[rank_array_total_size]; - delete[] full_ls; - full_ls = new LS_TYPE[rank_array_total_size]; - delete[] full_mus; - full_mus = new SPECIES_TYPE[rank_array_total_size]; - delete[] full_ms; - full_ms = new MS_TYPE[ms_array_total_size]; - - delete[] full_c_tildes; - full_c_tildes = new DOUBLE_TYPE[coeff_array_total_size]; - - - //3. copy the values from private C_tilde_B_basis_function arrays to new contigous space - //4. clean private memory - //5. reassign private array pointers - - //r = 0, rank = 1 - size_t rank_array_ind_rank1 = 0; - size_t coeff_array_ind_rank1 = 0; - size_t ms_array_ind_rank1 = 0; - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - for (int func_ind_r1 = 0; func_ind_r1 < total_basis_size_rank1[mu]; ++func_ind_r1) { - ACECTildeBasisFunction &func = basis_rank1[mu][func_ind_r1]; - - //copy values ns from c_tilde_basis_function private memory to contigous memory part - full_ns_rank1[rank_array_ind_rank1] = func.ns[0]; - - //copy values ls from c_tilde_basis_function private memory to contigous memory part - full_ls_rank1[rank_array_ind_rank1] = func.ls[0]; - - //copy values mus from c_tilde_basis_function private memory to contigous memory part - full_mus_rank1[rank_array_ind_rank1] = func.mus[0]; - - //copy values ctildes from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_c_tildes_rank1[coeff_array_ind_rank1], func.ctildes, - func.ndensity * sizeof(DOUBLE_TYPE)); - - - //copy values mus from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_ms_rank1[ms_array_ind_rank1], func.ms_combs, - func.num_ms_combs * - func.rank * sizeof(MS_TYPE)); - - //release memory of each ACECTildeBasisFunction if it is not proxy - func._clean(); - - func.mus = &full_mus_rank1[rank_array_ind_rank1]; - func.ns = &full_ns_rank1[rank_array_ind_rank1]; - func.ls = &full_ls_rank1[rank_array_ind_rank1]; - func.ms_combs = &full_ms_rank1[ms_array_ind_rank1]; - func.ctildes = &full_c_tildes_rank1[coeff_array_ind_rank1]; - func.is_proxy = true; - - rank_array_ind_rank1 += func.rank; - ms_array_ind_rank1 += func.rank * - func.num_ms_combs; - coeff_array_ind_rank1 += func.num_ms_combs * func.ndensity; - - } - } - - - //rank>1, r>0 - size_t rank_array_ind = 0; - size_t coeff_array_ind = 0; - size_t ms_array_ind = 0; - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - for (int func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { - ACECTildeBasisFunction &func = basis[mu][func_ind]; - - //copy values mus from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_mus[rank_array_ind], func.mus, - func.rank * sizeof(SPECIES_TYPE)); - - //copy values ns from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_ns[rank_array_ind], func.ns, - func.rank * sizeof(NS_TYPE)); - //copy values ls from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_ls[rank_array_ind], func.ls, - func.rank * sizeof(LS_TYPE)); - //copy values mus from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_ms[ms_array_ind], func.ms_combs, - func.num_ms_combs * - func.rank * sizeof(MS_TYPE)); - - //copy values ctildes from c_tilde_basis_function private memory to contigous memory part - memcpy(&full_c_tildes[coeff_array_ind], func.ctildes, - func.num_ms_combs * func.ndensity * sizeof(DOUBLE_TYPE)); - - - //release memory of each ACECTildeBasisFunction if it is not proxy - func._clean(); - - func.ns = &full_ns[rank_array_ind]; - func.ls = &full_ls[rank_array_ind]; - func.mus = &full_mus[rank_array_ind]; - func.ctildes = &full_c_tildes[coeff_array_ind]; - func.ms_combs = &full_ms[ms_array_ind]; - func.is_proxy = true; - - rank_array_ind += func.rank; - ms_array_ind += func.rank * - func.num_ms_combs; - coeff_array_ind += func.num_ms_combs * func.ndensity; - } - } -} - -void fwrite_c_tilde_b_basis_func(FILE *fptr, ACECTildeBasisFunction &func) { - RANK_TYPE r; - fprintf(fptr, "ctilde_basis_func: "); - fprintf(fptr, "rank=%d ndens=%d mu0=%d ", func.rank, func.ndensity, func.mu0); - - fprintf(fptr, "mu=("); - for (r = 0; r < func.rank; ++r) - fprintf(fptr, " %d ", func.mus[r]); - fprintf(fptr, ")\n"); - - fprintf(fptr, "n=("); - for (r = 0; r < func.rank; ++r) - fprintf(fptr, " %d ", func.ns[r]); - fprintf(fptr, ")\n"); - - fprintf(fptr, "l=("); - for (r = 0; r < func.rank; ++r) - fprintf(fptr, " %d ", func.ls[r]); - fprintf(fptr, ")\n"); - - fprintf(fptr, "num_ms=%d\n", func.num_ms_combs); - - for (int m_ind = 0; m_ind < func.num_ms_combs; m_ind++) { - fprintf(fptr, "<"); - for (r = 0; r < func.rank; ++r) - fprintf(fptr, " %d ", func.ms_combs[m_ind * func.rank + r]); - fprintf(fptr, ">: "); - for (DENSITY_TYPE p = 0; p < func.ndensity; p++) - fprintf(fptr, " %.18f ", func.ctildes[m_ind * func.ndensity + p]); - fprintf(fptr, "\n"); - } - -} - -void ACECTildeBasisSet::save(const string &filename) { - FILE *fptr; - fptr = fopen(filename.c_str(), "w"); - - fprintf(fptr, "nelements=%d\n", nelements); - - //elements mapping - fprintf(fptr, "elements:"); - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) - fprintf(fptr, " %s", elements_name[mu].c_str()); - fprintf(fptr, "\n\n"); - - fprintf(fptr, "lmax=%d\n\n", lmax); - - fprintf(fptr, "embedding-function: %s\n", npoti.c_str()); - - fprintf(fptr, "%ld FS parameters: ", FS_parameters.size()); - for (int i = 0; i < FS_parameters.size(); ++i) { - fprintf(fptr, " %f", FS_parameters.at(i)); - } - fprintf(fptr, "\n"); - - //hard-core energy cutoff repulsion - fprintf(fptr, "core energy-cutoff parameters: "); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - fprintf(fptr, "%.18f %.18f\n", rho_core_cutoffs(mu_i), drho_core_cutoffs(mu_i)); - - // save E0 values - fprintf(fptr, "E0:"); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - fprintf(fptr, " %.18f", E0vals(mu_i)); - fprintf(fptr, "\n"); - - - fprintf(fptr, "\n"); - - - fprintf(fptr, "radbasename=%s\n", radial_functions->radbasename.c_str()); - fprintf(fptr, "nradbase=%d\n", nradbase); - fprintf(fptr, "nradmax=%d\n", nradmax); - - - fprintf(fptr, "cutoffmax=%f\n", cutoffmax); - - fprintf(fptr, "deltaSplineBins=%f\n", deltaSplineBins); - - //hard-core repulsion - fprintf(fptr, "core repulsion parameters: "); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) - fprintf(fptr, "%.18f %.18f\n", radial_functions->prehc(mu_i, mu_j), radial_functions->lambdahc(mu_j, mu_j)); - - - - - - //TODO: radial functions - //radparameter - fprintf(fptr, "radparameter="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) - fprintf(fptr, " %.18f", radial_functions->lambda(mu_i, mu_j)); - fprintf(fptr, "\n"); - - fprintf(fptr, "cutoff="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) - fprintf(fptr, " %.18f", radial_functions->cut(mu_i, mu_j)); - fprintf(fptr, "\n"); - - fprintf(fptr, "dcut="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) - fprintf(fptr, " %.18f", radial_functions->dcut(mu_i, mu_j)); - fprintf(fptr, "\n"); - - fprintf(fptr, "crad="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { - for (NS_TYPE k = 0; k < nradbase; k++) { - for (NS_TYPE n = 0; n < nradmax; n++) { - for (LS_TYPE l = 0; l <= lmax; l++) { - fprintf(fptr, " %.18f", radial_functions->crad(mu_i, mu_j, n, l, k)); - } - fprintf(fptr, "\n"); - } - } - } - - fprintf(fptr, "\n"); - - fprintf(fptr, "rankmax=%d\n", rankmax); - fprintf(fptr, "ndensitymax=%d\n", ndensitymax); - fprintf(fptr, "\n"); - - //num_c_tilde_max - fprintf(fptr, "num_c_tilde_max=%d\n", num_ctilde_max); - fprintf(fptr, "num_ms_combinations_max=%d\n", num_ms_combinations_max); - - - //write total_basis_size and total_basis_size_rank1 - fprintf(fptr, "total_basis_size_rank1: "); - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - fprintf(fptr, "%d ", total_basis_size_rank1[mu]); - } - fprintf(fptr, "\n"); - - for (SPECIES_TYPE mu = 0; mu < nelements; mu++) - for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size_rank1[mu]; ++func_ind) - fwrite_c_tilde_b_basis_func(fptr, basis_rank1[mu][func_ind]); - - fprintf(fptr, "total_basis_size: "); - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - fprintf(fptr, "%d ", total_basis_size[mu]); - } - fprintf(fptr, "\n"); - - for (SPECIES_TYPE mu = 0; mu < nelements; mu++) - for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) - fwrite_c_tilde_b_basis_func(fptr, basis[mu][func_ind]); - - - fclose(fptr); -} - -void fread_c_tilde_b_basis_func(FILE *fptr, ACECTildeBasisFunction &func) { - RANK_TYPE r; - int res; - char buf[3][128]; - - res = fscanf(fptr, " ctilde_basis_func: "); - - res = fscanf(fptr, "rank=%s ndens=%s mu0=%s ", buf[0], buf[1], buf[2]); - if (res != 3) - throw invalid_argument("Could not read C-tilde basis function"); - - func.rank = (RANK_TYPE) stol(buf[0]); - func.ndensity = (DENSITY_TYPE) stol(buf[1]); - func.mu0 = (SPECIES_TYPE) stol(buf[2]); - - func.mus = new SPECIES_TYPE[func.rank]; - func.ns = new NS_TYPE[func.rank]; - func.ls = new LS_TYPE[func.rank]; - - res = fscanf(fptr, " mu=("); - for (r = 0; r < func.rank; ++r) { - res = fscanf(fptr, "%s", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - func.mus[r] = (SPECIES_TYPE) stol(buf[0]); - } - res = fscanf(fptr, " )"); // ")" - - res = fscanf(fptr, " n=("); // "n=" - for (r = 0; r < func.rank; ++r) { - res = fscanf(fptr, "%s", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - - func.ns[r] = (NS_TYPE) stol(buf[0]); - } - res = fscanf(fptr, " )"); - - res = fscanf(fptr, " l=("); - for (r = 0; r < func.rank; ++r) { - res = fscanf(fptr, "%s", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - func.ls[r] = (NS_TYPE) stol(buf[0]); - } - res = fscanf(fptr, " )"); - - res = fscanf(fptr, " num_ms=%s\n", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - - func.num_ms_combs = (SHORT_INT_TYPE) stoi(buf[0]); - - func.ms_combs = new MS_TYPE[func.rank * func.num_ms_combs]; - func.ctildes = new DOUBLE_TYPE[func.ndensity * func.num_ms_combs]; - - for (int m_ind = 0; m_ind < func.num_ms_combs; m_ind++) { - res = fscanf(fptr, " <"); - for (r = 0; r < func.rank; ++r) { - res = fscanf(fptr, "%s", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - func.ms_combs[m_ind * func.rank + r] = stoi(buf[0]); - } - res = fscanf(fptr, " >:"); - for (DENSITY_TYPE p = 0; p < func.ndensity; p++) { - res = fscanf(fptr, "%s", buf[0]); - if (res != 1) - throw invalid_argument("Could not read C-tilde basis function"); - func.ctildes[m_ind * func.ndensity + p] = stod(buf[0]); - } - } -} - -string -format_error_message(const char *buffer, const string &filename, const string &var_name, const string &expected) { - string err_message = "File '" + filename + "': couldn't read '" + var_name + "'"; - if (buffer) - err_message = err_message + ", read:'" + buffer + "'"; - if (!expected.empty()) - err_message = err_message + ". Expected format: '" + expected + "'"; - return err_message; -} - -void throw_error(const string &filename, const string &var_name, const string expected = "") { - throw invalid_argument(format_error_message(nullptr, filename, var_name, expected)); -} - -DOUBLE_TYPE stod_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { - try { - return stod(buffer); - } catch (invalid_argument &exc) { - throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); - } -} - -int stoi_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { - try { - return stoi(buffer); - } catch (invalid_argument &exc) { - throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); - } -} - -long int stol_err(const char *buffer, const string &filename, const string &var_name, const string expected = "") { - try { - return stol(buffer); - } catch (invalid_argument &exc) { - throw invalid_argument(format_error_message(buffer, filename, var_name, expected).c_str()); - } -} - -void ACECTildeBasisSet::load(const string filename) { - int res; - char buffer[1024], buffer2[1024]; - string radbasename = "ChebExpCos"; - - FILE *fptr; - fptr = fopen(filename.c_str(), "r"); - if (fptr == NULL) - throw invalid_argument("Could not open file " + filename); - - //read number of elements - res = fscanf(fptr, " nelements="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "nelements", "nelements=[number]"); - nelements = stoi_err(buffer, filename, "nelements", "nelements=[number]"); - - //elements mapping - elements_name = new string[nelements]; - res = fscanf(fptr, " elements:"); - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "elements", "elements: Ele1 Ele2 ..."); - elements_name[mu] = buffer; - } - - // load angular basis - only need spherical harmonics parameter - res = fscanf(fptr, " lmax=%s\n", buffer); - if (res != 1) - throw_error(filename, "lmax", "lmax=[number]"); - lmax = stoi_err(buffer, filename, "lmax", "lmax=[number]"); - spherical_harmonics.init(lmax); - - - // reading "embedding-function:" - bool is_embedding_function_specified = false; - res = fscanf(fptr, " embedding-function: %s", buffer); - if (res == 0) { - //throw_error(filename, "E0", " E0: E0-species1 E0-species2 ..."); - this->npoti = "FinnisSinclair"; // default values - //printf("Warning! No embedding-function is specified, embedding-function: FinnisSinclair would be assumed\n"); - is_embedding_function_specified = false; - } else { - this->npoti = buffer; - is_embedding_function_specified = true; - } - int parameters_size; - res = fscanf(fptr, "%s FS parameters:", buffer); - if (res != 1) - throw_error(filename, "FS parameters size", "[number] FS parameters: par1 par2 ..."); - parameters_size = stoi_err(buffer, filename, "FS parameters size", "[number] FS parameters"); - FS_parameters.resize(parameters_size); - for (int i = 0; i < FS_parameters.size(); ++i) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "FS parameter", "[number] FS parameters: [par1] [par2] ..."); - FS_parameters[i] = stod_err(buffer, filename, "FS parameter", "[number] FS parameters: [par1] [par2] ..."); - } - - if (!is_embedding_function_specified) { - // assuming non-linear potential, and embedding function type is important - for (int j = 1; j < parameters_size; j += 2) - if (FS_parameters[j] != 1.0) { //if not ensure linearity of embedding function parameters - printf("ERROR! Your potential is non-linear\n"); - printf("Please specify 'embedding-function: FinnisSinclair' or 'embedding-function: FinnisSinclairShiftedScaled' before 'FS parameters size' line\n"); - throw_error(filename, "embedding-function", "FinnisSinclair or FinnisSinclairShiftedScaled"); - } - printf("Notice! No embedding-function is specified, but potential has linear embedding, default embedding-function: FinnisSinclair would be assumed\n"); - } - - //hard-core energy cutoff repulsion - res = fscanf(fptr, " core energy-cutoff parameters:"); - if (res != 0) - throw_error(filename, "core energy-cutoff parameters", "core energy-cutoff parameters: [par1] [par2]"); - - rho_core_cutoffs.init(nelements, "rho_core_cutoffs"); - drho_core_cutoffs.init(nelements, "drho_core_cutoffs"); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) { - res = fscanf(fptr, "%s %s", buffer, buffer2); - if (res != 2) - throw_error(filename, "core energy-cutoff parameters", - "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); - rho_core_cutoffs(mu_i) = stod_err(buffer, filename, "rho core cutoff", - "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); - drho_core_cutoffs(mu_i) = stod_err(buffer2, filename, "drho_core_cutoff", - "core energy-cutoff parameters: [rho_core_cut] [drho_core_cutoff] ..."); - } - - // atom energy shift E0 (energy of isolated atom) - E0vals.init(nelements); - - // reading "E0:" - res = fscanf(fptr, " E0: %s", buffer); - if (res == 0) { - //throw_error(filename, "E0", " E0: E0-species1 E0-species2 ..."); - E0vals.fill(0.0); - } else { - double E0 = atof(buffer); - E0vals(0) = E0; - - for (SPECIES_TYPE mu_i = 1; mu_i < nelements; ++mu_i) { - res = fscanf(fptr, " %lf", &E0); - if (res != 1) - throw_error(filename, "E0", " couldn't read one of the E0 values"); - E0vals(mu_i) = E0; - } - res = fscanf(fptr, "\n"); - if (res != 0) - printf("file %s : format seems broken near E0; trying to continue...\n", filename.c_str()); - } - - // check which radial basis we need to load - res = fscanf(fptr, " radbasename=%s\n", buffer); - if (res != 1) { - throw_error(filename, "radbasename", "rabbasename=ChebExpCos|ChebPow|ACE.jl.Basic"); - } else { - radbasename = buffer; - } - -// printf("radbasename = `%s`\n", radbasename.c_str()); - if (radbasename == "ChebExpCos" | radbasename == "ChebPow") { - _load_radial_ACERadial(fptr, filename, radbasename); - } else if (radbasename == "ACE.jl.Basic") { - _load_radial_SHIPsBasic(fptr, filename, radbasename); - } else { - throw invalid_argument( - ("File '" + filename + "': I don't know how to read radbasename = " + radbasename).c_str()); - } - - res = fscanf(fptr, " rankmax="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "rankmax", "rankmax=[number]"); - rankmax = stoi_err(buffer, filename, "rankmax", "rankmax=[number]"); - - res = fscanf(fptr, " ndensitymax="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "ndensitymax", "ndensitymax=[number]"); - ndensitymax = stoi_err(buffer, filename, "ndensitymax", "ndensitymax=[number]"); - - // read the list of correlations to be put into the basis - //num_c_tilde_max - res = fscanf(fptr, " num_c_tilde_max="); - res = fscanf(fptr, "%s\n", buffer); - if (res != 1) - throw_error(filename, "num_c_tilde_max", "num_c_tilde_max=[number]"); - num_ctilde_max = stol_err(buffer, filename, "num_c_tilde_max", "num_c_tilde_max=[number]"); - - res = fscanf(fptr, " num_ms_combinations_max="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "num_ms_combinations_max", "num_ms_combinations_max=[number]"); -// throw invalid_argument(("File '" + filename + "': couldn't read num_ms_combinations_max").c_str()); - num_ms_combinations_max = stol_err(buffer, filename, "num_ms_combinations_max", "num_ms_combinations_max=[number]"); - - //read total_basis_size_rank1 - total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; - basis_rank1 = new ACECTildeBasisFunction *[nelements]; - res = fscanf(fptr, " total_basis_size_rank1: "); - - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "total_basis_size_rank1", "total_basis_size_rank1: [size_ele1] [size_ele2] ..."); -// throw invalid_argument(("File '" + filename + "': couldn't read total_basis_size_rank1").c_str()); - total_basis_size_rank1[mu] = stoi_err(buffer, filename, "total_basis_size_rank1", - "total_basis_size_rank1: [size_ele1] [size_ele2] ..."); - basis_rank1[mu] = new ACECTildeBasisFunction[total_basis_size_rank1[mu]]; - } - for (SPECIES_TYPE mu = 0; mu < nelements; mu++) - for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size_rank1[mu]; ++func_ind) { - fread_c_tilde_b_basis_func(fptr, basis_rank1[mu][func_ind]); - } - - //read total_basis_size - res = fscanf(fptr, " total_basis_size: "); - total_basis_size = new SHORT_INT_TYPE[nelements]; - basis = new ACECTildeBasisFunction *[nelements]; - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "total_basis_size", "total_basis_size: [size_ele1] [size_ele2] ..."); - total_basis_size[mu] = stoi_err(buffer, filename, "total_basis_size", - "total_basis_size: [size_ele1] [size_ele2] ..."); - basis[mu] = new ACECTildeBasisFunction[total_basis_size[mu]]; - } - for (SPECIES_TYPE mu = 0; mu < nelements; mu++) - for (SHORT_INT_TYPE func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { - fread_c_tilde_b_basis_func(fptr, basis[mu][func_ind]); - } - - fclose(fptr); - -// radial_functions->radbasename = radbasename; - radial_functions->setuplookupRadspline(); - pack_flatten_basis(); -} - -void ACECTildeBasisSet::compute_array_sizes(ACECTildeBasisFunction **basis_rank1, ACECTildeBasisFunction **basis) { - //compute arrays sizes - rank_array_total_size_rank1 = 0; - //ms_array_total_size_rank1 = rank_array_total_size_rank1; - coeff_array_total_size_rank1 = 0; - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - if (total_basis_size_rank1[mu] > 0) { - rank_array_total_size_rank1 += total_basis_size_rank1[mu]; - - ACEAbstractBasisFunction &func = basis_rank1[mu][0];//TODO: get total density instead of density from first function - coeff_array_total_size_rank1 += total_basis_size_rank1[mu] * func.ndensity; - } - } - - rank_array_total_size = 0; - coeff_array_total_size = 0; - - ms_array_total_size = 0; - max_dB_array_size = 0; - - - max_B_array_size = 0; - - size_t cur_ms_size = 0; - size_t cur_ms_rank_size = 0; - - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - - cur_ms_size = 0; - cur_ms_rank_size = 0; - for (int func_ind = 0; func_ind < total_basis_size[mu]; ++func_ind) { - auto &func = basis[mu][func_ind]; - rank_array_total_size += func.rank; - ms_array_total_size += func.rank * func.num_ms_combs; - coeff_array_total_size += func.ndensity * func.num_ms_combs; - - cur_ms_size += func.num_ms_combs; - cur_ms_rank_size += func.rank * func.num_ms_combs; - } - - if (cur_ms_size > max_B_array_size) - max_B_array_size = cur_ms_size; - - if (cur_ms_rank_size > max_dB_array_size) - max_dB_array_size = cur_ms_rank_size; - } -} - -void ACECTildeBasisSet::_clean_basis_arrays() { - if (basis_rank1 != nullptr) - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - delete[] basis_rank1[mu]; - basis_rank1[mu] = nullptr; - } - - if (basis != nullptr) - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - delete[] basis[mu]; - basis[mu] = nullptr; - } - delete[] basis; - basis = nullptr; - - delete[] basis_rank1; - basis_rank1 = nullptr; -} - -//pack into 1D array with all basis functions -void ACECTildeBasisSet::flatten_basis(C_tilde_full_basis_vector2d &mu0_ctilde_basis_vector) { - - _clean_basis_arrays(); - basis_rank1 = new ACECTildeBasisFunction *[nelements]; - basis = new ACECTildeBasisFunction *[nelements]; - - delete[] total_basis_size_rank1; - delete[] total_basis_size; - total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; - total_basis_size = new SHORT_INT_TYPE[nelements]; - - - size_t tot_size_rank1 = 0; - size_t tot_size = 0; - - for (SPECIES_TYPE mu = 0; mu < this->nelements; ++mu) { - tot_size = 0; - tot_size_rank1 = 0; - - for (auto &func: mu0_ctilde_basis_vector[mu]) { - if (func.rank == 1) tot_size_rank1 += 1; - else tot_size += 1; - } - - total_basis_size_rank1[mu] = tot_size_rank1; - basis_rank1[mu] = new ACECTildeBasisFunction[tot_size_rank1]; - - total_basis_size[mu] = tot_size; - basis[mu] = new ACECTildeBasisFunction[tot_size]; - } - - - for (SPECIES_TYPE mu = 0; mu < this->nelements; ++mu) { - size_t ind_rank1 = 0; - size_t ind = 0; - - for (auto &func: mu0_ctilde_basis_vector[mu]) { - if (func.rank == 1) { //r=0, rank=1 - basis_rank1[mu][ind_rank1] = func; - ind_rank1 += 1; - } else { //r>0, rank>1 - basis[mu][ind] = func; - ind += 1; - } - } - - } -} - - -void ACECTildeBasisSet::_load_radial_ACERadial(FILE *fptr, - const string filename, - const string radbasename) { - int res; - char buffer[1024], buffer2[1024]; - - res = fscanf(fptr, " nradbase="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "nradbase", "nradbase=[number]"); -// throw invalid_argument(("File '" + filename + "': couldn't read nradbase").c_str()); - nradbase = stoi_err(buffer, filename, "nradbase", "nradbase=[number]"); - - res = fscanf(fptr, " nradmax="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "nradmax", "nradmax=[number]"); - nradmax = stoi_err(buffer, filename, "nradmax", "nradmax=[number]"); - - res = fscanf(fptr, " cutoffmax="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "cutoffmax", "cutoffmax=[number]"); - cutoffmax = stod_err(buffer, filename, "cutoffmax", "cutoffmax=[number]"); - - - res = fscanf(fptr, " deltaSplineBins="); - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "deltaSplineBins", "deltaSplineBins=[spline density, Angstroms]"); -// throw invalid_argument(("File '" + filename + "': couldn't read ntot").c_str()); - deltaSplineBins = stod_err(buffer, filename, "deltaSplineBins", "deltaSplineBins=[spline density, Angstroms]"); - - - if (radial_functions == nullptr) - radial_functions = new ACERadialFunctions(nradbase, lmax, nradmax, - deltaSplineBins, - nelements, - cutoffmax, radbasename); - else - radial_functions->init(nradbase, lmax, nradmax, - deltaSplineBins, - nelements, - cutoffmax, radbasename); - - - //hard-core repulsion - res = fscanf(fptr, " core repulsion parameters:"); - if (res != 0) - throw_error(filename, "core repulsion parameters", "core repulsion parameters: [prehc lambdahc] ..."); -// throw invalid_argument(("File '" + filename + "': couldn't read core repulsion parameters").c_str()); - - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { - res = fscanf(fptr, "%s %s", buffer, buffer2); - if (res != 2) - throw_error(filename, "core repulsion parameters", "core repulsion parameters: [prehc lambdahc] ..."); - radial_functions->prehc(mu_i, mu_j) = stod_err(buffer, filename, "core repulsion parameters", - "core repulsion parameters: [prehc lambdahc] ..."); - radial_functions->lambdahc(mu_i, mu_j) = stod_err(buffer2, filename, "core repulsion parameters", - "core repulsion parameters: [prehc lambdahc] ..."); - } - - - - //read radial functions parameter - res = fscanf(fptr, " radparameter="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "radparameter", "radparameter=[param_ele1] [param_ele2]"); - radial_functions->lambda(mu_i, mu_j) = stod_err(buffer, filename, "radparameter", - "radparameter=[param_ele1] [param_ele2]"); - } - - - res = fscanf(fptr, " cutoff="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "cutoff", "cutoff=[param_ele1] [param_ele2]"); - radial_functions->cut(mu_i, mu_j) = stod_err(buffer, filename, "cutoff", - "cutoff=[param_ele1] [param_ele2]"); - } - - - res = fscanf(fptr, " dcut="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) { - res = fscanf(fptr, " %s", buffer); - if (res != 1) - throw_error(filename, "dcut", "dcut=[param_ele1] [param_ele2]"); - radial_functions->dcut(mu_i, mu_j) = stod_err(buffer, filename, "dcut", "dcut=[param_ele1] [param_ele2]"); - } - - - res = fscanf(fptr, " crad="); - for (SPECIES_TYPE mu_i = 0; mu_i < nelements; ++mu_i) - for (SPECIES_TYPE mu_j = 0; mu_j < nelements; ++mu_j) - for (NS_TYPE k = 0; k < nradbase; k++) - for (NS_TYPE n = 0; n < nradmax; n++) - for (LS_TYPE l = 0; l <= lmax; l++) { - res = fscanf(fptr, "%s", buffer); - if (res != 1) - throw_error(filename, "crad", "crad=[crad_]...[crad_knl]: nradbase*nrad*(l+1) times"); - radial_functions->crad(mu_i, mu_j, n, l, k) = stod_err(buffer, filename, "crad", - "crad=[crad_]...[crad_knl]: nradbase*nrad*(l+1) times"); - } -} - -void ACECTildeBasisSet::_load_radial_SHIPsBasic(FILE *fptr, - const string filename, - const string radbasename) { - // create a radial basis object, and read it from the file pointer - SHIPsRadialFunctions *ships_radial_functions = new SHIPsRadialFunctions(); - ships_radial_functions->fread(fptr); - - //mimic ships_radial_functions to ACERadialFunctions - ships_radial_functions->nradial = ships_radial_functions->get_maxn(); - ships_radial_functions->nradbase = ships_radial_functions->get_maxn(); - - nradbase = ships_radial_functions->get_maxn(); - nradmax = ships_radial_functions->get_maxn(); - cutoffmax = ships_radial_functions->get_rcut(); - deltaSplineBins = 0.001; - - ships_radial_functions->init(nradbase, lmax, nradmax, - deltaSplineBins, - nelements, - cutoffmax, radbasename); - - - if (radial_functions) delete radial_functions; - radial_functions = ships_radial_functions; - radial_functions->prehc.fill(0); - radial_functions->lambdahc.fill(1); - radial_functions->lambda.fill(0); - - - radial_functions->cut.fill(ships_radial_functions->get_rcut()); - radial_functions->dcut.fill(0); - - radial_functions->crad.fill(0); - -} \ No newline at end of file diff --git a/lib/pace/ace_c_basis.h b/lib/pace/ace_c_basis.h deleted file mode 100644 index ec6b9e8afc..0000000000 --- a/lib/pace/ace_c_basis.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 1.04.20. - -#ifndef ACE_C_BASIS_H -#define ACE_C_BASIS_H - -#include "ace_flatten_basis.h" - -typedef vector> C_tilde_full_basis_vector2d; - -/** - * ACE basis set of C-tilde basis functions - */ -class ACECTildeBasisSet : public ACEFlattenBasisSet { -public: - - ACECTildeBasisFunction **basis_rank1 = nullptr; ///< two-dimensional array of first-rank basis function with indices: [species index][func index] - ACECTildeBasisFunction **basis = nullptr; ///< two-dimensional array of higher rank basis function with indices: [species index][func index] - - DOUBLE_TYPE *full_c_tildes_rank1 = nullptr; ///< C_tilde coefficients contiguous package, size: coeff_array_total_size_rank1 - DOUBLE_TYPE *full_c_tildes = nullptr; ///< C_tilde coefficients contiguous package, size: coeff_array_total_size - - //TODO: remove? - SHORT_INT_TYPE num_ctilde_max = 0; - - - /** - * Default constructor - */ - ACECTildeBasisSet() = default; - - /** - * Constructor from .ace file - */ - ACECTildeBasisSet(const string filename); - - /** - * Copy constructor (see. Rule of Three) - * @param other - */ - ACECTildeBasisSet(const ACECTildeBasisSet &other); - - /** - * operator= (see. Rule of Three) - * @param other - * @return - */ - ACECTildeBasisSet &operator=(const ACECTildeBasisSet &other); - - /** - * Destructor (see. Rule of Three) - */ - ~ACECTildeBasisSet() override; - - /** - * Cleaning dynamic memory of the class (see. Rule of Three) - */ - void _clean() override; - - /** - * Copying and cleaning dynamic memory of the class (see. Rule of Three) - * @param src - */ - void _copy_dynamic_memory(const ACECTildeBasisSet &src); - - /** - * Copying scalar variables - * @param src - */ - void _copy_scalar_memory(const ACECTildeBasisSet &src); - - /** - * Clean contiguous arrays (full_c_tildes_rank1, full_c_tildes) and those of base class - */ - void _clean_contiguous_arrays() override ; - - /** - * Save potential to .ace file - * @param filename .ace file name - */ - void save(const string &filename) override; - - /** - * Load potential from .ace - * @param filename .ace file name - */ - void load(const string filename) override; - - /** - * Load the ACE type radial basis - */ - void _load_radial_ACERadial(FILE *fptr, - const string filename, - const string radbasename); - - void _load_radial_SHIPsBasic(FILE * fptr, - const string filename, - const string radbasename ); - - /** - * Re-pack the constituent dynamic arrays of all basis functions in contiguous arrays - */ - void pack_flatten_basis() override; - - /** - * Computes flatten array sizes - * @param basis_rank1 two-dimensional array of first-rank ACECTildeBasisFunctions - * @param basis two-dimensional array of higher-rank ACECTildeBasisFunctions - */ - void compute_array_sizes(ACECTildeBasisFunction** basis_rank1, ACECTildeBasisFunction** basis); - - /** - * Clean basis arrays 'basis_rank1' and 'basis' - */ - void _clean_basis_arrays(); - - /** - * Pack two-dimensional vector of ACECTildeBasisFunction into 1D dynami array with all basis functions - * @param mu0_ctilde_basis_vector vector> - */ - void flatten_basis(C_tilde_full_basis_vector2d& mu0_ctilde_basis_vector); - - /** - * Empty stub implementation - */ - void flatten_basis() override{}; -}; - -#endif //ACE_C_BASIS_H diff --git a/lib/pace/ace_c_basisfunction.h b/lib/pace/ace_c_basisfunction.h deleted file mode 100644 index 4e2795590e..0000000000 --- a/lib/pace/ace_c_basisfunction.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 26.02.20. - -#ifndef ACE_C_BASISFUNCTION_H -#define ACE_C_BASISFUNCTION_H - -#include -#include -#include -#include - -#include "ace_types.h" - -//macros for copying the member-array from "other" object for C-tilde and B-basis -#define basis_mem_copy(other, array, size, type) if(other.array) { \ - if(!is_proxy) delete[] array;\ - array = new type[(size)];\ - is_proxy = false;\ - memcpy(array, other.array, (size) * sizeof(type));\ -} - -/** - * Abstract basis function, that stores general quantities - */ -struct ACEAbstractBasisFunction { - /** - * flattened array of computed combinations of (m1, m2, ..., m_rank) - * which have non-zero general Clebsch-Gordan coefficient: - * \f$ \mathbf{m}_1, \dots, \mathbf{m}_\mathrm{num ms combs}\f$ = - * \f$ (m_1, m_2, \dots, m_{rank})_1, \dots, (m_1, m_2, \dots, m_{rank})_{\mathrm{num ms combs}} \f$, - * size = num_ms_combs * rank, - * effective shape: [num_ms_combs][rank] - */ - MS_TYPE *ms_combs = nullptr; - - /** - * species types of neighbours atoms \f$ \mathbf{\mu} = (\mu_1, \mu_2, \dots, \mu_{rank}) \f$, - * should be lexicographically sorted, - * size = rank, - * effective shape: [rank] - */ - SPECIES_TYPE *mus = nullptr; - - /** - * indices for radial part \f$ \mathbf{n} = (n_1, n_2, \dots, n_{rank}) \f$, - * should be lexicographically sorted, - * size = rank, - * effective shape: [rank] - */ - NS_TYPE *ns = nullptr; - - - /** - * indices for radial part \f$ \mathbf{l} = (l_1, l_2, \dots, l_{rank}) \f$, - * should be lexicographically sorted, - * size = rank, - * effective shape: [rank] - */ - LS_TYPE *ls = nullptr; - - SHORT_INT_TYPE num_ms_combs = 0; ///< number of different ms-combinations - - RANK_TYPE rank = 0; ///< number of atomic base functions "A"s in basis function product B - - DENSITY_TYPE ndensity = 0; ///< number of densities - - SPECIES_TYPE mu0 = 0; ///< species type of central atom - - /** - * whether ms array contains only "non-negative" ms-combinations. - * positive ms-combination is when the first non-zero m is positive (0 1 -1) - * negative ms-combination is when the first non-zero m is negative (0 -1 1) - */ - bool is_half_ms_basis = false; - - /* - * flag, whether object is "owner" (i.e. responsible for memory cleaning) of - * the ms, ns, ls, mus and other dynamically allocated arrases or just a proxy for them - */ - bool is_proxy = false; - - /** - * Copying static and dynamic memory variables from another ACEAbstractBasisFunction. - * Always copy the dynamic memory, even if the source is a proxy object - * @param other - */ - virtual void _copy_from(const ACEAbstractBasisFunction &other) { - rank = other.rank; - ndensity = other.ndensity; - mu0 = other.mu0; - num_ms_combs = other.num_ms_combs; - is_half_ms_basis = other.is_half_ms_basis; - is_proxy = false; - - basis_mem_copy(other, mus, rank, SPECIES_TYPE) - basis_mem_copy(other, ns, rank, NS_TYPE) - basis_mem_copy(other, ls, rank, LS_TYPE) - basis_mem_copy(other, ms_combs, num_ms_combs * rank, MS_TYPE) - } - - /** - * Clean the dynamically allocated memory if object is responsible for it - */ - virtual void _clean() { - //release memory if the structure is not proxy - if (!is_proxy) { - delete[] mus; - delete[] ns; - delete[] ls; - delete[] ms_combs; - } - - mus = nullptr; - ns = nullptr; - ls = nullptr; - ms_combs = nullptr; - } - -}; - -/** - * Representation of C-tilde basis function, i.e. the function that is summed up over a group of B-functions - * that differs only by intermediate coupling orbital moment \f$ L \f$ and coefficients. - */ -struct ACECTildeBasisFunction : public ACEAbstractBasisFunction { - - /** - * c_tilde coefficients for all densities, - * size = num_ms_combs*ndensity, - * effective shape [num_ms_combs][ndensity] - */ - DOUBLE_TYPE *ctildes = nullptr; - - /* - * Default constructor - */ - ACECTildeBasisFunction() = default; - - // Because the ACECTildeBasisFunction contains dynamically allocated arrays, the Rule of Three should be - // fulfilled, i.e. copy constructor (copy the dynamic arrays), operator= (release previous arrays and - // copy the new dynamic arrays) and destructor (release all dynamically allocated memory) - - /** - * Copy constructor, to fulfill the Rule of Three. - * Always copy the dynamic memory, even if the source is a proxy object. - */ - ACECTildeBasisFunction(const ACECTildeBasisFunction &other) { - _copy_from(other); - } - - /* - * operator=, to fulfill the Rule of Three. - * Always copy the dynamic memory, even if the source is a proxy object - */ - ACECTildeBasisFunction &operator=(const ACECTildeBasisFunction &other) { - _clean(); - _copy_from(other); - return *this; - } - - /* - * Destructor - */ - ~ACECTildeBasisFunction() { - _clean(); - } - - /** - * Copy from another object, always copy the memory, even if the source is a proxy object - * @param other - */ - void _copy_from(const ACECTildeBasisFunction &other) { - ACEAbstractBasisFunction::_copy_from(other); - is_proxy = false; - basis_mem_copy(other, ctildes, num_ms_combs * ndensity, DOUBLE_TYPE) - } - - /** - * Clean the dynamically allocated memory if object is responsible for it - */ - void _clean() override { - ACEAbstractBasisFunction::_clean(); - //release memory if the structure is not proxy - if (!is_proxy) { - delete[] ctildes; - } - ctildes = nullptr; - } - - /** - * Print the information about basis function to cout, in order to ease the output redirection. - */ - void print() const { - using namespace std; - cout << "ACECTildeBasisFunction: ndensity= " << (int) this->ndensity << ", mu0 = " << (int) this->mu0 << " "; - cout << " mus=("; - for (RANK_TYPE r = 0; r < this->rank; r++) - cout << (int) this->mus[r] << " "; - cout << "), ns=("; - for (RANK_TYPE r = 0; r < this->rank; r++) - cout << this->ns[r] << " "; - cout << "), ls=("; - for (RANK_TYPE r = 0; r < this->rank; r++) - cout << this->ls[r] << " "; - - cout << "), " << this->num_ms_combs << " m_s combinations: {" << endl; - - for (int i = 0; i < this->num_ms_combs; i++) { - cout << "\t< "; - for (RANK_TYPE r = 0; r < this->rank; r++) - cout << this->ms_combs[i * this->rank + r] << " "; - cout << " >: c_tilde="; - for (DENSITY_TYPE p = 0; p < this->ndensity; ++p) - cout << " " << this->ctildes[i * this->ndensity + p] << " "; - cout << endl; - } - if (this->is_proxy) - cout << "proxy "; - if (this->is_half_ms_basis) - cout << "half_ms_basis"; - cout << "}" << endl; - } -}; - -#endif //ACE_C_BASISFUNCTION_H diff --git a/lib/pace/ace_complex.h b/lib/pace/ace_complex.h deleted file mode 100644 index 5fdb4b5b93..0000000000 --- a/lib/pace/ace_complex.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 26.02.20. - -#ifndef ACE_COMPLEX_H -#define ACE_COMPLEX_H - - -/** -A custom data structure for complex numbers and overloaded operations with them. -*/ -struct ACEComplex { -public: - /** - Double, real part of the complex number - */ - DOUBLE_TYPE real; - /** - Double, imaginary part of the complex number - */ - DOUBLE_TYPE img; - - ACEComplex &operator=(const ACEComplex &rhs) = default; - - ACEComplex &operator=(const DOUBLE_TYPE &rhs) { - this->real = rhs; - this->img = 0.; - return *this; - } - - /** - Overloading of arithmetical operator += ACEComplex - */ - ACEComplex &operator+=(const ACEComplex &rhs) { - this->real += rhs.real; - this->img += rhs.img; - return *this; // return the result by reference - } - - /** - Overloading of arithmetical operator += DOUBLE_TYPE - */ - ACEComplex &operator+=(const DOUBLE_TYPE &rhs) { - this->real += rhs; - return *this; // return the result by reference - } - - /** - Overloading of arithmetical operator *= DOUBLE_TYPE - */ - ACEComplex &operator*=(const DOUBLE_TYPE &rhs) { - this->real *= rhs; - this->img *= rhs; - return *this; // return the result by reference - } - - /** - Overloading of arithmetical operator *= ACEComplex - */ - ACEComplex &operator*=(const ACEComplex &rhs) { - DOUBLE_TYPE old_real = this->real; - this->real = old_real * rhs.real - this->img * rhs.img; - this->img = old_real * rhs.img + this->img * rhs.real; - return *this; // return the result by reference - } - - /** - Overloading of arithmetical operator * ACEComplex - */ - ACEComplex operator*(const ACEComplex &cm2) const { - ACEComplex res{real * cm2.real - img * cm2.img, - real * cm2.img + img * cm2.real}; - return res; - } - - /* - * Return complex conjugated copy of itself - */ - ACEComplex conjugated() const { - ACEComplex res{real, -img}; - return res; - } - - /* - * Complex conjugate itself inplace - */ - void conjugate() { - img = -img; - } - - /* - * Multiplication by ACEComplex and return real-part only - */ - DOUBLE_TYPE real_part_product(const ACEComplex &cm2) const { - return real * cm2.real - img * cm2.img; - } - - /* - * Multiplication by DOUBLE_TYPE and return real-part only - */ - DOUBLE_TYPE real_part_product(const DOUBLE_TYPE &cm2) const { - return real * cm2; - } - - /* - * Overloading of arithmetical operator * by DOUBLE_TYPE - */ - ACEComplex operator*(const DOUBLE_TYPE &cm2) const { - ACEComplex res{real * cm2, - img * cm2}; - return res; - } - - /* - * Overloading of arithmetical operator + ACEComplex - */ - ACEComplex operator+(const ACEComplex &cm2) const { - ACEComplex res{real + cm2.real, - img + cm2.img}; - return res; - } - - /* - * Overloading of arithmetical operator + with DOUBLE_TYPE - */ - ACEComplex operator+(const DOUBLE_TYPE &cm2) const { - ACEComplex res{real + cm2, img}; - return res; - } - - /* - * Overloading of arithmetical operator == ACEComplex - */ - bool operator==(const ACEComplex &c2) const { - return (real == c2.real) && (img == c2.img); - } - - /* - * Overloading of arithmetical operator == DOUBLE_TYPE - */ - bool operator==(const DOUBLE_TYPE &d2) const { - return (real == d2) && (img == 0.); - } - - /* - * Overloading of arithmetical operator != ACEComplex - */ - bool operator!=(const ACEComplex &c2) const { - return (real != c2.real) || (img != c2.img); - } - - /* - * Overloading of arithmetical operator != DOUBLE_TYPE - */ - bool operator!=(const DOUBLE_TYPE &d2) const { - return (real != d2) || (img != 0.); - } - -}; - -/* - * double * complex for commutativity with complex * double - */ -inline ACEComplex operator*(const DOUBLE_TYPE &real, const ACEComplex &cm) { - return cm * real; -} - -/* - * double + complex for commutativity with complex + double - */ -inline ACEComplex operator+(const DOUBLE_TYPE &real, const ACEComplex &cm) { - return cm + real; -} - -/** -A structure to store the derivative of \f$ Y_{lm} \f$ -*/ -struct ACEDYcomponent { -public: - /** - complex, contains the three components of derivative of Ylm, - \f$ \frac{dY_{lm}}{dx}, \frac{dY_{lm}}{dy} and \frac{dY_{lm}}{dz}\f$ - */ - ACEComplex a[3]; - - /* - * Overloading of arithmetical operator*= DOUBLE_TYPE - */ - ACEDYcomponent &operator*=(const DOUBLE_TYPE &rhs) { - this->a[0] *= rhs; - this->a[1] *= rhs; - this->a[2] *= rhs; - return *this; - } - - /* - * Overloading of arithmetical operator * ACEComplex - */ - ACEDYcomponent operator*(const ACEComplex &rhs) const { - ACEDYcomponent res; - res.a[0] = this->a[0] * rhs; - res.a[1] = this->a[1] * rhs; - res.a[2] = this->a[2] * rhs; - return res; - } - - /* - * Overloading of arithmetical operator * DOUBLE_TYPE - */ - ACEDYcomponent operator*(const DOUBLE_TYPE &rhs) const { - ACEDYcomponent res; - res.a[0] = this->a[0] * rhs; - res.a[1] = this->a[1] * rhs; - res.a[2] = this->a[2] * rhs; - return res; - } - - /* - * Return conjugated copy of itself - */ - ACEDYcomponent conjugated() const { - ACEDYcomponent res; - res.a[0] = this->a[0].conjugated(); - res.a[1] = this->a[1].conjugated(); - res.a[2] = this->a[2].conjugated(); - return res; - } - - /* - * Conjugated itself in-place - */ - void conjugate() { - this->a[0].conjugate(); - this->a[1].conjugate(); - this->a[2].conjugate(); - } - -}; - - -#endif //ACE_COMPLEX_H diff --git a/lib/pace/ace_contigous_array.h b/lib/pace/ace_contigous_array.h deleted file mode 100644 index f008fa203f..0000000000 --- a/lib/pace/ace_contigous_array.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Yury Lysogorskiy on 11.01.20. -#ifndef ACE_CONTIGUOUSARRAYND_H -#define ACE_CONTIGUOUSARRAYND_H - -#include - -#include "ace_types.h" - -using namespace std; - -/** - * Common predecessor class to represent multidimensional array of type T - * and store it in memory contiguous form - * - * @tparam T data type - */ -template -class ContiguousArrayND { -protected: - T *data = nullptr; ///< pointer to contiguous data - size_t size = 0; ///< total array size - string array_name = "Array"; /// 0) { - data = new T[size]; - for (size_t ind = 0; ind < size; ind++) - data[ind] = other.data[ind]; - } - } else { //is proxy, then copy the pointer - data = other.data; - } - } - - /** - * Overload operator= - * @param other another ContiguousArrayND - * @return itself - */ - - ContiguousArrayND &operator=(const ContiguousArrayND &other) { -#ifdef MULTIARRAY_LIFE_CYCLE - cout< 0) { - - if(data!=nullptr) delete[] data; - data = new T[size]; - - for (size_t ind = 0; ind < size; ind++) - data[ind] = other.data[ind]; - } - } else { //is proxy, then copy the pointer - data = other.data; - } - } - return *this; - } - - - //TODO: make destructor virtual, check the destructors in inherited classes - - /** - * Destructor - */ - ~ContiguousArrayND() { -#ifdef MULTIARRAY_LIFE_CYCLE - cout<array_name = name; - } - - /** - * Get total number of elements in array (its size) - * @return array size - */ - size_t get_size() const { - return size; - } - - /** - * Fill array with value - * @param value value to fill - */ - void fill(T value) { - for (size_t ind = 0; ind < size; ind++) - data[ind] = value; - } - - /** - * Get array data at absolute index ind for reading - * @param ind absolute index - * @return array value - */ - inline const T &get_data(size_t ind) const { -#ifdef MULTIARRAY_INDICES_CHECK - if ((ind < 0) | (ind >= size)) { - printf("%s: get_data ind=%d out of range (0, %d)\n", array_name, ind, size); - exit(EXIT_FAILURE); - } -#endif - return data[ind]; - } - - /** - * Get array data at absolute index ind for writing - * @param ind absolute index - * @return array value - */ - inline T &get_data(size_t ind) { -#ifdef MULTIARRAY_INDICES_CHECK - if ((ind < 0) | (ind >= size)) { - printf("%s: get_data ind=%ld out of range (0, %ld)\n", array_name.c_str(), ind, size); - exit(EXIT_FAILURE); - } -#endif - return data[ind]; - } - - /** - * Get array data pointer - * @return data array pointer - */ - inline T* get_data() const { - return data; - } - - /** - * Overload comparison operator== - * Compare the total size and array values elementwise. - * - * @param other another array - * @return - */ - bool operator==(const ContiguousArrayND &other) const { - if (this->size != other.size) - return false; - - for (size_t i = 0; i < this->size; ++i) - if (this->data[i] != other.data[i]) - return false; - - return true; - } - - - /** - * Convert to flatten vector container - * @return vector container - */ - vector to_flatten_vector() const { - vector res; - - res.resize(size); - size_t vec_ind = 0; - - for (int vec_ind = 0; vec_ind < size; vec_ind++) - res.at(vec_ind) = data[vec_ind]; - - return res; - } // end to_flatten_vector() - - - /** - * Set values from flatten vector container - * @param vec container - */ - void set_flatten_vector(const vector &vec) { - if (vec.size() != size) - throw std::invalid_argument("Flatten vector size is not consistent with expected size"); - for (size_t i = 0; i < size; i++) { - data[i] = vec[i]; - } - } - - bool is_proxy(){ - return is_proxy_; - } - -}; - - -#endif //ACE_CONTIGUOUSARRAYND_H \ No newline at end of file diff --git a/lib/pace/ace_evaluator.cpp b/lib/pace/ace_evaluator.cpp deleted file mode 100644 index 987f4502bf..0000000000 --- a/lib/pace/ace_evaluator.cpp +++ /dev/null @@ -1,660 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 31.01.20. - -#include "ace_evaluator.h" - -#include "ace_abstract_basis.h" -#include "ace_types.h" - -void ACEEvaluator::init(ACEAbstractBasisSet *basis_set) { - A.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, "A"); - A_rank1.init(basis_set->nelements, basis_set->nradbase, "A_rank1"); - - rhos.init(basis_set->ndensitymax + 1, "rhos"); // +1 density for core repulsion - dF_drho.init(basis_set->ndensitymax + 1, "dF_drho"); // +1 density for core repulsion -} - -void ACEEvaluator::init_timers() { - loop_over_neighbour_timer.init(); - forces_calc_loop_timer.init(); - forces_calc_neighbour_timer.init(); - energy_calc_timer.init(); - per_atom_calc_timer.init(); - total_time_calc_timer.init(); -} - -//================================================================================================================ - -void ACECTildeEvaluator::set_basis(ACECTildeBasisSet &bas) { - basis_set = &bas; - init(basis_set); -} - -void ACECTildeEvaluator::init(ACECTildeBasisSet *basis_set) { - - ACEEvaluator::init(basis_set); - - - weights.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, - "weights"); - - weights_rank1.init(basis_set->nelements, basis_set->nradbase, "weights_rank1"); - - - DG_cache.init(1, basis_set->nradbase, "DG_cache"); - DG_cache.fill(0); - - R_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "R_cache"); - R_cache.fill(0); - - DR_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "DR_cache"); - DR_cache.fill(0); - - Y_cache.init(1, basis_set->lmax + 1, "Y_cache"); - Y_cache.fill({0, 0}); - - DY_cache.init(1, basis_set->lmax + 1, "dY_dense_cache"); - DY_cache.fill({0.}); - - //hard-core repulsion - DCR_cache.init(1, "DCR_cache"); - DCR_cache.fill(0); - dB_flatten.init(basis_set->max_dB_array_size, "dB_flatten"); - - -} - -void ACECTildeEvaluator::resize_neighbours_cache(int max_jnum) { - if(basis_set== nullptr) { - throw std::invalid_argument("ACECTildeEvaluator: basis set is not assigned"); - } - if (R_cache.get_dim(0) < max_jnum) { - - //TODO: implement grow - R_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); - R_cache.fill(0); - - DR_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); - DR_cache.fill(0); - - DG_cache.resize(max_jnum, basis_set->nradbase); - DG_cache.fill(0); - - Y_cache.resize(max_jnum, basis_set->lmax + 1); - Y_cache.fill({0, 0}); - - DY_cache.resize(max_jnum, basis_set->lmax + 1); - DY_cache.fill({0}); - - //hard-core repulsion - DCR_cache.init(max_jnum, "DCR_cache"); - DCR_cache.fill(0); - } -} - - - -// double** r - atomic coordinates of atom I -// int* types - atomic types if atom I -// int **firstneigh - ptr to 1st J int value of each I atom. Usage: jlist = firstneigh[i]; -// Usage: j = jlist_of_i[jj]; -// jnum - number of J neighbors for each I atom. jnum = numneigh[i]; - -void -ACECTildeEvaluator::compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) { - if(basis_set== nullptr) { - throw std::invalid_argument("ACECTildeEvaluator: basis set is not assigned"); - } - per_atom_calc_timer.start(); -#ifdef PRINT_MAIN_STEPS - printf("\n ATOM: ind = %d r_norm=(%f, %f, %f)\n",i, x[i][0], x[i][1], x[i][2]); -#endif - DOUBLE_TYPE evdwl = 0, evdwl_cut = 0, rho_core = 0; - DOUBLE_TYPE r_norm; - DOUBLE_TYPE xn, yn, zn, r_xyz; - DOUBLE_TYPE R, GR, DGR, R_over_r, DR, DCR; - DOUBLE_TYPE *r_hat; - - SPECIES_TYPE mu_j; - RANK_TYPE r, rank, t; - NS_TYPE n; - LS_TYPE l; - MS_TYPE m, m_t; - - SPECIES_TYPE *mus; - NS_TYPE *ns; - LS_TYPE *ls; - MS_TYPE *ms; - - int j, jj, func_ind, ms_ind; - SHORT_INT_TYPE factor; - - ACEComplex Y{0}, Y_DR{0.}; - ACEComplex B{0.}; - ACEComplex dB{0}; - ACEComplex A_cache[basis_set->rankmax]; - - dB_flatten.fill({0.}); - - ACEDYcomponent grad_phi_nlm{0}, DY{0.}; - - //size is +1 of max to avoid out-of-boundary array access in double-triangular scheme - ACEComplex A_forward_prod[basis_set->rankmax + 1]; - ACEComplex A_backward_prod[basis_set->rankmax + 1]; - - DOUBLE_TYPE inv_r_norm; - DOUBLE_TYPE r_norms[jnum]; - DOUBLE_TYPE inv_r_norms[jnum]; - DOUBLE_TYPE rhats[jnum][3];//normalized vector - SPECIES_TYPE elements[jnum]; - const DOUBLE_TYPE xtmp = x[i][0]; - const DOUBLE_TYPE ytmp = x[i][1]; - const DOUBLE_TYPE ztmp = x[i][2]; - DOUBLE_TYPE f_ji[3]; - - bool is_element_mapping = element_type_mapping.get_size() > 0; - SPECIES_TYPE mu_i; - if (is_element_mapping) - mu_i = element_type_mapping(type[i]); - else - mu_i = type[i]; - - const SHORT_INT_TYPE total_basis_size_rank1 = basis_set->total_basis_size_rank1[mu_i]; - const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; - - ACECTildeBasisFunction *basis_rank1 = basis_set->basis_rank1[mu_i]; - ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; - - DOUBLE_TYPE rho_cut, drho_cut, fcut, dfcut; - DOUBLE_TYPE dF_drho_core; - - //TODO: lmax -> lmaxi (get per-species type) - const LS_TYPE lmaxi = basis_set->lmax; - - //TODO: nradmax -> nradiali (get per-species type) - const NS_TYPE nradiali = basis_set->nradmax; - - //TODO: nradbase -> nradbasei (get per-species type) - const NS_TYPE nradbasei = basis_set->nradbase; - - //TODO: get per-species type number of densities - const DENSITY_TYPE ndensity= basis_set->ndensitymax; - - neighbours_forces.resize(jnum, 3); - neighbours_forces.fill(0); - - //TODO: shift nullifications to place where arrays are used - weights.fill({0}); - weights_rank1.fill(0); - A.fill({0}); - A_rank1.fill(0); - rhos.fill(0); - dF_drho.fill(0); - -#ifdef EXTRA_C_PROJECTIONS - basis_projections_rank1.init(total_basis_size_rank1, ndensity, "c_projections_rank1"); - basis_projections.init(total_basis_size, ndensity, "c_projections"); -#endif - - //proxy references to spherical harmonics and radial functions arrays - const Array2DLM &ylm = basis_set->spherical_harmonics.ylm; - const Array2DLM &dylm = basis_set->spherical_harmonics.dylm; - - const Array2D &fr = basis_set->radial_functions->fr; - const Array2D &dfr = basis_set->radial_functions->dfr; - - const Array1D &gr = basis_set->radial_functions->gr; - const Array1D &dgr = basis_set->radial_functions->dgr; - - loop_over_neighbour_timer.start(); - - int jj_actual = 0; - SPECIES_TYPE type_j = 0; - int neighbour_index_mapping[jnum]; // jj_actual -> jj - //loop over neighbours, compute distance, consider only atoms within with rradial_functions->cut(mu_i, mu_j); - r_xyz = sqrt(xn * xn + yn * yn + zn * zn); - - if (r_xyz >= current_cutoff) - continue; - - inv_r_norm = 1 / r_xyz; - - r_norms[jj_actual] = r_xyz; - inv_r_norms[jj_actual] = inv_r_norm; - rhats[jj_actual][0] = xn * inv_r_norm; - rhats[jj_actual][1] = yn * inv_r_norm; - rhats[jj_actual][2] = zn * inv_r_norm; - elements[jj_actual] = mu_j; - neighbour_index_mapping[jj_actual] = jj; - jj_actual++; - } - - int jnum_actual = jj_actual; - - //ALGORITHM 1: Atomic base A - for (jj = 0; jj < jnum_actual; ++jj) { - r_norm = r_norms[jj]; - mu_j = elements[jj]; - r_hat = rhats[jj]; - - //proxies - Array2DLM &Y_jj = Y_cache(jj); - Array2DLM &DY_jj = DY_cache(jj); - - - basis_set->radial_functions->evaluate(r_norm, basis_set->nradbase, nradiali, mu_i, mu_j); - basis_set->spherical_harmonics.compute_ylm(r_hat[0], r_hat[1], r_hat[2], lmaxi); - //loop for computing A's - //rank = 1 - for (n = 0; n < basis_set->nradbase; n++) { - GR = gr(n); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("-neigh atom %d\n", jj); - printf("gr(n=%d)(r=%f) = %f\n", n, r_norm, gr(n)); - printf("dgr(n=%d)(r=%f) = %f\n", n, r_norm, dgr(n)); -#endif - DG_cache(jj, n) = dgr(n); - A_rank1(mu_j, n) += GR * Y00; - } - //loop for computing A's - // for rank > 1 - for (n = 0; n < nradiali; n++) { - auto &A_lm = A(mu_j, n); - for (l = 0; l <= lmaxi; l++) { - R = fr(n, l); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("R(nl=%d,%d)(r=%f)=%f\n", n + 1, l, r_norm, R); -#endif - - DR_cache(jj, n, l) = dfr(n, l); - R_cache(jj, n, l) = R; - - for (m = 0; m <= l; m++) { - Y = ylm(l, m); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("Y(lm=%d,%d)=(%f, %f)\n", l, m, Y.real, Y.img); -#endif - A_lm(l, m) += R * Y; //accumulation sum over neighbours - Y_jj(l, m) = Y; - DY_jj(l, m) = dylm(l, m); - } - } - } - - //hard-core repulsion - rho_core += basis_set->radial_functions->cr; - DCR_cache(jj) = basis_set->radial_functions->dcr; - - } //end loop over neighbours - - //complex conjugate A's (for NEGATIVE (-m) terms) - // for rank > 1 - for (mu_j = 0; mu_j < basis_set->nelements; mu_j++) { - for (n = 0; n < nradiali; n++) { - auto &A_lm = A(mu_j, n); - for (l = 0; l <= lmaxi; l++) { - //fill in -m part in the outer loop using the same m <-> -m symmetry as for Ylm - for (m = 1; m <= l; m++) { - factor = m % 2 == 0 ? 1 : -1; - A_lm(l, -m) = A_lm(l, m).conjugated() * factor; - } - } - } - } //now A's are constructed - loop_over_neighbour_timer.stop(); - - // ==================== ENERGY ==================== - - energy_calc_timer.start(); -#ifdef EXTRA_C_PROJECTIONS - basis_projections_rank1.fill(0); - basis_projections.fill(0); -#endif - - //ALGORITHM 2: Basis functions B with iterative product and density rho(p) calculation - //rank=1 - for (int func_rank1_ind = 0; func_rank1_ind < total_basis_size_rank1; ++func_rank1_ind) { - ACECTildeBasisFunction *func = &basis_rank1[func_rank1_ind]; -// ndensity = func->ndensity; -#ifdef PRINT_LOOPS_INDICES - printf("Num density = %d r = 0\n",(int) ndensity ); - print_C_tilde_B_basis_function(*func); -#endif - double A_cur = A_rank1(func->mus[0], func->ns[0] - 1); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("A_r=1(x=%d, n=%d)=(%f)\n", func->mus[0], func->ns[0], A_cur); - printf(" coeff[0] = %f\n", func->ctildes[0]); -#endif - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 - rhos(p) += func->ctildes[p] * A_cur; -#ifdef EXTRA_C_PROJECTIONS - //aggregate C-projections separately - basis_projections_rank1(func_rank1_ind, p)+= func->ctildes[p] * A_cur; -#endif - } - } // end loop for rank=1 - - //rank>1 - int func_ms_ind = 0; - int func_ms_t_ind = 0;// index for dB - - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; - //TODO: check if func->ctildes are zero, then skip -// ndensity = func->ndensity; - rank = func->rank; - r = rank - 1; -#ifdef PRINT_LOOPS_INDICES - printf("Num density = %d r = %d\n",(int) ndensity, (int)r ); - print_C_tilde_B_basis_function(*func); -#endif - mus = func->mus; - ns = func->ns; - ls = func->ls; - - //loop over {ms} combinations in sum - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * rank]; // current ms-combination (of length = rank) - - //loop over m, collect B = product of A with given ms - A_forward_prod[0] = 1; - A_backward_prod[r] = 1; - - //fill forward A-product triangle - for (t = 0; t < rank; t++) { - //TODO: optimize ns[t]-1 -> ns[t] during functions construction - A_cache[t] = A(mus[t], ns[t] - 1, ls[t], ms[t]); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("A(x=%d, n=%d, l=%d, m=%d)=(%f,%f)\n", mus[t], ns[t], ls[t], ms[t], A_cache[t].real, - A_cache[t].img); -#endif - A_forward_prod[t + 1] = A_forward_prod[t] * A_cache[t]; - } - - B = A_forward_prod[t]; - -#ifdef DEBUG_FORCES_CALCULATIONS - printf("B = (%f, %f)\n", (B).real, (B).img); -#endif - //fill backward A-product triangle - for (t = r; t >= 1; t--) { - A_backward_prod[t - 1] = - A_backward_prod[t] * A_cache[t]; - } - - for (t = 0; t < rank; ++t, ++func_ms_t_ind) { - dB = A_forward_prod[t] * A_backward_prod[t]; //dB - product of all A's except t-th - dB_flatten(func_ms_t_ind) = dB; -#ifdef DEBUG_FORCES_CALCULATIONS - m_t = ms[t]; - printf("dB(n,l,m)(%d,%d,%d) = (%f, %f)\n", ns[t], ls[t], m_t, (dB).real, (dB).img); -#endif - } - - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - //real-part only multiplication - rhos(p) += B.real_part_product(func->ctildes[ms_ind * ndensity + p]); - -#ifdef EXTRA_C_PROJECTIONS - //aggregate C-projections separately - basis_projections(func_ind, p)+=B.real_part_product(func->ctildes[ms_ind * ndensity + p]); -#endif - -#ifdef PRINT_INTERMEDIATE_VALUES - printf("rhos(%d) += %f\n", p, B.real_part_product(func->ctildes[ms_ind * ndensity + p])); - printf("Rho[i = %d][p = %d] = %f\n", i , p , rhos(p)); -#endif - } - }//end of loop over {ms} combinations in sum - }// end loop for rank>1 - -#ifdef DEBUG_FORCES_CALCULATIONS - printf("rhos = "); - for(DENSITY_TYPE p =0; prho_core_cutoffs(mu_i); - drho_cut = basis_set->drho_core_cutoffs(mu_i); - - basis_set->inner_cutoff(rho_core, rho_cut, drho_cut, fcut, dfcut); - basis_set->FS_values_and_derivatives(rhos, evdwl, dF_drho, ndensity); - - dF_drho_core = evdwl * dfcut + 1; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) - dF_drho(p) *= fcut; - evdwl_cut = evdwl * fcut + rho_core; - - // E0 shift - evdwl_cut += basis_set->E0vals(mu_i); - -#ifdef DEBUG_FORCES_CALCULATIONS - printf("dFrhos = "); - for(DENSITY_TYPE p =0; pndensity; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 - weights_rank1(func->mus[0], func->ns[0] - 1) += dF_drho(p) * func->ctildes[p]; - } - } - - // rank>1 - func_ms_ind = 0; - func_ms_t_ind = 0;// index for dB - DOUBLE_TYPE theta = 0; - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; -// ndensity = func->ndensity; - rank = func->rank; - mus = func->mus; - ns = func->ns; - ls = func->ls; - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * rank]; - theta = 0; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - theta += dF_drho(p) * func->ctildes[ms_ind * ndensity + p]; -#ifdef DEBUG_FORCES_CALCULATIONS - printf("(p=%d) theta += dF_drho[p] * func.ctildes[ms_ind * ndensity + p] = %f * %f = %f\n",p, dF_drho(p), func->ctildes[ms_ind * ndensity + p],dF_drho(p)*func->ctildes[ms_ind * ndensity + p]); - printf("theta=%f\n",theta); -#endif - } - - theta *= 0.5; // 0.5 factor due to possible double counting ??? - for (t = 0; t < rank; ++t, ++func_ms_t_ind) { - m_t = ms[t]; - factor = (m_t % 2 == 0 ? 1 : -1); - dB = dB_flatten(func_ms_t_ind); - weights(mus[t], ns[t] - 1, ls[t], m_t) += theta * dB; //Theta_array(func_ms_ind); - // update -m_t (that could also be positive), because the basis is half_basis - weights(mus[t], ns[t] - 1, ls[t], -m_t) += - theta * (dB).conjugated() * factor;// Theta_array(func_ms_ind); -#ifdef DEBUG_FORCES_CALCULATIONS - printf("dB(n,l,m)(%d,%d,%d) = (%f, %f)\n", ns[t], ls[t], m_t, (dB).real, (dB).img); - printf("theta = %f\n",theta); - printf("weights(n,l,m)(%d,%d,%d) += (%f, %f)\n", ns[t], ls[t], m_t, (theta * dB * 0.5).real, - (theta * dB * 0.5).img); - printf("weights(n,l,-m)(%d,%d,%d) += (%f, %f)\n", ns[t], ls[t], -m_t, - ( theta * (dB).conjugated() * factor * 0.5).real, - ( theta * (dB).conjugated() * factor * 0.5).img); -#endif - } - } - } - energy_calc_timer.stop(); - -// ==================== FORCES ==================== -#ifdef PRINT_MAIN_STEPS - printf("\nFORCE CALCULATION\n"); - printf("loop over neighbours\n"); -#endif - - forces_calc_loop_timer.start(); -// loop over neighbour atoms for force calculations - for (jj = 0; jj < jnum_actual; ++jj) { - mu_j = elements[jj]; - r_hat = rhats[jj]; - inv_r_norm = inv_r_norms[jj]; - - Array2DLM &Y_cache_jj = Y_cache(jj); - Array2DLM &DY_cache_jj = DY_cache(jj); - -#ifdef PRINT_LOOPS_INDICES - printf("\nneighbour atom #%d\n", jj); - printf("rhat = (%f, %f, %f)\n", r_hat[0], r_hat[1], r_hat[2]); -#endif - - forces_calc_neighbour_timer.start(); - - f_ji[0] = f_ji[1] = f_ji[2] = 0; - -//for rank = 1 - for (n = 0; n < nradbasei; ++n) { - if (weights_rank1(mu_j, n) == 0) - continue; - auto &DG = DG_cache(jj, n); - DGR = DG * Y00; - DGR *= weights_rank1(mu_j, n); -#ifdef DEBUG_FORCES_CALCULATIONS - printf("r=1: (n,l,m)=(%d, 0, 0)\n",n+1); - printf("\tGR(n=%d, r=%f)=%f\n",n+1,r_norm, gr(n)); - printf("\tDGR(n=%d, r=%f)=%f\n",n+1,r_norm, dgr(n)); - printf("\tdF+=(%f, %f, %f)\n",DGR * r_hat[0], DGR * r_hat[1], DGR * r_hat[2]); -#endif - f_ji[0] += DGR * r_hat[0]; - f_ji[1] += DGR * r_hat[1]; - f_ji[2] += DGR * r_hat[2]; - } - -//for rank > 1 - for (n = 0; n < nradiali; n++) { - for (l = 0; l <= lmaxi; l++) { - R_over_r = R_cache(jj, n, l) * inv_r_norm; - DR = DR_cache(jj, n, l); - - // for m>=0 - for (m = 0; m <= l; m++) { - ACEComplex w = weights(mu_j, n, l, m); - if (w == 0) - continue; - //counting for -m cases if m>0 - if (m > 0) w *= 2; - - DY = DY_cache_jj(l, m); - Y_DR = Y_cache_jj(l, m) * DR; - - grad_phi_nlm.a[0] = Y_DR * r_hat[0] + DY.a[0] * R_over_r; - grad_phi_nlm.a[1] = Y_DR * r_hat[1] + DY.a[1] * R_over_r; - grad_phi_nlm.a[2] = Y_DR * r_hat[2] + DY.a[2] * R_over_r; -#ifdef DEBUG_FORCES_CALCULATIONS - printf("d_phi(n=%d, l=%d, m=%d) = ((%f,%f), (%f,%f), (%f,%f))\n",n+1,l,m, - grad_phi_nlm.a[0].real, grad_phi_nlm.a[0].img, - grad_phi_nlm.a[1].real, grad_phi_nlm.a[1].img, - grad_phi_nlm.a[2].real, grad_phi_nlm.a[2].img); - - printf("weights(n,l,m)(%d,%d,%d) = (%f,%f)\n", n+1, l, m,w.real, w.img); - //if (m>0) w*=2; - printf("dF(n,l,m)(%d, %d, %d) += (%f, %f, %f)\n", n + 1, l, m, - w.real_part_product(grad_phi_nlm.a[0]), - w.real_part_product(grad_phi_nlm.a[1]), - w.real_part_product(grad_phi_nlm.a[2]) - ); -#endif -// real-part multiplication only - f_ji[0] += w.real_part_product(grad_phi_nlm.a[0]); - f_ji[1] += w.real_part_product(grad_phi_nlm.a[1]); - f_ji[2] += w.real_part_product(grad_phi_nlm.a[2]); - } - } - } - - -#ifdef PRINT_INTERMEDIATE_VALUES - printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, - f_ji[0], f_ji[1], f_ji[2] - ); -#endif - - //hard-core repulsion - DCR = DCR_cache(jj); -#ifdef DEBUG_FORCES_CALCULATIONS - printf("DCR = %f\n",DCR); -#endif - f_ji[0] += dF_drho_core * DCR * r_hat[0]; - f_ji[1] += dF_drho_core * DCR * r_hat[1]; - f_ji[2] += dF_drho_core * DCR * r_hat[2]; -#ifdef PRINT_INTERMEDIATE_VALUES - printf("with core-repulsion\n"); - printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, - f_ji[0], f_ji[1], f_ji[2] - ); - printf("neighbour_index_mapping[jj=%d]=%d\n",jj,neighbour_index_mapping[jj]); -#endif - - neighbours_forces(neighbour_index_mapping[jj], 0) = f_ji[0]; - neighbours_forces(neighbour_index_mapping[jj], 1) = f_ji[1]; - neighbours_forces(neighbour_index_mapping[jj], 2) = f_ji[2]; - - forces_calc_neighbour_timer.stop(); - }// end loop over neighbour atoms for forces - - forces_calc_loop_timer.stop(); - - //now, energies and forces are ready - //energies(i) = evdwl + rho_core; - e_atom = evdwl_cut; - -#ifdef PRINT_INTERMEDIATE_VALUES - printf("energies(i) = FS(...rho_p_accum...) = %f\n", evdwl); -#endif - per_atom_calc_timer.stop(); -} \ No newline at end of file diff --git a/lib/pace/ace_evaluator.h b/lib/pace/ace_evaluator.h deleted file mode 100644 index 356ea52563..0000000000 --- a/lib/pace/ace_evaluator.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Yury Lysogorskiy on 31.01.20. - -#ifndef ACE_EVALUATOR_H -#define ACE_EVALUATOR_H - -#include "ace_abstract_basis.h" -#include "ace_arraynd.h" -#include "ace_array2dlm.h" -#include "ace_c_basis.h" -#include "ace_complex.h" -#include "ace_timing.h" -#include "ace_types.h" - -/** - * Basic evaluator class, that should accept the basis set and implement the "compute_atom" method using given basis set. - */ -class ACEEvaluator { -protected: - - Array2D A_rank1 = Array2D("A_rank1"); ///< 2D-array for storing A's for rank=1, shape: A(mu_j,n) - Array4DLM A = Array4DLM("A"); ///< 4D array with (l,m) last indices for storing A's for rank>1: A(mu_j, n, l, m) - - Array1D rhos = Array1D("rhos"); ///< densities \f$ \rho^{(p)} \f$(ndensity), p = 0 .. ndensity-1 - Array1D dF_drho = Array1D("dF_drho"); ///< derivatives of cluster functional wrt. densities, index = 0 .. ndensity-1 - - /** - * Initialize internal arrays according to basis set sizes - * @param basis_set - */ - void init(ACEAbstractBasisSet *basis_set); - -public: - // set of timers for code profiling - - ACETimer loop_over_neighbour_timer; ///< timer for loop over neighbours when constructing A's for single central atom - ACETimer per_atom_calc_timer; ///< timer for single compute_atom call - - - ACETimer forces_calc_loop_timer; ///< timer for forces calculations for single central atom - ACETimer forces_calc_neighbour_timer; ///< timer for loop over neighbour atoms for force calculations - - ACETimer energy_calc_timer; ///< timer for energy calculation - ACETimer total_time_calc_timer; ///< timer for total calculations of all atoms within given atomic environment system - - /** - * Initialize all timers - */ - void init_timers(); - - /** - * Mapping from external atoms types, i.e. LAMMPS, to internal SPECIES_TYPE, used in basis functions - */ - Array1D element_type_mapping = Array1D("element_type_mapping"); - - - DOUBLE_TYPE e_atom = 0; ///< energy of current atom, including core-repulsion - - /** - * temporary array for the pair forces between current atom_i and its neighbours atom_k - * neighbours_forces(k,3), k = 0..num_of_neighbours(atom_i)-1 - */ - Array2D neighbours_forces = Array2D("neighbours_forces"); - - ACEEvaluator() = default; - - virtual ~ACEEvaluator() = default; - - /** - * The key method to compute energy and forces for atom 'i'. - * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array - * - * @param i atom index - * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] - * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] - * @param jnum number of neighbours of atom_i - * @param jlist array of neighbour indices, shape: [jnum] - */ - virtual void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) = 0; - - /** - * Resize all caches over neighbours atoms - * @param max_jnum maximum number of neighbours - */ - virtual void resize_neighbours_cache(int max_jnum) = 0; - -#ifdef EXTRA_C_PROJECTIONS - /** - * 2D array to store projections of basis function for rank = 1, shape: [func_ind][ndensity] - */ - Array2D basis_projections_rank1 = Array2D("basis_projections_rank1"); - - /** - * 2D array to store projections of basis function for rank > 1, shape: [func_ind][ndensity] - */ - Array2D basis_projections = Array2D("basis_projections"); -#endif -}; - -//TODO: split into separate file -/** - * Evaluator for C-tilde basis set, that should accept the basis set and implement the "compute_atom" method using given basis set. - */ -class ACECTildeEvaluator : public ACEEvaluator { - - /** - * Weights \f$ \omega_{i \mu n 0 0} \f$ for rank = 1, see Eq.(10) from implementation notes, - * 'i' is fixed for the current atom, shape: [nelements][nradbase] - */ - Array2D weights_rank1 = Array2D("weights_rank1"); - - /** - * Weights \f$ \omega_{i \mu n l m} \f$ for rank > 1, see Eq.(10) from implementation notes, - * 'i' is fixed for the current atom, shape: [nelements][nradbase][l=0..lmax, m] - */ - Array4DLM weights = Array4DLM("weights"); - - /** - * cache for gradients of \f$ g(r)\f$: grad_phi(jj,n)=A2DLM(l,m) - * shape:[max_jnum][nradbase] - */ - Array2D DG_cache = Array2D("DG_cache"); - - - /** - * cache for \f$ R_{nl}(r)\f$ - * shape:[max_jnum][nradbase][0..lmax] - */ - Array3D R_cache = Array3D("R_cache"); - /** - * cache for derivatives of \f$ R_{nl}(r)\f$ - * shape:[max_jnum][nradbase][0..lmax] - */ - Array3D DR_cache = Array3D("DR_cache"); - /** - * cache for \f$ Y_{lm}(\hat{r})\f$ - * shape:[max_jnum][0..lmax][m] - */ - Array3DLM Y_cache = Array3DLM("Y_cache"); - /** - * cache for \f$ \nabla Y_{lm}(\hat{r})\f$ - * shape:[max_jnum][0..lmax][m] - */ - Array3DLM DY_cache = Array3DLM("dY_dense_cache"); - - /** - * cache for derivatives of hard-core repulsion - * shape:[max_jnum] - */ - Array1D DCR_cache = Array1D("DCR_cache"); - - /** - * Partial derivatives \f$ dB_{i \mu n l m t}^{(r)} \f$ with sequential numbering over [func_ind][ms_ind][r], - * shape:[func_ms_r_ind] - */ - Array1D dB_flatten = Array1D("dB_flatten"); - - /** - * pointer to the ACEBasisSet object - */ - ACECTildeBasisSet *basis_set = nullptr; - - /** - * Initialize internal arrays according to basis set sizes - * @param basis_set - */ - void init(ACECTildeBasisSet *basis_set); - -public: - - ACECTildeEvaluator() = default; - - explicit ACECTildeEvaluator(ACECTildeBasisSet &bas) { - set_basis(bas); - } - - /** - * set the basis function to the ACE evaluator - * @param bas - */ - void set_basis(ACECTildeBasisSet &bas); - - /** - * The key method to compute energy and forces for atom 'i'. - * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array - * - * @param i atom index - * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] - * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] - * @param jnum number of neighbours of atom_i - * @param jlist array of neighbour indices, shape: [jnum] - */ - void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) override; - - /** - * Resize all caches over neighbours atoms - * @param max_jnum maximum number of neighbours - */ - void resize_neighbours_cache(int max_jnum) override; -}; - - -#endif //ACE_EVALUATOR_H \ No newline at end of file diff --git a/lib/pace/ace_flatten_basis.cpp b/lib/pace/ace_flatten_basis.cpp deleted file mode 100644 index 541785a202..0000000000 --- a/lib/pace/ace_flatten_basis.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by yury on 28.04.2020. - -#include "ace_flatten_basis.h" - -ACEFlattenBasisSet::ACEFlattenBasisSet(const ACEFlattenBasisSet &other) { - _copy_scalar_memory(other); - _copy_dynamic_memory(other); -} - -ACEFlattenBasisSet &ACEFlattenBasisSet::operator=(const ACEFlattenBasisSet &other) { - if (this != &other) { - _clean(); - _copy_scalar_memory(other); - _copy_dynamic_memory(other); - } - return *this; -} - - -ACEFlattenBasisSet::~ACEFlattenBasisSet() { - ACEFlattenBasisSet::_clean(); -} - -void ACEFlattenBasisSet::_clean() { - //chained call of base class method - ACEAbstractBasisSet::_clean(); - _clean_contiguous_arrays(); - _clean_basissize_arrays(); - -} - -void ACEFlattenBasisSet::_clean_basissize_arrays() { - delete[] total_basis_size; - total_basis_size = nullptr; - - delete[] total_basis_size_rank1; - total_basis_size_rank1 = nullptr; -} - -void ACEFlattenBasisSet::_clean_contiguous_arrays() { - delete[] full_ns_rank1; - full_ns_rank1 = nullptr; - - delete[] full_ls_rank1; - full_ls_rank1 = nullptr; - - delete[] full_mus_rank1; - full_mus_rank1 = nullptr; - - delete[] full_ms_rank1; - full_ms_rank1 = nullptr; - - ////// - - delete[] full_ns; - full_ns = nullptr; - - delete[] full_ls; - full_ls = nullptr; - - delete[] full_mus; - full_mus = nullptr; - - delete[] full_ms; - full_ms = nullptr; -} - -void ACEFlattenBasisSet::_copy_scalar_memory(const ACEFlattenBasisSet &src) { - ACEAbstractBasisSet::_copy_scalar_memory(src); - - rank_array_total_size_rank1 = src.rank_array_total_size_rank1; - coeff_array_total_size_rank1 = src.coeff_array_total_size_rank1; - rank_array_total_size = src.rank_array_total_size; - ms_array_total_size = src.ms_array_total_size; - coeff_array_total_size = src.coeff_array_total_size; - - max_B_array_size = src.max_B_array_size; - max_dB_array_size = src.max_dB_array_size; - num_ms_combinations_max = src.num_ms_combinations_max; -} - -void ACEFlattenBasisSet::_copy_dynamic_memory(const ACEFlattenBasisSet &src) { //allocate new memory - - ACEAbstractBasisSet::_copy_dynamic_memory(src); - - if (src.total_basis_size_rank1 == nullptr) - throw runtime_error("Could not copy ACEFlattenBasisSet::total_basis_size_rank1 - array not initialized"); - if (src.total_basis_size == nullptr) - throw runtime_error("Could not copy ACEFlattenBasisSet::total_basis_size - array not initialized"); - - delete[] total_basis_size_rank1; - total_basis_size_rank1 = new SHORT_INT_TYPE[nelements]; - delete[] total_basis_size; - total_basis_size = new SHORT_INT_TYPE[nelements]; - - //copy - for (SPECIES_TYPE mu = 0; mu < nelements; ++mu) { - total_basis_size_rank1[mu] = src.total_basis_size_rank1[mu]; - total_basis_size[mu] = src.total_basis_size[mu]; - } -} - diff --git a/lib/pace/ace_flatten_basis.h b/lib/pace/ace_flatten_basis.h deleted file mode 100644 index e21cbb749a..0000000000 --- a/lib/pace/ace_flatten_basis.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Lysogroskiy Yury on 28.04.2020. - -#ifndef ACE_EVALUATOR_ACE_FLATTEN_BASIS_H -#define ACE_EVALUATOR_ACE_FLATTEN_BASIS_H - - -#include "ace_abstract_basis.h" -#include "ace_c_basisfunction.h" -#include "ace_radial.h" -#include "ace_spherical_cart.h" -#include "ace_types.h" - -/** - * Basis set with basis function attributes, i.e. \f$ \mathbf{n}, \mathbf{l}, \mathbf{m}\f$, etc. - * packed into contiguous arrays for the cache-friendly memory layout. - */ -class ACEFlattenBasisSet : public ACEAbstractBasisSet { -public: - //arrays and its sizes for rank = 1 basis functions for packed basis - - size_t rank_array_total_size_rank1 = 0; ///< size for full_ns_rank1, full_ls_rank1, full_Xs_rank1 - size_t coeff_array_total_size_rank1 = 0; ///< size for full coefficients array (depends on B or C-Tilde basis) - - NS_TYPE *full_ns_rank1 = nullptr; ///< ns contiguous package [rank_array_total_size_rank1] - LS_TYPE *full_ls_rank1 = nullptr; ///< ls contiguous package [rank_array_total_size_rank1] - SPECIES_TYPE *full_mus_rank1 = nullptr; ///< mus contiguous package [rank_array_total_size_rank1] - MS_TYPE *full_ms_rank1 = nullptr; ///< m_s contiguous package[rank_array_total_size_rank1] - - //arrays and its sizes for rank > 1 basis functions for packed basis - size_t rank_array_total_size = 0; ///< size for full_ns, full_ls, full_Xs - size_t ms_array_total_size = 0; ///< size for full_ms array - size_t coeff_array_total_size = 0;///< size for full coefficients arrays (depends on B- or C- basis) - - NS_TYPE *full_ns = nullptr; ///< ns contiguous package [rank_array_total_size] - LS_TYPE *full_ls = nullptr; ///< ls contiguous package [rank_array_total_size] - SPECIES_TYPE *full_mus = nullptr; ///< mus contiguous package [rank_array_total_size] - MS_TYPE *full_ms = nullptr; ///< //m_s contiguous package [ms_array_total_size] - - /** - * Rearrange basis functions in contiguous memory to optimize cache access - */ - virtual void pack_flatten_basis() = 0; - - virtual void flatten_basis() = 0; - - //1D flat array basis representation: [mu] - SHORT_INT_TYPE *total_basis_size_rank1 = nullptr; ///< per-species type array of total_basis_rank1[mu] sizes - SHORT_INT_TYPE *total_basis_size = nullptr; ///< per-species type array of total_basis[mu] sizes - - size_t max_B_array_size = 0; ///< maximum over elements array size for B[func_ind][ms_ind] - size_t max_dB_array_size = 0; ///< maximum over elements array size for dB[func_ind][ms_ind][r] - - SHORT_INT_TYPE num_ms_combinations_max = 0; ///< maximum number of ms combinations among all basis functions - - /** - * Default constructor - */ - ACEFlattenBasisSet() = default; - - /** - * Copy constructor (see Rule of Three) - * @param other - */ - ACEFlattenBasisSet(const ACEFlattenBasisSet &other); - - /** - * operator= (see Rule of Three) - * @param other - * @return - */ - ACEFlattenBasisSet &operator=(const ACEFlattenBasisSet &other); - - /** - * Destructor (see Rule of Three) - */ - ~ACEFlattenBasisSet() override; - - // routines for copying and cleaning dynamic memory of the class (see Rule of Three) - /** - * Cleaning dynamic memory of the class (see. Rule of Three), - * must be idempotent for safety - */ - void _clean() override; - - /** - * Copying scalar variables - * @param src - */ - void _copy_scalar_memory(const ACEFlattenBasisSet &src); - - /** - * Copying and cleaning dynamic memory of the class (see. Rule of Three) - * @param src - */ - void _copy_dynamic_memory(const ACEFlattenBasisSet &src); - - /** - * Clean contiguous arrays - */ - virtual void _clean_contiguous_arrays(); - - /** - * Release dynamic arrays with basis set sizes - */ - void _clean_basissize_arrays(); -}; - -#endif //ACE_EVALUATOR_ACE_FLATTEN_BASIS_H diff --git a/lib/pace/ace_radial.cpp b/lib/pace/ace_radial.cpp deleted file mode 100644 index 01348a719c..0000000000 --- a/lib/pace/ace_radial.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#include -#include -#include - -#include "ace_radial.h" - -const DOUBLE_TYPE pi = 3.14159265358979323846264338327950288419; // pi - -ACERadialFunctions::ACERadialFunctions(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, - SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, string radbasename) { - init(nradb, lmax, nradial, deltaSplineBins, nelements, cutoff, radbasename); -} - -void ACERadialFunctions::init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, - SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, string radbasename) { - this->nradbase = nradb; - this->lmax = lmax; - this->nradial = nradial; - this->deltaSplineBins = deltaSplineBins; - this->nelements = nelements; - this->cutoff = cutoff; - this->radbasename = radbasename; - - gr.init(nradbase, "gr"); - dgr.init(nradbase, "dgr"); - d2gr.init(nradbase, "d2gr"); - - - fr.init(nradial, lmax + 1, "fr"); - dfr.init(nradial, lmax + 1, "dfr"); - d2fr.init(nradial, lmax + 1, "d2fr"); - - - cheb.init(nradbase + 1, "cheb"); - dcheb.init(nradbase + 1, "dcheb"); - cheb2.init(nradbase + 1, "cheb2"); - - - splines_gk.init(nelements, nelements, "splines_gk"); - splines_rnl.init(nelements, nelements, "splines_rnl"); - splines_hc.init(nelements, nelements, "splines_hc"); - - lambda.init(nelements, nelements, "lambda"); - lambda.fill(1.); - - cut.init(nelements, nelements, "cut"); - cut.fill(1.); - - dcut.init(nelements, nelements, "dcut"); - dcut.fill(1.); - - crad.init(nelements, nelements, nradial, (lmax + 1), nradbase, "crad"); - crad.fill(0.); - - //hard-core repulsion - prehc.init(nelements, nelements, "prehc"); - prehc.fill(0.); - - lambdahc.init(nelements, nelements, "lambdahc"); - lambdahc.fill(1.); - -} - - -/** -Function that computes Chebyshev polynomials of first and second kind - to setup the radial functions and the derivatives - -@param n, x - -@returns cheb1, dcheb1 -*/ -void ACERadialFunctions::calcCheb(NS_TYPE n, DOUBLE_TYPE x) { - if (n < 0) { - char s[1024]; - sprintf(s, "The order n of the polynomials should be positive %d\n", n); - throw std::invalid_argument(s); - } - DOUBLE_TYPE twox = 2.0 * x; - cheb(0) = 1.; - dcheb(0) = 0.; - cheb2(0) = 1.; - - if (nradbase > 1) { - cheb(1) = x; - cheb2(1) = twox; - } - for (NS_TYPE m = 1; m <= n - 1; m++) { - cheb(m + 1) = twox * cheb(m) - cheb(m - 1); - cheb2(m + 1) = twox * cheb2(m) - cheb2(m - 1); - } - for (NS_TYPE m = 1; m <= n; m++) { - dcheb(m) = m * cheb2(m - 1); - } -#ifdef DEBUG_RADIAL - for ( NS_TYPE m=0; m<=n; m++ ) { - printf(" m %d cheb %f dcheb %f \n", m, cheb(m), dcheb(m)); - } -#endif -} - -/** -Function that computes radial basis. - -@param lam, nradbase, cut, dcut, r - -@returns gr, dgr -*/ -void ACERadialFunctions::radbase(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { - /*lam is given by the formula (24), that contains cut */ - - if (r < cut) { - if (radbasename == "ChebExpCos") { - chebExpCos(lam, cut, dcut, r); - } else if (radbasename == "ChebPow") { - chebPow(lam, cut, dcut, r); - } else if (radbasename == "ChebLinear") { - chebLinear(lam, cut, dcut, r); - } else { - throw invalid_argument("Unknown radial basis function name: " + radbasename); - } - } else { - gr.fill(0); - dgr.fill(0); - } -} - -/*** - * Radial function: ChebExpCos, cheb exp scaling including cos envelope - * @param lam function parameter - * @param cut cutoff distance - * @param r function input argument - * @return fills in gr and dgr arrays - */ -void -ACERadialFunctions::chebExpCos(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { - DOUBLE_TYPE y2, y1, x, dx; - DOUBLE_TYPE env, denv, fcut, dfcut; - /* scaled distance x and derivative*/ - y1 = exp(-lam * r / cut); - y2 = exp(-lam); - x = 1.0 - 2.0 * ((y1 - y2) / (1 - y2)); - dx = 2 * (lam / cut) * (y1 / (1 - y2)); - /* calculation of Chebyshev polynomials from the recursion */ - calcCheb(nradbase - 1, x); - gr(0) = cheb(0); - dgr(0) = dcheb(0) * dx; - for (NS_TYPE n = 2; n <= nradbase; n++) { - gr(n - 1) = 0.5 - 0.5 * cheb(n - 1); - dgr(n - 1) = -0.5 * dcheb(n - 1) * dx; - } - env = 0.5 * (1.0 + cos(M_PI * r / cut)); - denv = -0.5 * sin(M_PI * r / cut) * M_PI / cut; - for (NS_TYPE n = 0; n < nradbase; n++) { - dgr(n) = gr(n) * denv + dgr(n) * env; - gr(n) = gr(n) * env; - } - // for radtype = 3 a smooth cut is already included in the basis function - dx = cut - dcut; - if (r > dx) { - fcut = 0.5 * (1.0 + cos(M_PI * (r - dx) / dcut)); - dfcut = -0.5 * sin(M_PI * (r - dx) / dcut) * M_PI / dcut; - for (NS_TYPE n = 0; n < nradbase; n++) { - dgr(n) = gr(n) * dfcut + dgr(n) * fcut; - gr(n) = gr(n) * fcut; - } - } -} - -/*** -* Radial function: ChebPow, Radial function: ChebPow -* - argument of Chebyshev polynomials -* x = 2.0*( 1.0 - (1.0 - r/rcut)^lam ) - 1.0 -* - radial function -* gr(n) = ( 1.0 - Cheb(n) )/2.0, n = 1,...,nradbase -* - the function fulfills: -* gr(n) = 0 at rcut -* dgr(n) = 0 at rcut for lam >= 1 -* second derivative zero at rcut for lam >= 2 -* -> the radial function does not require a separate cutoff function -* - corresponds to radial basis radtype=5 in Fortran code -* -* @param lam function parameter -* @param cut cutoff distance -* @param r function input argument -* @return fills in gr and dgr arrays -*/ -void -ACERadialFunctions::chebPow(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { - DOUBLE_TYPE y, dy, x, dx; - /* scaled distance x and derivative*/ - y = (1.0 - r / cut); - dy = pow(y, (lam - 1.0)); - y = dy * y; - dy = -lam / cut * dy; - - x = 2.0 * (1.0 - y) - 1.0; - dx = -2.0 * dy; - calcCheb(nradbase, x); - for (NS_TYPE n = 1; n <= nradbase; n++) { - gr(n - 1) = 0.5 - 0.5 * cheb(n); - dgr(n - 1) = -0.5 * dcheb(n) * dx; - } -} - - -void -ACERadialFunctions::chebLinear(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r) { - DOUBLE_TYPE x, dx; - /* scaled distance x and derivative*/ - x = (1.0 - r / cut); - dx = -1 / cut; - calcCheb(nradbase, x); - for (NS_TYPE n = 1; n <= nradbase; n++) { - gr(n - 1) = 0.5 - 0.5 * cheb(n); - dgr(n - 1) = -0.5 * dcheb(n) * dx; - } -} - -/** -Function that computes radial functions. - -@param nradbase, nelements, elei, elej - -@returns fr, dfr -*/ -void ACERadialFunctions::radfunc(SPECIES_TYPE elei, SPECIES_TYPE elej) { - DOUBLE_TYPE frval, dfrval; - for (NS_TYPE n = 0; n < nradial; n++) { - for (LS_TYPE l = 0; l <= lmax; l++) { - frval = 0.0; - dfrval = 0.0; - for (NS_TYPE k = 0; k < nradbase; k++) { - frval += crad(elei, elej, n, l, k) * gr(k); - dfrval += crad(elei, elej, n, l, k) * dgr(k); - } - fr(n, l) = frval; - dfr(n, l) = dfrval; - } - } -} - - -void ACERadialFunctions::all_radfunc(SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, DOUBLE_TYPE r) { - DOUBLE_TYPE lam = lambda(mu_i, mu_j); - DOUBLE_TYPE r_cut = cut(mu_i, mu_j); - DOUBLE_TYPE dr_cut = dcut(mu_i, mu_j); - // set up radial functions - radbase(lam, r_cut, dr_cut, r); //update gr, dgr - radfunc(mu_i, mu_j); // update fr(nr, l), dfr(nr, l) -} - - -void ACERadialFunctions::setuplookupRadspline() { - using namespace std::placeholders; - DOUBLE_TYPE lam, r_cut, dr_cut; - DOUBLE_TYPE cr_c, dcr_c, pre, lamhc; - - // at r = rcut + eps the function and its derivatives is zero - for (SPECIES_TYPE elei = 0; elei < nelements; elei++) { - for (SPECIES_TYPE elej = 0; elej < nelements; elej++) { - - lam = lambda(elei, elej); - r_cut = cut(elei, elej); - dr_cut = dcut(elei, elej); - - splines_gk(elei, elej).setupSplines(gr.get_size(), - std::bind(&ACERadialFunctions::radbase, this, lam, r_cut, dr_cut, - _1),//update gr, dgr - gr.get_data(), - dgr.get_data(), deltaSplineBins, cutoff); - - splines_rnl(elei, elej).setupSplines(fr.get_size(), - std::bind(&ACERadialFunctions::all_radfunc, this, elei, elej, - _1), // update fr(nr, l), dfr(nr, l) - fr.get_data(), - dfr.get_data(), deltaSplineBins, cutoff); - - - pre = prehc(elei, elej); - lamhc = lambdahc(elei, elej); -// radcore(r, pre, lamhc, cutoff, cr_c, dcr_c); - splines_hc(elei, elej).setupSplines(1, - std::bind(&ACERadialFunctions::radcore, _1, pre, lamhc, cutoff, - std::ref(cr_c), std::ref(dcr_c)), - &cr_c, - &dcr_c, deltaSplineBins, cutoff); - } - } - -} - -/** -Function that gets radial function from look-up table using splines. - -@param r, nradbase_c, nradial_c, lmax, mu_i, mu_j - -@returns fr, dfr, gr, dgr, cr, dcr -*/ -void -ACERadialFunctions::evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, - SPECIES_TYPE mu_j, bool calc_second_derivatives) { - auto &spline_gk = splines_gk(mu_i, mu_j); - auto &spline_rnl = splines_rnl(mu_i, mu_j); - auto &spline_hc = splines_hc(mu_i, mu_j); - - spline_gk.calcSplines(r, calc_second_derivatives); // populate splines_gk.values, splines_gk.derivatives; - for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { - gr(nr) = spline_gk.values(nr); - dgr(nr) = spline_gk.derivatives(nr); - if (calc_second_derivatives) - d2gr(nr) = spline_gk.second_derivatives(nr); - } - - spline_rnl.calcSplines(r, calc_second_derivatives); - for (size_t ind = 0; ind < fr.get_size(); ind++) { - fr.get_data(ind) = spline_rnl.values.get_data(ind); - dfr.get_data(ind) = spline_rnl.derivatives.get_data(ind); - if (calc_second_derivatives) - d2fr.get_data(ind) = spline_rnl.second_derivatives.get_data(ind); - } - - spline_hc.calcSplines(r, calc_second_derivatives); - cr = spline_hc.values(0); - dcr = spline_hc.derivatives(0); - if (calc_second_derivatives) - d2cr = spline_hc.second_derivatives(0); -} - - -void -ACERadialFunctions::radcore(DOUBLE_TYPE r, DOUBLE_TYPE pre, DOUBLE_TYPE lambda, DOUBLE_TYPE cutoff, DOUBLE_TYPE &cr, - DOUBLE_TYPE &dcr) { -/* pseudocode for hard core repulsion -in: - r: distance - pre: prefactor: read from input, depends on pair of atoms mu_i mu_j - lambda: exponent: read from input, depends on pair of atoms mu_i mu_j - cutoff: cutoff distance: read from input, depends on pair of atoms mu_i mu_j -out: -cr: hard core repulsion -dcr: derivative of hard core repulsion - - function - \$f f_{core} = pre \exp( - \lambda r^2 ) / r \$f - -*/ - - DOUBLE_TYPE r2, lr2, y, x0, env, denv; - -// repulsion strictly positive and decaying - pre = abs(pre); - lambda = abs(lambda); - - r2 = r * r; - lr2 = lambda * r2; - if (lr2 < 50.0) { - y = exp(-lr2); - cr = pre * y / r; - dcr = -pre * y * (2.0 * lr2 + 1.0) / r2; - - x0 = r / cutoff; - env = 0.5 * (1.0 + cos(pi * x0)); - denv = -0.5 * sin(pi * x0) * pi / cutoff; - dcr = cr * denv + dcr * env; - cr = cr * env; - } else { - cr = 0.0; - dcr = 0.0; - } - -} - -void -ACERadialFunctions::evaluate_range(vector r_vec, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, - SPECIES_TYPE mu_j) { - if (nradbase_c > nradbase) - throw invalid_argument("nradbase_c couldn't be larger than nradbase"); - if (nradial_c > nradial) - throw invalid_argument("nradial_c couldn't be larger than nradial"); - if (mu_i > nelements) - throw invalid_argument("mu_i couldn't be larger than nelements"); - if (mu_j > nelements) - throw invalid_argument("mu_j couldn't be larger than nelements"); - - gr_vec.resize(r_vec.size(), nradbase_c); - dgr_vec.resize(r_vec.size(), nradbase_c); - d2gr_vec.resize(r_vec.size(), nradbase_c); - - fr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); - dfr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); - d2fr_vec.resize(r_vec.size(), fr.get_dim(0), fr.get_dim(1)); - - for (size_t i = 0; i < r_vec.size(); i++) { - DOUBLE_TYPE r = r_vec[i]; - this->evaluate(r, nradbase_c, nradial_c, mu_i, mu_j, true); - for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { - gr_vec(i, nr) = gr(nr); - dgr_vec(i, nr) = dgr(nr); - d2gr_vec(i, nr) = d2gr(nr); - } - - for (NS_TYPE nr = 0; nr < nradial_c; nr++) { - for (LS_TYPE l = 0; l <= lmax; l++) { - fr_vec(i, nr, l) = fr(nr, l); - dfr_vec(i, nr, l) = dfr(nr, l); - d2fr_vec(i, nr, l) = d2fr(nr, l); - - } - } - } - -} - -void SplineInterpolator::setupSplines(int num_of_functions, RadialFunctions func, - DOUBLE_TYPE *values, - DOUBLE_TYPE *dvalues, DOUBLE_TYPE deltaSplineBins, DOUBLE_TYPE cutoff) { - - this->deltaSplineBins = deltaSplineBins; - this->cutoff = cutoff; - this->ntot = static_cast(cutoff / deltaSplineBins); - - DOUBLE_TYPE r, c[4]; - this->num_of_functions = num_of_functions; - this->values.resize(num_of_functions); - this->derivatives.resize(num_of_functions); - this->second_derivatives.resize(num_of_functions); - - Array1D f1g(num_of_functions); - Array1D f1gd1(num_of_functions); - f1g.fill(0); - f1gd1.fill(0); - - nlut = ntot; - DOUBLE_TYPE f0, f1, f0d1, f1d1; - int idx; - - // cutoff is global cutoff - rscalelookup = (DOUBLE_TYPE) nlut / cutoff; - invrscalelookup = 1.0 / rscalelookup; - - lookupTable.init(ntot + 1, num_of_functions, 4); - if (values == nullptr & num_of_functions > 0) - throw invalid_argument("SplineInterpolator::setupSplines: values could not be null"); - if (dvalues == nullptr & num_of_functions > 0) - throw invalid_argument("SplineInterpolator::setupSplines: dvalues could not be null"); - - for (int n = nlut; n >= 1; n--) { - r = invrscalelookup * DOUBLE_TYPE(n); - func(r); //populate values and dvalues arrays - for (int func_id = 0; func_id < num_of_functions; func_id++) { - f0 = values[func_id]; - f1 = f1g(func_id); - f0d1 = dvalues[func_id] * invrscalelookup; - f1d1 = f1gd1(func_id); - // evaluate coefficients - c[0] = f0; - c[1] = f0d1; - c[2] = 3.0 * (f1 - f0) - f1d1 - 2.0 * f0d1; - c[3] = -2.0 * (f1 - f0) + f1d1 + f0d1; - // store coefficients - for (idx = 0; idx <= 3; idx++) - lookupTable(n, func_id, idx) = c[idx]; - - // evaluate function values and derivatives at current position - f1g(func_id) = c[0]; - f1gd1(func_id) = c[1]; - } - } - - -} - - -void SplineInterpolator::calcSplines(DOUBLE_TYPE r, bool calc_second_derivatives) { - DOUBLE_TYPE wl, wl2, wl3, w2l1, w3l2, w4l2; - DOUBLE_TYPE c[4]; - int func_id, idx; - DOUBLE_TYPE x = r * rscalelookup; - int nl = static_cast(floor(x)); - - if (nl <= 0) - throw std::invalid_argument("Encountered very small distance. Stopping."); - - if (nl < nlut) { - wl = x - DOUBLE_TYPE(nl); - wl2 = wl * wl; - wl3 = wl2 * wl; - w2l1 = 2.0 * wl; - w3l2 = 3.0 * wl2; - w4l2 = 6.0 * wl; - for (func_id = 0; func_id < num_of_functions; func_id++) { - for (idx = 0; idx <= 3; idx++) { - c[idx] = lookupTable(nl, func_id, idx); - } - values(func_id) = c[0] + c[1] * wl + c[2] * wl2 + c[3] * wl3; - derivatives(func_id) = (c[1] + c[2] * w2l1 + c[3] * w3l2) * rscalelookup; - if (calc_second_derivatives) - second_derivatives(func_id) = (c[2] + c[3] * w4l2) * rscalelookup * rscalelookup * 2; - } - } else { // fill with zeroes - values.fill(0); - derivatives.fill(0); - if (calc_second_derivatives) - second_derivatives.fill(0); - } -} - -void SplineInterpolator::calcSplines(DOUBLE_TYPE r, SHORT_INT_TYPE func_ind) { - DOUBLE_TYPE wl, wl2, wl3, w2l1, w3l2; - DOUBLE_TYPE c[4]; - int idx; - DOUBLE_TYPE x = r * rscalelookup; - int nl = static_cast(floor(x)); - - if (nl <= 0) - throw std::invalid_argument("Encountered very small distance. Stopping."); - - if (nl < nlut) { - wl = x - DOUBLE_TYPE(nl); - wl2 = wl * wl; - wl3 = wl2 * wl; - w2l1 = 2.0 * wl; - w3l2 = 3.0 * wl2; - - for (idx = 0; idx <= 3; idx++) { - c[idx] = lookupTable(nl, func_ind, idx); - } - values(func_ind) = c[0] + c[1] * wl + c[2] * wl2 + c[3] * wl3; - derivatives(func_ind) = (c[1] + c[2] * w2l1 + c[3] * w3l2) * rscalelookup; - - } else { // fill with zeroes - values(func_ind) = 0; - derivatives(func_ind) = 0; - } -} diff --git a/lib/pace/ace_radial.h b/lib/pace/ace_radial.h deleted file mode 100644 index e45cfaec79..0000000000 --- a/lib/pace/ace_radial.h +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef ACE_RADIAL_FUNCTIONS_H -#define ACE_RADIAL_FUNCTIONS_H - -#include "ace_arraynd.h" -#include "ace_types.h" -#include - -using namespace std; - -//typedef void (*RadialFunctions)(DOUBLE_TYPE x); -typedef std::function RadialFunctions; - -/** - * Class that implement spline interpolation and caching for radial functions - */ -class SplineInterpolator { -public: - DOUBLE_TYPE cutoff = 0; ///< cutoff - DOUBLE_TYPE deltaSplineBins = 0.001; - int ntot = 10000; ///< Number of bins for look-up tables. - int nlut = 10000; ///< number of nodes in look-up table - DOUBLE_TYPE invrscalelookup = 1; ///< inverse of conversion coefficient from distance to lookup table within cutoff range - DOUBLE_TYPE rscalelookup = 1; ///< conversion coefficient from distance to lookup table within cutoff range - int num_of_functions = 0;///< number of functions to spline-interpolation - - Array1D values;// = Array1D("values"); ///< shape: [func_ind] - Array1D derivatives;// = Array1D("derivatives");///< shape: [func_ind] - Array1D second_derivatives;// = Array1D("second_derivatives");///< shape: [func_ind] - - Array3D lookupTable = Array3D("lookupTable");///< shape: [ntot+1][func_ind][4] - - /** - * Setup splines - * - * @param num_of_functions number of functions - * @param func subroutine, that update `values` and `dvalues` arrays - * @param values values - * @param dvalues derivatives - */ - void setupSplines(int num_of_functions, RadialFunctions func, - DOUBLE_TYPE *values, - DOUBLE_TYPE *dvalues, DOUBLE_TYPE deltaSplineBins, DOUBLE_TYPE cutoff); - - /** - * Populate `values` and `derivatives` arrays with a spline-interpolation for - * all functions - * - * @param r - * - * @return: populate 'values' and 'derivatives' - */ - void calcSplines(DOUBLE_TYPE r, bool calc_second_derivatives = false); - - /** - * Populate `values` and `derivatives` arrays with a spline-interpolation for - * all functions - * - * @param r - * - * @return: populate 'values' and 'derivatives' - */ - void calcSplines(DOUBLE_TYPE r, SHORT_INT_TYPE func_ind); -}; - -/** - * Interface class for radial basis functions with rank=1 (g_k), R_nl (rank>1) and hard-core repulsion radial functions - */ -class AbstractRadialBasis { -public: - SPECIES_TYPE nelements = 0; ///< number of elements - Array2D cut = Array2D("cut"); ///< cutoffs, shape: [nelements][nelements] - Array2D dcut = Array2D("dcut"); ///< decay of cutoff, shape: [nelements][nelements] - DOUBLE_TYPE cutoff = 0; ///< cutoff - -// int ntot = 10000; ///< Number of bins for look-up tables. - DOUBLE_TYPE deltaSplineBins; - LS_TYPE lmax = 0; ///< maximum value of `l` - NS_TYPE nradial = 0; ///< maximum number `n` of radial functions \f$ R_{nl}(r) \f$ - NS_TYPE nradbase = 0; ///< number of radial basis functions \f$ g_k(r) \f$ - - // Arrays for look-up tables. - Array2D splines_gk; ///< array of spline interpolator to store g_k, shape: [nelements][nelements] - Array2D splines_rnl; ///< array of spline interpolator to store R_nl, shape: [nelements][nelements] - Array2D splines_hc; ///< array of spline interpolator to store R_nl shape: [nelements][nelements] - //-------------------------------------------------------------------------- - - string radbasename = "ChebExpCos"; ///< type of radial basis functions \f$ g_{k}(r) \f$ (default="ChebExpCos") - - /** - Arrays to store radial functions. - */ - Array1D gr = Array1D("gr"); ///< g_k(r) functions, shape: [nradbase] - Array1D dgr = Array1D("dgr"); ///< derivatives of g_k(r) functions, shape: [nradbase] - Array1D d2gr = Array1D("d2gr"); ///< derivatives of g_k(r) functions, shape: [nradbase] - - Array2D fr = Array2D("fr"); ///< R_nl(r) functions, shape: [nradial][lmax+1] - Array2D dfr = Array2D( - "dfr"); ///< derivatives of R_nl(r) functions, shape: [nradial][lmax+1] - Array2D d2fr = Array2D( - "d2fr"); ///< derivatives of R_nl(r) functions, shape: [nradial][lmax+1] - - - - DOUBLE_TYPE cr; ///< hard-core repulsion - DOUBLE_TYPE dcr; ///< derivative of hard-core repulsion - DOUBLE_TYPE d2cr; ///< derivative of hard-core repulsion - - Array5D crad = Array5D( - "crad"); ///< expansion coefficients of radial functions into radial basis function, see Eq. (27) of PRB, shape: [nelements][nelements][lmax + 1][nradial][nradbase] - Array2D lambda = Array2D( - "lambda"); ///< distance scaling parameter Eq.(24) of PRB, shape: [nelements][nelements] - - Array2D prehc = Array2D( - "prehc"); ///< hard-core repulsion coefficients (prefactor), shape: [nelements][nelements] - Array2D lambdahc = Array2D( - "lambdahc");; ///< hard-core repulsion coefficients (lambdahc), shape: [nelements][nelements] - - virtual void - evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, - bool calc_second_derivatives = false) = 0; - - virtual void - init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, - string radbasename = "ChebExpCos") = 0; - - /** - * Function that sets up the look-up tables for spline-representation of radial functions. - */ - virtual void setuplookupRadspline() = 0; - - virtual AbstractRadialBasis *clone() const = 0; - - virtual ~AbstractRadialBasis() = default; -}; - - -/** -Class to store radial functions and their associated functions. \n -*/ -class ACERadialFunctions final : public AbstractRadialBasis { -public: - - //-------------------------------------------------------------------------- - - /** - Arrays to store Chebyshev polynomials. - */ - Array1D cheb = Array1D( - "cheb"); ///< Chebyshev polynomials of the first kind, shape: [nradbase+1] - Array1D dcheb = Array1D( - "dcheb"); ///< derivatives Chebyshev polynomials of the first kind, shape: [nradbase+1] - Array1D cheb2 = Array1D( - "cheb2"); ///< Chebyshev polynomials of the second kind, shape: [nradbase+1] - - //-------------------------------------------------------------------------- - - Array2D gr_vec; - Array2D dgr_vec; - Array2D d2gr_vec; - - Array3D fr_vec; - Array3D dfr_vec; - Array3D d2fr_vec; - //------------------------------------------------------------------------ - /** - * Default constructor - */ - ACERadialFunctions() = default; - - /** - * Parametrized constructor - * - * @param nradb number of radial basis function \f$ g_k(r) \f$ - nradbase - * @param lmax maximum orbital moment - lmax - * @param nradial maximum n-index of radial functions \f$ R_{nl}(r) \f$ - nradial - * @param ntot Number of bins for spline look-up tables. - * @param nelements numer of elements - * @param cutoff cutoff - * @param radbasename type of radial basis function \f$ g_k(r) \f$ (default: "ChebExpCos") - */ - ACERadialFunctions(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, - SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, string radbasename = "ChebExpCos"); - - /** - * Initialize arrays for given parameters - * - * @param nradb number of radial basis function \f$ g_k(r) \f$ - nradbase - * @param lmax maximum orbital moment - lmax - * @param nradial maximum n-index of radial functions \f$ R_{nl}(r) \f$ - nradial - * @param ntot Number of bins for spline look-up tables. - * @param nelements numer of elements - * @param cutoff cutoff - * @param radbasename type of radial basis function \f$ g_k(r) \f$ (default: "ChebExpCos") - */ - void init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, - string radbasename = "ChebExpCos") final; - - /** - * Destructor - */ - ~ACERadialFunctions() final = default; - - /** - * Function that computes Chebyshev polynomials of first and second kind - * to setup the radial functions and the derivatives - * - * @param n maximum polynom order - * @param x - * - * @returns fills cheb, dcheb and cheb2 arrays - */ - void calcCheb(NS_TYPE n, DOUBLE_TYPE x); - - /** - * Function that computes radial basis functions \$f g_k(r) \$f, see Eq.(21) of PRB paper - * @param lam \$f \lambda \$f parameter, see eq. (24) of PRB paper - * @param cut cutoff - * @param dcut cutoff decay - * @param r distance - * - * @return function fills gr and dgr arrays - */ - void radbase(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); - - /** - * Function that computes radial core repulsion \$f f_{core} = pre \exp( - \lambda r^2 ) / r \$f, - * and its derivative, see Eq.(27) of implementation notes. - * - * @param r distance - * @param pre prefactor: read from input, depends on pair of atoms mu_i mu_j - * @param lambda exponent: read from input, depends on pair of atoms mu_i mu_j - * @param cutoff cutoff distance: read from input, depends on pair of atoms mu_i mu_j - * @param cr (out) hard core repulsion - * @param dcr (out) derivative of hard core repulsion - */ - static void radcore(DOUBLE_TYPE r, DOUBLE_TYPE pre, DOUBLE_TYPE lambda, DOUBLE_TYPE cutoff, DOUBLE_TYPE &cr, - DOUBLE_TYPE &dcr); - - /** - * Function that sets up the look-up tables for spline-representation of radial functions. - */ - void setuplookupRadspline() final; - - /** - * Function that computes radial functions \f$ R_{nl}(r)\f$ (see Eq. 27 from PRB paper) - * and its derivatives for all range of n,l, - * ONLY if radial basis functions (gr and dgr) are computed. - * @param elei first species type - * @param elej second species type - * - * @return fills in fr, dfr arrays - */ - void radfunc(SPECIES_TYPE elei, SPECIES_TYPE elej); - - /** - * Compute all radial functions R_nl(r), radial basis functions g_k(r) and hard-core repulsion function hc(r) - * - * @param r distance - * @param nradbase_c - * @param nradial_c - * @param mu_i - * @param mu_j - * - * @return update gr(k), dgr(k), fr(n,l), dfr(n,l), cr, dcr - */ - void evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, - bool calc_second_derivatives = false) final; - - - void - evaluate_range(vector r_vec, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, - SPECIES_TYPE mu_j); - - void chebExpCos(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); - - void chebPow(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); - - void chebLinear(DOUBLE_TYPE lam, DOUBLE_TYPE cut, DOUBLE_TYPE dcut, DOUBLE_TYPE r); - - /** - * Setup all radial functions for element pair mu_i-mu_j and distance r - * @param mu_i first specie type - * @param mu_j second specie type - * @param r distance - * @return update fr(nr, l), dfr(nr, l) - */ - void all_radfunc(SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, DOUBLE_TYPE r); - - ACERadialFunctions *clone() const override { - return new ACERadialFunctions(*this); - }; -}; - -#endif \ No newline at end of file diff --git a/lib/pace/ace_recursive.cpp b/lib/pace/ace_recursive.cpp deleted file mode 100644 index c895418943..0000000000 --- a/lib/pace/ace_recursive.cpp +++ /dev/null @@ -1,1340 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Christoph Ortner on 20.12.2020 - -#include "ace_recursive.h" - -#include "ace_abstract_basis.h" -#include "ace_types.h" - -/* ------------------------------------------------------------ - * ACEDAG Implementation - * (just the DAG construction, not the traversal) - * ------------------------------------------------------------ */ - -/* Notes on different Tags: - * rec1 - first basic implementation - * rec2 - avoid index arithmetic, contiguous layout, - * canonical evaluator in ACE.jl format - * rec3 - split nodes into interior and leaf nodes - */ - -void ACEDAG::init(Array2D xAspec, - Array2D AAspec, - Array1D orders, - Array2D jl_coeffs, - int _heuristic ) { - - // remember which heuristic we want to use! - heuristic = _heuristic; - - /* stage one of the graph is just extracting the A basis from - * the tensor product format into the linear list; all information - * for that is already stored in Aspec, and the only thing to do here is - * to construct zero-coefficients. Still we have to copy Aspec, since - * the one we have here will (may?) be deleted. */ - int num1 = xAspec.get_dim(0); - Aspec = xAspec; //YL: just copying the multiarray: Aspec = xAspec; - - /* fill the one-particle basis into the DAGmap - * DAGmap[ (i1,...,in) ] = iAA index where the (i1,...,in) basis functions - * lives. - */ - TDAGMAP DAGmap; - for (int iA = 0; iA < num1; iA++) { - vector a(1); - a[0] = iA; - DAGmap[a] = iA; - } - - /* For stage 2 we now want to construct the actual recursion; the - recursion info will be stored in DAGspec, while the - coefficients go into DAGcoeffs. These arrays are initialized to - length `num2`, but they will have to grow as we add additional - artificial nodes into the graph. - - initially we treat all nodes as having children, but then in a - second stage below we reorganize. */ - int num2 = AAspec.get_dim(0); - int ndensity = jl_coeffs.get_dim(1); - nodes_pre.resize(2*num2, 2); - coeffs_pre.resize(2*num2, ndensity); - - /* the first basis function we construct will get index num1, - * since there are already num1 one-particle basis functions - * to collect during stage 1 */ - dag_idx = num1; - /* main loop over AA basis set to transform into DAG */ - for (int iAA = 0; iAA < num2; iAA++) { - // create a vector representing the current basis function - int ord = orders(iAA); - vector aa(ord); - for (int t = 0; t < ord; t++) aa[t] = AAspec(iAA, t); - vector c(ndensity); - for (int p = 0; p < ndensity; p++) c[p] = jl_coeffs(iAA, p); - insert_node(DAGmap, aa, c); - } - - /* convert to 3-stage format through reordering - * interior nodes first, then leaf nodes */ - - // allocate storage - num_nodes = dag_idx; // store total size of dag - // num_nodes - num1 = number of many-body nodes. - nodes.resize(num_nodes - num1, 2); - coeffs.resize(num_nodes - num1, ndensity); - - // find out which nodes have children - haschild.resize(num_nodes - num1); - haschild.fill(false); - for (int iAA = 0; iAA < num_nodes - num1; iAA++) { - if (nodes_pre(iAA, 0) >= num1) - haschild(nodes_pre(iAA, 0)-num1) = true; - if (nodes_pre(iAA, 1) >= num1) - haschild(nodes_pre(iAA, 1)-num1) = true; - } - - // to reorder the graph we need a fresh map from preordered indices to - // postordered indices; for the 1-particle basis the order remains the same. - // TODO: doesn't need to be a map, could be a vector. - map neworder; - for (int iA = 0; iA < num1; iA++) - neworder[iA] = iA; - - // insert all interior nodes - num2_int = 0; - num2_leaf = 0; - dag_idx = num1; - int i1, i2, i1pre, i2pre; - for (int iAA = 0; iAA < num_nodes - num1; iAA++) { - if (haschild(iAA)) { - num2_int += 1; - // indices into AAbuf before reordering - i1pre = nodes_pre(iAA, 0); - i2pre = nodes_pre(iAA, 1); - // indices into AAbuf after reordering - i1 = neworder[i1pre]; - i2 = neworder[i2pre]; - // insert the current node : iAA is old order, dag_idx is new order - neworder[num1+iAA] = dag_idx; - nodes(dag_idx-num1, 0) = i1; - nodes(dag_idx-num1, 1) = i2; - for (int t = 0; t < ndensity; t++) - coeffs(dag_idx-num1, t) = coeffs_pre(iAA, t); - dag_idx++; - } - } - - // insert all leaf nodes - for (int iAA = 0; iAA < num_nodes - num1; iAA++) { - if (!haschild(iAA)) { - num2_leaf += 1; - // indices into AAbuf before reordering - i1pre = nodes_pre(iAA, 0); - i2pre = nodes_pre(iAA, 1); - // insert the current node : no need to remember the new order now - nodes(dag_idx-num1, 0) = neworder[i1pre]; - nodes(dag_idx-num1, 1) = neworder[i2pre]; - for (int t = 0; t < ndensity; t++) - coeffs(dag_idx-num1, t) = coeffs_pre(iAA, t); - dag_idx++; - } - } -#ifdef DEBUG - cout << "num2_int = " << num2_int << "; num2_leaf = " << num2_leaf << "\n"; -#endif - // free up memory that is no longer needed - nodes_pre.resize(0, 0); - coeffs_pre.resize(0, 0); - haschild.resize(0); - - /* finalize dag: allocate buffer storage */ - AAbuf.resize(num1 + num2_int); - w.resize(num_nodes); - // TODO: technically only need num1 + num2_int for w, this can save one - // memory access later, probably not worth the crazy code duplication. -} - -void ACEDAG::insert_node(TDAGMAP &DAGmap, vector a, vector c) { - /* start with a list of all possible partitions into 2 groups - * and check whether any of these nodes are already in the dag */ - auto partitions = find_2partitions(a); - int ndensity = c.size(); - int num1 = get_num1(); - - // TODO: first try to find partitions into nodes that are already parents - // that way we will get more leaf nodes! - for (TPARTITION const& p : partitions) { - /* this is the good case; the parent nodes are both already in the - * graph; add the new node and return. This is also the only place in the - * code where an actual insert happens. */ - if (DAGmap.count(p.first) && DAGmap.count(p.second)) { - if (nodes_pre.get_dim(0) < dag_idx + 1) { //check if array is sufficiently large - int newsize = (dag_idx * 3) / 2; - nodes_pre.resize(newsize, 2); // grow arrays if necessary - coeffs_pre.resize(newsize, ndensity); - } - int i1 = DAGmap[p.first]; - int i2 = DAGmap[p.second]; - nodes_pre(dag_idx - num1, 0) = i1; - nodes_pre(dag_idx - num1, 1) = i2; - DAGmap[a] = dag_idx; - for (int p = 0; p < ndensity; p++) - coeffs_pre(dag_idx - num1, p) = c[p]; - dag_idx += 1; - return; - } - } - - /* if we are here, then this means, the new node cannot yet be inserted. - * We first need to insert some intermediate auxiliary nodes. For this - * we use a simple heuristic: - * try to find a partition where one of the two nodes are already - * in the graph, if there are several, then we remember the longest - * (this is a very greedy heuristic!!) - * .... (continue below) .... - */ - TPARTITION longest; - int longest_length = 0; - for (auto const& p : partitions) { - int len = 0; - if (DAGmap.count(p.first)) { - len = p.first.size(); - } else if (DAGmap.count(p.second)) { - len = p.second.size(); - } - if ((len > 0) && (len > longest_length)) { - longest_length = len; - longest = p; - } - } - - /* sanity check */ - if (longest_length == 0) { - std::stringstream error_message; - error_message << "WARNING : something has gone horribly wrong! `longest_length == 0`! \n"; - error_message << "a = ["; - for (int t = 0; t < a.size(); t++) - error_message << a[t] << ", "; - error_message << "]\n"; - throw std::logic_error(error_message.str()); -// return; - } - - /* If there is a partition with one component already in the graph, - * then we only need to add in the other component. Note that there will - * always be at least one such partition, namely all those containing - * a one-element node e.g. (1,2,3,4) -> (1,) (2,3,4) then (1,) is - * a one-particle basis function and hence always in the graph. - * If heuristic == 0, then we just take one of those partitionas and move on. - * - * We also accept the found partition if longest_length > 1. - * And we also accept it if we have a 2- or 3-correlation. - */ - - if ( (heuristic == 0) - || (longest_length > 1) - || (a.size() <= 3)) { - /* insert the other node that isn't in the DAG yet - * this is an artificial node so it gets zero-coefficients - * This step is recursive, so more than one node might be inserted here */ - vector cz(ndensity); - for (int i = 0; i < ndensity; i++) cz[i] = 0.0; - TPARTITION p = longest; - if (DAGmap.count(p.first)) - insert_node(DAGmap, p.second, cz); - else - insert_node(DAGmap, p.first, cz); - } - - /* Second heuristic : heuristic == 1 - * Focus on inserting artificial 2-correlations - */ - else if (heuristic == 1) { - // and we also know that longest_length == 1 and nu = a.size >= 4. - int nu = a.size(); - // generate an artificial partition - vector a1(2); - for (int i = 0; i < 2; i++) a1[i] = a[i]; - vector a2(nu - 2); - for (int i = 0; i < nu - 2; i++) a2[i] = a[2 + i]; - vector cz(ndensity); - for (int i = 0; i < cz.size(); i++) cz[i] = 0.0; - // and insert both (we know neither are in the DAG yet) - insert_node(DAGmap, a1, cz); - insert_node(DAGmap, a2, cz); - } else { - cout << "WARNING : something has gone horribly wrong! \n"; - // TODO: Throw and error here?!? - return; - } - - - - /* now we should be ready to insert the entire tuple `a` since there is now - * an eligible parent pair. Here we recompute the partition of `a`, but - * that's a small price to pay for a clearer code. Maybe this can be - * optimized a bit by wrapping it all into a while loop or having a second - * version of `insert_node` ... */ - insert_node(DAGmap, a, c); -} - -TPARTITIONS ACEDAG::find_2partitions(vector v) { - int N = v.size(); - int zo; - TPARTITIONS partitions; - TPARTITION part; - /* This is a fun little hack to extract all subsets of the indices 1:N - * the number i will have binary representation with each digit indicating - * whether or not that index belongs to the selected subset */ - for (int i = 1; i < (1< v1(N1); - vector v2(N2); - int i1 =0, i2 = 0; - p = 1; - for (int n = 0; n < N; n++) { - zo = ((i / p) % 2); - p *= 2; - if (zo == 1) { - v1[i1] = v[n]; - i1 += 1; - } else { - v2[i2] = v[n]; - i2 += 1; - } - } - part = make_pair(v1, v2); - partitions.push_back(part); - } - return partitions; -} - -void ACEDAG::print() { - cout << "DAG Specification: \n" ; - cout << " n1 : " << get_num1() << "\n"; - cout << " n2 : " << get_num2() << "\n"; - cout << " num_nodes : " << num_nodes << "\n"; - cout << "--------------------\n"; - cout << "A-spec: \n"; - for (int iA = 0; iA < get_num1(); iA++) { - cout << iA << " : " << Aspec(iA, 0) << - Aspec(iA, 1) << Aspec(iA, 2) << Aspec(iA, 3) << "\n"; - } - - cout << "-----------\n"; - cout << "AA-tree\n"; - - for (int iAA = 0; iAA < get_num2(); iAA++) { - cout << iAA + get_num1() << " : " << - nodes(iAA, 0) << ", " << nodes(iAA, 1) << "\n"; - } -} - - -/* ------------------------------------------------------------ - * ACERecursiveEvaluator - * ------------------------------------------------------------ */ - - -void ACERecursiveEvaluator::set_basis(ACECTildeBasisSet &bas, int heuristic) { - basis_set = &bas; - init(basis_set, heuristic); -} - -void ACERecursiveEvaluator::init(ACECTildeBasisSet *basis_set, int heuristic) { - - ACEEvaluator::init(basis_set); - - - weights.init(basis_set->nelements, basis_set->nradmax + 1, basis_set->lmax + 1, - "weights"); - - weights_rank1.init(basis_set->nelements, basis_set->nradbase, "weights_rank1"); - - - DG_cache.init(1, basis_set->nradbase, "DG_cache"); - DG_cache.fill(0); - - R_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "R_cache"); - R_cache.fill(0); - - DR_cache.init(1, basis_set->nradmax, basis_set->lmax + 1, "DR_cache"); - DR_cache.fill(0); - - Y_cache.init(1, basis_set->lmax + 1, "Y_cache"); - Y_cache.fill({0, 0}); - - DY_cache.init(1, basis_set->lmax + 1, "dY_dense_cache"); - DY_cache.fill({0.}); - - //hard-core repulsion - DCR_cache.init(1, "DCR_cache"); - DCR_cache.fill(0); - dB_flatten.init(basis_set->max_dB_array_size, "dB_flatten"); - - /* convert to ACE.jl format to prepare for construction of DAG - * This will fill the arrays jl_Aspec, jl_AAspec, jl_orders - */ - acejlformat(); - - // test_acejlformat(); - - // now pass this info into the DAG - dag.init(jl_Aspec, jl_AAspec, jl_orders, jl_coeffs, heuristic); - - // finally empty the temporary arrays to clear up the memory... - // TODO -} - - -void ACERecursiveEvaluator::acejlformat() { - - int func_ms_ind = 0; - int func_ms_t_ind = 0;// index for dB - int j, jj, func_ind, ms_ind; - - SPECIES_TYPE mu_i = 0;//TODO: multispecies - const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; - ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; - - int AAidx = 0; - RANK_TYPE order, t; - SPECIES_TYPE *mus; - NS_TYPE *ns; - LS_TYPE *ls; - MS_TYPE *ms; - - /* transform basis into new format: - [A1 ... A_num1] - [(i1,i2)(i1,i2)(...)(i1,i2,i3)(...)] - where each ia represents an A_{ia} - */ - - /* compute max values for mu, n, l, m */ - SPECIES_TYPE maxmu = 0; //TODO: multispecies - NS_TYPE maxn = basis_set->nradmax; - LS_TYPE maxl = basis_set->lmax; - RANK_TYPE maxorder = basis_set->rankmax; - const DENSITY_TYPE ndensity = basis_set->ndensitymax; - - int num1 = 0; - - - /* create a 4D lookup table for the 1-p basis - * TODO: replace with a map?? - */ - Array4D A_lookup(int(maxmu+1), int(maxn), int(maxl+1), int(2*maxl+1)); - for (int mu = 0; mu < maxmu+1; mu++) - for (int n = 0; n < maxn; n++) - for (int l = 0; l < maxl+1; l++) - for (int m = 0; m < 2*maxl+1; m++) - A_lookup(mu, n, l, m) = -1; - int A_idx = 0; // linear index of A basis function (1-particle) - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; -// func->print(); - order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * order]; - for (t = 0; t < order; t++) { - int iA = A_lookup(mus[t], ns[t]-1, ls[t], ms[t]+ls[t]); - if (iA == -1) { - A_lookup(mus[t], ns[t] - 1, ls[t], ms[t] + ls[t]) = A_idx; - A_idx += 1; - } - } - } - } - - /* create the reverse list: linear indixes to mu,l,m,n - this keeps only the basis functions we really need */ - num1 = A_idx; - Array2D & Aspec = jl_Aspec; - Aspec.resize(num1, 4); - // Array2D Aspec(num1, 4); - for (int mu = 0; mu <= maxmu; mu++) - for (int n = 1; n <= maxn; n++) - for (int l = 0; l <= maxl; l++) - for (int m = -l; m <= l; m++) { - int iA = A_lookup(mu, n-1, l, l+m); - if (iA != -1) { - Aspec(iA, 0) = mu; - Aspec(iA, 1) = n; - Aspec(iA, 2) = l; - Aspec(iA, 3) = m; - } - } - - /* ============ HALF-BASIS TRICK START ============ */ - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; - order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; - if (!( (mus[0] <= maxmu) && (ns[0] <= maxn) && (ls[0] <= maxl) )) - continue; - - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * order]; - - // find first positive and negative index - int pos_idx = order + 1; - int neg_idx = order + 1; - for (t = order-1; t >= 0; t--) - if (ms[t] > 0) pos_idx = t; - else if (ms[t] < 0) neg_idx = t; - - // if neg_idx < pos_idx then this means that ms is non-zero - // and that the first non-zero index is negative, hence this is - // a negative-sign tuple which we want to combine into - // its opposite. - if (neg_idx < pos_idx) { - // find the opposite tuple - int ms_ind2 = 0; - MS_TYPE *ms2; - bool found_opposite = false; - for (ms_ind2 = 0; ms_ind2 < func->num_ms_combs; ++ms_ind2) { - ms2 = &func->ms_combs[ms_ind2 * order]; - bool isopposite = true; - for (t = 0; t < order; t++) - if (ms[t] != -ms2[t]) { - isopposite = false; - break; - } - if (isopposite) { - found_opposite = true; - break; - } - } - - if (ms_ind == ms_ind2) { - cout << "WARNING - ms_ind == ms_ind2 \n"; - } - - // now we need to overwrite the coefficients - if (found_opposite) { - int sig = 1; - for (t = 0; t < order; t++) - if (ms[t] < 0) - sig *= -1; - for (int p = 0; p < ndensity; ++p) { - func->ctildes[ms_ind2 * ndensity + p] += - func->ctildes[ms_ind * ndensity + p]; - func->ctildes[ms_ind * ndensity + p] = 0.0; - } - } - } - } - } - - // /* ============ HALF-BASIS TRICK END ============ */ - - - /* count number of basis functions, keep only non-zero!! */ - int num2 = 0; - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; - for (ms_ind = 0; ms_ind < (&basis[func_ind])->num_ms_combs; ++ms_ind, ++func_ms_ind) { - // check that the coefficients are actually non-zero - bool isnonzero = false; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) - if (func->ctildes[ms_ind * ndensity + p] != 0.0) - isnonzero = true; - if (isnonzero) - num2++; - } - } - - - /* Now create the AA basis links into the A basis */ - num1 = A_idx; // total number of A-basis functions that we keep - // Array1D AAorders(num2); - Array1D & AAorders = jl_orders; - AAorders.resize(num2); - // Array2D AAspec(num2, maxorder); // specs of AA basis functions - Array2D & AAspec = jl_AAspec; - AAspec.resize(num2, maxorder); - jl_coeffs.resize(num2, ndensity); - AAidx = 0; // linear index into AA basis function - int len_flat = 0; - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; - order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; - if (!((mus[0] <= maxmu) && (ns[0] <= maxn) && (ls[0] <= maxl))) //fool-proofing of functions - continue; - - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * order]; - - // check that the coefficients are actually non-zero - bool iszero = true; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) - if (func->ctildes[ms_ind * ndensity + p] != 0.0) - iszero = false; - if (iszero) continue; - - AAorders(AAidx) = order; - for (t = 0; t < order; t++) { - int Ait = A_lookup(int(mus[t]), int(ns[t]-1), int(ls[t]), int(ms[t])+int(ls[t])); - AAspec(AAidx, t) = Ait; - len_flat += 1; - } - for (t = order; t < maxorder; t++) AAspec(AAidx, t) = -1; - /* copy over the coefficients */ - for (DENSITY_TYPE p = 0; p < ndensity; ++p) - jl_coeffs(AAidx, p) = func->ctildes[ms_ind * ndensity + p]; - AAidx += 1; - } - } - - // flatten the AAspec array - jl_AAspec_flat.resize(len_flat); - int idx_spec = 0; - for (int AAidx = 0; AAidx < jl_AAspec.get_dim(0); AAidx++) - for (int p = 0; p < jl_orders(AAidx); p++, idx_spec++) - jl_AAspec_flat(idx_spec) = jl_AAspec(AAidx, p); - -} - -void ACERecursiveEvaluator::test_acejlformat() { - - Array2D AAspec = jl_AAspec; - Array2D Aspec = jl_Aspec; - Array1D AAorders = jl_orders; - cout << "num2 = " << AAorders.get_dim(0) << "\n"; - int func_ms_ind = 0; - int func_ms_t_ind = 0;// index for dB - int j, jj, func_ind, ms_ind; - - SPECIES_TYPE mu_i = 0; - const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; - ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; - - RANK_TYPE order, t; - SPECIES_TYPE *mus; - NS_TYPE *ns; - LS_TYPE *ls; - MS_TYPE *ms; - - /* ==== test by printing the basis spec ====*/ - // TODO: convert this into an automatic consistency test - int iAA = 0; - for (func_ind = 0; func_ind < total_basis_size; ++func_ind) { - ACECTildeBasisFunction *func = &basis[func_ind]; - order = func->rank; mus = func->mus; ns = func->ns; ls = func->ls; - // func->print(); - //loop over {ms} combinations in sum - for (ms_ind = 0; ms_ind < func->num_ms_combs; ++ms_ind, ++func_ms_ind) { - ms = &func->ms_combs[ms_ind * order]; - - - cout << iAA << " : |"; - for (t = 0; t < order; t++) - cout << mus[t] << ";" << ns[t] << "," << ls[t] << "," << ms[t] << "|"; - cout << "\n"; - - cout << " ["; - for (t = 0; t < AAorders(iAA); t++) - cout << AAspec(iAA, int(t)) << ","; - cout << "]\n"; - cout << " |"; - for (t = 0; t < AAorders(iAA); t++) { - int iA = AAspec(iAA, t); - // cout << iA << ","; - cout << Aspec(iA, 0) << ";" - << Aspec(iA, 1) << "," - << Aspec(iA, 2) << "," - << Aspec(iA, 3) << "|"; - } - cout << "\n"; - iAA += 1; - } - } - /* ==== END TEST ==== */ - - -} - - - - -void ACERecursiveEvaluator::resize_neighbours_cache(int max_jnum) { - if(basis_set== nullptr) { - throw std::invalid_argument("ACERecursiveEvaluator: basis set is not assigned"); - } - if (R_cache.get_dim(0) < max_jnum) { - - //TODO: implement grow - R_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); - R_cache.fill(0); - - DR_cache.resize(max_jnum, basis_set->nradmax, basis_set->lmax + 1); - DR_cache.fill(0); - - DG_cache.resize(max_jnum, basis_set->nradbase); - DG_cache.fill(0); - - Y_cache.resize(max_jnum, basis_set->lmax + 1); - Y_cache.fill({0, 0}); - - DY_cache.resize(max_jnum, basis_set->lmax + 1); - DY_cache.fill({0}); - - //hard-core repulsion - DCR_cache.init(max_jnum, "DCR_cache"); - DCR_cache.fill(0); - } -} - - - -// double** r - atomic coordinates of atom I -// int* types - atomic types if atom I -// int **firstneigh - ptr to 1st J int value of each I atom. Usage: jlist = firstneigh[i]; -// Usage: j = jlist_of_i[jj]; -// jnum - number of J neighbors for each I atom. jnum = numneigh[i]; - -void -ACERecursiveEvaluator::compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) { - if(basis_set== nullptr) { - throw std::invalid_argument("ACERecursiveEvaluator: basis set is not assigned"); - } - per_atom_calc_timer.start(); -#ifdef PRINT_MAIN_STEPS - printf("\n ATOM: ind = %d r_norm=(%f, %f, %f)\n",i, x[i][0], x[i][1], x[i][2]); -#endif - DOUBLE_TYPE evdwl = 0, evdwl_cut = 0, rho_core = 0; - DOUBLE_TYPE r_norm; - DOUBLE_TYPE xn, yn, zn, r_xyz; - DOUBLE_TYPE R, GR, DGR, R_over_r, DR, DCR; - DOUBLE_TYPE *r_hat; - - SPECIES_TYPE mu_j; - RANK_TYPE r, rank, t; - NS_TYPE n; - LS_TYPE l; - MS_TYPE m, m_t; - - SPECIES_TYPE *mus; - NS_TYPE *ns; - LS_TYPE *ls; - MS_TYPE *ms; - - int j, jj, func_ind, ms_ind; - SHORT_INT_TYPE factor; - - ACEComplex Y{0}, Y_DR{0.}; - ACEComplex B{0.}; - ACEComplex dB{0}; - ACEComplex A_cache[basis_set->rankmax]; - - ACEComplex dA[basis_set->rankmax]; - int spec[basis_set->rankmax]; - - dB_flatten.fill({0.}); - - ACEDYcomponent grad_phi_nlm{0}, DY{0.}; - - //size is +1 of max to avoid out-of-boundary array access in double-triangular scheme - ACEComplex A_forward_prod[basis_set->rankmax + 1]; - ACEComplex A_backward_prod[basis_set->rankmax + 1]; - - DOUBLE_TYPE inv_r_norm; - DOUBLE_TYPE r_norms[jnum]; - DOUBLE_TYPE inv_r_norms[jnum]; - DOUBLE_TYPE rhats[jnum][3];//normalized vector - SPECIES_TYPE elements[jnum]; - const DOUBLE_TYPE xtmp = x[i][0]; - const DOUBLE_TYPE ytmp = x[i][1]; - const DOUBLE_TYPE ztmp = x[i][2]; - DOUBLE_TYPE f_ji[3]; - - bool is_element_mapping = element_type_mapping.get_size() > 0; - SPECIES_TYPE mu_i; - if (is_element_mapping) - mu_i = element_type_mapping(type[i]); - else - mu_i = type[i]; - - const SHORT_INT_TYPE total_basis_size_rank1 = basis_set->total_basis_size_rank1[mu_i]; - const SHORT_INT_TYPE total_basis_size = basis_set->total_basis_size[mu_i]; - - ACECTildeBasisFunction *basis_rank1 = basis_set->basis_rank1[mu_i]; - ACECTildeBasisFunction *basis = basis_set->basis[mu_i]; - - DOUBLE_TYPE rho_cut, drho_cut, fcut, dfcut; - DOUBLE_TYPE dF_drho_core; - - //TODO: lmax -> lmaxi (get per-species type) - const LS_TYPE lmaxi = basis_set->lmax; - - //TODO: nradmax -> nradiali (get per-species type) - const NS_TYPE nradiali = basis_set->nradmax; - - //TODO: nradbase -> nradbasei (get per-species type) - const NS_TYPE nradbasei = basis_set->nradbase; - - //TODO: get per-species type number of densities - const DENSITY_TYPE ndensity= basis_set->ndensitymax; - - neighbours_forces.resize(jnum, 3); - neighbours_forces.fill(0); - - //TODO: shift nullifications to place where arrays are used - weights.fill({0}); - weights_rank1.fill(0); - A.fill({0}); - A_rank1.fill(0); - rhos.fill(0); - dF_drho.fill(0); - -#ifdef EXTRA_C_PROJECTIONS - basis_projections_rank1.init(total_basis_size_rank1, ndensity, "c_projections_rank1"); - basis_projections.init(total_basis_size, ndensity, "c_projections"); -#endif - - //proxy references to spherical harmonics and radial functions arrays - const Array2DLM &ylm = basis_set->spherical_harmonics.ylm; - const Array2DLM &dylm = basis_set->spherical_harmonics.dylm; - - const Array2D &fr = basis_set->radial_functions->fr; - const Array2D &dfr = basis_set->radial_functions->dfr; - - const Array1D &gr = basis_set->radial_functions->gr; - const Array1D &dgr = basis_set->radial_functions->dgr; - - loop_over_neighbour_timer.start(); - - int jj_actual = 0; - SPECIES_TYPE type_j = 0; - int neighbour_index_mapping[jnum]; // jj_actual -> jj - //loop over neighbours, compute distance, consider only atoms within with rradial_functions->cut(mu_i, mu_j); - r_xyz = sqrt(xn * xn + yn * yn + zn * zn); - - if (r_xyz >= current_cutoff) - continue; - - inv_r_norm = 1 / r_xyz; - - r_norms[jj_actual] = r_xyz; - inv_r_norms[jj_actual] = inv_r_norm; - rhats[jj_actual][0] = xn * inv_r_norm; - rhats[jj_actual][1] = yn * inv_r_norm; - rhats[jj_actual][2] = zn * inv_r_norm; - elements[jj_actual] = mu_j; - neighbour_index_mapping[jj_actual] = jj; - jj_actual++; - } - - int jnum_actual = jj_actual; - - //ALGORITHM 1: Atomic base A - for (jj = 0; jj < jnum_actual; ++jj) { - r_norm = r_norms[jj]; - mu_j = elements[jj]; - r_hat = rhats[jj]; - - //proxies - Array2DLM &Y_jj = Y_cache(jj); - Array2DLM &DY_jj = DY_cache(jj); - - - basis_set->radial_functions->evaluate(r_norm, basis_set->nradbase, nradiali, mu_i, mu_j); - basis_set->spherical_harmonics.compute_ylm(r_hat[0], r_hat[1], r_hat[2], lmaxi); - //loop for computing A's - //rank = 1 - for (n = 0; n < basis_set->nradbase; n++) { - GR = gr(n); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("-neigh atom %d\n", jj); - printf("gr(n=%d)(r=%f) = %f\n", n, r_norm, gr(n)); - printf("dgr(n=%d)(r=%f) = %f\n", n, r_norm, dgr(n)); -#endif - DG_cache(jj, n) = dgr(n); - A_rank1(mu_j, n) += GR * Y00; - } - //loop for computing A's - // for rank > 1 - for (n = 0; n < nradiali; n++) { - auto &A_lm = A(mu_j, n); - for (l = 0; l <= lmaxi; l++) { - R = fr(n, l); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("R(nl=%d,%d)(r=%f)=%f\n", n + 1, l, r_norm, R); -#endif - - DR_cache(jj, n, l) = dfr(n, l); - R_cache(jj, n, l) = R; - - for (m = 0; m <= l; m++) { - Y = ylm(l, m); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("Y(lm=%d,%d)=(%f, %f)\n", l, m, Y.real, Y.img); -#endif - A_lm(l, m) += R * Y; //accumulation sum over neighbours - Y_jj(l, m) = Y; - DY_jj(l, m) = dylm(l, m); - } - } - } - - //hard-core repulsion - rho_core += basis_set->radial_functions->cr; - DCR_cache(jj) = basis_set->radial_functions->dcr; - - } //end loop over neighbours - - //complex conjugate A's (for NEGATIVE (-m) terms) - // for rank > 1 - for (mu_j = 0; mu_j < basis_set->nelements; mu_j++) { - for (n = 0; n < nradiali; n++) { - auto &A_lm = A(mu_j, n); - for (l = 0; l <= lmaxi; l++) { - //fill in -m part in the outer loop using the same m <-> -m symmetry as for Ylm - for (m = 1; m <= l; m++) { - factor = m % 2 == 0 ? 1 : -1; - A_lm(l, -m) = A_lm(l, m).conjugated() * factor; - } - } - } - } //now A's are constructed - loop_over_neighbour_timer.stop(); - - // ==================== ENERGY ==================== - - energy_calc_timer.start(); -#ifdef EXTRA_C_PROJECTIONS - basis_projections_rank1.fill(0); - basis_projections.fill(0); -#endif - - //ALGORITHM 2: Basis functions B with iterative product and density rho(p) calculation - //rank=1 - for (int func_rank1_ind = 0; func_rank1_ind < total_basis_size_rank1; ++func_rank1_ind) { - ACECTildeBasisFunction *func = &basis_rank1[func_rank1_ind]; -// ndensity = func->ndensity; -#ifdef PRINT_LOOPS_INDICES - printf("Num density = %d r = 0\n",(int) ndensity ); - print_C_tilde_B_basis_function(*func); -#endif - double A_cur = A_rank1(func->mus[0], func->ns[0] - 1); -#ifdef DEBUG_ENERGY_CALCULATIONS - printf("A_r=1(x=%d, n=%d)=(%f)\n", func->mus[0], func->ns[0], A_cur); - printf(" coeff[0] = %f\n", func->ctildes[0]); -#endif - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 - rhos(p) += func->ctildes[p] * A_cur; -#ifdef EXTRA_C_PROJECTIONS - //aggregate C-projections separately - basis_projections_rank1(func_rank1_ind, p)+= func->ctildes[p] * A_cur; -#endif - } - } // end loop for rank=1 - - // ================ START RECURSIVE EVALUATOR ==================== - // (rank > 1 only) - - /* STAGE 1: - * 1-particle basis is already evaluated, so we only need to - * copy it into the AA value buffer - */ - int num1 = dag.get_num1(); - for (int idx = 0; idx < num1; idx++) - dag.AAbuf(idx) = A( dag.Aspec(idx, 0), - dag.Aspec(idx, 1)-1, - dag.Aspec(idx, 2), - dag.Aspec(idx, 3) ); - - - if (recursive) { - /* STAGE 2: FORWARD PASS - * Forward pass: go through the dag and store all intermediate results - */ - - // rhos.fill(0); note the rhos are already reset and started filling above! - ACEComplex AAcur{0.0}; - int i1, i2; - - int * dag_nodes = dag.nodes.get_data(); - int idx_nodes = 0; - - DOUBLE_TYPE * dag_coefs = dag.coeffs.get_data(); - int idx_coefs = 0; - - int num2_int = dag.get_num2_int(); - int num2_leaf = dag.get_num2_leaf(); - - // interior nodes (save AA) - for (int idx = num1; idx < num1+num2_int; idx++) { - i1 = dag_nodes[idx_nodes]; idx_nodes++; - i2 = dag_nodes[idx_nodes]; idx_nodes++; - AAcur = dag.AAbuf(i1) * dag.AAbuf(i2); - dag.AAbuf(idx) = AAcur; - for (int p = 0; p < ndensity; p++, idx_coefs++) - rhos(p) += AAcur.real_part_product(dag_coefs[idx_coefs]); - } - - // leaf nodes -> no need to store in AAbuf - DOUBLE_TYPE AAcur_re = 0.0; - for (int _idx = 0; _idx < num2_leaf; _idx++) { - i1 = dag_nodes[idx_nodes]; idx_nodes++; - i2 = dag_nodes[idx_nodes]; idx_nodes++; - AAcur_re = dag.AAbuf(i1).real_part_product(dag.AAbuf(i2)); - for (int p = 0; p < ndensity; p++, idx_coefs++) - rhos(p) += AAcur_re * dag_coefs[idx_coefs]; - } - - } else { - - /* non-recursive Julia-style evaluator implementation */ - // TODO: fix array access to enable bounds checking again??? - ACEComplex AAcur{1.0}; - int *AAspec = jl_AAspec_flat.get_data(); - DOUBLE_TYPE *coeffs = jl_coeffs.get_data(); - int idx_spec = 0; - int idx_coefs = 0; - int order = 0; - int max_order = jl_AAspec.get_dim(1); - for (int iAA = 0; iAA < jl_AAspec.get_dim(0); iAA ++) { - AAcur = 1.0; - order = jl_orders(iAA); - for (int r = 0; r < order; r++, idx_spec++) - AAcur *= dag.AAbuf( AAspec[idx_spec] ); - for (int p = 0; p < ndensity; p++, idx_coefs++) - rhos(p) += AAcur.real_part_product(coeffs[idx_coefs]); - } - } - - /* we now have rho and can evaluate lots of things. - -------- this is back to the original PACE code --------- */ - -#ifdef DEBUG_FORCES_CALCULATIONS - printf("rhos = "); - for(DENSITY_TYPE p =0; prho_core_cutoffs(mu_i); - drho_cut = basis_set->drho_core_cutoffs(mu_i); - - basis_set->inner_cutoff(rho_core, rho_cut, drho_cut, fcut, dfcut); - basis_set->FS_values_and_derivatives(rhos, evdwl, dF_drho, ndensity); - - dF_drho_core = evdwl * dfcut + 1; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) - dF_drho(p) *= fcut; - evdwl_cut = evdwl * fcut + rho_core; - - // E0 shift - evdwl_cut += basis_set->E0vals(mu_i); - - /* I've moved this from below the weight calculation - since I believe it only times the energy? the weights - are only needed for the forces? - But I believe we could add a third timer for computing just - the weights; this will allow us to check better where the - bottleneck is. - */ - energy_calc_timer.stop(); - - forces_calc_loop_timer.start(); - - -#ifdef DEBUG_FORCES_CALCULATIONS - printf("dFrhos = "); - for(DENSITY_TYPE p =0; pndensity; - for (DENSITY_TYPE p = 0; p < ndensity; ++p) { - //for rank=1 (r=0) only 1 ms-combination exists (ms_ind=0), so index of func.ctildes is 0..ndensity-1 - weights_rank1(func->mus[0], func->ns[0] - 1) += dF_drho(p) * func->ctildes[p]; - } - } - - /* --------- we now continue with the recursive code --------- */ - - if (recursive) { - /* STAGE 2: BACKWARD PASS */ - int i1, i2; - ACEComplex AA1{0.0}; - ACEComplex AA2{0.0}; - ACEComplex wcur{0.0}; - int num2_int = dag.get_num2_int(); - int num2_leaf = dag.get_num2_leaf(); - /* to prepare for the backward we first need to zero the weights */ - dag.w.fill({0.0}); - - int * dag_nodes = dag.nodes.get_data(); - int idx_nodes = 2 * (num2_int + num2_leaf) - 1; - - DOUBLE_TYPE * dag_coefs = dag.coeffs.get_data(); - int idx_coefs = ndensity * (num2_int + num2_leaf) - 1; - - for (int idx = num1+num2_int+num2_leaf - 1; idx >= num1; idx--) { - i2 = dag_nodes[idx_nodes]; idx_nodes--; - i1 = dag_nodes[idx_nodes]; idx_nodes--; - AA1 = dag.AAbuf(i1); - AA2 = dag.AAbuf(i2); - wcur = dag.w(idx); // [***] - for (int p = ndensity-1; p >= 0; p--, idx_coefs--) - wcur += dF_drho(p) * dag_coefs[idx_coefs]; - dag.w(i1) += wcur * AA2; // TODO: replace with explicit muladd? - dag.w(i2) += wcur * AA1; - } - - /* [***] - * Note that these weights don't really need to be stored for the - * leaf nodes. We tested splitting this for loop into two where - * for the leaf nodes the weight would just be initialized to 0.0 - * instead of reading from an array. The improvement was barely - * measurable, ca 3%, so we reverted to this simpler algorithm - */ - - - } else { - - // non-recursive ACE.jl style implemenation of gradients, but with - // a backward differentiation approach to the prod-A - // (cf. Algorithm 3 in the manuscript) - - dag.w.fill({0.0}); - ACEComplex AAf{1.0}, AAb{1.0}, theta{0.0}; - - int *AAspec = jl_AAspec_flat.get_data(); - DOUBLE_TYPE *coeffs = jl_coeffs.get_data(); - int idx_spec = 0; - int idx_coefs = 0; - int order = 0; - int max_order = jl_AAspec.get_dim(1); - for (int iAA = 0; iAA < jl_AAspec.get_dim(0); iAA ++ ) { - order = jl_orders(iAA); - theta = 0.0; - for (int p = 0; p < ndensity; p++, idx_coefs++) - theta += dF_drho(p) * coeffs[idx_coefs]; - dA[0] = 1.0; - AAf = 1.0; - for (int t = 0; t < order-1; t++, idx_spec++) { - spec[t] = AAspec[idx_spec]; - A_cache[t] = dag.AAbuf(spec[t]); - AAf *= A_cache[t]; - dA[t+1] = AAf; - } - spec[order-1] = AAspec[idx_spec]; idx_spec++; - A_cache[order-1] = dag.AAbuf(spec[order-1]); - AAb = 1.0; - for (int t = order-1; t >= 1; t--) { - AAb *= A_cache[t]; - dA[t-1] *= AAb; - dag.w(spec[t]) += theta * dA[t]; - } - dag.w(spec[0]) += theta * dA[0]; - } - - } - - /* STAGE 3: - * get the gradients from the 1-particle basis gradients and write them - * into the dF/drho derivatives. - */ - /* In order to reuse the original PACE code, we copy the weights back - * into the the PACE datastructure. */ - - for (int idx = 0; idx < num1; idx++) { - int m = dag.Aspec(idx, 3); - if (m >= 0) { - weights(dag.Aspec(idx, 0), // mu - dag.Aspec(idx, 1) - 1, // n - dag.Aspec(idx, 2), // l - m ) += dag.w(idx); - } else { - int factor = (m % 2 == 0 ? 1 : -1); - weights(dag.Aspec(idx, 0), // mu - dag.Aspec(idx, 1) - 1, // n - dag.Aspec(idx, 2), // l - -m ) += factor * dag.w(idx).conjugated(); - } - } - - - /* ------ From here we are now back to the original PACE code ---- */ - -// ==================== FORCES ==================== -#ifdef PRINT_MAIN_STEPS - printf("\nFORCE CALCULATION\n"); - printf("loop over neighbours\n"); -#endif - -// loop over neighbour atoms for force calculations - for (jj = 0; jj < jnum_actual; ++jj) { - mu_j = elements[jj]; - r_hat = rhats[jj]; - inv_r_norm = inv_r_norms[jj]; - - Array2DLM &Y_cache_jj = Y_cache(jj); - Array2DLM &DY_cache_jj = DY_cache(jj); - -#ifdef PRINT_LOOPS_INDICES - printf("\nneighbour atom #%d\n", jj); - printf("rhat = (%f, %f, %f)\n", r_hat[0], r_hat[1], r_hat[2]); -#endif - - forces_calc_neighbour_timer.start(); - - f_ji[0] = f_ji[1] = f_ji[2] = 0; - -//for rank = 1 - for (n = 0; n < nradbasei; ++n) { - if (weights_rank1(mu_j, n) == 0) - continue; - auto &DG = DG_cache(jj, n); - DGR = DG * Y00; - DGR *= weights_rank1(mu_j, n); -#ifdef DEBUG_FORCES_CALCULATIONS - printf("r=1: (n,l,m)=(%d, 0, 0)\n",n+1); - printf("\tGR(n=%d, r=%f)=%f\n",n+1,r_norm, gr(n)); - printf("\tDGR(n=%d, r=%f)=%f\n",n+1,r_norm, dgr(n)); - printf("\tdF+=(%f, %f, %f)\n",DGR * r_hat[0], DGR * r_hat[1], DGR * r_hat[2]); -#endif - f_ji[0] += DGR * r_hat[0]; - f_ji[1] += DGR * r_hat[1]; - f_ji[2] += DGR * r_hat[2]; - } - -//for rank > 1 - for (n = 0; n < nradiali; n++) { - for (l = 0; l <= lmaxi; l++) { - R_over_r = R_cache(jj, n, l) * inv_r_norm; - DR = DR_cache(jj, n, l); - - // for m>=0 - for (m = 0; m <= l; m++) { - ACEComplex w = weights(mu_j, n, l, m); - if (w == 0) - continue; - //counting for -m cases if m>0 - // if (m > 0) w *= 2; // not needed for recursive eval - - DY = DY_cache_jj(l, m); - Y_DR = Y_cache_jj(l, m) * DR; - - grad_phi_nlm.a[0] = Y_DR * r_hat[0] + DY.a[0] * R_over_r; - grad_phi_nlm.a[1] = Y_DR * r_hat[1] + DY.a[1] * R_over_r; - grad_phi_nlm.a[2] = Y_DR * r_hat[2] + DY.a[2] * R_over_r; -#ifdef DEBUG_FORCES_CALCULATIONS - printf("d_phi(n=%d, l=%d, m=%d) = ((%f,%f), (%f,%f), (%f,%f))\n",n+1,l,m, - grad_phi_nlm.a[0].real, grad_phi_nlm.a[0].img, - grad_phi_nlm.a[1].real, grad_phi_nlm.a[1].img, - grad_phi_nlm.a[2].real, grad_phi_nlm.a[2].img); - - printf("weights(n,l,m)(%d,%d,%d) = (%f,%f)\n", n+1, l, m, w.real, w.img); - //if (m>0) w*=2; - printf("dF(n,l,m)(%d, %d, %d) += (%f, %f, %f)\n", n + 1, l, m, - w.real_part_product(grad_phi_nlm.a[0]), - w.real_part_product(grad_phi_nlm.a[1]), - w.real_part_product(grad_phi_nlm.a[2]) - ); -#endif -// real-part multiplication only - f_ji[0] += w.real_part_product(grad_phi_nlm.a[0]); - f_ji[1] += w.real_part_product(grad_phi_nlm.a[1]); - f_ji[2] += w.real_part_product(grad_phi_nlm.a[2]); - } - } - } - - -#ifdef PRINT_INTERMEDIATE_VALUES - printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, - f_ji[0], f_ji[1], f_ji[2] - ); -#endif - - //hard-core repulsion - DCR = DCR_cache(jj); -#ifdef DEBUG_FORCES_CALCULATIONS - printf("DCR = %f\n",DCR); -#endif - f_ji[0] += dF_drho_core * DCR * r_hat[0]; - f_ji[1] += dF_drho_core * DCR * r_hat[1]; - f_ji[2] += dF_drho_core * DCR * r_hat[2]; -#ifdef PRINT_INTERMEDIATE_VALUES - printf("with core-repulsion\n"); - printf("f_ji(jj=%d, i=%d)=(%f, %f, %f)\n", jj, i, - f_ji[0], f_ji[1], f_ji[2] - ); - printf("neighbour_index_mapping[jj=%d]=%d\n",jj,neighbour_index_mapping[jj]); -#endif - - neighbours_forces(neighbour_index_mapping[jj], 0) = f_ji[0]; - neighbours_forces(neighbour_index_mapping[jj], 1) = f_ji[1]; - neighbours_forces(neighbour_index_mapping[jj], 2) = f_ji[2]; - - forces_calc_neighbour_timer.stop(); - }// end loop over neighbour atoms for forces - - forces_calc_loop_timer.stop(); - - //now, energies and forces are ready - //energies(i) = evdwl + rho_core; - e_atom = evdwl_cut; - -#ifdef PRINT_INTERMEDIATE_VALUES - printf("energies(i) = FS(...rho_p_accum...) = %f\n", evdwl); -#endif - per_atom_calc_timer.stop(); -} \ No newline at end of file diff --git a/lib/pace/ace_recursive.h b/lib/pace/ace_recursive.h deleted file mode 100644 index 78e74feb86..0000000000 --- a/lib/pace/ace_recursive.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Christoph Ortner on 20.12.2020 - -#ifndef ACE_RECURSIVE_H -#define ACE_RECURSIVE_H - -#include "ace_abstract_basis.h" -#include "ace_arraynd.h" -#include "ace_array2dlm.h" -#include "ace_c_basis.h" -#include "ace_complex.h" -#include "ace_timing.h" -#include "ace_types.h" -#include "ace_evaluator.h" - -#include -#include -#include -#include -#include - -using namespace std; - - -typedef pair, vector > TPARTITION; -typedef list TPARTITIONS; - -typedef map, int> TDAGMAP; - -class ACEDAG { - - TPARTITIONS find_2partitions(vector v); - - void insert_node(TDAGMAP &dagmap, - vector node, - vector c); - - // the following fields are used only for *construction*, not evaluation - int dag_idx; // current index of dag node - Array2D nodes_pre; //TODO: YL: better to use vector<> - Array2D coeffs_pre; //TODO: YL: better to use vector<> - Array1D haschild; //TODO: YL: better to use vector<> - - /* which heuristic to choose for DAG construction? - * 0 : the simple original heuristic - * 1 : prioritize 2-correlation nodes and build the rest from those - */ - int heuristic = 0; - -public: - - ACEDAG() = default; - - void init(Array2D Aspec, Array2D AAspec, - Array1D orders, Array2D coeffs, - int heuristic ); - - Array1D AAbuf; - Array1D w; - - Array2D Aspec; - - // nodes in the graph - Array2D nodes; - Array2D coeffs; - - // total number of nodes in the dag - int num_nodes; - // number of interior nodes (with children) - int num2_int; - // number of leaf nodes (nc = no child) - int num2_leaf; - - - // number of 1-particle basis functions - // (these will be stored in the first num1 entries of AAbuf) - int get_num1() { return Aspec.get_dim(0); }; - // total number of n-correlation basis functions n > 1. - int get_num2() { return num_nodes - get_num1(); }; - int get_num2_int() { return num2_int; }; // with children - int get_num2_leaf() { return num2_leaf; }; // without children - - // debugging tool - void print(); -}; - - -/** - * Recursive Variant of the ACETildeEvaluator; should be 100% compatible - */ -class ACERecursiveEvaluator : public ACEEvaluator { - - /** - * Weights \f$ \omega_{i \mu n 0 0} \f$ for rank = 1, see Eq.(10) from implementation notes, - * 'i' is fixed for the current atom, shape: [nelements][nradbase] - */ - Array2D weights_rank1 = Array2D("weights_rank1"); - - /** - * Weights \f$ \omega_{i \mu n l m} \f$ for rank > 1, see Eq.(10) from implementation notes, - * 'i' is fixed for the current atom, shape: [nelements][nradbase][l=0..lmax, m] - */ - Array4DLM weights = Array4DLM("weights"); - - /** - * cache for gradients of \f$ g(r)\f$: grad_phi(jj,n)=A2DLM(l,m) - * shape:[max_jnum][nradbase] - */ - Array2D DG_cache = Array2D("DG_cache"); - - - /** - * cache for \f$ R_{nl}(r)\f$ - * shape:[max_jnum][nradbase][0..lmax] - */ - Array3D R_cache = Array3D("R_cache"); - /** - * cache for derivatives of \f$ R_{nl}(r)\f$ - * shape:[max_jnum][nradbase][0..lmax] - */ - Array3D DR_cache = Array3D("DR_cache"); - /** - * cache for \f$ Y_{lm}(\hat{r})\f$ - * shape:[max_jnum][0..lmax][m] - */ - Array3DLM Y_cache = Array3DLM("Y_cache"); - /** - * cache for \f$ \nabla Y_{lm}(\hat{r})\f$ - * shape:[max_jnum][0..lmax][m] - */ - Array3DLM DY_cache = Array3DLM("dY_dense_cache"); - - /** - * cache for derivatives of hard-core repulsion - * shape:[max_jnum] - */ - Array1D DCR_cache = Array1D("DCR_cache"); - - /** - * Partial derivatives \f$ dB_{i \mu n l m t}^{(r)} \f$ with sequential numbering over [func_ind][ms_ind][r], - * shape:[func_ms_r_ind] - */ - Array1D dB_flatten = Array1D("dB_flatten"); - - /** - * pointer to the ACEBasisSet object - */ - ACECTildeBasisSet *basis_set = nullptr; - - /** - * Initialize internal arrays according to basis set sizes - * @param basis_set - */ - void init(ACECTildeBasisSet *basis_set, int heuristic); - - /* convert the PACE to the ACE.jl format to prepare for DAG construction*/ - Array2D jl_Aspec; - Array2D jl_AAspec; - Array1D jl_AAspec_flat; - Array1D jl_orders; - Array2D jl_coeffs; - void acejlformat(); - - /* the main event : the computational graph */ - ACEDAG dag; - - bool recursive = true; - -public: - - - ACERecursiveEvaluator() = default; - - explicit ACERecursiveEvaluator(ACECTildeBasisSet &bas, - bool recursive = true) { - set_recursive(recursive); - set_basis(bas); - } - - /** - * set the basis function to the ACE evaluator - * @param bas - */ - void set_basis(ACECTildeBasisSet &bas, int heuristic = 0); - - /** - * The key method to compute energy and forces for atom 'i'. - * Method will update the "e_atom" variable and "neighbours_forces(jj, alpha)" array - * - * @param i atom index - * @param x atomic positions array of the real and ghost atoms, shape: [atom_ind][3] - * @param type atomic types array of the real and ghost atoms, shape: [atom_ind] - * @param jnum number of neighbours of atom_i - * @param jlist array of neighbour indices, shape: [jnum] - */ - void compute_atom(int i, DOUBLE_TYPE **x, const SPECIES_TYPE *type, const int jnum, const int *jlist) override; - - /** - * Resize all caches over neighbours atoms - * @param max_jnum maximum number of neighbours - */ - void resize_neighbours_cache(int max_jnum) override; - - /******* public functions related to recursive evaluator ********/ - - // print out the DAG for visual inspection - void print_dag() {dag.print();} - - // print out the jl format for visual inspection - // should be converted into a proper test - void test_acejlformat(); - - void set_recursive(bool tf) { recursive = tf; } - - /********************************/ - -}; - - -#endif //ACE_RECURSIVE_H \ No newline at end of file diff --git a/lib/pace/ace_spherical_cart.cpp b/lib/pace/ace_spherical_cart.cpp deleted file mode 100644 index f1f0fccced..0000000000 --- a/lib/pace/ace_spherical_cart.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Ralf Drautz, Yury Lysogorskiy - -#include - -#include "ace_spherical_cart.h" - -ACECartesianSphericalHarmonics::ACECartesianSphericalHarmonics(LS_TYPE lm) { - init(lm); -} - -void ACECartesianSphericalHarmonics::init(LS_TYPE lm) { - lmax = lm; - - alm.init(lmax, "alm"); - blm.init(lmax, "blm"); - cl.init(lmax + 1); - dl.init(lmax + 1); - - plm.init(lmax, "plm"); - dplm.init(lmax, "dplm"); - - ylm.init(lmax, "ylm"); - dylm.init(lmax, "dylm"); - - pre_compute(); -} - -/** -Destructor for ACECartesianSphericalHarmonics. - -@param None - -@returns None -*/ -ACECartesianSphericalHarmonics::~ACECartesianSphericalHarmonics() {} - - -void ACECartesianSphericalHarmonics::pre_compute() { - - DOUBLE_TYPE a, b; - DOUBLE_TYPE lsq, ld, l1, l2; - DOUBLE_TYPE msq; - - for (LS_TYPE l = 1; l <= lmax; l++) { - lsq = l * l; - ld = 2 * l; - l1 = (4 * lsq - 1); - l2 = lsq - ld + 1; - for (MS_TYPE m = 0; m < l - 1; m++) { - msq = m * m; - a = sqrt((DOUBLE_TYPE(l1)) / (DOUBLE_TYPE(lsq - msq))); - b = -sqrt((DOUBLE_TYPE(l2 - msq)) / (DOUBLE_TYPE(4 * l2 - 1))); - alm(l, m) = a; - blm(l, m) = b; - } - } - - for (LS_TYPE l = 1; l <= lmax; l++) { - cl(l) = -sqrt(1.0 + 0.5 / (DOUBLE_TYPE(l))); - dl(l) = sqrt(DOUBLE_TYPE(2 * (l - 1) + 3)); - } -} - - -void ACECartesianSphericalHarmonics::compute_barplm(DOUBLE_TYPE rz, LS_TYPE lmaxi) { - - // requires -1 <= rz <= 1 , NO CHECKING IS PERFORMED !!!!!!!!! - // prefactors include 1/sqrt(2) factor compared to reference - DOUBLE_TYPE t; - - // l=0, m=0 - //plm(0, 0) = Y00/sq1o4pi; //= sq1o4pi; - plm(0, 0) = Y00; //= 1; - dplm(0, 0) = 0.0; - - if (lmaxi > 0) { - - // l=1, m=0 - plm(1, 0) = Y00 * sq3 * rz; - dplm(1, 0) = Y00 * sq3; - - // l=1, m=1 - plm(1, 1) = -sq3o2 * Y00; - dplm(1, 1) = 0.0; - - // loop l = 2, lmax - for (LS_TYPE l = 2; l <= lmaxi; l++) { - for (MS_TYPE m = 0; m < l - 1; m++) { - plm(l, m) = alm(l, m) * (rz * plm(l - 1, m) + blm(l, m) * plm(l - 2, m)); - dplm(l, m) = alm(l, m) * (plm(l - 1, m) + rz * dplm(l - 1, m) + blm(l, m) * dplm(l - 2, m)); - } - t = dl(l) * plm(l - 1, l - 1); - plm(l, l - 1) = t * rz; - dplm(l, l - 1) = t; - plm(l, l) = cl(l) * plm(l - 1, l - 1); - dplm(l, l) = 0.0; - } - } -} //end compute_barplm - - -void ACECartesianSphericalHarmonics::compute_ylm(DOUBLE_TYPE rx, DOUBLE_TYPE ry, DOUBLE_TYPE rz, LS_TYPE lmaxi) { - - // requires rx^2 + ry^2 + rz^2 = 1 , NO CHECKING IS PERFORMED !!!!!!!!! - - DOUBLE_TYPE real; - DOUBLE_TYPE img; - MS_TYPE m; - ACEComplex phase; - ACEComplex phasem, mphasem1; - ACEComplex dyx, dyy, dyz; - ACEComplex rdy; - - phase.real = rx; - phase.img = ry; - //compute barplm - compute_barplm(rz, lmaxi); - - //m = 0 - m = 0; - for (LS_TYPE l = 0; l <= lmaxi; l++) { - - ylm(l, m).real = plm(l, m); - ylm(l, m).img = 0.0; - - dyz.real = dplm(l, m); - rdy.real = dyz.real * rz; - - dylm(l, m).a[0].real = -rdy.real * rx; - dylm(l, m).a[0].img = 0.0; - dylm(l, m).a[1].real = -rdy.real * ry; - dylm(l, m).a[1].img = 0.0; - dylm(l, m).a[2].real = dyz.real - rdy.real * rz; - dylm(l, m).a[2].img = 0; - } - //m = 0 - m = 1; - for (LS_TYPE l = 1; l <= lmaxi; l++) { - - ylm(l, m) = phase * plm(l, m); - -// std::cout << "Re ylm(" << l << "," << m <<")= " << ylm(l, m).real << std::endl; -// std::cout << "Im ylm(" << l << "," << m <<")= " << ylm(l, m).img << std::endl; - - dyx.real = plm(l, m); - dyx.img = 0.0; - dyy.real = 0.0; - dyy.img = plm(l, m); - dyz.real = phase.real * dplm(l, m); - dyz.img = phase.img * dplm(l, m); - - rdy.real = rx * dyx.real + +rz * dyz.real; - rdy.img = ry * dyy.img + rz * dyz.img; - - dylm(l, m).a[0].real = dyx.real - rdy.real * rx; - dylm(l, m).a[0].img = -rdy.img * rx; - dylm(l, m).a[1].real = -rdy.real * ry; - dylm(l, m).a[1].img = dyy.img - rdy.img * ry; - dylm(l, m).a[2].real = dyz.real - rdy.real * rz; - dylm(l, m).a[2].img = dyz.img - rdy.img * rz; - } - - // m > 1 - phasem = phase; - for (MS_TYPE m = 2; m <= lmaxi; m++) { - - mphasem1.real = phasem.real * DOUBLE_TYPE(m); - mphasem1.img = phasem.img * DOUBLE_TYPE(m); - phasem = phasem * phase; - - for (LS_TYPE l = m; l <= lmaxi; l++) { - - ylm(l, m).real = phasem.real * plm(l, m); - ylm(l, m).img = phasem.img * plm(l, m); - - dyx = mphasem1 * plm(l, m); - dyy.real = -dyx.img; - dyy.img = dyx.real; - dyz = phasem * dplm(l, m); - - rdy.real = rx * dyx.real + ry * dyy.real + rz * dyz.real; - rdy.img = rx * dyx.img + ry * dyy.img + rz * dyz.img; - - dylm(l, m).a[0].real = dyx.real - rdy.real * rx; - dylm(l, m).a[0].img = dyx.img - rdy.img * rx; - dylm(l, m).a[1].real = dyy.real - rdy.real * ry; - dylm(l, m).a[1].img = dyy.img - rdy.img * ry; - dylm(l, m).a[2].real = dyz.real - rdy.real * rz; - dylm(l, m).a[2].img = dyz.img - rdy.img * rz; - } - } - -} - diff --git a/lib/pace/ace_spherical_cart.h b/lib/pace/ace_spherical_cart.h deleted file mode 100644 index b2a0cb5913..0000000000 --- a/lib/pace/ace_spherical_cart.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Ralf Drautz, Yury Lysogorskiy - -#ifndef ACE_SPHERICAL_CART_H -#define ACE_SPHERICAL_CART_H - -#include - -#include "ace_arraynd.h" -#include "ace_array2dlm.h" -#include "ace_complex.h" -#include "ace_types.h" - - -using namespace std; - -const DOUBLE_TYPE sq1o4pi = 0.28209479177387814347; // sqrt(1/(4*pi)) -const DOUBLE_TYPE sq4pi = 3.54490770181103176384; // sqrt(4*pi) -const DOUBLE_TYPE sq3 = 1.73205080756887719318;//sqrt(3), numpy -const DOUBLE_TYPE sq3o2 = 1.22474487139158894067;//sqrt(3/2), numpy - -//definition of common factor for spherical harmonics = Y00 -//const DOUBLE_TYPE Y00 = sq1o4pi; -const DOUBLE_TYPE Y00 = 1; - -/** -Class to store spherical harmonics and their associated functions. \n -All the associated members such as \f$ P_{lm}, Y_{lm}\f$ etc are one dimensional arrays of length (L+1)*(L+2)/2. \n -The value that corresponds to a particular l, m configuration can be accessed through a \code ylm(l,m) \endcode \n -*/ -class ACECartesianSphericalHarmonics { -public: - - /** - int, the number of spherical harmonics to be found - */ - LS_TYPE lmax; - - /** - * Default constructor - */ - ACECartesianSphericalHarmonics() = default; - - /** - * Parametrized constructor. Dynamically initialises all the arrays. - * @param lmax maximum orbital moment - */ - explicit ACECartesianSphericalHarmonics(LS_TYPE lmax); - - /** - * Initialize internal arrays and precompute necessary coefficients - * @param lm maximum orbital moment - */ - void init(LS_TYPE lm); - - /** - * Destructor - */ - ~ACECartesianSphericalHarmonics(); - - /** - * Precompute necessaary helper arrays Precomputes the value of \f$ a_{lm}, b_{lm}, c_l, d_l \f$ - */ - void pre_compute(); - - /** - Function that computes \f$ \bar{P}_{lm} \f$ for the corresponding lmax value - Input is \f$ \hat{r}_z \f$ which is the $z$-component of the bond direction. - - For each \f$ \hat{r}_z \f$, this computes the whole range of \f$ \bar{P}_{lm} \f$ values - and its derivatives upto the lmax specified, which is a member of the class. - - @param rz, DOUBLE_TYPE - - @returns None - */ - void compute_barplm(DOUBLE_TYPE rz, LS_TYPE lmaxi); - - /** - Function that computes \f$ Y_{lm} \f$ for the corresponding lmax value - Input is the bond-directon vector \f$ \hat{r}_x, \hat{r}_y, \hat{r}_z \f$ - - Each \f$ Y_{lm} \f$ value is a ACEComplex object with real and imaginary parts. This function also - finds the derivatives, which are stored in the Dycomponent class, with each component being a - ACEComplex object. - - @param rx, DOUBLE_TYPE - @param ry, DOUBLE_TYPE - @param rz, DOUBLE_TYPE - @param lmaxi, int - */ - void compute_ylm(DOUBLE_TYPE rx, DOUBLE_TYPE ry, DOUBLE_TYPE rz, LS_TYPE lmaxi); - - Array2DLM alm; - Array2DLM blm; - Array1D cl; - Array1D dl; - - Array2DLM plm; - Array2DLM dplm; - - Array2DLM ylm; ///< Values of all spherical harmonics after \code compute_ylm(rx,ry,rz, lmaxi) \endcode call - Array2DLM dylm;///< Values of gradients of all spherical harmonics after \code compute_ylm(rx,ry,rz, lmaxi) \endcode call - -}; - - -#endif diff --git a/lib/pace/ace_timing.h b/lib/pace/ace_timing.h deleted file mode 100644 index 7f5243eb99..0000000000 --- a/lib/pace/ace_timing.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Yury Lysogorskiy on 19.02.20. - -#ifndef ACE_TIMING_H -#define ACE_TIMING_H - -#include - -using namespace std::chrono; -using Clock = std::chrono::high_resolution_clock; -using TimePoint = std::chrono::time_point; -using Duration = Clock::duration; - -////////////////////////////////////////// -#ifdef FINE_TIMING -/** - * Helper class for timing the code. - * The timer should be initialized to reset measured time and - * then call "start" and "stop" before and after measured code. - * The measured time is stored in "duration" variable - */ -struct ACETimer { - Duration duration; ///< measured duration - TimePoint start_moment; ///< start moment of current measurement - - ACETimer() { init(); }; - - /** - * Reset timer - */ - void init() { duration = std::chrono::nanoseconds(0); } - - /** - * Start timer - */ - void start() { start_moment = Clock::now(); } - - /** - * Stop timer, update measured "duration" - */ - void stop() { duration += Clock::now() - start_moment; } - - /** - * Get duration in microseconds - */ - long as_microseconds() { return std::chrono::duration_cast(duration).count(); } - - /** - * Get duration in nanoseconds - */ - long as_nanoseconds() { return std::chrono::duration_cast(duration).count(); } - -}; - -#else // EMPTY Definitions -/** - * Helper class for timing the code. - * The timer should be initialized to reset measured time and - * then call "start" and "stop" before and after measured code. - * The measured time is stored in "duration" variable - */ -struct ACETimer { - Duration duration; ///< measured duration - TimePoint start_moment; ///< start moment of current measurement - - ACETimer() {}; - - /** - * Reset timer - */ - void init() {} - - /** - * Start timer - */ - void start() {} - - /** - * Stop timer, update measured "duration" - */ - void stop() {} - - /** - * Get duration in microseconds - */ - long as_microseconds() {return 0; } - - /** - * Get duration in nanoseconds - */ - long as_nanoseconds() {return 0; } - -}; - -#endif -////////////////////////////////////////// - - -#endif //ACE_TIMING_H diff --git a/lib/pace/ace_types.h b/lib/pace/ace_types.h deleted file mode 100644 index f9b3cf7267..0000000000 --- a/lib/pace/ace_types.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Yury Lysogorskiy on 20.01.20. - -#ifndef ACE_TYPES_H -#define ACE_TYPES_H - -typedef char RANK_TYPE; -typedef int SPECIES_TYPE; -typedef short int NS_TYPE; -typedef short int LS_TYPE; - -typedef short int DENSITY_TYPE; - -typedef short int MS_TYPE; - -typedef short int SHORT_INT_TYPE; -typedef double DOUBLE_TYPE; - -#endif \ No newline at end of file diff --git a/lib/pace/ace_version.h b/lib/pace/ace_version.h deleted file mode 100644 index 9d61e5c505..0000000000 --- a/lib/pace/ace_version.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Lysogorskiy Yury on 07.04.2020. - -#ifndef ACE_VERSION_H -#define ACE_VERSION_H - -#define VERSION_YEAR 2021 -#define VERSION_MONTH 2 -#define VERSION_DAY 3 - -#endif //ACE_VERSION_Hls - diff --git a/lib/pace/ships_radial.cpp b/lib/pace/ships_radial.cpp deleted file mode 100644 index e948f03f21..0000000000 --- a/lib/pace/ships_radial.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Created by Christoph Ortner on 03.06.2020 - -#include "ships_radial.h" - -#include -#include -#include - - -using namespace std; - -void SHIPsRadPolyBasis::_init(DOUBLE_TYPE r0, int p, DOUBLE_TYPE rcut, - DOUBLE_TYPE xl, DOUBLE_TYPE xr, - int pl, int pr, size_t maxn) { - this->p = p; - this->r0 = r0; - this->rcut = rcut; - this->xl = xl; - this->xr = xr; - this->pl = pl; - this->pr = pr; - this->maxn = maxn; - this->A.resize(maxn); - this->B.resize(maxn); - this->C.resize(maxn); - this->P.resize(maxn); - this->dP_dr.resize(maxn); -} - - -void SHIPsRadPolyBasis::fread(FILE *fptr) -{ - int res; //for fscanf result - int maxn, p, pl, pr, ntests; - double r0, xl, xr, a, b, c, rcut; - - // transform parameters - res = fscanf(fptr, "transform parameters: p=%d r0=%lf\n", &p, &r0); - if (res != 2) - throw invalid_argument("Couldn't read line: transform parameters: p=%d r0=%lf"); - // cutoff parameters - res = fscanf(fptr, "cutoff parameters: rcut=%lf xl=%lf xr=%lf pl=%d pr=%d\n", - &rcut, &xl, &xr, &pl, &pr); - if (res != 5) - throw invalid_argument("Couldn't read cutoff parameters: rcut=%lf xl=%lf xr=%lf pl=%d pr=%d"); - // basis size - res = fscanf(fptr, "recursion coefficients: maxn = %d\n", &maxn); - if (res != 1) - throw invalid_argument("Couldn't read recursion coefficients: maxn = %d"); - // initialize and allocate - this->_init(r0, p, rcut, xl, xr, pl, pr, maxn); - - // read basis coefficients - for (int i = 0; i < maxn; i++) { - res = fscanf(fptr, " %lf %lf %lf\n", &a, &b, &c); - if (res != 3) - throw invalid_argument("Couldn't read line: A_n B_n C_n"); - this->A(i) = DOUBLE_TYPE(a); - this->B(i) = DOUBLE_TYPE(b); - this->C(i) = DOUBLE_TYPE(c); - } - - // // check there are no consistency tests (I don't have time to fix this now) - // res = fscanf(fptr, "tests: ntests = %d\n", &ntests); - // if (res != 1) - // throw invalid_argument("Couldn't read line: tests: ntests = %d"); - // if (ntests != 0) - // throw invalid_argument("must have ntests = 0!"); - - // --------------------------------------------------------------------- - // run the consistency test this could be moved into a separate function - double r, Pn, dPn; - double err = 0.0; - - res = fscanf(fptr, "tests: ntests = %d\n", &ntests); - if (res != 1) - throw invalid_argument("Couldn't read line: tests: ntests = %d"); - for (size_t itest = 0; itest < ntests; itest++) { - // read an r argument - res = fscanf(fptr, " r=%lf\n", &r); - // printf("r = %lf \n", r); - if (res != 1) - throw invalid_argument("Couldn't read line: r=%lf"); - // printf("test %d, r=%f, maxn=%d \n", itest, r, maxn); - // evaluate the basis - this->calcP(r, maxn, SPECIES_TYPE(0), SPECIES_TYPE(0)); - // compare against the stored values - for (size_t n = 0; n < maxn; n++) { - res = fscanf(fptr, " %lf %lf\n", &Pn, &dPn); - if (res != 2) - throw invalid_argument("Couldn't read test value line: %lf %lf"); - err = max(err, abs(Pn - this->P(n)) + abs(dPn - this->dP_dr(n))); - // printf(" %d %e %e \n", int(n), - // abs(Pn - this->P(n)), - // abs(dPn - this->dP_dr(n))); - } - } - if (ntests > 0) - printf("Maximum Test error = %e\n", err); - // --------------------------------------------------------------------- - -} - - - - -size_t SHIPsRadPolyBasis::get_maxn() -{ - return this->maxn; -} - - -// Julia code: ((1+r0)/(1+r))^p -void SHIPsRadPolyBasis::transform(const DOUBLE_TYPE r, DOUBLE_TYPE &x_out, DOUBLE_TYPE &dx_out) const { - x_out = pow((1 + r0) / (1 + r), p); // ==pow( (1 + r) / (1 + r0), -p ); - dx_out = -p * pow((1 + r) / (1 + r0), -p - 1) / (1 + r0); -} - -void SHIPsRadPolyBasis::fcut(const DOUBLE_TYPE x, DOUBLE_TYPE &f_out, DOUBLE_TYPE &df_out) const { - if ( ((x < xl) && (pl > 0)) || ((x > xr) && (pr > 0)) ) { - f_out = 0.0; - df_out = 0.0; - } else { - f_out = pow(x - xl, pl) * pow(x - xr, pr); - df_out = pl * pow(x - xl, pl - 1) * pow(x - xr, pr) + pow(x - xl, pl) * pr * pow(x - xr, pr - 1); - } -} - - /* ------------------------------------------------------------------------ -Julia Code -P[1] = J.A[1] * _fcut_(J.pl, J.tl, J.pr, J.tr, t) -if length(J) == 1; return P; end -P[2] = (J.A[2] * t + J.B[2]) * P[1] -@inbounds for n = 3:length(J) - P[n] = (J.A[n] * t + J.B[n]) * P[n-1] + J.C[n] * P[n-2] -end -return P ------------------------------------------------------------------------- */ - -void SHIPsRadPolyBasis::calcP(DOUBLE_TYPE r, size_t maxn, - SPECIES_TYPE z1, SPECIES_TYPE z2) { - if (maxn > this->maxn) - throw invalid_argument("Given maxn couldn't be larger than global maxn"); - - if (maxn > P.get_size()) - throw invalid_argument("Given maxn couldn't be larger than global length of P"); - - DOUBLE_TYPE x, dx_dr; // dx -> dx/dr - transform(r, x, dx_dr); - // printf("r = %f, x = %f, fcut = %f \n", r, x, fcut(x)); - DOUBLE_TYPE f, df_dx; - fcut(x, f, df_dx); // df -> df/dx - - //fill with zeros - P.fill(0); - dP_dr.fill(0); - - P(0) = A(0) * f; - dP_dr(0) = A(0) * df_dx * dx_dr; // dP/dr; chain rule: df_cut/dr = df_cut/dx * dx/dr - if (maxn > 0) { - P(1) = (A(1) * x + B(1)) * P(0); - dP_dr(1) = A(1) * dx_dr * P(0) + (A(1) * x + B(1)) * dP_dr(0); - } - for (size_t n = 2; n < maxn; n++) { - P(n) = (A(n) * x + B(n)) * P(n - 1) + C(n) * P(n - 2); - dP_dr(n) = A(n) * dx_dr * P(n - 1) + (A(n) * x + B(n)) * dP_dr(n - 1) + C(n) * dP_dr(n - 2); - } -} - - -// ==================================================================== - - -bool SHIPsRadialFunctions::has_pair() { - return this->haspair; -} - -void SHIPsRadialFunctions::load(string fname) { - FILE * fptr = fopen(fname.data(), "r"); - size_t res = fscanf(fptr, "radbasename=ACE.jl.Basic\n"); - if (res != 0) - throw("SHIPsRadialFunctions::load : couldnt read radbasename=ACE.jl.Basic"); - this->fread(fptr); - fclose(fptr); -} - -void SHIPsRadialFunctions::fread(FILE *fptr){ - int res; - size_t maxn; - char hasE0, haspair; - DOUBLE_TYPE c; - - // check whether we have a pair potential - res = fscanf(fptr, "haspair: %c\n", &haspair); - if (res != 1) - throw("SHIPsRadialFunctions::load : couldn't read haspair"); - - // read the radial basis - this->radbasis.fread(fptr); - - // read the pair potential - if (haspair == 't') { - this->haspair=true; - fscanf(fptr, "begin repulsive potential\n"); - fscanf(fptr, "begin polypairpot\n"); - // read the basis parameters - pairbasis.fread(fptr); - maxn = pairbasis.get_maxn(); - // read the coefficients - fscanf(fptr, "coefficients\n"); - paircoeffs.resize(maxn); - for (size_t n = 0; n < maxn; n++) { - fscanf(fptr, "%lf\n", &c); - paircoeffs(n) = c; - } - fscanf(fptr, "end polypairpot\n"); - // read the spline parameters - fscanf(fptr, "spline parameters\n"); - fscanf(fptr, " e_0 + B exp(-A*(r/ri-1)) * (ri/r)\n"); - fscanf(fptr, "ri=%lf\n", &(this->ri)); - fscanf(fptr, "e0=%lf\n", &(this->e0)); - fscanf(fptr, "A=%lf\n", &(this->A)); - fscanf(fptr, "B=%lf\n", &(this->B)); - fscanf(fptr, "end repulsive potential\n"); - } -} - - -size_t SHIPsRadialFunctions::get_maxn() -{ - return this->radbasis.get_maxn(); -} - -DOUBLE_TYPE SHIPsRadialFunctions::get_rcut() -{ - return max(radbasis.rcut, pairbasis.rcut); -} - - -void SHIPsRadialFunctions::fill_gk(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2) { - radbasis.calcP(r, maxn, z1, z2); - for (NS_TYPE n = 0; n < maxn; n++) { - gr(n) = radbasis.P(n); - dgr(n) = radbasis.dP_dr(n); - } -} - - -void SHIPsRadialFunctions::fill_Rnl(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2) { - radbasis.calcP(r, maxn, z1, z2); - for (NS_TYPE n = 0; n < maxn; n++) { - for (LS_TYPE l = 0; l <= lmax; l++) { - fr(n, l) = radbasis.P(n); - dfr(n, l) = radbasis.dP_dr(n); - } - } -} - - -void SHIPsRadialFunctions::setuplookupRadspline() { -} - - -void SHIPsRadialFunctions::init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, - SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, string radbasename) { - //mimic ACERadialFunctions::init - this->nradbase = nradb; - this->lmax = lmax; - this->nradial = nradial; - this->deltaSplineBins = deltaSplineBins; - this->nelements = nelements; - this->cutoff = cutoff; - this->radbasename = radbasename; - - gr.init(nradbase, "gr"); - dgr.init(nradbase, "dgr"); - - - fr.init(nradial, lmax + 1, "fr"); - dfr.init(nradial, lmax + 1, "dfr"); - - splines_gk.init(nelements, nelements, "splines_gk"); - splines_rnl.init(nelements, nelements, "splines_rnl"); - splines_hc.init(nelements, nelements, "splines_hc"); - - lambda.init(nelements, nelements, "lambda"); - lambda.fill(1.); - - cut.init(nelements, nelements, "cut"); - cut.fill(1.); - - dcut.init(nelements, nelements, "dcut"); - dcut.fill(1.); - - crad.init(nelements, nelements, (lmax + 1), nradial, nradbase, "crad"); - crad.fill(0.); - - //hard-core repulsion - prehc.init(nelements, nelements, "prehc"); - prehc.fill(0.); - - lambdahc.init(nelements, nelements, "lambdahc"); - lambdahc.fill(1.); -} - - -void SHIPsRadialFunctions::evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, - SPECIES_TYPE mu_j, bool calc_second_derivatives) { - if (calc_second_derivatives) - throw invalid_argument("SHIPsRadialFunctions has not `calc_second_derivatives` option"); - - radbasis.calcP(r, nradbase_c, mu_i, mu_j); - for (NS_TYPE nr = 0; nr < nradbase_c; nr++) { - gr(nr) = radbasis.P(nr); - dgr(nr) = radbasis.dP_dr(nr); - } - for (NS_TYPE nr = 0; nr < nradial_c; nr++) { - for (LS_TYPE l = 0; l <= this->lmax; l++) { - fr(nr, l) = radbasis.P(nr); - dfr(nr, l) = radbasis.dP_dr(nr); - } - } - - if (this->has_pair()) - this->evaluate_pair(r, mu_i, mu_j); - else { - cr = 0; - dcr = 0; - } -} - -void SHIPsRadialFunctions::evaluate_pair(DOUBLE_TYPE r, - SPECIES_TYPE mu_i, - SPECIES_TYPE mu_j, - bool calc_second_derivatives) { - // spline_hc.calcSplines(r); - // cr = spline_hc.values(0); - // dcr = spline_hc.derivatives(0); - - // the outer polynomial potential - if (r > ri) { - pairbasis.calcP(r, pairbasis.get_maxn(), mu_i, mu_j); - cr = 0; - dcr = 0; - for (size_t n = 0; n < pairbasis.get_maxn(); n++) { - cr += paircoeffs(n) * pairbasis.P(n); - dcr += paircoeffs(n) * pairbasis.dP_dr(n); - } - } - else { // the repulsive core part - cr = e0 + B * exp(-A * (r/ri - 1)) * (ri/r); - dcr = B * exp( - A * (r/ri-1) ) * ri * ( - A / ri / r - 1/(r*r) ); - } - // fix double-counting - cr *= 0.5; - dcr *= 0.5; -} - - - diff --git a/lib/pace/ships_radial.h b/lib/pace/ships_radial.h deleted file mode 100644 index 60a82448cd..0000000000 --- a/lib/pace/ships_radial.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Performant implementation of atomic cluster expansion and interface to LAMMPS - * - * Copyright 2021 (c) Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, - * Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, - * Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1 - * - * ^1: Ruhr-University Bochum, Bochum, Germany - * ^2: University of Cambridge, Cambridge, United Kingdom - * ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA - * ^4: University of British Columbia, Vancouver, BC, Canada - * - * - * See the LICENSE file. - * This FILENAME is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Created by Christoph Ortner on 03.06.2020 - -#ifndef SHIPs_RADIAL_FUNCTIONS_H -#define SHIPs_RADIAL_FUNCTIONS_H - -#include "ace_arraynd.h" -#include "ace_types.h" -#include "ace_radial.h" - -class SHIPsRadPolyBasis { - -public: - - // transform parameters - int p = 0; - DOUBLE_TYPE r0 = 0.0; - - // cutoff parameters - DOUBLE_TYPE rcut = 0.0; - DOUBLE_TYPE xl = 0.0; - DOUBLE_TYPE xr = 0.0; - int pl = 0; - int pr = 0; - - // basis size - size_t maxn = 0; - - // recursion parameters - Array1D A = Array1D("SHIPs radial basis: A"); - Array1D B = Array1D("SHIPs radial basis: B"); - Array1D C = Array1D("SHIPs radial basis: C"); - - // temporary storage for evaluating the basis - Array1D P = Array1D("SHIPs radial basis: P"); - Array1D dP_dr = Array1D("SHIPs radial basis: dP"); - -////////////////////////////////// - - SHIPsRadPolyBasis() = default; - - ~SHIPsRadPolyBasis() = default; - - // distance transform - void transform(const DOUBLE_TYPE r, DOUBLE_TYPE &x_out, DOUBLE_TYPE &dx_out) const; - - // cutoff function - void fcut(const DOUBLE_TYPE x, DOUBLE_TYPE &f_out, DOUBLE_TYPE &df_out) const; - - void fread(FILE *fptr); - - void _init(DOUBLE_TYPE r0, int p, DOUBLE_TYPE rcut, - DOUBLE_TYPE xl, DOUBLE_TYPE xr, - int pl, int pr, size_t maxn); - - void calcP(DOUBLE_TYPE r, size_t maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); - - size_t get_maxn(); - -}; - - - - -class SHIPsRadialFunctions : public AbstractRadialBasis { -public: - - // radial basis - SHIPsRadPolyBasis radbasis; - - // pair potential basis - bool haspair = false; - SHIPsRadPolyBasis pairbasis; - - // pair potential coefficients - Array1D paircoeffs = Array1D("SHIPs pairpot coeffs: paircoeffs"); - - // spline parameters for repulsive core - DOUBLE_TYPE ri = 0.0; - DOUBLE_TYPE e0 = 0.0; - DOUBLE_TYPE A = 0.0; - DOUBLE_TYPE B = 0.0; - -////////////////////////////////// - - SHIPsRadialFunctions() = default; - - ~SHIPsRadialFunctions() override = default; - - - void fread(FILE *fptr); - - void load(string fname); - - size_t get_maxn(); - DOUBLE_TYPE get_rcut(); - - bool has_pair(); - - void init(NS_TYPE nradb, LS_TYPE lmax, NS_TYPE nradial, DOUBLE_TYPE deltaSplineBins, SPECIES_TYPE nelements, - DOUBLE_TYPE cutoff, - string radbasename) override; - - void - evaluate(DOUBLE_TYPE r, NS_TYPE nradbase_c, NS_TYPE nradial_c, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, - bool calc_second_derivatives = false) override; - - void - evaluate_pair(DOUBLE_TYPE r, SPECIES_TYPE mu_i, SPECIES_TYPE mu_j, - bool calc_second_derivatives = false); - - void setuplookupRadspline() override; - - SHIPsRadialFunctions *clone() const override { - return new SHIPsRadialFunctions(*this); - }; - - /** - * Helper method, that populate `fr` and `dfr` 2D-arrays (n,l) with P(n), dP_dr for given coordinate r - * @param r - * @param maxn - * @param z1 - * @param z2 - */ - void fill_Rnl(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); - - void fill_gk(DOUBLE_TYPE r, NS_TYPE maxn, SPECIES_TYPE z1, SPECIES_TYPE z2); -}; - - -#endif diff --git a/src/USER-PACE/Install.sh b/src/USER-PACE/Install.sh index 4d87b0e3ed..c099ddd2c4 100644 --- a/src/USER-PACE/Install.sh +++ b/src/USER-PACE/Install.sh @@ -1,68 +1,64 @@ -# Install.sh file that integrates the settings from the lib folder into the conventional build process (make build?) +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update -# COPIED FROM src/KIM/Install.sh: +mode=$1 -# # Install/unInstall package files in LAMMPS -# # mode = 0/1/2 for uninstall/install/update +# enforce using portable C locale +LC_ALL=C +export LC_ALL -# mode=$1 +# arg1 = file, arg2 = file it depends on -# # enforce using portable C locale -# LC_ALL=C -# export LC_ALL +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} -# # arg1 = file, arg2 = file it depends on +# all package files with no dependencies -# action () { -# if (test $mode = 0) then -# rm -f ../$1 -# elif (! cmp -s $1 ../$1) then -# if (test -z "$2" || test -e ../$2) then -# cp $1 .. -# if (test $mode = 2) then -# echo " updating src/$1" -# fi -# fi -# elif (test -n "$2") then -# if (test ! -e ../$2) then -# rm -f ../$1 -# fi -# fi -# } +for file in *.cpp *.h; do + test -f ${file} && action $file +done -# # all package files with no dependencies +# edit 2 Makefile.package files to include/exclude package info -# for file in *.cpp *.h; do -# test -f ${file} && action $file -# done +if (test $1 = 1) then -# # edit 2 Makefile.package files to include/exclude package info + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*pace[^ \t]* //' ../Makefile.package + sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(pace_SYSINC) |' ../Makefile.package + sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(pace_SYSLIB) |' ../Makefile.package + sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(pace_SYSPATH) |' ../Makefile.package + fi -# if (test $1 = 1) then + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*pace.*$/d' ../Makefile.package.settings + # multiline form needed for BSD sed on Macs + sed -i -e '4 i \ +include ..\/..\/lib\/pace\/Makefile.lammps +' ../Makefile.package.settings + fi -# if (test -e ../Makefile.package) then -# sed -i -e 's/[^ \t]*kim[^ \t]* //' ../Makefile.package -# sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(kim_SYSINC) |' ../Makefile.package -# sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(kim_SYSLIB) |' ../Makefile.package -# sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(kim_SYSPATH) |' ../Makefile.package -# fi +elif (test $1 = 0) then -# if (test -e ../Makefile.package.settings) then -# sed -i -e '/^include.*kim.*$/d' ../Makefile.package.settings -# # multiline form needed for BSD sed on Macs -# sed -i -e '4 i \ -# include ..\/..\/lib\/kim\/Makefile.lammps -# ' ../Makefile.package.settings -# fi + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*pace[^ \t]* //' ../Makefile.package + fi -# elif (test $1 = 0) then + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*pace.*$/d' ../Makefile.package.settings + fi -# if (test -e ../Makefile.package) then -# sed -i -e 's/[^ \t]*kim[^ \t]* //' ../Makefile.package -# fi - -# if (test -e ../Makefile.package.settings) then -# sed -i -e '/^include.*kim.*$/d' ../Makefile.package.settings -# fi - -# fi +fi From 0d1ccbe1b542fdcfb8259c23c501be756307798c Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 7 Apr 2021 12:43:28 +0200 Subject: [PATCH 288/370] Move A.Thomson's modifications on doc and examples in: - doc/src/.rst - examples/USER/pace - potentials --- doc/src/Commands_pair.rst | 1 + doc/src/Packages_details.rst | 37 + doc/src/pair_pace.rst | 114 + examples/USER/pace/Cu-PBE-core-rep.ace | 1 + examples/USER/pace/in.pace.product | 38 + examples/USER/pace/in.pace.recursive | 38 + .../pace/log.03Feb2021.pace.product.g++.1 | 108 + .../pace/log.03Feb2021.pace.product.g++.4 | 108 + .../pace/log.03Feb2021.pace.recursive.g++.1 | 108 + .../pace/log.03Feb2021.pace.recursive.g++.4 | 108 + potentials/Cu-PBE-core-rep.ace | 8980 +++++++++++++++++ 11 files changed, 9641 insertions(+) create mode 100644 doc/src/pair_pace.rst create mode 120000 examples/USER/pace/Cu-PBE-core-rep.ace create mode 100644 examples/USER/pace/in.pace.product create mode 100644 examples/USER/pace/in.pace.recursive create mode 100644 examples/USER/pace/log.03Feb2021.pace.product.g++.1 create mode 100644 examples/USER/pace/log.03Feb2021.pace.product.g++.4 create mode 100644 examples/USER/pace/log.03Feb2021.pace.recursive.g++.1 create mode 100644 examples/USER/pace/log.03Feb2021.pace.recursive.g++.4 create mode 100644 potentials/Cu-PBE-core-rep.ace diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 080f3eff20..1d15b93edf 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -215,6 +215,7 @@ OPT. * :doc:`oxrna2/stk ` * :doc:`oxrna2/xstk ` * :doc:`oxrna2/coaxstk ` + * :doc:`pace ` * :doc:`peri/eps ` * :doc:`peri/lps (o) ` * :doc:`peri/pmb (o) ` diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index b662ae73c7..549ab3d8f0 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -90,6 +90,7 @@ page gives those details. * :ref:`USER-MOLFILE ` * :ref:`USER-NETCDF ` * :ref:`USER-OMP ` + * :ref:`USER-PACE ` * :ref:`USER-PHONON ` * :ref:`USER-PLUMED ` * :ref:`USER-PTM ` @@ -1349,6 +1350,42 @@ This package has :ref:`specific installation instructions ` on the ---------- +.. _PKG-USER-PACE: + +USER-PACE package +------------------- + +**Contents:** + +A pair style for the Atomic Cluster Expansion potential (ACE). +ACE is a methodology for deriving a highly accurate classical potential +fit to a large archive of quantum mechanical (DFT) data. The USER-PACE +package provides an efficient implementation for running simulations +with ACE potentials. + +**Authors:** + +This package was written by Yury Lysogorskiy^1, +Cas van der Oord^2, Anton Bochkarev^1, +Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, +Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1. + + ^1: Ruhr-University Bochum, Bochum, Germany + + ^2: University of Cambridge, Cambridge, United Kingdom + + ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA + + ^4: University of British Columbia, Vancouver, BC, Canada + +**Supporting info:** + +* src/USER-PACE: filenames -> commands +* :doc:`pair_style pace ` +* examples/USER/pace + +---------- + .. _PKG-USER-PLUMED: USER-PLUMED package diff --git a/doc/src/pair_pace.rst b/doc/src/pair_pace.rst new file mode 100644 index 0000000000..1ebf6210cd --- /dev/null +++ b/doc/src/pair_pace.rst @@ -0,0 +1,114 @@ +.. index:: pair_style pace + +pair_style pace command +======================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style pace ... keyword values ... + +* an optional keyword may be appended +* keyword = *product* or *recursive* + + .. parsed-literal:: + + *product* = use product algorithm for basis functions + *recursive* = use recursive algorithm for basis functions + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style pace + pair_style pace product + pair_coeff * * Cu-PBE-core-rep.ace Cu + +Description +""""""""""" + +Pair style *pace* computes interactions using the Atomic Cluster +Expansion (ACE), which is a general expansion of the atomic energy in +multi-body basis functions. :ref:`(Drautz) `. +The *pace* pair style +provides an efficient implementation that +is described in this paper :ref:`(Lysogorskiy) `. + +In ACE, the total energy is decomposed into a sum over +atomic energies. The energy of atom *i* is expressed as a +linear or non-linear function of one or more density functions. +By projecting the +density onto a local atomic base, the lowest order contributions +to the energy can be expressed as a set of scalar polynomials in +basis function contributions summed over neighbor atoms. + +Only a single pair_coeff command is used with the *pace* style which +specifies an ACE coefficient file followed by N additional arguments +specifying the mapping of ACE elements to LAMMPS atom types, +where N is the number of LAMMPS atom types: + +* ACE coefficient file +* N element names = mapping of ACE elements to atom types + +Only a single pair_coeff command is used with the *pace* style which +specifies an ACE file that fully defines the potential. +Note that unlike for other potentials, cutoffs are +not set in the pair_style or pair_coeff command; they are specified in +the ACE file. + +The pair_style *mliap* may be followed by an optional keyword +*product* or *recursive*, which determines which of two algorithms + is used for the calculation of basis functions and derivatives. +The default is *recursive*. + +See the :doc:`pair_coeff ` doc page for alternate ways +to specify the path for the ACE coefficient file. + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +For atom type pairs I,J and I != J, where types I and J correspond to +two different element types, mixing is performed by LAMMPS with +user-specifiable parameters as described above. You never need to +specify a pair_coeff command with I != J arguments for this style. + +This pair style does not support the :doc:`pair_modify ` +shift, table, and tail options. + +This pair style does not write its information to :doc:`binary restart files `, since it is stored in potential files. Thus, you +need to re-specify the pair_style and pair_coeff commands in an input +script that reads a restart file. + +This pair style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the +*inner*\ , *middle*\ , *outer* keywords. + +---------- + +Restrictions +"""""""""""" + +This pair style is part of the USER-PACE package. It is only enabled if LAMMPS +was built with that package. +See the :doc:`Build package ` doc page for more info. + +Related commands +"""""""""""""""" + +:doc:`pair_style snap ` + +Default +""""""" + +recursive + +.. _Drautz20191: + +**(Drautz)** Drautz, Phys Rev B, 99, 014104 (2019). + +.. _Lysogorskiy20211: + +**(Lysogorskiy)** Lysogorskiy, van der Oord, Bochkarev, Menon, Rinaldi, Hammerschmidt, Mrovec, Thompson, Csanyi, Ortner, Drautz, TBD (2021). diff --git a/examples/USER/pace/Cu-PBE-core-rep.ace b/examples/USER/pace/Cu-PBE-core-rep.ace new file mode 120000 index 0000000000..4414592f78 --- /dev/null +++ b/examples/USER/pace/Cu-PBE-core-rep.ace @@ -0,0 +1 @@ +../../../potentials/Cu-PBE-core-rep.ace \ No newline at end of file diff --git a/examples/USER/pace/in.pace.product b/examples/USER/pace/in.pace.product new file mode 100644 index 0000000000..d70bb0f67c --- /dev/null +++ b/examples/USER/pace/in.pace.product @@ -0,0 +1,38 @@ +# simple test of fcc Cu with ACE product + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +region box block 0 4 0 4 0 4 +create_box 1 box +create_atoms 1 box + +mass 1 26.98 + +group Al type 1 + +pair_style pace product +pair_coeff * * Cu-PBE-core-rep.ace Cu + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 + diff --git a/examples/USER/pace/in.pace.recursive b/examples/USER/pace/in.pace.recursive new file mode 100644 index 0000000000..dd655eb18d --- /dev/null +++ b/examples/USER/pace/in.pace.recursive @@ -0,0 +1,38 @@ +# simple test of fcc Cu with ACE recursive + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +region box block 0 4 0 4 0 4 +create_box 1 box +create_atoms 1 box + +mass 1 26.98 + +group Al type 1 + +pair_style pace recursive +pair_coeff * * Cu-PBE-core-rep.ace Cu + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 + diff --git a/examples/USER/pace/log.03Feb2021.pace.product.g++.1 b/examples/USER/pace/log.03Feb2021.pace.product.g++.1 new file mode 100644 index 0000000000..01ba9c25a4 --- /dev/null +++ b/examples/USER/pace/log.03Feb2021.pace.product.g++.1 @@ -0,0 +1,108 @@ +LAMMPS (24 Dec 2020) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94) + using 1 OpenMP thread(s) per MPI task +# simple test of fcc Cu with ACE product + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +lattice fcc 3.597 +Lattice spacing in x,y,z = 3.5970000 3.5970000 3.5970000 +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (14.388000 14.388000 14.388000) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 256 atoms + create_atoms CPU = 0.000 seconds + +mass 1 26.98 + +group Al type 1 +256 atoms in group Al + +pair_style pace product +ACE version: 2021.2.3 +Product evaluator is used +pair_coeff * * Cu-PBE-core-rep.ace Cu +Loading Cu-PBE-core-rep.ace +Total number of basis functions + Cu: 16 (r=1) 726 (r>1) +Mapping LAMMPS atom type #1(Cu) -> ACE species type #0 + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 7.7 + ghost atom cutoff = 7.7 + binsize = 3.85, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair pace, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.036 | 4.036 | 4.036 Mbytes +Step Temp E_pair TotEng Press v_delenergy v_delpress + 0 300 -945.9873 -936.0989 45359.818 0 2.1827873e-11 + 10 280.68558 -945.35055 -936.09878 46326.919 0 2.910383e-11 + 20 228.73618 -943.63789 -936.09844 48903.598 0 -2.910383e-11 + 30 160.53661 -941.38948 -936.09798 52222.083 0 -2.910383e-11 + 40 97.732944 -939.31899 -936.09758 55176.875 0 2.1827873e-11 + 50 59.165961 -938.04759 -936.0974 56850.103 0 2.910383e-11 + 60 53.124678 -937.84857 -936.09751 56878.948 0 0 + 70 74.623347 -938.5575 -936.09782 55565.237 0 4.3655746e-11 + 80 109.4762 -939.70663 -936.09815 53665.652 0 2.910383e-11 + 90 142.02657 -940.77975 -936.09837 52001.1 0 0 + 100 161.73598 -941.42945 -936.09842 51114.997 0 1.4551915e-11 +Loop time of 11.4718 on 1 procs for 100 steps with 256 atoms + +Performance: 0.377 ns/day, 63.732 hours/ns, 8.717 timesteps/s +99.3% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 11.468 | 11.468 | 11.468 | 0.0 | 99.96 +Neigh | 0.001181 | 0.001181 | 0.001181 | 0.0 | 0.01 +Comm | 0.001207 | 0.001207 | 0.001207 | 0.0 | 0.01 +Output | 0.000876 | 0.000876 | 0.000876 | 0.0 | 0.01 +Modify | 0.000455 | 0.000455 | 0.000455 | 0.0 | 0.00 +Other | | 0.000397 | | | 0.00 + +Nlocal: 256.000 ave 256 max 256 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2201.00 ave 2201 max 2201 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 43118.0 ave 43118 max 43118 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 43118 +Ave neighs/atom = 168.42969 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:11 diff --git a/examples/USER/pace/log.03Feb2021.pace.product.g++.4 b/examples/USER/pace/log.03Feb2021.pace.product.g++.4 new file mode 100644 index 0000000000..052becb7d6 --- /dev/null +++ b/examples/USER/pace/log.03Feb2021.pace.product.g++.4 @@ -0,0 +1,108 @@ +LAMMPS (24 Dec 2020) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94) + using 1 OpenMP thread(s) per MPI task +# simple test of fcc Cu with ACE product + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +lattice fcc 3.597 +Lattice spacing in x,y,z = 3.5970000 3.5970000 3.5970000 +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (14.388000 14.388000 14.388000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 256 atoms + create_atoms CPU = 0.000 seconds + +mass 1 26.98 + +group Al type 1 +256 atoms in group Al + +pair_style pace product +ACE version: 2021.2.3 +Product evaluator is used +pair_coeff * * Cu-PBE-core-rep.ace Cu +Loading Cu-PBE-core-rep.ace +Total number of basis functions + Cu: 16 (r=1) 726 (r>1) +Mapping LAMMPS atom type #1(Cu) -> ACE species type #0 + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 7.7 + ghost atom cutoff = 7.7 + binsize = 3.85, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair pace, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.005 | 4.005 | 4.005 Mbytes +Step Temp E_pair TotEng Press v_delenergy v_delpress + 0 300 -945.9873 -936.0989 45359.818 0 -1.4551915e-11 + 10 280.68558 -945.35055 -936.09878 46326.919 0 2.910383e-11 + 20 228.73618 -943.63789 -936.09844 48903.598 0 0 + 30 160.53661 -941.38948 -936.09798 52222.083 0 -2.910383e-11 + 40 97.732944 -939.31899 -936.09758 55176.875 0 2.1827873e-11 + 50 59.165961 -938.04759 -936.0974 56850.103 0 -1.4551915e-11 + 60 53.124678 -937.84857 -936.09751 56878.948 0 7.2759576e-12 + 70 74.623347 -938.5575 -936.09782 55565.237 0 0 + 80 109.4762 -939.70663 -936.09815 53665.652 0 2.1827873e-11 + 90 142.02657 -940.77975 -936.09837 52001.1 0 -1.4551915e-11 + 100 161.73598 -941.42945 -936.09842 51114.997 0 1.4551915e-11 +Loop time of 3.54317 on 4 procs for 100 steps with 256 atoms + +Performance: 1.219 ns/day, 19.684 hours/ns, 28.223 timesteps/s +98.7% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 3.1375 | 3.3058 | 3.469 | 6.5 | 93.30 +Neigh | 0.000284 | 0.00031975 | 0.000352 | 0.0 | 0.01 +Comm | 0.071607 | 0.23492 | 0.40336 | 24.6 | 6.63 +Output | 0.001189 | 0.0012315 | 0.001347 | 0.2 | 0.03 +Modify | 0.000311 | 0.00032725 | 0.000351 | 0.0 | 0.01 +Other | | 0.0005298 | | | 0.01 + +Nlocal: 64.0000 ave 71 max 57 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Nghost: 1373.00 ave 1380 max 1366 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 10779.5 ave 11978 max 9604 min +Histogram: 1 0 0 0 1 1 0 0 0 1 + +Total # of neighbors = 43118 +Ave neighs/atom = 168.42969 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:03 diff --git a/examples/USER/pace/log.03Feb2021.pace.recursive.g++.1 b/examples/USER/pace/log.03Feb2021.pace.recursive.g++.1 new file mode 100644 index 0000000000..e6de3bd5c6 --- /dev/null +++ b/examples/USER/pace/log.03Feb2021.pace.recursive.g++.1 @@ -0,0 +1,108 @@ +LAMMPS (24 Dec 2020) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94) + using 1 OpenMP thread(s) per MPI task +# simple test of fcc Cu with ACE recursive + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +lattice fcc 3.597 +Lattice spacing in x,y,z = 3.5970000 3.5970000 3.5970000 +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (14.388000 14.388000 14.388000) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 256 atoms + create_atoms CPU = 0.000 seconds + +mass 1 26.98 + +group Al type 1 +256 atoms in group Al + +pair_style pace recursive +ACE version: 2021.2.3 +Recursive evaluator is used +pair_coeff * * Cu-PBE-core-rep.ace Cu +Loading Cu-PBE-core-rep.ace +Total number of basis functions + Cu: 16 (r=1) 726 (r>1) +Mapping LAMMPS atom type #1(Cu) -> ACE species type #0 + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 7.7 + ghost atom cutoff = 7.7 + binsize = 3.85, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair pace, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.036 | 4.036 | 4.036 Mbytes +Step Temp E_pair TotEng Press v_delenergy v_delpress + 0 300 -945.9873 -936.0989 45359.818 0 0 + 10 280.68558 -945.35055 -936.09878 46326.919 0 5.8207661e-11 + 20 228.73618 -943.63789 -936.09844 48903.598 0 1.4551915e-11 + 30 160.53661 -941.38948 -936.09798 52222.083 0 7.2759576e-11 + 40 97.732944 -939.31899 -936.09758 55176.875 0 -5.8207661e-11 + 50 59.165961 -938.04759 -936.0974 56850.103 0 0 + 60 53.124678 -937.84857 -936.09751 56878.948 0 8.7311491e-11 + 70 74.623347 -938.5575 -936.09782 55565.237 0 -1.4551915e-11 + 80 109.4762 -939.70663 -936.09815 53665.652 0 2.1827873e-11 + 90 142.02657 -940.77975 -936.09837 52001.1 0 2.910383e-11 + 100 161.73598 -941.42945 -936.09842 51114.997 0 0 +Loop time of 9.31437 on 1 procs for 100 steps with 256 atoms + +Performance: 0.464 ns/day, 51.746 hours/ns, 10.736 timesteps/s +99.4% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 9.3103 | 9.3103 | 9.3103 | 0.0 | 99.96 +Neigh | 0.001214 | 0.001214 | 0.001214 | 0.0 | 0.01 +Comm | 0.001176 | 0.001176 | 0.001176 | 0.0 | 0.01 +Output | 0.000827 | 0.000827 | 0.000827 | 0.0 | 0.01 +Modify | 0.000479 | 0.000479 | 0.000479 | 0.0 | 0.01 +Other | | 0.000363 | | | 0.00 + +Nlocal: 256.000 ave 256 max 256 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2201.00 ave 2201 max 2201 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 43118.0 ave 43118 max 43118 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 43118 +Ave neighs/atom = 168.42969 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:09 diff --git a/examples/USER/pace/log.03Feb2021.pace.recursive.g++.4 b/examples/USER/pace/log.03Feb2021.pace.recursive.g++.4 new file mode 100644 index 0000000000..b816f8e570 --- /dev/null +++ b/examples/USER/pace/log.03Feb2021.pace.recursive.g++.4 @@ -0,0 +1,108 @@ +LAMMPS (24 Dec 2020) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94) + using 1 OpenMP thread(s) per MPI task +# simple test of fcc Cu with ACE recursive + +units metal +atom_style atomic + +neighbor 0.3 bin +neigh_modify every 2 delay 10 check yes + +variable a equal 3.597 +lattice fcc $a +lattice fcc 3.597 +Lattice spacing in x,y,z = 3.5970000 3.5970000 3.5970000 +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (14.388000 14.388000 14.388000) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 256 atoms + create_atoms CPU = 0.000 seconds + +mass 1 26.98 + +group Al type 1 +256 atoms in group Al + +pair_style pace recursive +ACE version: 2021.2.3 +Recursive evaluator is used +pair_coeff * * Cu-PBE-core-rep.ace Cu +Loading Cu-PBE-core-rep.ace +Total number of basis functions + Cu: 16 (r=1) 726 (r>1) +Mapping LAMMPS atom type #1(Cu) -> ACE species type #0 + +velocity all create 300 8728 loop geom +timestep 0.0005 +fix 1 all nve + +compute eatom all pe/atom +compute energy all reduce sum c_eatom +variable delenergy equal c_energy-pe + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable delpress equal -(c_str[1]+c_str[2]+c_str[3])/(3*vol)-press + +thermo 10 +thermo_style custom step temp epair etotal press v_delenergy v_delpress + +run 100 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 7.7 + ghost atom cutoff = 7.7 + binsize = 3.85, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair pace, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.005 | 4.005 | 4.005 Mbytes +Step Temp E_pair TotEng Press v_delenergy v_delpress + 0 300 -945.9873 -936.0989 45359.818 0 -5.0931703e-11 + 10 280.68558 -945.35055 -936.09878 46326.919 0 1.4551915e-11 + 20 228.73618 -943.63789 -936.09844 48903.598 0 0 + 30 160.53661 -941.38948 -936.09798 52222.083 0 -2.910383e-11 + 40 97.732944 -939.31899 -936.09758 55176.875 0 0 + 50 59.165961 -938.04759 -936.0974 56850.103 0 -2.910383e-11 + 60 53.124678 -937.84857 -936.09751 56878.948 0 1.4551915e-11 + 70 74.623347 -938.5575 -936.09782 55565.237 0 3.6379788e-11 + 80 109.4762 -939.70663 -936.09815 53665.652 0 -7.2759576e-12 + 90 142.02657 -940.77975 -936.09837 52001.1 0 -2.910383e-11 + 100 161.73598 -941.42945 -936.09842 51114.997 0 7.2759576e-12 +Loop time of 2.91339 on 4 procs for 100 steps with 256 atoms + +Performance: 1.483 ns/day, 16.185 hours/ns, 34.324 timesteps/s +98.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.5753 | 2.723 | 2.8656 | 6.3 | 93.46 +Neigh | 0.000308 | 0.000365 | 0.00046 | 0.0 | 0.01 +Comm | 0.045106 | 0.18792 | 0.33552 | 24.1 | 6.45 +Output | 0.001213 | 0.001259 | 0.001388 | 0.2 | 0.04 +Modify | 0.000304 | 0.00033 | 0.00037 | 0.0 | 0.01 +Other | | 0.0005595 | | | 0.02 + +Nlocal: 64.0000 ave 71 max 57 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Nghost: 1373.00 ave 1380 max 1366 min +Histogram: 1 0 0 0 1 1 0 0 0 1 +Neighs: 0.00000 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 10779.5 ave 11978 max 9604 min +Histogram: 1 0 0 0 1 1 0 0 0 1 + +Total # of neighbors = 43118 +Ave neighs/atom = 168.42969 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:03 diff --git a/potentials/Cu-PBE-core-rep.ace b/potentials/Cu-PBE-core-rep.ace new file mode 100644 index 0000000000..338675f718 --- /dev/null +++ b/potentials/Cu-PBE-core-rep.ace @@ -0,0 +1,8980 @@ +nelements=1 +elements: Cu + +lmax=6 + +embedding-function: FinnisSinclairShiftedScaled +4 FS parameters: 1.000000 1.000000 1.000000 0.500000 +core energy-cutoff parameters: 100000.000000000000000000 250.000000000000000000 +E0: 0.000000000000000000 + +radbasename=ChebPow +nradbase=16 +nradmax=5 +cutoffmax=7.400000 +deltaSplineBins=0.001000 +core repulsion parameters: 400.000000000000000000 7.000000000000000000 +radparameter= 2.000000000000000000 +cutoff= 7.400000000000000355 +dcut= 0.010000000000000000 +crad= 1.620882954168367363 1.226870698977090335 0.999546737553742348 1.448717152469839231 0.789126334259324436 0.990815368777163696 1.019809595831713933 + -0.010015984641177847 0.177152406295798537 -0.099297777289971231 0.173787043169736394 -0.226947223064932313 -0.058969556614429458 0.008323578427593646 + 0.037392073193535026 0.101922365253167557 0.446201407295113706 -0.369069422111282963 -0.101863282196291566 -0.029626931322193999 0.097875222496131745 + 0.002819311425100959 0.000151479194773449 -0.214871024239485592 -0.069350620490777212 0.231426164941363366 -0.026191321598537990 -0.242936254601765322 + 0.186424171366563085 -0.103524085445276359 0.830521273247123437 0.062832162628560284 -0.106558674195482483 -0.060269761337715569 0.046046279743879009 + 1.089304926077264701 0.177165429291873872 0.040767337435711030 0.207716881111047691 -0.085636392006336770 0.046112979588318073 0.078517835329897867 + 1.129288955740465283 1.283253876185540099 1.270328483265826813 1.302687308336752281 0.783473148483047943 1.064176625568968637 1.118800783955553158 + 0.034683824293293135 0.166087484219912207 0.546218802681498805 -0.211429048936371933 -0.108993988729734884 -0.212659494092938856 -0.036191223132020688 + 0.234655107931153573 0.156894718007277223 0.048936621328313876 -0.162183357659622718 0.307926217468614039 -0.083635563001107333 -0.190353036639087092 + 0.329164314982446249 -0.116372429560617760 1.123321061290994516 0.035933724713058841 -0.121370009888348923 -0.109059319819502371 -0.046270850004972844 + 0.108676366969885460 -0.180439291176837630 0.383342539875913824 -0.621209999725314210 0.385861319212343623 0.152252507630111139 0.149457142460434372 + 0.330958073121243090 -0.158282686680629170 0.518958273372971735 0.067226874856217825 0.206572443953436963 0.339537052357791691 0.158596210584529440 + 1.111506419459131090 0.957689150469036465 0.902367027195451810 1.304322975666854845 1.089903020096729014 0.640922035675120738 0.852402336400111094 + 0.311659366422990858 0.407722114498847987 0.545357078699712172 -0.047688798410163040 -0.202317109106842585 -0.073290520019455838 0.228458278553162836 + 0.016478777869119634 0.119519275288016646 -0.105703783821920971 -0.168081439248992437 -0.084202740091545075 -0.057979361619927096 -0.178261149665524310 + -0.614150422523331962 -0.113461629368103653 0.467772160304797735 0.043087231016849081 0.026751930571205659 0.095990676140457337 0.108807286772020978 + 0.194153732515313149 -0.438554540631357515 -0.157353675556007294 -0.196717245341016089 0.051481657072597040 0.246337180836969150 0.081532474873181965 + 0.152006625631538272 -0.052929673773957256 -0.281471510782792256 -0.383762521867106021 0.009965087491552352 -0.211125042490682313 0.219840794494771730 + 0.704490118902931228 1.210078321428047499 0.908865477162489666 0.964021705530207051 0.450293727333551608 1.056627264682903355 1.036709129269184348 + -0.266388684620139204 0.119181785240976085 -0.508517138281119108 -0.105337098339662927 -0.414055390436296855 -0.006568085386914734 -0.008489695366700342 + 0.009311394124494344 -0.099540617340626705 -0.220138090092576039 0.394717776767940565 -0.399661065152255024 -0.054875482424368613 0.087928207583678072 + -0.200476767128879518 0.054334966747964966 -0.215670764334545295 -0.202435906588276288 -0.374669531151026636 0.080145301631041707 0.139272393452873761 + -0.228221777484558963 0.172333233925270862 -0.224387778758770889 -0.564483491180480801 -0.298745938717995319 -0.259629429961615532 0.108686444970415394 + -0.483517031721824420 -0.282846852149469419 -0.625693461166449194 -0.387653192284443615 -0.369381863863073201 0.099516220004199393 -0.162958290590200922 + 0.843113306239999361 0.970201274626998567 0.497935134368538423 1.238080061977394619 0.548287703792778025 1.005350365417147840 0.978841498999161952 + 0.161892884869938802 -0.057335972877138500 -0.287116420859928667 -0.431089456562013029 0.091551903183807848 0.009439015631080828 0.268379617567215512 + -0.313867847114206122 0.243338557259537763 0.109264771609771119 -0.009666213846503660 -0.133516151120714938 0.183542158157167595 0.006005890571908578 + -0.275733732828145839 -0.128502017574031319 -0.073686803430467171 0.308342699434350775 -0.206556802250618482 -0.701080266495170523 -0.286168309771043461 + 0.119676675371723718 -0.265827473160971328 -0.138936457944444508 -0.260613135771113114 -0.122074823420990297 -0.103261598427067697 0.101997949329349455 + -0.157897581669569576 0.350345541041593489 -0.933992118802804527 0.147922763127684820 0.356569853133460291 -0.081578094144895641 -0.338456352936399141 + -0.203760900854131732 0.189503004819520010 0.235745748801731325 0.004064475912380798 0.215067145132773530 0.117105245708646361 0.111489983723870631 + 0.101650818608736676 -0.167934753188295732 -0.139505609630948518 0.100135735837952627 0.207615321477888276 -0.078360547689259985 -0.116477991952193133 + 0.178361429240386588 -0.246847445837075324 0.143897039260075771 0.044934626106912463 0.118578224500244023 -0.719942102233247505 0.073637722061881336 + 0.024025247854341104 0.001534080809538862 0.094065987917264698 0.240346270826002351 0.098969119363074953 -0.244637392429236766 0.096073383164608006 + -0.304219743047226709 0.539609038640176175 -0.132850069068995102 -0.299368028571179834 0.746390925347525602 -0.232536767925996535 -0.108103436794605989 + 0.195979815142720420 -0.040816048069926517 -0.044677154389707881 0.433473455733551616 -0.201417732045534481 -0.109853989934706436 -0.195696892388067839 + 0.252310364976787271 -0.021898887380862420 0.067719939949285227 -0.017567269073639431 0.022537126215898290 -0.529276494508221229 0.272475503821669407 + -0.016626743795124868 0.284841765436517957 -0.079759939497546326 -0.328099876823462200 0.055122957831866798 -0.189781205812279585 0.365248408266040103 + -0.329763357459598394 0.010673557058247799 -0.017801755801789724 -0.039803492471327410 0.249452633918018529 -0.048044948752604191 0.159824465245292396 + -0.131392669230931763 -0.361557435802961957 0.742274013004291744 -0.252379926701268686 -0.110472709032232691 -0.111902522072616598 0.417101605249653729 + 0.067609831656761807 -0.091801646917712573 -0.091634912786787426 -0.434385245328863356 0.024595602536191159 -0.289945821375914847 0.288303924123883670 + -0.222102655505146879 0.197355553496445846 0.119137466964190517 -0.042193758741101241 -0.122199312294347676 -0.128163957018649854 0.282954745760183590 + -0.204869687909700199 0.000000621334072530 0.032919899102939618 0.322373316219983164 -0.077448878302233126 0.132826673866245498 0.151351269017551887 + 0.154359198134425391 0.079067208002472550 0.058020078782584084 -0.232041484505397327 -0.026740685821034973 0.148256901236103134 0.424170596945284806 + 0.076066132728142583 -0.832551883078829325 -0.098299542749259339 0.077287366905066629 -0.744292521475131585 0.211880016794529641 0.170541270652513594 + -0.301235289725240885 0.124854406668055681 0.181148870342708240 0.020790964162366463 0.092737682517404635 0.037519961016909541 0.327465533485634563 + -0.057351161899013424 -0.172723703275453028 -0.191045047691164482 0.064598438230230093 0.038530117310918668 0.367171594126136536 -0.035108818230914815 + 0.222822360258921021 -0.277052912363094761 0.128622927261680037 0.042894401860175763 0.089121765389491847 0.326364329820108379 0.030774994290021802 + 0.111545057922890795 -0.034316594853320039 0.022312383003994508 0.289389743851779624 -0.246524961296611334 0.028561066177931277 -0.070048339030033088 + 0.045575326010860895 0.109780971670271690 -0.338626089720981571 0.024597569064119484 -0.142385603670319966 0.090150826060666198 -0.372899644372851724 + 0.291392634005350593 -0.121181025017044364 -0.167594681733613610 0.418058936918965562 -0.161438428637826009 0.250892543119877354 -0.553531220726090512 + 0.280439932760923050 -0.045161340984994365 0.145378000975044303 -0.032786294274536824 0.054876462308243001 -0.092595253604733418 0.096974220050406124 + -0.037062175032763989 0.281880298116827188 -0.283327757130565294 -0.328329927335834160 0.016267612428127076 0.466711025996532913 -0.136943959907595614 + -0.202699957735178654 -0.155744585760218823 -0.064691184011394204 -0.010011506674438368 0.123909262044762644 -0.157356236508212094 -0.581020771631760469 + -0.013864148398799264 0.589523162717231486 0.210130906014073165 -0.041132265159346544 0.427080437934189927 -0.370839207978565399 -0.228221803399244971 + -0.117316390211942637 0.105828808341833114 0.064732613180985069 -0.570746814954502524 0.173615222749272019 -0.039156497506634864 0.047129546703413218 + -0.296820240442319583 0.215985098466458941 -0.101180811783609007 -0.050727672473374119 -0.062868935459046468 -0.149766104907457120 -0.187737339165467587 + -0.135395947527593125 -0.178526515064528601 0.254279030910830595 0.324458118192411549 -0.131019927336322617 -0.090644759580875284 -0.048175899295618413 + 0.201186098632202576 0.214678921747854301 -0.046817091358603936 -0.311321078952362162 0.141123812750895999 -0.224280305518061496 0.061785358391432607 + -0.039718453214003191 -0.100313138160843709 -0.163755261758446430 0.078958079832196743 0.091597172971250335 -0.246955473616377569 0.210137425898705849 + -0.020928587901441802 -0.073463934758673452 0.040369959448086516 0.438404350385290353 -0.102882684652787021 -0.033081564618892306 0.536459552888738367 + 0.192269484941590685 -0.199849387314510074 0.110717599113859783 0.096893820038588277 0.042154418198533598 0.344356250511964890 0.033227584485695669 + 0.189281310257760876 0.115753002295463162 -0.094886206077761825 -0.184153223554636647 0.144584955795100834 -0.428848345913688311 0.041529544188303000 + -0.145976206197570624 -0.109411578701642934 0.157497794094985794 0.398664417382644687 -0.263204907220635942 -0.039370507864295204 0.666124702411733827 + 0.045657200117720939 -0.388985180138902376 0.209263790100419456 0.009217586427354594 -0.222024958874212308 0.293022315296286473 0.238898724595455747 + 0.062538013377883533 0.043324296533199559 -0.072995962506026496 -0.218020871314228537 0.016363481173287529 -0.008814551087371419 -0.445713189829081147 + -0.073147111207916560 0.097837425665409233 -0.101164665007458840 -0.070972762713574389 -0.023635867292054968 -0.287102674234959554 0.144903701346548480 + -0.138848347980535664 -0.074476951705818389 -0.014043298678579744 0.063802121083298080 -0.044508765572264831 0.346111987264413556 0.209412636105885702 + 0.065988699465650127 0.002844488967674905 -0.158349167897939014 -0.273829200679602536 0.233300763084839324 0.524562168896331227 -0.276941619014999640 + -0.040552715767521105 0.358034042258507434 -0.159809355884827337 -0.055779306211808273 -0.058012898049283036 0.123150329617385132 0.010088304079376876 + -0.038896344296986941 -0.021291676374172713 0.034045094204886668 0.065680845722403555 0.016175406450344553 -0.229426985066826100 0.071928878705798727 + 0.014301163554659121 -0.019742156450417429 0.041229485842464615 0.035107543236686287 0.006577466522553385 -0.028686735753756000 -0.339081583859915991 + 0.063078713153799190 0.047182339952238382 0.019205029655248076 -0.004228530388563512 -0.028004312224389732 0.069422621338731616 -0.331160190510054020 + -0.012659008117644029 0.041636123832886486 0.075120638944337390 0.115783439976586952 -0.123485973005787786 -0.095468155539712010 -0.053812815477012638 + 0.024864000159051606 -0.091130995649244775 0.098067123627009894 0.012070150960164505 0.172024706838292490 0.101558372742640429 -0.100147846163164009 + 0.008829229120333874 0.006405635890914630 -0.000254252635758890 -0.009011737939159836 -0.004752296253587464 0.079792557189286267 0.118552883972912901 + -0.003635605667191180 -0.001002425952287890 -0.000649194473260929 -0.011404466728970108 0.006901342169003619 0.034016193177316904 0.278783128764508614 + -0.017744804165672218 -0.016847357300988471 0.000912070777251806 -0.003869343607930638 0.023830639783322036 -0.127167731719168647 0.285890261660589728 + -0.002679566245452475 -0.022073307923849178 -0.008876564594146853 -0.022914399060255677 0.035103058565932314 0.055453820008897800 0.241028402897824484 + -0.008521518382250752 -0.021652682943862276 -0.028772707427434475 0.007188333511621093 -0.103543186820726829 0.006757566326101306 0.136511555349044217 + +rankmax=6 +ndensitymax=2 + +num_c_tilde_max=742 +num_ms_combinations_max=43 +total_basis_size_rank1: 16 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 1 ) +l=( 0 ) +num_ms=1 +< 0 >: 21.470762535743872945 -13.793209621753947047 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 2 ) +l=( 0 ) +num_ms=1 +< 0 >: 2.104801676125194643 -8.820703455800842363 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 3 ) +l=( 0 ) +num_ms=1 +< 0 >: -19.863946793243037803 14.722042315042330074 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 4 ) +l=( 0 ) +num_ms=1 +< 0 >: 18.431266327113892345 -3.178188891777359526 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 5 ) +l=( 0 ) +num_ms=1 +< 0 >: -2.555646585840716689 -11.500658249153314472 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 6 ) +l=( 0 ) +num_ms=1 +< 0 >: -12.337994092080041497 13.955310823988369862 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 7 ) +l=( 0 ) +num_ms=1 +< 0 >: 16.321023276924805145 -1.316684071539170109 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 8 ) +l=( 0 ) +num_ms=1 +< 0 >: -10.622911593436542788 -12.815946383819756704 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 9 ) +l=( 0 ) +num_ms=1 +< 0 >: 2.405909881352659596 14.563815776076941333 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 10 ) +l=( 0 ) +num_ms=1 +< 0 >: 2.848724496673481266 -3.833614026162156740 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 11 ) +l=( 0 ) +num_ms=1 +< 0 >: -4.037154587884821844 -9.045251135935824749 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 12 ) +l=( 0 ) +num_ms=1 +< 0 >: 2.906894963960199529 14.840216345844389423 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 13 ) +l=( 0 ) +num_ms=1 +< 0 >: -1.442545132794496698 -12.437798929121386848 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 14 ) +l=( 0 ) +num_ms=1 +< 0 >: 0.526838604830681234 6.670020535134621120 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 15 ) +l=( 0 ) +num_ms=1 +< 0 >: -0.138466706086830982 -2.209524140381979862 +ctilde_basis_func: rank=1 ndens=2 mu0=0 mu=( 0 ) +n=( 16 ) +l=( 0 ) +num_ms=1 +< 0 >: 0.021753609992975927 0.347647438597837033 +total_basis_size: 726 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.276073421846033618 0.943638110319304224 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.114991763852642592 -0.163038264609165984 +< 1 -1 >: 0.229983527705285129 0.326076529218331912 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.150603037137131079 0.200814698064905317 +< 1 -1 >: -0.301206074274262214 -0.401629396129810690 +< 2 -2 >: 0.301206074274262270 0.401629396129810801 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.040544295625458825 0.273558633659413464 +< 1 -1 >: 0.081088591250917649 -0.547117267318826928 +< 2 -2 >: -0.081088591250917635 0.547117267318826817 +< 3 -3 >: 0.081088591250917635 -0.547117267318826817 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.007486283689304846 -0.103146896489077697 +< 1 -1 >: -0.014972567378609686 0.206293792978155338 +< 2 -2 >: 0.014972567378609686 -0.206293792978155338 +< 3 -3 >: -0.014972567378609686 0.206293792978155338 +< 4 -4 >: 0.014972567378609688 -0.206293792978155366 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.004496650457917946 -0.071564261184607722 +< 1 -1 >: -0.008993300915835892 0.143128522369215444 +< 2 -2 >: 0.008993300915835894 -0.143128522369215472 +< 3 -3 >: -0.008993300915835896 0.143128522369215500 +< 4 -4 >: 0.008993300915835894 -0.143128522369215472 +< 5 -5 >: -0.008993300915835884 0.143128522369215305 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 1 1 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.018933070506297011 0.044295980593250135 +< 1 -1 >: 0.037866141012594036 -0.088591961186500284 +< 2 -2 >: -0.037866141012594015 0.088591961186500257 +< 3 -3 >: 0.037866141012594036 -0.088591961186500284 +< 4 -4 >: -0.037866141012594008 0.088591961186500243 +< 5 -5 >: 0.037866141012594015 -0.088591961186500257 +< 6 -6 >: -0.037866141012593994 0.088591961186500201 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.009469793779863284 -0.308610971550766999 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.056736899711583730 0.409170451739158947 +< 1 -1 0 >: -0.113473799423167446 -0.818340903478317783 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: 0.167410082246193581 -0.177991034261680253 +< -1 0 1 >: -0.236753608790562287 0.251717334633682455 +< -1 1 0 >: 0.068344879883423221 -0.072664535455225832 +< 0 0 0 >: 0.068344879883423235 -0.072664535455225832 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.032161204572764113 0.105304782790813747 +< 1 -1 0 >: 0.064322409145528225 -0.210609565581627523 +< 2 -2 0 >: -0.064322409145528239 0.210609565581627578 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 2 2 2 ) +num_ms=5 +< -2 0 2 >: 0.135349476741624480 -0.243550057913533124 +< -2 1 1 >: -0.110512384989893159 0.198857789571149440 +< -1 -1 2 >: -0.055256192494946579 0.099428894785574720 +< -1 0 1 >: 0.067674738370812226 -0.121775028956766521 +< 0 0 0 >: -0.022558246123604072 0.040591676318922174 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: 0.175670129498521982 -0.157245599186258633 +< -2 -1 3 >: -0.248435079640647760 0.222378858992690720 +< -2 0 2 >: 0.162638936819378604 -0.145581136327416566 +< -2 1 1 >: -0.093899633953382800 0.084051308247565570 +< -2 2 0 >: 0.020996596458211125 -0.018794443883934534 +< -1 -1 2 >: 0.132794135838743138 -0.118866500058908836 +< -1 0 1 >: -0.230006190219906204 0.205882817419919012 +< -1 1 0 >: 0.083986385832844512 -0.075177775535738151 +< 0 0 0 >: 0.062989789374633370 -0.056383331651803599 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: 0.054516667380390550 0.043115393457091603 +< -2 0 2 >: -0.154196420769462494 -0.121948748348142344 +< -2 1 1 >: 0.084456857941992702 0.066794080329798416 +< -1 -2 3 >: -0.086198419681919602 -0.068171422769365331 +< -1 -1 2 >: 0.066769008779494474 0.052805357014603420 +< -1 0 1 >: -0.048761189667719473 -0.038563580258682603 +< 0 -3 3 >: 0.086198419681919589 0.068171422769365317 +< 0 -1 1 >: -0.051719051809151741 -0.040902853661619186 +< 0 0 0 >: 0.034479367872767841 0.027268569107746131 +< 1 -3 2 >: -0.086198419681919602 -0.068171422769365331 +< 1 -2 1 >: 0.066769008779494474 0.052805357014603420 +< 2 -3 1 >: 0.054516667380390550 0.043115393457091603 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.015736892091809770 -0.086212663677825471 +< -2 -1 3 >: 0.023605338137714659 0.129318995516738228 +< -2 0 2 >: -0.056427550950417620 -0.309131526343983332 +< -2 1 1 >: 0.029739930631419775 0.162926619968555231 +< -1 -3 4 >: 0.029441029270092230 0.161289124941796591 +< -1 -2 3 >: -0.027819157782299098 -0.152403897776863834 +< -1 -1 2 >: 0.018926375959344998 0.103685866034012072 +< -1 0 1 >: -0.013300101307596568 -0.072862999518792812 +< 0 -4 4 >: -0.033995572348614785 -0.186240639405010788 +< 0 -3 3 >: 0.008498893087153693 0.046560159851252683 +< 0 -2 2 >: 0.009713020671032798 0.053211611258574529 +< 0 -1 1 >: -0.020640168925944686 -0.113074673924470834 +< 0 0 0 >: 0.012141275838790995 0.066514514073218151 +< 1 -4 3 >: 0.029441029270092230 0.161289124941796591 +< 1 -3 2 >: -0.027819157782299098 -0.152403897776863834 +< 1 -2 1 >: 0.018926375959344998 0.103685866034012072 +< 2 -4 2 >: -0.015736892091809770 -0.086212663677825471 +< 2 -3 1 >: 0.023605338137714659 0.129318995516738228 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.044004529005274344 -0.043258843809945630 +< 0 1 -1 >: 0.050812053333515649 -0.049951010237008146 +< 1 -2 1 >: -0.029336352670182884 0.028839229206630408 +< 1 -1 0 >: -0.082975735633465622 0.081569658144806031 +< 1 0 -1 >: -0.071859094956282871 0.070641396131414236 +< 2 -2 0 >: 0.065598078782436411 -0.064486476924722938 +< 2 -1 -1 >: 0.092769692679740334 -0.091197650256602814 +< 3 -2 -1 >: -0.113619205330085807 0.111693854434738116 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.016229403465369892 -0.004224252258146830 +< 1 -1 0 >: 0.032458806930739784 0.008448504516293660 +< 2 -2 0 >: -0.032458806930739784 -0.008448504516293658 +< 3 -3 0 >: 0.032458806930739784 0.008448504516293658 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: -0.025466777895254464 -0.021246082021809758 +< -3 0 3 >: 0.031190305618081587 0.026021029993376542 +< -3 1 2 >: -0.028876611859268674 -0.024090792584652430 +< -3 2 1 >: 0.021523355692400440 0.017956216617043556 +< -3 3 0 >: -0.005894413712967474 -0.004917512444301930 +< -2 -2 4 >: 0.016438734444980615 0.013714286973770995 +< -2 -1 3 >: -0.014703251073217575 -0.012266431174516730 +< -2 0 2 >: -0.006806282687793583 -0.005678254266922107 +< -2 1 1 >: 0.022229226173644138 0.018545100778320688 +< -2 2 0 >: -0.013753631996924105 -0.011474195703371170 +< -1 -1 2 >: 0.012426515202871462 0.010367026497477330 +< -1 0 1 >: -0.015219310763986433 -0.012696962534366068 +< -1 1 0 >: -0.001964804570989159 -0.001639170814767311 +< 0 0 0 >: 0.005894413712967474 0.004917512444301930 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.006148466217365900 -0.087978083276143981 +< 0 1 -1 >: -0.007530302466643330 -0.107750706287319475 +< 1 -2 1 >: 0.005324727938549284 0.076191255093403562 +< 1 -1 0 >: 0.011906453632288523 0.170368825679877489 +< 1 0 -1 >: 0.009721578681738081 0.139105563664291693 +< 2 -3 1 >: -0.003074233108682951 -0.043989041638071998 +< 2 -2 0 >: -0.010649455877098571 -0.152382510186807180 +< 2 -1 -1 >: -0.011906453632288524 -0.170368825679877489 +< 3 -3 0 >: 0.008133656277816087 0.116384064586403838 +< 3 -2 -1 >: 0.014087905924479028 0.201583113055029212 +< 4 -3 -1 >: -0.016267312555632178 -0.232768129172807758 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.004198863556308038 0.004005914088795745 +< 1 -1 0 >: -0.008397727112616072 -0.008011828177591487 +< 2 -2 0 >: 0.008397727112616072 0.008011828177591487 +< 3 -3 0 >: -0.008397727112616072 -0.008011828177591487 +< 4 -4 0 >: 0.008397727112616073 0.008011828177591489 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 1 ) +l=( 4 4 4 ) +num_ms=13 +< -4 0 4 >: 0.028164648121169828 -0.080250909154112107 +< -4 1 3 >: -0.059376291706719105 0.169183771484167189 +< -4 2 2 >: 0.033663193206258352 -0.095918182546090164 +< -3 -1 4 >: -0.029688145853359542 0.084591885742083567 +< -3 0 3 >: 0.042246972181754744 -0.120376363731168168 +< -3 1 2 >: -0.022442128804172231 0.063945455030726767 +< -2 -2 4 >: 0.016831596603129172 -0.047959091273045075 +< -2 -1 3 >: -0.011221064402086115 0.031972727515363383 +< -2 0 2 >: -0.022129366380919148 0.063054285763945214 +< -2 1 1 >: 0.025446982160022474 -0.072507330636071662 +< -1 -1 2 >: 0.012723491080011237 -0.036253665318035831 +< -1 0 1 >: -0.018105845220752034 0.051589870170500644 +< 0 0 0 >: 0.006035281740250679 -0.017196623390166886 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 >: 0.000138481844165009 0.013689058093833308 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 0 1 1 2 ) +num_ms=4 +< 0 -1 -1 2 >: -0.002584242887631366 -0.243495540854912540 +< 0 -1 0 1 >: 0.003654671340154488 0.344354696254389359 +< 0 -1 1 0 >: -0.001055012741018902 -0.099406638289591731 +< 0 0 0 0 >: -0.001055012741018902 -0.099406638289591745 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 0 2 2 2 ) +num_ms=5 +< 0 -2 0 2 >: 0.002987041467627661 -0.272724527006854289 +< 0 -2 1 1 >: -0.002438909145407322 0.222678643836227763 +< 0 -1 -1 2 >: -0.001219454572703661 0.111339321918113882 +< 0 -1 0 1 >: 0.001493520733813830 -0.136362263503427089 +< 0 0 0 0 >: -0.000497840244604610 0.045454087834475694 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: -0.001037016851645970 -0.059980506805764756 +< 1 -1 0 0 >: 0.002074033703291940 0.119961013611529499 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 1 1 1 1 ) +num_ms=3 +< -1 -1 1 1 >: 0.008589960551968066 0.137705095105858571 +< -1 0 0 1 >: -0.008589960551968067 -0.137705095105858599 +< 0 0 0 0 >: 0.002147490137992017 0.034426273776464664 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 1 1 2 2 ) +num_ms=11 +< -1 -1 0 2 >: -0.005958717238765831 0.150281030317797659 +< -1 -1 1 1 >: 0.003648954189125550 -0.092027960574583262 +< -1 0 -1 2 >: 0.005160400502739472 -0.130147189962112136 +< -1 0 0 1 >: -0.004213449366704498 0.106264735621415807 +< -1 1 -2 2 >: -0.002023210051568463 -0.170081554018195052 +< -1 1 -1 1 >: -0.001625744137557086 0.262109514592778259 +< -1 1 0 0 >: 0.001421031100299468 -0.146392750725486326 +< 0 0 -2 2 >: -0.002637349163341318 0.177068737583680802 +< 0 0 -1 1 >: -0.001011605025784232 -0.085040777009097540 +< 0 0 0 0 >: 0.001113961544413041 0.027182395075451553 +< 0 1 -2 1 >: 0.005160400502739472 -0.130147189962112136 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: -0.000252427805362054 -0.010361628612788434 +< 1 -1 0 0 >: 0.000504855610724107 0.020723257225576868 +< 2 -2 0 0 >: -0.000504855610724107 -0.020723257225576875 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 1 ) +l=( 2 2 2 2 ) +num_ms=6 +< -2 -2 2 2 >: 0.001241037853319114 0.015089372462838339 +< -2 -1 1 2 >: -0.002482075706638228 -0.030178744925676668 +< -2 0 0 2 >: 0.001241037853319114 0.015089372462838332 +< -1 -1 1 1 >: 0.001241037853319114 0.015089372462838330 +< -1 0 0 1 >: -0.001241037853319113 -0.015089372462838327 +< 0 0 0 0 >: 0.000310259463329778 0.003772343115709581 +ctilde_basis_func: rank=5 ndens=2 mu0=0 mu=( 0 0 0 0 0 ) +n=( 1 1 1 1 1 ) +l=( 0 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 0 >: -0.000000935020536080 -0.000007019453681854 +ctilde_basis_func: rank=5 ndens=2 mu0=0 mu=( 0 0 0 0 0 ) +n=( 1 1 1 1 1 ) +l=( 0 1 1 1 1 ) +num_ms=3 +< 0 -1 -1 1 1 >: 0.000022811031369710 -0.032258483849424084 +< 0 -1 0 0 1 >: -0.000022811031369710 0.032258483849424091 +< 0 0 0 0 0 >: 0.000005702757842428 -0.008064620962356025 +ctilde_basis_func: rank=5 ndens=2 mu0=0 mu=( 0 0 0 0 0 ) +n=( 1 1 1 1 1 ) +l=( 1 1 0 0 0 ) +num_ms=2 +< 0 0 0 0 0 >: 0.000024850300450537 0.001653066345334017 +< 1 -1 0 0 0 >: -0.000049700600901074 -0.003306132690668033 +ctilde_basis_func: rank=6 ndens=2 mu0=0 mu=( 0 0 0 0 0 0 ) +n=( 1 1 1 1 1 1 ) +l=( 0 0 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 0 0 >: 0.000000003348866130 -0.000000862948625992 +ctilde_basis_func: rank=6 ndens=2 mu0=0 mu=( 0 0 0 0 0 0 ) +n=( 1 1 1 1 1 1 ) +l=( 0 0 1 1 1 1 ) +num_ms=3 +< 0 0 -1 -1 1 1 >: -0.000002459754467278 0.000454149082932992 +< 0 0 -1 0 0 1 >: 0.000002459754467278 -0.000454149082932992 +< 0 0 0 0 0 0 >: -0.000000614938616820 0.000113537270733248 +ctilde_basis_func: rank=6 ndens=2 mu0=0 mu=( 0 0 0 0 0 0 ) +n=( 1 1 1 1 1 1 ) +l=( 1 1 0 0 0 0 ) +num_ms=2 +< 0 0 0 0 0 0 >: -0.000000129541495748 -0.000009835136249784 +< 1 -1 0 0 0 0 >: 0.000000259082991496 0.000019670272499569 +ctilde_basis_func: rank=6 ndens=2 mu0=0 mu=( 0 0 0 0 0 0 ) +n=( 1 1 1 1 1 1 ) +l=( 1 1 1 1 1 1 ) +num_ms=4 +< -1 -1 -1 1 1 1 >: -0.000016778677138455 0.001507157658533400 +< -1 -1 0 0 1 1 >: 0.000025168015707683 -0.002260736487800101 +< -1 0 0 0 0 1 >: -0.000012584007853841 0.001130368243900051 +< 0 0 0 0 0 0 >: 0.000002097334642307 -0.000188394707316675 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 0 1 1 2 ) +num_ms=4 +< 0 -1 -1 2 >: 0.002606633917492742 0.166454618525816056 +< 0 -1 0 1 >: -0.003686337038259946 -0.235402379038848891 +< 0 -1 1 0 >: 0.001064153840681534 0.067954813452978852 +< 0 0 0 0 >: 0.001064153840681534 0.067954813452978852 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 0 2 2 2 ) +num_ms=7 +< 0 -2 0 2 >: -0.004460727294756203 0.344570699240051515 +< 0 -2 1 1 >: 0.005463252876929137 -0.422011196726066795 +< 0 -2 2 0 >: -0.002230363647378102 0.172285349620025813 +< 0 -1 -1 2 >: 0.002731626438464568 -0.211005598363033398 +< 0 -1 0 1 >: -0.002230363647378101 0.172285349620025702 +< 0 -1 1 0 >: -0.001115181823689050 0.086142674810012851 +< 0 0 0 0 >: 0.001115181823689050 -0.086142674810012851 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 1 1 1 1 ) +num_ms=4 +< -1 -1 1 1 >: -0.001800118773298505 0.041745806620423383 +< -1 0 0 1 >: 0.000900059386649252 -0.020872903310211695 +< -1 0 1 0 >: 0.000900059386649252 -0.020872903310211695 +< 0 0 0 0 >: -0.000450029693324626 0.010436451655105851 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 1 1 2 0 ) +num_ms=4 +< -1 -1 2 0 >: 0.000708205678384126 0.033448205200141384 +< -1 0 1 0 >: -0.001001554075320470 -0.047302905431078221 +< -1 1 0 0 >: 0.000289123757497120 0.013655172592042209 +< 0 0 0 0 >: 0.000289123757497120 0.013655172592042211 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 1 1 2 2 ) +num_ms=13 +< -1 -1 0 2 >: 0.004998045503574758 -0.131890838605257354 +< -1 -1 1 1 >: -0.006121330597484975 0.161532628165324682 +< -1 -1 2 0 >: 0.004998045503574758 -0.131890838605257354 +< -1 0 -1 2 >: -0.008656868750732653 0.228441633517172366 +< -1 0 0 1 >: 0.003534151868256642 -0.093260906354157916 +< -1 0 1 0 >: 0.003534151868256642 -0.093260906354157916 +< -1 1 -2 2 >: 0.004214437589129390 0.213954236196574943 +< -1 1 -1 1 >: 0.001906893008355585 -0.375486864361899542 +< -1 1 0 0 >: -0.001973668270425288 0.214665536875170537 +< 0 0 -2 2 >: 0.004014111802920279 -0.268509746263612126 +< 0 0 -1 1 >: 0.002107218794564695 0.106977118098287485 +< 0 0 0 0 >: -0.002073831163529843 -0.026566454354922955 +< 0 1 -2 1 >: -0.008656868750732653 0.228441633517172366 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 1 2 2 1 ) +num_ms=16 +< -1 -2 2 1 >: 0.000043196748971934 0.004624812988269349 +< -1 -1 1 1 >: 0.000021598374479169 0.002312406494125256 +< -1 -1 2 0 >: -0.000091634142360189 -0.009810709877161313 +< -1 0 0 1 >: -0.000043196748965136 -0.004624812988259930 +< -1 0 1 0 >: 0.000074818963929414 0.008010411071170644 +< -1 0 2 -1 >: 0.000211619987023362 0.022656863954066245 +< -1 1 1 -1 >: -0.000129590246895409 -0.013874438964779794 +< 0 -2 1 1 >: -0.000091634142360189 -0.009810709877161313 +< 0 -2 2 0 >: 0.000086393497930272 0.009249625976519859 +< 0 -1 1 0 >: 0.000043196748965136 0.004624812988259929 +< 0 -1 2 -1 >: -0.000091634142350575 -0.009810709877147994 +< 0 0 0 0 >: -0.000043196748965136 -0.004624812988259929 +< 0 0 1 -1 >: 0.000074818963929414 0.008010411071170644 +< 1 -2 1 0 >: -0.000091634142350575 -0.009810709877147994 +< 1 -2 2 -1 >: 0.000043196748958338 0.004624812988250512 +< 1 -1 1 -1 >: 0.000021598374485967 0.002312406494134675 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 2 2 2 0 ) +num_ms=5 +< -2 0 2 0 >: -0.002711275102736040 0.118067964076814316 +< -2 1 1 0 >: 0.002213746851338445 -0.096402088985816467 +< -1 -1 2 0 >: 0.001106873425669223 -0.048201044492908234 +< -1 0 1 0 >: -0.001355637551368019 0.059033982038407144 +< 0 0 0 0 >: 0.000451879183789340 -0.019677994012802378 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 1 2 ) +l=( 2 2 2 2 ) +num_ms=9 +< -2 -2 2 2 >: -0.004288317671950520 -0.028719268605867147 +< -2 -1 1 2 >: 0.004288317671950519 0.028719268605867140 +< -2 -1 2 1 >: 0.004288317671950519 0.028719268605867140 +< -2 0 0 2 >: -0.002144158835975259 -0.014359634302933568 +< -2 0 2 0 >: -0.002144158835975259 -0.014359634302933568 +< -1 -1 1 1 >: -0.004288317671950518 -0.028719268605867133 +< -1 0 0 1 >: 0.002144158835975259 0.014359634302933563 +< -1 0 1 0 >: 0.002144158835975259 0.014359634302933563 +< 0 0 0 0 >: -0.001072079417987629 -0.007179817151466781 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.054583050684663452 0.037778832951642007 +< 1 -1 0 >: -0.109166101369326876 -0.075557665903283999 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.184430989327066336 -0.154125006937149200 +< -1 0 1 >: 0.260824806428224809 0.217965675111363805 +< -1 1 0 >: -0.075293636101333786 -0.062921270599822179 +< 0 0 0 >: -0.075293636101333800 -0.062921270599822193 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.038448246681710971 0.140449177313778123 +< 1 -1 0 >: -0.076896493363421956 -0.280898354627556246 +< 2 -2 0 >: 0.076896493363421969 0.280898354627556357 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: -0.108690908618374091 -0.016097050258906159 +< -2 1 1 >: 0.133118632897245542 0.019714779749127966 +< -2 2 0 >: -0.054345454309187059 -0.008048525129453081 +< -1 -1 2 >: 0.066559316448622771 0.009857389874563983 +< -1 0 1 >: -0.054345454309187032 -0.008048525129453078 +< -1 1 0 >: -0.027172727154593516 -0.004024262564726539 +< 0 0 0 >: 0.027172727154593516 0.004024262564726539 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.176338912536312509 -0.091213992615658768 +< -2 -1 3 >: 0.249380881682976202 0.128996065435264012 +< -2 0 2 >: -0.163258109598152040 -0.084447747744081952 +< -2 1 1 >: 0.094257113523882524 0.048755929892503339 +< -2 2 0 >: -0.021076531320231608 -0.010902157354585147 +< -1 -1 2 >: -0.133299688295615143 -0.068951297300090031 +< -1 0 1 >: 0.230881832761099803 0.119427150171542665 +< -1 1 0 >: -0.084306125280926444 -0.043608629418340594 +< 0 0 0 >: -0.063229593960694802 -0.032706472063755439 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.024945478185600632 0.000607322378003120 +< -2 0 2 >: 0.035278233569958614 -0.000858883543704693 +< -2 1 1 >: -0.038645368630404672 0.000940859782314069 +< -2 2 0 >: 0.035278233569958614 -0.000858883543704693 +< -1 -2 3 >: 0.039442264194271250 -0.000960260994239802 +< -1 -1 2 >: -0.030551846472225141 0.000743814967740666 +< -1 0 1 >: 0.011155956990848228 -0.000271602824294360 +< -1 1 0 >: 0.011155956990848228 -0.000271602824294360 +< 0 -3 3 >: -0.039442264194271250 0.000960260994239802 +< 0 -1 1 >: 0.023665358516562741 -0.000576156596543881 +< 0 0 0 >: -0.015776905677708501 0.000384104397695921 +< 1 -3 2 >: 0.039442264194271250 -0.000960260994239802 +< 1 -2 1 >: -0.030551846472225141 0.000743814967740666 +< 2 -3 1 >: -0.024945478185600632 0.000607322378003120 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.045315983906195470 -0.042800229133881873 +< 0 1 -1 >: -0.052326391013669385 -0.049421447623648702 +< 1 -2 1 >: 0.030210655937463634 0.028533486089254569 +< 1 -1 0 >: 0.085448638709896718 0.080704886018415745 +< 1 0 -1 >: 0.074000691841568891 0.069892481501475562 +< 2 -2 0 >: -0.067553080321026346 -0.063802814530617868 +< 2 -1 -1 >: -0.095534482370074475 -0.090230805626774949 +< 3 -2 -1 >: 0.117005367323798889 0.110509716432923955 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.029791319964388840 -0.036280069387636865 +< 1 -1 0 >: -0.059582639928777680 0.072560138775273730 +< 2 -2 0 >: 0.059582639928777673 -0.072560138775273716 +< 3 -3 0 >: -0.059582639928777673 0.072560138775273716 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: -0.062403229056392263 0.114592988417411126 +< -3 2 1 >: 0.098668168583699756 -0.181187423642156509 +< -3 3 0 >: -0.098668168583699756 0.181187423642156481 +< -2 1 1 >: -0.076428034745091036 0.140347174861660068 +< -2 3 -1 >: 0.098668168583699756 -0.181187423642156509 +< -1 1 0 >: 0.059200901150219837 -0.108712454185293864 +< -1 2 -1 >: -0.076428034745091036 0.140347174861660068 +< -1 3 -2 >: -0.062403229056392263 0.114592988417411126 +< 0 0 0 >: -0.039467267433479905 0.072474969456862590 +< 0 1 -1 >: 0.055815144874233280 -0.102495084738470951 +< 0 2 -2 >: 0.176502985734849543 -0.324117916745531753 +< 1 1 -2 >: -0.096674666753989627 0.177526694293109133 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: 0.012326585138872454 -0.178995877105088769 +< -3 0 3 >: -0.015096921930605817 0.219224282484696609 +< -3 1 2 >: 0.013977033768051901 -0.202962247082547842 +< -3 2 1 >: -0.010417865876391355 0.151279127114228390 +< -3 3 0 >: 0.002853050070781436 -0.041429495200077153 +< -2 -2 4 >: -0.007956776493076807 0.115541341844633008 +< -2 -1 3 >: 0.007116757248116852 -0.103343317830456152 +< -2 0 2 >: 0.003294418452754285 -0.047838660412309698 +< -2 1 1 >: -0.010759525611276336 0.156240410651253742 +< -2 2 0 >: 0.006657116831823352 -0.096668822133513355 +< -1 -1 2 >: -0.006014757668115967 0.087341044762171402 +< -1 0 1 >: 0.007366543606688264 -0.106970496634452614 +< -1 1 0 >: 0.000951016690260480 -0.013809831733359063 +< 0 0 0 >: -0.002853050070781436 0.041429495200077153 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.017947273004863901 -0.042559306577471916 +< 0 1 -1 >: 0.021980830568171777 -0.052124292460741052 +< 1 -2 1 >: -0.015542794350866815 0.036857440663540832 +< 1 -1 0 >: -0.034754744728837925 0.082415742800342265 +< 1 0 -1 >: -0.028377130242112060 0.067292172211098289 +< 2 -3 1 >: 0.008973636502431952 -0.021279653288735965 +< 2 -2 0 >: 0.031085588701733641 -0.073714881327081691 +< 2 -1 -1 >: 0.034754744728837925 -0.082415742800342279 +< 3 -3 0 >: -0.023742010541326398 0.056300670587673088 +< 3 -2 -1 >: -0.041122368531413198 0.097515621958048540 +< 4 -3 -1 >: 0.047484021082652816 -0.112601341175346217 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.007714119228406039 0.044611919281672956 +< 1 -1 0 >: 0.015428238456812073 -0.089223838563345884 +< 2 -2 0 >: -0.015428238456812073 0.089223838563345884 +< 3 -3 0 >: 0.015428238456812073 -0.089223838563345884 +< 4 -4 0 >: -0.015428238456812075 0.089223838563345897 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: 0.010597679068320204 0.043734705711118302 +< -4 3 1 >: -0.019826442084319936 -0.081820142341195140 +< -4 4 0 >: 0.022893603348909268 0.094477762411644975 +< -3 1 2 >: -0.015896518602480307 -0.065602058566677460 +< -3 2 1 >: 0.018734226835119869 0.077312767453824427 +< -3 3 0 >: -0.005723400837227315 -0.023619440602911237 +< -3 4 -1 >: -0.019826442084319936 -0.081820142341195140 +< -2 1 1 >: -0.012745569911348526 -0.052598662933625431 +< -2 2 0 >: -0.006541029528259793 -0.026993646403327146 +< -2 3 -1 >: 0.018734226835119869 0.077312767453824427 +< -2 4 -2 >: 0.010597679068320204 0.043734705711118302 +< -1 1 0 >: 0.013899687747552054 0.057361498607070162 +< -1 2 -1 >: -0.012745569911348526 -0.052598662933625431 +< -1 3 -2 >: -0.015896518602480307 -0.065602058566677460 +< 0 0 0 >: -0.008176286910324739 -0.033742058004158922 +< 0 1 -1 >: 0.008956673554838158 0.036962572611051174 +< 0 2 -2 >: 0.037999947645001697 0.156818914460246650 +< 1 1 -2 >: -0.020027730920892814 -0.082650824981582327 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 2 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: -0.045458003399570290 0.049647232216497236 +< -4 1 3 >: 0.071875414313159663 -0.078499166663710512 +< -4 2 2 >: -0.081499059279579789 0.089009688479138524 +< -4 3 1 >: 0.071875414313159663 -0.078499166663710526 +< -4 4 0 >: -0.022729001699785145 0.024823616108248618 +< -3 -1 4 >: 0.071875414313159650 -0.078499166663710498 +< -3 0 3 >: -0.068187005099355422 0.074470848324745847 +< -3 1 2 >: 0.027166353093193256 -0.029669896159712838 +< -3 2 1 >: 0.027166353093193259 -0.029669896159712841 +< -3 3 0 >: -0.034093502549677704 0.037235424162372917 +< -2 -2 4 >: -0.040749529639789887 0.044504844239569255 +< -2 -1 3 >: 0.027166353093193256 -0.029669896159712838 +< -2 0 2 >: 0.035717002671090937 -0.039008539598676402 +< -2 1 1 >: -0.061607497982708294 0.067284999997466163 +< -2 2 0 >: 0.017858501335545462 -0.019504269799338191 +< -1 -1 2 >: -0.030803748991354147 0.033642499998733082 +< -1 0 1 >: 0.029223002185438045 -0.031916077853462510 +< -1 1 0 >: 0.014611501092719019 -0.015958038926731252 +< 0 0 0 >: -0.014611501092719026 0.015958038926731258 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: -0.000865763010737041 0.017336339429338609 +< 1 -1 0 0 >: 0.001731526021474082 -0.034672678858677211 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: 0.000399163511050922 0.014268554496454817 +< 1 -1 0 0 >: -0.000798327022101844 -0.028537108992909638 +< 2 -2 0 0 >: 0.000798327022101844 0.028537108992909649 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 1 ) +l=( 2 2 1 1 ) +num_ms=8 +< 0 0 0 0 >: 0.000076214838495211 -0.025166557601403610 +< 0 0 1 -1 >: -0.000152429676990421 0.050333115202807206 +< 1 -1 -1 1 >: 0.000152429676990421 -0.050333115202807220 +< 1 -1 0 0 >: -0.000152429676990421 0.050333115202807227 +< 1 -1 1 -1 >: 0.000152429676990421 -0.050333115202807220 +< 2 -2 -1 1 >: -0.000152429676990421 0.050333115202807227 +< 2 -2 0 0 >: 0.000152429676990421 -0.050333115202807241 +< 2 -2 1 -1 >: -0.000152429676990421 0.050333115202807227 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 0 2 1 1 ) +num_ms=4 +< 0 0 -1 1 >: -0.000115575459848796 0.008854089271594225 +< 0 0 0 0 >: -0.000115575459848796 0.008854089271594225 +< 0 1 -1 0 >: 0.000400365137132502 -0.030671464946303427 +< 0 2 -1 -1 >: -0.000283100903417075 0.021688000852456642 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 0 2 2 2 ) +num_ms=8 +< 0 -2 0 2 >: 0.003219841324988002 -0.222372484414000454 +< 0 -2 1 1 >: -0.001971742074736877 0.136174779912326516 +< 0 -1 -1 2 >: -0.001971742074736877 0.136174779912326516 +< 0 -1 0 1 >: 0.001609920662494000 -0.111186242207000158 +< 0 0 -2 2 >: 0.001609920662494000 -0.111186242207000158 +< 0 0 -1 1 >: 0.000804960331247000 -0.055593121103500079 +< 0 0 0 0 >: -0.000804960331247000 0.055593121103500079 +< 0 1 -2 1 >: -0.001971742074736877 0.136174779912326516 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: 0.000361033295246299 -0.003372423802545437 +< 1 -1 0 0 >: -0.000722066590492599 0.006744847605090873 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 1 1 0 2 ) +num_ms=4 +< -1 -1 0 2 >: -0.000852279449019880 0.003079773563530716 +< -1 0 0 1 >: 0.001205305155735783 -0.004355457542583255 +< -1 1 0 0 >: -0.000347941628059849 0.001257312292327214 +< 0 0 0 0 >: -0.000347941628059849 0.001257312292327214 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 1 1 1 1 ) +num_ms=6 +< -1 -1 1 1 >: 0.000146116709268971 -0.009867113533806938 +< -1 0 0 1 >: -0.000292233418537943 0.019734227067613876 +< -1 1 -1 1 >: -0.000053920014922944 0.013645083117420780 +< -1 1 0 0 >: 0.000100018362095957 -0.011756098325613858 +< 0 0 -1 1 >: 0.000100018362095957 -0.011756098325613858 +< 0 0 0 0 >: 0.000023049173586507 0.000944492395903464 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 1 1 2 2 ) +num_ms=11 +< -1 -1 0 2 >: -0.004364184410262559 0.116902449375929834 +< -1 -1 1 1 >: 0.002672506237138097 -0.071587837663142445 +< -1 0 -1 2 >: 0.003779494566087384 -0.101240490924179499 +< -1 0 0 1 >: -0.003085944390845268 0.082662514691037026 +< -1 1 -2 2 >: -0.001922680468440096 -0.070387973408986615 +< -1 1 -1 1 >: -0.000749825768698001 0.141975811072129032 +< -1 1 0 0 >: 0.000820330590538683 -0.082919211813254901 +< 0 0 -2 2 >: -0.001711166002918049 0.106781824367635753 +< 0 0 -1 1 >: -0.000961340234220048 -0.035193986704493307 +< 0 0 0 0 >: 0.000926087823299707 0.005665687075056245 +< 0 1 -2 1 >: 0.003779494566087384 -0.101240490924179499 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: -0.000138889360550470 0.000147685181843324 +< 1 -1 0 0 >: 0.000277778721100941 -0.000295370363686649 +< 2 -2 0 0 >: -0.000277778721100941 0.000295370363686649 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 2 2 0 2 ) +num_ms=7 +< -2 0 0 2 >: 0.003679465688564987 -0.157830328449144713 +< -2 1 0 1 >: -0.004506406731531289 0.193301885318140021 +< -2 2 0 0 >: 0.001839732844282494 -0.078915164224572384 +< -1 -1 0 2 >: -0.002253203365765644 0.096650942659070010 +< -1 0 0 1 >: 0.001839732844282493 -0.078915164224572343 +< -1 1 0 0 >: 0.000919866422141246 -0.039457582112286171 +< 0 0 0 0 >: -0.000919866422141246 0.039457582112286171 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 2 2 1 1 ) +num_ms=11 +< -2 1 0 1 >: 0.000183464638503149 -0.007191830649866146 +< -2 2 -1 1 >: 0.000172733037519855 -0.004317936006064334 +< -2 2 0 0 >: -0.000216095608753443 0.007244360224697774 +< -1 1 -1 1 >: -0.000302462127513371 0.009403328227729940 +< -1 1 0 0 >: 0.000086366518759928 -0.002158968003032168 +< -1 2 -1 0 >: 0.000183464638503149 -0.007191830649866146 +< 0 0 -1 1 >: 0.000172852578755604 -0.005549229484142570 +< 0 0 0 0 >: -0.000021561744381045 0.000231918631238483 +< 0 1 -1 0 >: -0.000149798250058962 0.005872105136226933 +< 0 2 -1 -1 >: -0.000211846716853141 0.008304410723332845 +< 1 1 -1 -1 >: 0.000129729089993515 -0.005085392221665607 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 1 2 2 ) +l=( 2 2 2 2 ) +num_ms=21 +< -2 -2 2 2 >: 0.001642650748657122 0.011687034584406454 +< -2 -1 1 2 >: -0.003285301497314243 -0.023374069168812905 +< -2 0 0 2 >: 0.003752712720853359 0.010171505506617327 +< -2 0 1 1 >: -0.000286229749430199 0.008084886067247495 +< -2 1 -1 2 >: -0.001993209166311457 -0.001785111837759770 +< -2 1 0 1 >: 0.000286229749430198 -0.008084886067247495 +< -2 2 -2 2 >: 0.003704563252236249 0.009294746160439746 +< -2 2 -1 1 >: -0.001711354085924791 -0.007509634322679977 +< -2 2 0 0 >: 0.000797250640020006 0.005405137619114435 +< -1 -1 0 2 >: -0.000286229749430199 0.008084886067247493 +< -1 -1 1 1 >: 0.001817929957484289 0.006736073211083109 +< -1 0 -1 2 >: 0.000143114874715099 -0.004042443033623748 +< -1 0 0 1 >: -0.003402154303199022 -0.020073428253264015 +< -1 1 -2 2 >: -0.001711354085924791 -0.007509634322679977 +< -1 1 -1 1 >: 0.003529284043409080 0.014245707533763086 +< -1 1 0 0 >: -0.000972529848847173 -0.000454176245791089 +< -1 2 -2 1 >: -0.001993209166311457 -0.001785111837759770 +< 0 0 -2 2 >: 0.000797250640020006 0.005405137619114435 +< 0 0 -1 1 >: -0.000972529848847173 -0.000454176245791089 +< 0 0 0 0 >: 0.001336803500223342 0.005245445186211549 +< 0 1 -2 1 >: 0.000143114874715099 -0.004042443033623748 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.077831243654351678 0.087134761468995028 +< 1 -1 0 >: 0.155662487308703329 -0.174269522937990001 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: 0.093879741204974443 -0.354998956968941126 +< -1 0 1 >: -0.132766003244151165 0.502044339573779363 +< -1 1 0 >: 0.038326243856120691 -0.144927717299024678 +< 0 0 0 >: 0.038326243856120698 -0.144927717299024705 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.042645803866773122 0.041017325383404461 +< 1 -1 0 >: 0.085291607733546243 -0.082034650766808936 +< 2 -2 0 >: -0.085291607733546271 0.082034650766808950 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: 0.013535447720539140 -0.138163269103870084 +< -2 1 1 >: -0.016577470177719288 0.169214755249660870 +< -2 2 0 >: 0.006767723860269572 -0.069081634551935070 +< -1 -1 2 >: -0.008288735088859644 0.084607377624830435 +< -1 0 1 >: 0.006767723860269569 -0.069081634551935028 +< -1 1 0 >: 0.003383861930134784 -0.034540817275967514 +< 0 0 0 >: -0.003383861930134784 0.034540817275967514 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: 0.004053776574595621 0.024663695904383425 +< -2 -1 3 >: -0.005732905810623477 -0.034879733246224807 +< -2 0 2 >: 0.003753067832747749 0.022834145402956127 +< -2 1 1 >: -0.002166834723523838 -0.013183299995111777 +< -2 2 0 >: 0.000484518973780627 0.002947875495684258 +< -1 -1 2 >: 0.003064367053428369 0.018644001649920236 +< -1 0 1 >: -0.005307639429578066 -0.032292358114059817 +< -1 1 0 >: 0.001938075895122507 0.011791501982737033 +< 0 0 0 >: 0.001453556921341879 0.008843626487052772 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.072008818150769691 -0.077610763262163152 +< -2 0 2 >: 0.101835847239276439 0.109758193991478722 +< -2 1 1 >: -0.111555581391203792 -0.120234077440321746 +< -2 2 0 >: 0.101835847239276439 0.109758193991478722 +< -1 -2 3 >: 0.113855938486653138 0.122713391426277629 +< -1 -1 2 >: -0.088192430725124768 -0.095053384270121083 +< -1 0 1 >: 0.032203322472908358 0.034708588487968033 +< -1 1 0 >: 0.032203322472908358 0.034708588487968033 +< 0 -3 3 >: -0.113855938486653124 -0.122713391426277615 +< 0 -1 1 >: 0.068313563091991866 0.073628034855766550 +< 0 0 0 >: -0.045542375394661251 -0.049085356570511045 +< 1 -3 2 >: 0.113855938486653138 0.122713391426277629 +< 1 -2 1 >: -0.088192430725124768 -0.095053384270121083 +< 2 -3 1 >: -0.072008818150769691 -0.077610763262163152 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.041628574037905194 -0.115819866613139630 +< 0 1 -1 >: 0.048068536853529645 -0.133737262333205376 +< 1 -2 1 >: -0.027752382691936788 0.077213244408759735 +< 1 -1 0 >: -0.078495591982210719 0.218392034875393187 +< 1 0 -1 >: -0.067979176741692557 0.189133050186267526 +< 2 -2 0 >: 0.062056214236759277 -0.172654063261292345 +< 2 -1 -1 >: 0.087760739803155310 -0.244169717862941948 +< 3 -2 -1 >: -0.107484515983446147 0.299045609701769410 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.019647915926264872 0.006553058011735113 +< 1 -1 0 >: 0.039295831852529745 -0.013106116023470227 +< 2 -2 0 >: -0.039295831852529745 0.013106116023470225 +< 3 -3 0 >: 0.039295831852529745 -0.013106116023470225 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: 0.057340467918147182 -0.045385362560376334 +< -3 2 1 >: -0.090663240360579225 0.071760559061660206 +< -3 3 0 >: 0.090663240360579225 -0.071760559061660206 +< -2 1 1 >: 0.070227444005944717 -0.055585490032068766 +< -2 3 -1 >: -0.090663240360579225 0.071760559061660206 +< -1 1 0 >: -0.054397944216347520 0.043056335436996107 +< -1 2 -1 >: 0.070227444005944717 -0.055585490032068766 +< -1 3 -2 >: 0.057340467918147182 -0.045385362560376334 +< 0 0 0 >: 0.036265296144231692 -0.028704223624664082 +< 0 1 -1 >: -0.051286873650649191 0.040593902347390166 +< 0 2 -2 >: -0.162183334805326235 0.128369190532208660 +< 1 1 -2 >: 0.088831470924289904 -0.070310701343169274 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: 0.003922008927877927 0.243957419704823208 +< -3 0 3 >: -0.004803460319970515 -0.298785598621407578 +< -3 1 2 >: 0.004447140112688595 0.276621712726273117 +< -3 2 1 >: -0.003314702532479257 -0.206181651236121727 +< -3 3 0 >: 0.000907768674229195 0.056465170662843400 +< -2 -2 4 >: -0.002531645876891335 -0.157473837283418849 +< -2 -1 3 >: 0.002264372910274436 0.140848881937386178 +< -2 0 2 >: 0.001048200976856270 0.065200362964061578 +< -2 1 1 >: -0.003423410054912990 -0.212943493741612117 +< -2 2 0 >: 0.002118126906534788 0.131752064879967934 +< -1 -1 2 >: -0.001913744399410434 -0.119039031843136439 +< -1 0 1 >: 0.002343848638332305 0.145792443745301398 +< -1 1 0 >: 0.000302589558076398 0.018821723554281147 +< 0 0 0 >: -0.000907768674229195 -0.056465170662843400 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.016568155728426164 -0.040824130388153267 +< 0 1 -1 >: -0.020291763756807121 -0.049999144321912242 +< 1 -2 1 >: 0.014348443754673729 0.035354734003549007 +< 1 -1 0 >: 0.032084095606782777 0.079055588558358883 +< 1 0 -1 >: 0.026196554365096405 0.064548617761129065 +< 2 -3 1 >: -0.008284077864213084 -0.020412065194076640 +< 2 -2 0 >: -0.028696887509347471 -0.070709468007098042 +< 2 -1 -1 >: -0.032084095606782784 -0.079055588558358897 +< 3 -3 0 >: 0.021917609870202914 0.054005248248764154 +< 3 -2 -1 >: 0.037962413875664569 0.093539833842229678 +< 4 -3 -1 >: -0.043835219740405842 -0.108010496497528335 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.009257965839577923 0.060925918811764297 +< 1 -1 0 >: -0.018515931679155839 -0.121851837623528553 +< 2 -2 0 >: 0.018515931679155839 0.121851837623528553 +< 3 -3 0 >: -0.018515931679155839 -0.121851837623528553 +< 4 -4 0 >: 0.018515931679155842 0.121851837623528581 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: -0.005929546252978678 -0.014690098804514934 +< -4 3 1 >: 0.011093165268837708 0.027482658352176177 +< -4 4 0 >: -0.012809283908256910 -0.031734240395350853 +< -3 1 2 >: 0.008894319379468017 0.022035148206772402 +< -3 2 1 >: -0.010482055912101265 -0.025968671202432257 +< -3 3 0 >: 0.003202320977064227 0.007933560098837710 +< -3 4 -1 >: 0.011093165268837708 0.027482658352176177 +< -2 1 1 >: 0.007131320529967096 0.017667423226398967 +< -2 2 0 >: 0.003659795402359118 0.009066925827243102 +< -2 3 -1 >: -0.010482055912101265 -0.025968671202432257 +< -2 4 -2 >: -0.005929546252978678 -0.014690098804514934 +< -1 1 0 >: -0.007777065230013124 -0.019267217382891586 +< -1 2 -1 >: 0.007131320529967096 0.017667423226398967 +< -1 3 -2 >: 0.008894319379468017 0.022035148206772402 +< 0 0 0 >: 0.004574744252948897 0.011333657284053876 +< 0 1 -1 >: -0.005011381244314461 -0.012415399507018088 +< 0 2 -2 >: -0.021261489965795004 -0.052674079095315664 +< 1 1 -2 >: 0.011205789123454617 0.027761677265509824 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 3 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: 0.011896638246535272 0.030366334707953697 +< -4 1 3 >: -0.018810236679061600 -0.048013390934078817 +< -4 2 2 >: 0.021328803580741063 0.054442068005355330 +< -4 3 1 >: -0.018810236679061603 -0.048013390934078824 +< -4 4 0 >: 0.005948319123267636 0.015183167353976849 +< -3 -1 4 >: -0.018810236679061596 -0.048013390934078810 +< -3 0 3 >: 0.017844957369802905 0.045549502061930543 +< -3 1 2 >: -0.007109601193580354 -0.018147356001785107 +< -3 2 1 >: -0.007109601193580355 -0.018147356001785110 +< -3 3 0 >: 0.008922478684901453 0.022774751030965268 +< -2 -2 4 >: 0.010664401790370530 0.027221034002677662 +< -2 -1 3 >: -0.007109601193580354 -0.018147356001785107 +< -2 0 2 >: -0.009347358622277714 -0.023859262984820762 +< -2 1 1 >: 0.016123060010624232 0.041154335086353279 +< -2 2 0 >: -0.004673679311138854 -0.011929631492410376 +< -1 -1 2 >: 0.008061530005312116 0.020577167543176639 +< -1 0 1 >: -0.007647838872772676 -0.019521215169398809 +< -1 1 0 >: -0.003823919436386337 -0.009760607584699401 +< 0 0 0 >: 0.003823919436386339 0.009760607584699406 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.003525841278372580 -0.076227387034227184 +< 1 -1 0 >: -0.007051682556745160 0.152454774068454341 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.072040489156466325 0.465077453888616987 +< -1 0 1 >: 0.101880636805066579 -0.657718842843229901 +< -1 1 0 >: -0.029410406542307834 0.189867075483313941 +< 0 0 0 >: -0.029410406542307841 0.189867075483313968 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.030857467694981530 -0.079339768964250545 +< 1 -1 0 >: -0.061714935389963067 0.158679537928501119 +< 2 -2 0 >: 0.061714935389963081 -0.158679537928501146 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: -0.103034978895394994 0.051697655988502171 +< -2 1 1 >: 0.126191561976075645 -0.063316439034884708 +< -2 2 0 >: -0.051517489447697511 0.025848827994251092 +< -1 -1 2 >: 0.063095780988037822 -0.031658219517442354 +< -1 0 1 >: -0.051517489447697483 0.025848827994251079 +< -1 1 0 >: -0.025758744723848741 0.012924413997125539 +< 0 0 0 >: 0.025758744723848741 -0.012924413997125539 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: 0.007561865329007393 -0.122486068160255923 +< -2 -1 3 >: -0.010694092505121145 0.173221458793989286 +< -2 0 2 >: 0.007000926913368222 -0.113400063844875651 +< -2 1 1 >: -0.004041987038010039 0.065471557386959714 +< -2 2 0 >: 0.000903815778116347 -0.014639885291002042 +< -1 -1 2 >: 0.005716232888090053 -0.092590764406326825 +< -1 0 1 >: -0.009900805790068150 0.160371908263398033 +< -1 1 0 >: 0.003615263112465390 -0.058559541164008175 +< 0 0 0 >: 0.002711447334349042 -0.043919655873006121 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: 0.057490550234226612 0.046711134765060294 +< -2 0 2 >: -0.081303915849535016 -0.066059520298585667 +< -2 1 1 >: 0.089063977448584256 0.072364578811011548 +< -2 2 0 >: -0.081303915849535016 -0.066059520298585667 +< -1 -2 3 >: -0.090900541338241381 -0.073856788974332344 +< -1 -1 2 >: 0.070411256552849577 0.057209222740388962 +< -1 0 1 >: -0.025710555677519436 -0.020889854528165702 +< -1 1 0 >: -0.025710555677519436 -0.020889854528165702 +< 0 -3 3 >: 0.090900541338241367 0.073856788974332330 +< 0 -1 1 >: -0.054540324802944809 -0.044314073384599389 +< 0 0 0 >: 0.036360216535296551 0.029542715589732933 +< 1 -3 2 >: -0.090900541338241381 -0.073856788974332344 +< 1 -2 1 >: 0.070411256552849577 0.057209222740388962 +< 2 -3 1 >: 0.057490550234226612 0.046711134765060294 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.033474215179731516 0.073809035014022292 +< 0 1 -1 >: -0.038652694289858874 0.085227332467944533 +< 1 -2 1 >: 0.022316143453154337 -0.049206023342681510 +< 1 -1 0 >: 0.063119585462628858 -0.139175651123334632 +< 1 0 -1 >: 0.054663164486979512 -0.120529649461047994 +< 2 -2 0 >: -0.049900413756890000 0.110028013096677313 +< 2 -1 -1 >: -0.070569841903022804 0.155603108362285580 +< 3 -2 -1 >: 0.086430051945642419 -0.190574108939298936 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.000004075443895903 0.116698363421342946 +< 1 -1 0 >: 0.000008150887791805 -0.233396726842685892 +< 2 -2 0 >: -0.000008150887791805 0.233396726842685864 +< 3 -3 0 >: 0.000008150887791805 -0.233396726842685864 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: -0.036048849696384208 0.009668486778914418 +< -3 2 1 >: 0.056998236034821709 -0.015287219874297195 +< -3 3 0 >: -0.056998236034821702 0.015287219874297193 +< -2 1 1 >: -0.044150643785212808 0.011841429596592819 +< -2 3 -1 >: 0.056998236034821709 -0.015287219874297195 +< -1 1 0 >: 0.034198941620893014 -0.009172331924578314 +< -1 2 -1 >: -0.044150643785212808 0.011841429596592819 +< -1 3 -2 >: -0.036048849696384208 0.009668486778914418 +< 0 0 0 >: -0.022799294413928681 0.006114887949718878 +< 0 1 -1 >: 0.032243071372715100 -0.008647757470884249 +< 0 2 -2 >: 0.101961544297151582 -0.027346610260731471 +< 1 1 -2 >: -0.055846637809612146 0.014978355311104856 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: -0.013488971010532948 0.206467696043667576 +< -3 0 3 >: 0.016520548065500046 -0.252870251837519322 +< -3 1 2 >: -0.015295055458298488 0.234112361785722423 +< -3 2 1 >: 0.011400261241461535 -0.174497051775299727 +< -3 3 0 >: -0.003122090121700167 0.047787985737739284 +< -2 -2 4 >: 0.008707093346878121 -0.133274324717823217 +< -2 -1 3 >: -0.007787861044022256 0.119204179889773304 +< -2 0 2 >: -0.003605079144395725 0.055180812859427532 +< -2 1 1 >: 0.011774139181491847 -0.180219780130141144 +< -2 2 0 >: -0.007284876950633722 0.111505300054724990 +< -1 -1 2 >: 0.006581943896589877 -0.100745919815265386 +< -1 0 1 >: -0.008061202031135622 0.123388048607374540 +< -1 1 0 >: -0.001040696707233390 0.015929328579246439 +< 0 0 0 >: 0.003122090121700167 -0.047787985737739284 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.008380141684403685 -0.023364893579381544 +< 0 1 -1 >: 0.010263535549508285 -0.028616033581957814 +< 1 -2 1 >: -0.007257415586006507 0.020234591396464340 +< 1 -1 0 >: -0.016228074591277022 0.045245921859426670 +< 1 0 -1 >: -0.013250167418817790 0.036943140499144919 +< 2 -3 1 >: 0.004190070842201844 -0.011682446789690774 +< 2 -2 0 >: 0.014514831172013019 -0.040469182792928694 +< 2 -1 -1 >: 0.016228074591277026 -0.045245921859426677 +< 3 -3 0 >: -0.011085885424209038 0.030908848910266677 +< 3 -2 -1 >: -0.019201316801617317 0.053535696716051830 +< 4 -3 -1 >: 0.022171770848418083 -0.061817697820533375 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.003663090143367874 -0.072164658886293587 +< 1 -1 0 >: 0.007326180286735746 0.144329317772587118 +< 2 -2 0 >: -0.007326180286735746 -0.144329317772587118 +< 3 -3 0 >: 0.007326180286735746 0.144329317772587118 +< 4 -4 0 >: -0.007326180286735748 -0.144329317772587146 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: 0.008588732417776062 0.018271910908865912 +< -4 3 1 >: -0.016068047046998310 -0.034183615211316749 +< -4 4 0 >: 0.018553782575872080 0.039471838888256609 +< -3 1 2 >: -0.012883098626664095 -0.027407866363298870 +< -3 2 1 >: 0.015182877336015459 0.032300480272238842 +< -3 3 0 >: -0.004638445643968018 -0.009867959722064149 +< -3 4 -1 >: -0.016068047046998310 -0.034183615211316749 +< -2 1 1 >: -0.010329458815927482 -0.021975181207275048 +< -2 2 0 >: -0.005301080735963453 -0.011277668253787605 +< -2 3 -1 >: 0.015182877336015459 0.032300480272238842 +< -2 4 -2 >: 0.008588732417776062 0.018271910908865912 +< -1 1 0 >: 0.011264796563922333 0.023965045039298652 +< -1 2 -1 >: -0.010329458815927482 -0.021975181207275048 +< -1 3 -2 >: -0.012883098626664095 -0.027407866363298870 +< 0 0 0 >: -0.006626350919954315 -0.014097085317234503 +< 0 1 -1 >: 0.007258803745608175 0.015442583246648416 +< 0 2 -2 >: 0.030796496110931115 0.065517331996457207 +< 1 1 -2 >: -0.016231178610509975 -0.034530665887705266 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 1 4 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: -0.000865745293242400 0.004697279271587992 +< -4 1 3 >: 0.001368863500108181 -0.007427050652057349 +< -4 2 2 >: -0.001552145314319865 0.008421483857153082 +< -4 3 1 >: 0.001368863500108181 -0.007427050652057350 +< -4 4 0 >: -0.000432872646621200 0.002348639635793996 +< -3 -1 4 >: 0.001368863500108181 -0.007427050652057348 +< -3 0 3 >: -0.001298617939863599 0.007045918907381987 +< -3 1 2 >: 0.000517381771439955 -0.002807161285717693 +< -3 2 1 >: 0.000517381771439955 -0.002807161285717694 +< -3 3 0 >: -0.000649308969931800 0.003522959453690993 +< -2 -2 4 >: -0.000776072657159932 0.004210741928576540 +< -2 -1 3 >: 0.000517381771439955 -0.002807161285717693 +< -2 0 2 >: 0.000680228444690457 -0.003690719427676279 +< -2 1 1 >: -0.001173311571521298 0.006366043416049158 +< -2 2 0 >: 0.000340114222345228 -0.001845359713838139 +< -1 -1 2 >: -0.000586655785760649 0.003183021708024579 +< -1 0 1 >: 0.000556550545655828 -0.003019679531735138 +< -1 1 0 >: 0.000278275272827914 -0.001509839765867569 +< 0 0 0 >: -0.000278275272827914 0.001509839765867569 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.006032080931175211 0.151129350255267830 +< 0 1 -1 >: -0.006032080931175210 0.151129350255267803 +< 1 -1 0 >: 0.010447870648162851 -0.261763713156996369 +< 1 0 -1 >: 0.010447870648162851 -0.261763713156996369 +< 2 -1 -1 >: -0.014775520368551681 0.370189793283764779 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.046178334643545510 0.143247010414325082 +< 0 1 -1 >: -0.053322147874359217 0.165407400046639341 +< 1 -2 1 >: 0.030785556429030327 -0.095498006942883351 +< 1 -1 0 >: 0.087074702854273864 -0.270109153196451346 +< 1 0 -1 >: 0.075408904698782503 -0.233921388462829477 +< 2 -2 0 >: -0.068838596900467508 0.213540035240034093 +< 2 -1 -1 >: -0.097352477351375644 0.301991213946084858 +< 3 -2 -1 >: 0.119231947353363149 -0.369862190485787501 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.060874691017562065 -0.029595270771200832 +< 0 1 -1 >: -0.081166254690082776 -0.039460361028267790 +< 0 2 -2 >: -0.020291563672520690 -0.009865090257066946 +< 1 -2 1 >: 0.045373315741521550 0.022059012418972568 +< 1 -1 0 >: 0.111141471504919542 0.054033324656200046 +< 1 0 -1 >: 0.111141471504919556 0.054033324656200053 +< 1 1 -2 >: 0.045373315741521550 0.022059012418972568 +< 2 -2 0 >: -0.078588888172180016 -0.038207330274453312 +< 2 -1 -1 >: -0.128335116982992853 -0.062392309070935084 +< 2 0 -2 >: -0.078588888172180058 -0.038207330274453326 +< 3 -2 -1 >: 0.120046509610478316 0.058362661028286779 +< 3 -1 -2 >: 0.120046509610478302 0.058362661028286772 +< 4 -2 -2 >: -0.169771402006690469 -0.082537266762386818 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.004809322860405252 -0.017106067831302731 +< 0 1 -1 >: -0.005890193508147660 -0.020950568846064662 +< 1 -2 1 >: 0.004164995772112190 0.014814289300767945 +< 1 -1 0 >: 0.009313213672442080 0.033125757914864960 +< 1 0 -1 >: 0.007604207120998307 0.027047068078126787 +< 2 -3 1 >: -0.002404661430202626 -0.008553033915651367 +< 2 -2 0 >: -0.008329991544224383 -0.029628578601535900 +< 2 -1 -1 >: -0.009313213672442082 -0.033125757914864960 +< 3 -3 0 >: 0.006362136131625050 0.022629200695914509 +< 3 -2 -1 >: 0.011019543024644305 0.039194925339996939 +< 4 -3 -1 >: -0.012724272263250106 -0.045258401391829031 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.001820359505609305 -0.038114414676048626 +< 0 1 -1 >: -0.000606786501869769 0.012704804892016220 +< 0 2 -2 >: -0.004247505513088378 0.088933634244113463 +< 0 3 -3 >: -0.001820359505609305 0.038114414676048626 +< 1 -3 2 >: 0.003323506546637227 -0.069587082280592627 +< 1 -2 1 >: 0.003432502801636616 -0.071869229542373486 +< 1 -1 0 >: -0.002350074016445069 0.049205497763593307 +< 1 0 -1 >: -0.002350074016445068 0.049205497763593294 +< 1 1 -2 >: 0.003432502801636615 -0.071869229542373472 +< 1 2 -3 >: 0.003323506546637228 -0.069587082280592641 +< 2 -3 1 >: -0.004458951937167850 0.093360867801165759 +< 2 -2 0 >: -0.001050985050585426 0.022005367573221690 +< 2 -1 -1 >: 0.003837654798708974 -0.080352241373641595 +< 2 0 -2 >: -0.001050985050585426 0.022005367573221694 +< 2 1 -3 >: -0.004458951937167850 0.093360867801165745 +< 3 -3 0 >: 0.004816218548574709 -0.100841262599615136 +< 3 -2 -1 >: -0.002270387196915739 0.047537027071734163 +< 3 -1 -2 >: -0.002270387196915739 0.047537027071734156 +< 3 0 -3 >: 0.004816218548574710 -0.100841262599615150 +< 4 -3 -1 >: -0.003932425977911945 0.082336546129020735 +< 4 -2 -2 >: 0.005076740107548792 -0.106296023980645332 +< 4 -1 -3 >: -0.003932425977911945 0.082336546129020735 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 1 1 ) +l=( 2 1 1 0 ) +num_ms=5 +< 0 0 0 0 >: -0.000065408670341292 -0.004809311015566168 +< 0 1 -1 0 >: -0.000065408670341292 -0.004809311015566167 +< 1 -1 0 0 >: 0.000113291140286642 0.008329971028361279 +< 1 0 -1 0 >: 0.000113291140286642 0.008329971028361279 +< 2 -1 -1 0 >: -0.000160217867090082 -0.011780358002483480 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 1 2 ) +l=( 2 1 1 0 ) +num_ms=5 +< 0 0 0 0 >: -0.000023351324155048 -0.011751894790749902 +< 0 1 -1 0 >: -0.000023351324155048 -0.011751894790749900 +< 1 -1 0 0 >: 0.000040445679860554 0.020354878862782852 +< 1 0 -1 0 >: 0.000040445679860554 0.020354878862782852 +< 2 -1 -1 0 >: -0.000057198828998196 -0.028786145748208952 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: 0.017629754203650469 -0.090933532602500491 +< 0 0 0 >: 0.017629754203650472 -0.090933532602500505 +< 1 -1 0 >: -0.061071260011347224 0.315002997158503717 +< 2 -1 -1 >: 0.043183902089630445 -0.222740755384864708 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: 0.120496386283590121 0.154444853460479925 +< -2 1 1 >: -0.073788665561023384 -0.094577771094274135 +< -1 -1 2 >: -0.073788665561023384 -0.094577771094274135 +< -1 0 1 >: 0.060248193141795026 0.077222426730239921 +< 0 -2 2 >: 0.060248193141795026 0.077222426730239921 +< 0 -1 1 >: 0.030124096570897513 0.038611213365119960 +< 0 0 0 >: -0.030124096570897513 -0.038611213365119960 +< 1 -2 1 >: -0.073788665561023384 -0.094577771094274135 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: 0.002020661438639850 -0.038631160094535065 +< -2 0 2 >: -0.005715293622977614 0.109265421071795613 +< -2 1 1 >: 0.003130395240070265 -0.059847135876322753 +< -1 -2 3 >: -0.003194946263087248 0.061081227276668197 +< -1 -1 2 >: 0.002474794733792907 -0.047313315201689243 +< -1 0 1 >: -0.001807334534524490 0.034552760008423049 +< 0 -3 3 >: 0.003194946263087247 -0.061081227276668190 +< 0 -1 1 >: -0.001916967757852348 0.036648736366000904 +< 0 0 0 >: 0.001277978505234899 -0.024432490910667279 +< 1 -3 2 >: -0.003194946263087248 0.061081227276668197 +< 1 -2 1 >: 0.002474794733792907 -0.047313315201689243 +< 2 -3 1 >: 0.002020661438639850 -0.038631160094535065 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.021795450007540320 0.034414313308814622 +< -2 -1 3 >: 0.032693175011310478 -0.051621469963221929 +< -2 0 2 >: -0.078151636206989131 0.123398915511877802 +< -2 1 1 >: 0.041189528880494666 -0.065036938968702745 +< -1 -3 4 >: 0.040775553259387698 -0.064383284801339494 +< -1 -2 3 >: -0.038529276248360361 0.060836485776353151 +< -1 -1 2 >: 0.026212855666749229 -0.041389254515146807 +< -1 0 1 >: -0.018420517307595374 0.029085403316504877 +< 0 -4 4 >: -0.047083553301326797 0.074343413622731364 +< 0 -3 3 >: 0.011770888325331696 -0.018585853405682834 +< 0 -2 2 >: 0.013452443800379089 -0.021240975320780394 +< 0 -1 1 >: -0.028586443075805552 0.045137072556658317 +< 0 0 0 >: 0.016815554750473857 -0.026551219150975486 +< 1 -4 3 >: 0.040775553259387698 -0.064383284801339494 +< 1 -3 2 >: -0.038529276248360361 0.060836485776353151 +< 1 -2 1 >: 0.026212855666749229 -0.041389254515146807 +< 2 -4 2 >: -0.021795450007540320 0.034414313308814622 +< 2 -3 1 >: 0.032693175011310478 -0.051621469963221929 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.039354261819319843 -0.073096770197199665 +< 0 1 -1 >: 0.045442387310286624 -0.084404879900490851 +< 1 -2 1 >: -0.026236174546213218 0.048731180131466427 +< 1 -1 0 >: -0.074207107736085048 0.137832591704732305 +< 1 0 -1 >: -0.064265240440818369 0.119366525885746422 +< 2 -2 0 >: 0.058665869754882465 -0.108966231397746097 +< 2 -1 -1 >: 0.082966068655768332 -0.154101522283377507 +< 3 -2 -1 >: -0.101612267085674737 0.188735049090203250 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.035522450263794123 -0.065388831263795730 +< -3 1 2 >: -0.035522450263794123 0.065388831263795730 +< -3 2 1 >: 0.022466370180727707 -0.041355528066004198 +< -2 -1 3 >: -0.035522450263794123 0.065388831263795730 +< -2 1 1 >: 0.027515571657631192 -0.050649970902529567 +< -1 -2 3 >: 0.022466370180727707 -0.041355528066004198 +< -1 -1 2 >: 0.027515571657631192 -0.050649970902529567 +< -1 0 1 >: -0.021313470158276469 0.039233298758277427 +< 0 -2 2 >: -0.031772245406879618 0.058485548670044331 +< 0 -1 1 >: -0.010047266186356280 0.018494754400197162 +< 0 0 0 >: 0.014208980105517650 -0.026155532505518293 +< 1 -2 1 >: 0.034804751023875737 -0.064067708589299083 +< 1 -1 0 >: -0.010047266186356280 0.018494754400197162 +< 2 -2 0 >: -0.031772245406879618 0.058485548670044331 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: 0.001098074194541128 0.019308485265777532 +< 0 -1 1 >: 0.004392296778164512 0.077233941063110143 +< 0 0 0 >: 0.003294222583623383 0.057925455797332583 +< 1 -2 1 >: -0.004910737086664580 -0.086350171193663311 +< 1 -1 0 >: -0.012028800123289836 -0.211513858626449752 +< 2 -2 0 >: 0.008505646136715820 0.149562883749695313 +< 2 -1 -1 >: 0.006944830989209591 0.122117583215317224 +< 3 -2 -1 >: -0.012992589085336324 -0.228461078646286619 +< 4 -2 -2 >: 0.009187147847411635 0.161546377947982378 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.003364811381474099 -0.039670949390755453 +< 0 1 -1 >: -0.004121035482660451 -0.048586791809563025 +< 1 -2 1 >: 0.002914012135299582 0.034356049964641026 +< 1 -1 0 >: 0.006515929221789180 0.076822463159316581 +< 1 0 -1 >: 0.005320233931157922 0.062725278508028157 +< 2 -3 1 >: -0.001682405690737050 -0.019835474695377730 +< 2 -2 0 >: -0.005828024270599166 -0.068712099929282067 +< 2 -1 -1 >: -0.006515929221789181 -0.076822463159316595 +< 3 -3 0 >: 0.004451227062010077 0.052479733180884128 +< 3 -2 -1 >: 0.007709751427426998 0.090897564236949599 +< 4 -3 -1 >: -0.008902454124020158 -0.104959466361768297 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: 0.000225437443465702 0.004175983593506603 +< 0 -2 2 >: 0.000526020701419971 0.009743961718182073 +< 0 -1 1 >: 0.000075145814488567 0.001391994531168869 +< 0 0 0 >: -0.000225437443465702 -0.004175983593506603 +< 1 -3 2 >: -0.000823181153949737 -0.015248536092900333 +< 1 -2 1 >: -0.000850177840042436 -0.015748620357825524 +< 1 -1 0 >: 0.000582076976102827 0.010782343274457651 +< 2 -3 1 >: 0.001104413410816999 0.020458057956650524 +< 2 -2 0 >: 0.000260312737340688 0.004822010503684995 +< 2 -1 -1 >: -0.000475263860824708 -0.008803746417983734 +< 3 -3 0 >: -0.001192902823224861 -0.022097228135008629 +< 3 -2 -1 >: 0.000562339783732584 0.010416733239793845 +< 4 -3 -1 >: 0.000974001076542131 0.018042311220214498 +< 4 -2 -2 >: -0.000628714991439295 -0.011646261813830326 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 2 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: 0.037780855057295837 -0.000045677834222940 +< -4 1 3 >: -0.059736776964873076 0.000072222997364039 +< -4 2 2 >: 0.033867569137196990 -0.000040946590706769 +< -3 -1 4 >: -0.029868388482436531 0.000036111498682019 +< -3 0 3 >: 0.056671282585943734 -0.000068516751334410 +< -3 1 2 >: -0.022578379424797991 0.000027297727137846 +< -2 -2 4 >: 0.033867569137196983 -0.000040946590706769 +< -2 -1 3 >: -0.011289189712398996 0.000013648863568923 +< -2 0 2 >: -0.029684957545018140 0.000035889726889453 +< -2 1 1 >: 0.025601475842088453 -0.000030952713156017 +< -1 -3 4 >: -0.029868388482436517 0.000036111498682019 +< -1 -2 3 >: -0.011289189712398992 0.000013648863568923 +< -1 -1 2 >: 0.025601475842088457 -0.000030952713156017 +< -1 0 1 >: -0.024287692536833033 0.000029364322000461 +< 0 -4 4 >: 0.018890427528647915 -0.000022838917111470 +< 0 -3 3 >: 0.028335641292971878 -0.000034258375667205 +< 0 -2 2 >: -0.014842478772509082 0.000017944863444726 +< 0 -1 1 >: -0.012143846268416520 0.000014682161000231 +< 0 0 0 >: 0.012143846268416521 -0.000014682161000231 +< 1 -4 3 >: -0.029868388482436517 0.000036111498682019 +< 1 -3 2 >: -0.011289189712398992 0.000013648863568923 +< 1 -2 1 >: 0.025601475842088457 -0.000030952713156017 +< 2 -4 2 >: 0.033867569137196983 -0.000040946590706769 +< 2 -3 1 >: -0.011289189712398996 0.000013648863568923 +< 3 -4 1 >: -0.029868388482436531 0.000036111498682019 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 0 1 1 2 ) +num_ms=4 +< 0 -1 -1 2 >: 0.000320036471237378 -0.009099011397214153 +< 0 -1 0 1 >: -0.000452599918077926 0.012867945322127617 +< 0 -1 1 0 >: 0.000130654342268747 -0.003714655847823882 +< 0 0 0 0 >: 0.000130654342268747 -0.003714655847823883 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 0 2 2 2 ) +num_ms=5 +< 0 -2 0 2 >: -0.001100000042281807 0.073412066188337413 +< 0 -2 1 1 >: 0.000898146273543449 -0.059940701041617410 +< 0 -1 -1 2 >: 0.000449073136771725 -0.029970350520808705 +< 0 -1 0 1 >: -0.000550000021140903 0.036706033094168693 +< 0 0 0 0 >: 0.000183333340380301 -0.012235344364722898 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 1 1 1 1 ) +num_ms=2 +< -1 -1 1 1 >: -0.000000000000114814 0.000000000000002808 +< 1 -1 -1 1 >: 0.000000000000114814 -0.000000000000002808 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 1 1 2 2 ) +num_ms=16 +< -1 -1 0 2 >: 0.000357500900835941 0.004881002808116767 +< -1 -1 1 1 >: -0.000218923697408346 -0.002988991578244476 +< -1 0 -1 2 >: -0.000154802431010495 -0.002113536211060421 +< -1 0 0 1 >: 0.000126395655630697 0.001725695092304972 +< -1 1 -2 2 >: 0.000072974565817804 0.000996330522085308 +< -1 1 -1 1 >: 0.000036487282893880 0.000498165265038838 +< -1 1 0 0 >: -0.000072974565802782 -0.000996330526081492 +< 0 -1 -1 2 >: -0.000154802430989251 -0.002113536216711879 +< 0 -1 0 1 >: 0.000126395655630697 0.001725695092304972 +< 0 0 -2 2 >: 0.000145949131605564 0.001992661052162984 +< 0 0 -1 1 >: 0.000072974565802782 0.000996330526081492 +< 0 0 0 0 >: -0.000072974565802782 -0.000996330526081492 +< 0 1 -2 1 >: -0.000154802431010495 -0.002113536211060421 +< 1 -1 -2 2 >: 0.000072974565787760 0.000996330530077676 +< 1 -1 -1 1 >: 0.000036487282908902 0.000498165261042654 +< 1 0 -2 1 >: -0.000154802430989251 -0.002113536216711879 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 2 0 1 1 ) +num_ms=4 +< 0 0 -1 1 >: 0.000068593145415220 -0.004344525164863466 +< 0 0 0 0 >: 0.000068593145415220 -0.004344525164863467 +< 1 0 -1 0 >: -0.000237613625820242 0.015049876640610154 +< 2 0 -1 -1 >: 0.000168018206119816 -0.010641869828596459 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 2 0 2 2 ) +num_ms=8 +< -2 0 0 2 >: -0.002486022037894315 0.105169540284253848 +< -2 0 1 1 >: 0.001522371370538764 -0.064402927544875491 +< -1 0 -1 2 >: 0.001522371370538764 -0.064402927544875491 +< -1 0 0 1 >: -0.001243011018947157 0.052584770142126890 +< 0 0 -2 2 >: -0.001243011018947157 0.052584770142126890 +< 0 0 -1 1 >: -0.000621505509473579 0.026292385071063445 +< 0 0 0 0 >: 0.000621505509473579 -0.026292385071063445 +< 1 0 -2 1 >: 0.001522371370538764 -0.064402927544875491 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 2 1 1 2 ) +num_ms=13 +< -2 -1 1 2 >: -0.000143002816486277 0.006718120187445183 +< -2 0 0 2 >: 0.000279983781678076 -0.012447391776107240 +< -2 0 1 1 >: -0.000294838600027421 0.012852841924573460 +< -1 -1 0 2 >: -0.000294838600027421 0.012852841924573460 +< -1 -1 1 1 >: 0.000351485189921215 -0.015806451869829829 +< -1 0 0 1 >: -0.000071501408243138 0.003359060093722592 +< 0 -1 -1 2 >: 0.000170225145093324 -0.007420591745004197 +< 0 -1 0 1 >: 0.000120367354423953 -0.005247150743309381 +< 0 -1 1 0 >: -0.000210489657199764 0.009417947881979020 +< 0 0 0 0 >: 0.000001003641882413 -0.000164808099797187 +< 1 -1 -1 1 >: -0.000208482373434938 0.009088331682384650 +< 1 -1 0 0 >: 0.000120367354423953 -0.005247150743309381 +< 2 -1 -1 0 >: 0.000170225145093324 -0.007420591745004197 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 1 2 2 2 ) +l=( 2 2 2 2 ) +num_ms=12 +< -2 -2 2 2 >: 0.000000000000004360 0.000000000000028454 +< -2 -1 1 2 >: -0.000000000000004360 -0.000000000000028454 +< -1 -2 1 2 >: -0.000000000000004360 -0.000000000000028454 +< -1 -1 0 2 >: 0.000000000000001506 -0.000000000000040996 +< -1 -1 1 1 >: 0.000000000000002516 0.000000000000078663 +< 0 -2 1 1 >: 0.000000000000001506 -0.000000000000040996 +< 0 -1 -1 2 >: -0.000000000000001506 0.000000000000040996 +< 1 -2 -1 2 >: 0.000000000000004360 0.000000000000028454 +< 1 -2 0 1 >: -0.000000000000001506 0.000000000000040996 +< 1 -1 -1 1 >: -0.000000000000002516 -0.000000000000078663 +< 2 -2 -2 2 >: -0.000000000000004360 -0.000000000000028454 +< 2 -2 -1 1 >: 0.000000000000004360 0.000000000000028454 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 3 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: 0.022445003465771395 -0.028678602089656006 +< -2 0 2 >: -0.031742028308805043 0.040557668025092926 +< -2 1 1 >: 0.034771649851400160 -0.044428699314298783 +< -2 2 0 >: -0.031742028308805043 0.040557668025092926 +< -1 -2 3 >: -0.035488666521105362 0.045344851356488684 +< -1 -1 2 >: 0.027489402883069964 -0.035123970827986309 +< -1 0 1 >: -0.010037710700936646 0.012825460754427673 +< -1 1 0 >: -0.010037710700936646 0.012825460754427673 +< 0 -3 3 >: 0.035488666521105355 -0.045344851356488684 +< 0 -1 1 >: -0.021293199912663211 0.027206910813893204 +< 0 0 0 >: 0.014195466608442144 -0.018137940542595474 +< 1 -3 2 >: -0.035488666521105362 0.045344851356488684 +< 1 -2 1 >: 0.027489402883069964 -0.035123970827986309 +< 2 -3 1 >: 0.022445003465771395 -0.028678602089656006 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.003909118032464789 -0.065474700467181915 +< 0 1 -1 >: -0.004513860696675130 -0.075603671879675149 +< 1 -2 1 >: 0.002606078688309858 0.043649800311454594 +< 1 -1 0 >: 0.007371103651238577 0.123460279190672900 +< 1 0 -1 >: 0.006383563015900836 0.106919738137441989 +< 2 -2 0 >: -0.005827369101774331 -0.097603920700703978 +< 2 -1 -1 >: -0.008241144416683178 -0.138032788395723638 +< 3 -2 -1 >: 0.010093299358730152 0.169054949671542970 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 3 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.114994567612826615 0.116868257509743459 +< -3 1 2 >: -0.114994567612826615 -0.116868257509743459 +< -3 2 1 >: 0.072728950440552789 0.073913975981173455 +< -2 -1 3 >: -0.114994567612826615 -0.116868257509743459 +< -2 1 1 >: 0.089074409053760087 0.090525763007103299 +< -1 -2 3 >: 0.072728950440552789 0.073913975981173455 +< -1 -1 2 >: 0.089074409053760087 0.090525763007103299 +< -1 0 1 >: -0.068996740567695947 -0.070120954505846059 +< 0 -2 2 >: -0.102854268090190465 -0.104530147281494720 +< 0 -1 1 >: -0.032525375423457868 -0.033055334956238115 +< 0 0 0 >: 0.045997827045130647 0.046747303003897386 +< 1 -2 1 >: 0.112671205537362235 0.114507039210823947 +< 1 -1 0 >: -0.032525375423457868 -0.033055334956238115 +< 2 -2 0 >: -0.102854268090190465 -0.104530147281494720 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 3 ) +l=( 3 3 2 ) +num_ms=14 +< -3 1 2 >: -0.018663326793617287 -0.075821938916878287 +< -3 2 1 >: 0.029509310691938944 0.119885011793747803 +< -3 3 0 >: -0.029509310691938941 -0.119885011793747789 +< -2 1 1 >: -0.022857813773588007 -0.092862530827413026 +< -2 3 -1 >: 0.029509310691938944 0.119885011793747803 +< -1 1 0 >: 0.017705586415163361 0.071931007076248651 +< -1 2 -1 >: -0.022857813773588007 -0.092862530827413026 +< -1 3 -2 >: -0.018663326793617287 -0.075821938916878287 +< 0 0 0 >: -0.011803724276775576 -0.047954004717499117 +< 0 1 -1 >: 0.008346493479364291 0.033908601920795332 +< 0 2 -2 >: 0.026393929870534748 0.107228414341673683 +< 1 0 -1 >: 0.008346493479364291 0.033908601920795332 +< 1 1 -2 >: -0.028913101542602578 -0.117462842680890273 +< 2 0 -2 >: 0.026393929870534748 0.107228414341673683 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.015960834663241177 -0.027940446653430408 +< 0 1 -1 >: 0.019547950396933734 -0.034219918743179180 +< 1 -2 1 >: -0.013822488283970105 0.024197136594954639 +< 1 -1 0 >: -0.030908023421151579 0.054106442287166372 +< 1 0 -1 >: -0.025236295446604332 0.044177725133634660 +< 2 -3 1 >: 0.007980417331620590 -0.013970223326715207 +< 2 -2 0 >: 0.027644976567940221 -0.048394273189909291 +< 2 -1 -1 >: 0.030908023421151582 -0.054106442287166379 +< 3 -3 0 >: -0.021114199617977752 0.036961736682521874 +< 3 -2 -1 >: -0.036570866499488860 0.064019605870110227 +< 4 -3 -1 >: 0.042228399235955519 -0.073923473365043776 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.019034907164356060 -0.004788559928114240 +< -2 0 2 >: 0.026919423870345141 0.006772046394575493 +< -2 1 1 >: -0.029488751377662114 -0.007418405141561056 +< -2 2 0 >: 0.026919423870345141 0.006772046394575493 +< -1 -2 3 >: 0.030096830844611094 0.007571378042526579 +< -1 -1 2 >: -0.023312904926960101 -0.005864764213309192 +< -1 0 1 >: 0.008512669272979584 0.002141509102718990 +< -1 1 0 >: 0.008512669272979584 0.002141509102718990 +< 0 -3 3 >: -0.030096830844611091 -0.007571378042526578 +< 0 -1 1 >: 0.018058098506766651 0.004542826825515945 +< 0 0 0 >: -0.012038732337844436 -0.003028551217010631 +< 1 -3 2 >: 0.030096830844611094 0.007571378042526579 +< 1 -2 1 >: -0.023312904926960101 -0.005864764213309192 +< 2 -3 1 >: -0.019034907164356060 -0.004788559928114240 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.004494209735994228 0.105381182914565316 +< 0 1 -1 >: 0.005189466401741807 0.121683708646490904 +< 1 -2 1 >: -0.002996139823996151 -0.070254121943043521 +< 1 -1 0 >: -0.008474363147722992 -0.198708664128930873 +< 1 0 -1 >: -0.007339013766822769 -0.172086751087723699 +< 2 -2 0 >: 0.006699572316549651 0.157092992364204959 +< 2 -1 -1 >: 0.009474626032163850 0.222163040355231683 +< 3 -2 -1 >: -0.011603999641245916 -0.272093044287832653 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: -0.108583709135183393 0.020736957145319656 +< -3 1 2 >: 0.108583709135183407 -0.020736957145319659 +< -3 2 1 >: -0.068674367531282338 0.013115203264102683 +< -2 -1 3 >: 0.108583709135183407 -0.020736957145319659 +< -2 1 1 >: -0.084108579429999122 0.016062777934967992 +< -1 -2 3 >: -0.068674367531282338 0.013115203264102683 +< -1 -1 2 >: -0.084108579429999122 0.016062777934967992 +< -1 0 1 >: 0.065150225481110019 -0.012442174287191791 +< 0 -2 2 >: 0.097120221950134047 -0.018547698329373908 +< 0 -1 1 >: 0.030712110822350355 -0.005865297207452147 +< 0 0 0 >: -0.043433483654073360 0.008294782858127863 +< 1 -2 1 >: -0.106389872703993582 0.020317985529597946 +< 1 -1 0 >: 0.030712110822350355 -0.005865297207452147 +< 2 -2 0 >: 0.097120221950134047 -0.018547698329373908 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 4 ) +l=( 3 3 2 ) +num_ms=14 +< -3 1 2 >: 0.016480307505388939 0.058759687309151966 +< -3 2 1 >: -0.026057654128498350 -0.092907223248105325 +< -3 3 0 >: 0.026057654128498347 0.092907223248105311 +< -2 1 1 >: 0.020184172096181417 0.071965625676457326 +< -2 3 -1 >: -0.026057654128498350 -0.092907223248105325 +< -1 1 0 >: -0.015634592477099005 -0.055744333948863176 +< -1 2 -1 >: 0.020184172096181417 0.071965625676457326 +< -1 3 -2 >: 0.016480307505388939 0.058759687309151966 +< 0 0 0 >: 0.010423061651399340 0.037162889299242129 +< 0 1 -1 >: -0.007370217574429931 -0.026278131031979103 +< 0 2 -2 >: -0.023306674386200155 -0.083098746713404975 +< 1 0 -1 >: -0.007370217574429931 -0.026278131031979103 +< 1 1 -2 >: 0.025531182603499389 0.091030116150680365 +< 2 0 -2 >: -0.023306674386200155 -0.083098746713404975 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 2 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.011735387748534349 0.046335658991316926 +< 0 1 -1 >: -0.014372855958809133 0.056749360712164972 +< 1 -2 1 >: 0.010163143913491416 -0.040127857787573294 +< 1 -1 0 >: 0.022725480655680048 -0.089728617804458219 +< 1 0 -1 >: 0.018555277255301931 -0.073263109648710786 +< 2 -3 1 >: -0.005867693874267176 0.023167829495658467 +< 2 -2 0 >: -0.020326287826982838 0.080255715575146616 +< 2 -1 -1 >: -0.022725480655680051 0.089728617804458233 +< 3 -3 0 >: 0.015524458760768045 -0.061296315262659266 +< 3 -2 -1 >: 0.026889151333658032 -0.106168332351685518 +< 4 -3 -1 >: -0.031048917521536101 0.122592630525318574 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.016074341813435620 -0.076988436962834667 +< 0 1 -1 >: 0.016074341813435616 -0.076988436962834653 +< 1 -1 0 >: -0.027841576719099339 0.133347884414943385 +< 1 0 -1 >: -0.027841576719099339 0.133347884414943385 +< 2 -1 -1 >: 0.039373935394001296 -0.188582386653372791 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.021681852163816049 0.144948481443401556 +< 0 1 -1 >: 0.025036046366617718 0.167372089559950643 +< 1 -2 1 >: -0.014454568109210694 -0.096632320962267662 +< 1 -1 0 >: -0.040883692516582790 -0.273317477736857828 +< 1 0 -1 >: -0.035406316319872427 -0.236699879018406500 +< 2 -2 0 >: 0.032321396877595721 0.216076438495208439 +< 2 -1 -1 >: 0.045709357819139269 0.305578229829199632 +< 3 -2 -1 >: -0.055982301563593850 -0.374255369792232562 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.003824450171526099 -0.001296334662190527 +< 0 1 -1 >: 0.005099266895368134 -0.001728446216254036 +< 0 2 -2 >: 0.001274816723842033 -0.000432111554063509 +< 1 -2 1 >: -0.002850576853364363 0.000966230808749082 +< 1 -1 0 >: -0.006982458763331155 0.002366772455191970 +< 1 0 -1 >: -0.006982458763331156 0.002366772455191971 +< 1 1 -2 >: -0.002850576853364363 0.000966230808749082 +< 2 -2 0 >: 0.004937343940906893 -0.001673560852591776 +< 2 -1 -1 >: 0.008062648893229409 -0.002732913428231351 +< 2 0 -2 >: 0.004937343940906894 -0.001673560852591776 +< 3 -2 -1 >: -0.007541917447079142 0.002556406429038884 +< 3 -1 -2 >: -0.007541917447079141 0.002556406429038883 +< 4 -2 -2 >: 0.010665881939957590 -0.003615304642884561 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000693579002525661 0.141853933592052839 +< 0 1 -1 >: 0.000849457326248198 0.173734877653589748 +< 1 -2 1 >: -0.000600657035718694 -0.122849110117468505 +< 1 -1 0 >: -0.001343109963030520 -0.274698961198016789 +< 1 0 -1 >: -0.001096644692624383 -0.224290762602578686 +< 2 -3 1 >: 0.000346789501262831 0.070926966796026433 +< 2 -2 0 >: 0.001201314071437389 0.245698220234937093 +< 2 -1 -1 >: 0.001343109963030520 0.274698961198016789 +< 3 -3 0 >: -0.000917518777629570 -0.187655115390421567 +< 3 -2 -1 >: -0.001589189139752906 -0.325028194156410655 +< 4 -3 -1 >: 0.001835037555259140 0.375310230780843246 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.002611489685934477 -0.008214556580714625 +< 0 1 -1 >: 0.000870496561978160 0.002738185526904878 +< 0 2 -2 >: 0.006093475933847112 0.019167298688334129 +< 0 3 -3 >: 0.002611489685934477 0.008214556580714625 +< 1 -3 2 >: -0.004767906032261314 -0.014997659797199688 +< 1 -2 1 >: -0.004924272175794656 -0.015489516433770379 +< 1 -1 0 >: 0.003371418687472223 0.010604946944528766 +< 1 0 -1 >: 0.003371418687472221 0.010604946944528761 +< 1 1 -2 >: -0.004924272175794655 -0.015489516433770376 +< 1 2 -3 >: -0.004767906032261315 -0.014997659797199692 +< 2 -3 1 >: 0.006396817199080564 0.020121472085972536 +< 2 -2 0 >: 0.001507744273160201 0.004742676453149000 +< 2 -1 -1 >: -0.005505503662393822 -0.017317805842255340 +< 2 0 -2 >: 0.001507744273160201 0.004742676453149000 +< 2 1 -3 >: 0.006396817199080564 0.020121472085972536 +< 3 -3 0 >: -0.006909352260392797 -0.021733673843239983 +< 3 -2 -1 >: 0.003257099891286899 0.010245352103101126 +< 3 -1 -2 >: 0.003257099891286898 0.010245352103101124 +< 3 0 -3 >: -0.006909352260392798 -0.021733673843239987 +< 4 -3 -1 >: 0.005641462497035975 0.017745470384003797 +< 4 -2 -2 >: -0.007283096766424677 -0.022909303755954541 +< 4 -1 -3 >: 0.005641462497035975 0.017745470384003797 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.003912935032967597 0.008270316149055911 +< 0 1 -1 >: -0.003912935032967597 0.008270316149055910 +< 1 -1 0 >: 0.006777402283816078 -0.014324607764822219 +< 1 0 -1 >: 0.006777402283816078 -0.014324607764822219 +< 2 -1 -1 >: -0.009584694227431086 0.020258054576686526 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.023188891044067617 0.009202290289687139 +< 0 1 -1 >: -0.026776224973002669 0.010625889551823893 +< 1 -2 1 >: 0.015459260696045071 -0.006134860193124757 +< 1 -1 0 >: 0.043725392281216559 -0.017352004976759719 +< 1 0 -1 >: 0.037867300505973533 -0.015027277116467919 +< 2 -2 0 >: -0.034567957798247499 0.013717964424284447 +< 2 -1 -1 >: -0.048886474741822408 0.019400131336974692 +< 3 -2 -1 >: 0.059873459220461445 -0.023760211359283002 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.034192908607169961 -0.017877247109522633 +< 0 1 -1 >: 0.045590544809559964 -0.023836329479363517 +< 0 2 -2 >: 0.011397636202389989 -0.005959082369840879 +< 1 -2 1 >: -0.025485889331356565 0.013324913262484746 +< 1 -1 0 >: -0.062427424502865134 0.032639238359931919 +< 1 0 -1 >: -0.062427424502865148 0.032639238359931926 +< 1 1 -2 >: -0.025485889331356565 0.013324913262484746 +< 2 -2 0 >: 0.044142855197987156 -0.023079426777071942 +< 2 -1 -1 >: 0.072084980683088468 -0.037688546106502109 +< 2 0 -2 >: 0.044142855197987177 -0.023079426777071949 +< 3 -2 -1 >: -0.067429325112083729 0.035254406734040983 +< 3 -1 -2 >: -0.067429325112083716 0.035254406734040983 +< 4 -2 -2 >: 0.095359466075173496 -0.049857260136698119 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.004687493334737923 0.008742309607119626 +< 0 1 -1 >: 0.005740983421402529 0.010707098855437179 +< 1 -2 1 >: -0.004059488307953275 -0.007571062207514351 +< 1 -1 0 >: -0.009077291810449124 -0.016929409757881712 +< 1 0 -1 >: -0.007411577727314956 -0.013822805184434893 +< 2 -3 1 >: 0.002343746667368962 0.004371154803559814 +< 2 -2 0 >: 0.008118976615906553 0.015142124415028707 +< 2 -1 -1 >: 0.009077291810449126 0.016929409757881712 +< 3 -3 0 >: -0.006200970817994696 -0.011564988552384657 +< 3 -2 -1 >: -0.010740396513018757 -0.020031147761682674 +< 4 -3 -1 >: 0.012401941635989394 0.023129977104769321 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.002177512226194075 0.007340828969379939 +< 0 1 -1 >: -0.000725837408731359 -0.002446942989793315 +< 0 2 -2 >: -0.005080861861119508 -0.017128600928553190 +< 0 3 -3 >: -0.002177512226194075 -0.007340828969379939 +< 1 -3 2 >: 0.003975575218432621 0.013402458724389308 +< 1 -2 1 >: 0.004105956430022523 0.013841999850077896 +< 1 -1 0 >: -0.002811156196070897 -0.009476969448588489 +< 1 0 -1 >: -0.002811156196070896 -0.009476969448588486 +< 1 1 -2 >: 0.004105956430022522 0.013841999850077892 +< 1 2 -3 >: 0.003975575218432622 0.013402458724389310 +< 2 -3 1 >: -0.005333793862847352 -0.017981285264021773 +< 2 -2 0 >: -0.001257187269956850 -0.004238229581546509 +< 2 -1 -1 >: 0.004590598845091359 0.015475826304658035 +< 2 0 -2 >: -0.001257187269956850 -0.004238229581546510 +< 2 1 -3 >: -0.005333793862847351 -0.017981285264021773 +< 3 -3 0 >: 0.005761155827312150 0.019422007870037901 +< 3 -2 -1 >: -0.002715834901976544 -0.009155622312774864 +< 3 -1 -2 >: -0.002715834901976544 -0.009155622312774864 +< 3 0 -3 >: 0.005761155827312151 0.019422007870037904 +< 4 -3 -1 >: -0.004703964035192215 -0.015858003020637335 +< 4 -2 -2 >: 0.006072791456486028 0.020472593867678430 +< 4 -1 -3 >: -0.004703964035192215 -0.015858003020637335 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: -0.047029213218911819 -0.050627883867582490 +< 0 0 0 >: -0.047029213218911826 -0.050627883867582504 +< 1 -1 0 >: 0.162913973470290296 0.175380134276699212 +< 2 -1 -1 >: -0.115197575390887555 -0.124012482232461266 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: -0.025237475186649448 0.183673013227056120 +< -2 1 1 >: 0.015454734150860693 -0.112476290481438201 +< -1 -1 2 >: 0.015454734150860693 -0.112476290481438201 +< -1 0 1 >: -0.012618737593324717 0.091836506613528004 +< 0 -2 2 >: -0.012618737593324717 0.091836506613528004 +< 0 -1 1 >: -0.006309368796662359 0.045918253306764002 +< 0 0 0 >: 0.006309368796662359 -0.045918253306764002 +< 1 -2 1 >: 0.015454734150860693 -0.112476290481438201 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: -0.020074498512695594 0.107062520909747841 +< -2 0 2 >: 0.056779256108985293 -0.302818538184837061 +< -2 1 1 >: -0.031099279369254246 0.165860544194574744 +< -1 -2 3 >: 0.031740569092890310 -0.169280709057102768 +< -1 -1 2 >: -0.024586139099182017 0.131124273402468461 +< -1 0 1 >: 0.017955177315442314 -0.095759629838675545 +< 0 -3 3 >: -0.031740569092890310 0.169280709057102741 +< 0 -1 1 >: 0.019044341455734182 -0.101568425434261631 +< 0 0 0 >: -0.012696227637156124 0.067712283622841096 +< 1 -3 2 >: 0.031740569092890310 -0.169280709057102768 +< 1 -2 1 >: -0.024586139099182017 0.131124273402468461 +< 2 -3 1 >: -0.020074498512695594 0.107062520909747841 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.000841419805470141 -0.009360728564836463 +< -2 -1 3 >: 0.001262129708205211 0.014041092847254693 +< -2 0 2 >: -0.003017067071875477 -0.033564631754718646 +< -2 1 1 >: 0.001590133966770241 0.017690114194954164 +< -1 -3 4 >: 0.001574152315257623 0.017512319590103093 +< -1 -2 3 >: -0.001487434125681505 -0.016547586612606198 +< -1 -1 2 >: 0.001011955059808471 0.011257919736494842 +< -1 0 1 >: -0.000711129528605930 -0.007911259573930293 +< 0 -4 4 >: -0.001817674525918921 -0.020221484858961546 +< 0 -3 3 >: 0.000454418631479730 0.005055371214740385 +< 0 -2 2 >: 0.000519335578833978 0.005777567102560443 +< 0 -1 1 >: -0.001103588105022202 -0.012277330092940936 +< 0 0 0 >: 0.000649169473542472 0.007221958878200552 +< 1 -4 3 >: 0.001574152315257623 0.017512319590103093 +< 1 -3 2 >: -0.001487434125681505 -0.016547586612606198 +< 1 -2 1 >: 0.001011955059808471 0.011257919736494842 +< 2 -4 2 >: -0.000841419805470141 -0.009360728564836463 +< 2 -3 1 >: 0.001262129708205211 0.014041092847254693 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.005205621898156869 -0.051588496234578299 +< 0 1 -1 >: -0.006010934408400555 -0.059569264376243526 +< 1 -2 1 >: 0.003470414598771245 0.034392330823052188 +< 1 -1 0 >: 0.009815814785279757 0.097276201383165298 +< 1 0 -1 >: 0.008500744962895162 0.084243661581472062 +< 2 -2 0 >: -0.007760082952960163 -0.076903589625006000 +< 2 -1 -1 >: -0.010974414557216518 -0.108758099442858316 +< 3 -2 -1 >: 0.013440857945476127 0.133200924514937147 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: -0.082462230780954784 0.139406072728251590 +< -3 1 2 >: 0.082462230780954798 -0.139406072728251590 +< -3 2 1 >: -0.052153694041252537 0.088168141896071694 +< -2 -1 3 >: 0.082462230780954798 -0.139406072728251590 +< -2 1 1 >: -0.063874969301150136 0.107983479607339714 +< -1 -2 3 >: -0.052153694041252537 0.088168141896071694 +< -1 -1 2 >: -0.063874969301150136 0.107983479607339714 +< -1 0 1 >: 0.049477338468572864 -0.083643643636950926 +< 0 -2 2 >: 0.073756461440996235 -0.124688582038660123 +< 0 -1 1 >: 0.023323841030793283 -0.039429991745892706 +< 0 0 0 >: -0.032984892312381914 0.055762429091300636 +< 1 -2 1 >: -0.080796155385987251 0.136589498091815281 +< 1 -1 0 >: 0.023323841030793283 -0.039429991745892706 +< 2 -2 0 >: 0.073756461440996235 -0.124688582038660123 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: -0.008898299215685870 -0.009776235584328294 +< 0 -1 1 >: -0.035593196862743488 -0.039104942337313174 +< 0 0 0 >: -0.026694897647057608 -0.029328706752984872 +< 1 -2 1 >: 0.039794403860813336 0.043720654661220881 +< 1 -1 0 >: 0.097475984077233582 0.107093295140426092 +< 2 -2 0 >: -0.068925929343843784 -0.075726395213407613 +< 2 -1 -1 >: -0.056277785646514485 -0.061830342777729051 +< 3 -2 -1 >: 0.105286096187780731 0.115673979390527384 +< 4 -2 -2 >: -0.074448512579038853 -0.081793855233874835 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.015007866695251853 -0.057139486949664538 +< 0 1 -1 >: -0.018380807765538344 -0.069981293595548277 +< 1 -2 1 >: 0.012997193814698516 0.049484247257618894 +< 1 -1 0 >: 0.029062608886405689 0.110650140683443421 +< 1 0 -1 >: 0.023729520788589985 0.090345461547203396 +< 2 -3 1 >: -0.007503933347625928 -0.028569743474832276 +< 2 -2 0 >: -0.025994387629397042 -0.098968494515237829 +< 2 -1 -1 >: -0.029062608886405692 -0.110650140683443421 +< 3 -3 0 >: 0.019853541492622598 0.075588436255316513 +< 3 -2 -1 >: 0.034387342575399195 0.130923012058889593 +< 4 -3 -1 >: -0.039707082985245210 -0.151176872510633054 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: 0.002520546632108451 -0.005915906059051884 +< 0 -2 2 >: 0.005881275474919720 -0.013803780804454395 +< 0 -1 1 >: 0.000840182210702818 -0.001971968686350630 +< 0 0 0 >: -0.002520546632108451 0.005915906059051884 +< 1 -3 2 >: -0.009203734984329824 0.021601834644161370 +< 1 -2 1 >: -0.009505576617924266 0.022310278886496913 +< 1 -1 0 >: 0.006508023419663483 -0.015274803762956998 +< 2 -3 1 >: 0.012348106243112675 -0.028981902421832895 +< 2 -2 0 >: 0.002910476553105637 -0.006831099911388285 +< 2 -1 -1 >: -0.005313778870752801 0.012471825046796354 +< 3 -3 0 >: -0.013337479113000747 0.031304032423742960 +< 3 -2 -1 >: 0.006287347949824511 -0.014756862403541467 +< 4 -3 -1 >: 0.010890006093960071 -0.025559635443236802 +< 4 -2 -2 >: -0.007029468707000771 0.016498673734464821 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 3 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: 0.003679990763049324 -0.009296407074617208 +< -4 1 3 >: -0.005818576289808433 0.014698910205946636 +< -4 2 2 >: 0.003298822681562143 -0.008333498774700855 +< -3 -1 4 >: -0.002909288144904216 0.007349455102973316 +< -3 0 3 >: 0.005519986144573985 -0.013944610611925807 +< -3 1 2 >: -0.002199215121041429 0.005555665849800571 +< -2 -2 4 >: 0.003298822681562143 -0.008333498774700854 +< -2 -1 3 >: -0.001099607560520714 0.002777832924900285 +< -2 0 2 >: -0.002891421313824468 0.007304319844342088 +< -2 1 1 >: 0.002493675552775042 -0.006299532945405699 +< -1 -3 4 >: -0.002909288144904214 0.007349455102973313 +< -1 -2 3 >: -0.001099607560520714 0.002777832924900284 +< -1 -1 2 >: 0.002493675552775043 -0.006299532945405700 +< -1 0 1 >: -0.002365708347674566 0.005976261690825347 +< 0 -4 4 >: 0.001839995381524662 -0.004648203537308603 +< 0 -3 3 >: 0.002759993072286993 -0.006972305305962906 +< 0 -2 2 >: -0.001445710656912235 0.003652159922171047 +< 0 -1 1 >: -0.001182854173837283 0.002988130845412674 +< 0 0 0 >: 0.001182854173837283 -0.002988130845412675 +< 1 -4 3 >: -0.002909288144904214 0.007349455102973313 +< 1 -3 2 >: -0.001099607560520714 0.002777832924900284 +< 1 -2 1 >: 0.002493675552775043 -0.006299532945405700 +< 2 -4 2 >: 0.003298822681562143 -0.008333498774700854 +< 2 -3 1 >: -0.001099607560520714 0.002777832924900285 +< 3 -4 1 >: -0.002909288144904216 0.007349455102973316 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.003451767512611046 0.009424699117887672 +< -2 0 2 >: 0.004881536430493386 -0.013328537313802496 +< -2 1 1 >: -0.005347455236528954 0.014600681090637878 +< -2 2 0 >: 0.004881536430493386 -0.013328537313802496 +< -1 -2 3 >: 0.005457723646612442 -0.014901757737152405 +< -1 -1 2 >: -0.004227534558306482 0.011542851909041760 +< -1 0 1 >: 0.001543677360144733 -0.004214853579015829 +< -1 1 0 >: 0.001543677360144733 -0.004214853579015829 +< 0 -3 3 >: -0.005457723646612441 0.014901757737152403 +< 0 -1 1 >: 0.003274634187967464 -0.008941054642291439 +< 0 0 0 >: -0.002183089458644977 0.005960703094860961 +< 1 -3 2 >: 0.005457723646612442 -0.014901757737152405 +< 1 -2 1 >: -0.004227534558306482 0.011542851909041760 +< 2 -3 1 >: -0.003451767512611046 0.009424699117887672 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.002196774961861487 0.032475662370909410 +< 0 1 -1 >: 0.002536617231159517 0.037499664823911878 +< 1 -2 1 >: -0.001464516641240990 -0.021650441580606264 +< 1 -1 0 >: -0.004142278592728203 -0.061236696229319557 +< 1 0 -1 >: -0.003587318490855077 -0.053032534578421463 +< 2 -2 0 >: 0.003274758763994527 0.048411859117123611 +< 2 -1 -1 >: 0.004631208257541214 0.068464707743131778 +< 3 -2 -1 >: -0.005672048561769978 -0.083851799679724656 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.092871730118677082 0.122981467016222271 +< -3 1 2 >: -0.092871730118677095 -0.122981467016222284 +< -3 2 1 >: 0.058737239483095893 0.077780309152026841 +< -2 -1 3 >: -0.092871730118677095 -0.122981467016222284 +< -2 1 1 >: 0.071938132816621259 0.095261034729197155 +< -1 -2 3 >: 0.058737239483095893 0.077780309152026841 +< -1 -1 2 >: 0.071938132816621259 0.095261034729197155 +< -1 0 1 >: -0.055723038071206238 -0.073788880209733343 +< 0 -2 2 >: -0.083067000693350684 -0.109997968088368550 +< 0 -1 1 >: -0.026268092058977410 -0.034784411714976211 +< 0 0 0 >: 0.037148692047470837 0.049192586806488907 +< 1 -2 1 >: 0.090995340128090879 0.120496736803465732 +< 1 -1 0 >: -0.026268092058977410 -0.034784411714976211 +< 2 -2 0 >: -0.083067000693350684 -0.109997968088368550 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 4 ) +l=( 3 3 2 ) +num_ms=14 +< -3 1 2 >: 0.034114368889974593 -0.122455747258013378 +< -3 2 1 >: -0.053939553315754896 0.193619536956620458 +< -3 3 0 >: 0.053939553315754889 -0.193619536956620458 +< -2 1 1 >: 0.041781398338757166 -0.149977048426676557 +< -2 3 -1 >: -0.053939553315754896 0.193619536956620458 +< -1 1 0 >: -0.032363731989452922 0.116171722173972244 +< -1 2 -1 >: 0.041781398338757166 -0.149977048426676557 +< -1 3 -2 >: 0.034114368889974593 -0.122455747258013378 +< 0 0 0 >: 0.021575821326301956 -0.077447814782648186 +< 0 1 -1 >: -0.015256409569497449 0.054763875020890293 +< 0 2 -2 >: -0.048245003156000874 0.173178578562814545 +< 1 0 -1 >: -0.015256409569497449 0.054763875020890293 +< 1 1 -2 >: 0.052849753030899213 -0.189707627911068211 +< 2 0 -2 >: -0.048245003156000874 0.173178578562814545 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 3 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.010502990198937533 0.045507240709490512 +< 0 1 -1 >: 0.012863483380424871 0.055734759670131043 +< 1 -2 1 >: -0.009095856327978880 -0.039410426510552161 +< 1 -1 0 >: -0.020338953062932399 -0.088124392699854490 +< 1 0 -1 >: -0.016606685635533799 -0.071953265335763419 +< 2 -3 1 >: 0.005251495099468768 0.022753620354745260 +< 2 -2 0 >: 0.018191712655957766 0.078820853021104365 +< 2 -1 -1 >: 0.020338953062932402 0.088124392699854490 +< 3 -3 0 >: -0.013894150044468763 -0.060200420885033211 +< 3 -2 -1 >: -0.024065373805005279 -0.104270187609908124 +< 4 -3 -1 >: 0.027788300088937533 0.120400841770066463 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.008476853230064019 0.014522391911916168 +< 0 1 -1 >: 0.008476853230064018 0.014522391911916167 +< 1 -1 0 >: -0.014682340482775232 -0.025153520638866132 +< 1 0 -1 >: -0.014682340482775232 -0.025153520638866132 +< 2 -1 -1 >: 0.020763965038120266 0.035572450028916042 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.008809116627443402 -0.051393694703885100 +< 0 1 -1 >: -0.010171891712354508 -0.059344326943874981 +< 1 -2 1 >: 0.005872744418295599 0.034262463135923384 +< 1 -1 0 >: 0.016610629609409063 0.096908880094262143 +< 1 0 -1 >: 0.014385227214602229 0.083925552013931093 +< 2 -2 0 >: -0.013131855733791421 -0.076613196648505327 +< 2 -1 -1 >: -0.018571248477854716 -0.108347421757073167 +< 3 -2 -1 >: 0.022745041328591419 0.132697949125476833 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.056947247360977574 0.067292612316523850 +< 0 1 -1 >: -0.075929663147970117 0.089723483088698500 +< 0 2 -2 >: -0.018982415786992526 0.022430870772174621 +< 1 -2 1 >: 0.042445972076880459 -0.050156951841095650 +< 1 -1 0 >: 0.103970973224779883 -0.122858939064033640 +< 1 0 -1 >: 0.103970973224779883 -0.122858939064033654 +< 1 1 -2 >: 0.042445972076880459 -0.050156951841095650 +< 2 -2 0 >: -0.073518580213806792 0.086874388941562977 +< 2 -1 -1 >: -0.120055338758468078 0.141865283081943322 +< 2 0 -2 >: -0.073518580213806820 0.086874388941563005 +< 3 -2 -1 >: 0.112301486271817519 -0.132702821092582413 +< 3 -1 -2 >: 0.112301486271817519 -0.132702821092582385 +< 4 -2 -2 >: -0.158818284960260236 0.187670129354300413 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.009125624293360770 0.061675009519915142 +< 0 1 -1 >: -0.011176561551540098 0.075536151602543511 +< 1 -2 1 >: 0.007903022463442844 -0.053412125022893608 +< 1 -1 0 >: 0.017671695455966051 -0.119433142373907647 +< 1 0 -1 >: 0.014428878918992307 -0.097516752397749873 +< 2 -3 1 >: -0.004562812146680387 0.030837504759957578 +< 2 -2 0 >: -0.015806044926885695 0.106824250045787258 +< 2 -1 -1 >: -0.017671695455966051 0.119433142373907661 +< 3 -3 0 >: 0.012072066219221069 -0.081588368648618292 +< 3 -2 -1 >: 0.020909432044026822 -0.141315199806066633 +< 4 -3 -1 >: -0.024144132438442146 0.163176737297236640 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.008245976518538201 0.001192751997317891 +< 0 1 -1 >: -0.002748658839512736 -0.000397583999105964 +< 0 2 -2 >: -0.019240611876589136 -0.002783087993741745 +< 0 3 -3 >: -0.008245976518538201 -0.001192751997317891 +< 1 -3 2 >: 0.015055024492870961 0.002177657248134500 +< 1 -2 1 >: 0.015548762436702404 0.002249074734872745 +< 1 -1 0 >: -0.010645509909838625 -0.001539836207255942 +< 1 0 -1 >: -0.010645509909838620 -0.001539836207255942 +< 1 1 -2 >: 0.015548762436702402 0.002249074734872745 +< 1 2 -3 >: 0.015055024492870965 0.002177657248134501 +< 2 -3 1 >: -0.020198434901390269 -0.002921633783114323 +< 2 -2 0 >: -0.004760816762709361 -0.000688635686727948 +< 2 -1 -1 >: 0.017384044887230922 0.002514541996826387 +< 2 0 -2 >: -0.004760816762709362 -0.000688635686727948 +< 2 1 -3 >: -0.020198434901390266 -0.002921633783114323 +< 3 -3 0 >: 0.021816803184930275 0.003155725160678719 +< 3 -2 -1 >: -0.010284539650584311 -0.001487623107117953 +< 3 -1 -2 >: -0.010284539650584309 -0.001487623107117953 +< 3 0 -3 >: 0.021816803184930279 0.003155725160678719 +< 4 -3 -1 >: -0.017813345207268693 -0.002576638804041773 +< 4 -2 -2 >: 0.022996929775998445 0.003326426392415193 +< 4 -1 -3 >: -0.017813345207268693 -0.002576638804041773 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.003321486338984252 -0.000643706857129781 +< 0 1 -1 >: -0.003321486338984252 -0.000643706857129781 +< 1 -1 0 >: 0.005752983095766669 0.001114932981729262 +< 1 0 -1 >: 0.005752983095766669 0.001114932981729262 +< 2 -1 -1 >: -0.008135946718136377 -0.001576753343898596 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.018889021454609311 0.062064370363208311 +< 0 1 -1 >: 0.021811163243094595 0.071665761872565861 +< 1 -2 1 >: -0.012592680969739535 -0.041376246908805522 +< 1 -1 0 >: -0.035617480428086469 -0.117029699077061275 +< 1 0 -1 >: -0.030845642869517916 -0.101350692397983305 +< 2 -2 0 >: 0.028158090667305579 0.092520100741904712 +< 2 -1 -1 >: 0.039821553712234822 0.130843181261326685 +< 3 -2 -1 >: -0.048771243679904291 -0.160249515206369930 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.027289245792213691 -0.004604817381872335 +< 0 1 -1 >: 0.036385661056284935 -0.006139756509163115 +< 0 2 -2 >: 0.009096415264071232 -0.001534939127290779 +< 1 -2 1 >: -0.020340202882029975 0.003432228229946383 +< 1 -1 0 >: -0.049823118325661261 0.008407207844144528 +< 1 0 -1 >: -0.049823118325661268 0.008407207844144530 +< 1 1 -2 >: -0.020340202882029975 0.003432228229946383 +< 2 -2 0 >: 0.035230264827934808 -0.005944793677439330 +< 2 -1 -1 >: 0.057530781554374216 -0.009707807423899956 +< 2 0 -2 >: 0.035230264827934822 -0.005944793677439331 +< 3 -2 -1 >: -0.053815118442450592 0.009080822339253546 +< 3 -1 -2 >: -0.053815118442450585 0.009080822339253546 +< 4 -2 -2 >: 0.076106070362028072 -0.012842222109672936 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.005376732345743923 -0.048444838179329965 +< 0 1 -1 >: 0.006585125365295138 -0.059332567105529817 +< 1 -2 1 >: -0.004656386800763732 0.041954460545526019 +< 1 -1 0 >: -0.010411997416040477 0.093813025739129113 +< 1 0 -1 >: -0.008501360290825365 0.076598014762483652 +< 2 -3 1 >: 0.002688366172871962 -0.024222419089664986 +< 2 -2 0 >: 0.009312773601527468 -0.083908921091052080 +< 2 -1 -1 >: 0.010411997416040477 -0.093813025739129113 +< 3 -3 0 >: -0.007112748326497687 0.064086497063637088 +< 3 -2 -1 >: -0.012319641482944503 0.111001068993333146 +< 4 -3 -1 >: 0.014225496652995379 -0.128172994127274231 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000939000085659110 -0.036515326430728329 +< 0 1 -1 >: 0.000313000028553037 0.012171775476909452 +< 0 2 -2 >: 0.002191000199871256 0.085202428338366096 +< 0 3 -3 >: 0.000939000085659110 0.036515326430728329 +< 1 -3 2 >: -0.001714371761382592 -0.066667559935915013 +< 1 -2 1 >: -0.001770595541611482 -0.068853959830422334 +< 1 -1 0 >: 0.001212243897948357 0.047141083715846119 +< 1 0 -1 >: 0.001212243897948357 0.047141083715846105 +< 1 1 -2 >: -0.001770595541611481 -0.068853959830422320 +< 1 2 -3 >: -0.001714371761382592 -0.066667559935915027 +< 2 -3 1 >: 0.002300071078294516 0.089443917546448537 +< 2 -2 0 >: 0.000542131952224369 0.021082133544328047 +< 2 -1 -1 >: -0.001979585995850665 -0.076981067350432114 +< 2 0 -2 >: 0.000542131952224369 0.021082133544328051 +< 2 1 -3 >: 0.002300071078294515 0.089443917546448523 +< 3 -3 0 >: -0.002484360707722353 -0.096610472778050974 +< 3 -2 -1 >: 0.001171138868895924 0.045542613623332139 +< 3 -1 -2 >: 0.001171138868895924 0.045542613623332132 +< 3 0 -3 >: -0.002484360707722353 -0.096610472778050988 +< 4 -3 -1 >: 0.002028472023646487 0.078882120705089778 +< 4 -2 -2 >: -0.002618746121943499 -0.101836379934778620 +< 4 -1 -3 >: 0.002028472023646487 0.078882120705089778 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 3 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.040668858788855060 0.075358621345957930 +< 0 1 -1 >: 0.040668858788855053 0.075358621345957916 +< 1 -1 0 >: -0.070440529708141048 -0.130524960959543662 +< 1 0 -1 >: -0.070440529708141048 -0.130524960959543662 +< 2 -1 -1 >: 0.099617952453997960 0.184590170017205402 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.025838414533841458 -0.044005534434981834 +< 0 1 -1 >: -0.029835631173092996 -0.050813214303740195 +< 1 -2 1 >: 0.017225609689227633 0.029337022956654545 +< 1 -1 0 >: 0.048721381685302240 0.082977631489903420 +< 1 0 -1 >: 0.042193954246949612 0.071860736816119930 +< 2 -2 0 >: -0.038517634218992021 -0.065599577588551450 +< 2 -1 -1 >: -0.054472160703024533 -0.092771812311675583 +< 3 -2 -1 >: 0.066714499454647747 0.113621801338427739 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 3 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.001622342585559750 -0.010551035010337882 +< 0 1 -1 >: -0.002163123447413001 -0.014068046680450514 +< 0 2 -2 >: -0.000540780861853250 -0.003517011670112628 +< 1 -2 1 >: 0.001209222768034790 0.007864277172031902 +< 1 -1 0 >: 0.002961978767041101 0.019263466267296043 +< 1 0 -1 >: 0.002961978767041101 0.019263466267296043 +< 1 1 -2 >: 0.001209222768034790 0.007864277172031902 +< 2 -2 0 >: -0.002094435271905331 -0.013621327626763336 +< 2 -1 -1 >: -0.003420198476970272 -0.022243534869897292 +< 2 0 -2 >: -0.002094435271905332 -0.013621327626763342 +< 3 -2 -1 >: 0.003199302723897201 0.020806921638478741 +< 3 -1 -2 >: 0.003199302723897201 0.020806921638478741 +< 4 -2 -2 >: -0.004524497302272606 -0.029425430772370850 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.006285520405620221 -0.027977794219560634 +< 0 1 -1 >: 0.007698158880810546 -0.034265659983256133 +< 1 -2 1 >: -0.005443420347272581 0.024229480535992932 +< 1 -1 0 >: -0.012171857926607004 0.054178765537988241 +< 1 0 -1 >: -0.009938280380612655 0.044236776820652295 +< 2 -3 1 >: 0.003142760202810111 -0.013988897109780319 +< 2 -2 0 >: 0.010886840694545164 -0.048458961071985877 +< 2 -1 -1 >: 0.012171857926607004 -0.054178765537988248 +< 3 -3 0 >: -0.008314961926946468 0.037011142868548931 +< 3 -2 -1 >: -0.014401936520472104 0.064105179894517292 +< 4 -3 -1 >: 0.016629923853892940 -0.074022285737097890 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 3 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000796659387258248 0.034365208947845130 +< 0 1 -1 >: -0.000265553129086083 -0.011455069649281719 +< 0 2 -2 >: -0.001858871903602579 -0.080185487544971970 +< 0 3 -3 >: -0.000796659387258248 -0.034365208947845130 +< 1 -3 2 >: 0.001454494390165287 0.062742000447043825 +< 1 -2 1 >: 0.001502195346736606 0.064799659423770445 +< 1 -1 0 >: -0.001028482846483667 -0.044365293981314106 +< 1 0 -1 >: -0.001028482846483667 -0.044365293981314093 +< 1 1 -2 >: 0.001502195346736606 0.064799659423770431 +< 1 2 -3 >: 0.001454494390165287 0.062742000447043839 +< 2 -3 1 >: -0.001951408997581011 -0.084177226826347359 +< 2 -2 0 >: -0.000459951511685992 -0.019840762636796114 +< 2 -1 -1 >: 0.001679505455393459 0.072448221695192772 +< 2 0 -2 >: -0.000459951511685992 -0.019840762636796117 +< 2 1 -3 >: -0.001951408997581011 -0.084177226826347346 +< 3 -3 0 >: 0.002107762618310424 0.090921796628769855 +< 3 -2 -1 >: -0.000993608827025876 -0.042860945969244897 +< 3 -1 -2 >: -0.000993608827025876 -0.042860945969244890 +< 3 0 -3 >: 0.002107762618310424 0.090921796628769869 +< 4 -3 -1 >: -0.001720980971257732 -0.074237336079196636 +< 4 -2 -2 >: 0.002221776880273687 0.095839988767177170 +< 4 -1 -3 >: -0.001720980971257732 -0.074237336079196636 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: -0.002966209606809296 -0.027493054947750905 +< 0 0 0 >: -0.002966209606809296 -0.027493054947750908 +< 1 -1 0 >: 0.010275251489785208 0.095238736049574960 +< 2 -1 -1 >: -0.007265700006824295 -0.067343956092290144 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: 0.039814573406919143 0.265704835114836169 +< -2 1 1 >: -0.024381347293384075 -0.162710317055421660 +< -1 -1 2 >: -0.024381347293384075 -0.162710317055421660 +< -1 0 1 >: 0.019907286703459561 0.132852417557418001 +< 0 -2 2 >: 0.019907286703459561 0.132852417557418001 +< 0 -1 1 >: 0.009953643351729781 0.066426208778709001 +< 0 0 0 >: -0.009953643351729781 -0.066426208778709001 +< 1 -2 1 >: -0.024381347293384075 -0.162710317055421660 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: 0.007653567234261328 -0.027845071048683039 +< -2 0 2 >: -0.021647557166453429 0.078757754244579967 +< -2 1 1 >: 0.011856855374949156 -0.043137398578204693 +< -1 -2 3 >: -0.012101352342750641 0.044026923061525829 +< -1 -1 2 >: 0.009373667218012272 -0.034103107960408975 +< -1 0 1 >: -0.006845558642469357 0.024905388681266658 +< 0 -3 3 >: 0.012101352342750641 -0.044026923061525829 +< 0 -1 1 >: -0.007260811405650383 0.026416153836915490 +< 0 0 0 >: 0.004840540937100257 -0.017610769224610332 +< 1 -3 2 >: -0.012101352342750641 0.044026923061525829 +< 1 -2 1 >: 0.009373667218012272 -0.034103107960408975 +< 2 -3 1 >: 0.007653567234261328 -0.027845071048683039 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.000574441238777359 -0.003347613159679569 +< -2 -1 3 >: 0.000861661858166039 0.005021419739519354 +< -2 0 2 >: -0.002059765808904567 -0.012003489064299978 +< -2 1 1 >: 0.001085591900446261 0.006326394218685211 +< -1 -3 4 >: 0.001074681152169440 0.006262810753488357 +< -1 -2 3 >: -0.001015478238331678 -0.005917799914996869 +< -1 -1 2 >: 0.000690866454966068 0.004026092627242514 +< -1 0 1 >: -0.000485491457044205 -0.002829249505088360 +< 0 -4 4 >: -0.001240934904996086 -0.007231670948820369 +< 0 -3 3 >: 0.000310233726249021 0.001807917737205091 +< 0 -2 2 >: 0.000354552829998882 0.002066191699662963 +< 0 -1 1 >: -0.000753424763747623 -0.004390657361783795 +< 0 0 0 >: 0.000443191037498602 0.002582739624578703 +< 1 -4 3 >: 0.001074681152169440 0.006262810753488357 +< 1 -3 2 >: -0.001015478238331678 -0.005917799914996869 +< 1 -2 1 >: 0.000690866454966068 0.004026092627242514 +< 2 -4 2 >: -0.000574441238777359 -0.003347613159679569 +< 2 -3 1 >: 0.000861661858166039 0.005021419739519354 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.021322143097413839 0.003526676922539522 +< 0 1 -1 >: 0.024620690113983192 0.004072255741146066 +< 1 -2 1 >: -0.014214762064942554 -0.002351117948359681 +< 1 -1 0 >: -0.040205418596296699 -0.006649965778618134 +< 1 0 -1 >: -0.034818913874180214 -0.005759039298580466 +< 2 -2 0 >: 0.031785174261196841 0.005257259555652087 +< 2 -1 -1 >: 0.044951024522576787 0.007434887764518732 +< 3 -2 -1 >: -0.055053536747823470 -0.009105840658966392 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: -0.050687647140572147 0.017378841408344180 +< -3 1 2 >: 0.050687647140572153 -0.017378841408344184 +< -3 2 1 >: -0.032057682839825796 0.010991344389043199 +< -2 -1 3 >: 0.050687647140572153 -0.017378841408344184 +< -2 1 1 >: -0.039262482646774802 0.013461592670179379 +< -1 -2 3 >: -0.032057682839825796 0.010991344389043199 +< -1 -1 2 >: -0.039262482646774802 0.013461592670179379 +< -1 0 1 >: 0.030412588284343279 -0.010427304845006506 +< 0 -2 2 >: 0.045336409850336892 -0.015544108303698317 +< 0 -1 1 >: 0.014336631606195799 -0.004915478643602298 +< 0 0 0 >: -0.020275058856228861 0.006951536563337673 +< 1 -2 1 >: -0.049663548702657850 0.017027717508477862 +< 1 -1 0 >: 0.014336631606195799 -0.004915478643602298 +< 2 -2 0 >: 0.045336409850336892 -0.015544108303698317 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: 0.004371228091308439 -0.001015669812656635 +< 0 -1 1 >: 0.017484912365233758 -0.004062679250626541 +< 0 0 0 >: 0.013113684273925315 -0.003047009437969904 +< 1 -2 1 >: -0.019548726314644653 0.004542213487589424 +< 1 -1 0 >: -0.047884404592197678 0.011126105347381701 +< 2 -2 0 >: 0.033859387200223232 -0.007867344539329506 +< 2 -1 -1 >: 0.027646073881290287 -0.006423659917342960 +< 3 -2 -1 >: -0.051721068276613970 0.012017567289924988 +< 4 -2 -2 >: 0.036572318108606151 -0.008497703324071598 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.006143592400603938 0.009637657780642005 +< 0 1 -1 >: -0.007524333284560014 0.011803671939068540 +< 1 -2 1 >: 0.005320507089420034 -0.008346456471016729 +< 1 -1 0 >: 0.011897015526712750 -0.018663244040436414 +< 1 0 -1 >: 0.009713872500805026 -0.015238474948036084 +< 2 -3 1 >: -0.003071796200301969 0.004818828890321003 +< 2 -2 0 >: -0.010641014178840072 0.016692912942033466 +< 2 -1 -1 >: -0.011897015526712752 0.018663244040436414 +< 3 -3 0 >: 0.008127208824272161 -0.012749422854362718 +< 3 -2 -1 >: 0.014076738607361508 -0.022082648150936052 +< 4 -3 -1 >: -0.016254417648544330 0.025498845708725446 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: -0.001947804649495662 0.010050146296873052 +< 0 -2 2 >: -0.004544877515489877 0.023450341359370453 +< 0 -1 1 >: -0.000649268216498554 0.003350048765624353 +< 0 0 0 >: 0.001947804649495662 -0.010050146296873052 +< 1 -3 2 >: 0.007112376960948116 -0.036697945553495877 +< 1 -2 1 >: 0.007345631339120367 -0.037901475191657617 +< 1 -1 0 >: -0.005029209979441382 0.025949366156491644 +< 2 -3 1 >: -0.009542255019770017 0.049235460535321768 +< 2 -2 0 >: -0.002249131077430249 0.011604909339789551 +< 2 -1 -1 >: 0.004106332752981489 -0.021187568744017077 +< 3 -3 0 >: 0.010306813410201706 -0.053180375482685636 +< 3 -2 -1 >: -0.004858678436518714 0.025069469419902551 +< 4 -3 -1 >: -0.008415477909689729 0.043421594754065491 +< 4 -2 -2 >: 0.005432167632434120 -0.028028518891377155 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 1 4 4 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: 0.001008757196501169 0.003242376852545740 +< -4 1 3 >: -0.001594985173514865 -0.005126647943326229 +< -4 2 2 >: 0.000904271595847615 0.002906536182304704 +< -3 -1 4 >: -0.000797492586757432 -0.002563323971663114 +< -3 0 3 >: 0.001513135794751752 0.004863565278818609 +< -3 1 2 >: -0.000602847730565077 -0.001937690788203136 +< -2 -2 4 >: 0.000904271595847615 0.002906536182304704 +< -2 -1 3 >: -0.000301423865282538 -0.000968845394101568 +< -2 0 2 >: -0.000792594940108061 -0.002547581812714509 +< -2 1 1 >: 0.000683565074363513 0.002197134832854097 +< -1 -3 4 >: -0.000797492586757432 -0.002563323971663113 +< -1 -2 3 >: -0.000301423865282538 -0.000968845394101568 +< -1 -1 2 >: 0.000683565074363513 0.002197134832854098 +< -1 0 1 >: -0.000648486769179323 -0.002084385119493690 +< 0 -4 4 >: 0.000504378598250584 0.001621188426272870 +< 0 -3 3 >: 0.000756567897375876 0.002431782639409305 +< 0 -2 2 >: -0.000396297470054031 -0.001273790906357255 +< 0 -1 1 >: -0.000324243384589661 -0.001042192559746845 +< 0 0 0 >: 0.000324243384589661 0.001042192559746845 +< 1 -4 3 >: -0.000797492586757432 -0.002563323971663113 +< 1 -3 2 >: -0.000301423865282538 -0.000968845394101568 +< 1 -2 1 >: 0.000683565074363513 0.002197134832854098 +< 2 -4 2 >: 0.000904271595847615 0.002906536182304704 +< 2 -3 1 >: -0.000301423865282538 -0.000968845394101568 +< 3 -4 1 >: -0.000797492586757432 -0.002563323971663114 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.443685031756588133 -0.766788492334507632 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.021258964632145865 -0.099770728173720583 +< 1 -1 >: -0.042517929264291723 0.199541456347441110 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.080484268478046864 0.056545394865651424 +< 1 -1 >: 0.160968536956093755 -0.113090789731302863 +< 2 -2 >: -0.160968536956093783 0.113090789731302890 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.068612942196417448 0.331839144705912803 +< 1 -1 >: 0.137225884392834896 -0.663678289411825606 +< 2 -2 >: -0.137225884392834868 0.663678289411825495 +< 3 -3 >: 0.137225884392834868 -0.663678289411825495 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.010563846674115336 -0.074491987845651350 +< 1 -1 >: -0.021127693348230666 0.148983975691302645 +< 2 -2 >: 0.021127693348230666 -0.148983975691302645 +< 3 -3 >: -0.021127693348230666 0.148983975691302645 +< 4 -4 >: 0.021127693348230669 -0.148983975691302672 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: -0.005330008844206259 0.085596074475354916 +< 1 -1 >: 0.010660017688412517 -0.171192148950709833 +< 2 -2 >: -0.010660017688412519 0.171192148950709860 +< 3 -3 >: 0.010660017688412520 -0.171192148950709888 +< 4 -4 >: -0.010660017688412519 0.171192148950709860 +< 5 -5 >: 0.010660017688412507 -0.171192148950709666 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 1 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.043595376456603344 -0.061977341956862740 +< 1 -1 >: -0.087190752913206701 0.123954683913725508 +< 2 -2 >: 0.087190752913206673 -0.123954683913725452 +< 3 -3 >: -0.087190752913206701 0.123954683913725508 +< 4 -4 >: 0.087190752913206646 -0.123954683913725439 +< 5 -5 >: -0.087190752913206673 0.123954683913725452 +< 6 -6 >: 0.087190752913206618 -0.123954683913725383 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.025673494362345103 0.354532665314856887 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.008471527858069306 -0.403448183560426166 +< 1 -1 0 >: 0.016943055716138609 0.806896367120852220 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.050528239746022864 -0.080541291480621405 +< 1 -1 0 >: -0.101056479492045728 0.161082582961242810 +< 2 -2 0 >: 0.101056479492045756 -0.161082582961242865 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.005081450586248567 -0.056434814324392242 +< 0 1 -1 >: 0.005867553727688781 -0.065165310483708785 +< 1 -2 1 >: -0.003387633724165710 0.037623209549594812 +< 1 -1 0 >: -0.009581675114135251 0.106414506410083903 +< 1 0 -1 >: -0.008297974059650284 0.092157665882314610 +< 2 -2 0 >: 0.007574979290105302 -0.084128054084613269 +< 2 -1 -1 >: 0.010712638446762237 -0.118975035062517331 +< 3 -2 -1 >: -0.013120248996744407 0.145714064016452594 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.013488697530298670 0.087985761931948028 +< 1 -1 0 >: -0.026977395060597341 -0.175971523863896057 +< 2 -2 0 >: 0.026977395060597337 0.175971523863896029 +< 3 -3 0 >: -0.026977395060597337 -0.175971523863896029 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.023166996813129861 -0.004034707910871768 +< 0 1 -1 >: 0.028373660532426084 -0.004941487821403271 +< 1 -2 1 >: -0.020063207769563590 0.003494159547664992 +< 1 -1 0 >: -0.044862696419446131 0.007813178272808840 +< 1 0 -1 >: -0.036630238237676291 0.006379433345927211 +< 2 -3 1 >: 0.011583498406564932 -0.002017353955435884 +< 2 -2 0 >: 0.040126415539127193 -0.006988319095329987 +< 2 -1 -1 >: 0.044862696419446138 -0.007813178272808840 +< 3 -3 0 >: -0.030647056095883758 0.005337416872475828 +< 3 -2 -1 >: -0.053082258260484162 0.009244677204303511 +< 4 -3 -1 >: 0.061294112191767537 -0.010674833744951659 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.009599109215753620 -0.030650039218870596 +< 1 -1 0 >: 0.019198218431507232 0.061300078437741171 +< 2 -2 0 >: -0.019198218431507232 -0.061300078437741171 +< 3 -3 0 >: 0.019198218431507232 0.061300078437741171 +< 4 -4 0 >: -0.019198218431507236 -0.061300078437741184 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.030345923816554193 -0.019658602753619338 +< 0 1 -1 >: 0.016621147002659993 0.010767460177190486 +< 0 2 -2 >: 0.070517554540076050 0.045682464644684985 +< 1 -3 2 >: -0.058999219052618165 -0.038220692081764117 +< 1 -2 1 >: -0.047304613667597688 -0.030644728897573924 +< 1 -1 0 >: 0.051588070488142117 0.033419624681152872 +< 1 0 -1 >: 0.016621147002659993 0.010767460177190486 +< 1 1 -2 >: -0.074332029123929264 -0.048153545802439718 +< 2 -4 2 >: 0.039332812701745441 0.025480461387842747 +< 2 -3 1 >: 0.069531246461361412 0.045043517587763968 +< 2 -2 0 >: -0.024276739053243360 -0.015726882202895476 +< 2 -1 -1 >: -0.047304613667597688 -0.030644728897573924 +< 2 0 -2 >: 0.070517554540076050 0.045682464644684985 +< 3 -4 1 >: -0.073584954594040866 -0.047669578285115005 +< 3 -3 0 >: -0.021242146671587924 -0.013761021927533533 +< 3 -2 -1 >: 0.069531246461361412 0.045043517587763968 +< 3 -1 -2 >: -0.058999219052618165 -0.038220692081764117 +< 4 -4 0 >: 0.084968586686351738 0.055044087710134144 +< 4 -3 -1 >: -0.073584954594040866 -0.047669578285115005 +< 4 -2 -2 >: 0.039332812701745441 0.025480461387842747 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 1 1 ) +l=( 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 >: -0.000131149336668165 -0.026671105528810853 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 1 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: -0.000549702479850836 0.031159740241633885 +< 1 -1 0 0 >: 0.001099404959701671 -0.062319480483267763 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 1 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: 0.000534231632539918 0.016152804358911307 +< 1 -1 0 0 >: -0.001068463265079836 -0.032305608717822620 +< 2 -2 0 0 >: 0.001068463265079836 0.032305608717822627 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.044836097751452433 0.123019968306161701 +< 1 -1 0 >: 0.089672195502904839 -0.246039936612323346 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.065253113373031621 -0.109526680389507899 +< 1 -1 0 >: 0.130506226746063242 0.219053360779015799 +< 2 -2 0 >: -0.130506226746063270 -0.219053360779015854 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.006691075378480910 0.061635128918971091 +< 0 1 -1 >: 0.007726188341868057 0.071170116545810458 +< 1 -2 1 >: -0.004460716918987272 -0.041090085945980709 +< 1 -1 0 >: -0.012616812729477856 -0.116220313647764084 +< 1 0 -1 >: -0.010926480338518703 -0.100649744054758961 +< 2 -2 0 >: 0.009974466259238965 0.091880225376521643 +< 2 -1 -1 >: 0.014106025461248574 0.129938260841373499 +< 3 -2 -1 >: -0.017276282339383366 -0.159141218563014747 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.020750470233620349 -0.091150031876353815 +< 1 -1 0 >: 0.041500940467240698 0.182300063752707631 +< 2 -2 0 >: -0.041500940467240698 -0.182300063752707603 +< 3 -3 0 >: 0.041500940467240698 0.182300063752707603 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.016080450169900506 0.089746028513755141 +< 0 1 -1 >: -0.019694448875253651 0.109915988149984933 +< 1 -2 1 >: 0.013926078351423631 -0.077722340581674543 +< 1 -1 0 >: 0.031139657853771447 -0.173792436911014841 +< 1 0 -1 >: 0.025425424168863588 -0.141900930528941122 +< 2 -3 1 >: -0.008040225084950255 0.044873014256877584 +< 2 -2 0 >: -0.027852156702847273 0.155444681163349141 +< 2 -1 -1 >: -0.031139657853771451 0.173792436911014869 +< 3 -3 0 >: 0.021272436059761542 -0.118722836301553905 +< 3 -2 -1 >: 0.036844940056267296 -0.205633984492974126 +< 4 -3 -1 >: -0.042544872119523097 0.237445672603107893 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.024580789850859350 -0.118255530012825641 +< 1 -1 0 >: -0.049161579701718680 0.236511060025651199 +< 2 -2 0 >: 0.049161579701718680 -0.236511060025651199 +< 3 -3 0 >: -0.049161579701718680 0.236511060025651199 +< 4 -4 0 >: 0.049161579701718694 -0.236511060025651254 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.019821407204615442 -0.034286484773894357 +< 0 1 -1 >: -0.010856631847463296 0.018779481128219356 +< 0 2 -2 >: -0.046060788001122802 0.079674590717572227 +< 1 -3 2 >: 0.038537220111199838 -0.066660545183855613 +< 1 -2 1 >: 0.030898515920315173 -0.053447340277189580 +< 1 -1 0 >: -0.033696392247846249 0.058287024115620402 +< 1 0 -1 >: -0.010856631847463296 0.018779481128219356 +< 1 1 -2 >: 0.048552333635234125 -0.083984392769745869 +< 2 -4 2 >: -0.025691480074133227 0.044440363455903735 +< 2 -3 1 >: -0.045416549447846656 0.078560205895160898 +< 2 -2 0 >: 0.015857125763692359 -0.027429187819115495 +< 2 -1 -1 >: 0.030898515920315173 -0.053447340277189580 +< 2 0 -2 >: -0.046060788001122802 0.079674590717572227 +< 3 -4 1 >: 0.048064358098268055 -0.083140307097850474 +< 3 -3 0 >: 0.013874985043230804 -0.024000539341726041 +< 3 -2 -1 >: -0.045416549447846656 0.078560205895160898 +< 3 -1 -2 >: 0.038537220111199838 -0.066660545183855613 +< 4 -4 0 >: -0.055499940172923236 0.096002157366904206 +< 4 -3 -1 >: 0.048064358098268055 -0.083140307097850474 +< 4 -2 -2 >: -0.025691480074133227 0.044440363455903735 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 2 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: 0.000879900694635743 -0.046214553741910469 +< 1 -1 0 0 >: -0.001759801389271486 0.092429107483820924 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 2 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: -0.000744986350624590 -0.021998531066858684 +< 1 -1 0 0 >: 0.001489972701249181 0.043997062133717374 +< 2 -2 0 0 >: -0.001489972701249181 -0.043997062133717388 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 2 1 ) +l=( 2 2 1 1 ) +num_ms=19 +< 0 0 0 0 >: 0.000074721474110087 0.045311132790134441 +< 0 0 1 -1 >: 0.000198560903657768 -0.077407572244935746 +< 0 1 -1 0 >: -0.000080600861057782 -0.006242390936835944 +< 0 1 0 -1 >: -0.000120319256502976 -0.001387115817576990 +< 0 2 -1 -1 >: -0.000284143955208020 -0.010789751926307911 +< 1 -2 0 1 >: 0.000262290850582401 0.007362041501545532 +< 1 -2 1 0 >: 0.000229860916501465 0.011326357035883928 +< 1 -1 -1 1 >: -0.000129094548527080 0.078208423935611018 +< 1 -1 0 0 >: -0.000033441664260861 -0.086217367801824513 +< 1 -1 1 -1 >: -0.000152025974829142 0.081011618332704857 +< 1 0 -1 0 >: -0.000120319256502976 -0.001387115817576990 +< 1 0 0 -1 >: -0.000080600861057782 -0.006242390936835944 +< 1 1 -1 -1 >: 0.000348003851877943 0.013214693335333129 +< 2 -2 -1 1 >: -0.000056373090562923 -0.083414173404730660 +< 2 -2 0 0 >: -0.000314562187617083 0.073002674466491405 +< 2 -2 1 -1 >: -0.000010510237958798 -0.089020562198918365 +< 2 -1 -1 0 >: 0.000262290850582401 0.007362041501545532 +< 2 -1 0 -1 >: 0.000229860916501465 0.011326357035883928 +< 2 0 -1 -1 >: -0.000284143955208020 -0.010789751926307911 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 2 2 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: -0.000390044560424510 0.010161400220348013 +< 1 -1 0 0 >: 0.000780089120849020 -0.020322800440696023 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 1 2 2 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: 0.000236958433008212 0.000726730860463758 +< 1 -1 0 0 >: -0.000473916866016423 -0.001453461720927516 +< 2 -2 0 0 >: 0.000473916866016423 0.001453461720927516 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.099936425840165849 0.172960728852067092 +< 1 -1 0 >: -0.199872851680331642 -0.345921457704134128 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.067333069873716456 -0.178547061608677754 +< 1 -1 0 >: -0.134666139747432939 0.357094123217355564 +< 2 -2 0 >: 0.134666139747432967 -0.357094123217355619 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.026384848432851424 -0.090557865129244200 +< 0 1 -1 >: -0.030466598690468475 -0.104567215619213866 +< 1 -2 1 >: 0.017589898955234277 0.060371910086162772 +< 1 -1 0 >: 0.049751747326529309 0.170757548060440939 +< 1 0 -1 >: 0.043086277067438894 0.147880374508284007 +< 2 -2 0 >: -0.039332209781256379 -0.134995694884165185 +< 2 -1 -1 >: -0.055624144510756472 -0.190912742567166616 +< 3 -2 -1 >: 0.068125385715093592 0.233819402342440030 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.016318843547732997 0.075691400143286583 +< 1 -1 0 >: -0.032637687095465995 -0.151382800286573166 +< 2 -2 0 >: 0.032637687095465995 0.151382800286573166 +< 3 -3 0 >: -0.032637687095465995 -0.151382800286573166 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.005080880668698730 -0.050804786190446816 +< 0 1 -1 >: -0.006222782541141438 -0.062222901328895970 +< 1 -2 1 >: 0.004400171732690367 0.043998235474763780 +< 1 -1 0 >: 0.009839083106968696 0.098383045411614564 +< 1 0 -1 >: 0.008033577716303685 0.080329420199840462 +< 2 -3 1 >: -0.002540440334349366 -0.025402393095223415 +< 2 -2 0 >: -0.008800343465380738 -0.087996470949527589 +< 2 -1 -1 >: -0.009839083106968696 -0.098383045411614564 +< 3 -3 0 >: 0.006721373345286200 0.067208414835865440 +< 3 -2 -1 >: 0.011641760130674894 0.116408389191884884 +< 4 -3 -1 >: -0.013442746690572405 -0.134416829671730909 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.030940967307135768 0.061648342892035281 +< 1 -1 0 >: 0.061881934614271515 -0.123296685784070520 +< 2 -2 0 >: -0.061881934614271515 0.123296685784070520 +< 3 -3 0 >: 0.061881934614271515 -0.123296685784070520 +< 4 -4 0 >: -0.061881934614271529 0.123296685784070548 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.009817053273569845 0.055584686124101140 +< 0 1 -1 >: 0.005377021526164138 -0.030444986442014595 +< 0 2 -2 >: 0.022812770302420210 -0.129167138197686160 +< 1 -3 2 >: -0.019086533006538668 0.108068981271806724 +< 1 -2 1 >: -0.015303271545390008 0.086647950440740765 +< 1 -1 0 >: 0.016688990565068732 -0.094493966410971922 +< 1 0 -1 >: 0.005377021526164138 -0.030444986442014595 +< 1 1 -2 >: -0.024046771297965359 0.136154118516808226 +< 2 -4 2 >: 0.012724355337692445 -0.072045987514537821 +< 2 -3 1 >: 0.022493694863773919 -0.127360515822027537 +< 2 -2 0 >: -0.007853642618855877 0.044467748899280922 +< 2 -1 -1 >: -0.015303271545390008 0.086647950440740765 +< 2 0 -2 >: 0.022812770302420210 -0.129167138197686160 +< 3 -4 1 >: -0.023805089070606685 0.134785700685596782 +< 3 -3 0 >: -0.006871937291498888 0.038909280286870782 +< 3 -2 -1 >: 0.022493694863773919 -0.127360515822027537 +< 3 -1 -2 >: -0.019086533006538668 0.108068981271806724 +< 4 -4 0 >: 0.027487749165995563 -0.155637121147483182 +< 4 -3 -1 >: -0.023805089070606685 0.134785700685596782 +< 4 -2 -2 >: 0.012724355337692445 -0.072045987514537821 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.049812769767711255 -0.011045396958808368 +< 1 -1 0 >: 0.099625539535422497 0.022090793917616734 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.044266647288743223 0.086360412014017507 +< 1 -1 0 >: 0.088533294577486460 -0.172720824028035042 +< 2 -2 0 >: -0.088533294577486474 0.172720824028035069 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.023973339060976952 0.088744963009341440 +< 0 1 -1 >: 0.027682027520458417 0.102473856565333268 +< 1 -2 1 >: -0.015982226040651297 -0.059163308672894266 +< 1 -1 0 >: -0.045204561647203045 -0.167339107040145707 +< 1 0 -1 >: -0.039148298753417556 -0.144919917743369542 +< 2 -2 0 >: 0.035737343858663624 0.132293179966394475 +< 2 -1 -1 >: 0.050540236368112931 0.187090809317939699 +< 3 -2 -1 >: -0.061898895290764977 -0.229138509196648354 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.004553843690772358 -0.016727430375017845 +< 1 -1 0 >: 0.009107687381544716 0.033454860750035689 +< 2 -2 0 >: -0.009107687381544716 -0.033454860750035689 +< 3 -3 0 >: 0.009107687381544716 0.033454860750035689 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.007910374230632561 0.026348395715979800 +< 0 1 -1 >: 0.009688190269755417 0.032270062522542373 +< 1 -2 1 >: -0.006850585037169583 -0.022818380039003577 +< 1 -1 0 >: -0.015318373828754114 -0.051023448903636311 +< 1 0 -1 >: -0.012507399856550489 -0.041660471576959568 +< 2 -3 1 >: 0.003955187115316282 0.013174197857989902 +< 2 -2 0 >: 0.013701170074339171 0.045636760078007176 +< 2 -1 -1 >: 0.015318373828754115 0.051023448903636318 +< 3 -3 0 >: -0.010464441495853826 -0.034855651255001098 +< 3 -2 -1 >: -0.018124944343650896 -0.060371758904563817 +< 4 -3 -1 >: 0.020928882991707660 0.069711302510002210 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.012080441009612876 0.000022520940721450 +< 1 -1 0 >: -0.024160882019225744 -0.000045041881442901 +< 2 -2 0 >: 0.024160882019225744 0.000045041881442901 +< 3 -3 0 >: -0.024160882019225744 -0.000045041881442901 +< 4 -4 0 >: 0.024160882019225748 0.000045041881442901 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 1 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.015160180132536510 -0.016821694253254679 +< 0 1 -1 >: -0.008303572634431905 0.009213621397962607 +< 0 2 -2 >: -0.035229075107291077 0.039090085018709031 +< 1 -3 2 >: 0.029474758914037103 -0.032705111568972378 +< 1 -2 1 >: 0.023632382017304564 -0.026222426204423863 +< 1 -1 0 >: -0.025772306225312062 0.028596880230532949 +< 1 0 -1 >: -0.008303572634431905 0.009213621397962607 +< 1 1 -2 >: 0.037134705733393510 -0.041204567529582077 +< 2 -4 2 >: -0.019649839276024733 0.021803407712648253 +< 2 -3 1 >: -0.034736336503257116 0.038543343616471611 +< 2 -2 0 >: 0.012128144106029212 -0.013457355402603746 +< 2 -1 -1 >: 0.023632382017304564 -0.026222426204423863 +< 2 0 -2 >: -0.035229075107291077 0.039090085018709031 +< 3 -4 1 >: 0.036761483138029336 -0.040790440762437132 +< 3 -3 0 >: 0.010612126092775552 -0.011775185977278271 +< 3 -2 -1 >: -0.034736336503257116 0.038543343616471611 +< 3 -1 -2 >: 0.029474758914037103 -0.032705111568972378 +< 4 -4 0 >: -0.042448504371102230 0.047100743909113098 +< 4 -3 -1 >: 0.036761483138029336 -0.040790440762437132 +< 4 -2 -2 >: -0.019649839276024733 0.021803407712648253 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.237529292163412231 -0.506725013422213544 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.011163256227855207 -0.272012801083348243 +< 1 -1 >: -0.022326512455710410 0.544025602166696376 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.007641334930427780 0.036306741501869841 +< 1 -1 >: 0.015282669860855563 -0.072613483003739682 +< 2 -2 >: -0.015282669860855566 0.072613483003739709 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.029464058726948968 -0.015652403783227988 +< 1 -1 >: -0.058928117453897935 0.031304807566455976 +< 2 -2 >: 0.058928117453897928 -0.031304807566455969 +< 3 -3 >: -0.058928117453897928 0.031304807566455969 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.013586208381099698 0.030901612428767603 +< 1 -1 >: 0.027172416762199385 -0.061803224857535186 +< 2 -2 >: -0.027172416762199385 0.061803224857535186 +< 3 -3 >: 0.027172416762199385 -0.061803224857535186 +< 4 -4 >: -0.027172416762199392 0.061803224857535199 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.001635058193904321 -0.026240219199856703 +< 1 -1 >: -0.003270116387808642 0.052480438399713406 +< 2 -2 >: 0.003270116387808642 -0.052480438399713412 +< 3 -3 >: -0.003270116387808643 0.052480438399713426 +< 4 -4 >: 0.003270116387808642 -0.052480438399713412 +< 5 -5 >: -0.003270116387808638 0.052480438399713357 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 2 2 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.024120927536316672 -0.006947962831113538 +< 1 -1 >: 0.048241855072633351 0.013895925662227079 +< 2 -2 >: -0.048241855072633337 -0.013895925662227072 +< 3 -3 >: 0.048241855072633351 0.013895925662227079 +< 4 -4 >: -0.048241855072633323 -0.013895925662227070 +< 5 -5 >: 0.048241855072633337 0.013895925662227072 +< 6 -6 >: -0.048241855072633302 -0.013895925662227065 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.042157890720039490 -0.080177729415818355 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.000441540392775611 0.171446291731526923 +< 1 -1 0 >: 0.000883080785551222 -0.342892583463053791 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.015314948158571085 0.144142255874459224 +< 0 1 -1 >: 0.015314948158571083 0.144142255874459196 +< 1 -1 0 >: -0.026526268325928540 -0.249661710692156869 +< 1 0 -1 >: -0.026526268325928540 -0.249661710692156869 +< 2 -1 -1 >: 0.037513808425675990 0.353074977266116141 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.010715155854679278 -0.024320535097604255 +< 1 -1 0 >: 0.021430311709358555 0.048641070195208511 +< 2 -2 0 >: -0.021430311709358562 -0.048641070195208524 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.009379950621030062 0.142958858170693121 +< 0 1 -1 >: 0.010831034032074202 0.165074670495782339 +< 1 -2 1 >: -0.006253300414020039 -0.095305905447128719 +< 1 -1 0 >: -0.017687004510200867 -0.269565808115154626 +< 1 0 -1 >: -0.015317395222683886 -0.233450837819405205 +< 2 -2 0 >: 0.013982804809476390 0.213110483236947368 +< 2 -1 -1 >: 0.019774672201577252 0.301383735677575038 +< 3 -2 -1 >: -0.024218928362331558 -0.369118184591948284 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.001892496709451729 -0.008303587970500197 +< 1 -1 0 >: 0.003784993418903457 0.016607175941000394 +< 2 -2 0 >: -0.003784993418903457 -0.016607175941000391 +< 3 -3 0 >: 0.003784993418903457 0.016607175941000391 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.064323537074706449 -0.050824047196869532 +< 0 1 -1 >: 0.085764716099608632 -0.067765396262492728 +< 0 2 -2 >: 0.021441179024902154 -0.016941349065623182 +< 1 -2 1 >: -0.047943933817423873 0.037882008141285978 +< 1 -1 0 >: -0.117438174114455327 0.092791590378108843 +< 1 0 -1 >: -0.117438174114455340 0.092791590378108857 +< 1 1 -2 >: -0.047943933817423873 0.037882008141285978 +< 2 -2 0 >: 0.083041329286497809 -0.065613562793445143 +< 2 -1 -1 >: 0.135605922876237850 -0.107146499366669271 +< 2 0 -2 >: 0.083041329286497836 -0.065613562793445157 +< 3 -2 -1 >: -0.126847725755043245 0.100226372705566905 +< 3 -1 -2 >: -0.126847725755043217 0.100226372705566905 +< 4 -2 -2 >: 0.179389774118965034 -0.141741495587673266 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000988267132983525 0.050693726784944340 +< 0 1 -1 >: 0.001210375102686442 0.062086881891587016 +< 1 -2 1 >: -0.000855864442888947 -0.043902055208269439 +< 1 -1 0 >: -0.001913771073824672 -0.098167979797639165 +< 1 0 -1 >: -0.001562587538456227 -0.080153819861354433 +< 2 -3 1 >: 0.000494133566491763 0.025346863392472177 +< 2 -2 0 >: 0.001711728885777895 0.087804110416538905 +< 2 -1 -1 >: 0.001913771073824673 0.098167979797639179 +< 3 -3 0 >: -0.001307354531386603 -0.067061497052008326 +< 3 -2 -1 >: -0.002264404471866998 -0.116153920125708937 +< 4 -3 -1 >: 0.002614709062773207 0.134122994104016680 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.002658802058065159 -0.012783282173783569 +< 0 1 -1 >: 0.000886267352688387 0.004261094057927860 +< 0 2 -2 >: 0.006203871468818703 0.029827658405494995 +< 0 3 -3 >: 0.002658802058065159 0.012783282173783569 +< 1 -3 2 >: -0.004854286210478159 -0.023338973351783115 +< 1 -2 1 >: -0.005013485240241661 -0.024104388029075930 +< 1 -1 0 >: 0.003432498697249456 0.016503146322977974 +< 1 0 -1 >: 0.003432498697249454 0.016503146322977967 +< 1 1 -2 >: -0.005013485240241660 -0.024104388029075927 +< 1 2 -3 >: -0.004854286210478159 -0.023338973351783119 +< 2 -3 1 >: 0.006512708369321411 0.031312518563785911 +< 2 -2 0 >: 0.001535060083945850 0.007380431404160885 +< 2 -1 -1 >: -0.005605246900686108 -0.026949525094522975 +< 2 0 -2 >: 0.001535060083945850 0.007380431404160887 +< 2 1 -3 >: 0.006512708369321410 0.031312518563785904 +< 3 -3 0 >: -0.007034529030987125 -0.033821385570996489 +< 3 -2 -1 >: 0.003316108786843087 0.015943554057584318 +< 3 -1 -2 >: 0.003316108786843086 0.015943554057584314 +< 3 0 -3 >: -0.007034529030987126 -0.033821385570996496 +< 4 -3 -1 >: 0.005743668902237818 0.027615045680956962 +< 4 -2 -2 >: -0.007415044668165499 -0.035650870675701114 +< 4 -1 -3 >: 0.005743668902237818 0.027615045680956962 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.004972044830004877 0.040109990151243995 +< 1 -1 0 >: -0.009944089660009750 -0.080219980302487962 +< 2 -2 0 >: 0.009944089660009750 0.080219980302487962 +< 3 -3 0 >: -0.009944089660009750 -0.080219980302487962 +< 4 -4 0 >: 0.009944089660009751 0.080219980302487975 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 1 1 ) +l=( 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 >: 0.000169145388298771 0.021394144275254930 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 1 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: 0.000151629851811976 -0.010246816255707641 +< 1 -1 0 0 >: -0.000303259703623953 0.020493632511415279 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 1 1 ) +l=( 2 1 1 0 ) +num_ms=5 +< 0 0 0 0 >: -0.000186246234993290 -0.005624955595958680 +< 0 1 -1 0 >: -0.000186246234993290 -0.005624955595958679 +< 1 -1 0 0 >: 0.000322587941726792 0.009742708882519307 +< 1 0 -1 0 >: 0.000322587941726792 0.009742708882519307 +< 2 -1 -1 0 >: -0.000456208242248050 -0.013778271035911628 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 1 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: -0.000259357644193434 -0.004860497836025403 +< 1 -1 0 0 >: 0.000518715288386869 0.009720995672050805 +< 2 -2 0 0 >: -0.000518715288386869 -0.009720995672050809 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 1 2 ) +l=( 2 1 1 0 ) +num_ms=5 +< 0 0 0 0 >: 0.000121874643713454 0.003691822861407739 +< 0 1 -1 0 >: 0.000121874643713454 0.003691822861407738 +< 1 -1 0 0 >: -0.000211093075066057 -0.006394424768502517 +< 1 0 -1 0 >: -0.000211093075066057 -0.006394424768502517 +< 2 -1 -1 0 >: 0.000298530689681459 0.009043082231190699 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.018986895339668273 0.010069321218616062 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.003813645922355822 0.032025295375989443 +< 1 -1 0 >: -0.007627291844711643 -0.064050590751978873 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.020494722777808224 -0.109750203166273874 +< -1 0 1 >: 0.028983914909453182 0.155210225790947121 +< -1 1 0 >: -0.008366935537571001 -0.044805332820692947 +< 0 0 0 >: -0.008366935537571001 -0.044805332820692954 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.012065695405917632 0.084713234829181264 +< 1 -1 0 >: 0.024131390811835268 -0.169426469658362555 +< 2 -2 0 >: -0.024131390811835275 0.169426469658362583 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 2 2 2 ) +num_ms=5 +< -2 0 2 >: -0.120655043887796895 0.034518829883595066 +< -2 1 1 >: 0.098514430806070891 -0.028184506577581182 +< -1 -1 2 >: 0.049257215403035445 -0.014092253288790591 +< -1 0 1 >: -0.060327521943898434 0.017259414941797526 +< 0 0 0 >: 0.020109173981299477 -0.005753138313932508 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.007326806974795491 -0.028045977233177387 +< -2 -1 3 >: 0.010361669792645573 0.039663001373166522 +< -2 0 2 >: -0.006783305164419386 -0.025965529440238989 +< -2 1 1 >: 0.003916343062672911 0.014991205411973135 +< -2 2 0 >: -0.000875720931134635 -0.003352135436583467 +< -1 -1 2 >: -0.005538545474137816 -0.021200766009933352 +< -1 0 1 >: 0.009593042161237355 0.036720803888583863 +< -1 1 0 >: -0.003502883724538540 -0.013408541746333871 +< 0 0 0 >: -0.002627162793403904 -0.010056406309750399 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: -0.001031271630432890 0.024875652818421367 +< -2 0 2 >: 0.002916876652497616 -0.070358971177392038 +< -2 1 1 >: -0.001597639140033101 0.038537195636713428 +< -1 -2 3 >: 0.001630583619241674 -0.039331860594899230 +< -1 -1 2 >: -0.001263044640384324 0.030466328211879303 +< -1 0 1 >: 0.000922397387565993 -0.022249460274669768 +< 0 -3 3 >: -0.001630583619241674 0.039331860594899223 +< 0 -1 1 >: 0.000978350171545004 -0.023599116356939530 +< 0 0 0 >: -0.000652233447696670 0.015732744237959690 +< 1 -3 2 >: 0.001630583619241674 -0.039331860594899230 +< 1 -2 1 >: -0.001263044640384324 0.030466328211879303 +< 2 -3 1 >: -0.001031271630432890 0.024875652818421367 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: 0.013674779634781781 -0.035644073162967756 +< -2 -1 3 >: -0.020512169452172671 0.053466109744451637 +< -2 0 2 >: 0.049033463537503534 -0.127808447992761975 +< -2 1 1 >: -0.025842904390888037 0.067360966644717218 +< -1 -3 4 >: -0.025583170116493557 0.066683954822464558 +< -1 -2 3 >: 0.024173823527464736 -0.063010414606609819 +< -1 -1 2 >: -0.016446323646317283 0.042868256671584351 +< -1 0 1 >: 0.011557298190810687 -0.030124740089536722 +< 0 -4 4 >: 0.029540900306963075 -0.076999998534757474 +< 0 -3 3 >: -0.007385225076740766 0.019249999633689362 +< 0 -2 2 >: -0.008440257230560881 0.021999999581359286 +< 0 -1 1 >: 0.017935546614941865 -0.046749999110388463 +< 0 0 0 >: -0.010550321538201098 0.027499999476699101 +< 1 -4 3 >: -0.025583170116493557 0.066683954822464558 +< 1 -3 2 >: 0.024173823527464736 -0.063010414606609819 +< 1 -2 1 >: -0.016446323646317283 0.042868256671584351 +< 2 -4 2 >: 0.013674779634781781 -0.035644073162967756 +< 2 -3 1 >: -0.020512169452172671 0.053466109744451637 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.009321287240871334 -0.074857642926248552 +< 0 1 -1 >: -0.010763295395421773 -0.086438160588740931 +< 1 -2 1 >: 0.006214191493914220 0.049905095284165681 +< 1 -1 0 >: 0.017576387779754035 0.141152925164777426 +< 1 0 -1 >: 0.015221598324033355 0.122242019011180980 +< 2 -2 0 >: -0.013895354605593170 -0.111591185478998670 +< 2 -1 -1 >: -0.019650998937213310 -0.157813767945691491 +< 3 -2 -1 >: 0.024067460166073567 0.193281602926467982 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.002613170775531592 0.001424210166313564 +< 1 -1 0 >: -0.005226341551063184 -0.002848420332627128 +< 2 -2 0 >: 0.005226341551063184 0.002848420332627128 +< 3 -3 0 >: -0.005226341551063184 -0.002848420332627128 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: -0.001638737005437354 -0.043698457336331438 +< -3 0 3 >: 0.002007034742969010 0.053519461510396084 +< -3 1 2 >: -0.001858153105982546 -0.049549393195328140 +< -3 2 1 >: 0.001384985552526448 0.036931937142873066 +< -3 3 0 >: -0.000379293914468746 -0.010114227532757238 +< -2 -2 4 >: 0.001057800188478781 0.028207232919761155 +< -2 -1 3 >: -0.000946125251220258 -0.025229316106302330 +< -2 0 2 >: -0.000437970887241034 -0.011678903977365028 +< -2 1 1 >: 0.001430406927912749 0.038143140666007075 +< -2 2 0 >: -0.000885019133760407 -0.023599864243100222 +< -1 -1 2 >: 0.000799621781574887 0.021322663851132108 +< -1 0 1 >: -0.000979332676036849 -0.026114823196080873 +< -1 1 0 >: -0.000126431304822915 -0.003371409177585748 +< 0 0 0 >: 0.000379293914468746 0.010114227532757238 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.002406610681941587 0.026892227459352502 +< 0 1 -1 >: 0.002947484090144173 0.032936117661138041 +< 1 -2 1 >: -0.002084185987580406 -0.023289352144148720 +< 1 -1 0 >: -0.004660381545982320 -0.052076574546247020 +< 1 0 -1 >: -0.003805185598113233 -0.042520345063438526 +< 2 -3 1 >: 0.001203305340970793 0.013446113729676253 +< 2 -2 0 >: 0.004168371975160813 0.046578704288297454 +< 2 -1 -1 >: 0.004660381545982321 0.052076574546247027 +< 3 -3 0 >: -0.003183646683484500 -0.035575073029014533 +< 3 -2 -1 >: -0.005514237809143309 -0.061617833969226425 +< 4 -3 -1 >: 0.006367293366969003 0.071150146058029079 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.014767957273141234 0.040172809034638220 +< 1 -1 0 >: 0.029535914546282457 -0.080345618069276412 +< 2 -2 0 >: -0.029535914546282457 0.080345618069276412 +< 3 -3 0 >: 0.029535914546282457 -0.080345618069276412 +< 4 -4 0 >: -0.029535914546282464 0.080345618069276425 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 2 ) +l=( 4 4 4 ) +num_ms=13 +< -4 0 4 >: -0.016466403054395954 0.014289760802882370 +< -4 1 3 >: 0.034714225681496458 -0.030125460904069784 +< -4 2 2 >: -0.019681116023445286 0.017079530932150221 +< -3 -1 4 >: 0.017357112840748225 -0.015062730452034887 +< -3 0 3 >: -0.024699604581593933 0.021434641204323555 +< -3 1 2 >: 0.013120744015630190 -0.011386353954766813 +< -2 -2 4 >: -0.009840558011722641 0.008539765466075109 +< -2 -1 3 >: 0.006560372007815095 -0.005693176977383406 +< -2 0 2 >: 0.012937888114168248 -0.011227669202264718 +< -2 1 1 >: -0.014877525292069912 0.012910911816029909 +< -1 -1 2 >: -0.007438762646034956 0.006455455908014955 +< -1 0 1 >: 0.010585544820683114 -0.009186274801852952 +< 0 0 0 >: -0.003528514940227706 0.003062091600617652 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 >: -0.000096232900583378 -0.007181811938265209 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: -0.000202105566068617 0.017235014306926640 +< 1 -1 0 0 >: 0.000404211132137234 -0.034470028613853274 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 1 1 1 1 ) +num_ms=5 +< 0 0 0 0 >: 0.000064703297946057 -0.003457522621016441 +< 0 0 1 -1 >: -0.000129406595892114 0.006915045242032880 +< 1 -1 -1 1 >: 0.000129406595892114 -0.006915045242032879 +< 1 -1 0 0 >: -0.000129406595892114 0.006915045242032880 +< 1 -1 1 -1 >: 0.000129406595892114 -0.006915045242032879 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: 0.000346797029018903 0.007220241099190649 +< 1 -1 0 0 >: -0.000693594058037806 -0.014440482198381300 +< 2 -2 0 0 >: 0.000693594058037806 0.014440482198381304 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 2 2 1 1 ) +num_ms=8 +< 0 0 0 0 >: 0.000018213204980344 -0.017773446029033343 +< 0 0 1 -1 >: -0.000036426409960688 0.035546892058066680 +< 1 -1 -1 1 >: 0.000036426409960688 -0.035546892058066687 +< 1 -1 0 0 >: -0.000036426409960688 0.035546892058066694 +< 1 -1 1 -1 >: 0.000036426409960688 -0.035546892058066687 +< 2 -2 -1 1 >: -0.000036426409960688 0.035546892058066694 +< 2 -2 0 0 >: 0.000036426409960688 -0.035546892058066701 +< 2 -2 1 -1 >: -0.000036426409960688 0.035546892058066694 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 1 ) +l=( 2 2 2 2 ) +num_ms=13 +< 0 0 0 0 >: -0.000727799869848321 -0.001653804898473280 +< 0 0 1 -1 >: 0.001455599739696642 0.003307609796946560 +< 0 0 2 -2 >: -0.001455599739696642 -0.003307609796946562 +< 1 -1 -2 2 >: 0.001455599739696643 0.003307609796946562 +< 1 -1 -1 1 >: -0.001455599739696642 -0.003307609796946561 +< 1 -1 0 0 >: 0.001455599739696642 0.003307609796946560 +< 1 -1 1 -1 >: -0.001455599739696642 -0.003307609796946561 +< 1 -1 2 -2 >: 0.001455599739696643 0.003307609796946562 +< 2 -2 -2 2 >: -0.001455599739696643 -0.003307609796946563 +< 2 -2 -1 1 >: 0.001455599739696643 0.003307609796946562 +< 2 -2 0 0 >: -0.001455599739696642 -0.003307609796946562 +< 2 -2 1 -1 >: 0.001455599739696643 0.003307609796946562 +< 2 -2 2 -2 >: -0.001455599739696643 -0.003307609796946563 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 0 0 0 0 ) +num_ms=1 +< 0 0 0 0 >: 0.000020935512243829 0.000901079341750005 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 0 1 1 2 ) +num_ms=4 +< 0 -1 -1 2 >: -0.000168814917448911 0.008250168730277932 +< 0 -1 0 1 >: 0.000238740345787144 -0.011667500510225469 +< 0 -1 1 0 >: -0.000068918401453316 0.003368117280174384 +< 0 0 0 0 >: -0.000068918401453316 0.003368117280174385 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 0 2 2 2 ) +num_ms=5 +< 0 -2 0 2 >: 0.000814856742190073 -0.034047282432673624 +< 0 -2 1 1 >: -0.000665327743944100 0.027799489696158645 +< 0 -1 -1 2 >: -0.000332663871972050 0.013899744848079322 +< 0 -1 0 1 >: 0.000407428371095036 -0.017023641216336809 +< 0 0 0 0 >: -0.000135809457031679 0.005674547072112269 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 1 1 0 0 ) +num_ms=2 +< 0 0 0 0 >: 0.000082623206527214 -0.005265773447052712 +< 1 -1 0 0 >: -0.000165246413054427 0.010531546894105423 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 1 1 1 1 ) +num_ms=3 +< -1 -1 1 1 >: -0.000011504996837292 0.001339849741944992 +< -1 0 0 1 >: 0.000011504996837292 -0.001339849741944992 +< 0 0 0 0 >: -0.000002876249209323 0.000334962435486248 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 1 1 2 2 ) +num_ms=11 +< -1 -1 0 2 >: -0.000144780468302614 0.006236442820208421 +< -1 -1 1 1 >: 0.000088659568015650 -0.003819025679888580 +< -1 0 -1 2 >: 0.000125383563521872 -0.005400917911549560 +< -1 0 0 1 >: -0.000102375250920142 0.004409831008651529 +< -1 1 -2 2 >: 0.000030428886117350 -0.004315425479804201 +< -1 1 -1 1 >: -0.000119088454133000 0.008134451159692781 +< -1 1 0 0 >: 0.000074320821735775 -0.004703729859827819 +< 0 0 -2 2 >: -0.000103874011074325 0.005976738419790680 +< 0 0 -1 1 >: 0.000015214443058675 -0.002157712739902101 +< 0 0 0 0 >: 0.000007169373139937 0.000442352089969620 +< 0 1 -2 1 >: 0.000125383563521872 -0.005400917911549560 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 2 2 0 0 ) +num_ms=3 +< 0 0 0 0 >: -0.000107196788060430 -0.000335221069303797 +< 1 -1 0 0 >: 0.000214393576120860 0.000670442138607594 +< 2 -2 0 0 >: -0.000214393576120860 -0.000670442138607594 +ctilde_basis_func: rank=4 ndens=2 mu0=0 mu=( 0 0 0 0 ) +n=( 2 2 2 2 ) +l=( 2 2 2 2 ) +num_ms=6 +< -2 -2 2 2 >: 0.000592031129020375 0.000530260317488982 +< -2 -1 1 2 >: -0.001184062258040749 -0.001060520634977963 +< -2 0 0 2 >: 0.000592031129020374 0.000530260317488981 +< -1 -1 1 1 >: 0.000592031129020374 0.000530260317488981 +< -1 0 0 1 >: -0.000592031129020374 -0.000530260317488981 +< 0 0 0 0 >: 0.000148007782255094 0.000132565079372245 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.015496423957503546 -0.211402399527168994 +< 1 -1 0 >: 0.030992847915007088 0.422804799054337876 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: 0.010335376702368096 0.186370131773652109 +< -1 0 1 >: -0.014616429904723878 -0.263567167975559735 +< -1 1 0 >: 0.004219399870041812 0.076085287690118339 +< 0 0 0 >: 0.004219399870041813 0.076085287690118353 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.030084347150259941 0.124342680618911530 +< 1 -1 0 >: -0.060168694300519888 -0.248685361237823088 +< 2 -2 0 >: 0.060168694300519902 0.248685361237823171 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: 0.129546917496429492 -0.024167972229472437 +< -2 1 1 >: -0.158661922808341349 0.029599600039980717 +< -2 2 0 >: 0.064773458748214774 -0.012083986114736222 +< -1 -1 2 >: -0.079330961404170675 0.014799800019990358 +< -1 0 1 >: 0.064773458748214732 -0.012083986114736215 +< -1 1 0 >: 0.032386729374107366 -0.006041993057368108 +< 0 0 0 >: -0.032386729374107366 0.006041993057368108 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.005437462674323070 0.002070360366137689 +< -2 -1 3 >: 0.007689733458925168 -0.002927931708791647 +< -2 0 2 >: -0.005034112235651309 0.001916781240742731 +< -2 1 1 >: 0.002906446054384072 -0.001106654165320441 +< -2 2 0 >: -0.000649901095053884 0.000247455394123980 +< -1 -1 2 >: -0.004110335428415725 0.001565045329452845 +< -1 0 1 >: 0.007119309798166423 -0.002710738026760699 +< -1 1 0 >: -0.002599604380215535 0.000989821576495919 +< 0 0 0 >: -0.001949703285161650 0.000742366182371939 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.019415948844952600 -0.041919380289178819 +< -2 0 2 >: 0.027458298182874204 0.059282956131232099 +< -2 1 1 >: -0.030079058610926628 -0.064941224697330019 +< -2 2 0 >: 0.027458298182874204 0.059282956131232099 +< -1 -2 3 >: 0.030699310641682822 0.066280359908286429 +< -1 -1 2 >: -0.023779583771057145 -0.051340546021085433 +< -1 0 1 >: 0.008683076292994509 0.018746916780253729 +< -1 1 0 >: 0.008683076292994509 0.018746916780253729 +< 0 -3 3 >: -0.030699310641682818 -0.066280359908286415 +< 0 -1 1 >: 0.018419586385009686 0.039768215944971839 +< 0 0 0 >: -0.012279724256673128 -0.026512143963314569 +< 1 -3 2 >: 0.030699310641682822 0.066280359908286429 +< 1 -2 1 >: -0.023779583771057145 -0.051340546021085433 +< 2 -3 1 >: -0.019415948844952600 -0.041919380289178819 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.010916976047477154 0.029562404251441590 +< 0 1 -1 >: 0.012605838119495259 0.034135724104924658 +< 1 -2 1 >: -0.007277984031651434 -0.019708269500961051 +< 1 -1 0 >: -0.020585247448592556 -0.055743404038326318 +< 1 0 -1 >: -0.017827347233669948 -0.048275203990610638 +< 2 -2 0 >: 0.016274067033930591 0.044069030323034782 +< 2 -1 -1 >: 0.023015006314353527 0.062323020363466958 +< 3 -2 -1 >: -0.028187510948549519 -0.076329799559789718 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.003019318068367032 0.035361910211253469 +< 1 -1 0 >: 0.006038636136734063 -0.070723820422506939 +< 2 -2 0 >: -0.006038636136734062 0.070723820422506925 +< 3 -3 0 >: 0.006038636136734062 -0.070723820422506925 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: 0.000780557466224931 0.022883587515913923 +< -3 2 1 >: -0.001234169718960367 -0.036182128793041307 +< -3 3 0 >: 0.001234169718960367 0.036182128793041300 +< -2 1 1 >: 0.000955983753585398 0.028026556449156175 +< -2 3 -1 >: -0.001234169718960367 -0.036182128793041307 +< -1 1 0 >: -0.000740501831376220 -0.021709277275824775 +< -1 2 -1 >: 0.000955983753585398 0.028026556449156175 +< -1 3 -2 >: 0.000780557466224931 0.022883587515913923 +< 0 0 0 >: 0.000493667887584147 0.014472851517216521 +< 0 1 -1 >: -0.000698151821929577 -0.020467702901859640 +< 0 2 -2 >: -0.002207749909893755 -0.064724559641514259 +< 1 1 -2 >: 0.001209234426978807 0.035451101340245844 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: 0.001088468824505481 0.005627282905129761 +< -3 0 3 >: -0.001333096610482720 -0.006891985877927236 +< -3 1 2 >: 0.001234207636923562 0.006380739053133610 +< -3 2 1 >: -0.000919924058170154 -0.004755922089831464 +< -3 3 0 >: 0.000251931578925744 0.001302462905168902 +< -2 -2 4 >: -0.000702603605029282 -0.003632395495994208 +< -2 -1 3 >: 0.000628427768832755 0.003248913300082847 +< -2 0 2 >: 0.000290905529820292 0.001503954617817535 +< -2 1 1 >: -0.000950093481884947 -0.004911895213273929 +< -2 2 0 >: 0.000587840350826736 0.003039080112060771 +< -1 -1 2 >: -0.000531118402618552 -0.002745832898809083 +< -1 0 1 >: 0.000650484539708764 0.003362944760514725 +< -1 1 0 >: 0.000083977192975248 0.000434154301722968 +< 0 0 0 >: -0.000251931578925744 -0.001302462905168902 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.007778889614829623 -0.017226748254304803 +< 0 1 -1 >: -0.009527155160883875 -0.021098371575213819 +< 1 -2 1 >: 0.006736716019677401 0.014918801612827192 +< 1 -1 0 >: 0.015063754965110481 0.033359454549115104 +< 1 0 -1 >: 0.012299504424945760 0.027237880580966350 +< 2 -3 1 >: -0.003889444807414812 -0.008613374127152405 +< 2 -2 0 >: -0.013473432039354806 -0.029837603225654395 +< 2 -1 -1 >: -0.015063754965110483 -0.033359454549115111 +< 3 -3 0 >: 0.010290503698531100 0.022788845889603292 +< 3 -2 -1 >: 0.017823675241331317 0.039471438926650088 +< 4 -3 -1 >: -0.020581007397062208 -0.045577691779206599 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.018737015545710532 -0.052616975313013861 +< 1 -1 0 >: -0.037474031091421049 0.105233950626027695 +< 2 -2 0 >: 0.037474031091421049 -0.105233950626027695 +< 3 -3 0 >: -0.037474031091421049 0.105233950626027695 +< 4 -4 0 >: 0.037474031091421056 -0.105233950626027709 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: -0.006044870827777889 0.025085459056242251 +< -4 3 1 >: 0.011308917792424723 -0.046930596589202039 +< -4 4 0 >: -0.013058413463399518 0.054190785148011039 +< -3 1 2 >: 0.009067306241666833 -0.037628188584363377 +< -3 2 1 >: -0.010685922884296206 0.044345245519615953 +< -3 3 0 >: 0.003264603365849879 -0.013547696287002755 +< -3 4 -1 >: 0.011308917792424723 -0.046930596589202039 +< -2 1 1 >: 0.007270018580844463 -0.030169669235915589 +< -2 2 0 >: 0.003730975275257007 -0.015483081470860301 +< -2 3 -1 >: -0.010685922884296206 0.044345245519615953 +< -2 4 -2 >: -0.006044870827777889 0.025085459056242251 +< -1 1 0 >: -0.007928322459921136 0.032901548125578127 +< -1 2 -1 >: 0.007270018580844463 -0.030169669235915589 +< -1 3 -2 >: 0.009067306241666833 -0.037628188584363377 +< 0 0 0 >: 0.004663719094071257 -0.019353851838575371 +< 0 1 -1 >: -0.005108848299380770 0.021201082453201125 +< 0 2 -2 >: -0.021675007659273028 0.089948575026921870 +< 1 1 -2 >: 0.011423732084149601 -0.047407061561935734 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 3 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: 0.009407769941711568 -0.012810286243555288 +< -4 1 3 >: -0.014874990359339028 0.020254841004178591 +< -4 2 2 >: 0.016866653676554738 -0.022966830918090146 +< -4 3 1 >: -0.014874990359339032 0.020254841004178594 +< -4 4 0 >: 0.004703884970855784 -0.006405143121777644 +< -3 -1 4 >: -0.014874990359339027 0.020254841004178587 +< -3 0 3 >: 0.014111654912567351 -0.019215429365332930 +< -3 1 2 >: -0.005622217892184912 0.007655610306030048 +< -3 2 1 >: -0.005622217892184912 0.007655610306030048 +< -3 3 0 >: 0.007055827456283674 -0.009607714682666463 +< -2 -2 4 >: 0.008433326838277367 -0.011483415459045071 +< -2 -1 3 >: -0.005622217892184912 0.007655610306030048 +< -2 0 2 >: -0.007391819239916232 0.010065224905650583 +< -2 1 1 >: 0.012749991736576313 -0.017361292289295938 +< -2 2 0 >: -0.003695909619958114 0.005032612452825289 +< -1 -1 2 >: 0.006374995868288156 -0.008680646144647969 +< -1 0 1 >: -0.006047852105386008 0.008235184013714114 +< -1 1 0 >: -0.003023926052693004 0.004117592006857056 +< 0 0 0 >: 0.003023926052693005 -0.004117592006857058 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.012095863652752078 0.074670222274287504 +< 1 -1 0 >: -0.024191727305504153 -0.149340444548574980 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.027722962161594932 -0.182169209836380019 +< -1 0 1 >: 0.039206189078083695 0.257626167197398892 +< -1 1 0 >: -0.011317851909065490 -0.074370268490854874 +< 0 0 0 >: -0.011317851909065492 -0.074370268490854888 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.010303945864100435 -0.114024069317504431 +< 1 -1 0 >: 0.020607891728200874 0.228048138635008890 +< 2 -2 0 >: -0.020607891728200878 -0.228048138635008946 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: 0.042022451452387269 0.080597823448569278 +< -2 1 1 >: -0.051466781899613338 -0.098711770913959981 +< -2 2 0 >: 0.021011225726193641 0.040298911724284653 +< -1 -1 2 >: -0.025733390949806669 -0.049355885456979991 +< -1 0 1 >: 0.021011225726193627 0.040298911724284632 +< -1 1 0 >: 0.010505612863096814 0.020149455862142316 +< 0 0 0 >: -0.010505612863096814 -0.020149455862142316 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.056934482896859567 -0.047203325033994971 +< -2 -1 3 >: 0.080517517879437839 0.066755582452181134 +< -2 0 2 >: -0.052711088636069131 -0.043701787092569389 +< -2 1 1 >: 0.030432761213312742 0.025231238541962651 +< -2 2 0 >: -0.006804972281598627 -0.005641876453634117 +< -1 -1 2 >: -0.043038423648328772 -0.035682359741514340 +< -1 0 1 >: 0.074544736436579315 0.061803660006253106 +< -1 1 0 >: -0.027219889126394513 -0.022567505814536471 +< 0 0 0 >: -0.020414916844795877 -0.016925629360902347 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: 0.018889007523489963 0.016319736810161682 +< -2 0 2 >: -0.026713090619486946 -0.023079593131290089 +< -2 1 1 >: 0.029262724625945299 0.025282427552097746 +< -2 2 0 >: -0.026713090619486946 -0.023079593131290089 +< -1 -2 3 >: -0.029866143257142375 -0.025803769567300922 +< -1 -1 2 >: 0.023134215090071478 0.019987513960706055 +< -1 0 1 >: -0.008447420970005705 -0.007298408176485422 +< -1 1 0 >: -0.008447420970005705 -0.007298408176485422 +< 0 -3 3 >: 0.029866143257142371 0.025803769567300919 +< 0 -1 1 >: -0.017919685954285419 -0.015482261740380547 +< 0 0 0 >: 0.011946457302856948 0.010321507826920368 +< 1 -3 2 >: -0.029866143257142375 -0.025803769567300922 +< 1 -2 1 >: 0.023134215090071478 0.019987513960706055 +< 2 -3 1 >: 0.018889007523489963 0.016319736810161682 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.010671986401207595 -0.045090125829449212 +< 0 1 -1 >: -0.012322948443050454 -0.052065592570853178 +< 1 -2 1 >: 0.007114657600805060 0.030060083886299466 +< 1 -1 0 >: 0.020123290541398692 0.085022756636155300 +< 1 0 -1 >: 0.017427280816586368 0.073631867146692426 +< 2 -2 0 >: -0.015908858032035681 -0.067216390979111681 +< 2 -1 -1 >: -0.022498522790773006 -0.095058331736432286 +< 3 -2 -1 >: 0.027554950401886016 0.116422204277235763 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.001864695096017076 -0.055191671252036840 +< 1 -1 0 >: -0.003729390192034152 0.110383342504073681 +< 2 -2 0 >: 0.003729390192034151 -0.110383342504073667 +< 3 -3 0 >: -0.003729390192034151 0.110383342504073667 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: -0.001824350276484969 -0.001765977023819884 +< -3 2 1 >: 0.002884551061825212 0.002792254845398130 +< -3 3 0 >: -0.002884551061825211 -0.002792254845398130 +< -2 1 1 >: -0.002234363644746794 -0.002162871302918785 +< -2 3 -1 >: 0.002884551061825212 0.002792254845398130 +< -1 1 0 >: 0.001730730637095126 0.001675352907238878 +< -1 2 -1 >: -0.002234363644746794 -0.002162871302918785 +< -1 3 -2 >: -0.001824350276484969 -0.001765977023819884 +< 0 0 0 >: -0.001153820424730084 -0.001116901938159252 +< 0 1 -1 >: 0.001631748493196371 0.001579537868785611 +< 0 2 -2 >: 0.005160041807048300 0.004994937315850710 +< 1 1 -2 >: -0.002826271295390074 -0.002735839841215740 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: -0.000880613013969882 0.073925413803475143 +< -3 0 3 >: 0.001078526272540303 -0.090539771421307161 +< -3 1 2 >: -0.000998521301250582 0.083823540210658604 +< -3 2 1 >: 0.000744253835525948 -0.062478378008573206 +< -3 3 0 >: -0.000203822307113651 0.017110408495815126 +< -2 -2 4 >: 0.000568433256259812 -0.047718649420391841 +< -2 -1 3 >: -0.000508422160667399 0.042680857559390842 +< -2 0 2 >: -0.000235353727757834 0.019757397902006639 +< -2 1 1 >: 0.000768662056091465 -0.064527391340068213 +< -2 2 0 >: -0.000475585383265185 0.039924286490235293 +< -1 -1 2 >: 0.000429695152286318 -0.036071908361780945 +< -1 0 1 >: -0.000526266934024496 0.044178884767398584 +< -1 1 0 >: -0.000067940769037884 0.005703469498605046 +< 0 0 0 >: 0.000203822307113651 -0.017110408495815126 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.005754255337477731 0.002739786439421501 +< 0 1 -1 >: 0.007047494713253530 0.003355539390389707 +< 1 -2 1 >: -0.004983331302117914 -0.002372724657483135 +< 1 -1 0 >: -0.011143067545938199 -0.005305573626022196 +< 1 0 -1 >: -0.009098276552305242 -0.004331982725507440 +< 2 -3 1 >: 0.002877127668738867 0.001369893219710751 +< 2 -2 0 >: 0.009966662604235831 0.004745449314966272 +< 2 -1 -1 >: 0.011143067545938200 0.005305573626022197 +< 3 -3 0 >: -0.007612164301666063 -0.003624396782068212 +< 3 -2 -1 >: -0.013184655326047687 -0.006277639373331288 +< 4 -3 -1 >: 0.015224328603332131 0.007248793564136426 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.007116166719745826 0.026591214056357816 +< 1 -1 0 >: 0.014232333439491648 -0.053182428112715618 +< 2 -2 0 >: -0.014232333439491648 0.053182428112715618 +< 3 -3 0 >: 0.014232333439491648 -0.053182428112715618 +< 4 -4 0 >: -0.014232333439491651 0.053182428112715625 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: 0.010506451961026682 -0.021355907622853013 +< -4 3 1 >: -0.019655771794380526 0.039953244754154946 +< -4 4 0 >: 0.022696530273230889 -0.046134033227620705 +< -3 1 2 >: -0.015759677941540023 0.032033861434279519 +< -3 2 1 >: 0.018572958569631662 -0.037752267746282105 +< -3 3 0 >: -0.005674132568307720 0.011533508306905171 +< -3 4 -1 >: -0.019655771794380526 0.039953244754154946 +< -2 1 1 >: -0.012635853296387476 0.025684228770528172 +< -2 2 0 >: -0.006484722935208827 0.013181152350748775 +< -2 3 -1 >: 0.018572958569631662 -0.037752267746282105 +< -2 4 -2 >: 0.010506451961026682 -0.021355907622853013 +< -1 1 0 >: 0.013780036237318752 -0.028009948745341139 +< -1 2 -1 >: -0.012635853296387476 0.025684228770528172 +< -1 3 -2 >: -0.015759677941540023 0.032033861434279519 +< 0 0 0 >: -0.008105903669011032 0.016476440438435967 +< 0 1 -1 >: 0.008879572576962463 -0.018049036191043377 +< 0 2 -2 >: 0.037672835899249593 -0.076575575307409119 +< 1 1 -2 >: -0.019855327893231054 0.040358871851526874 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 2 4 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: -0.000815261153535848 0.006227177581522628 +< -4 1 3 >: 0.001289041066514758 -0.009846032275975178 +< -4 2 2 >: -0.001461635182177508 0.011164351201262402 +< -4 3 1 >: 0.001289041066514758 -0.009846032275975180 +< -4 4 0 >: -0.000407630576767924 0.003113588790761314 +< -3 -1 4 >: 0.001289041066514758 -0.009846032275975176 +< -3 0 3 >: -0.001222891730303773 0.009340766372283942 +< -3 1 2 >: 0.000487211727392503 -0.003721450400420801 +< -3 2 1 >: 0.000487211727392503 -0.003721450400420801 +< -3 3 0 >: -0.000611445865151886 0.004670383186141970 +< -2 -2 4 >: -0.000730817591088754 0.005582175600631200 +< -2 -1 3 >: 0.000487211727392503 -0.003721450400420801 +< -2 0 2 >: 0.000640562334921024 -0.004892782385482065 +< -2 1 1 >: -0.001104892342726936 0.008439456236550154 +< -2 2 0 >: 0.000320281167460512 -0.002446391192741031 +< -1 -1 2 >: -0.000552446171363468 0.004219728118275077 +< -1 0 1 >: 0.000524096455844474 -0.004003185588121690 +< -1 1 0 >: 0.000262048227922237 -0.002001592794060844 +< 0 0 0 >: -0.000262048227922237 0.002001592794060845 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.044909625842496657 -0.074854674750367375 +< 0 1 -1 >: 0.044909625842496650 -0.074854674750367362 +< 1 -1 0 >: -0.077785753708112457 0.129652099851679470 +< 1 0 -1 >: -0.077785753708112457 0.129652099851679470 +< 2 -1 -1 >: 0.110005667853425901 -0.183355758000395830 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.011830002482392145 -0.182045459226579193 +< 0 1 -1 >: -0.013660110235446086 -0.210207989778429000 +< 1 -2 1 >: 0.007886668321594761 0.121363639484386096 +< 1 -1 0 >: 0.022306866604675138 0.343268209875555452 +< 1 0 -1 >: 0.019318313158479386 0.297278990063839232 +< 2 -2 0 >: -0.017635126483080060 -0.271377347883864861 +< 2 -1 -1 >: -0.024939835046536761 -0.383785525898203250 +< 3 -2 -1 >: 0.030544935066598111 0.470039354558148270 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.009918496013901573 0.142717750537309895 +< 0 1 -1 >: -0.013224661351868769 0.190290334049746573 +< 0 2 -2 >: -0.003306165337967192 0.047572583512436636 +< 1 -2 1 >: 0.007392810440548207 -0.106375530599094034 +< 1 -1 0 >: 0.018108613344463221 -0.260565771085598918 +< 1 0 -1 >: 0.018108613344463224 -0.260565771085598974 +< 1 1 -2 >: 0.007392810440548207 -0.106375530599094034 +< 2 -2 0 >: -0.012804723293755146 0.184247823679728584 +< 2 -1 -1 >: -0.020910025578153385 0.300875436155745968 +< 2 0 -2 >: -0.012804723293755151 0.184247823679728640 +< 3 -2 -1 >: 0.019559537915532423 -0.281443199547744605 +< 3 -1 -2 >: 0.019559537915532419 -0.281443199547744605 +< 4 -2 -2 >: -0.027661363793896721 0.398020789838097688 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.002662617097155242 0.043569531234203263 +< 0 1 -1 >: -0.003261026634220442 0.053361559928026096 +< 1 -2 1 >: 0.002305894046687218 -0.037732320879799594 +< 1 -1 0 >: 0.005156135837304694 -0.084372034436066570 +< 1 0 -1 >: 0.004209967281958199 -0.068889477642964686 +< 2 -3 1 >: -0.001331308548577621 0.021784765617101635 +< 2 -2 0 >: -0.004611788093374438 0.075464641759599216 +< 2 -1 -1 >: -0.005156135837304694 0.084372034436066584 +< 3 -3 0 >: 0.003522311337830738 -0.057637072192681452 +< 3 -2 -1 >: 0.006100822197198743 -0.099830337437239625 +< 4 -3 -1 >: -0.007044622675661477 0.115274144385362945 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.003440880470860412 0.013618720548827392 +< 0 1 -1 >: -0.001146960156953472 -0.004539573516275801 +< 0 2 -2 >: -0.008028721098674294 -0.031777014613930586 +< 0 3 -3 >: -0.003440880470860412 -0.013618720548827392 +< 1 -3 2 >: 0.006282159505230815 0.024864268163172991 +< 1 -2 1 >: 0.006488186437860689 0.025679705736427819 +< 1 -1 0 >: -0.004442157586644238 -0.017581692627420414 +< 1 0 -1 >: -0.004442157586644236 -0.017581692627420407 +< 1 1 -2 >: 0.006488186437860687 0.025679705736427812 +< 1 2 -3 >: 0.006282159505230816 0.024864268163172998 +< 2 -3 1 >: -0.008428401419515532 -0.033358916294183201 +< 2 -2 0 >: -0.001986593266100584 -0.007862771974883781 +< 2 -1 -1 >: 0.007254012962874356 0.028710783834421945 +< 2 0 -2 >: -0.001986593266100584 -0.007862771974883781 +< 2 1 -3 >: -0.008428401419515532 -0.033358916294183194 +< 3 -3 0 >: 0.009103714016995480 0.036031747747082357 +< 3 -2 -1 >: -0.004291531943600353 -0.016985528779976698 +< 3 -1 -2 >: -0.004291531943600353 -0.016985528779976694 +< 3 0 -3 >: 0.009103714016995482 0.036031747747082364 +< 4 -3 -1 >: -0.007433151368620624 -0.029419798840343042 +< 4 -2 -2 >: 0.009596157153502179 0.037980796985806947 +< 4 -1 -3 >: -0.007433151368620624 -0.029419798840343042 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.031626196124089540 0.124238012018366747 +< 0 1 -1 >: -0.031626196124089533 0.124238012018366720 +< 1 -1 0 >: 0.054778178537060983 -0.215186549047164027 +< 1 0 -1 >: 0.054778178537060983 -0.215186549047164027 +< 2 -1 -1 >: -0.077468043009206428 0.304319736102762528 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.010343487681285667 0.081185770639017593 +< 0 1 -1 >: 0.011943630794299710 0.093745253065608006 +< 1 -2 1 >: -0.006895658454190442 -0.054123847092678382 +< 1 -1 0 >: -0.019503867414817636 -0.153085357212546791 +< 1 0 -1 >: -0.016890844653275592 -0.132575808293480812 +< 2 -2 0 >: 0.015419161053190952 0.121024601303033247 +< 2 -1 -1 >: 0.021805986681837659 0.171154632543546154 +< 3 -2 -1 >: -0.026706770354213965 -0.209620758422620096 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.035281108280478521 0.016415843772724075 +< 0 1 -1 >: -0.047041477707304706 0.021887791696965440 +< 0 2 -2 >: -0.011760369426826175 0.005471947924241359 +< 1 -2 1 >: 0.026296985478893566 -0.012235647527942548 +< 1 -1 0 >: 0.064414196196667967 -0.029971093116005623 +< 1 0 -1 >: 0.064414196196667980 -0.029971093116005626 +< 1 1 -2 >: 0.026296985478893566 -0.012235647527942548 +< 2 -2 0 >: -0.045547714935344624 0.021192763181901022 +< 2 -1 -1 >: -0.074379107027559246 0.034607637356866373 +< 2 0 -2 >: -0.045547714935344645 0.021192763181901029 +< 3 -2 -1 >: 0.069575283807829180 -0.032372480488778228 +< 3 -1 -2 >: 0.069575283807829180 -0.032372480488778221 +< 4 -2 -2 >: -0.098394309966989196 0.045781600954888556 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.002213108333893375 -0.056403580921133775 +< 0 1 -1 >: -0.002710493081769895 -0.069079996461279075 +< 1 -2 1 >: 0.001916608038478716 0.048846933942113140 +< 1 -1 0 >: 0.004285665860260942 0.109225064787006762 +< 1 0 -1 >: 0.003499231521901740 0.089181891950200362 +< 2 -3 1 >: -0.001106554166946688 -0.028201790460566891 +< 2 -2 0 >: -0.003833216076957434 -0.097693867884226307 +< 2 -1 -1 >: -0.004285665860260943 -0.109225064787006776 +< 3 -3 0 >: 0.002927667137963184 0.074614924085413703 +< 3 -2 -1 >: 0.005070868230601998 0.129236839518831331 +< 4 -3 -1 >: -0.005855334275926370 -0.149229848170827462 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.002552071211400202 0.000010578837385885 +< 0 1 -1 >: 0.000850690403800068 -0.000003526279128628 +< 0 2 -2 >: 0.005954832826600471 -0.000024683953900398 +< 0 3 -3 >: 0.002552071211400202 -0.000010578837385885 +< 1 -3 2 >: -0.004659423236144752 0.000019314226228094 +< 1 -2 1 >: -0.004812231625738799 0.000019947647073678 +< 1 -1 0 >: 0.003294709766696124 -0.000013657220339256 +< 1 0 -1 >: 0.003294709766696123 -0.000013657220339256 +< 1 1 -2 >: -0.004812231625738799 0.000019947647073678 +< 1 2 -3 >: -0.004659423236144753 0.000019314226228094 +< 2 -3 1 >: 0.006251272255177035 -0.000025912753667297 +< 2 -2 0 >: 0.001473439000893000 -0.000006107694612454 +< 2 -1 -1 >: -0.005380238519313141 0.000022302147423959 +< 2 0 -2 >: 0.001473439000893000 -0.000006107694612454 +< 2 1 -3 >: 0.006251272255177034 -0.000025912753667297 +< 3 -3 0 >: -0.006752145753492282 0.000027988972883245 +< 3 -2 -1 >: 0.003182992033236229 -0.000013194128349459 +< 3 -1 -2 >: 0.003182992033236228 -0.000013194128349459 +< 3 0 -3 >: -0.006752145753492283 0.000027988972883245 +< 4 -3 -1 >: 0.005513103921652112 -0.000022852900662848 +< 4 -2 -2 >: -0.007117386558156476 0.000029502967893248 +< 4 -1 -3 >: 0.005513103921652112 -0.000022852900662848 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: 0.015761397451015922 -0.034885911749473052 +< 0 0 0 >: 0.015761397451015922 -0.034885911749473059 +< 1 -1 0 >: -0.054599082366892350 0.120848343236902800 +< 2 -1 -1 >: 0.038607381388192433 -0.085452682997973414 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: -0.024039661482545320 -0.096286931071182427 +< -2 1 1 >: 0.014721226055368649 0.058963462505733047 +< -1 -1 2 >: 0.014721226055368649 0.058963462505733047 +< -1 0 1 >: -0.012019830741272653 -0.048143465535591186 +< 0 -2 2 >: -0.012019830741272653 -0.048143465535591186 +< 0 -1 1 >: -0.006009915370636327 -0.024071732767795593 +< 0 0 0 >: 0.006009915370636327 0.024071732767795593 +< 1 -2 1 >: 0.014721226055368649 0.058963462505733047 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: 0.011712964679141825 0.035618966481091710 +< -2 0 2 >: -0.033129267009678810 -0.100745650950545190 +< -2 1 1 >: 0.018145646854812802 0.055180665596155372 +< -1 -2 3 >: -0.018519823269595739 -0.056318530990721309 +< -1 -1 2 >: 0.014345393419569783 0.043624146521985999 +< -1 0 1 >: -0.010476394096246056 -0.031858572136003023 +< 0 -3 3 >: 0.018519823269595739 0.056318530990721302 +< 0 -1 1 >: -0.011111893961757440 -0.033791118594432776 +< 0 0 0 >: 0.007407929307838295 0.022527412396288523 +< 1 -3 2 >: -0.018519823269595739 -0.056318530990721309 +< 1 -2 1 >: 0.014345393419569783 0.043624146521985999 +< 2 -3 1 >: 0.011712964679141825 0.035618966481091710 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.000325432350205215 -0.000378105260875749 +< -2 -1 3 >: 0.000488148525307823 0.000567157891313623 +< -2 0 2 >: -0.001166898166104609 -0.001355766675415617 +< -2 1 1 >: 0.000615009333727343 0.000714551778344593 +< -1 -3 4 >: 0.000608828178520274 0.000707370171166916 +< -1 -2 3 >: -0.000575288554118958 -0.000668401984918876 +< -1 -1 2 >: 0.000391389543334462 0.000454737967178732 +< -1 0 1 >: -0.000275040535402238 -0.000319557269964375 +< 0 -4 4 >: -0.000703014225517819 -0.000816800717479861 +< 0 -3 3 >: 0.000175753556379455 0.000204200179369965 +< 0 -2 2 >: 0.000200861207290806 0.000233371633565675 +< 0 -1 1 >: -0.000426830065492962 -0.000495914721327059 +< 0 0 0 >: 0.000251076509113507 0.000291714541957093 +< 1 -4 3 >: 0.000608828178520274 0.000707370171166916 +< 1 -3 2 >: -0.000575288554118958 -0.000668401984918876 +< 1 -2 1 >: 0.000391389543334462 0.000454737967178732 +< 2 -4 2 >: -0.000325432350205215 -0.000378105260875749 +< 2 -3 1 >: 0.000488148525307823 0.000567157891313623 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.008099599554954246 -0.002354940413717618 +< 0 1 -1 >: -0.009352611966762011 -0.002719250963570790 +< 1 -2 1 >: 0.005399733036636162 0.001569960275811745 +< 1 -1 0 >: 0.015272751387209840 0.004440518228879951 +< 1 0 -1 >: 0.013226590687007742 0.003845601592177918 +< 2 -2 0 >: -0.012074170130269825 -0.003510537898689381 +< 2 -1 -1 >: -0.017075455152627705 -0.004964650307551269 +< 3 -2 -1 >: 0.020913076124857863 0.006080430002426092 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.019631542699033788 -0.035711676901976415 +< -3 1 2 >: -0.019631542699033788 0.035711676901976415 +< -3 2 1 >: 0.012416077782359243 -0.022586047614854231 +< -2 -1 3 >: -0.019631542699033788 0.035711676901976415 +< -2 1 1 >: 0.015206527586743538 -0.027662145981298958 +< -1 -2 3 >: 0.012416077782359243 -0.022586047614854231 +< -1 -1 2 >: 0.015206527586743538 -0.027662145981298958 +< -1 0 1 >: -0.011778925619420269 0.021427006141185843 +< 0 -2 2 >: -0.017558985591291709 0.031941494857331360 +< 0 -1 1 >: -0.005552638787056022 0.010100787561972214 +< 0 0 0 >: 0.007852617079613515 -0.014284670760790565 +< 1 -2 1 >: 0.019234904990517311 -0.034990154507591284 +< 1 -1 0 >: -0.005552638787056022 0.010100787561972214 +< 2 -2 0 >: -0.017558985591291709 0.031941494857331360 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: 0.009353804665421333 -0.010047640726051023 +< 0 -1 1 >: 0.037415218661685339 -0.040190562904204100 +< 0 0 0 >: 0.028061413996263992 -0.030142922178153061 +< 1 -2 1 >: -0.041831486160273552 0.044934415353890853 +< 1 -1 0 >: -0.102465796274966534 0.110066389507314608 +< 2 -2 0 >: 0.072454259385708111 -0.077828690401342007 +< 2 -1 -1 >: 0.059158655062081289 -0.063546859610778300 +< 3 -2 -1 >: -0.110675709352324056 0.118885288334477632 +< 4 -2 -2 >: 0.078259544595659730 -0.084064593564627074 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.010293696918808872 -0.032314368986093446 +< 0 1 -1 >: 0.012607152508970569 -0.039576857687973373 +< 1 -2 1 >: -0.008914603030546085 0.027985064449220918 +< 1 -1 0 >: -0.019933658368726685 0.062576506463170700 +< 1 0 -1 >: -0.016275763903446684 0.051093503573580605 +< 2 -3 1 >: 0.005146848459404437 -0.016157184493046726 +< 2 -2 0 >: 0.017829206061092177 -0.055970128898441857 +< 2 -1 -1 >: 0.019933658368726688 -0.062576506463170700 +< 3 -3 0 >: -0.013617281059320054 0.042747892055590840 +< 3 -2 -1 >: -0.023585822655687684 0.074041520956753329 +< 4 -3 -1 >: 0.027234562118640119 -0.085495784111181708 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: -0.002607958750132885 0.016684473672022890 +< 0 -2 2 >: -0.006085237083643398 0.038930438568053415 +< 0 -1 1 >: -0.000869319583377629 0.005561491224007634 +< 0 0 0 >: 0.002607958750132885 -0.016684473672022890 +< 1 -3 2 >: 0.009522918909938399 -0.060923083935119908 +< 1 -2 1 >: 0.009835228358793364 -0.062921090528084284 +< 1 -1 0 >: -0.006733720537907048 0.043079125781320511 +< 2 -3 1 >: -0.012776336416104280 0.081736894246712127 +< 2 -2 0 >: -0.003011411372849321 0.019265570731659274 +< 2 -1 -1 >: 0.005498059796123914 -0.035173958909803654 +< 3 -3 0 >: 0.013800020564732902 -0.088285936184354416 +< 3 -2 -1 >: -0.006505392081224297 0.041618389439573196 +< 4 -3 -1 >: -0.011267669607836723 0.072085165038528798 +< 4 -2 -2 >: 0.007273249456953178 -0.046530773950472511 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 3 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: -0.003648104537075803 0.026454157441520663 +< -4 1 3 >: 0.005768159739776860 -0.041827695547948941 +< -4 2 2 >: -0.003270239184416702 0.023714074357456379 +< -3 -1 4 >: 0.002884079869888429 -0.020913847773974467 +< -3 0 3 >: -0.005472156805613703 0.039681236162280982 +< -3 1 2 >: 0.002180159456277802 -0.015809382904970918 +< -2 -2 4 >: -0.003270239184416702 0.023714074357456375 +< -2 -1 3 >: 0.001090079728138901 -0.007904691452485459 +< -2 0 2 >: 0.002866367850559558 -0.020785409418337654 +< -2 1 1 >: -0.002472068459904368 0.017926155234835255 +< -1 -3 4 >: 0.002884079869888428 -0.020913847773974457 +< -1 -2 3 >: 0.001090079728138900 -0.007904691452485456 +< -1 -1 2 >: -0.002472068459904368 0.017926155234835258 +< -1 0 1 >: 0.002345210059548730 -0.017006244069548995 +< 0 -4 4 >: -0.001824052268537901 0.013227078720760330 +< 0 -3 3 >: -0.002736078402806852 0.019840618081140498 +< 0 -2 2 >: 0.001433183925279780 -0.010392704709168836 +< 0 -1 1 >: 0.001172605029774365 -0.008503122034774499 +< 0 0 0 >: -0.001172605029774366 0.008503122034774501 +< 1 -4 3 >: 0.002884079869888428 -0.020913847773974457 +< 1 -3 2 >: 0.001090079728138900 -0.007904691452485456 +< 1 -2 1 >: -0.002472068459904368 0.017926155234835258 +< 2 -4 2 >: -0.003270239184416702 0.023714074357456375 +< 2 -3 1 >: 0.001090079728138901 -0.007904691452485459 +< 3 -4 1 >: 0.002884079869888429 -0.020913847773974467 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: 0.009625484768779556 -0.059386974877105640 +< -2 0 2 >: -0.013612491104423707 0.083985865299513102 +< -2 1 1 >: 0.014911736883462550 -0.092001905872267378 +< -2 2 0 >: -0.013612491104423707 0.083985865299513102 +< -1 -2 3 >: -0.015219227726301290 0.093899051979425954 +< -1 -1 2 >: 0.011788763105220618 -0.072733892908196290 +< -1 0 1 >: -0.004304647651875987 0.026558662560656091 +< -1 1 0 >: -0.004304647651875987 0.026558662560656091 +< 0 -3 3 >: 0.015219227726301288 -0.093899051979425954 +< 0 -1 1 >: -0.009131536635780771 0.056339431187655553 +< 0 0 0 >: 0.006087691090520516 -0.037559620791770380 +< 1 -3 2 >: -0.015219227726301290 0.093899051979425954 +< 1 -2 1 >: 0.011788763105220618 -0.072733892908196290 +< 2 -3 1 >: 0.009625484768779556 -0.059386974877105640 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.006314448997840148 0.008714688795515652 +< 0 1 -1 >: 0.007291297657374341 0.010062855843989549 +< 1 -2 1 >: -0.004209632665226764 -0.005809792530343766 +< 1 -1 0 >: -0.011906639215544981 -0.016432574781972114 +< 1 0 -1 >: -0.010311452034357970 -0.014231027210775378 +< 2 -2 0 >: 0.009413024799750661 0.012991091033019172 +< 2 -1 -1 >: 0.013312027334761672 0.018372177128919212 +< 3 -2 -1 >: -0.016303837206074000 -0.022501229714941656 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: -0.022917611572427582 -0.095136539930398695 +< -3 1 2 >: 0.022917611572427585 0.095136539930398695 +< -3 2 1 >: -0.014494370219980818 -0.060169630977523370 +< -2 -1 3 >: 0.022917611572427585 0.095136539930398695 +< -2 1 1 >: -0.017751905590972488 -0.073692446953246241 +< -1 -2 3 >: -0.014494370219980818 -0.060169630977523370 +< -1 -1 2 >: -0.017751905590972488 -0.073692446953246241 +< -1 0 1 >: 0.013750566943456546 0.057081923958239203 +< 0 -2 2 >: 0.020498134943153581 0.085092708171397885 +< 0 -1 1 >: 0.006482079420585139 0.026908677009363880 +< 0 0 0 >: -0.009167044628971034 -0.038054615972159478 +< 1 -2 1 >: -0.022454581790300181 -0.093214391489357590 +< 1 -1 0 >: 0.006482079420585139 0.026908677009363880 +< 2 -2 0 >: 0.020498134943153581 0.085092708171397885 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 4 ) +l=( 3 3 2 ) +num_ms=14 +< -3 1 2 >: -0.009925536391645493 0.073082807694142202 +< -3 2 1 >: 0.015693650998244400 -0.115554065056783811 +< -3 3 0 >: -0.015693650998244400 0.115554065056783797 +< -2 1 1 >: -0.012156249791478398 0.089507793910298450 +< -2 3 -1 >: 0.015693650998244400 -0.115554065056783811 +< -1 1 0 >: 0.009416190598946637 -0.069332439034070256 +< -1 2 -1 >: -0.012156249791478398 0.089507793910298450 +< -1 3 -2 >: -0.009925536391645493 0.073082807694142202 +< 0 0 0 >: -0.006277460399297760 0.046221626022713520 +< 0 1 -1 >: 0.004438834816973460 -0.032683625198129333 +< 0 2 -2 >: 0.014036828178892772 -0.103354697817360730 +< 1 0 -1 >: 0.004438834816973460 -0.032683625198129333 +< 1 1 -2 >: -0.015376574858807463 0.113219398837396845 +< 2 0 -2 >: 0.014036828178892772 -0.103354697817360730 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 3 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.007795806063381553 0.037279924497378908 +< 0 1 -1 >: -0.009547873494490012 0.045658396334030481 +< 1 -2 1 >: 0.006751366093865186 -0.032285361665895955 +< 1 -1 0 >: 0.015096513526869783 -0.072192263363109216 +< 1 0 -1 >: 0.012326251678618338 -0.058944736205412601 +< 2 -3 1 >: -0.003897903031690777 0.018639962248689457 +< 2 -2 0 >: -0.013502732187730376 0.064570723331791938 +< 2 -1 -1 >: -0.015096513526869785 0.072192263363109230 +< 3 -3 0 >: 0.010312882056498515 -0.049316704557664598 +< 3 -2 -1 >: 0.017862435694320843 -0.085419037955738727 +< 4 -3 -1 >: -0.020625764112997037 0.098633409115329224 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.053271702106590713 -0.004203523508645967 +< 0 1 -1 >: -0.053271702106590706 -0.004203523508645966 +< 1 -1 0 >: 0.092269294654289125 0.007280716287785008 +< 1 0 -1 >: 0.092269294654289125 0.007280716287785008 +< 2 -1 -1 >: -0.130488487890694976 -0.010296487717976251 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.005827360758839869 0.027378270584179781 +< 0 1 -1 >: -0.006728856605562517 0.031613703783445204 +< 1 -2 1 >: 0.003884907172559911 -0.018252180389453181 +< 1 -1 0 >: 0.010988176823989483 -0.051624962099289871 +< 1 0 -1 >: 0.009516040270850300 -0.044708528647393837 +< 2 -2 0 >: -0.008686916524120469 0.040813116088405904 +< 2 -1 -1 >: -0.012285155163614113 0.057718462294931189 +< 3 -2 -1 >: 0.015046180780886280 -0.070690390680325774 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.059231345990026794 0.114295582697711742 +< 0 1 -1 >: 0.078975127986702420 0.152394110263615712 +< 0 2 -2 >: 0.019743781996675602 0.038098527565903921 +< 1 -2 1 >: -0.044148438677503170 -0.085190897480010755 +< 1 -1 0 >: -0.108141147700436147 -0.208674229555779661 +< 1 0 -1 >: -0.108141147700436160 -0.208674229555779689 +< 1 1 -2 >: -0.044148438677503170 -0.085190897480010755 +< 2 -2 0 >: 0.076467338864274398 0.147554962777770027 +< 2 -1 -1 >: 0.124870641470643792 0.240956245213934328 +< 2 0 -2 >: 0.076467338864274426 0.147554962777770082 +< 3 -2 -1 >: -0.116805789512458735 -0.225393928698507690 +< 3 -1 -2 >: -0.116805789512458721 -0.225393928698507662 +< 4 -2 -2 >: 0.165188331692216139 0.318755150841983859 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.014123746813070662 -0.207334968187052132 +< 0 1 -1 >: 0.017297986474141595 -0.253932438947230388 +< 1 -2 1 >: -0.012231523536738698 0.179557349542825567 +< 1 -1 0 >: -0.027350518096536380 0.401502439437448844 +< 1 0 -1 >: -0.022331604512423844 0.327825369034818237 +< 2 -3 1 >: 0.007061873406535332 -0.103667484093526094 +< 2 -2 0 >: 0.024463047073477406 -0.359114699085651301 +< 2 -1 -1 >: 0.027350518096536384 -0.401502439437448899 +< 3 -3 0 >: -0.018683960823913017 0.274278381955214201 +< 3 -2 -1 >: -0.032361569433643822 0.475064092964213869 +< 4 -3 -1 >: 0.037367921647826048 -0.548556763910428513 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.005586530235519948 -0.031100937682684408 +< 0 1 -1 >: 0.001862176745173317 0.010366979227561477 +< 0 2 -2 >: 0.013035237216213212 0.072568854592930276 +< 0 3 -3 >: 0.005586530235519948 0.031100937682684408 +< 1 -3 2 >: -0.010199562093929745 -0.056782283761228985 +< 1 -2 1 >: -0.010534062434239565 -0.058644490497830340 +< 1 -1 0 >: 0.007212179521750988 0.040151137898823810 +< 1 0 -1 >: 0.007212179521750985 0.040151137898823797 +< 1 1 -2 >: -0.010534062434239563 -0.058644490497830326 +< 1 2 -3 >: -0.010199562093929746 -0.056782283761228992 +< 2 -3 1 >: 0.013684148509654210 0.076181427844674299 +< 2 -2 0 >: 0.003225384735313424 0.017956134743147611 +< 2 -1 -1 >: -0.011777439841093286 -0.065566533629494550 +< 2 0 -2 >: 0.003225384735313425 0.017956134743147615 +< 2 1 -3 >: 0.013684148509654206 0.076181427844674285 +< 3 -3 0 >: -0.014780569694928880 -0.082285346649300400 +< 3 -2 -1 >: 0.006967627374056395 0.038789684405337387 +< 3 -1 -2 >: 0.006967627374056394 0.038789684405337380 +< 3 0 -3 >: -0.014780569694928882 -0.082285346649300414 +< 4 -3 -1 >: 0.012068284620073394 0.067185704199606497 +< 4 -2 -2 >: -0.015580088450278449 -0.086736371156097877 +< 4 -1 -3 >: 0.012068284620073394 0.067185704199606497 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.022868430750014889 -0.026881012703276877 +< 0 1 -1 >: 0.022868430750014886 -0.026881012703276874 +< 1 -1 0 >: -0.039609283948396239 0.046559279760979969 +< 1 0 -1 >: -0.039609283948396239 0.046559279760979969 +< 2 -1 -1 >: 0.056015986555708885 -0.065844764892301025 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.005105938206464469 -0.061307427965305666 +< 0 1 -1 >: -0.005895829595935710 -0.070791720078185599 +< 1 -2 1 >: 0.003403958804309645 0.040871618643537097 +< 1 -1 0 >: 0.009627849413628011 0.115602394803662453 +< 1 0 -1 >: 0.008337962176012965 0.100114610638289830 +< 2 -2 0 >: -0.007611483279045272 -0.091391717637396716 +< 2 -1 -1 >: -0.010764262883001859 -0.129247406571378814 +< 3 -2 -1 >: 0.013183475760267366 0.158295098338959772 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.029728205437398288 -0.088854042070227318 +< 0 1 -1 >: -0.039637607249864398 -0.118472056093636466 +< 0 2 -2 >: -0.009909401812466098 -0.029618014023409113 +< 1 -2 1 >: 0.022158096069033819 0.066227892714884815 +< 1 -1 0 >: 0.054276029040702597 0.162224543891255152 +< 1 0 -1 >: 0.054276029040702604 0.162224543891255152 +< 1 1 -2 >: 0.022158096069033819 0.066227892714884815 +< 2 -2 0 >: -0.038378948190558780 -0.114710075060401179 +< 2 -1 -1 >: -0.062672559954387183 -0.187320768169560864 +< 2 0 -2 >: -0.038378948190558794 -0.114710075060401220 +< 3 -2 -1 >: 0.058624811725341404 0.175222533979451645 +< 3 -1 -2 >: 0.058624811725341397 0.175222533979451617 +< 4 -2 -2 >: -0.082908003833547031 -0.247802083987120919 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.006754557238419695 0.062138276414587426 +< 0 1 -1 >: -0.008272609336275457 0.076103535355878896 +< 1 -2 1 >: 0.005849618159787520 -0.053813325922412142 +< 1 -1 0 >: 0.013080143847702123 -0.120330254857865138 +< 1 0 -1 >: 0.010679892729691609 -0.098249241673608739 +< 2 -3 1 >: -0.003377278619209848 0.031069138207293720 +< 2 -2 0 >: -0.011699236319575044 0.107626651844824325 +< 2 -1 -1 >: -0.013080143847702124 0.120330254857865152 +< 3 -3 0 >: 0.008935439334604865 -0.082201213145594310 +< 3 -2 -1 >: 0.015476634915485073 -0.142376677611968067 +< 4 -3 -1 >: -0.017870878669209736 0.164402426291188675 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000684508559562604 0.017230875513980341 +< 0 1 -1 >: -0.000228169519854201 -0.005743625171326785 +< 0 2 -2 >: -0.001597186638979408 -0.040205376199287463 +< 0 3 -3 >: -0.000684508559562604 -0.017230875513980341 +< 1 -3 2 >: 0.001249735929592688 0.031459130681901516 +< 1 -2 1 >: 0.001290721717991874 0.032490850457911301 +< 1 -1 0 >: -0.000883696750507464 -0.022244964635406348 +< 1 0 -1 >: -0.000883696750507464 -0.022244964635406338 +< 1 1 -2 >: 0.001290721717991874 0.032490850457911294 +< 1 2 -3 >: 0.001249735929592688 0.031459130681901523 +< 2 -3 1 >: -0.001676696695495886 -0.042206852830668676 +< 2 -2 0 >: -0.000395201201126072 -0.009948250616369477 +< 2 -1 -1 >: 0.001443070750732572 0.036325875135334917 +< 2 0 -2 >: -0.000395201201126072 -0.009948250616369479 +< 2 1 -3 >: -0.001676696695495886 -0.042206852830668669 +< 3 -3 0 >: 0.001811039418897693 0.045588611481904240 +< 3 -2 -1 >: -0.000853732169399136 -0.021490677549155596 +< 3 -1 -2 >: -0.000853732169399135 -0.021490677549155592 +< 3 0 -3 >: 0.001811039418897693 0.045588611481904247 +< 4 -3 -1 >: -0.001478707493455302 -0.037222945404217285 +< 4 -2 -2 >: 0.001909003165354832 0.048054615882440477 +< 4 -1 -3 >: -0.001478707493455302 -0.037222945404217285 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 3 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.017694899263075575 0.068953597370605371 +< 0 1 -1 >: 0.017694899263075575 0.068953597370605357 +< 1 -1 0 >: -0.030648464558459987 -0.119431134010536261 +< 1 0 -1 >: -0.030648464558459987 -0.119431134010536261 +< 2 -1 -1 >: 0.043343474244485238 0.168901129487298962 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.020118940903727806 0.129429915640769139 +< 0 1 -1 >: 0.023231351893154832 0.149452793272777162 +< 1 -2 1 >: -0.013412627269151867 -0.086286610427179403 +< 1 -1 0 >: -0.037936638782179573 -0.244055389434641723 +< 1 0 -1 >: -0.032854092919561442 -0.211358167180903944 +< 2 -2 0 >: 0.029991546330690948 0.192942726463215336 +< 2 -1 -1 >: 0.042414451577404172 0.272862220525521393 +< 3 -2 -1 >: -0.051946882042312646 -0.334186605185153085 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 3 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.004133633258302778 0.035219393568613942 +< 0 1 -1 >: 0.005511511011070372 0.046959191424818608 +< 0 2 -2 >: 0.001377877752767593 0.011739797856204650 +< 1 -2 1 >: -0.003081028319872986 -0.026250986048579898 +< 1 -1 0 >: -0.007546947266753369 -0.064301521063940770 +< 1 0 -1 >: -0.007546947266753369 -0.064301521063940784 +< 1 1 -2 >: -0.003081028319872986 -0.026250986048579898 +< 2 -2 0 >: 0.005336497589578586 0.045468041584922132 +< 2 -1 -1 >: 0.008714464072039936 0.074249000991137210 +< 2 0 -2 >: 0.005336497589578587 0.045468041584922146 +< 3 -2 -1 >: -0.008151634716731091 -0.069453580754768568 +< 3 -1 -2 >: -0.008151634716731089 -0.069453580754768568 +< 4 -2 -2 >: 0.011528152371912468 0.098222195858768666 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.007727186668594346 0.126957116773081052 +< 0 1 -1 >: -0.009463832242646384 0.155490077654494102 +< 1 -2 1 >: 0.006691939954787150 -0.109948088316715653 +< 1 -1 0 >: 0.014963632640250938 -0.245851399472326648 +< 1 0 -1 >: 0.012217754889023408 -0.200736827085451180 +< 2 -3 1 >: -0.003863593334297174 0.063478558386540540 +< 2 -2 0 >: -0.013383879909574304 0.219896176633431389 +< 2 -1 -1 >: -0.014963632640250940 0.245851399472326676 +< 3 -3 0 >: 0.010222107129637158 -0.167948479075679752 +< 3 -2 -1 >: 0.017705208908943625 -0.290895298812995917 +< 4 -3 -1 >: -0.020444214259274323 0.335896958151359615 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 3 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000778843439898713 -0.004525756822878790 +< 0 1 -1 >: 0.000259614479966238 0.001508585607626265 +< 0 2 -2 >: 0.001817301359763664 0.010560099253383843 +< 0 3 -3 >: 0.000778843439898713 0.004525756822878790 +< 1 -3 2 >: -0.001421967069324814 -0.008262863672245420 +< 1 -2 1 >: -0.001468601274226767 -0.008533848905223674 +< 1 -1 0 >: 0.001005482557343538 0.005842726934664717 +< 1 0 -1 >: 0.001005482557343538 0.005842726934664714 +< 1 1 -2 >: -0.001468601274226766 -0.008533848905223672 +< 1 2 -3 >: -0.001421967069324815 -0.008262863672245421 +< 2 -3 1 >: 0.001907769017265865 0.011085794915972584 +< 2 -2 0 >: 0.000449665469682096 0.002612946919975854 +< 2 -1 -1 >: -0.001641946140506930 -0.009541133130896147 +< 2 0 -2 >: 0.000449665469682096 0.002612946919975854 +< 2 1 -3 >: 0.001907769017265865 0.011085794915972582 +< 3 -3 0 >: -0.002060626052226077 -0.011974027047691077 +< 3 -2 -1 >: 0.000971388436679149 0.005644610482355665 +< 3 -1 -2 >: 0.000971388436679149 0.005644610482355664 +< 3 0 -3 >: -0.002060626052226077 -0.011974027047691078 +< 4 -3 -1 >: 0.001682494126213189 0.009776752144375877 +< 4 -2 -2 >: -0.002172090576971827 -0.012621732745055137 +< 4 -1 -3 >: 0.001682494126213189 0.009776752144375877 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: -0.022116145723924285 -0.041260785944438057 +< 0 0 0 >: -0.022116145723924289 -0.041260785944438064 +< 1 -1 0 >: 0.076612576122868078 0.142931555231981061 +< 2 -1 -1 >: -0.054173272100650587 -0.101067871950073357 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: 0.034677318353898291 -0.129990094600396566 +< -2 1 1 >: -0.021235433903775171 0.079602350846771558 +< -1 -1 2 >: -0.021235433903775171 0.079602350846771558 +< -1 0 1 >: 0.017338659176949135 -0.064995047300198242 +< 0 -2 2 >: 0.017338659176949135 -0.064995047300198242 +< 0 -1 1 >: 0.008669329588474568 -0.032497523650099121 +< 0 0 0 >: -0.008669329588474568 0.032497523650099121 +< 1 -2 1 >: -0.021235433903775171 0.079602350846771558 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: -0.011358322653565719 0.056076513923086671 +< -2 0 2 >: 0.032126187884964415 -0.158608333041265787 +< -2 1 1 >: -0.017596237791244192 0.086873361814993236 +< -1 -2 3 >: 0.017959084992177646 -0.088664753619549022 +< -1 -1 2 >: -0.013911047417565521 0.068679422832819456 +< -1 0 1 >: 0.010159192625499499 -0.050156358829294097 +< 0 -3 3 >: -0.017959084992177646 0.088664753619549008 +< 0 -1 1 >: 0.010775450995306584 -0.053198852171729392 +< 0 0 0 >: -0.007183633996871059 0.035465901447819609 +< 1 -3 2 >: 0.017959084992177646 -0.088664753619549022 +< 1 -2 1 >: -0.013911047417565521 0.068679422832819456 +< 2 -3 1 >: -0.011358322653565719 0.056076513923086671 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: 0.000403562276564152 -0.000162601660772411 +< -2 -1 3 >: -0.000605343414846227 0.000243902491158616 +< -2 0 2 >: 0.001447047535792778 -0.000583038470641414 +< -2 1 1 >: -0.000762661015939868 0.000307288255121347 +< -1 -3 4 >: -0.000754995886564783 0.000304199852565401 +< -1 -2 3 >: 0.000713404055973981 -0.000287441842410916 +< -1 -1 2 >: -0.000485354498505932 0.000195557048077758 +< -1 0 1 >: 0.000341072375086119 -0.000137423485427726 +< 0 -4 4 >: 0.000871794156690475 -0.000351259733532157 +< 0 -3 3 >: -0.000217948539172619 0.000087814933383039 +< 0 -2 2 >: -0.000249084044768707 0.000100359923866331 +< 0 -1 1 >: 0.000529303595133503 -0.000213264838215952 +< 0 0 0 >: -0.000311355055960884 0.000125449904832913 +< 1 -4 3 >: -0.000754995886564783 0.000304199852565401 +< 1 -3 2 >: 0.000713404055973981 -0.000287441842410916 +< 1 -2 1 >: -0.000485354498505932 0.000195557048077758 +< 2 -4 2 >: 0.000403562276564152 -0.000162601660772411 +< 2 -3 1 >: -0.000605343414846227 0.000243902491158616 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.016484663824014738 -0.098119484383888775 +< 0 1 -1 >: -0.019034850192590783 -0.113298621443570890 +< 1 -2 1 >: 0.010989775882676488 0.065412989589259160 +< 1 -1 0 >: 0.031083780201443693 0.185015874065000807 +< 1 0 -1 >: 0.026919343300102004 0.160228447043673117 +< 2 -2 0 >: -0.024573885931152388 -0.146267891333069555 +< 2 -1 -1 >: -0.034752722764045098 -0.206854035662941055 +< 3 -2 -1 >: 0.042563218972157958 0.253343419304839890 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.015926487128803200 0.023379910035030406 +< -3 1 2 >: -0.015926487128803204 -0.023379910035030409 +< -3 2 1 >: 0.010072794890474721 0.014786753440104636 +< -2 -1 3 >: -0.015926487128803204 -0.023379910035030409 +< -2 1 1 >: 0.012336603882688320 0.018110000440300093 +< -1 -2 3 >: 0.010072794890474721 0.014786753440104636 +< -1 -1 2 >: 0.012336603882688320 0.018110000440300093 +< -1 0 1 >: -0.009555892277281918 -0.014027946021018240 +< 0 -2 2 >: -0.014245083145111772 -0.020911627258463003 +< 0 -1 1 >: -0.004504690819702806 -0.006612837171720568 +< 0 0 0 >: 0.006370594851521281 0.009351964014012164 +< 1 -2 1 >: 0.015604706744228708 0.022907539927200203 +< 1 -1 0 >: -0.004504690819702806 -0.006612837171720568 +< 2 -2 0 >: -0.014245083145111772 -0.020911627258463003 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: -0.004628573120642897 -0.017765183713257846 +< 0 -1 1 >: -0.018514292482571592 -0.071060734853031396 +< 0 0 0 >: -0.013885719361928690 -0.053295551139773530 +< 1 -2 1 >: 0.020699608273171705 0.079448316831233351 +< 1 -1 0 >: 0.050703478144763912 0.194607837159494229 +< 2 -2 0 >: -0.035852773225906465 -0.137608521327525740 +< 2 -1 -1 >: -0.029273666755729753 -0.112356887170444855 +< 3 -2 -1 >: 0.054766015727267504 0.210200488418110676 +< 4 -2 -2 >: -0.038725421099319958 -0.148634190769170366 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.007784200142983607 -0.110856207564197728 +< 0 1 -1 >: 0.009533659203004847 -0.135770571676172652 +< 1 -2 1 >: -0.006741315071966263 0.096004291917795873 +< 1 -1 0 >: -0.015074038758660454 0.214672122859925263 +< 1 0 -1 >: -0.012307901107218279 0.175279054335625656 +< 2 -3 1 >: 0.003892100071491804 -0.055428103782098871 +< 2 -2 0 >: 0.013482630143932531 -0.192008583835591828 +< 2 -1 -1 >: 0.015074038758660455 -0.214672122859925291 +< 3 -3 0 >: -0.010297528866944025 0.146648978251312262 +< 3 -2 -1 >: -0.017835843189954230 0.254003481209336190 +< 4 -3 -1 >: 0.020595057733888058 -0.293297956502624579 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: 0.001304955982363996 0.012281745338285435 +< 0 -2 2 >: 0.003044897292182658 0.028657405789332679 +< 0 -1 1 >: 0.000434985327454666 0.004093915112761815 +< 0 0 0 >: -0.001304955982363996 -0.012281745338285435 +< 1 -3 2 >: -0.004765025520613829 -0.044846593115418991 +< 1 -2 1 >: -0.004921297196157517 -0.046317362205375461 +< 1 -1 0 >: 0.003369381858152998 0.031711330105026712 +< 2 -3 1 >: 0.006392952587168311 0.060168018459210583 +< 2 -2 0 >: 0.001506833375396931 0.014181737954355050 +< 2 -1 -1 >: -0.002751088767021832 -0.025892192607424779 +< 3 -3 0 >: -0.006905178002442247 -0.064988887661860228 +< 3 -2 -1 >: 0.003255132127218061 0.030636055444981412 +< 4 -3 -1 >: 0.005638054229691440 0.053063204574204957 +< 4 -2 -2 >: -0.003639348356101538 -0.034252151268715496 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 2 4 4 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: -0.001190327260320904 0.013418324705094308 +< -4 1 3 >: 0.001882072651801112 -0.021216234225902596 +< -4 2 2 >: -0.001067034897004629 0.012028474182650404 +< -3 -1 4 >: 0.000941036325900556 -0.010608117112951296 +< -3 0 3 >: -0.001785490890481355 0.020127487057641457 +< -3 1 2 >: 0.000711356598003086 -0.008018982788433602 +< -2 -2 4 >: -0.001067034897004629 0.012028474182650403 +< -2 -1 3 >: 0.000355678299001543 -0.004009491394216801 +< -2 0 2 >: 0.000935257133109281 -0.010542969411145523 +< -2 1 1 >: -0.000806602565057619 0.009092671811101108 +< -1 -3 4 >: 0.000941036325900555 -0.010608117112951291 +< -1 -2 3 >: 0.000355678299001543 -0.004009491394216799 +< -1 -1 2 >: -0.000806602565057619 0.009092671811101112 +< -1 0 1 >: 0.000765210381634867 -0.008626065881846339 +< 0 -4 4 >: -0.000595163630160452 0.006709162352547153 +< 0 -3 3 >: -0.000892745445240678 0.010063743528820732 +< 0 -2 2 >: 0.000467628566554641 -0.005271484705572766 +< 0 -1 1 >: 0.000382605190817433 -0.004313032940923171 +< 0 0 0 >: -0.000382605190817433 0.004313032940923172 +< 1 -4 3 >: 0.000941036325900555 -0.010608117112951291 +< 1 -3 2 >: 0.000355678299001543 -0.004009491394216799 +< 1 -2 1 >: -0.000806602565057619 0.009092671811101112 +< 2 -4 2 >: -0.001067034897004629 0.012028474182650403 +< 2 -3 1 >: 0.000355678299001543 -0.004009491394216801 +< 3 -4 1 >: 0.000941036325900556 -0.010608117112951296 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.360154989178294860 0.274262363425851641 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.236503037611134448 -0.017793557778389042 +< 1 -1 >: 0.473006075222268785 0.035587115556778084 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.109362673367572216 -0.176245148364653936 +< 1 -1 >: -0.218725346735144460 0.352490296729307928 +< 2 -2 >: 0.218725346735144516 -0.352490296729307984 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.085923349847730035 -0.451038172672023951 +< 1 -1 >: -0.171846699695460070 0.902076345344047903 +< 2 -2 >: 0.171846699695460070 -0.902076345344047792 +< 3 -3 >: -0.171846699695460070 0.902076345344047792 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.013560976305340870 0.027254481451177152 +< 1 -1 >: -0.027121952610681732 -0.054508962902354283 +< 2 -2 >: 0.027121952610681732 0.054508962902354283 +< 3 -3 >: -0.027121952610681732 -0.054508962902354283 +< 4 -4 >: 0.027121952610681736 0.054508962902354297 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000394826851028686 -0.011479639494511551 +< 1 -1 >: -0.000789653702057372 0.022959278989023103 +< 2 -2 >: 0.000789653702057372 -0.022959278989023106 +< 3 -3 >: -0.000789653702057372 0.022959278989023113 +< 4 -4 >: 0.000789653702057372 -0.022959278989023106 +< 5 -5 >: -0.000789653702057371 0.022959278989023082 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 1 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.036031930408102500 0.073811722430843191 +< 1 -1 >: 0.072063860816205014 -0.147623444861686409 +< 2 -2 >: -0.072063860816204986 0.147623444861686354 +< 3 -3 >: 0.072063860816205014 -0.147623444861686409 +< 4 -4 >: -0.072063860816204972 0.147623444861686326 +< 5 -5 >: 0.072063860816204986 -0.147623444861686354 +< 6 -6 >: -0.072063860816204944 0.147623444861686270 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.024919033854915000 0.118397927355655158 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.049498795663409048 0.250305546865169426 +< 1 -1 0 >: 0.098997591326818082 -0.500611093730338741 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.035633126325943947 -0.078566305460119765 +< 1 -1 0 >: 0.071266252651887893 0.157132610920239529 +< 2 -2 0 >: -0.071266252651887921 -0.157132610920239585 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.027429849235777872 -0.087513004003342554 +< 0 1 -1 >: -0.031673261680214400 -0.101051312837845200 +< 1 -2 1 >: 0.018286566157185241 0.058342002668895013 +< 1 -1 0 >: 0.051722219737448456 0.165016102860717329 +< 1 0 -1 >: 0.044792756232751245 0.142908137110887123 +< 2 -2 0 >: -0.040890005002513316 -0.130456683911123444 +< 2 -1 -1 >: -0.057827199640058030 -0.184493611689330705 +< 3 -2 -1 >: 0.070823566186098613 0.225957604721019084 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.012196224155131703 0.020287513804108058 +< 1 -1 0 >: 0.024392448310263406 -0.040575027608216116 +< 2 -2 0 >: -0.024392448310263402 0.040575027608216109 +< 3 -3 0 >: 0.024392448310263402 -0.040575027608216109 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.012421907309781263 -0.120080484980472135 +< 0 1 -1 >: -0.015213667270556293 -0.147067958134047994 +< 1 -2 1 >: 0.010757687293726188 0.103992750491844602 +< 1 -1 0 >: 0.024054920069457506 0.232534859266939259 +< 1 0 -1 >: 0.019640759991201785 0.189863917537965776 +< 2 -3 1 >: -0.006210953654890632 -0.060040242490236082 +< 2 -2 0 >: -0.021515374587452382 -0.207985500983689287 +< 2 -1 -1 >: -0.024054920069457510 -0.232534859266939287 +< 3 -3 0 >: 0.016432638775388298 0.158851550285178000 +< 3 -2 -1 >: 0.028462165261398956 0.275138955955010811 +< 4 -3 -1 >: -0.032865277550776603 -0.317703100570356112 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.003608364130291558 0.027578091051118719 +< 1 -1 0 >: -0.007216728260583114 -0.055156182102237418 +< 2 -2 0 >: 0.007216728260583114 0.055156182102237418 +< 3 -3 0 >: -0.007216728260583114 -0.055156182102237418 +< 4 -4 0 >: 0.007216728260583114 0.055156182102237425 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.000869775901563319 -0.014410984674016806 +< 0 1 -1 >: 0.000476395881260622 0.007893221381820237 +< 0 2 -2 >: 0.002021176549012365 0.033488102186950454 +< 1 -3 2 >: -0.001691037625126737 -0.028018156464309805 +< 1 -2 1 >: -0.001355846447436025 -0.022464501878244173 +< 1 -1 0 >: 0.001478619032657641 0.024498673945828567 +< 1 0 -1 >: 0.000476395881260622 0.007893221381820237 +< 1 1 -2 >: -0.002130507149399340 -0.035299559142409752 +< 2 -4 2 >: 0.001127358416751158 0.018678770976206537 +< 2 -3 1 >: 0.001992906953281184 0.033019714053765262 +< 2 -2 0 >: -0.000695820721250655 -0.011528787739213448 +< 2 -1 -1 >: -0.001355846447436025 -0.022464501878244173 +< 2 0 -2 >: 0.002021176549012365 0.033488102186950454 +< 3 -4 1 >: -0.002109094473789373 -0.034944780699490946 +< 3 -3 0 >: -0.000608843131094323 -0.010087689271811759 +< 3 -2 -1 >: 0.001992906953281184 0.033019714053765262 +< 3 -1 -2 >: -0.001691037625126737 -0.028018156464309805 +< 4 -4 0 >: 0.002435372524377292 0.040350757087247051 +< 4 -3 -1 >: -0.002109094473789373 -0.034944780699490946 +< 4 -2 -2 >: 0.001127358416751158 0.018678770976206537 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.012133802258501273 -0.139076548810896566 +< 1 -1 0 >: -0.024267604517002543 0.278153097621793133 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.013791095149015265 -0.138174582053536055 +< 1 -1 0 >: -0.027582190298030534 0.276349164107072109 +< 2 -2 0 >: 0.027582190298030541 -0.276349164107072220 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.016459879601045745 0.003208294727954801 +< 0 1 -1 >: 0.019006231836985171 0.003704619649648721 +< 1 -2 1 >: -0.010973253067363825 -0.002138863151969866 +< 1 -1 0 >: -0.031037046622436185 -0.006049618555151704 +< 1 0 -1 >: -0.026878870833471735 -0.005239123351967085 +< 2 -2 0 >: 0.024536939792933598 0.004782643402374085 +< 2 -1 -1 >: 0.034700473034298775 0.006763679163631634 +< 3 -2 -1 >: -0.042499226383619554 -0.008283781367395996 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.026926954637611796 -0.042991289269624235 +< 1 -1 0 >: -0.053853909275223592 0.085982578539248469 +< 2 -2 0 >: 0.053853909275223585 -0.085982578539248455 +< 3 -3 0 >: -0.053853909275223585 0.085982578539248455 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.001214021670103439 0.014748397803456945 +< 0 1 -1 >: 0.001486866814217439 0.018063024571026872 +< 1 -2 1 >: -0.001051373607054390 -0.012772487162912328 +< 1 -1 0 >: -0.002350942855122768 -0.028560149538015403 +< 1 0 -1 >: -0.001919536803164206 -0.023319264448574142 +< 2 -3 1 >: 0.000607010835051720 0.007374198901728474 +< 2 -2 0 >: 0.002102747214108780 0.025544974325824667 +< 2 -1 -1 >: 0.002350942855122768 0.028560149538015406 +< 3 -3 0 >: -0.001605999712668499 -0.019510296412299170 +< 3 -2 -1 >: -0.002781673099282860 -0.033792824656830957 +< 4 -3 -1 >: 0.003211999425336999 0.039020592824598355 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.011908961484496062 -0.094323560600201542 +< 1 -1 0 >: 0.023817922968992117 0.188647121200403001 +< 2 -2 0 >: -0.023817922968992117 -0.188647121200403001 +< 3 -3 0 >: 0.023817922968992117 0.188647121200403001 +< 4 -4 0 >: -0.023817922968992121 -0.188647121200403056 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.004558055184434740 0.020126689870304117 +< 0 1 -1 >: -0.002496549642868278 -0.011023842049876291 +< 0 2 -2 >: -0.010591963092246076 -0.046770200809181622 +< 1 -3 2 >: 0.008861872121806554 0.039130757450013952 +< 1 -2 1 >: 0.007105304846829330 0.031374404499193737 +< 1 -1 0 >: -0.007748693813539057 -0.034215372779516993 +< 1 0 -1 >: -0.002496549642868278 -0.011023842049876291 +< 1 1 -2 >: 0.011164909421312584 0.049300120393488037 +< 2 -4 2 >: -0.005907914747871035 -0.026087171633342631 +< 2 -3 1 >: -0.010443816452229051 -0.046116039909784780 +< 2 -2 0 >: 0.003646444147547793 0.016101351896243298 +< 2 -1 -1 >: 0.007105304846829330 0.031374404499193737 +< 2 0 -2 >: -0.010591963092246076 -0.046770200809181622 +< 3 -4 1 >: 0.011052696428401183 0.048804629220968045 +< 3 -3 0 >: 0.003190638629104317 0.014088682909212877 +< 3 -2 -1 >: -0.010443816452229051 -0.046116039909784780 +< 3 -1 -2 >: 0.008861872121806554 0.039130757450013952 +< 4 -4 0 >: -0.012762554516417272 -0.056354731636851521 +< 4 -3 -1 >: 0.011052696428401183 0.048804629220968045 +< 4 -2 -2 >: -0.005907914747871035 -0.026087171633342631 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.065034147298372993 -0.047196259697234337 +< 1 -1 0 >: 0.130068294596745959 0.094392519394468660 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.016796106620001042 -0.129855617544632068 +< 1 -1 0 >: -0.033592213240002090 0.259711235089264136 +< 2 -2 0 >: 0.033592213240002097 -0.259711235089264247 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.026919185071921752 -0.080257020639781712 +< 0 1 -1 >: 0.031083597495278743 -0.092672824941470597 +< 1 -2 1 >: -0.017946123381281161 0.053504680426521116 +< 1 -1 0 >: -0.050759302155657465 0.151334089419248946 +< 1 0 -1 >: -0.043958845145169567 0.131059165895655361 +< 2 -2 0 >: 0.040128751813143064 -0.119640102548103686 +< 2 -1 -1 >: 0.056750625055250838 -0.169196655627236126 +< 3 -2 -1 >: -0.069505036984685478 0.207222736236066268 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.029204147694068341 -0.014311818505648768 +< 1 -1 0 >: 0.058408295388136681 0.028623637011297536 +< 2 -2 0 >: -0.058408295388136675 -0.028623637011297533 +< 3 -3 0 >: 0.058408295388136675 0.028623637011297533 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.010812031281630137 0.052343958951060074 +< 0 1 -1 >: 0.013241979861501942 0.064107995273642693 +< 1 -2 1 >: -0.009363493756403721 -0.045331198186267886 +< 1 -1 0 >: -0.020937408546213582 -0.101363640646010181 +< 1 0 -1 >: -0.017095322491470333 -0.082763066017853965 +< 2 -3 1 >: 0.005406015640815070 0.026171979475530044 +< 2 -2 0 >: 0.018726987512807450 0.090662396372535800 +< 2 -1 -1 >: 0.020937408546213586 0.101363640646010195 +< 3 -3 0 >: -0.014302972969322151 -0.069244549010539155 +< 3 -2 -1 >: -0.024773475882150262 -0.119935077033447079 +< 4 -3 -1 >: 0.028605945938644312 0.138489098021078338 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.016069363750387557 0.061402412860779139 +< 1 -1 0 >: -0.032138727500775101 -0.122804825721558236 +< 2 -2 0 >: 0.032138727500775101 0.122804825721558236 +< 3 -3 0 >: -0.032138727500775101 -0.122804825721558236 +< 4 -4 0 >: 0.032138727500775108 0.122804825721558264 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.004835693703825201 -0.018718794987673260 +< 0 1 -1 >: 0.002648618522770768 0.010252706264063282 +< 0 2 -2 >: 0.011237136709365039 0.043498548748997647 +< 1 -3 2 >: -0.009401663097424391 -0.036393496950530159 +< 1 -2 1 >: -0.007538100466379558 -0.029179713577604155 +< 1 -1 0 >: 0.008220679296502839 0.031821951479044534 +< 1 0 -1 >: 0.002648618522770768 0.010252706264063282 +< 1 1 -2 >: -0.011844982126761027 -0.045851496319566823 +< 2 -4 2 >: 0.006267775398282927 0.024262331300353438 +< 2 -3 1 >: 0.011079966217700176 0.042890147474686342 +< 2 -2 0 >: -0.003868554963060161 -0.014975035990138611 +< 2 -1 -1 >: -0.007538100466379558 -0.029179713577604155 +< 2 0 -2 >: 0.011237136709365039 0.043498548748997647 +< 3 -4 1 >: -0.011725934058812648 -0.045390665565162025 +< 3 -3 0 >: -0.003384985592677639 -0.013103156491371276 +< 3 -2 -1 >: 0.011079966217700176 0.042890147474686342 +< 3 -1 -2 >: -0.009401663097424391 -0.036393496950530159 +< 4 -4 0 >: 0.013539942370710560 0.052412625965485120 +< 4 -3 -1 >: -0.011725934058812648 -0.045390665565162025 +< 4 -2 -2 >: 0.006267775398282927 0.024262331300353438 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.099299222180234459 -0.028070314492789197 +< 1 -1 0 >: -0.198598444360468890 0.056140628985578388 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.004454427650309395 0.259452239157920983 +< 1 -1 0 >: 0.008908855300618792 -0.518904478315841966 +< 2 -2 0 >: -0.008908855300618794 0.518904478315842188 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.030742865736554072 0.030112738251934824 +< 0 1 -1 >: -0.035498803617320017 0.034771195071582606 +< 1 -2 1 >: 0.020495243824369375 -0.020075158834623210 +< 1 -1 0 >: 0.057969303561133195 -0.056781123781436418 +< 1 0 -1 >: 0.050202889523633054 -0.049173895650152642 +< 2 -2 0 >: -0.045828758406722694 0.044889419813322964 +< 2 -1 -1 >: -0.064811651685507218 0.063483226307060853 +< 3 -2 -1 >: 0.079377738008243007 -0.077750755838964389 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.011228970968402285 0.029184583395980727 +< 1 -1 0 >: -0.022457941936804570 -0.058369166791961455 +< 2 -2 0 >: 0.022457941936804567 0.058369166791961448 +< 3 -3 0 >: -0.022457941936804567 -0.058369166791961448 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.008548132744733879 -0.028232475920630648 +< 0 1 -1 >: -0.010469281739087326 -0.034577580090478920 +< 1 -2 1 >: 0.007402900111861140 0.024450041358998600 +< 1 -1 0 >: 0.016553387880762306 0.054671954531402216 +< 1 0 -1 >: 0.013515784607412875 0.044639463947525992 +< 2 -3 1 >: -0.004274066372366940 -0.014116237960315327 +< 2 -2 0 >: -0.014805800223722285 -0.048900082717997222 +< 2 -1 -1 >: -0.016553387880762310 -0.054671954531402223 +< 3 -3 0 >: 0.011308116708266909 0.037348055090804015 +< 3 -2 -1 >: 0.019586232676636818 0.064688728981154034 +< 4 -3 -1 >: -0.022616233416533824 -0.074696110181608044 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.007289306139640483 -0.007904629611406767 +< 1 -1 0 >: 0.014578612279280961 0.015809259222813527 +< 2 -2 0 >: -0.014578612279280961 -0.015809259222813527 +< 3 -3 0 >: 0.014578612279280961 0.015809259222813527 +< 4 -4 0 >: -0.014578612279280964 -0.015809259222813531 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 1 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.000463362253131482 0.003461824263848675 +< 0 1 -1 >: -0.000253793958336532 -0.001896119239428635 +< 0 2 -2 >: -0.001076756573783626 -0.008044552632829601 +< 1 -3 2 >: 0.000900879183592549 0.006730555619237984 +< 1 -2 1 >: 0.000722310268259987 0.005396449960674569 +< 1 -1 0 >: -0.000787715830323520 -0.005885101248542747 +< 1 0 -1 >: -0.000253793958336532 -0.001896119239428635 +< 1 1 -2 >: 0.001135001086238469 0.008479703025615256 +< 2 -4 2 >: -0.000600586122395033 -0.004487037079491990 +< 2 -3 1 >: -0.001061696299580154 -0.007932035865860667 +< 2 -2 0 >: 0.000370689802505186 0.002769459411078941 +< 2 -1 -1 >: 0.000722310268259987 0.005396449960674569 +< 2 0 -2 >: -0.001076756573783626 -0.008044552632829601 +< 3 -4 1 >: 0.001123593750626647 0.008394477716604887 +< 3 -3 0 >: 0.000324353577192038 0.002423276984694071 +< 3 -2 -1 >: -0.001061696299580154 -0.007932035865860667 +< 3 -1 -2 >: 0.000900879183592549 0.006730555619237984 +< 4 -4 0 >: -0.001297414308768151 -0.009693107938776289 +< 4 -3 -1 >: 0.001123593750626647 0.008394477716604887 +< 4 -2 -2 >: -0.000600586122395033 -0.004487037079491990 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.413647545681683826 0.238747196297639130 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.063581753118858733 0.269039596844016404 +< 1 -1 >: -0.127163506237717439 -0.538079193688032698 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.058396305129791819 0.024828448464959414 +< 1 -1 >: 0.116792610259583651 -0.049656896929918835 +< 2 -2 >: -0.116792610259583679 0.049656896929918849 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.048098593790511880 -0.107268311593823662 +< 1 -1 >: 0.096197187581023760 0.214536623187647324 +< 2 -2 >: -0.096197187581023746 -0.214536623187647296 +< 3 -3 >: 0.096197187581023746 0.214536623187647296 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.006438111813368136 0.088509794079511608 +< 1 -1 >: 0.012876223626736268 -0.177019588159023161 +< 2 -2 >: -0.012876223626736268 0.177019588159023161 +< 3 -3 >: 0.012876223626736268 -0.177019588159023161 +< 4 -4 >: -0.012876223626736270 0.177019588159023189 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: -0.000227447483396139 0.006403781684337695 +< 1 -1 >: 0.000454894966792277 -0.012807563368675390 +< 2 -2 >: -0.000454894966792277 0.012807563368675393 +< 3 -3 >: 0.000454894966792277 -0.012807563368675395 +< 4 -4 >: -0.000454894966792277 0.012807563368675393 +< 5 -5 >: 0.000454894966792277 -0.012807563368675379 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 2 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.035159880175297135 0.014639776930199728 +< 1 -1 >: -0.070319760350594285 -0.029279553860399463 +< 2 -2 >: 0.070319760350594257 0.029279553860399449 +< 3 -3 >: -0.070319760350594285 -0.029279553860399463 +< 4 -4 >: 0.070319760350594243 0.029279553860399442 +< 5 -5 >: -0.070319760350594257 -0.029279553860399449 +< 6 -6 >: 0.070319760350594215 0.029279553860399432 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.070138423728544286 -0.319737878788430130 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.000590765241106720 -0.085531965435636362 +< 1 -1 0 >: 0.001181530482213440 0.171063930871272668 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.027886407609637495 -0.112140466967647984 +< 0 1 -1 >: -0.027886407609637488 -0.112140466967647956 +< 1 -1 0 >: 0.048300674820467508 0.194232986372465694 +< 1 0 -1 >: 0.048300674820467508 0.194232986372465694 +< 2 -1 -1 >: -0.068307469402877796 -0.274686923588169540 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.006880216419361051 0.051035192411418365 +< 1 -1 0 >: -0.013760432838722103 -0.102070384822836743 +< 2 -2 0 >: 0.013760432838722107 0.102070384822836771 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 2 2 2 ) +num_ms=10 +< 0 0 0 >: 0.023760388603510450 0.028420660306426281 +< 0 1 -1 >: -0.023760388603510450 -0.028420660306426281 +< 0 2 -2 >: -0.047520777207020928 -0.056841320612852589 +< 1 -2 1 >: 0.058200828168841180 0.069616115903716205 +< 1 -1 0 >: -0.023760388603510450 -0.028420660306426281 +< 1 0 -1 >: -0.023760388603510450 -0.028420660306426281 +< 1 1 -2 >: 0.058200828168841180 0.069616115903716205 +< 2 -2 0 >: -0.047520777207020901 -0.056841320612852561 +< 2 -1 -1 >: 0.058200828168841180 0.069616115903716205 +< 2 0 -2 >: -0.047520777207020928 -0.056841320612852589 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.011684804748145752 0.160894754917286553 +< 0 1 -1 >: 0.013492450333540329 0.185785260125388429 +< 1 -2 1 >: -0.007789869832097165 -0.107263169944857670 +< 1 -1 0 >: -0.022033079131345678 -0.303386059358295823 +< 1 0 -1 >: -0.019081206251338124 -0.262740034558337721 +< 2 -2 0 >: 0.017418678480444139 0.239847739478814159 +< 2 -1 -1 >: 0.024633731345660471 0.339195926075467780 +< 3 -2 -1 >: -0.030170036128835891 -0.415428470857849730 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.002531396175927053 -0.075445379988288888 +< 1 -1 0 >: -0.005062792351854106 0.150890759976577776 +< 2 -2 0 >: 0.005062792351854106 -0.150890759976577749 +< 3 -3 0 >: -0.005062792351854106 0.150890759976577749 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.002561394970747174 0.073816746797527227 +< 0 1 -1 >: -0.003415193294329566 0.098422329063369673 +< 0 2 -2 >: -0.000853798323582391 0.024605582265842415 +< 1 -2 1 >: 0.001909151090605589 -0.055019754572386934 +< 1 -1 0 >: 0.004676446013861709 -0.134770324475509656 +< 1 0 -1 >: 0.004676446013861709 -0.134770324475509684 +< 1 1 -2 >: 0.001909151090605589 -0.055019754572386934 +< 2 -2 0 >: -0.003306746688254412 0.095297010339344193 +< 2 -1 -1 >: -0.005399894729907620 0.155619366229417438 +< 2 0 -2 >: -0.003306746688254413 0.095297010339344221 +< 3 -2 -1 >: 0.005051139000990132 -0.145568587794344811 +< 3 -1 -2 >: 0.005051139000990132 -0.145568587794344784 +< 4 -2 -2 >: -0.007143389280631929 0.205865071114260945 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.003558911181816534 -0.020595979383847621 +< 0 1 -1 >: 0.004358758217667979 -0.025224820121654272 +< 1 -2 1 >: -0.003082107493265617 0.017836641362232609 +< 1 -1 0 >: -0.006891801868903397 0.039883942576236571 +< 1 0 -1 >: -0.005627132662390934 0.032565102747414906 +< 2 -3 1 >: 0.001779455590908267 -0.010297989691923812 +< 2 -2 0 >: 0.006164214986531237 -0.035673282724465231 +< 2 -1 -1 >: 0.006891801868903398 -0.039883942576236571 +< 3 -3 0 >: -0.004707996962626763 0.027245919728737057 +< 3 -2 -1 >: -0.008154489941149508 0.047191317269115844 +< 4 -3 -1 >: 0.009415993925253528 -0.054491839457474135 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.001312545864702657 0.036535945291993888 +< 0 1 -1 >: -0.000437515288234219 -0.012178648430664638 +< 0 2 -2 >: -0.003062607017639533 -0.085250539014652391 +< 0 3 -3 >: -0.001312545864702657 -0.036535945291993888 +< 1 -3 2 >: 0.002396369926192563 0.066705204653999067 +< 1 -2 1 >: 0.002474960217465626 0.068892839128078920 +< 1 -1 0 >: -0.001694489425042269 -0.047167702551279209 +< 1 0 -1 >: -0.001694489425042268 -0.047167702551279188 +< 1 1 -2 >: 0.002474960217465626 0.068892839128078906 +< 1 2 -3 >: 0.002396369926192564 0.066705204653999081 +< 2 -3 1 >: -0.003215067632521636 -0.089494423235626383 +< 2 -2 0 >: -0.000757798708309809 -0.021094037849430102 +< 2 -1 -1 >: 0.002767089643930401 0.077024535726670895 +< 2 0 -2 >: -0.000757798708309809 -0.021094037849430106 +< 2 1 -3 >: -0.003215067632521636 -0.089494423235626369 +< 3 -3 0 >: 0.003472669942369462 0.096665025157276985 +< 3 -2 -1 >: -0.001637032310048096 -0.045568329861519180 +< 3 -1 -2 >: -0.001637032310048096 -0.045568329861519180 +< 3 0 -3 >: 0.003472669942369463 0.096665025157276999 +< 4 -3 -1 >: -0.002835423134635149 -0.078926662536209280 +< 4 -2 -2 >: 0.003660515526631053 0.101893883191490439 +< 4 -1 -3 >: -0.002835423134635149 -0.078926662536209280 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.003194710869684784 -0.037484623508700396 +< 1 -1 0 >: 0.006389421739369566 0.074969247017400764 +< 2 -2 0 >: -0.006389421739369566 -0.074969247017400764 +< 3 -3 0 >: 0.006389421739369566 0.074969247017400764 +< 4 -4 0 >: -0.006389421739369567 -0.074969247017400778 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.002242735739163265 -0.002058808906315038 +< 0 1 -1 >: 0.001228396954862743 0.001127656079581287 +< 0 2 -2 >: 0.005211646900634105 0.004784239564308989 +< 1 -3 2 >: -0.004360376634170764 -0.004002782000820134 +< 1 -2 1 >: -0.003496079023363185 -0.003209365465931663 +< 1 -1 0 >: 0.003812650756577550 0.003499975140735564 +< 1 0 -1 >: 0.001228396954862743 0.001127656079581287 +< 1 1 -2 >: -0.005493558188853668 -0.005043031298369340 +< 2 -4 2 >: 0.002906917756113842 0.002668521333880089 +< 2 -3 1 >: 0.005138753144249200 0.004717323827318954 +< 2 -2 0 >: -0.001794188591330612 -0.001647047125052031 +< 2 -1 -1 >: -0.003496079023363185 -0.003209365465931663 +< 2 0 -2 >: 0.005211646900634105 0.004784239564308989 +< 3 -4 1 >: -0.005438345147453845 -0.004992346280338144 +< 3 -3 0 >: -0.001569915017414285 -0.001441166234420526 +< 3 -2 -1 >: 0.005138753144249200 0.004717323827318954 +< 3 -1 -2 >: -0.004360376634170764 -0.004002782000820134 +< 4 -4 0 >: 0.006279660069657141 0.005764664937682106 +< 4 -3 -1 >: -0.005438345147453845 -0.004992346280338144 +< 4 -2 -2 >: 0.002906917756113842 0.002668521333880089 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 1 ) +l=( 4 4 4 ) +num_ms=31 +< 0 0 0 >: -0.006574658982315992 -0.014087994203259398 +< 0 1 -1 >: 0.006574658982315990 0.014087994203259391 +< 0 2 -2 >: 0.008035694311719539 0.017218659581761473 +< 0 3 -3 >: -0.015340870958737306 -0.032871986474271912 +< 0 4 -4 >: -0.010227247305824874 -0.021914657649514613 +< 1 -4 3 >: 0.016170697840113619 0.034650116157649069 +< 1 -3 2 >: 0.006111949287329992 0.013096512893234338 +< 1 -2 1 >: -0.013860598148668817 -0.029700099563699203 +< 1 -1 0 >: 0.006574658982315990 0.014087994203259395 +< 1 0 -1 >: 0.006574658982315990 0.014087994203259391 +< 1 1 -2 >: -0.013860598148668813 -0.029700099563699196 +< 1 2 -3 >: 0.006111949287329992 0.013096512893234338 +< 1 3 -4 >: 0.016170697840113622 0.034650116157649069 +< 2 -4 2 >: -0.018335847861989975 -0.039289538679703008 +< 2 -3 1 >: 0.006111949287329991 0.013096512893234333 +< 2 -2 0 >: 0.008035694311719545 0.017218659581761487 +< 2 -1 -1 >: -0.013860598148668817 -0.029700099563699203 +< 2 0 -2 >: 0.008035694311719539 0.017218659581761473 +< 2 1 -3 >: 0.006111949287329992 0.013096512893234338 +< 2 2 -4 >: -0.018335847861989978 -0.039289538679703015 +< 3 -4 1 >: 0.016170697840113612 0.034650116157649048 +< 3 -3 0 >: -0.015340870958737311 -0.032871986474271919 +< 3 -2 -1 >: 0.006111949287329991 0.013096512893234333 +< 3 -1 -2 >: 0.006111949287329992 0.013096512893234338 +< 3 0 -3 >: -0.015340870958737306 -0.032871986474271912 +< 3 1 -4 >: 0.016170697840113622 0.034650116157649069 +< 4 -4 0 >: -0.010227247305824872 -0.021914657649514609 +< 4 -3 -1 >: 0.016170697840113612 0.034650116157649048 +< 4 -2 -2 >: -0.018335847861989975 -0.039289538679703008 +< 4 -1 -3 >: 0.016170697840113619 0.034650116157649069 +< 4 0 -4 >: -0.010227247305824874 -0.021914657649514613 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.028562625396167999 -0.040893223768209308 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.033474606026999379 0.003531046844184128 +< 1 -1 0 >: -0.066949212053998744 -0.007062093688368256 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.080183448364590931 -0.010055377451931887 +< 1 -1 0 >: -0.160366896729181890 0.020110754903863777 +< 2 -2 0 >: 0.160366896729181918 -0.020110754903863780 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.006927029626842822 -0.039188203779566347 +< 0 1 -1 >: -0.007998644839484427 -0.045250640002381062 +< 1 -2 1 >: 0.004618019751228546 0.026125469186377554 +< 1 -1 0 >: 0.013061732326988476 0.073893985693471081 +< 1 0 -1 >: 0.011311792012604446 0.063994068797429804 +< 2 -2 0 >: -0.010326206085183700 -0.058418325044816345 +< 2 -1 -1 >: -0.014603460693526370 -0.082615987569499116 +< 3 -2 -1 >: 0.017885513588965077 0.101183507070695317 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.007081306006930199 0.020682885014649426 +< 1 -1 0 >: 0.014162612013860399 -0.041365770029298851 +< 2 -2 0 >: -0.014162612013860397 0.041365770029298844 +< 3 -3 0 >: 0.014162612013860397 -0.041365770029298844 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000060535381768797 -0.005509987654540380 +< 0 1 -1 >: 0.000074140398359066 -0.006748329121329302 +< 1 -2 1 >: -0.000052425178439567 0.004771789283370605 +< 1 -1 0 >: -0.000117226262723429 0.010670045211921681 +< 1 0 -1 >: -0.000095714842708615 0.008712055433878303 +< 2 -3 1 >: 0.000030267690884398 -0.002754993827270191 +< 2 -2 0 >: 0.000104850356879135 -0.009543578566741213 +< 2 -1 -1 >: 0.000117226262723429 -0.010670045211921681 +< 3 -3 0 >: -0.000080080782840295 0.007289028530474959 +< 3 -2 -1 >: -0.000138703984589280 0.012624967752601744 +< 4 -3 -1 >: 0.000160161565680589 -0.014578057060949924 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.011913230655226979 0.067478759809899272 +< 1 -1 0 >: -0.023826461310453951 -0.134957519619798516 +< 2 -2 0 >: 0.023826461310453951 0.134957519619798516 +< 3 -3 0 >: -0.023826461310453951 -0.134957519619798516 +< 4 -4 0 >: 0.023826461310453954 0.134957519619798516 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.002407912466291439 0.009462982242613851 +< 0 1 -1 >: 0.001318867974285719 -0.005183088835550431 +< 0 2 -2 >: 0.005595482928643184 -0.021989983578659979 +< 1 -3 2 >: -0.004681516895549575 0.018398140244405548 +< 1 -2 1 >: -0.003753564058615729 0.014751329431796342 +< 1 -1 0 >: 0.004093451192695446 -0.016087069812443545 +< 1 0 -1 >: 0.001318867974285719 -0.005183088835550431 +< 1 1 -2 >: -0.005898156887700626 0.023179477939421989 +< 2 -4 2 >: 0.003121011263699716 -0.012265426829603699 +< 2 -3 1 >: 0.005517220571804162 -0.021682416213400474 +< 2 -2 0 >: -0.001926329973033152 0.007570385794091083 +< 2 -1 -1 >: -0.003753564058615729 0.014751329431796342 +< 2 0 -2 >: 0.005595482928643184 -0.021989983578659979 +< 3 -4 1 >: -0.005838877424513359 0.022946512449460981 +< 3 -3 0 >: -0.001685538726404007 0.006624087569829693 +< 3 -2 -1 >: 0.005517220571804162 -0.021682416213400474 +< 3 -1 -2 >: -0.004681516895549575 0.018398140244405548 +< 4 -4 0 >: 0.006742154905616029 -0.026496350279318782 +< 4 -3 -1 >: -0.005838877424513359 0.022946512449460981 +< 4 -2 -2 >: 0.003121011263699716 -0.012265426829603699 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.039944153566567428 0.078664696909813467 +< 1 -1 0 >: 0.079888307133134842 -0.157329393819626906 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.148212179996103782 0.052461354094730982 +< 1 -1 0 >: 0.296424359992207564 -0.104922708189461977 +< 2 -2 0 >: -0.296424359992207676 0.104922708189462005 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.029635440469442446 0.144935335828732109 +< 0 1 -1 >: -0.034220059065171435 0.167356910311614537 +< 1 -2 1 >: 0.019756960312961622 -0.096623557219154707 +< 1 -1 0 >: 0.055881122451714650 -0.273292690128122850 +< 1 0 -1 >: 0.048394471635173825 -0.236678412319542952 +< 2 -2 0 >: -0.044177906288547723 0.216056842169870533 +< 2 -1 -1 >: -0.062476994230511826 0.305550516440134146 +< 3 -2 -1 >: 0.076518378263781259 -0.374221427961105635 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.009189405473043527 -0.041296367239119176 +< 1 -1 0 >: -0.018378810946087055 0.082592734478238353 +< 2 -2 0 >: 0.018378810946087051 -0.082592734478238339 +< 3 -3 0 >: -0.018378810946087051 0.082592734478238339 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.004193920271992357 0.059533526155363545 +< 0 1 -1 >: -0.005136482344147857 0.072913380834638525 +< 1 -2 1 >: 0.003632041496991924 -0.051557546027410153 +< 1 -1 0 >: 0.008121491684374040 -0.115286177670363352 +< 1 0 -1 >: 0.006631170192324360 -0.094130769896077993 +< 2 -3 1 >: -0.002096960135996179 0.029766763077681776 +< 2 -2 0 >: -0.007264082993983850 0.103115092054820348 +< 2 -1 -1 >: -0.008121491684374042 0.115286177670363366 +< 3 -3 0 >: 0.005548035029062071 -0.078755452438925594 +< 3 -2 -1 >: 0.009609478552507383 -0.136408444997293432 +< 4 -3 -1 >: -0.011096070058124146 0.157510904877851243 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.016119704515829444 -0.040604277544866535 +< 1 -1 0 >: 0.032239409031658874 0.081208555089733042 +< 2 -2 0 >: -0.032239409031658874 -0.081208555089733042 +< 3 -3 0 >: 0.032239409031658874 0.081208555089733042 +< 4 -4 0 >: -0.032239409031658881 -0.081208555089733056 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.003883361704442617 -0.014763909030005193 +< 0 1 -1 >: -0.002127004804474931 0.008086526012688061 +< 0 2 -2 >: -0.009024117125163543 0.034308224278878849 +< 1 -3 2 >: 0.007550118073385938 -0.028704319835503804 +< 1 -2 1 >: 0.006053561798635698 -0.023014656502464544 +< 1 -1 0 >: -0.006601714897552447 0.025098645351008825 +< 1 0 -1 >: -0.002127004804474931 0.008086526012688061 +< 1 1 -2 >: 0.009512254662549190 -0.036164043732381669 +< 2 -4 2 >: -0.005033412048923958 0.019136213223669200 +< 2 -3 1 >: -0.008897899480750511 0.033828365341720429 +< 2 -2 0 >: 0.003106689363554094 -0.011811127224004157 +< 2 -1 -1 >: 0.006053561798635698 -0.023014656502464544 +< 2 0 -2 >: -0.009024117125163543 0.034308224278878849 +< 3 -4 1 >: 0.009416651686766643 -0.035800576781611526 +< 3 -3 0 >: 0.002718353193109830 -0.010334736321003631 +< 3 -2 -1 >: -0.008897899480750511 0.033828365341720429 +< 3 -1 -2 >: 0.007550118073385938 -0.028704319835503804 +< 4 -4 0 >: -0.010873412772439327 0.041338945284014536 +< 4 -3 -1 >: 0.009416651686766643 -0.035800576781611526 +< 4 -2 -2 >: -0.005033412048923958 0.019136213223669200 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.005072215053019308 -0.028852562164503000 +< 1 -1 0 >: -0.010144430106038615 0.057705124329005986 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.068168184874519477 -0.026661227943539156 +< 1 -1 0 >: -0.136336369749038955 0.053322455887078318 +< 2 -2 0 >: 0.136336369749039010 -0.053322455887078332 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.029434249958283192 -0.051268600876259576 +< 0 1 -1 >: 0.033987744273619051 -0.059199881033767873 +< 1 -2 1 >: -0.019622833305522121 0.034179067250839704 +< 1 -1 0 >: -0.055501753985711728 0.096673000910799251 +< 1 0 -1 >: -0.048065928906220558 0.083721274648828295 +< 2 -2 0 >: 0.043877989182294373 -0.076426717780414460 +< 2 -1 -1 >: 0.062052847391260650 -0.108083700812723088 +< 3 -2 -1 >: -0.075998906597691415 0.132374958251405522 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.004455294383807628 0.074176281212189638 +< 1 -1 0 >: 0.008910588767615257 -0.148352562424379275 +< 2 -2 0 >: -0.008910588767615255 0.148352562424379247 +< 3 -3 0 >: 0.008910588767615255 -0.148352562424379247 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.003065086686454744 -0.045447316415647733 +< 0 1 -1 >: 0.003753949199606088 -0.055661367698575340 +< 1 -2 1 >: -0.002654442935271277 0.039358530549780481 +< 1 -1 0 >: -0.005935514845660651 0.088008349803811337 +< 1 0 -1 >: -0.004846327577527679 0.071858516707903233 +< 2 -3 1 >: 0.001532543343227373 -0.022723658207823873 +< 2 -2 0 >: 0.005308885870542557 -0.078717061099560989 +< 2 -1 -1 >: 0.005935514845660652 -0.088008349803811337 +< 3 -3 0 >: -0.004054728559607131 0.060121148495533641 +< 3 -2 -1 >: -0.007022995876140124 0.104132883803657469 +< 4 -3 -1 >: 0.008109457119214264 -0.120242296991067324 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.006926660717943072 0.010593690588367720 +< 1 -1 0 >: -0.013853321435886141 -0.021187381176735434 +< 2 -2 0 >: 0.013853321435886141 0.021187381176735434 +< 3 -3 0 >: -0.013853321435886141 -0.021187381176735434 +< 4 -4 0 >: 0.013853321435886143 0.021187381176735437 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 2 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.000781000306832227 0.010512068342587475 +< 0 1 -1 >: -0.000427771485470467 -0.005757696957271104 +< 0 2 -2 >: -0.001814880709046459 -0.024427839375021299 +< 1 -3 2 >: 0.001518438142186993 0.020437796739675461 +< 1 -2 1 >: 0.001217458990944270 0.016386692815798080 +< 1 -1 0 >: -0.001327700521614786 -0.017870516182398703 +< 1 0 -1 >: -0.000427771485470467 -0.005757696957271104 +< 1 1 -2 >: 0.001913052240696055 0.025749203580603789 +< 2 -4 2 >: -0.001012292094791329 -0.013625197826450308 +< 2 -3 1 >: -0.001789496511921209 -0.024086174445228044 +< 2 -2 0 >: 0.000624800245465782 0.008409654674069981 +< 2 -1 -1 >: 0.001217458990944270 0.016386692815798080 +< 2 0 -2 >: -0.001814880709046459 -0.024427839375021299 +< 3 -4 1 >: 0.001893825097024421 0.025490411046797022 +< 3 -3 0 >: 0.000546700214782559 0.007358447839811230 +< 3 -2 -1 >: -0.001789496511921209 -0.024086174445228044 +< 3 -1 -2 >: 0.001518438142186993 0.020437796739675461 +< 4 -4 0 >: -0.002186800859130236 -0.029433791359244930 +< 4 -3 -1 >: 0.001893825097024421 0.025490411046797022 +< 4 -2 -2 >: -0.001012292094791329 -0.013625197826450308 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.176658714096489783 0.023879805557936042 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.002540801358050102 0.298466751975384748 +< 1 -1 >: 0.005081602716100203 -0.596933503950769384 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.059823661384663780 0.100956277395379490 +< 1 -1 >: -0.119647322769327574 -0.201912554790758980 +< 2 -2 >: 0.119647322769327602 0.201912554790759036 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.029432650864335195 0.244404832833674923 +< 1 -1 >: -0.058865301728670390 -0.488809665667349846 +< 2 -2 >: 0.058865301728670383 0.488809665667349735 +< 3 -3 >: -0.058865301728670383 -0.488809665667349735 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.001906339961232206 -0.025163049350088649 +< 1 -1 >: 0.003812679922464411 0.050326098700177277 +< 2 -2 >: -0.003812679922464411 -0.050326098700177277 +< 3 -3 >: 0.003812679922464411 0.050326098700177277 +< 4 -4 >: -0.003812679922464412 -0.050326098700177291 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000012471310214961 -0.000675022383739162 +< 1 -1 >: -0.000024942620429923 0.001350044767478325 +< 2 -2 >: 0.000024942620429923 -0.001350044767478325 +< 3 -3 >: -0.000024942620429923 0.001350044767478325 +< 4 -4 >: 0.000024942620429923 -0.001350044767478325 +< 5 -5 >: -0.000024942620429922 0.001350044767478324 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 3 3 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.007031432348500973 0.042736940015154629 +< 1 -1 >: 0.014062864697001949 -0.085473880030309271 +< 2 -2 >: -0.014062864697001944 0.085473880030309243 +< 3 -3 >: 0.014062864697001949 -0.085473880030309271 +< 4 -4 >: -0.014062864697001940 0.085473880030309229 +< 5 -5 >: 0.014062864697001944 -0.085473880030309243 +< 6 -6 >: -0.014062864697001935 0.085473880030309188 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.022494385424700006 0.030550572951718341 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.032256602544819685 0.141081987034832185 +< 1 -1 0 >: -0.064513205089639356 -0.282163974069664314 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.039490564642876563 -0.041364977212005966 +< 0 1 -1 >: -0.039490564642876563 -0.041364977212005959 +< 1 -1 0 >: 0.068399664381045319 0.071646242185123152 +< 1 0 -1 >: 0.068399664381045319 0.071646242185123152 +< 2 -1 -1 >: -0.096731733029442185 -0.101323087391268510 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.003686817274720872 -0.024299573471098207 +< 1 -1 0 >: -0.007373634549441745 0.048599146942196421 +< 2 -2 0 >: 0.007373634549441747 -0.048599146942196435 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.006364692275466469 -0.128720015722180114 +< 0 1 -1 >: -0.007349313597099392 -0.148633071454587040 +< 1 -2 1 >: 0.004243128183644311 0.085813343814786724 +< 1 -1 0 >: 0.012001378848394606 0.242716789310913533 +< 1 0 -1 >: 0.010393498963150958 0.210198905468246350 +< 2 -2 0 >: -0.009487923055873893 -0.191884470146424263 +< 2 -1 -1 >: -0.013417949464369239 -0.271365620089848436 +< 3 -2 -1 >: 0.016433564791077746 0.332353651477040213 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.000109883258596099 0.076222231585436256 +< 1 -1 0 >: 0.000219766517192198 -0.152444463170872513 +< 2 -2 0 >: -0.000219766517192198 0.152444463170872485 +< 3 -3 0 >: 0.000219766517192198 -0.152444463170872485 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.005775081143343545 -0.138028080587029867 +< 0 1 -1 >: 0.007700108191124730 -0.184037440782706563 +< 0 2 -2 >: 0.001925027047781182 -0.046009360195676634 +< 1 -2 1 >: -0.004304491337364459 0.102880056998805966 +< 1 -1 0 >: -0.010543807378773288 0.252003644355523970 +< 1 0 -1 >: -0.010543807378773288 0.252003644355523970 +< 1 1 -2 >: -0.004304491337364459 0.102880056998805966 +< 2 -2 0 >: 0.007455597697055345 -0.178193485807513957 +< 2 -1 -1 >: 0.012174940056836640 -0.290988743810856987 +< 2 0 -2 >: 0.007455597697055348 -0.178193485807514013 +< 3 -2 -1 >: -0.011388613599298195 0.272195045686990822 +< 3 -1 -2 >: -0.011388613599298193 0.272195045686990822 +< 4 -2 -2 >: 0.016105931808754172 -0.384941925221306547 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.004286442952834003 0.007171131761165309 +< 0 1 -1 >: -0.005249799022996065 0.008782806846560546 +< 1 -2 1 >: 0.003712168489027029 -0.006210382279054599 +< 1 -1 0 >: 0.008300661085397121 -0.013886836942226154 +< 1 0 -1 >: 0.006777461395666574 -0.011338554883228488 +< 2 -3 1 >: -0.002143221476417002 0.003585565880582655 +< 2 -2 0 >: -0.007424336978054061 0.012420764558109204 +< 2 -1 -1 >: -0.008300661085397121 0.013886836942226156 +< 3 -3 0 >: 0.005670431031132069 -0.009486515629460021 +< 3 -2 -1 >: 0.009821474646735925 -0.016431127057021010 +< 4 -3 -1 >: -0.011340862062264142 0.018973031258920046 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.001537531547045407 -0.050717661819310568 +< 0 1 -1 >: 0.000512510515681803 0.016905887273103538 +< 0 2 -2 >: 0.003587573609772615 0.118341210911724656 +< 0 3 -3 >: 0.001537531547045407 0.050717661819310568 +< 1 -3 2 >: -0.002807135703975282 -0.092597358141182987 +< 1 -2 1 >: -0.002899197288544134 -0.095634140262294831 +< 1 -1 0 >: 0.001984944691991796 0.065476219861589885 +< 1 0 -1 >: 0.001984944691991795 0.065476219861589857 +< 1 1 -2 >: -0.002899197288544134 -0.095634140262294817 +< 1 2 -3 >: -0.002807135703975283 -0.092597358141183000 +< 2 -3 1 >: 0.003766167753693276 0.124232392404347289 +< 2 -2 0 >: 0.000887694252574207 0.029281855704047351 +< 2 -1 -1 >: -0.003241401108683878 -0.106922219298120388 +< 2 0 -2 >: 0.000887694252574207 0.029281855704047354 +< 2 1 -3 >: 0.003766167753693275 0.124232392404347275 +< 3 -3 0 >: -0.004067926106398554 -0.134186320252571462 +< 3 -2 -1 >: 0.001917638756800137 0.063256037995375367 +< 3 -1 -2 >: 0.001917638756800137 0.063256037995375367 +< 3 0 -3 >: -0.004067926106398554 -0.134186320252571489 +< 4 -3 -1 >: 0.003321447757341056 0.109562671693497496 +< 4 -2 -2 >: -0.004287970616493293 -0.141444800944968807 +< 4 -1 -3 >: 0.003321447757341056 0.109562671693497496 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.000564000276867000 0.002960362759414127 +< 1 -1 0 >: -0.001128000553734000 -0.005920725518828251 +< 2 -2 0 >: 0.001128000553734000 0.005920725518828251 +< 3 -3 0 >: -0.001128000553734000 -0.005920725518828251 +< 4 -4 0 >: 0.001128000553734001 0.005920725518828253 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.001362998863120273 0.310650973639591432 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.056822075852102985 -0.025729572016269381 +< 1 -1 0 >: 0.113644151704205942 0.051459144032538755 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.039634463368203594 0.108310888568006566 +< 0 1 -1 >: 0.039634463368203587 0.108310888568006553 +< 1 -1 0 >: -0.068648904284456122 -0.187599962012718474 +< 1 0 -1 >: -0.068648904284456122 -0.187599962012718474 +< 2 -1 -1 >: 0.097084211481130306 0.265306410579063845 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.055685185220894801 -0.052456178200205983 +< 1 -1 0 >: 0.111370370441789615 0.104912356400411980 +< 2 -2 0 >: -0.111370370441789643 -0.104912356400412007 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.002405068117621055 0.014712202886592562 +< 0 1 -1 >: -0.002777133450255805 0.016988188593893203 +< 1 -2 1 >: 0.001603378745080703 -0.009808135257728371 +< 1 -1 0 >: 0.004535039933827769 -0.027741595806138396 +< 1 0 -1 >: 0.003927459789871746 -0.024024926709635686 +< 2 -2 0 >: -0.003585263867678760 0.021931657168793063 +< 2 -1 -1 >: -0.005070328786357519 0.031016047013424260 +< 3 -2 -1 >: 0.006209859177360511 -0.037986744510531772 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.002879204336403736 0.002628541220406434 +< 1 -1 0 >: -0.005758408672807473 -0.005257082440812869 +< 2 -2 0 >: 0.005758408672807472 0.005257082440812868 +< 3 -3 0 >: -0.005758408672807472 -0.005257082440812868 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.004629765197891853 -0.029385394315170330 +< 0 1 -1 >: 0.006173020263855807 -0.039180525753560451 +< 0 2 -2 >: 0.001543255065963951 -0.009795131438390111 +< 1 -2 1 >: -0.003450823234116317 0.021902579744785582 +< 1 -1 0 >: -0.008452756116125794 0.053650144425342883 +< 1 0 -1 >: -0.008452756116125794 0.053650144425342890 +< 1 1 -2 >: -0.003450823234116317 0.021902579744785582 +< 2 -2 0 >: 0.005977001169428610 -0.037936380934797592 +< 2 -1 -1 >: 0.009760402038078965 -0.061949850652068032 +< 2 0 -2 >: 0.005977001169428613 -0.037936380934797606 +< 3 -2 -1 >: -0.009130020095915401 0.057948779075463225 +< 3 -1 -2 >: -0.009130020095915400 0.057948779075463218 +< 4 -2 -2 >: 0.012911798244382463 -0.081951949291482293 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000341378894985666 0.029268900300513732 +< 0 1 -1 >: -0.000418102050835023 0.035846935534325934 +< 1 -2 1 >: 0.000295642795373447 -0.025347611201078885 +< 1 -1 0 >: 0.000661077387513088 -0.056678981712847486 +< 1 0 -1 >: 0.000539767426633070 -0.046278194779005064 +< 2 -3 1 >: -0.000170689447492833 0.014634450150256870 +< 2 -2 0 >: -0.000591285590746895 0.050695222402157784 +< 2 -1 -1 >: -0.000661077387513088 0.056678981712847493 +< 3 -3 0 >: 0.000451601829489054 -0.038719115671751500 +< 3 -2 -1 >: 0.000782197313466099 -0.067063475567609984 +< 4 -3 -1 >: -0.000903203658978108 0.077438231343503028 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.001192979420224080 -0.016137607842938776 +< 0 1 -1 >: -0.000397659806741360 0.005379202614312929 +< 0 2 -2 >: -0.002783618647189520 0.037654418300190479 +< 0 3 -3 >: -0.001192979420224080 0.016137607842938776 +< 1 -3 2 >: 0.002178072463653877 -0.029463106132499504 +< 1 -2 1 >: 0.002249503567617181 -0.030429365167656597 +< 1 -1 0 >: -0.001540129808965347 0.020833562141109364 +< 1 0 -1 >: -0.001540129808965347 0.020833562141109353 +< 1 1 -2 >: 0.002249503567617181 -0.030429365167656593 +< 1 2 -3 >: 0.002178072463653878 -0.029463106132499511 +< 2 -3 1 >: -0.002922190853190307 0.039528904884335907 +< 2 -2 0 >: -0.000688766989404056 0.009317052232197314 +< 2 -1 -1 >: 0.002515021446410155 -0.034021064513522215 +< 2 0 -2 >: -0.000688766989404056 0.009317052232197316 +< 2 1 -3 >: -0.002922190853190306 0.039528904884335900 +< 3 -3 0 >: 0.003156326865130934 -0.042696097107901489 +< 3 -2 -1 >: -0.001487906753316908 0.020127133196797656 +< 3 -1 -2 >: -0.001487906753316908 0.020127133196797653 +< 3 0 -3 >: 0.003156326865130935 -0.042696097107901496 +< 4 -3 -1 >: -0.002577130093669736 0.034861217307559735 +< 4 -2 -2 >: 0.003327060644597615 -0.045005638020232198 +< 4 -1 -3 >: -0.002577130093669736 0.034861217307559735 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.002558471978950402 0.027987985900305476 +< 1 -1 0 >: 0.005116943957900802 -0.055975971800610931 +< 2 -2 0 >: -0.005116943957900802 0.055975971800610931 +< 3 -3 0 >: 0.005116943957900802 -0.055975971800610931 +< 4 -4 0 >: -0.005116943957900803 0.055975971800610938 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.004553733633015689 -0.064790509961743667 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.097793834778726593 -0.108485198544140196 +< 1 -1 0 >: -0.195587669557453159 0.216970397088280337 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.032161344950737955 -0.112984298064465527 +< -1 0 1 >: 0.045483010213493089 0.159783926657971392 +< -1 1 0 >: -0.013129814095157363 -0.046125646534077594 +< 0 0 0 >: -0.013129814095157365 -0.046125646534077601 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.093210570847324675 0.043977683080320906 +< 1 -1 0 >: -0.186421141694649378 -0.087955366160641826 +< 2 -2 0 >: 0.186421141694649434 0.087955366160641840 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 2 2 2 ) +num_ms=5 +< -2 0 2 >: -0.029497321738384760 0.039844891202794913 +< -2 1 1 >: 0.024084462345916241 -0.032533217434519271 +< -1 -1 2 >: 0.012042231172958121 -0.016266608717259635 +< -1 0 1 >: -0.014748660869192376 0.019922445601397450 +< 0 0 0 >: 0.004916220289730791 -0.006640815200465815 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.012053716636300216 0.144055293275742763 +< -2 -1 3 >: 0.017046529544057974 -0.203724949482189194 +< -2 0 2 >: -0.011159573138849526 0.133369285993312298 +< -2 1 1 >: 0.006442982555756092 -0.077000793169867049 +< -2 2 0 >: -0.001440694697251595 0.017217900784922423 +< -1 -1 2 >: -0.009111753312483532 0.108895566014311593 +< -1 0 1 >: 0.015782019683255495 -0.188612653055758361 +< -1 1 0 >: -0.005762778789006382 0.068871603139689708 +< 0 0 0 >: -0.004322084091754785 0.051653702354767267 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: -0.004380200531294019 -0.041906832467186635 +< -2 0 2 >: 0.012389077994539682 0.118530421662385019 +< -2 1 1 >: -0.006785777484300248 -0.064921785695087261 +< -1 -2 3 >: 0.006925705143584370 0.066260520059701594 +< -1 -1 2 >: -0.005364628136369064 -0.051325178140453370 +< -1 0 1 >: 0.003917770457221650 0.037482610447329825 +< 0 -3 3 >: -0.006925705143584369 -0.066260520059701594 +< 0 -1 1 >: 0.004155423086150621 0.039756312035820945 +< 0 0 0 >: -0.002770282057433748 -0.026504208023880638 +< 1 -3 2 >: 0.006925705143584370 0.066260520059701594 +< 1 -2 1 >: -0.005364628136369064 -0.051325178140453370 +< 2 -3 1 >: -0.004380200531294019 -0.041906832467186635 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: 0.000809802232324886 0.001889120792213550 +< -2 -1 3 >: -0.001214703348487329 -0.002833681188320325 +< -2 0 2 >: 0.002903696387932681 0.006773793652026266 +< -2 1 1 >: -0.001530382369911856 -0.003570102723398841 +< -1 -3 4 >: -0.001515001252202218 -0.003534221383347035 +< -1 -2 3 >: 0.001431541624742326 0.003339525306636759 +< -1 -1 2 >: -0.000973929376415711 -0.002271999460723093 +< -1 0 1 >: 0.000684407802138027 0.001596598475235387 +< 0 -4 4 >: 0.001749372761563141 0.004080967334102282 +< 0 -3 3 >: -0.000437343190390785 -0.001020241833525570 +< 0 -2 2 >: -0.000499820789018040 -0.001165990666886367 +< 0 -1 1 >: 0.001062119176663335 0.002477730167133528 +< 0 0 0 >: -0.000624775986272550 -0.001457488333607958 +< 1 -4 3 >: -0.001515001252202218 -0.003534221383347035 +< 1 -3 2 >: 0.001431541624742326 0.003339525306636759 +< 1 -2 1 >: -0.000973929376415711 -0.002271999460723093 +< 2 -4 2 >: 0.000809802232324886 0.001889120792213550 +< 2 -3 1 >: -0.001214703348487329 -0.002833681188320325 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.035701527119409944 -0.053420162550066437 +< 0 1 -1 >: 0.041224572585744086 -0.061684290456868816 +< 1 -2 1 >: -0.023801018079606620 0.035613441700044275 +< 1 -1 0 >: -0.067319445132933850 0.100730024509972343 +< 1 0 -1 >: -0.058300349653793382 0.087234760149465171 +< 2 -2 0 >: 0.053220694359701913 -0.079634076554024699 +< 2 -1 -1 >: 0.075265427762403719 -0.112619591089759025 +< 3 -2 -1 >: -0.092180946645098072 0.137930266605400254 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.003482305721539481 0.020452352358404691 +< 1 -1 0 >: 0.006964611443078962 -0.040904704716809383 +< 2 -2 0 >: -0.006964611443078961 0.040904704716809376 +< 3 -3 0 >: 0.006964611443078961 -0.040904704716809376 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: 0.004382834526596494 -0.117676364726824578 +< -3 0 3 >: -0.005367854108607040 0.144123524183184498 +< -3 1 2 >: 0.004969667226395071 -0.133432455538847611 +< -3 2 1 >: -0.003704171247924070 0.099454680329860490 +< -3 3 0 >: 0.001014429074675037 -0.027236785933064969 +< -2 -2 4 >: -0.002829107521781848 0.075959766804870224 +< -2 -1 3 >: 0.002530430693744072 -0.067940480852288751 +< -2 0 2 >: 0.001171361798674831 -0.031450331380630539 +< -2 1 1 >: -0.003825651614589406 0.102716352165315231 +< -2 2 0 >: 0.002367001174241754 -0.063552500510484930 +< -1 -1 2 >: -0.002138604267113434 0.057420186460613150 +< -1 0 1 >: 0.002619244608083346 -0.070325078881984707 +< -1 1 0 >: 0.000338143024891679 -0.009078928644354996 +< 0 0 0 >: -0.001014429074675037 0.027236785933064969 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.007723239197808061 -0.134033210982121453 +< 0 1 -1 >: 0.009458997598045913 -0.164156487746500074 +< 1 -2 1 >: -0.006688521344805530 0.116076165661316608 +< 1 -1 0 >: -0.014955988395943478 0.259554196986230779 +< 1 0 -1 >: -0.012211513389682590 0.211925114404698856 +< 2 -3 1 >: 0.003861619598904031 -0.067016605491060754 +< 2 -2 0 >: 0.013377042689611065 -0.232152331322633299 +< 2 -1 -1 >: 0.014955988395943479 -0.259554196986230834 +< 3 -3 0 >: -0.010216885116633056 0.177309271841072369 +< 3 -2 -1 >: -0.017696164117102734 0.307108667481779118 +< 4 -3 -1 >: 0.020433770233266119 -0.354618543682144849 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.003908715996914536 -0.054969785859003528 +< 1 -1 0 >: -0.007817431993829071 0.109939571718007015 +< 2 -2 0 >: 0.007817431993829071 -0.109939571718007015 +< 3 -3 0 >: -0.007817431993829071 0.109939571718007015 +< 4 -4 0 >: 0.007817431993829071 -0.109939571718007029 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 3 ) +l=( 4 4 4 ) +num_ms=13 +< -4 0 4 >: 0.000775532495355726 -0.009285757436870396 +< -4 1 3 >: -0.001634966056532032 0.019576095533571761 +< -4 2 2 >: 0.000926938625917656 -0.011098602947887106 +< -3 -1 4 >: -0.000817483028266016 0.009788047766785877 +< -3 0 3 >: 0.001163298743033588 -0.013928636155305596 +< -3 1 2 >: -0.000617959083945104 0.007399068631924736 +< -2 -2 4 >: 0.000463469312958828 -0.005549301473943552 +< -2 -1 3 >: -0.000308979541972552 0.003699534315962368 +< -2 0 2 >: -0.000609346960636641 0.007295952271826740 +< -2 1 1 >: 0.000700699738513728 -0.008389755228673614 +< -1 -1 2 >: 0.000350349869256864 -0.004194877614336807 +< -1 0 1 >: -0.000498556604157252 0.005969415495130970 +< 0 0 0 >: 0.000166185534719084 -0.001989805165043657 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.066664158356713826 -0.065458414025154135 +< 1 -1 0 >: 0.133328316713427625 0.130916828050308243 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: 0.043462810338660528 0.002981869019847740 +< -1 0 1 >: -0.061465695839783299 -0.004216999609088842 +< -1 1 0 >: 0.017743618019513272 0.001217342929739994 +< 0 0 0 >: 0.017743618019513272 0.001217342929739995 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.044287821139775037 -0.044567938890902138 +< 1 -1 0 >: 0.088575642279550088 0.089135877781804290 +< 2 -2 0 >: -0.088575642279550101 -0.089135877781804304 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 2 2 2 ) +num_ms=7 +< -2 0 2 >: 0.106016957408160653 0.033269414514770987 +< -2 1 1 >: -0.129843724866185284 -0.040746544801166656 +< -2 2 0 >: 0.053008478704080340 0.016634707257385500 +< -1 -1 2 >: -0.064921862433092642 -0.020373272400583328 +< -1 0 1 >: 0.053008478704080313 0.016634707257385490 +< -1 1 0 >: 0.026504239352040156 0.008317353628692745 +< 0 0 0 >: -0.026504239352040156 -0.008317353628692745 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.045985631644394974 0.036820920571881154 +< -2 -1 3 >: 0.065033503945796753 -0.052072645251816839 +< -2 0 2 >: -0.042574422077117542 0.034089548357576195 +< -2 1 1 >: 0.024580354046816563 -0.019681609920799384 +< -2 2 0 >: -0.005496334255969388 0.004400941768954168 +< -1 -1 2 >: -0.034761870060940378 0.027833999679331350 +< -1 0 1 >: 0.060209325111656158 -0.048209901622457731 +< -1 1 0 >: -0.021985337023877557 0.017603767075816675 +< 0 0 0 >: -0.016489002767908163 0.013202825306862500 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 2 3 3 ) +num_ms=14 +< -2 -1 3 >: -0.009379752710374514 0.102811600243705448 +< -2 0 2 >: 0.013264973494717440 -0.145397559433929291 +< -2 1 1 >: -0.014531050415529753 0.159275046216322297 +< -2 2 0 >: 0.013264973494717440 -0.145397559433929291 +< -1 -2 3 >: 0.014830691226960565 -0.162559413328415808 +< -1 -1 2 >: -0.011487804026952545 0.125917980118040507 +< -1 0 1 >: 0.004194752934507063 -0.045978745404091879 +< -1 1 0 >: 0.004194752934507063 -0.045978745404091879 +< 0 -3 3 >: -0.014830691226960563 0.162559413328415781 +< 0 -1 1 >: 0.008898414736176335 -0.097535647997049446 +< 0 0 0 >: -0.005932276490784225 0.065023765331366321 +< 1 -3 2 >: 0.014830691226960565 -0.162559413328415808 +< 1 -2 1 >: -0.011487804026952545 0.125917980118040507 +< 2 -3 1 >: -0.009379752710374514 0.102811600243705448 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.029546446403111212 -0.003892591581908146 +< 0 1 -1 >: -0.034117297568866202 -0.004494777595319877 +< 1 -2 1 >: 0.019697630935407467 0.002595061054605430 +< 1 -1 0 >: 0.055713313630946164 0.007339941077218454 +< 1 0 -1 >: 0.048249144933409205 0.006356575435152097 +< 2 -2 0 >: -0.044045241767273875 -0.005802732923860036 +< 2 -1 -1 >: -0.062289378265280616 -0.008206303599751746 +< 3 -2 -1 >: 0.076288596572573142 0.010050628246878286 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.001030179959723282 -0.043275519382215084 +< 1 -1 0 >: -0.002060359919446563 0.086551038764430169 +< 2 -2 0 >: 0.002060359919446563 -0.086551038764430155 +< 3 -3 0 >: -0.002060359919446563 0.086551038764430155 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 3 3 2 ) +num_ms=12 +< -3 1 2 >: 0.008917378502174089 -0.073728040405108039 +< -3 2 1 >: -0.014099613412345441 0.116574267550532379 +< -3 3 0 >: 0.014099613412345439 -0.116574267550532365 +< -2 1 1 >: 0.010921513586795328 -0.090298039363907942 +< -2 3 -1 >: -0.014099613412345441 0.116574267550532379 +< -1 1 0 >: -0.008459768047407262 0.069944560530319402 +< -1 2 -1 >: 0.010921513586795328 -0.090298039363907942 +< -1 3 -2 >: 0.008917378502174089 -0.073728040405108039 +< 0 0 0 >: 0.005639845364938176 -0.046629707020212949 +< 0 1 -1 >: -0.007975945804782610 0.065944364077469092 +< 0 2 -2 >: -0.025222155237177756 0.208534389336190729 +< 1 1 -2 >: 0.013814743372299319 -0.114218989054996417 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: -0.001068781669214567 0.066023814167766440 +< -3 0 3 >: 0.001308984868007883 -0.080862327791683272 +< -3 1 2 >: -0.001211884501099818 0.074863968383936982 +< -3 2 1 >: 0.000903285375112537 -0.055800307457292704 +< -3 3 0 >: -0.000247374887906826 0.015281543555041478 +< -2 -2 4 >: 0.000689895600933297 -0.042618188787475440 +< -2 -1 3 >: -0.000617061384425968 0.038118866882685780 +< -2 0 2 >: -0.000285643916247519 0.017645606570272372 +< -2 1 1 >: 0.000932909123915620 -0.057630309732092856 +< -2 2 0 >: -0.000577208071782594 0.035656934961763448 +< -1 -1 2 >: 0.000521512054476276 -0.032216322531331831 +< -1 0 1 >: -0.000638719214088709 0.039456775795345955 +< -1 1 0 >: -0.000082458295968942 0.005093847851680496 +< 0 0 0 >: 0.000247374887906826 -0.015281543555041478 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.005641052905865435 0.092111697634158968 +< 0 1 -1 >: -0.006908850615707313 0.112813329272608967 +< 1 -2 1 >: 0.004885295120571495 -0.079771070136892649 +< 1 -1 0 >: 0.010923851979745896 -0.178373535463995453 +< 1 0 -1 >: 0.008919287792023091 -0.145641381834342720 +< 2 -3 1 >: -0.002820526452932718 0.046055848817079498 +< 2 -2 0 >: -0.009770590241142994 0.159542140273785354 +< 2 -1 -1 >: -0.010923851979745896 0.178373535463995453 +< 3 -3 0 >: 0.007462411560739097 -0.121852322389980630 +< 3 -2 -1 >: 0.012925275970189483 -0.211054413399709206 +< 4 -3 -1 >: -0.014924823121478199 0.243704644779961344 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.001879958236216916 0.030209742754573738 +< 1 -1 0 >: 0.003759916472433831 -0.060419485509147455 +< 2 -2 0 >: -0.003759916472433831 0.060419485509147455 +< 3 -3 0 >: 0.003759916472433831 -0.060419485509147455 +< 4 -4 0 >: -0.003759916472433832 0.060419485509147469 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 4 4 2 ) +num_ms=18 +< -4 2 2 >: 0.000165183908643678 0.008762327111258185 +< -4 3 1 >: -0.000309030795976405 -0.016392812980584381 +< -4 4 0 >: 0.000356838026489723 0.018928789974231159 +< -3 1 2 >: -0.000247775862965517 -0.013143490666887279 +< -3 2 1 >: 0.000292006654862109 0.015489752298363482 +< -3 3 0 >: -0.000089209506622431 -0.004732197493557788 +< -3 4 -1 >: -0.000309030795976405 -0.016392812980584381 +< -2 1 1 >: -0.000198662654556260 -0.010538236916089957 +< -2 2 0 >: -0.000101953721854207 -0.005408225706923190 +< -2 3 -1 >: 0.000292006654862109 0.015489752298363482 +< -2 4 -2 >: 0.000165183908643678 0.008762327111258185 +< -1 1 0 >: 0.000216651658940189 0.011492479627211774 +< -1 2 -1 >: -0.000198662654556260 -0.010538236916089957 +< -1 3 -2 >: -0.000247775862965517 -0.013143490666887279 +< 0 0 0 >: -0.000127442152317758 -0.006760282133653986 +< 0 1 -1 >: 0.000139605883202891 0.007405518039402884 +< 0 2 -2 >: 0.000592297600237808 0.031418952143166520 +< 1 1 -2 >: -0.000312168244900560 -0.016559241744705820 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 3 4 ) +l=( 4 4 4 ) +num_ms=19 +< -4 0 4 >: -0.000195030428604774 0.001789977071893170 +< -4 1 3 >: 0.000308370183714971 -0.002830202253330689 +< -4 2 2 >: -0.000349658921938763 0.003209147709568985 +< -4 3 1 >: 0.000308370183714971 -0.002830202253330690 +< -4 4 0 >: -0.000097515214302387 0.000894988535946585 +< -3 -1 4 >: 0.000308370183714971 -0.002830202253330689 +< -3 0 3 >: -0.000292545642907161 0.002684965607839755 +< -3 1 2 >: 0.000116552973979588 -0.001069715903189661 +< -3 2 1 >: 0.000116552973979588 -0.001069715903189661 +< -3 3 0 >: -0.000146272821453581 0.001342482803919877 +< -2 -2 4 >: -0.000174829460969381 0.001604573854784492 +< -2 -1 3 >: 0.000116552973979588 -0.001069715903189661 +< -2 0 2 >: 0.000153238193903751 -0.001406410556487491 +< -2 1 1 >: -0.000264317300327118 0.002425887645712020 +< -2 2 0 >: 0.000076619096951876 -0.000703205278243745 +< -1 -1 2 >: -0.000132158650163559 0.001212943822856010 +< -1 0 1 >: 0.000125376704103069 -0.001150699546217038 +< -1 1 0 >: 0.000062688352051535 -0.000575349773108519 +< 0 0 0 >: -0.000062688352051535 0.000575349773108519 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.047525227733783315 0.060775651937650811 +< 0 1 -1 >: 0.047525227733783308 0.060775651937650797 +< 1 -1 0 >: -0.082316109076194202 -0.105266517019133088 +< 1 0 -1 >: -0.082316109076194202 -0.105266517019133088 +< 2 -1 -1 >: 0.116412557857336854 0.148869336032236232 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.021861474116540425 -0.014568241311156417 +< 0 1 -1 >: 0.025243455932133292 -0.016821956085231161 +< 1 -2 1 >: -0.014574316077693612 0.009712160874104274 +< 1 -1 0 >: -0.041222390918773125 0.027470139256215206 +< 1 0 -1 >: -0.035699637740390464 0.023789838441378525 +< 2 -2 0 >: 0.032589161475291034 -0.021717051922910940 +< 2 -1 -1 >: 0.046088034144723358 -0.030712549364141351 +< 3 -2 -1 >: -0.056446083451270369 0.037615037321093128 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.006240588588765760 -0.068885280705849511 +< 0 1 -1 >: -0.008320784785021016 -0.091847040941132718 +< 0 2 -2 >: -0.002080196196255254 -0.022961760235283176 +< 1 -2 1 >: 0.004651460101363241 0.051344056769144740 +< 1 -1 0 >: 0.011393703807254461 0.125766740408897265 +< 1 0 -1 >: 0.011393703807254463 0.125766740408897265 +< 1 1 -2 >: 0.004651460101363241 0.051344056769144740 +< 2 -2 0 >: -0.008056565224940611 -0.088930514990859411 +< 2 -1 -1 >: -0.013156315920370455 -0.145222922860357234 +< 2 0 -2 >: -0.008056565224940615 -0.088930514990859438 +< 3 -2 -1 >: 0.012306606661546433 0.135843605512339538 +< 3 -1 -2 >: 0.012306606661546432 0.135843605512339510 +< 4 -2 -2 >: -0.017404170047550040 -0.192111869277211050 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.003062949483190131 -0.030827964827846322 +< 0 1 -1 >: -0.003751331670868632 -0.037756391818345079 +< 1 -2 1 >: 0.002652592062951071 0.026697800687888084 +< 1 -1 0 >: 0.005931376169334998 0.059698097187858415 +< 1 0 -1 >: 0.004842948362458217 0.048743292241777474 +< 2 -3 1 >: -0.001531474741595066 -0.015413982413923165 +< 2 -2 0 >: -0.005305184125902145 -0.053395601375776189 +< 2 -1 -1 >: -0.005931376169334998 -0.059698097187858422 +< 3 -3 0 >: 0.004051901305437450 0.040781564180363744 +< 3 -2 -1 >: 0.007018098928272326 0.070635741172521055 +< 4 -3 -1 >: -0.008103802610874903 -0.081563128360727516 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000836442954682002 0.008642052578707270 +< 0 1 -1 >: -0.000278814318227334 -0.002880684192902426 +< 0 2 -2 >: -0.001951700227591339 -0.020164789350316965 +< 0 3 -3 >: -0.000836442954682002 -0.008642052578707270 +< 1 -3 2 >: 0.001527128914485346 0.015778157135012204 +< 1 -2 1 >: 0.001577211960883616 0.016295610618065604 +< 1 -1 0 >: -0.001079843211178640 -0.011156841904794044 +< 1 0 -1 >: -0.001079843211178640 -0.011156841904794039 +< 1 1 -2 >: 0.001577211960883616 0.016295610618065604 +< 1 2 -3 >: 0.001527128914485347 0.015778157135012207 +< 2 -3 1 >: -0.002048858437916820 -0.021168619148136378 +< 2 -2 0 >: -0.000482920565047420 -0.004989491382667540 +< 2 -1 -1 >: 0.001763376579730752 0.018219046538431028 +< 2 0 -2 >: -0.000482920565047420 -0.004989491382667541 +< 2 1 -3 >: -0.002048858437916819 -0.021168619148136378 +< 3 -3 0 >: 0.002213020043980647 0.022864721940403888 +< 3 -2 -1 >: -0.001043227653333645 -0.010778533289336286 +< 3 -1 -2 >: -0.001043227653333645 -0.010778533289336284 +< 3 0 -3 >: 0.002213020043980648 0.022864721940403891 +< 4 -3 -1 >: -0.001806923299434725 -0.018668967288202939 +< 4 -2 -2 >: 0.002332727948861615 0.024101533132700335 +< 4 -1 -3 >: -0.001806923299434725 -0.018668967288202939 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.029237905706183832 -0.128485553661727453 +< 0 1 -1 >: -0.029237905706183828 -0.128485553661727425 +< 1 -1 0 >: 0.050641538190018397 0.222543506980729361 +< 1 0 -1 >: 0.050641538190018397 0.222543506980729361 +< 2 -1 -1 >: -0.071617950127759039 -0.314724045790218954 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.005655341211660518 0.076721839767011066 +< 0 1 -1 >: -0.006530225541822766 0.088590749684414313 +< 1 -2 1 >: 0.003770227474440344 -0.051147893178007359 +< 1 -1 0 >: 0.010663813655170397 -0.144668088438296677 +< 1 0 -1 >: 0.009235133526600950 -0.125286239704498703 +< 2 -2 0 >: -0.008430484923485962 0.114370166051922240 +< 2 -1 -1 >: -0.011922506116175751 0.161743839961491359 +< 3 -2 -1 >: 0.014602028219921103 -0.198094938472018478 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.003688550512002725 0.059394131097942435 +< 0 1 -1 >: 0.004918067349336969 0.079192174797256612 +< 0 2 -2 >: 0.001229516837334242 0.019798043699314150 +< 1 -2 1 >: -0.002749283227759917 -0.044269771533177842 +< 1 -1 0 >: -0.006734341066403744 -0.108438351285873855 +< 1 0 -1 >: -0.006734341066403745 -0.108438351285873869 +< 1 1 -2 >: -0.002749283227759917 -0.044269771533177842 +< 2 -2 0 >: 0.004761898234877131 0.076677493534930349 +< 2 -1 -1 >: 0.007776147255005907 0.125213822610756947 +< 2 0 -2 >: 0.004761898234877133 0.076677493534930377 +< 3 -2 -1 >: -0.007273919704333691 -0.117126806074435222 +< 3 -1 -2 >: -0.007273919704333691 -0.117126806074435208 +< 4 -2 -2 >: 0.010286875897481597 0.165642317667909655 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.001338310405543282 0.013816890326506145 +< 0 1 -1 >: 0.001639088805519132 0.016922165565968459 +< 1 -2 1 >: -0.001159010809349536 -0.011965778024057789 +< 1 -1 0 >: -0.002591626956362612 -0.026756293065466334 +< 1 0 -1 >: -0.002116054548910202 -0.021846421806253478 +< 2 -3 1 >: 0.000669155202771641 0.006908445163253073 +< 2 -2 0 >: 0.002318021618699074 0.023931556048115588 +< 2 -1 -1 >: 0.002591626956362613 0.026756293065466334 +< 3 -3 0 >: -0.001770418255038761 -0.018278027848094645 +< 3 -2 -1 >: -0.003066454368374569 -0.031658472895058770 +< 4 -3 -1 >: 0.003540836510077523 0.036556055696189305 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000290279039957704 0.008903859516862032 +< 0 1 -1 >: 0.000096759679985902 -0.002967953172287346 +< 0 2 -2 >: 0.000677317759901310 -0.020775672206011408 +< 0 3 -3 >: 0.000290279039957704 -0.008903859516862032 +< 1 -3 2 >: -0.000529974593852594 0.016256149020807947 +< 1 -2 1 >: -0.000547355406907770 0.016789278514948054 +< 1 -1 0 >: 0.000374748629169756 -0.011494833208592358 +< 1 0 -1 >: 0.000374748629169756 -0.011494833208592353 +< 1 1 -2 >: -0.000547355406907770 0.016789278514948051 +< 1 2 -3 >: -0.000529974593852594 0.016256149020807950 +< 2 -3 1 >: 0.000711035530921346 -0.021809912557735935 +< 2 -2 0 >: 0.000167592681859687 -0.005140645688886903 +< 2 -1 -1 >: -0.000611961948848916 0.018770984026300282 +< 2 0 -2 >: 0.000167592681859687 -0.005140645688886904 +< 2 1 -3 >: 0.000711035530921345 -0.021809912557735931 +< 3 -3 0 >: -0.000768006150542667 0.023557397990272653 +< 3 -2 -1 >: 0.000362041571361131 -0.011105063910688094 +< 3 -1 -2 >: 0.000362041571361131 -0.011105063910688093 +< 3 0 -3 >: -0.000768006150542667 0.023557397990272656 +< 4 -3 -1 >: 0.000627074396049552 -0.019234534914611308 +< 4 -2 -2 >: -0.000809549564244330 0.024831677798778224 +< 4 -1 -3 >: 0.000627074396049552 -0.019234534914611308 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 3 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.012791305455401133 -0.031734570064752096 +< 0 1 -1 >: -0.012791305455401131 -0.031734570064752096 +< 1 -1 0 >: 0.022155190943887720 0.054965887708504996 +< 1 0 -1 >: 0.022155190943887720 0.054965887708504996 +< 2 -1 -1 >: -0.031332171509811581 -0.077733503865244358 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.027599415306187654 -0.092072968743109149 +< 0 1 -1 >: -0.031869059713007422 -0.106316706577844075 +< 1 -2 1 >: 0.018399610204125096 0.061381979162072740 +< 1 -1 0 >: 0.052041956586104221 0.173614454832612009 +< 1 0 -1 >: 0.045069656466213116 0.150354528349227939 +< 2 -2 0 >: -0.041142779175922503 -0.137254277999870250 +< 2 -1 -1 >: -0.058184676304310949 -0.194106861441143613 +< 3 -2 -1 >: 0.071261383897284550 0.237731383051958428 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 3 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.003208876008607552 -0.015865073805428828 +< 0 1 -1 >: -0.004278501344810070 -0.021153431740571781 +< 0 2 -2 >: -0.001069625336202517 -0.005288357935142944 +< 1 -2 1 >: 0.002391754962204895 0.011825127832330046 +< 1 -1 0 >: 0.005858579247171660 0.028965529332392329 +< 1 0 -1 >: 0.005858579247171660 0.028965529332392333 +< 1 1 -2 >: 0.002391754962204895 0.011825127832330046 +< 2 -2 0 >: -0.004142641113793858 -0.020481722211592460 +< 2 -1 -1 >: -0.006764904610846626 -0.033446512314553430 +< 2 0 -2 >: -0.004142641113793859 -0.020481722211592467 +< 3 -2 -1 >: 0.006327988826998846 0.031286347465893614 +< 3 -1 -2 >: 0.006327988826998845 0.031286347465893614 +< 4 -2 -2 >: -0.008949127621687177 -0.044245576903383849 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000311875931422909 0.030493197373766243 +< 0 1 -1 >: 0.000381968447520683 0.037346387095851676 +< 1 -2 1 >: -0.000270092479441173 -0.026407883568294495 +< 1 -1 0 >: -0.000603945144241926 -0.059049822800606208 +< 1 0 -1 >: -0.000493119145341435 -0.048213978421083034 +< 2 -3 1 >: 0.000155937965711454 0.015246598686883125 +< 2 -2 0 >: 0.000540184958882345 0.052815767136589011 +< 2 -1 -1 >: 0.000603945144241926 0.059049822800606215 +< 3 -3 0 >: -0.000412573077225826 -0.040338708465096684 +< 3 -2 -1 >: -0.000714597531590169 -0.069868692573256244 +< 4 -3 -1 >: 0.000825146154451652 0.080677416930193396 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 3 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000434757122193576 -0.025981169198161836 +< 0 1 -1 >: -0.000144919040731192 0.008660389732720618 +< 0 2 -2 >: -0.001014433285118343 0.060622728129044283 +< 0 3 -3 >: -0.000434757122193576 0.025981169198161836 +< 1 -3 2 >: 0.000793754276204838 -0.047434908133972144 +< 1 -2 1 >: 0.000819785891392602 -0.048990562461800780 +< 1 -1 0 >: -0.000561269031300261 0.033541545206492641 +< 1 0 -1 >: -0.000561269031300261 0.033541545206492628 +< 1 1 -2 >: 0.000819785891392602 -0.048990562461800773 +< 1 2 -3 >: 0.000793754276204838 -0.047434908133972151 +< 2 -3 1 >: -0.001064933111415097 0.063640607456411674 +< 2 -2 0 >: -0.000251007141530568 0.015000235030419943 +< 2 -1 -1 >: 0.000916548490074559 -0.054773113960267988 +< 2 0 -2 >: -0.000251007141530568 0.015000235030419945 +< 2 1 -3 >: -0.001064933111415097 0.063640607456411660 +< 3 -3 0 >: 0.001150259226038322 -0.068739712469027631 +< 3 -2 -1 >: -0.000542237399236058 0.032404211215775282 +< 3 -1 -2 >: -0.000542237399236058 0.032404211215775275 +< 3 0 -3 >: 0.001150259226038322 -0.068739712469027645 +< 4 -3 -1 >: -0.000939182725240862 0.056125740204916043 +< 4 -2 -2 >: 0.001212479684634518 -0.072458019035734608 +< 4 -1 -3 >: -0.000939182725240862 0.056125740204916043 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 2 1 1 ) +num_ms=4 +< 0 -1 1 >: 0.017006555442343647 0.051682027384418273 +< 0 0 0 >: 0.017006555442343651 0.051682027384418280 +< 1 -1 0 >: -0.058912436175752418 -0.179031794535957051 +< 2 -1 -1 >: 0.041657383116094210 0.126594595964371892 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 2 2 2 ) +num_ms=8 +< -2 0 2 >: -0.073419485635343396 -0.030314404211117290 +< -2 1 1 >: 0.044960069246047618 0.018563705543428739 +< -1 -1 2 >: 0.044960069246047618 0.018563705543428739 +< -1 0 1 >: -0.036709742817671677 -0.015157202105558635 +< 0 -2 2 >: -0.036709742817671677 -0.015157202105558635 +< 0 -1 1 >: -0.018354871408835838 -0.007578601052779317 +< 0 0 0 >: 0.018354871408835838 0.007578601052779317 +< 1 -2 1 >: 0.044960069246047618 0.018563705543428739 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: 0.010399637935952335 -0.034587632831313740 +< -2 0 2 >: -0.029414618025587074 0.097828598880849688 +< -2 1 1 >: 0.016111049813012111 -0.053582930376166016 +< -1 -2 3 >: -0.016443271359350829 0.054687849310284906 +< -1 -1 2 >: 0.012736903226387035 -0.042361025923726855 +< -1 0 1 >: -0.009301718946470012 0.030936119276648424 +< 0 -3 3 >: 0.016443271359350826 -0.054687849310284906 +< 0 -1 1 >: -0.009865962815610493 0.032812709586170934 +< 0 0 0 >: 0.006577308543740331 -0.021875139724113962 +< 1 -3 2 >: -0.016443271359350829 0.054687849310284906 +< 1 -2 1 >: 0.012736903226387035 -0.042361025923726855 +< 2 -3 1 >: 0.010399637935952335 -0.034587632831313740 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: -0.000056969662490620 -0.003666580543715266 +< -2 -1 3 >: 0.000085454493735930 0.005499870815572900 +< -2 0 2 >: -0.000204275311418739 -0.013147205892832026 +< -2 1 1 >: 0.000107662542303903 0.006929185914756131 +< -1 -3 4 >: 0.000106580479240023 0.006859544087796920 +< -1 -2 3 >: -0.000100709086672565 -0.006481659915569307 +< -1 -1 2 >: 0.000068516022368586 0.004409706913583733 +< -1 0 1 >: -0.000048148152644395 -0.003098826146825754 +< 0 -4 4 >: -0.000123068536759173 -0.007920719251215312 +< 0 -3 3 >: 0.000030767134189793 0.001980179812803828 +< 0 -2 2 >: 0.000035162439074049 0.002263062643204376 +< 0 -1 1 >: -0.000074720183032355 -0.004809008116809297 +< 0 0 0 >: 0.000043953048842562 0.002828828304005469 +< 1 -4 3 >: 0.000106580479240023 0.006859544087796920 +< 1 -3 2 >: -0.000100709086672565 -0.006481659915569307 +< 1 -2 1 >: 0.000068516022368586 0.004409706913583733 +< 2 -4 2 >: -0.000056969662490620 -0.003666580543715266 +< 2 -3 1 >: 0.000085454493735930 0.005499870815572900 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.025159180427669910 0.062119674465192128 +< 0 1 -1 >: 0.029051319185011158 0.071729621548901154 +< 1 -2 1 >: -0.016772786951779934 -0.041413116310128069 +< 1 -1 0 >: -0.047440605572003344 -0.117133981491835112 +< 1 0 -1 >: -0.041084769596272469 -0.101441003618345432 +< 2 -2 0 >: 0.037505091796301425 0.092602543229551637 +< 2 -1 -1 >: 0.053040209476377380 0.130959772545472752 +< 3 -2 -1 >: -0.064960724533728753 -0.160392309783676773 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 3 2 3 ) +num_ms=14 +< -3 0 3 >: 0.002833752401334180 -0.079207572764643866 +< -3 1 2 >: -0.002833752401334180 0.079207572764643866 +< -3 2 1 >: 0.001792222382637516 -0.050095267573958942 +< -2 -1 3 >: -0.002833752401334180 0.079207572764643866 +< -2 1 1 >: 0.002195015171528512 -0.061353922042195599 +< -1 -2 3 >: 0.001792222382637516 -0.050095267573958942 +< -1 -1 2 >: 0.002195015171528512 -0.061353922042195599 +< -1 0 1 >: -0.001700251440800508 0.047524543658786306 +< 0 -2 2 >: -0.002534585200314599 0.070845406813801901 +< 0 -1 1 >: -0.000801506215674825 0.022403284729282640 +< 0 0 0 >: 0.001133500960533672 -0.031683029105857546 +< 1 -2 1 >: 0.002776498976262111 -0.077607254815098989 +< 1 -1 0 >: -0.000801506215674825 0.022403284729282640 +< 2 -2 0 >: -0.002534585200314599 0.070845406813801901 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 4 2 2 ) +num_ms=9 +< 0 -2 2 >: 0.000834529747187740 0.010078086610853210 +< 0 -1 1 >: 0.003338118988750962 0.040312346443412847 +< 0 0 0 >: 0.002503589241563220 0.030234259832559625 +< 1 -2 1 >: -0.003732130487915003 -0.045070573489996490 +< 1 -1 0 >: -0.009141815348876177 -0.110399907465101838 +< 2 -2 0 >: 0.006464239625545608 0.078064523210940845 +< 2 -1 -1 >: 0.005278029552555514 0.063739416293486326 +< 3 -2 -1 >: -0.009874289131465252 -0.119245528901591236 +< 4 -2 -2 >: 0.006982176804255703 0.084319322112491588 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000572908359465638 -0.024115899432731829 +< 0 1 -1 >: -0.000701666575032910 -0.029535824149233642 +< 1 -2 1 >: 0.000496153193337710 0.020884981543856498 +< 1 -1 0 >: 0.001109432267556715 0.046700238440891648 +< 1 0 -1 >: 0.000905847653230952 0.038130585015497570 +< 2 -3 1 >: -0.000286454179732819 -0.012057949716365918 +< 2 -2 0 >: -0.000992306386675420 -0.041769963087713018 +< 2 -1 -1 >: -0.001109432267556715 -0.046700238440891648 +< 3 -3 0 >: 0.000757886521588038 0.031902336270826032 +< 3 -2 -1 >: 0.001312697961762130 0.055256467301218123 +< 4 -3 -1 >: -0.001515773043176077 -0.063804672541652077 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 4 3 3 ) +num_ms=14 +< 0 -3 3 >: -0.000232922969764295 -0.008537019114105015 +< 0 -2 2 >: -0.000543486929450021 -0.019919711266245036 +< 0 -1 1 >: -0.000077640989921432 -0.002845673038035007 +< 0 0 0 >: 0.000232922969764295 0.008537019114105015 +< 1 -3 2 >: 0.000850514431339986 0.031172786284320568 +< 1 -2 1 >: 0.000878407527543690 0.032195115235748417 +< 1 -1 0 >: -0.000601404521897524 -0.022042488570122077 +< 2 -3 1 >: -0.001141084850592472 -0.041822681507888343 +< 2 -2 0 >: -0.000268956278587725 -0.009857700567211020 +< 2 -1 -1 >: 0.000491044735883803 0.017997616552643158 +< 3 -3 0 >: 0.001232512505261881 0.045173659027453628 +< 3 -2 -1 >: -0.000581011966911931 -0.021295067086214238 +< 4 -3 -1 >: -0.001006342246496992 -0.036884138143910797 +< 4 -2 -2 >: 0.000649591126877968 0.023808608795096702 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 3 4 4 ) +l=( 4 4 4 ) +num_ms=25 +< -4 0 4 >: 0.000449825338994940 -0.008002256070840756 +< -4 1 3 >: -0.000711236310240683 0.012652677801883255 +< -4 2 2 >: 0.000403233085777721 -0.007173394046316527 +< -3 -1 4 >: -0.000355618155120342 0.006326338900941627 +< -3 0 3 >: 0.000674738008492410 -0.012003384106261129 +< -3 1 2 >: -0.000268822057185147 0.004782262697544351 +< -2 -2 4 >: 0.000403233085777720 -0.007173394046316526 +< -2 -1 3 >: -0.000134411028592573 0.002391131348772176 +< -2 0 2 >: -0.000353434194924595 0.006287486912803448 +< -2 1 1 >: 0.000304815561531721 -0.005422576200807108 +< -1 -3 4 >: -0.000355618155120341 0.006326338900941624 +< -1 -2 3 >: -0.000134411028592573 0.002391131348772175 +< -1 -1 2 >: 0.000304815561531721 -0.005422576200807109 +< -1 0 1 >: -0.000289173432211033 0.005144307474111914 +< 0 -4 4 >: 0.000224912669497470 -0.004001128035420377 +< 0 -3 3 >: 0.000337369004246205 -0.006001692053130567 +< 0 -2 2 >: -0.000176717097462298 0.003143743456401726 +< 0 -1 1 >: -0.000144586716105516 0.002572153737055957 +< 0 0 0 >: 0.000144586716105516 -0.002572153737055958 +< 1 -4 3 >: -0.000355618155120341 0.006326338900941624 +< 1 -3 2 >: -0.000134411028592573 0.002391131348772175 +< 1 -2 1 >: 0.000304815561531721 -0.005422576200807109 +< 2 -4 2 >: 0.000403233085777720 -0.007173394046316526 +< 2 -3 1 >: -0.000134411028592573 0.002391131348772176 +< 3 -4 1 >: -0.000355618155120342 0.006326338900941627 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.157554155758129116 0.231164493466297694 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.184133567952436655 -0.154604107376737965 +< 1 -1 >: -0.368267135904873255 0.309208214753475874 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.144488809584725070 -0.364079015494222169 +< 1 -1 >: 0.288977619169450195 0.728158030988444449 +< 2 -2 >: -0.288977619169450251 -0.728158030988444671 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.089201606941624448 0.126277646492835266 +< 1 -1 >: 0.178403213883248896 -0.252555292985670532 +< 2 -2 >: -0.178403213883248868 0.252555292985670476 +< 3 -3 >: 0.178403213883248868 -0.252555292985670476 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.031206805162126219 -0.074117671226575033 +< 1 -1 >: -0.062413610324252418 0.148235342453150010 +< 2 -2 >: 0.062413610324252418 -0.148235342453150010 +< 3 -3 >: -0.062413610324252418 0.148235342453150010 +< 4 -4 >: 0.062413610324252425 -0.148235342453150037 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.002505517869991374 -0.034819070698867929 +< 1 -1 >: -0.005011035739982747 0.069638141397735859 +< 2 -2 >: 0.005011035739982749 -0.069638141397735859 +< 3 -3 >: -0.005011035739982750 0.069638141397735873 +< 4 -4 >: 0.005011035739982749 -0.069638141397735859 +< 5 -5 >: -0.005011035739982743 0.069638141397735789 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 1 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.011027347746966754 0.049545417789944347 +< 1 -1 >: -0.022054695493933515 -0.099090835579888722 +< 2 -2 >: 0.022054695493933504 0.099090835579888681 +< 3 -3 >: -0.022054695493933515 -0.099090835579888722 +< 4 -4 >: 0.022054695493933501 0.099090835579888667 +< 5 -5 >: -0.022054695493933504 -0.099090835579888681 +< 6 -6 >: 0.022054695493933490 0.099090835579888625 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.009881859225126983 -0.219792647952851444 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.038037296734070511 -0.051050933697750711 +< 1 -1 0 >: -0.076074593468141008 0.102101867395501394 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.023970409040645662 -0.097244131034850759 +< 1 -1 0 >: -0.047940818081291331 0.194488262069701517 +< 2 -2 0 >: 0.047940818081291338 -0.194488262069701573 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.004853574855062973 -0.030948741139870253 +< 0 1 -1 >: -0.005604425498205210 -0.035736528056368254 +< 1 -2 1 >: 0.003235716570041981 0.020632494093246825 +< 1 -1 0 >: 0.009151988514697448 0.058357505944504888 +< 1 0 -1 >: 0.007925854548871399 0.050539082649442610 +< 2 -2 0 >: -0.007235282206536331 -0.046135659337862796 +< 2 -1 -1 >: -0.010232234224080410 -0.065245675144630491 +< 3 -2 -1 >: 0.012531876388819979 0.079909306013867865 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.011630735346167934 0.003140347900163450 +< 1 -1 0 >: 0.023261470692335869 -0.006280695800326900 +< 2 -2 0 >: -0.023261470692335865 0.006280695800326899 +< 3 -3 0 >: 0.023261470692335865 -0.006280695800326899 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.002697459723056831 0.062847678113761199 +< 0 1 -1 >: -0.003303699961599229 0.076972371448698451 +< 1 -2 1 >: 0.002336068645852552 -0.054427685815384479 +< 1 -1 0 >: 0.005223608292232188 -0.121704005341200780 +< 1 0 -1 >: 0.004265058310713298 -0.099370904246300101 +< 2 -3 1 >: -0.001348729861528416 0.031423839056880606 +< 2 -2 0 >: -0.004672137291705105 0.108855371630768999 +< 2 -1 -1 >: -0.005223608292232189 0.121704005341200794 +< 3 -3 0 >: 0.003568403799410768 -0.083139663383424545 +< 3 -2 -1 >: 0.006180656682501273 -0.144002121104265135 +< 4 -3 -1 >: -0.007136807598821539 0.166279326766849145 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.001556648333714049 -0.001179970747050745 +< 1 -1 0 >: -0.003113296667428097 0.002359941494101490 +< 2 -2 0 >: 0.003113296667428097 -0.002359941494101490 +< 3 -3 0 >: -0.003113296667428097 0.002359941494101490 +< 4 -4 0 >: 0.003113296667428097 -0.002359941494101490 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.003147239138375993 -0.045268139294386202 +< 0 1 -1 >: -0.001723813869951654 0.024794381027821315 +< 0 2 -2 >: -0.007313522861677441 0.105193649760573202 +< 1 -3 2 >: 0.006118932231508618 -0.088011321799897457 +< 1 -2 1 >: 0.004906060282112865 -0.070566045499783847 +< 1 -1 0 >: -0.005350306535239187 0.076955836800456520 +< 1 0 -1 >: -0.001723813869951654 0.024794381027821315 +< 1 1 -2 >: 0.007709129987537763 -0.110883842876479149 +< 2 -4 2 >: -0.004079288154339078 0.058674214533264969 +< 2 -3 1 >: -0.007211230790867793 0.103722337443164808 +< 2 -2 0 >: 0.002517791310700795 -0.036214511435508967 +< 2 -1 -1 >: 0.004906060282112865 -0.070566045499783847 +< 2 0 -2 >: -0.007313522861677441 0.105193649760573202 +< 3 -4 1 >: 0.007631649327731125 -0.109769404110774904 +< 3 -3 0 >: 0.002203067396863194 -0.031687697506070325 +< 3 -2 -1 >: -0.007211230790867793 0.103722337443164808 +< 3 -1 -2 >: 0.006118932231508618 -0.088011321799897457 +< 4 -4 0 >: -0.008812269587452780 0.126750790024281357 +< 4 -3 -1 >: 0.007631649327731125 -0.109769404110774904 +< 4 -2 -2 >: -0.004079288154339078 0.058674214533264969 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.011930248142467558 0.034879821696619094 +< 1 -1 0 >: -0.023860496284935112 -0.069759643393238174 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.010800971050317396 -0.087271967525785019 +< 1 -1 0 >: -0.021601942100634795 0.174543935051570037 +< 2 -2 0 >: 0.021601942100634802 -0.174543935051570093 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.013126827675406438 0.050469449847610731 +< 0 1 -1 >: -0.015157554984003466 0.058277100910740717 +< 1 -2 1 >: 0.008751218450270956 -0.033646299898407145 +< 1 -1 0 >: 0.024752183639325697 -0.095166107279999773 +< 1 0 -1 >: 0.021436019830793605 -0.082416266483754982 +< 2 -2 0 >: -0.019568319340756223 0.075235413764182649 +< 2 -1 -1 >: -0.027673782604545193 0.106398942516058526 +< 3 -2 -1 >: 0.033893323316922491 -0.130311559168031166 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.024882056454765392 0.048496728546899577 +< 1 -1 0 >: -0.049764112909530783 -0.096993457093799154 +< 2 -2 0 >: 0.049764112909530776 0.096993457093799140 +< 3 -3 0 >: -0.049764112909530776 -0.096993457093799140 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000918343606543681 0.027461293300710472 +< 0 1 -1 >: 0.001124736622289629 0.033633078131825353 +< 1 -2 1 >: -0.000795308892669849 -0.023782177619190686 +< 1 -1 0 >: -0.001778364747119867 -0.053178565809484490 +< 1 0 -1 >: -0.001452028735665771 -0.043420117162084146 +< 2 -3 1 >: 0.000459171803271841 0.013730646650355239 +< 2 -2 0 >: 0.001590617785339699 0.047564355238381394 +< 2 -1 -1 >: 0.001778364747119867 0.053178565809484497 +< 3 -3 0 >: -0.001214854400510364 -0.036327876376941994 +< 3 -2 -1 >: -0.002104189545482582 -0.062921727615944750 +< 4 -3 -1 >: 0.002429708801020729 0.072655752753884015 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.009851657119976582 -0.006144135502695961 +< 1 -1 0 >: 0.019703314239953158 0.012288271005391916 +< 2 -2 0 >: -0.019703314239953158 -0.012288271005391916 +< 3 -3 0 >: 0.019703314239953158 0.012288271005391916 +< 4 -4 0 >: -0.019703314239953161 -0.012288271005391919 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.003578339080263088 -0.000467045563529370 +< 0 1 -1 >: 0.001959937032662382 0.000255811390527748 +< 0 2 -2 >: 0.008315308598965265 0.001085315813681586 +< 1 -3 2 >: -0.006957086313049306 -0.000908040357472688 +< 1 -2 1 >: -0.005578078584352461 -0.000728051980934257 +< 1 -1 0 >: 0.006083176436447249 0.000793977457999930 +< 1 0 -1 >: 0.001959937032662382 0.000255811390527748 +< 1 1 -2 >: -0.008765104873304628 -0.001144023317277582 +< 2 -4 2 >: 0.004638057542032871 0.000605360238315125 +< 2 -3 1 >: 0.008199004848762133 0.001070135823933324 +< 2 -2 0 >: -0.002862671264210471 -0.000373636450823496 +< 2 -1 -1 >: -0.005578078584352461 -0.000728051980934257 +< 2 0 -2 >: 0.008315308598965265 0.001085315813681586 +< 3 -4 1 >: -0.008677011131214942 -0.001132525303675511 +< 3 -3 0 >: -0.002504837356184161 -0.000326931894470559 +< 3 -2 -1 >: 0.008199004848762133 0.001070135823933324 +< 3 -1 -2 >: -0.006957086313049306 -0.000908040357472688 +< 4 -4 0 >: 0.010019349424736645 0.001307727577882237 +< 4 -3 -1 >: -0.008677011131214942 -0.001132525303675511 +< 4 -2 -2 >: 0.004638057542032871 0.000605360238315125 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.013468787859311522 -0.061572797573190549 +< 1 -1 0 >: -0.026937575718623038 0.123145595146381071 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.038797971985155805 0.053059172670396101 +< 1 -1 0 >: 0.077595943970311623 -0.106118345340792217 +< 2 -2 0 >: -0.077595943970311637 0.106118345340792244 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.036749560678448812 -0.103331079045556190 +< 0 1 -1 >: 0.042434737500605800 -0.119316452605212675 +< 1 -2 1 >: -0.024499707118965867 0.068887386030370770 +< 1 -1 0 >: -0.069295636163620417 0.194842951201162518 +< 1 0 -1 >: -0.060011781289098898 0.168738945488538378 +< 2 -2 0 >: 0.054783010546843217 -0.154036877956178458 +< 2 -1 -1 >: 0.077474876502973980 -0.217841041911236821 +< 3 -2 -1 >: -0.094886957658714105 0.266799698859387480 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.019572126169034785 0.084843622212785935 +< 1 -1 0 >: 0.039144252338069570 -0.169687244425571870 +< 2 -2 0 >: -0.039144252338069563 0.169687244425571870 +< 3 -3 0 >: 0.039144252338069563 -0.169687244425571870 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.005990785587919729 -0.048647248739531211 +< 0 1 -1 >: 0.007337183924411334 -0.059580468401051793 +< 1 -2 1 >: -0.005188172507764179 0.042129753232654540 +< 1 -1 0 >: -0.011601106406356261 0.094204992103507079 +< 1 0 -1 >: -0.009472263715768623 0.076918053958836927 +< 2 -3 1 >: 0.002995392793959865 -0.024323624369765609 +< 2 -2 0 >: 0.010376345015528362 -0.084259506465309109 +< 2 -1 -1 >: 0.011601106406356263 -0.094204992103507093 +< 3 -3 0 >: -0.007925064411772738 0.064354261066149970 +< 3 -2 -1 >: -0.013726614214446344 0.111464849850123462 +< 4 -3 -1 >: 0.015850128823545480 -0.128708522132299996 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.012567434723074462 -0.015502730665534242 +< 1 -1 0 >: -0.025134869446148917 0.031005461331068473 +< 2 -2 0 >: 0.025134869446148917 -0.031005461331068473 +< 3 -3 0 >: -0.025134869446148917 0.031005461331068473 +< 4 -4 0 >: 0.025134869446148921 -0.031005461331068480 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.002206809792468274 0.020213622302955207 +< 0 1 -1 >: -0.001208719503458168 -0.011071456904218091 +< 0 2 -2 >: -0.005128162544686243 -0.046972213527523406 +< 1 -3 2 >: 0.004290528610708245 0.039299773416302003 +< 1 -2 1 >: 0.003440076014876023 0.031509918750353257 +< 1 -1 0 >: -0.003751576647196064 -0.034363157915023847 +< 1 0 -1 >: -0.001208719503458168 -0.011071456904218091 +< 1 1 -2 >: 0.005405557950924511 0.049513060495582073 +< 2 -4 2 >: -0.002860352407138830 -0.026199848944201336 +< 2 -3 1 >: -0.005056436459177827 -0.046315227136269919 +< 2 -2 0 >: 0.001765447833974619 0.016170897842364168 +< 2 -1 -1 >: 0.003440076014876023 0.031509918750353257 +< 2 0 -2 >: -0.005128162544686243 -0.046972213527523406 +< 3 -4 1 >: 0.005351229356473814 0.049015429167216192 +< 3 -3 0 >: 0.001544766854727791 0.014149535612068638 +< 3 -2 -1 >: -0.005056436459177827 -0.046315227136269919 +< 3 -1 -2 >: 0.004290528610708245 0.039299773416302003 +< 4 -4 0 >: -0.006179067418911166 -0.056598142448274574 +< 4 -3 -1 >: 0.005351229356473814 0.049015429167216192 +< 4 -2 -2 >: -0.002860352407138830 -0.026199848944201336 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.059083716408346074 0.136148585985658210 +< 1 -1 0 >: 0.118167432816692133 -0.272297171971316365 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.009352930572533689 -0.044273101196926970 +< 1 -1 0 >: -0.018705861145067382 0.088546202393853954 +< 2 -2 0 >: 0.018705861145067386 -0.088546202393853982 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.026234572998636890 0.014909810897346160 +< 0 1 -1 >: -0.030293075565675776 0.017216366670298435 +< 1 -2 1 >: 0.017489715332424584 -0.009939873931564102 +< 1 -1 0 >: 0.049468385250319040 -0.028114209044593472 +< 1 0 -1 >: 0.042840878310971699 -0.024347619239924168 +< 2 -2 0 >: -0.039108192390421716 0.022226233798755431 +< 2 -1 -1 >: -0.055307336078430656 0.031432641278675205 +< 3 -2 -1 >: 0.067737376212388942 -0.038496966200349016 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.002524005065410506 -0.051232649910169847 +< 1 -1 0 >: -0.005048010130821012 0.102465299820339695 +< 2 -2 0 >: 0.005048010130821011 -0.102465299820339681 +< 3 -3 0 >: -0.005048010130821011 0.102465299820339681 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.005334637759604893 0.033713120893056552 +< 0 1 -1 >: -0.006533570236808009 0.041289971912375642 +< 1 -2 1 >: 0.004619931819805540 -0.029196419134242896 +< 1 -1 0 >: 0.010330481600499498 -0.065285177883742690 +< 1 0 -1 >: 0.008434802906144621 -0.053305124527334276 +< 2 -3 1 >: -0.002667318879802447 0.016856560446528279 +< 2 -2 0 >: -0.009239863639611084 0.058392838268485812 +< 2 -1 -1 >: -0.010330481600499500 0.065285177883742690 +< 3 -3 0 >: 0.007057062423264657 -0.044598266901441710 +< 3 -2 -1 >: 0.012223190669279531 -0.077246464202814460 +< 4 -3 -1 >: -0.014114124846529319 0.089196533802883449 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.003828032263925754 -0.011598754992030929 +< 1 -1 0 >: 0.007656064527851504 0.023197509984061851 +< 2 -2 0 >: -0.007656064527851504 -0.023197509984061851 +< 3 -3 0 >: 0.007656064527851504 0.023197509984061851 +< 4 -4 0 >: -0.007656064527851506 -0.023197509984061854 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 1 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.001401747909936194 0.010543239399376297 +< 0 1 -1 >: 0.000767768950207773 -0.005774770048215617 +< 0 2 -2 >: 0.003257367786458360 -0.024500274365317376 +< 1 -3 2 >: -0.002725309418649495 0.020498400200578571 +< 1 -2 1 >: -0.002185108739471674 0.016435283684473549 +< 1 -1 0 >: 0.002382971446891529 -0.017923506978939702 +< 1 0 -1 >: 0.000767768950207773 -0.005774770048215617 +< 1 1 -2 >: -0.003433567127356465 0.025825556764479719 +< 2 -4 2 >: 0.001816872945766330 -0.013665600133719048 +< 2 -3 1 >: 0.003211807951264375 -0.024157596308841317 +< 2 -2 0 >: -0.001121398327948955 0.008434591519501039 +< 2 -1 -1 >: -0.002185108739471674 0.016435283684473549 +< 2 0 -2 >: 0.003257367786458360 -0.024500274365317376 +< 3 -4 1 >: -0.003399058039178160 0.025565996842514420 +< 3 -3 0 >: -0.000981223536955335 0.007380267579563404 +< 3 -2 -1 >: 0.003211807951264375 -0.024157596308841317 +< 3 -1 -2 >: -0.002725309418649495 0.020498400200578571 +< 4 -4 0 >: 0.003924894147821343 -0.029521070318253628 +< 4 -3 -1 >: -0.003399058039178160 0.025565996842514420 +< 4 -2 -2 >: 0.001816872945766330 -0.013665600133719048 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.287026989817026290 -0.066729552024546113 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.005767666807775936 -0.096451267935127302 +< 1 -1 >: 0.011535333615551870 0.192902535870254577 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.057515597339940411 0.044271616939913321 +< 1 -1 >: -0.115031194679880835 -0.088543233879826655 +< 2 -2 >: 0.115031194679880863 0.088543233879826669 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.032601265583660076 0.138180925507352059 +< 1 -1 >: -0.065202531167320152 -0.276361851014704119 +< 2 -2 >: 0.065202531167320138 0.276361851014704063 +< 3 -3 >: -0.065202531167320138 -0.276361851014704063 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.020388227653746625 0.002279263934942535 +< 1 -1 >: 0.040776455307493235 -0.004558527869885069 +< 2 -2 >: -0.040776455307493235 0.004558527869885069 +< 3 -3 >: 0.040776455307493235 -0.004558527869885069 +< 4 -4 >: -0.040776455307493242 0.004558527869885070 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: -0.001555261349867393 0.025661933919382016 +< 1 -1 >: 0.003110522699734786 -0.051323867838764033 +< 2 -2 >: -0.003110522699734787 0.051323867838764047 +< 3 -3 >: 0.003110522699734787 -0.051323867838764053 +< 4 -4 >: -0.003110522699734787 0.051323867838764047 +< 5 -5 >: 0.003110522699734783 -0.051323867838763991 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 2 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.005821332904486398 -0.127693554634757372 +< 1 -1 >: 0.011642665808972798 0.255387109269514800 +< 2 -2 >: -0.011642665808972795 -0.255387109269514689 +< 3 -3 >: 0.011642665808972798 0.255387109269514800 +< 4 -4 >: -0.011642665808972791 -0.255387109269514634 +< 5 -5 >: 0.011642665808972795 0.255387109269514689 +< 6 -6 >: -0.011642665808972788 -0.255387109269514578 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.018455587456866641 0.464400210681951586 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.000112749367497700 -0.063197505042209404 +< 1 -1 0 >: -0.000225498734995400 0.126395010084418780 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.024360220296848232 0.044872287240805497 +< 0 1 -1 >: 0.024360220296848228 0.044872287240805490 +< 1 -1 0 >: -0.042193139237711737 -0.077721081352899790 +< 1 0 -1 >: -0.042193139237711737 -0.077721081352899790 +< 2 -1 -1 >: 0.059670109749068327 0.109914207331573532 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.016306322357343566 0.094452916810822768 +< 1 -1 0 >: 0.032612644714687139 -0.188905833621645564 +< 2 -2 0 >: -0.032612644714687146 0.188905833621645619 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 2 2 2 ) +num_ms=10 +< 0 0 0 >: 0.003325328308296832 0.027448792220999947 +< 0 1 -1 >: -0.003325328308296832 -0.027448792220999947 +< 0 2 -2 >: -0.006650656616593668 -0.054897584441999929 +< 1 -2 1 >: 0.008145357582559630 0.067235534997126076 +< 1 -1 0 >: -0.003325328308296832 -0.027448792220999947 +< 1 0 -1 >: -0.003325328308296832 -0.027448792220999947 +< 1 1 -2 >: 0.008145357582559630 0.067235534997126076 +< 2 -2 0 >: -0.006650656616593664 -0.054897584441999894 +< 2 -1 -1 >: 0.008145357582559630 0.067235534997126076 +< 2 0 -2 >: -0.006650656616593668 -0.054897584441999929 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.016730983793628286 -0.003411413597293024 +< 0 1 -1 >: 0.019319275994117108 -0.003939161117428552 +< 1 -2 1 >: -0.011153989195752187 0.002274275731528682 +< 1 -1 0 >: -0.031548245590391440 0.006432623168207710 +< 1 0 -1 >: -0.027321582126109373 0.005570815076640215 +< 2 -2 0 >: 0.024941078062000105 -0.005085435135276196 +< 2 -1 -1 >: 0.035272010855486619 -0.007191891338876251 +< 3 -2 -1 >: -0.043199214398925684 0.008808232032894277 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.005652004549836375 -0.007069154502153570 +< 1 -1 0 >: -0.011304009099672749 0.014138309004307140 +< 2 -2 0 >: 0.011304009099672748 -0.014138309004307138 +< 3 -3 0 >: -0.011304009099672748 0.014138309004307138 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.022641065281083991 -0.011572589255505880 +< 0 1 -1 >: 0.030188087041445336 -0.015430119007341179 +< 0 2 -2 >: 0.007547021760361332 -0.003857529751835294 +< 1 -2 1 >: -0.016875653683838067 0.008625698750331610 +< 1 -1 0 >: -0.041336740601322496 0.021128560613274960 +< 1 0 -1 >: -0.041336740601322502 0.021128560613274963 +< 1 1 -2 >: -0.016875653683838067 0.008625698750331610 +< 2 -2 0 >: 0.029229489591344412 -0.014940148486357718 +< 2 -1 -1 >: 0.047731556627190558 -0.024397160315327248 +< 2 0 -2 >: 0.029229489591344422 -0.014940148486357724 +< 3 -2 -1 >: -0.044648782859086571 0.022821453777538071 +< 3 -1 -2 >: -0.044648782859086564 0.022821453777538067 +< 4 -2 -2 >: 0.063142914262771591 -0.032274409445265030 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000364239024064384 -0.000939032880186161 +< 0 1 -1 >: -0.000446099876683532 -0.001150075704076073 +< 1 -2 1 >: 0.000315440247889408 0.000813226329230084 +< 1 -1 0 >: 0.000705345837120102 0.001818429353251093 +< 1 0 -1 >: 0.000575912464380168 0.001484741349588133 +< 2 -3 1 >: -0.000182119512032192 -0.000469516440093080 +< 2 -2 0 >: -0.000630880495778817 -0.001626452658460169 +< 2 -1 -1 >: -0.000705345837120102 -0.001818429353251093 +< 3 -3 0 >: 0.000481842937729616 0.001242223736942646 +< 3 -2 -1 >: 0.000834576449415942 0.002151594626752740 +< 4 -3 -1 >: -0.000963685875459232 -0.002484447473885294 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000635830977452394 0.048298488990391457 +< 0 1 -1 >: 0.000211943659150798 -0.016099496330130497 +< 0 2 -2 >: 0.001483605614055586 -0.112696474310913397 +< 0 3 -3 >: 0.000635830977452394 -0.048298488990391457 +< 1 -3 2 >: -0.001160863230370783 0.088180573044841046 +< 1 -2 1 >: -0.001198934388920157 0.091072504229785634 +< 1 -1 0 >: 0.000820854262225302 -0.062353081168922811 +< 1 0 -1 >: 0.000820854262225302 -0.062353081168922783 +< 1 1 -2 >: -0.001198934388920156 0.091072504229785620 +< 1 2 -3 >: -0.001160863230370783 0.088180573044841060 +< 2 -3 1 >: 0.001557461457413442 -0.118306653373890153 +< 2 -2 0 >: 0.000367097185991242 -0.027885145620054671 +< 2 -1 -1 >: -0.001340449397093820 0.101822155169468895 +< 2 0 -2 >: 0.000367097185991242 -0.027885145620054678 +< 2 1 -3 >: 0.001557461457413442 -0.118306653373890139 +< 3 -3 0 >: -0.001682250642210152 0.127785790568766905 +< 3 -2 -1 >: 0.000793020557841482 -0.060238799366972705 +< 3 -1 -2 >: 0.000793020557841482 -0.060238799366972691 +< 3 0 -3 >: -0.001682250642210152 0.127785790568766905 +< 4 -3 -1 >: 0.001373551897628060 -0.104336661090544638 +< 4 -2 -2 >: -0.001773247874888357 0.134698050267522212 +< 4 -1 -3 >: 0.001373551897628060 -0.104336661090544638 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.001729464105349662 -0.024105254666445555 +< 1 -1 0 >: 0.003458928210699323 0.048210509332891095 +< 2 -2 0 >: -0.003458928210699323 -0.048210509332891095 +< 3 -3 0 >: 0.003458928210699323 0.048210509332891095 +< 4 -4 0 >: -0.003458928210699323 -0.048210509332891102 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.001876784661961253 0.010877525676841630 +< 0 1 -1 >: 0.001027957294935886 -0.005957866183047810 +< 0 2 -2 >: 0.004361253444116070 -0.025277085476610721 +< 1 -3 2 >: -0.003648886422275981 0.021148327005565227 +< 1 -2 1 >: -0.002925617750444584 0.016956384419632271 +< 1 -1 0 >: 0.003190533925334130 -0.018491793650630767 +< 1 0 -1 >: 0.001027957294935886 -0.005957866183047810 +< 1 1 -2 >: -0.004597164778886885 0.026644387572284225 +< 2 -4 2 >: 0.002432590948183987 -0.014098884670376817 +< 2 -3 1 >: 0.004300253888284776 -0.024923542393976265 +< 2 -2 0 >: -0.001501427729569003 0.008702020541473307 +< 2 -1 -1 >: -0.002925617750444584 0.016956384419632271 +< 2 0 -2 >: 0.004361253444116070 -0.025277085476610721 +< 3 -4 1 >: -0.004550960945136021 0.026376597986094652 +< 3 -3 0 >: -0.001313749263372877 0.007614267973789138 +< 3 -2 -1 >: 0.004300253888284776 -0.024923542393976265 +< 3 -1 -2 >: -0.003648886422275981 0.021148327005565227 +< 4 -4 0 >: 0.005254997053491508 -0.030457071895156562 +< 4 -3 -1 >: -0.004550960945136021 0.026376597986094652 +< 4 -2 -2 >: 0.002432590948183987 -0.014098884670376817 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 1 ) +l=( 4 4 4 ) +num_ms=31 +< 0 0 0 >: 0.000655470119741609 -0.009793161264484037 +< 0 1 -1 >: -0.000655470119741609 0.009793161264484034 +< 0 2 -2 >: -0.000801130146350855 0.011969419323258259 +< 0 3 -3 >: 0.001529430279397088 -0.022850709617129407 +< 0 4 -4 >: 0.001019620186264725 -0.015233806411419609 +< 1 -4 3 >: -0.001612161068440831 0.024086762847081025 +< 1 -3 2 >: -0.000609339608639231 0.009103940625995212 +< 1 -2 1 >: 0.001381852344377855 -0.020645796726069452 +< 1 -1 0 >: -0.000655470119741609 0.009793161264484035 +< 1 0 -1 >: -0.000655470119741609 0.009793161264484034 +< 1 1 -2 >: 0.001381852344377855 -0.020645796726069445 +< 1 2 -3 >: -0.000609339608639231 0.009103940625995212 +< 1 3 -4 >: -0.001612161068440832 0.024086762847081028 +< 2 -4 2 >: 0.001828018825917694 -0.027311821877985636 +< 2 -3 1 >: -0.000609339608639231 0.009103940625995210 +< 2 -2 0 >: -0.000801130146350856 0.011969419323258268 +< 2 -1 -1 >: 0.001381852344377855 -0.020645796726069452 +< 2 0 -2 >: -0.000801130146350855 0.011969419323258259 +< 2 1 -3 >: -0.000609339608639231 0.009103940625995212 +< 2 2 -4 >: 0.001828018825917694 -0.027311821877985639 +< 3 -4 1 >: -0.001612161068440830 0.024086762847081014 +< 3 -3 0 >: 0.001529430279397088 -0.022850709617129417 +< 3 -2 -1 >: -0.000609339608639231 0.009103940625995210 +< 3 -1 -2 >: -0.000609339608639231 0.009103940625995212 +< 3 0 -3 >: 0.001529430279397088 -0.022850709617129407 +< 3 1 -4 >: -0.001612161068440832 0.024086762847081028 +< 4 -4 0 >: 0.001019620186264725 -0.015233806411419607 +< 4 -3 -1 >: -0.001612161068440830 0.024086762847081014 +< 4 -2 -2 >: 0.001828018825917694 -0.027311821877985636 +< 4 -1 -3 >: -0.001612161068440831 0.024086762847081025 +< 4 0 -4 >: 0.001019620186264725 -0.015233806411419609 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.003160276460310858 -0.290714607686225146 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.033165383753138482 -0.065714662622380016 +< 1 -1 0 >: 0.066330767506276950 0.131429325244760004 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.022326309815497613 0.053284706814357853 +< 1 -1 0 >: 0.044652619630995226 -0.106569413628715720 +< 2 -2 0 >: -0.044652619630995240 0.106569413628715748 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.005907741309733746 -0.106135249692557762 +< 0 1 -1 >: 0.006821672070954898 -0.122554429961012692 +< 1 -2 1 >: -0.003938494206489162 0.070756833128371818 +< 1 -1 0 >: -0.011139743844289673 0.200130546081426747 +< 1 0 -1 >: -0.009647301160806174 0.173318136979767723 +< 2 -2 0 >: 0.008806740774698863 -0.158217088747648532 +< 2 -1 -1 >: 0.012454612243883268 -0.223752752706112140 +< 3 -2 -1 >: -0.015253722470866923 0.274040036336561321 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.010723934618256343 0.042211665913045954 +< 1 -1 0 >: 0.021447869236512686 -0.084423331826091907 +< 2 -2 0 >: -0.021447869236512682 0.084423331826091894 +< 3 -3 0 >: 0.021447869236512682 -0.084423331826091894 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000392382834446121 0.002302098388691950 +< 0 1 -1 >: 0.000480568864109982 0.002819483194989307 +< 1 -2 1 >: -0.000339813502639284 -0.001993675686618451 +< 1 -1 0 >: -0.000759846091573744 -0.004457994360367426 +< 1 0 -1 >: -0.000620411735801258 -0.003639937153035087 +< 2 -3 1 >: 0.000196191417223061 0.001151049194345975 +< 2 -2 0 >: 0.000679627005278569 0.003987351373236904 +< 2 -1 -1 >: 0.000759846091573744 0.004457994360367427 +< 3 -3 0 >: -0.000519073699337532 -0.003045389915040704 +< 3 -2 -1 >: -0.000899062020125338 -0.005274770061708367 +< 4 -3 -1 >: 0.001038147398675065 0.006090779830081409 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.009590808832438397 0.015162806903201789 +< 1 -1 0 >: -0.019181617664876787 -0.030325613806403567 +< 2 -2 0 >: 0.019181617664876787 0.030325613806403567 +< 3 -3 0 >: -0.019181617664876787 -0.030325613806403567 +< 4 -4 0 >: 0.019181617664876791 0.030325613806403574 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.002321808667863386 0.034548359254821651 +< 0 1 -1 >: -0.001271706981599796 -0.018922915688658188 +< 0 2 -2 >: -0.005395395782228952 -0.080283132019629097 +< 1 -3 2 >: 0.004514111978321516 0.067169687365781591 +< 1 -2 1 >: 0.003619341520373877 0.053855562192744191 +< 1 -1 0 >: -0.003947074735367755 -0.058732210733196795 +< 1 0 -1 >: -0.001271706981599796 -0.018922915688658188 +< 1 1 -2 >: 0.005687246516636438 0.084625851624673926 +< 2 -4 2 >: -0.003009407985547677 -0.044779791577187721 +< 2 -3 1 >: -0.005319931984844275 -0.079160235710874188 +< 2 -2 0 >: 0.001857446934290709 0.027638687403857328 +< 2 -1 -1 >: 0.003619341520373877 0.053855562192744191 +< 2 0 -2 >: -0.005395395782228952 -0.080283132019629097 +< 3 -4 1 >: 0.005630086809470477 0.083775318966490986 +< 3 -3 0 >: 0.001625266067504369 0.024183851478375144 +< 3 -2 -1 >: -0.005319931984844275 -0.079160235710874188 +< 3 -1 -2 >: 0.004514111978321516 0.067169687365781591 +< 4 -4 0 >: -0.006501064270017480 -0.096735405913500619 +< 4 -3 -1 >: 0.005630086809470477 0.083775318966490986 +< 4 -2 -2 >: -0.003009407985547677 -0.044779791577187721 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.047209873545272368 0.112362011082415572 +< 1 -1 0 >: -0.094419747090544723 -0.224724022164831116 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.055540104125378409 -0.064077659113268695 +< 1 -1 0 >: -0.111080208250756832 0.128155318226537418 +< 2 -2 0 >: 0.111080208250756859 -0.128155318226537446 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.026824954147321351 0.039363876600757679 +< 0 1 -1 >: -0.030974788995910687 0.045453489503589295 +< 1 -2 1 >: 0.017883302764880895 -0.026242584400505111 +< 1 -1 0 >: 0.050581618620237676 -0.074225237541829914 +< 1 0 -1 >: 0.043804966689661794 -0.064280941313159104 +< 2 -2 0 >: -0.039988280644483627 0.058680202624805007 +< 2 -1 -1 >: -0.056551968823410272 0.082986338394800518 +< 3 -2 -1 >: 0.069261733783568757 -0.101637092344598848 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.009447121937352258 -0.102258967371407938 +< 1 -1 0 >: -0.018894243874704515 0.204517934742815877 +< 2 -2 0 >: 0.018894243874704512 -0.204517934742815849 +< 3 -3 0 >: -0.018894243874704512 0.204517934742815849 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000656854021824935 -0.027812928638570465 +< 0 1 -1 >: -0.000804478594483028 -0.034063741708469431 +< 1 -2 1 >: 0.000568852269478372 0.024086702754645764 +< 1 -1 0 >: 0.001271992343708669 0.053859504713219375 +< 1 0 -1 >: 0.001038577399604373 0.043976101448804351 +< 2 -3 1 >: -0.000328427010912468 -0.013906464319285236 +< 2 -2 0 >: -0.001137704538956744 -0.048173405509291549 +< 2 -1 -1 >: -0.001271992343708669 -0.053859504713219382 +< 3 -3 0 >: 0.000868936194710686 0.036793046205021850 +< 3 -2 -1 >: 0.001505041637774471 0.063727425392327133 +< 4 -3 -1 >: -0.001737872389421372 -0.073586092410043727 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.012398524780334092 0.043462566869807581 +< 1 -1 0 >: 0.024797049560668173 -0.086925133739615135 +< 2 -2 0 >: -0.024797049560668173 0.086925133739615135 +< 3 -3 0 >: 0.024797049560668173 -0.086925133739615135 +< 4 -4 0 >: -0.024797049560668180 0.086925133739615149 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.001535119704393886 -0.049500517208194067 +< 0 1 -1 >: 0.000840819690567194 0.027112549883100540 +< 0 2 -2 >: 0.003567295829731425 0.115028807265593586 +< 1 -3 2 >: -0.002984613823557992 -0.096240004939014620 +< 1 -2 1 >: -0.002393014791339294 -0.077163669724976694 +< 1 -1 0 >: 0.002609703497469606 0.084150879253929903 +< 1 0 -1 >: 0.000840819690567194 0.027112549883100540 +< 1 1 -2 >: -0.003760259969857169 -0.121251009163933582 +< 2 -4 2 >: 0.001989742549038661 0.064160003292676404 +< 2 -3 1 >: 0.003517401123101609 0.113419933523006736 +< 2 -2 0 >: -0.001228095763515109 -0.039600413766555265 +< 2 -1 -1 >: -0.002393014791339294 -0.077163669724976694 +< 2 0 -2 >: 0.003567295829731425 0.115028807265593586 +< 3 -4 1 >: -0.003722467453194459 -0.120032375127741550 +< 3 -3 0 >: -0.001074583793075720 -0.034650362045735836 +< 3 -2 -1 >: 0.003517401123101609 0.113419933523006736 +< 3 -1 -2 >: -0.002984613823557992 -0.096240004939014620 +< 4 -4 0 >: 0.004298335172302881 0.138601448182943371 +< 4 -3 -1 >: -0.003722467453194459 -0.120032375127741550 +< 4 -2 -2 >: 0.001989742549038661 0.064160003292676404 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.014680923368191412 -0.058637077745640601 +< 1 -1 0 >: 0.029361846736382816 0.117274155491281173 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.021502947095046354 0.082736453508225102 +< 1 -1 0 >: 0.043005894190092715 -0.165472907016450232 +< 2 -2 0 >: -0.043005894190092729 0.165472907016450260 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.020176428560983086 0.043726297438351325 +< 0 1 -1 >: 0.023297732921937667 0.050490779193395542 +< 1 -2 1 >: -0.013450952373988719 -0.029150864958900874 +< 1 -1 0 >: -0.038045038548258865 -0.082451097159568484 +< 1 0 -1 >: -0.032947969870750403 -0.071404744710085261 +< 2 -2 0 >: 0.030077243870350958 0.065183315651018980 +< 2 -1 -1 >: 0.042535646200253359 0.092183129034117475 +< 3 -2 -1 >: -0.052095314535087429 -0.112900814513364450 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.002654179181349309 0.065491871130055904 +< 1 -1 0 >: 0.005308358362698618 -0.130983742260111807 +< 2 -2 0 >: -0.005308358362698617 0.130983742260111780 +< 3 -3 0 >: 0.005308358362698617 -0.130983742260111780 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000529039402438292 0.014985092581065959 +< 0 1 -1 >: 0.000647938294900369 0.018352915285988685 +< 1 -2 1 >: -0.000458161562114500 -0.012977470853264844 +< 1 -1 0 >: -0.001024480397565514 -0.029018507003922393 +< 1 0 -1 >: -0.000836484741839719 -0.023693511752329897 +< 2 -3 1 >: 0.000264519701219146 0.007492546290532981 +< 2 -2 0 >: 0.000916323124229000 0.025954941706529698 +< 2 -1 -1 >: 0.001024480397565514 0.029018507003922396 +< 3 -3 0 >: -0.000699853346302969 -0.019823414171389764 +< 3 -2 -1 >: -0.001212181553643839 -0.034335160524327980 +< 4 -3 -1 >: 0.001399706692605938 0.039646828342779543 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.004087506620450706 -0.024883374261687737 +< 1 -1 0 >: -0.008175013240901408 0.049766748523375461 +< 2 -2 0 >: 0.008175013240901408 -0.049766748523375461 +< 3 -3 0 >: -0.008175013240901408 0.049766748523375461 +< 4 -4 0 >: 0.008175013240901410 -0.049766748523375468 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 2 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.001167370367493290 0.009436401675653811 +< 0 1 -1 >: -0.000639395083239171 -0.005168530059435140 +< 0 2 -2 >: -0.002712723595294528 -0.021928215922758586 +< 1 -3 2 >: 0.002269627395218733 0.018346461715780141 +< 1 -2 1 >: 0.001819750308973858 0.014709894428574443 +< 1 -1 0 >: -0.001984529624738593 -0.016041882848611477 +< 1 0 -1 >: -0.000639395083239171 -0.005168530059435140 +< 1 1 -2 >: 0.002859461741203844 0.023114369113296007 +< 2 -4 2 >: -0.001513084930145822 -0.012230974477186761 +< 2 -3 1 >: -0.002674781536543210 -0.021621512483345859 +< 2 -2 0 >: 0.000933896293994632 0.007549121340523051 +< 2 -1 -1 >: 0.001819750308973858 0.014709894428574443 +< 2 0 -2 >: -0.002712723595294528 -0.021928215922758586 +< 3 -4 1 >: 0.002830722702848224 0.022882058000004694 +< 3 -3 0 >: 0.000817159257245303 0.006605481172957665 +< 3 -2 -1 >: -0.002674781536543210 -0.021621512483345859 +< 3 -1 -2 >: 0.002269627395218733 0.018346461715780141 +< 4 -4 0 >: -0.003268637028981213 -0.026421924691830669 +< 4 -3 -1 >: 0.002830722702848224 0.022882058000004694 +< 4 -2 -2 >: -0.001513084930145822 -0.012230974477186761 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.245281708527948977 0.559268363567744231 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.145119885809440269 -0.061365845190963948 +< 1 -1 >: 0.290239771618880482 0.122731690381927869 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.090566246377035614 -0.084976941526146571 +< 1 -1 >: 0.181132492754071256 0.169953883052293142 +< 2 -2 >: -0.181132492754071284 -0.169953883052293198 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.051110005163533430 -0.022849868411288696 +< 1 -1 >: 0.102220010327066860 0.045699736822577393 +< 2 -2 >: -0.102220010327066846 -0.045699736822577386 +< 3 -3 >: 0.102220010327066846 0.045699736822577386 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.008081311756303928 0.040428258540914440 +< 1 -1 >: -0.016162623512607849 -0.080856517081828852 +< 2 -2 >: 0.016162623512607849 0.080856517081828852 +< 3 -3 >: -0.016162623512607849 -0.080856517081828852 +< 4 -4 >: 0.016162623512607853 0.080856517081828866 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000042027964679000 0.000652235133231223 +< 1 -1 >: -0.000084055929358001 -0.001304470266462445 +< 2 -2 >: 0.000084055929358001 0.001304470266462445 +< 3 -3 >: -0.000084055929358001 -0.001304470266462446 +< 4 -4 >: 0.000084055929358001 0.001304470266462445 +< 5 -5 >: -0.000084055929358001 -0.001304470266462444 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 3 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.011536460262933116 0.013132408814001066 +< 1 -1 >: 0.023072920525866240 -0.026264817628002136 +< 2 -2 >: -0.023072920525866229 0.026264817628002125 +< 3 -3 >: 0.023072920525866240 -0.026264817628002136 +< 4 -4 >: -0.023072920525866226 0.026264817628002122 +< 5 -5 >: 0.023072920525866229 -0.026264817628002125 +< 6 -6 >: -0.023072920525866215 0.026264817628002111 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.005191241746347684 -0.155144029183842513 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.049017226878351014 -0.126224630147017125 +< 1 -1 0 >: 0.098034453756702014 0.252449260294034195 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.006085618806556616 -0.014309749310589969 +< 0 1 -1 >: 0.006085618806556615 -0.014309749310589965 +< 1 -1 0 >: -0.010540600968452734 0.024785212849515542 +< 1 0 -1 >: -0.010540600968452734 0.024785212849515542 +< 2 -1 -1 >: 0.014906660845148835 -0.035051584158088782 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.007027679783514151 0.021483606466834285 +< 1 -1 0 >: -0.014055359567028304 -0.042967212933668578 +< 2 -2 0 >: 0.014055359567028308 0.042967212933668592 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 2 2 2 ) +num_ms=10 +< 0 0 0 >: -0.032375079188961889 -0.054437665386157477 +< 0 1 -1 >: 0.032375079188961889 0.054437665386157477 +< 0 2 -2 >: 0.064750158377923819 0.108875330772315024 +< 1 -2 1 >: -0.079302424395155294 -0.133344502984455632 +< 1 -1 0 >: 0.032375079188961889 0.054437665386157477 +< 1 0 -1 >: 0.032375079188961889 0.054437665386157477 +< 1 1 -2 >: -0.079302424395155294 -0.133344502984455632 +< 2 -2 0 >: 0.064750158377923778 0.108875330772314954 +< 2 -1 -1 >: -0.079302424395155294 -0.133344502984455632 +< 2 0 -2 >: 0.064750158377923819 0.108875330772315024 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.016301924233295455 0.035769565686963475 +< 0 1 -1 >: -0.018823840688804019 0.041303136756328712 +< 1 -2 1 >: 0.010867949488863632 -0.023846377124642309 +< 1 -1 0 >: 0.030739203124673396 -0.067447739886265387 +< 1 0 -1 >: 0.026620930798057146 -0.058411456169350749 +< 2 -2 0 >: -0.024301473833133178 0.053322120267796189 +< 2 -1 -1 >: -0.034367473880471823 0.075408865657206656 +< 3 -2 -1 >: 0.042091387377792257 -0.092356621471121184 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.005810194013240329 0.019740242534463631 +< 1 -1 0 >: 0.011620388026480659 -0.039480485068927262 +< 2 -2 0 >: -0.011620388026480657 0.039480485068927255 +< 3 -3 0 >: 0.011620388026480657 -0.039480485068927255 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.030395364395211857 0.083940308665567717 +< 0 1 -1 >: -0.040527152526949155 0.111920411554090327 +< 0 2 -2 >: -0.010131788131737287 0.027980102888522575 +< 1 -2 1 >: 0.022655366996190168 -0.062565412076174706 +< 1 -1 0 >: 0.055494089076156355 -0.153253335133592711 +< 1 0 -1 >: 0.055494089076156362 -0.153253335133592739 +< 1 1 -2 >: 0.022655366996190168 -0.062565412076174706 +< 2 -2 0 >: -0.039240246701520459 0.108366472512417947 +< 2 -1 -1 >: -0.064079054533103891 0.176961708587175387 +< 2 0 -2 >: -0.039240246701520473 0.108366472512417988 +< 3 -2 -1 >: 0.059940466932819618 -0.165532521027835638 +< 3 -1 -2 >: 0.059940466932819611 -0.165532521027835638 +< 4 -2 -2 >: -0.084768621271369513 0.234098336251374661 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000060364084857908 -0.033485278125448638 +< 0 1 -1 >: -0.000073930603345969 -0.041010922651264187 +< 1 -2 1 >: 0.000052276830963148 0.028999101509425890 +< 1 -1 0 >: 0.000116894547681864 0.064843962261493054 +< 1 0 -1 >: 0.000095443998511335 0.052944873480315562 +< 2 -3 1 >: -0.000030182042428954 -0.016742639062724322 +< 2 -2 0 >: -0.000104553661926296 -0.057998203018851800 +< 2 -1 -1 >: -0.000116894547681864 -0.064843962261493068 +< 3 -3 0 >: 0.000079854178327012 0.044296859250884099 +< 3 -2 -1 >: 0.000138311494059050 0.076724410838258719 +< 4 -3 -1 >: -0.000159708356654024 -0.088593718501768226 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000233797391050202 0.009216789555698943 +< 0 1 -1 >: -0.000077932463683401 -0.003072263185232983 +< 0 2 -2 >: -0.000545527245783804 -0.021505842296630866 +< 0 3 -3 >: -0.000233797391050202 -0.009216789555698943 +< 1 -3 2 >: 0.000426853683213507 0.016827478491447757 +< 1 -2 1 >: 0.000440852588360856 0.017379345054944186 +< 1 -1 0 >: -0.000301831133974725 -0.011898824151573490 +< 1 0 -1 >: -0.000301831133974725 -0.011898824151573485 +< 1 1 -2 >: 0.000440852588360855 0.017379345054944182 +< 1 2 -3 >: 0.000426853683213507 0.016827478491447761 +< 2 -3 1 >: -0.000572684311266937 -0.022576431478075691 +< 2 -2 0 >: -0.000134982986658666 -0.005321315931046913 +< 2 -1 -1 >: 0.000492888177815803 0.019430698473640005 +< 2 0 -2 >: -0.000134982986658666 -0.005321315931046914 +< 2 1 -3 >: -0.000572684311266937 -0.022576431478075688 +< 3 -3 0 >: 0.000618569753894552 0.024385333050796903 +< 3 -2 -1 >: -0.000291596578410488 -0.011495356241140623 +< 3 -1 -2 >: -0.000291596578410488 -0.011495356241140621 +< 3 0 -3 >: 0.000618569753894553 0.024385333050796907 +< 4 -3 -1 >: -0.000505060089120207 -0.019910541060759547 +< 4 -2 -2 >: 0.000652029771332198 0.025704397980766888 +< 4 -1 -3 >: -0.000505060089120207 -0.019910541060759547 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.000558486550436971 0.001763741065189403 +< 1 -1 0 >: -0.001116973100873941 -0.003527482130378805 +< 2 -2 0 >: 0.001116973100873941 0.003527482130378805 +< 3 -3 0 >: -0.001116973100873941 -0.003527482130378805 +< 4 -4 0 >: 0.001116973100873941 0.003527482130378806 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.000216751494657636 -0.018274738668965874 +< 0 1 -1 >: 0.000118719682996948 0.010009486601504544 +< 0 2 -2 >: 0.000503684957444755 0.042466655112718528 +< 1 -3 2 >: -0.000421413069860543 -0.035530152793420526 +< 1 -2 1 >: -0.000337882141227168 -0.028487498282723286 +< 1 -1 0 >: 0.000368477540917981 0.031067055737241982 +< 1 0 -1 >: 0.000118719682996948 0.010009486601504544 +< 1 1 -2 >: -0.000530930562896803 -0.044763784921675029 +< 2 -4 2 >: 0.000280942046573695 0.023686768528947015 +< 2 -3 1 >: 0.000496640065631717 0.041872686628036337 +< 2 -2 0 >: -0.000173401195726109 -0.014619790935172704 +< 2 -1 -1 >: -0.000337882141227168 -0.028487498282723286 +< 2 0 -2 >: 0.000503684957444755 0.042466655112718528 +< 3 -4 1 >: -0.000525594441908928 -0.044313886217569563 +< 3 -3 0 >: -0.000151726046260345 -0.012792317068276108 +< 3 -2 -1 >: 0.000496640065631717 0.041872686628036337 +< 3 -1 -2 >: -0.000421413069860543 -0.035530152793420526 +< 4 -4 0 >: 0.000606904185041381 0.051169268273104446 +< 4 -3 -1 >: -0.000525594441908928 -0.044313886217569563 +< 4 -2 -2 >: 0.000280942046573695 0.023686768528947015 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 1 ) +l=( 4 4 4 ) +num_ms=31 +< 0 0 0 >: -0.000325122105032178 0.005743213611392538 +< 0 1 -1 >: 0.000325122105032178 -0.005743213611392535 +< 0 2 -2 >: 0.000397371461705995 -0.007019483302813096 +< 0 3 -3 >: -0.000758618245075082 0.013400831759915913 +< 0 4 -4 >: -0.000505745496716721 0.008933887839943946 +< 1 -4 3 >: 0.000799653842999024 -0.014125716967352335 +< 1 -3 2 >: 0.000302240743358929 -0.005339019169442825 +< 1 -2 1 >: -0.000685417579713449 0.012107757400587716 +< 1 -1 0 >: 0.000325122105032178 -0.005743213611392537 +< 1 0 -1 >: 0.000325122105032178 -0.005743213611392535 +< 1 1 -2 >: -0.000685417579713449 0.012107757400587714 +< 1 2 -3 >: 0.000302240743358929 -0.005339019169442825 +< 1 3 -4 >: 0.000799653842999024 -0.014125716967352337 +< 2 -4 2 >: -0.000906722230076788 0.016017057508328471 +< 2 -3 1 >: 0.000302240743358929 -0.005339019169442823 +< 2 -2 0 >: 0.000397371461705995 -0.007019483302813102 +< 2 -1 -1 >: -0.000685417579713449 0.012107757400587716 +< 2 0 -2 >: 0.000397371461705995 -0.007019483302813096 +< 2 1 -3 >: 0.000302240743358929 -0.005339019169442825 +< 2 2 -4 >: -0.000906722230076788 0.016017057508328474 +< 3 -4 1 >: 0.000799653842999024 -0.014125716967352328 +< 3 -3 0 >: -0.000758618245075082 0.013400831759915919 +< 3 -2 -1 >: 0.000302240743358929 -0.005339019169442823 +< 3 -1 -2 >: 0.000302240743358929 -0.005339019169442825 +< 3 0 -3 >: -0.000758618245075082 0.013400831759915913 +< 3 1 -4 >: 0.000799653842999024 -0.014125716967352337 +< 4 -4 0 >: -0.000505745496716721 0.008933887839943944 +< 4 -3 -1 >: 0.000799653842999024 -0.014125716967352328 +< 4 -2 -2 >: -0.000906722230076788 0.016017057508328471 +< 4 -1 -3 >: 0.000799653842999024 -0.014125716967352335 +< 4 0 -4 >: -0.000505745496716721 0.008933887839943946 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.018778803118206799 0.097831166433084232 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.080195260248957248 0.231864109412112884 +< 1 -1 0 >: -0.160390520497914441 -0.463728218824225658 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.003623467502519982 0.019712479171376876 +< 0 1 -1 >: -0.003623467502519981 0.019712479171376873 +< 1 -1 0 >: 0.006276029813939318 -0.034143015467967990 +< 1 0 -1 >: 0.006276029813939318 -0.034143015467967990 +< 2 -1 -1 >: -0.008875646480730874 0.048285515535114697 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.033924763634886182 0.146941163170304895 +< 1 -1 0 >: -0.067849527269772378 -0.293882326340609790 +< 2 -2 0 >: 0.067849527269772392 0.293882326340609901 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 2 2 2 ) +num_ms=10 +< 0 0 0 >: 0.039246049473245823 0.031493586671176986 +< 0 1 -1 >: -0.039246049473245823 -0.031493586671176986 +< 0 2 -2 >: -0.078492098946491701 -0.062987173342354014 +< 1 -2 1 >: 0.096132795629476825 0.077143217514501067 +< 1 -1 0 >: -0.039246049473245823 -0.031493586671176986 +< 1 0 -1 >: -0.039246049473245823 -0.031493586671176986 +< 1 1 -2 >: 0.096132795629476825 0.077143217514501067 +< 2 -2 0 >: -0.078492098946491645 -0.062987173342353972 +< 2 -1 -1 >: 0.096132795629476825 0.077143217514501067 +< 2 0 -2 >: -0.078492098946491701 -0.062987173342354014 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.000626888692694647 0.032468049842558626 +< 0 1 -1 >: 0.000723868710958374 0.037490874633326801 +< 1 -2 1 >: -0.000417925795129765 -0.021645366561705744 +< 1 -1 0 >: -0.001182072655076146 -0.061222341908202721 +< 1 0 -1 >: -0.001023704948414863 -0.053020103371680199 +< 2 -2 0 >: 0.000934510487460805 0.048400511029874950 +< 2 -1 -1 >: 0.001321597405546962 0.068448659124237726 +< 3 -2 -1 >: -0.001618619644488072 -0.083832144216041252 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.012528122968272454 -0.115052983924417720 +< 1 -1 0 >: -0.025056245936544909 0.230105967848835441 +< 2 -2 0 >: 0.025056245936544905 -0.230105967848835413 +< 3 -3 0 >: -0.025056245936544905 0.230105967848835413 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.039041347200888643 -0.011178525647991046 +< 0 1 -1 >: 0.052055129601184878 -0.014904700863988067 +< 0 2 -2 >: 0.013013782400296216 -0.003726175215997016 +< 1 -2 1 >: -0.029099702091452719 0.008331981079044289 +< 1 -1 0 >: -0.071279421791059630 0.020409102190182504 +< 1 0 -1 >: -0.071279421791059644 0.020409102190182507 +< 1 1 -2 >: -0.029099702091452719 0.008331981079044289 +< 2 -2 0 >: 0.050402162507514413 -0.014431414556607262 +< 2 -1 -1 >: 0.082306386717498320 -0.023566401286840899 +< 2 0 -2 >: 0.050402162507514434 -0.014431414556607267 +< 3 -2 -1 >: -0.076990574960050073 0.022044349863646801 +< 3 -1 -2 >: -0.076990574960050059 0.022044349863646798 +< 4 -2 -2 >: 0.108881115283405189 -0.031175418550866783 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000437096148983159 0.014621722902882639 +< 0 1 -1 >: -0.000535331266772138 0.017907880136214450 +< 1 -2 1 >: 0.000378536368915764 -0.012662783480993112 +< 1 -1 0 >: 0.000846433052851586 -0.028314844647862016 +< 1 0 -1 >: 0.000691109693637537 -0.023118973844479050 +< 2 -3 1 >: -0.000218548074491580 0.007310861451441321 +< 2 -2 0 >: -0.000757072737831527 0.025325566961986231 +< 2 -1 -1 >: -0.000846433052851586 0.028314844647862020 +< 3 -3 0 >: 0.000578223854616738 -0.019342721270162445 +< 3 -2 -1 >: 0.001001513094344511 -0.033502575996564574 +< 4 -3 -1 >: -0.001156447709233477 0.038685442540324903 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000448111692132453 0.025490836760937236 +< 0 1 -1 >: 0.000149370564044151 -0.008496945586979086 +< 0 2 -2 >: 0.001045593948309058 -0.059478619108853555 +< 0 3 -3 >: 0.000448111692132453 -0.025490836760937236 +< 1 -3 2 >: -0.000818136273542517 0.046539687678824153 +< 1 -2 1 >: -0.000844967509962230 0.048065982751408137 +< 1 -1 0 >: 0.000578509706956606 -0.032908528752000586 +< 1 0 -1 >: 0.000578509706956606 -0.032908528752000572 +< 1 1 -2 >: -0.000844967509962230 0.048065982751408130 +< 1 2 -3 >: -0.000818136273542517 0.046539687678824160 +< 2 -3 1 >: 0.001097644993499658 -0.062439543180876148 +< 2 -2 0 >: 0.000258717406079691 -0.014717141465795915 +< 2 -1 -1 >: -0.000944702395527139 0.053739402418740478 +< 2 0 -2 >: 0.000258717406079691 -0.014717141465795919 +< 2 1 -3 >: 0.001097644993499658 -0.062439543180876141 +< 3 -3 0 >: -0.001185592096962811 0.067442414780383153 +< 3 -2 -1 >: 0.000558893474322388 -0.031792659220536520 +< 3 -1 -2 >: 0.000558893474322388 -0.031792659220536514 +< 3 0 -3 >: -0.001185592096962811 0.067442414780383167 +< 4 -3 -1 >: 0.000968031893545068 -0.055066501077692384 +< 4 -2 -2 >: -0.001249723800765893 0.071090547202605103 +< 4 -1 -3 >: 0.000968031893545068 -0.055066501077692384 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.002688524825348421 -0.031280983902182924 +< 1 -1 0 >: 0.005377049650696841 0.062561967804365820 +< 2 -2 0 >: -0.005377049650696841 -0.062561967804365820 +< 3 -3 0 >: 0.005377049650696841 0.062561967804365820 +< 4 -4 0 >: -0.005377049650696842 -0.062561967804365834 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: 0.000415328282348928 -0.007188021197386673 +< 0 1 -1 >: -0.000227484669012383 0.003937041353633975 +< 0 2 -2 >: -0.000965135712447799 0.016703451833798691 +< 1 -3 2 >: 0.000807490470785560 -0.013975110454476670 +< 1 -2 1 >: 0.000647432718163791 -0.011205016127780219 +< 1 -1 0 >: -0.000706058079993178 0.012219636035557343 +< 1 0 -1 >: -0.000227484669012383 0.003937041353633975 +< 1 1 -2 >: 0.001017342367501456 -0.017606984193906716 +< 2 -4 2 >: -0.000538326980523707 0.009316740302984447 +< 2 -3 1 >: -0.000951636646059978 0.016469825616985775 +< 2 -2 0 >: 0.000332262625879143 -0.005750416957909340 +< 2 -1 -1 >: 0.000647432718163791 -0.011205016127780219 +< 2 0 -2 >: -0.000965135712447799 0.016703451833798691 +< 3 -4 1 >: 0.001007117561588119 -0.017430025087658122 +< 3 -3 0 >: 0.000290729797644250 -0.005031614838170669 +< 3 -2 -1 >: -0.000951636646059978 0.016469825616985775 +< 3 -1 -2 >: 0.000807490470785560 -0.013975110454476670 +< 4 -4 0 >: -0.001162919190577000 0.020126459352682684 +< 4 -3 -1 >: 0.001007117561588119 -0.017430025087658122 +< 4 -2 -2 >: -0.000538326980523707 0.009316740302984447 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 2 ) +l=( 4 4 4 ) +num_ms=31 +< 0 0 0 >: 0.000303706996230653 -0.002598029442864748 +< 0 1 -1 >: -0.000303706996230653 0.002598029442864747 +< 0 2 -2 >: -0.000371197439837464 0.003175369319056911 +< 0 3 -3 >: 0.000708649657871523 -0.006062068700017741 +< 0 4 -4 >: 0.000472433105247682 -0.004041379133345162 +< 1 -4 3 >: -0.000746982327324361 0.006389981474824025 +< 1 -3 2 >: -0.000282332781694358 0.002415185980670587 +< 1 -2 1 >: 0.000640270566278024 -0.005477126978420593 +< 1 -1 0 >: -0.000303706996230653 0.002598029442864747 +< 1 0 -1 >: -0.000303706996230653 0.002598029442864747 +< 1 1 -2 >: 0.000640270566278024 -0.005477126978420592 +< 1 2 -3 >: -0.000282332781694358 0.002415185980670587 +< 1 3 -4 >: -0.000746982327324361 0.006389981474824026 +< 2 -4 2 >: 0.000846998345083074 -0.007245557942011760 +< 2 -3 1 >: -0.000282332781694358 0.002415185980670586 +< 2 -2 0 >: -0.000371197439837465 0.003175369319056914 +< 2 -1 -1 >: 0.000640270566278024 -0.005477126978420593 +< 2 0 -2 >: -0.000371197439837464 0.003175369319056911 +< 2 1 -3 >: -0.000282332781694358 0.002415185980670587 +< 2 2 -4 >: 0.000846998345083074 -0.007245557942011761 +< 3 -4 1 >: -0.000746982327324361 0.006389981474824022 +< 3 -3 0 >: 0.000708649657871523 -0.006062068700017744 +< 3 -2 -1 >: -0.000282332781694358 0.002415185980670586 +< 3 -1 -2 >: -0.000282332781694358 0.002415185980670587 +< 3 0 -3 >: 0.000708649657871523 -0.006062068700017741 +< 3 1 -4 >: -0.000746982327324361 0.006389981474824026 +< 4 -4 0 >: 0.000472433105247682 -0.004041379133345162 +< 4 -3 -1 >: -0.000746982327324361 0.006389981474824022 +< 4 -2 -2 >: 0.000846998345083074 -0.007245557942011760 +< 4 -1 -3 >: -0.000746982327324361 0.006389981474824025 +< 4 0 -4 >: 0.000472433105247682 -0.004041379133345162 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.002178592250819812 -0.198859745376887886 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.144434674241241234 0.026404400773172472 +< 1 -1 0 >: 0.288869348482482413 -0.052808801546344930 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.066933773019674625 -0.060517553976457361 +< 1 -1 0 >: 0.133867546039349278 0.121035107952914736 +< 2 -2 0 >: -0.133867546039349306 -0.121035107952914764 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.008216152462939682 0.080644103798288486 +< 0 1 -1 >: 0.009487195672362459 0.093119790072995909 +< 1 -2 1 >: -0.005477434975293119 -0.053762735865525636 +< 1 -1 0 >: -0.015492525658152539 -0.152063980422617595 +< 1 0 -1 >: -0.013416920788742326 -0.131691270046566333 +< 2 -2 0 >: 0.012247916947090298 0.120217132051681344 +< 2 -1 -1 >: 0.017321170257394370 0.170012698577085036 +< 3 -2 -1 >: -0.021214014439244287 -0.208222180653728994 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.014229741031922949 0.121632073985388084 +< 1 -1 0 >: 0.028459482063845899 -0.243264147970776168 +< 2 -2 0 >: -0.028459482063845895 0.243264147970776112 +< 3 -3 0 >: 0.028459482063845895 -0.243264147970776112 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000098084456858408 0.018122032281549901 +< 0 1 -1 >: -0.000120128435500565 0.022194866096021060 +< 1 -2 1 >: 0.000084943631355780 -0.015694140324023886 +< 1 -1 0 >: 0.000189939733967207 -0.035093164612937988 +< 1 0 -1 >: 0.000155085143366546 -0.028653448920397725 +< 2 -3 1 >: -0.000049042228429204 0.009061016140774954 +< 2 -2 0 >: -0.000169887262711560 0.031388280648047787 +< 2 -1 -1 >: -0.000189939733967207 0.035093164612937995 +< 3 -3 0 >: 0.000129753540164096 -0.023973195334032745 +< 3 -2 -1 >: 0.000224739724026143 -0.041522792338317870 +< 4 -3 -1 >: -0.000259507080328191 0.047946390668065504 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.003056338219503456 0.047063152839364790 +< 1 -1 0 >: -0.006112676439006910 -0.094126305678729552 +< 2 -2 0 >: 0.006112676439006910 0.094126305678729552 +< 3 -3 0 >: -0.006112676439006910 -0.094126305678729552 +< 4 -4 0 >: 0.006112676439006912 0.094126305678729566 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 3 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.000321265665724485 0.015693481158689460 +< 0 1 -1 >: 0.000175964452069215 -0.008595673636396527 +< 0 2 -2 >: 0.000746553943835503 -0.036468354702974493 +< 1 -3 2 >: -0.000624611842458531 0.030511614613444728 +< 1 -2 1 >: -0.000500803610186023 0.024463716043027536 +< 1 -1 0 >: 0.000546151631731625 -0.026678917969772075 +< 1 0 -1 >: 0.000175964452069215 -0.008595673636396527 +< 1 1 -2 >: -0.000786936952900536 0.038441021126770898 +< 2 -4 2 >: 0.000416407894972354 -0.020341076408963151 +< 2 -3 1 >: 0.000736112115686417 -0.035958282663528865 +< 2 -2 0 >: -0.000257012532579588 0.012554784926951570 +< 2 -1 -1 >: -0.000500803610186023 0.024463716043027536 +< 2 0 -2 >: 0.000746553943835503 -0.036468354702974493 +< 3 -4 1 >: -0.000779027838067147 0.038054669400265070 +< 3 -3 0 >: -0.000224885966007140 0.010985436811082617 +< 3 -2 -1 >: 0.000736112115686417 -0.035958282663528865 +< 3 -1 -2 >: -0.000624611842458531 0.030511614613444728 +< 4 -4 0 >: 0.000899543864028559 -0.043941747244330483 +< 4 -3 -1 >: -0.000779027838067147 0.038054669400265070 +< 4 -2 -2 >: 0.000416407894972354 -0.020341076408963151 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.105451860684968465 0.081293634195520742 +< 1 -1 0 >: -0.210903721369936875 -0.162587268391041456 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.030457193645041694 -0.051104929393587219 +< 1 -1 0 >: -0.060914387290083395 0.102209858787174451 +< 2 -2 0 >: 0.060914387290083409 -0.102209858787174479 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.007340629660088890 -0.092579558798564845 +< 0 1 -1 >: -0.008476229020547340 -0.106901666387616348 +< 1 -2 1 >: 0.004893753106725926 0.061719705865709878 +< 1 -1 0 >: 0.013841624028874549 0.174569690201930389 +< 1 0 -1 >: 0.011987198038638465 0.151181786445651084 +< 2 -2 0 >: -0.010942764611739954 -0.138009457867019819 +< 2 -1 -1 >: -0.015475406123778998 -0.195174847051297645 +< 3 -2 -1 >: 0.018953424282800318 0.239039392950714580 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.006013331113252285 -0.048220230959381494 +< 1 -1 0 >: -0.012026662226504571 0.096440461918762987 +< 2 -2 0 >: 0.012026662226504569 -0.096440461918762974 +< 3 -3 0 >: -0.012026662226504569 0.096440461918762974 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000113806136745823 -0.008979004277503451 +< 0 1 -1 >: 0.000139383482312336 -0.010996989439075493 +< 1 -2 1 >: -0.000098559005528448 0.007776045805007128 +< 1 -1 0 >: -0.000220384636156388 0.017387767016148015 +< 1 0 -1 >: -0.000179943301910691 0.014197052318652740 +< 2 -3 1 >: 0.000056903068372911 -0.004489502138751727 +< 2 -2 0 >: 0.000197118011056896 -0.015552091610014264 +< 2 -1 -1 >: 0.000220384636156388 -0.017387767016148019 +< 3 -3 0 >: -0.000150551367751228 0.011878106169629662 +< 3 -2 -1 >: -0.000260762618094114 0.020573483383495926 +< 4 -3 -1 >: 0.000301102735502457 -0.023756212339259331 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.000810472149903069 -0.033694185263296240 +< 1 -1 0 >: 0.001620944299806138 0.067388370526592467 +< 2 -2 0 >: -0.001620944299806138 -0.067388370526592467 +< 3 -3 0 >: 0.001620944299806138 0.067388370526592467 +< 4 -4 0 >: -0.001620944299806138 -0.067388370526592467 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 3 4 ) +l=( 4 4 2 ) +num_ms=20 +< 0 0 0 >: -0.000093237885069566 0.004741555114419998 +< 0 1 -1 >: 0.000051068492866675 -0.002597056693821822 +< 0 2 -2 >: 0.000216665265666018 -0.011018378395963953 +< 1 -3 2 >: -0.000181275166921143 0.009218636761129689 +< 1 -2 1 >: -0.000145343478717680 0.007391352928557148 +< 1 -1 0 >: 0.000158504404618262 -0.008060643694513994 +< 1 0 -1 >: 0.000051068492866675 -0.002597056693821822 +< 1 1 -2 >: -0.000228385243116698 0.011614390617612904 +< 2 -4 2 >: 0.000120850111280762 -0.006145757840753126 +< 2 -3 1 >: 0.000213634832984439 -0.010864267611817319 +< 2 -2 0 >: -0.000074590308055653 0.003793244091535999 +< 2 -1 -1 >: -0.000145343478717680 0.007391352928557148 +< 2 0 -2 >: 0.000216665265666018 -0.011018378395963953 +< 3 -4 1 >: -0.000226089855783058 0.011497660111088900 +< 3 -3 0 >: -0.000065266519548696 0.003319088580093997 +< 3 -2 -1 >: 0.000213634832984439 -0.010864267611817319 +< 3 -1 -2 >: -0.000181275166921143 0.009218636761129689 +< 4 -4 0 >: 0.000261066078194784 -0.013276354320375992 +< 4 -3 -1 >: -0.000226089855783058 0.011497660111088900 +< 4 -2 -2 >: 0.000120850111280762 -0.006145757840753126 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.054250151605964823 0.208595392086789289 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.103192119057310613 -0.093246219760853732 +< 1 -1 >: -0.206384238114621199 0.186492439521707437 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.044390859739626594 0.169408665353573712 +< 1 -1 >: -0.088781719479253202 -0.338817330707147479 +< 2 -2 >: 0.088781719479253215 0.338817330707147590 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.011637781623393110 -0.226875186972397141 +< 1 -1 >: -0.023275563246786219 0.453750373944794283 +< 2 -2 >: 0.023275563246786216 -0.453750373944794172 +< 3 -3 >: -0.023275563246786216 0.453750373944794172 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.002673631050075407 -0.052584537499551505 +< 1 -1 >: 0.005347262100150813 0.105169074999102968 +< 2 -2 >: -0.005347262100150813 -0.105169074999102968 +< 3 -3 >: 0.005347262100150813 0.105169074999102968 +< 4 -4 >: -0.005347262100150814 -0.105169074999102996 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000756246807439673 -0.017237829886004301 +< 1 -1 >: -0.001512493614879346 0.034475659772008602 +< 2 -2 >: 0.001512493614879346 -0.034475659772008609 +< 3 -3 >: -0.001512493614879346 0.034475659772008616 +< 4 -4 >: 0.001512493614879346 -0.034475659772008609 +< 5 -5 >: -0.001512493614879344 0.034475659772008567 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 4 4 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.010487613030069814 -0.003629149816459060 +< 1 -1 >: -0.020975226060139636 0.007258299632918121 +< 2 -2 >: 0.020975226060139626 -0.007258299632918118 +< 3 -3 >: -0.020975226060139636 0.007258299632918121 +< 4 -4 >: 0.020975226060139622 -0.007258299632918117 +< 5 -5 >: -0.020975226060139626 0.007258299632918118 +< 6 -6 >: 0.020975226060139615 -0.007258299632918114 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.001213408047735315 0.035697451364269411 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.018657268269850258 0.028650874808118284 +< 1 -1 0 >: -0.037314536539700509 -0.057301749616236554 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.018430445854120365 0.003240291627703445 +< 0 1 -1 >: -0.018430445854120361 0.003240291627703444 +< 1 -1 0 >: 0.031922468625483646 -0.005612349730522423 +< 1 0 -1 >: 0.031922468625483646 -0.005612349730522423 +< 2 -1 -1 >: -0.045145188074588581 0.007937061105685796 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.002825899779315056 0.010538572521290751 +< 1 -1 0 >: 0.005651799558630113 -0.021077145042581506 +< 2 -2 0 >: -0.005651799558630114 0.021077145042581513 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.000633670587875195 0.057629644903303641 +< 0 1 -1 >: 0.000731699768974584 0.066544981996449773 +< 1 -2 1 >: -0.000422447058583463 -0.038419763268869082 +< 1 -1 0 >: -0.001194860719266710 -0.108667500555996693 +< 1 0 -1 >: -0.001034779736869117 -0.094108816047252714 +< 2 -2 0 >: 0.000944620339887460 0.085909202348640815 +< 2 -1 -1 >: 0.001335894895962328 0.121493959094102377 +< 3 -2 -1 >: -0.001636130422548062 -0.148799103305561398 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.001618336463487219 -0.001267267722437297 +< 1 -1 0 >: 0.003236672926974437 0.002534535444874594 +< 2 -2 0 >: -0.003236672926974437 -0.002534535444874593 +< 3 -3 0 >: 0.003236672926974437 0.002534535444874593 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.000736986042581823 0.070591808985609933 +< 0 1 -1 >: -0.000982648056775764 0.094122411980813281 +< 0 2 -2 >: -0.000245662014193941 0.023530602995203317 +< 1 -2 1 >: 0.000549316963227170 -0.052616027848834769 +< 1 -1 0 >: 0.001345546266961758 -0.128882420521714808 +< 1 0 -1 >: 0.001345546266961758 -0.128882420521714836 +< 1 1 -2 >: 0.000549316963227170 -0.052616027848834769 +< 2 -2 0 >: -0.000951444889768903 0.091133633526640778 +< 2 -1 -1 >: -0.001553702998874934 0.148820600364045208 +< 2 0 -2 >: -0.000951444889768904 0.091133633526640806 +< 3 -2 -1 >: 0.001453356075648306 -0.139208924664065675 +< 3 -1 -2 >: 0.001453356075648306 -0.139208924664065647 +< 4 -2 -2 >: -0.002055355873139172 0.196871149263296047 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000196073051354437 0.040098960077170558 +< 0 1 -1 >: -0.000240139464064447 0.049110995702650720 +< 1 -2 1 >: 0.000169804243470474 -0.034726718092167715 +< 1 -1 0 >: 0.000379693831267904 -0.077651302289558827 +< 1 0 -1 >: 0.000310018715029592 -0.063402022824010071 +< 2 -3 1 >: -0.000098036525677219 0.020049480038585282 +< 2 -2 0 >: -0.000339608486940947 0.069453436184335457 +< 2 -1 -1 >: -0.000379693831267904 0.077651302289558841 +< 3 -3 0 >: 0.000259380266342719 -0.053045938098250339 +< 3 -2 -1 >: 0.000449259799786336 -0.091878259921323202 +< 4 -3 -1 >: -0.000518760532685437 0.106091876196500706 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.001238384706671072 0.007037363188932728 +< 0 1 -1 >: -0.000412794902223691 -0.002345787729644244 +< 0 2 -2 >: -0.002889564315565836 -0.016420514107509696 +< 0 3 -3 >: -0.001238384706671072 -0.007037363188932728 +< 1 -3 2 >: 0.002260970795710549 0.012848408546449815 +< 1 -2 1 >: 0.002335120596812877 0.013269779286845118 +< 1 -1 0 >: -0.001598747781711674 -0.009085196810649860 +< 1 0 -1 >: -0.001598747781711673 -0.009085196810649857 +< 1 1 -2 >: 0.002335120596812877 0.013269779286845116 +< 1 2 -3 >: 0.002260970795710549 0.012848408546449816 +< 2 -3 1 >: -0.003033410636610348 -0.017237948947530637 +< 2 -2 0 >: -0.000714981743756859 -0.004063023531515472 +< 2 -1 -1 >: 0.002610744195066736 0.014836064265902182 +< 2 0 -2 >: -0.000714981743756859 -0.004063023531515472 +< 2 1 -3 >: -0.003033410636610347 -0.017237948947530633 +< 3 -3 0 >: 0.003276457961277329 0.018619112883556454 +< 3 -2 -1 >: -0.001544537095127900 -0.008777133986427054 +< 3 -1 -2 >: -0.001544537095127900 -0.008777133986427054 +< 3 0 -3 >: 0.003276457961277329 0.018619112883556454 +< 4 -3 -1 >: -0.002675216722936367 -0.015202442009331218 +< 4 -2 -2 >: 0.003453689938476042 0.019626268241274603 +< 4 -1 -3 >: -0.002675216722936367 -0.015202442009331218 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 1 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.000356821089702680 0.020718344046613824 +< 1 -1 0 >: 0.000713642179405360 -0.041436688093227633 +< 2 -2 0 >: -0.000713642179405360 0.041436688093227633 +< 3 -3 0 >: 0.000713642179405360 -0.041436688093227633 +< 4 -4 0 >: -0.000713642179405360 0.041436688093227640 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.001741909027330715 0.001028033309054385 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.026292349867263188 -0.145147277541537695 +< 1 -1 0 >: 0.052584699734526362 0.290294555083075334 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: 0.007695818301156227 0.021265540175698535 +< 0 1 -1 >: 0.007695818301156226 0.021265540175698535 +< 1 -1 0 >: -0.013329548303420990 -0.036832996034707056 +< 1 0 -1 >: -0.013329548303420990 -0.036832996034707056 +< 2 -1 -1 >: 0.018850827991005240 0.052089722535117143 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.013713591503660897 -0.063837175218931175 +< 1 -1 0 >: 0.027427183007321797 0.127674350437862377 +< 2 -2 0 >: -0.027427183007321804 -0.127674350437862405 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.005666625340128594 -0.011330464497213925 +< 0 1 -1 >: 0.006543255331039994 -0.013083293455019908 +< 1 -2 1 >: -0.003777750226752395 0.007553642998142613 +< 1 -1 0 >: -0.010685091211862547 0.021364928746595711 +< 1 0 -1 >: -0.009253560431226816 0.018502571044596301 +< 2 -2 0 >: 0.008447306309033601 -0.016890459221612204 +< 2 -1 -1 >: 0.011946295147755128 -0.023886716505913688 +< 3 -2 -1 >: -0.014631163714343320 0.029255133535002604 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.003440334564960547 0.020755218162560776 +< 1 -1 0 >: -0.006880669129921094 -0.041510436325121552 +< 2 -2 0 >: 0.006880669129921093 0.041510436325121546 +< 3 -3 0 >: -0.006880669129921093 -0.041510436325121546 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: -0.011655980059018163 -0.029947069094655394 +< 0 1 -1 >: -0.015541306745357556 -0.039929425459540542 +< 0 2 -2 >: -0.003885326686339389 -0.009982356364885134 +< 1 -2 1 >: 0.008687854585448877 0.022321227407510850 +< 1 -1 0 >: 0.021280810693848823 0.054675617581028582 +< 1 0 -1 >: 0.021280810693848826 0.054675617581028589 +< 1 1 -2 >: 0.008687854585448877 0.022321227407510850 +< 2 -2 0 >: -0.015047805550767695 -0.038661499957107714 +< 2 -1 -1 >: -0.024572963565334172 -0.063133965057031782 +< 2 0 -2 >: -0.015047805550767700 -0.038661499957107728 +< 3 -2 -1 >: 0.022985902659789888 0.059056416677992732 +< 3 -1 -2 >: 0.022985902659789885 0.059056416677992725 +< 4 -2 -2 >: -0.032506975284862648 -0.083518385411173943 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.001114057647065003 -0.005461004065584623 +< 0 1 -1 >: 0.001364436389677444 -0.006688336721973384 +< 1 -2 1 >: -0.000964802223638611 0.004729368250966384 +< 1 -1 0 >: -0.002157363356898890 0.010575188899790122 +< 1 0 -1 >: -0.001761479804726704 0.008634605579343473 +< 2 -3 1 >: 0.000557028823532502 -0.002730502032792312 +< 2 -2 0 >: 0.001929604447277223 -0.009458736501932772 +< 2 -1 -1 >: 0.002157363356898890 -0.010575188899790124 +< 3 -3 0 >: -0.001473759740161883 0.007224229333124788 +< 3 -2 -1 >: -0.002552626748109889 0.012512732250501564 +< 4 -3 -1 >: 0.002947519480323767 -0.014448458666249581 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: -0.000040013265781497 0.005034179208135279 +< 0 1 -1 >: 0.000013337755260499 -0.001678059736045094 +< 0 2 -2 >: 0.000093364286823494 -0.011746418152315649 +< 0 3 -3 >: 0.000040013265781497 -0.005034179208135279 +< 1 -3 2 >: -0.000073053894226585 0.009191111702730620 +< 1 -2 1 >: -0.000075449737524044 0.009492539348748748 +< 1 -1 0 >: 0.000051656903999703 -0.006499097411643860 +< 1 0 -1 >: 0.000051656903999703 -0.006499097411643858 +< 1 1 -2 >: -0.000075449737524044 0.009492539348748746 +< 1 2 -3 >: -0.000073053894226585 0.009191111702730622 +< 2 -3 1 >: 0.000098012084107035 -0.012331170333659710 +< 2 -2 0 >: 0.000023101669770103 -0.002906484720965719 +< 2 -1 -1 >: -0.000084355370994139 0.010612981631446890 +< 2 0 -2 >: 0.000023101669770103 -0.002906484720965719 +< 2 1 -3 >: 0.000098012084107035 -0.012331170333659708 +< 3 -3 0 >: -0.000105865150401372 0.013319186240058017 +< 3 -2 -1 >: 0.000049905310493429 -0.006278724606821053 +< 3 -1 -2 >: 0.000049905310493429 -0.006278724606821052 +< 3 0 -3 >: -0.000105865150401372 0.013319186240058019 +< 4 -3 -1 >: 0.000086438533342120 -0.010875070025746987 +< 4 -2 -2 >: -0.000111591666701542 0.014039655032852510 +< 4 -1 -3 >: 0.000086438533342120 -0.010875070025746987 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 2 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.000421853567774246 -0.023896840608999721 +< 1 -1 0 >: -0.000843707135548492 0.047793681217999429 +< 2 -2 0 >: 0.000843707135548492 -0.047793681217999429 +< 3 -3 0 >: -0.000843707135548492 0.047793681217999429 +< 4 -4 0 >: 0.000843707135548492 -0.047793681217999436 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: -0.014109861976344697 0.193509596104425502 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: 0.049685918092498657 0.008458786461950975 +< 1 -1 0 >: -0.099371836184997300 -0.016917572923901947 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 2 1 1 ) +num_ms=5 +< 0 0 0 >: -0.012106686397669158 0.038685893459240055 +< 0 1 -1 >: -0.012106686397669156 0.038685893459240048 +< 1 -1 0 >: 0.020969395952066008 -0.067005933007600285 +< 1 0 -1 >: 0.020969395952066008 -0.067005933007600285 +< 2 -1 -1 >: -0.029655204150183224 0.094760699218811348 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: 0.024701085634451905 0.107843322975982550 +< 1 -1 0 >: -0.049402171268903818 -0.215686645951965128 +< 2 -2 0 >: 0.049402171268903824 0.215686645951965184 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: -0.012234782769779649 -0.029335212186955249 +< 0 1 -1 >: -0.014127510251217744 -0.033873385305746795 +< 1 -2 1 >: 0.008156521846519762 0.019556808124636827 +< 1 -1 0 >: 0.023070127634281387 0.055315006573179483 +< 1 0 -1 >: 0.019979316599837066 0.047904200902876622 +< 2 -2 0 >: -0.018238537308780303 -0.043730352389608131 +< 2 -1 -1 >: -0.025793186819924790 -0.061844057436738500 +< 3 -2 -1 >: 0.031590073274548013 0.075743192171692342 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: -0.002867619014356497 0.014286109322940568 +< 1 -1 0 >: 0.005735238028712993 -0.028572218645881137 +< 2 -2 0 >: -0.005735238028712992 0.028572218645881130 +< 3 -3 0 >: 0.005735238028712992 -0.028572218645881130 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 4 2 2 ) +num_ms=13 +< 0 0 0 >: 0.014951251518046636 -0.018095272181581044 +< 0 1 -1 >: 0.019935002024062190 -0.024127029575441401 +< 0 2 -2 >: 0.004983750506015547 -0.006031757393860349 +< 1 -2 1 >: -0.011144004914349736 0.013487419556458715 +< 1 -1 0 >: -0.027297125731225006 0.033037295860158862 +< 1 0 -1 >: -0.027297125731225010 0.033037295860158869 +< 1 1 -2 >: -0.011144004914349736 0.013487419556458715 +< 2 -2 0 >: 0.019301982711450991 -0.023360895934784576 +< 2 -1 -1 >: 0.031520005778051641 -0.038148183316320063 +< 2 0 -2 >: 0.019301982711450998 -0.023360895934784586 +< 3 -2 -1 >: -0.029484265612651068 0.035684357974378855 +< 3 -1 -2 >: -0.029484265612651064 0.035684357974378855 +< 4 -2 -2 >: 0.041697048306021799 -0.050465303011943068 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: -0.000827935056385834 -0.019614086301770382 +< 0 1 -1 >: -0.001014009214153857 -0.024022251605125295 +< 1 -2 1 >: 0.000717012791513834 0.016986297009353522 +< 1 -1 0 >: 0.001603289342561818 0.037982514798915859 +< 1 0 -1 >: 0.001309080266439585 0.031012593468351547 +< 2 -3 1 >: -0.000413967528192917 -0.009807043150885193 +< 2 -2 0 >: -0.001434025583027669 -0.033972594018707059 +< 2 -1 -1 >: -0.001603289342561818 -0.037982514798915866 +< 3 -3 0 >: 0.001095255130454578 0.025946997274121506 +< 3 -2 -1 >: 0.001897037533197809 0.044941517582629625 +< 4 -3 -1 >: -0.002190510260909157 -0.051893994548243033 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 4 3 3 ) +num_ms=22 +< 0 0 0 >: 0.000188613045151763 -0.003056798319884722 +< 0 1 -1 >: -0.000062871015050588 0.001018932773294908 +< 0 2 -2 >: -0.000440097105354114 0.007132529413064352 +< 0 3 -3 >: -0.000188613045151763 0.003056798319884722 +< 1 -3 2 >: 0.000344358731564537 -0.005580924645149182 +< 1 -2 1 >: 0.000355652168658816 -0.005763954188560354 +< 1 -1 0 >: -0.000243498394250082 0.003946309661876115 +< 1 0 -1 >: -0.000243498394250082 0.003946309661876113 +< 1 1 -2 >: 0.000355652168658816 -0.005763954188560353 +< 1 2 -3 >: 0.000344358731564537 -0.005580924645149183 +< 2 -3 1 >: -0.000462005719454344 0.007487596130314481 +< 2 -2 0 >: -0.000108895792391045 0.001764843332843839 +< 2 -1 -1 >: 0.000397631212733167 -0.006444296692407796 +< 2 0 -2 >: -0.000108895792391045 0.001764843332843840 +< 2 1 -3 >: -0.000462005719454344 0.007487596130314480 +< 3 -3 0 >: 0.000499023211494162 -0.008087528162495042 +< 3 -2 -1 >: -0.000235241797878007 0.003812497337824949 +< 3 -1 -2 >: -0.000235241797878007 0.003812497337824948 +< 3 0 -3 >: 0.000499023211494162 -0.008087528162495044 +< 4 -3 -1 >: -0.000407450745988557 0.006603439092833897 +< 4 -2 -2 >: 0.000526016651204489 -0.008525003211413563 +< 4 -1 -3 >: -0.000407450745988557 0.006603439092833897 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 3 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: -0.000151112971668910 0.010079340615102923 +< 1 -1 0 >: 0.000302225943337819 -0.020158681230205838 +< 2 -2 0 >: -0.000302225943337819 0.020158681230205838 +< 3 -3 0 >: 0.000302225943337819 -0.020158681230205838 +< 4 -4 0 >: -0.000302225943337819 0.020158681230205842 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 0 0 0 ) +num_ms=1 +< 0 0 0 >: 0.005541515991558750 -0.060359180371488269 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 1 1 0 ) +num_ms=2 +< 0 0 0 >: -0.039526815180770912 -0.005101713824901174 +< 1 -1 0 >: 0.079053630361541810 0.010203427649802347 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 1 1 2 ) +num_ms=4 +< -1 -1 2 >: -0.004177952841598594 -0.081072442466747066 +< -1 0 1 >: 0.005908517571543944 0.114653747671186163 +< -1 1 0 >: -0.001705642105221264 -0.033097686040779374 +< 0 0 0 >: -0.001705642105221265 -0.033097686040779381 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 2 2 0 ) +num_ms=3 +< 0 0 0 >: -0.009429509908910956 -0.051590743999683941 +< 1 -1 0 >: 0.018859019817821916 0.103181487999367882 +< 2 -2 0 >: -0.018859019817821919 -0.103181487999367910 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 2 2 2 ) +num_ms=5 +< -2 0 2 >: -0.002347060540487584 -0.126608246332323732 +< -2 1 1 >: 0.001916366906538493 0.103375200247597623 +< -1 -1 2 >: 0.000958183453269246 0.051687600123798812 +< -1 0 1 >: -0.001173530270243791 -0.063304123166161852 +< 0 0 0 >: 0.000391176756747930 0.021101374388720614 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 2 2 4 ) +num_ms=9 +< -2 -2 4 >: -0.001504842363776750 -0.051768039787223226 +< -2 -1 3 >: 0.002128168480086666 0.073211063964561091 +< -2 0 2 >: -0.001393213307373752 -0.047927891760836408 +< -2 1 1 >: 0.000804372078050805 0.027671181209810151 +< -2 2 0 >: -0.000179863064572437 -0.006187464220285037 +< -1 -1 2 >: -0.001137553901973678 -0.039132959753797068 +< -1 0 1 >: 0.001970301154566636 0.067780274544124580 +< -1 1 0 >: -0.000719452258289746 -0.024749856881140151 +< 0 0 0 >: -0.000539589193717310 -0.018562392660855107 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 2 3 3 ) +num_ms=12 +< -2 -1 3 >: -0.004223553912545217 0.023819573153742578 +< -2 0 2 >: 0.011946014449070792 -0.067371926807921673 +< -2 1 1 >: -0.006543101586038722 0.036901124055285721 +< -1 -2 3 >: 0.006678025092079245 -0.037662052029413307 +< -1 -1 2 >: -0.005172775993435635 0.029172900058783004 +< -1 0 1 >: 0.003777661462034523 -0.021304873906718983 +< 0 -3 3 >: -0.006678025092079244 0.037662052029413300 +< 0 -1 1 >: 0.004006815055247546 -0.022597231217647975 +< 0 0 0 >: -0.002671210036831698 0.015064820811765321 +< 1 -3 2 >: 0.006678025092079245 -0.037662052029413307 +< 1 -2 1 >: -0.005172775993435635 0.029172900058783004 +< 2 -3 1 >: -0.004223553912545217 0.023819573153742578 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 2 4 4 ) +num_ms=18 +< -2 -2 4 >: 0.000240220309580954 0.004324166557239217 +< -2 -1 3 >: -0.000360330464371431 -0.006486249835858826 +< -2 0 2 >: 0.000861354559662963 0.015505102742217962 +< -2 1 1 >: -0.000453973713584393 -0.008171906670055223 +< -1 -3 4 >: -0.000449411047898350 -0.008089774870267481 +< -1 -2 3 >: 0.000424653524708561 0.007644118739009841 +< -1 -1 2 >: -0.000288907102220368 -0.005200569559457665 +< -1 0 1 >: 0.000203023216714545 0.003654587764005484 +< 0 -4 4 >: 0.000518935178961808 0.009341267398064795 +< 0 -3 3 >: -0.000129733794740452 -0.002335316849516198 +< 0 -2 2 >: -0.000148267193989088 -0.002668933542304228 +< 0 -1 1 >: 0.000315067787226812 0.005671483777396482 +< 0 0 0 >: -0.000185333992486360 -0.003336166927880284 +< 1 -4 3 >: -0.000449411047898350 -0.008089774870267481 +< 1 -3 2 >: 0.000424653524708561 0.007644118739009841 +< 1 -2 1 >: -0.000288907102220368 -0.005200569559457665 +< 2 -4 2 >: 0.000240220309580954 0.004324166557239217 +< 2 -3 1 >: -0.000360330464371431 -0.006486249835858826 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 3 2 1 ) +num_ms=8 +< 0 0 0 >: 0.008760751724334374 0.041747788186835638 +< 0 1 -1 >: 0.010116044732695853 0.048206193495482053 +< 1 -2 1 >: -0.005840501149556247 -0.027831858791223751 +< 1 -1 0 >: -0.016519431873516198 -0.078720384337202992 +< 1 0 -1 >: -0.014306247658551386 -0.068173852631692400 +< 2 -2 0 >: 0.013059757593073438 0.062233928197351449 +< 2 -1 -1 >: 0.018469286309429463 0.088012065296447797 +< 3 -2 -1 >: -0.022620163685736622 -0.107792325592406077 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 3 3 0 ) +num_ms=4 +< 0 0 0 >: 0.000591058405233963 -0.019472467390641453 +< 1 -1 0 >: -0.001182116810467926 0.038944934781282907 +< 2 -2 0 >: 0.001182116810467926 -0.038944934781282900 +< 3 -3 0 >: -0.001182116810467926 0.038944934781282900 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 3 3 4 ) +num_ms=14 +< -3 -1 4 >: 0.000271764969167761 -0.055075168110579449 +< -3 0 3 >: -0.000332842752212108 0.067453029684461763 +< -3 1 2 >: 0.000308152510061585 -0.062449370672429283 +< -3 2 1 >: -0.000229683319978297 0.046547012658544523 +< -3 3 0 >: 0.000062901367717395 -0.012747424408781675 +< -2 -2 4 >: -0.000175423533278218 0.035550868146974654 +< -2 -1 3 >: 0.000156903578105317 -0.031797663134306930 +< -2 0 2 >: 0.000072632243168067 -0.014719457827769010 +< -2 1 1 >: -0.000237215912847353 0.048073547957933012 +< -2 2 0 >: 0.000146769858007255 -0.029743990287157244 +< -1 -1 2 >: -0.000132607726617837 0.026873930288383602 +< -1 0 1 >: 0.000162410633082093 -0.032913708294832901 +< -1 1 0 >: 0.000020967122572465 -0.004249141469593896 +< 0 0 0 >: -0.000062901367717395 0.012747424408781675 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 4 3 1 ) +num_ms=11 +< 0 0 0 >: 0.000112956969057605 0.019211722353957333 +< 0 1 -1 >: 0.000138343468541241 0.023529458423608391 +< 1 -2 1 >: -0.000097823604738379 -0.016637839608980427 +< 1 -1 0 >: -0.000218740229999086 -0.037203340364418754 +< 1 0 -1 >: -0.000178600649905598 -0.030376400206638364 +< 2 -3 1 >: 0.000056478484528803 0.009605861176978668 +< 2 -2 0 >: 0.000195647209476758 0.033275679217960860 +< 2 -1 -1 >: 0.000218740229999086 0.037203340364418760 +< 3 -3 0 >: -0.000149428024489021 -0.025414719802895756 +< 3 -2 -1 >: -0.000258816930489631 -0.044019585958742349 +< 4 -3 -1 >: 0.000298856048978042 0.050829439605791532 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 4 4 0 ) +num_ms=5 +< 0 0 0 >: 0.000040901533397538 0.008179721997529900 +< 1 -1 0 >: -0.000081803066795075 -0.016359443995059793 +< 2 -2 0 >: 0.000081803066795075 0.016359443995059793 +< 3 -3 0 >: -0.000081803066795075 -0.016359443995059793 +< 4 -4 0 >: 0.000081803066795075 0.016359443995059796 +ctilde_basis_func: rank=3 ndens=2 mu0=0 mu=( 0 0 0 ) +n=( 4 4 4 ) +l=( 4 4 4 ) +num_ms=13 +< -4 0 4 >: -0.000089621725821500 -0.004671772164949175 +< -4 1 3 >: 0.000188939187620711 0.009848960500410162 +< -4 2 2 >: -0.000107118450719780 -0.005583835747839332 +< -3 -1 4 >: 0.000094469593810355 0.004924480250205079 +< -3 0 3 >: -0.000134432588732250 -0.007007658247423763 +< -3 1 2 >: 0.000071412300479853 0.003722557165226221 +< -2 -2 4 >: -0.000053559225359890 -0.002791917873919665 +< -2 -1 3 >: 0.000035706150239927 0.001861278582613110 +< -2 0 2 >: 0.000070417070288322 0.003670678129602923 +< -2 1 1 >: -0.000080973937551733 -0.004220983071604355 +< -1 -1 2 >: -0.000040486968775867 -0.002110491535802177 +< -1 0 1 >: 0.000057613966599536 0.003003282106038756 +< 0 0 0 >: -0.000019204655533179 -0.001001094035346252 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.036354686618942797 0.112716151876300436 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.012575790814374094 0.044298713022054285 +< 1 -1 >: -0.025151581628748185 -0.088597426044108557 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.024515135306401561 0.272026568680671377 +< 1 -1 >: -0.049030270612803128 -0.544053137361342865 +< 2 -2 >: 0.049030270612803142 0.544053137361342976 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.007582177999163661 -0.070781616545872547 +< 1 -1 >: -0.015164355998327321 0.141563233091745094 +< 2 -2 >: 0.015164355998327319 -0.141563233091745094 +< 3 -3 >: -0.015164355998327319 0.141563233091745094 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.009642092538547307 0.027222201050041573 +< 1 -1 >: 0.019284185077094607 -0.054444402100083125 +< 2 -2 >: -0.019284185077094607 0.054444402100083125 +< 3 -3 >: 0.019284185077094607 -0.054444402100083125 +< 4 -4 >: -0.019284185077094611 0.054444402100083139 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000765366179527079 -0.013233978357391383 +< 1 -1 >: -0.001530732359054158 0.026467956714782765 +< 2 -2 >: 0.001530732359054158 -0.026467956714782772 +< 3 -3 >: -0.001530732359054159 0.026467956714782775 +< 4 -4 >: 0.001530732359054158 -0.026467956714782772 +< 5 -5 >: -0.001530732359054157 0.026467956714782741 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 1 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.011966394369992209 -0.043960679058516534 +< 1 -1 >: -0.023932788739984421 0.087921358117033083 +< 2 -2 >: 0.023932788739984414 -0.087921358117033055 +< 3 -3 >: -0.023932788739984421 0.087921358117033083 +< 4 -4 >: 0.023932788739984407 -0.087921358117033027 +< 5 -5 >: -0.023932788739984414 0.087921358117033055 +< 6 -6 >: 0.023932788739984397 -0.087921358117032999 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.022654895781669057 0.005925444934381353 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.000930388542384164 -0.019540938019308115 +< 1 -1 >: -0.001860777084768328 0.039081876038616223 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.016769561527053545 0.107666259659159783 +< 1 -1 >: 0.033539123054107091 -0.215332519318319593 +< 2 -2 >: -0.033539123054107105 0.215332519318319648 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.011757247699702073 0.050365927147369705 +< 1 -1 >: 0.023514495399404145 -0.100731854294739409 +< 2 -2 >: -0.023514495399404142 0.100731854294739395 +< 3 -3 >: 0.023514495399404142 -0.100731854294739395 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.006244736507749126 -0.007390267531366143 +< 1 -1 >: -0.012489473015498249 0.014780535062732280 +< 2 -2 >: 0.012489473015498249 -0.014780535062732280 +< 3 -3 >: -0.012489473015498249 0.014780535062732280 +< 4 -4 >: 0.012489473015498251 -0.014780535062732284 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: -0.000345498946750941 0.002458373216535279 +< 1 -1 >: 0.000690997893501882 -0.004916746433070557 +< 2 -2 >: -0.000690997893501882 0.004916746433070558 +< 3 -3 >: 0.000690997893501882 -0.004916746433070559 +< 4 -4 >: -0.000690997893501882 0.004916746433070558 +< 5 -5 >: 0.000690997893501881 -0.004916746433070553 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 2 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.019269466067705292 0.071391366733516939 +< 1 -1 >: 0.038538932135410590 -0.142782733467033907 +< 2 -2 >: -0.038538932135410577 0.142782733467033851 +< 3 -3 >: 0.038538932135410590 -0.142782733467033907 +< 4 -4 >: -0.038538932135410570 0.142782733467033823 +< 5 -5 >: 0.038538932135410577 -0.142782733467033851 +< 6 -6 >: -0.038538932135410556 0.142782733467033768 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.009916635737881018 -0.678214416426462074 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: -0.017546705953354277 -0.073117899737826647 +< 1 -1 >: 0.035093411906708546 0.146235799475653266 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.004749098007251869 -0.257069405099209003 +< 1 -1 >: -0.009498196014503739 0.514138810198418117 +< 2 -2 >: 0.009498196014503742 -0.514138810198418228 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.027176926052467926 -0.108355590420074283 +< 1 -1 >: -0.054353852104935853 0.216711180840148565 +< 2 -2 >: 0.054353852104935846 -0.216711180840148510 +< 3 -3 >: -0.054353852104935846 0.216711180840148510 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.000211150248804564 0.002501125696239490 +< 1 -1 >: -0.000422300497609128 -0.005002251392478979 +< 2 -2 >: 0.000422300497609128 0.005002251392478979 +< 3 -3 >: -0.000422300497609128 -0.005002251392478979 +< 4 -4 >: 0.000422300497609128 0.005002251392478980 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000099590275967354 -0.005481190461921377 +< 1 -1 >: -0.000199180551934708 0.010962380923842753 +< 2 -2 >: 0.000199180551934708 -0.010962380923842757 +< 3 -3 >: -0.000199180551934708 0.010962380923842758 +< 4 -4 >: 0.000199180551934708 -0.010962380923842757 +< 5 -5 >: -0.000199180551934708 0.010962380923842744 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 3 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.028820822741815019 0.043553113576786734 +< 1 -1 >: -0.057641645483630044 -0.087106227153573496 +< 2 -2 >: 0.057641645483630023 0.087106227153573454 +< 3 -3 >: -0.057641645483630044 -0.087106227153573496 +< 4 -4 >: 0.057641645483630009 0.087106227153573440 +< 5 -5 >: -0.057641645483630023 -0.087106227153573454 +< 6 -6 >: 0.057641645483629989 0.087106227153573398 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: -0.015195924588765826 -0.167087048140837691 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.013684484211213044 0.034395304368322346 +< 1 -1 >: -0.027368968422426084 -0.068790608736644679 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: -0.005928702549188424 -0.130153406570613472 +< 1 -1 >: 0.011857405098376850 0.260306813141227000 +< 2 -2 >: -0.011857405098376851 -0.260306813141227056 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: -0.015008760973931355 0.153801142295301702 +< 1 -1 >: 0.030017521947862710 -0.307602284590603403 +< 2 -2 >: -0.030017521947862707 0.307602284590603348 +< 3 -3 >: 0.030017521947862707 -0.307602284590603348 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: -0.001151840097758326 0.013431027541694857 +< 1 -1 >: 0.002303680195516651 -0.026862055083389708 +< 2 -2 >: -0.002303680195516651 0.026862055083389708 +< 3 -3 >: 0.002303680195516651 -0.026862055083389708 +< 4 -4 >: -0.002303680195516651 0.026862055083389711 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: -0.000652423778863231 0.026695406667047394 +< 1 -1 >: 0.001304847557726462 -0.053390813334094789 +< 2 -2 >: -0.001304847557726462 0.053390813334094796 +< 3 -3 >: 0.001304847557726462 -0.053390813334094803 +< 4 -4 >: -0.001304847557726462 0.053390813334094796 +< 5 -5 >: 0.001304847557726461 -0.053390813334094740 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 4 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: -0.022661669008512072 -0.089577314277810058 +< 1 -1 >: 0.045323338017024151 0.179154628555620143 +< 2 -2 >: -0.045323338017024137 -0.179154628555620060 +< 3 -3 >: 0.045323338017024151 0.179154628555620143 +< 4 -4 >: -0.045323338017024123 -0.179154628555620032 +< 5 -5 >: 0.045323338017024137 0.179154628555620060 +< 6 -6 >: -0.045323338017024109 -0.179154628555619949 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 0 0 ) +num_ms=1 +< 0 0 >: 0.000927204096660696 0.214065283656125371 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 1 1 ) +num_ms=2 +< 0 0 >: 0.000094655033139699 0.004208753371838363 +< 1 -1 >: -0.000189310066279397 -0.008417506743676724 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 2 2 ) +num_ms=3 +< 0 0 >: 0.000351584678183165 0.036688837956052121 +< 1 -1 >: -0.000703169356366331 -0.073377675912104257 +< 2 -2 >: 0.000703169356366331 0.073377675912104270 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 3 3 ) +num_ms=4 +< 0 0 >: 0.002788351180694639 -0.034407768721874142 +< 1 -1 >: -0.005576702361389278 0.068815537443748284 +< 2 -2 >: 0.005576702361389277 -0.068815537443748284 +< 3 -3 >: -0.005576702361389277 0.068815537443748284 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 4 4 ) +num_ms=5 +< 0 0 >: 0.000317570803659664 -0.001123830834830057 +< 1 -1 >: -0.000635141607319327 0.002247661669660114 +< 2 -2 >: 0.000635141607319327 -0.002247661669660114 +< 3 -3 >: -0.000635141607319327 0.002247661669660114 +< 4 -4 >: 0.000635141607319327 -0.002247661669660114 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 5 5 ) +num_ms=6 +< 0 0 >: 0.000488890061324461 -0.017808170881300944 +< 1 -1 >: -0.000977780122648922 0.035616341762601887 +< 2 -2 >: 0.000977780122648922 -0.035616341762601894 +< 3 -3 >: -0.000977780122648922 0.035616341762601901 +< 4 -4 >: 0.000977780122648922 -0.035616341762601894 +< 5 -5 >: -0.000977780122648921 0.035616341762601852 +ctilde_basis_func: rank=2 ndens=2 mu0=0 mu=( 0 0 ) +n=( 5 5 ) +l=( 6 6 ) +num_ms=7 +< 0 0 >: 0.005721847329407898 0.062910453316038589 +< 1 -1 >: -0.011443694658815798 -0.125820906632077206 +< 2 -2 >: 0.011443694658815794 0.125820906632077151 +< 3 -3 >: -0.011443694658815798 -0.125820906632077206 +< 4 -4 >: 0.011443694658815791 0.125820906632077123 +< 5 -5 >: -0.011443694658815794 -0.125820906632077151 +< 6 -6 >: 0.011443694658815787 0.125820906632077067 From da56b9de569ac6546df64872283ae6f2eadde983 Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Wed, 7 Apr 2021 07:48:43 -0600 Subject: [PATCH 289/370] Adding user-omp support --- src/USER-OMP/pair_gran_hertz_history_omp.cpp | 1 + src/USER-OMP/pair_gran_hooke_history_omp.cpp | 1 + src/USER-OMP/pair_gran_hooke_omp.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 2187dcbe90..200075a316 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -224,6 +224,7 @@ void PairGranHertzHistoryOMP::eval(int iifrom, int iito, ThrData * const thr) ccel = kn*(radsum-r)*rinv - damp; polyhertz = sqrt((radsum-r)*radi*radj / radsum); ccel *= polyhertz; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 7894d1e963..0ba9607bd9 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -223,6 +223,7 @@ void PairGranHookeHistoryOMP::eval(int iifrom, int iito, ThrData * const thr) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index 08ae07c6f5..451b074fa9 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -197,6 +197,7 @@ void PairGranHookeOMP::eval(int iifrom, int iito, ThrData * const thr) damp = meff*gamman*vnnr*rsqinv; ccel = kn*(radsum-r)*rinv - damp; + if (limit_damping && (ccel < 0.0)) ccel = 0.0; // relative velocities From 29c78d022a1351f2f89d0bdd3dd274e0ad19ed08 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 7 Apr 2021 19:54:35 +0200 Subject: [PATCH 290/370] add lib/pace/Makefile.lammps --- lib/pace/Makefile.lammps | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lib/pace/Makefile.lammps diff --git a/lib/pace/Makefile.lammps b/lib/pace/Makefile.lammps new file mode 100644 index 0000000000..17820716df --- /dev/null +++ b/lib/pace/Makefile.lammps @@ -0,0 +1,3 @@ +pace_SYSINC =-I../../lib/pace/src/USER-PACE +pace_SYSLIB = -L../../lib/pace/ -lpace +pace_SYSPATH = From 5d00fa7ec5106229561e12cab93fb7b0a680e58b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:00:14 -0400 Subject: [PATCH 291/370] update constants for lj/cubic/gpu from CPU version --- lib/gpu/lal_lj_cubic.cu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gpu/lal_lj_cubic.cu b/lib/gpu/lal_lj_cubic.cu index a91326d521..df3398afd7 100644 --- a/lib/gpu/lal_lj_cubic.cu +++ b/lib/gpu/lal_lj_cubic.cu @@ -26,10 +26,10 @@ _texture_2d( pos_tex,int4); // LJ quantities scaled by epsilon and rmin = sigma*2^1/6 (see src/pair_lj_cubic.h) -#define _RT6TWO (numtyp)1.1224621 -#define _PHIS (numtyp)-0.7869823 /* energy at s */ -#define _DPHIDS (numtyp)2.6899009 /* gradient at s */ -#define _A3 (numtyp)27.93357 /* cubic coefficient */ +#define _RT6TWO (numtyp)1.1224620483093730 /* 2^1/6 */ +#define _PHIS (numtyp)-0.7869822485207097 /* energy at s */ +#define _DPHIDS (numtyp)2.6899008972047196 /* gradient at s */ +#define _A3 (numtyp)27.9335700460986445 /* cubic coefficient */ __kernel void k_lj_cubic(const __global numtyp4 *restrict x_, const __global numtyp4 *restrict lj1, From 835820ba00227fc1e294163f2d19f44effa951c7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:00:27 -0400 Subject: [PATCH 292/370] reorder includes --- src/GPU/pair_lj_cubic_gpu.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/GPU/pair_lj_cubic_gpu.cpp b/src/GPU/pair_lj_cubic_gpu.cpp index 2c6231ca89..73839bdbed 100644 --- a/src/GPU/pair_lj_cubic_gpu.cpp +++ b/src/GPU/pair_lj_cubic_gpu.cpp @@ -17,25 +17,24 @@ #include "pair_lj_cubic_gpu.h" -#include -#include -#include - #include "atom.h" #include "atom_vec.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" +#include "gpu_extra.h" #include "integrate.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" +#include "suffix.h" #include "universe.h" #include "update.h" -#include "domain.h" -#include "gpu_extra.h" -#include "suffix.h" + +#include +#include #include "pair_lj_cubic_const.h" From 9af086916b7764b746a174eb40cb74a461480432 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:11:25 -0400 Subject: [PATCH 293/370] skip GPU tests for a couple more tabulated coulomb tests --- unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml | 1 + unittest/force-styles/tests/mol-pair-coul_table_cs.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml index 32a2b44328..d2ff07b2b8 100644 --- a/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-born_coul_table_cs.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:39 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair born/coul/long/cs diff --git a/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml index d5ed5fab83..983053a88b 100644 --- a/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_table_cs.yaml @@ -2,6 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 7.5e-14 +skip_tests: gpu prerequisites: ! | atom full pair coul/long/cs From 7b18bc1fecfe282b656841bd156dbac43e4f6052 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:26:27 -0400 Subject: [PATCH 294/370] correctly handle r-RESPA for lj/class2 and lj/class2/gpu --- src/CLASS2/pair_lj_class2.cpp | 17 +++++----- src/GPU/pair_lj_class2_gpu.cpp | 32 +++++++++---------- .../tests/mol-pair-lj_class2.yaml | 1 - 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index 23b0be7396..a0cb122494 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -11,20 +11,20 @@ #include "pair_lj_class2.h" -#include -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "respa.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -36,6 +36,7 @@ PairLJClass2::PairLJClass2(LAMMPS *lmp) : Pair(lmp) respa_enable = 1; writedata = 1; centroidstressflag = CENTROID_SAME; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/pair_lj_class2_gpu.cpp b/src/GPU/pair_lj_class2_gpu.cpp index 06ab116a7e..e32561ab59 100644 --- a/src/GPU/pair_lj_class2_gpu.cpp +++ b/src/GPU/pair_lj_class2_gpu.cpp @@ -16,25 +16,24 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_gpu.h" -#include -#include -#include #include "atom.h" #include "atom_vec.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" +#include "gpu_extra.h" #include "integrate.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" +#include "suffix.h" #include "universe.h" #include "update.h" -#include "domain.h" -#include "gpu_extra.h" -#include "suffix.h" + +#include using namespace LAMMPS_NS; @@ -46,13 +45,13 @@ int lj96_gpu_init(const int ntypes, double **cutsq, double **host_lj1, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); void lj96_gpu_clear(); -int ** lj96_gpu_compute_n(const int ago, const int inum, const int nall, - double **host_x, int *host_type, double *sublo, - double *subhi, tagint *tag, int **nspecial, - tagint **special, const bool eflag, const bool vflag, - const bool eatom, const bool vatom, int &host_start, - int **ilist, int **jnum, - const double cpu_time, bool &success); +int **lj96_gpu_compute_n(const int ago, const int inum, const int nall, + double **host_x, int *host_type, double *sublo, + double *subhi, tagint *tag, int **nspecial, + tagint **special, const bool eflag, const bool vflag, + const bool eatom, const bool vatom, int &host_start, + int **ilist, int **jnum, + const double cpu_time, bool &success); void lj96_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, @@ -64,6 +63,7 @@ double lj96_gpu_bytes(); PairLJClass2GPU::PairLJClass2GPU(LAMMPS *lmp) : PairLJClass2(lmp), gpu_mode(GPU_FORCE) { + respa_enable = 0; reinitflag = 0; cpu_time = 0.0; suffix_flag |= Suffix::GPU; diff --git a/unittest/force-styles/tests/mol-pair-lj_class2.yaml b/unittest/force-styles/tests/mol-pair-lj_class2.yaml index 779bb4def2..ba4989e6e2 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2.yaml @@ -2,7 +2,6 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:46 2021 epsilon: 5e-14 -skip_tests: gpu prerequisites: ! | atom full pair lj/class2 From f072289ac1ad17fca3aaf23046ca8ca0aa1bb74c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:52:36 -0400 Subject: [PATCH 295/370] need to initialize limit_damping array to NULL --- src/GRANULAR/pair_granular.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index dc367dcc0a..faeaaacd88 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -80,6 +80,8 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) onerad_frozen = nullptr; maxrad_dynamic = nullptr; maxrad_frozen = nullptr; + + limit_damping = nullptr; history_transfer_factors = nullptr; From ea8277ce87d8e5b7fe5be83117f9e4025687662f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 14:59:33 -0400 Subject: [PATCH 296/370] whitespace fixes --- doc/src/fix_wall_gran.rst | 4 ++-- doc/src/fix_wall_gran_region.rst | 4 ++-- doc/src/pair_gran.rst | 8 ++++---- doc/src/pair_granular.rst | 12 ++++++------ src/GRANULAR/fix_wall_gran.cpp | 14 +++++++------- src/GRANULAR/pair_gran_hooke_history.cpp | 2 +- src/GRANULAR/pair_granular.cpp | 10 +++++----- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/src/fix_wall_gran.rst b/doc/src/fix_wall_gran.rst index 95a4b5d818..57bec679e4 100644 --- a/doc/src/fix_wall_gran.rst +++ b/doc/src/fix_wall_gran.rst @@ -96,8 +96,8 @@ Specifically, delta = radius - r = overlap of particle with wall, m_eff = mass of particle, and the effective radius of contact = RiRj/Ri+Rj is set to the radius of the particle. -The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, -and the optional keyword *limit_damping* +The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, +and the optional keyword *limit_damping* have the same meaning and units as those specified with the :doc:`pair_style gran/\* ` commands. This means a NULL can be used for either *Kt* or *gamma_t* as described on that page. If a diff --git a/doc/src/fix_wall_gran_region.rst b/doc/src/fix_wall_gran_region.rst index 35fe1fab72..0a252b162a 100644 --- a/doc/src/fix_wall_gran_region.rst +++ b/doc/src/fix_wall_gran_region.rst @@ -181,8 +181,8 @@ radius - r = overlap of particle with wall, m_eff = mass of particle, and the effective radius of contact is just the radius of the particle. -The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, -and the optional keyword *limit_damping* +The parameters *Kn*\ , *Kt*\ , *gamma_n*, *gamma_t*, *xmu*, *dampflag*, +and the optional keyword *limit_damping* have the same meaning and units as those specified with the :doc:`pair_style gran/\* ` commands. This means a NULL can be used for either *Kt* or *gamma_t* as described on that page. If a diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index 5bccdfd8b4..fbcacb5c76 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -217,11 +217,11 @@ potential is used as a sub-style of :doc:`pair_style hybrid `, then pair_coeff command to determine which atoms interact via a granular potential. -If two particles are moving away from each other while in contact, there -is a possibility that the particles could experience an effective attractive -force due to damping. If the *limit_damping* keyword is used, this option +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective -attractive force. +attractive force. ---------- diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index a9ca437370..432fd29584 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -623,9 +623,9 @@ Finally, the twisting torque on each particle is given by: ---------- -If two particles are moving away from each other while in contact, there -is a possibility that the particles could experience an effective attractive -force due to damping. If the optional *limit_damping* keyword is used, this option +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the optional *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective attractive force. This keyword cannot be used with the JKR or DMT models. @@ -665,9 +665,9 @@ then LAMMPS will use that cutoff for the specified atom type combination, and automatically set pairwise cutoffs for the remaining atom types. -If two particles are moving away from each other while in contact, there -is a possibility that the particles could experience an effective attractive -force due to damping. If the *limit_damping* keyword is used, this option +If two particles are moving away from each other while in contact, there +is a possibility that the particles could experience an effective attractive +force due to damping. If the *limit_damping* keyword is used, this option will zero out the normal component of the force if there is an effective attractive force. This keyword cannot be used with the JKR or DMT models. diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 0611a54efd..51dca15e7b 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -119,12 +119,12 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : kt /= force->nktv2p; } iarg = 10; - + if (strcmp(arg[iarg],"limit_damping") == 0) { limit_damping = 1; - iarg += 1; + iarg += 1; } - + } else { iarg = 4; damping_model = VISCOELASTIC; @@ -310,7 +310,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : break; } else if (strcmp(arg[iarg],"limit_damping") == 0) { limit_damping = 1; - iarg += 1; + iarg += 1; } else { error->all(FLERR, "Illegal fix wall/gran command"); } @@ -530,7 +530,7 @@ void FixWallGran::init() roll_history_index += 1; twist_history_index += 1; } - + if (damping_model == TSUJI) { double cor = normal_coeffs[1]; normal_coeffs[1] = 1.2728-4.2783*cor+11.087*pow(cor,2)-22.348*pow(cor,3)+ @@ -1020,7 +1020,7 @@ void FixWallGran::hertz_history(double rsq, double dx, double dy, double dz, else polyhertz = sqrt((radius-r)*radius*rwall/(rwall+radius)); ccel *= polyhertz; if (limit_damping && (ccel < 0.0)) ccel = 0.0; - + // relative velocities vtr1 = vt1 - (dz*wr2-dy*wr3); @@ -1305,7 +1305,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, history[thist2] -= rsht*nz; // also rescale to preserve magnitude - prjmag = sqrt(history[thist0]*history[thist0] + + prjmag = sqrt(history[thist0]*history[thist0] + history[thist1]*history[thist1] + history[thist2]*history[thist2]); if (prjmag > 0) scalefac = shrmag/prjmag; else scalefac = 0; diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 0f9682a133..ac26ffbf1b 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -370,7 +370,7 @@ void PairGranHookeHistory::settings(int narg, char **arg) xmu = utils::numeric(FLERR,arg[4],false,lmp); dampflag = utils::inumeric(FLERR,arg[5],false,lmp); if (dampflag == 0) gammat = 0.0; - + limit_damping = 0; if (narg == 7) { if (strcmp(arg[6], "limit_damping") == 0) limit_damping = 1; diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index faeaaacd88..52971f920f 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -80,7 +80,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) onerad_frozen = nullptr; maxrad_dynamic = nullptr; maxrad_frozen = nullptr; - + limit_damping = nullptr; history_transfer_factors = nullptr; @@ -796,7 +796,7 @@ void PairGranular::coeff(int narg, char **arg) twist_model_one = TWIST_NONE; damping_model_one = VISCOELASTIC; int ld_flag = 0; - + int iarg = 2; while (iarg < narg) { if (strcmp(arg[iarg], "hooke") == 0) { @@ -971,7 +971,7 @@ void PairGranular::coeff(int narg, char **arg) cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "limit_damping") == 0) { - ld_flag = 1; + ld_flag = 1; iarg += 1; } else error->all(FLERR, "Illegal pair_coeff command"); } @@ -1047,7 +1047,7 @@ void PairGranular::coeff(int narg, char **arg) } } - + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -1320,7 +1320,7 @@ void PairGranular::write_restart(FILE *fp) fwrite(&tangential_model[i][j],sizeof(int),1,fp); fwrite(&roll_model[i][j],sizeof(int),1,fp); fwrite(&twist_model[i][j],sizeof(int),1,fp); - fwrite(&limit_damping[i][j],sizeof(int),1,fp); + fwrite(&limit_damping[i][j],sizeof(int),1,fp); fwrite(normal_coeffs[i][j],sizeof(double),4,fp); fwrite(tangential_coeffs[i][j],sizeof(double),3,fp); fwrite(roll_coeffs[i][j],sizeof(double),3,fp); From 5bc630f00858e773028397ee38c8a36e8ab25ec4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 15:07:06 -0400 Subject: [PATCH 297/370] step version strings for next patch release --- doc/lammps.1 | 2 +- src/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/lammps.1 b/doc/lammps.1 index 6ce463bfba..c10950643d 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "10 March 2021" "2021-03-10" +.TH LAMMPS "8 April 2021" "2021-04-08" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/src/version.h b/src/version.h index d16067e41c..d7839fcbfe 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "10 Mar 2021" +#define LAMMPS_VERSION "8 Apr 2021" From feda2dc08dc11502dd24dd7c2bc835a21924be95 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Wed, 7 Apr 2021 14:07:58 -0600 Subject: [PATCH 298/370] Updated doc page and spelling --- doc/src/pair_pace.rst | 4 ++-- doc/utils/sphinx-config/false_positives.txt | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/src/pair_pace.rst b/doc/src/pair_pace.rst index 1ebf6210cd..36baaa7ef9 100644 --- a/doc/src/pair_pace.rst +++ b/doc/src/pair_pace.rst @@ -59,9 +59,9 @@ Note that unlike for other potentials, cutoffs are not set in the pair_style or pair_coeff command; they are specified in the ACE file. -The pair_style *mliap* may be followed by an optional keyword +The pair_style *pace* command may be followed by an optional keyword *product* or *recursive*, which determines which of two algorithms - is used for the calculation of basis functions and derivatives. +is used for the calculation of basis functions and derivatives. The default is *recursive*. See the :doc:`pair_coeff ` doc page for alternate ways diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 38a6971f4c..9689125753 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -268,6 +268,7 @@ blueviolet bn bni bo +Bochkarev Bochum bocs bodyflag @@ -343,6 +344,7 @@ Cao Capolungo Caro cartesian +Cas CasP Caswell Cates @@ -1069,6 +1071,7 @@ fuer fx fy fz +Gabor Gahler gainsboro Galindo @@ -1193,6 +1196,7 @@ Halperin Halver Hamaker Hamel +Hammerschmidt haptic Hara Harpertown @@ -1743,6 +1747,7 @@ lx ly Lybrand lyon +Lysogorskiy Lyulin lz Maaravi @@ -1801,8 +1806,10 @@ Materias mathbf mathjax matlab +Matous matplotlib Matsubara +Matteo Mattice Mattox Mattson @@ -1863,6 +1870,7 @@ MEMALIGN membered memcheck Mendelev +Menon mer Meremianin Mersenne @@ -1986,6 +1994,7 @@ mpiio mpirun mplayer mps +Mrovec Mryglod mscg MSCG @@ -2311,6 +2320,7 @@ oneway onn ons OO +Oord opencl openKIM openmp @@ -2331,6 +2341,7 @@ Orsi ortho orthonormal orthorhombic +Ortner oso Otype Ouldridge @@ -2620,6 +2631,7 @@ radians Rafferty rahman Rahman +Ralf Raman ramped ramping @@ -2726,6 +2738,7 @@ Rij RIj Rik Rin +Rinaldi Rino RiRj Risi @@ -2814,6 +2827,7 @@ Sandia sandybrown sanitizer Sanyal +Sarath sc scafacos SCAFACOS From 0151fd00c281aac40fdebd88b76b5ef80e3c2c81 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 17:37:30 -0400 Subject: [PATCH 299/370] correct CMake support for USER-PACE package and align with recent conventions for downloading external code --- cmake/Modules/Packages/USER-PACE.cmake | 34 +++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake index c9e8e1bcfe..008d32444c 100644 --- a/cmake/Modules/Packages/USER-PACE.cmake +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -1,14 +1,26 @@ -set(PACE_EVALUATOR_PATH ${LAMMPS_LIB_SOURCE_DIR}/pace) -message("CMakeLists.txt DEBUG: PACE_EVALUATOR_PATH=${PACE_EVALUATOR_PATH}") -set(PACE_EVALUATOR_SRC_PATH ${PACE_EVALUATOR_PATH}) -FILE(GLOB PACE_EVALUATOR_SOURCE_FILES ${PACE_EVALUATOR_SRC_PATH}/*.cpp) -set(PACE_EVALUATOR_INCLUDE_DIR ${PACE_EVALUATOR_SRC_PATH}) +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "9ebb087cba7e4ca041fde52f7e9e640c" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +mark_as_advanced(PACELIB_URL) +mark_as_advanced(PACELIB_MD5) + +# download library sources to build folder +file(DOWNLOAD ${PACELIB_URL} libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) + +# uncompress downloaded sources +execute_process( + COMMAND ${CMAKE_COMMAND} -E remove_directory lammps-user-pace* + COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) -##### aceevaluator ##### -add_library(aceevaluator ${PACE_EVALUATOR_SOURCE_FILES}) -target_include_directories(aceevaluator PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) -target_compile_options(aceevaluator PRIVATE -O2) -set_target_properties(aceevaluator PROPERTIES OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) -target_link_libraries(lammps PRIVATE aceevaluator) \ No newline at end of file +file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE) +file(GLOB PACE_EVALUATOR_SOURCES ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PACE/*.cpp) +list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) + +add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) +set_target_properties(pace PROPERTIES OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) +target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) +target_link_libraries(lammps PRIVATE pace) + From 7b34f025ee088212ee5d26ad62c993e8e7d80678 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 17:46:18 -0400 Subject: [PATCH 300/370] correct src/Makefile for USER-PACE --- src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index bec0a2b16b..d5f0e600d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,7 +55,7 @@ PACKUSER = user-adios user-atc user-awpmd user-bocs user-cgdna user-cgsdk user-c user-diffraction user-dpd user-drude user-eff user-fep user-h5md \ user-intel user-lb user-manifold user-meamc user-mesodpd user-mesont \ user-mgpt user-misc user-mofff user-molfile \ - user-netcdf user-omp user-phonon user-plumed user-ptm user-qmmm \ + user-netcdf user-omp user-phonon user-pace user-plumed user-ptm user-qmmm \ user-qtb user-quip user-reaction user-reaxc user-scafacos user-smd user-smtbq \ user-sdpd user-sph user-tally user-uef user-vtk user-yaff @@ -70,8 +70,8 @@ PACKSYS = compress mpiio python user-lb PACKINT = gpu kokkos message poems user-atc user-awpmd user-colvars user-mesont PACKEXT = kim latte mscg voronoi \ - user-adios user-h5md user-molfile user-netcdf user-plumed user-qmmm user-quip \ - user-smd user-vtk user-pace + user-adios user-h5md user-molfile user-netcdf user-pace user-plumed \ + user-qmmm user-quip user-smd user-vtk PACKALL = $(PACKAGE) $(PACKUSER) From 084c0713d6e69fad23459782978fa4c73889f82b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 18:05:00 -0400 Subject: [PATCH 301/370] resolve whitespace issues --- doc/src/Packages_details.rst | 4 ++-- doc/src/pair_pace.rst | 26 +++++++++++++------------- src/USER-PACE/pair_pace.cpp | 2 +- src/USER-PACE/pair_pace.h | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 549ab3d8f0..1964a83717 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -1363,9 +1363,9 @@ fit to a large archive of quantum mechanical (DFT) data. The USER-PACE package provides an efficient implementation for running simulations with ACE potentials. -**Authors:** +**Authors:** -This package was written by Yury Lysogorskiy^1, +This package was written by Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1. diff --git a/doc/src/pair_pace.rst b/doc/src/pair_pace.rst index 36baaa7ef9..56ae0f32dc 100644 --- a/doc/src/pair_pace.rst +++ b/doc/src/pair_pace.rst @@ -15,8 +15,8 @@ Syntax .. parsed-literal:: - *product* = use product algorithm for basis functions - *recursive* = use recursive algorithm for basis functions + *product* = use product algorithm for basis functions + *recursive* = use recursive algorithm for basis functions Examples """""""" @@ -30,24 +30,24 @@ Examples Description """"""""""" -Pair style *pace* computes interactions using the Atomic Cluster -Expansion (ACE), which is a general expansion of the atomic energy in -multi-body basis functions. :ref:`(Drautz) `. -The *pace* pair style -provides an efficient implementation that +Pair style *pace* computes interactions using the Atomic Cluster +Expansion (ACE), which is a general expansion of the atomic energy in +multi-body basis functions. :ref:`(Drautz) `. +The *pace* pair style +provides an efficient implementation that is described in this paper :ref:`(Lysogorskiy) `. In ACE, the total energy is decomposed into a sum over -atomic energies. The energy of atom *i* is expressed as a -linear or non-linear function of one or more density functions. +atomic energies. The energy of atom *i* is expressed as a +linear or non-linear function of one or more density functions. By projecting the density onto a local atomic base, the lowest order contributions to the energy can be expressed as a set of scalar polynomials in basis function contributions summed over neighbor atoms. Only a single pair_coeff command is used with the *pace* style which -specifies an ACE coefficient file followed by N additional arguments -specifying the mapping of ACE elements to LAMMPS atom types, +specifies an ACE coefficient file followed by N additional arguments +specifying the mapping of ACE elements to LAMMPS atom types, where N is the number of LAMMPS atom types: * ACE coefficient file @@ -61,7 +61,7 @@ the ACE file. The pair_style *pace* command may be followed by an optional keyword *product* or *recursive*, which determines which of two algorithms -is used for the calculation of basis functions and derivatives. +is used for the calculation of basis functions and derivatives. The default is *recursive*. See the :doc:`pair_coeff ` doc page for alternate ways @@ -92,7 +92,7 @@ Restrictions """""""""""" This pair style is part of the USER-PACE package. It is only enabled if LAMMPS -was built with that package. +was built with that package. See the :doc:`Build package ` doc page for more info. Related commands diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index a515b7b4b0..ee1922d886 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -446,7 +446,7 @@ double PairPACE::init_one(int i, int j) { return basis_set->radial_functions->cut(map[i], map[j]); } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- extract method for extracting value of scale variable ---------------------------------------------------------------------- */ void *PairPACE::extract(const char *str, int &dim) diff --git a/src/USER-PACE/pair_pace.h b/src/USER-PACE/pair_pace.h index 3fccbd98f0..76b08a65c0 100644 --- a/src/USER-PACE/pair_pace.h +++ b/src/USER-PACE/pair_pace.h @@ -94,4 +94,4 @@ namespace LAMMPS_NS { } #endif -#endif \ No newline at end of file +#endif From 2d1fc67b5df7d47c425565c96e208794e7c2a5bb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 19:09:43 -0400 Subject: [PATCH 302/370] update .gitignore --- src/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/.gitignore b/src/.gitignore index 6fa3aef513..96a89ae667 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -32,6 +32,9 @@ /pair_kim.cpp /pair_kim.h +/pair_pace.cpp +/pair_pace.h + /superpose3d.h /kokkos.cpp From 2d4b05ffa6db866f30ae100754677ae6bdcd9d6d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 19:13:10 -0400 Subject: [PATCH 303/370] refactor code to more closely match LAMMPS coding conventions - update indentation to 2 characters - remove dead code and unused class members - use convenience functions in many places - reuse code and members from Pair base class - declare local functions/variables static - PIMPL-ify access to the ACE evaluator library functions/classes - correct settings member variables to match implementation --- src/USER-PACE/pair_pace.cpp | 538 ++++++++++++++++-------------------- src/USER-PACE/pair_pace.h | 60 ++-- 2 files changed, 250 insertions(+), 348 deletions(-) diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index ee1922d886..527f2a6f06 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -28,25 +28,33 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, // Created by Lysogorskiy Yury on 27.02.20. // -#include -#include -#include -#include #include "pair_pace.h" + #include "atom.h" -#include "neighbor.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include +#include -#include "math_const.h" - +#include "ace_evaluator.h" +#include "ace_recursive.h" +#include "ace_c_basis.h" #include "ace_version.h" +namespace LAMMPS_NS { + struct ACEImpl { + ACECTildeBasisSet *basis_set; + ACERecursiveEvaluator *ace; + }; +} + using namespace LAMMPS_NS; using namespace MathConst; @@ -59,9 +67,8 @@ using namespace MathConst; #define RECURSIVE_KEYWORD "recursive" #define PRODUCT_KEYWORD "product" - -int elements_num_pace = 104; -char const *const elements_pace[104] = {"X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", +static int elements_num_pace = 104; +static char const *const elements_pace[104] = {"X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", @@ -71,27 +78,26 @@ char const *const elements_pace[104] = {"X", "H", "He", "Li", "Be", "B", "C", "N "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr" }; -int AtomicNumberByName_pace(char *elname) { - for (int i = 1; i < elements_num_pace; i++) - if (strcmp(elname, elements_pace[i]) == 0) - return i; - return -1; +static int AtomicNumberByName_pace(char *elname) { + for (int i = 1; i < elements_num_pace; i++) + if (strcmp(elname, elements_pace[i]) == 0) + return i; + return -1; } - /* ---------------------------------------------------------------------- */ PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) { - //single_enable = 0; - restartinfo = 0; - one_coeff = 1; - manybody_flag = 1; + single_enable = 0; + restartinfo = 0; + one_coeff = 1; + manybody_flag = 1; - nelements = 0; + aceimpl = new ACEImpl; + aceimpl->ace = nullptr; + aceimpl->basis_set = nullptr; + recursive = false; - ace = NULL; - potential_file_name = NULL; - elements = NULL; - map = NULL; + scale = nullptr; } /* ---------------------------------------------------------------------- @@ -99,170 +105,157 @@ PairPACE::PairPACE(LAMMPS *lmp) : Pair(lmp) { ------------------------------------------------------------------------- */ PairPACE::~PairPACE() { - if (copymode) return; + if (copymode) return; - if (elements) - for (int i = 0; i < nelements; i++) delete[] elements[i]; - delete[] elements; + delete aceimpl->basis_set; + delete aceimpl->ace; + delete aceimpl; - - delete[] potential_file_name; - - delete basis_set; - delete ace; - - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - memory->destroy(map); - memory->destroy(scale); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(scale); + } } /* ---------------------------------------------------------------------- */ void PairPACE::compute(int eflag, int vflag) { - int i, j, ii, jj, inum, jnum; - double delx, dely, delz, evdwl; - double fij[3]; - int *ilist, *jlist, *numneigh, **firstneigh; + int i, j, ii, jj, inum, jnum; + double delx, dely, delz, evdwl; + double fij[3]; + int *ilist, *jlist, *numneigh, **firstneigh; - ev_init(eflag, vflag); + ev_init(eflag, vflag); - // downwards modified by YL + // downwards modified by YL - double **x = atom->x; - double **f = atom->f; - tagint *tag = atom->tag; - int *type = atom->type; + double **x = atom->x; + double **f = atom->f; + tagint *tag = atom->tag; + int *type = atom->type; - // number of atoms in cell - int nlocal = atom->nlocal; + // number of atoms in cell + int nlocal = atom->nlocal; - int newton_pair = force->newton_pair; + int newton_pair = force->newton_pair; - // number of atoms including ghost atoms - int nall = nlocal + atom->nghost; + // number of atoms including ghost atoms + int nall = nlocal + atom->nghost; - // inum: length of the neighborlists list - inum = list->inum; + // inum: length of the neighborlists list + inum = list->inum; - // ilist: list of "i" atoms for which neighbor lists exist - ilist = list->ilist; + // ilist: list of "i" atoms for which neighbor lists exist + ilist = list->ilist; - //numneigh: the length of each these neigbor list - numneigh = list->numneigh; + //numneigh: the length of each these neigbor list + numneigh = list->numneigh; - // the pointer to the list of neighbors of "i" - firstneigh = list->firstneigh; + // the pointer to the list of neighbors of "i" + firstneigh = list->firstneigh; - if (inum != nlocal) { - char str[128]; - snprintf(str,128,"inum: %d nlocal: %d are different",inum, nlocal); - error->all(FLERR,str); + if (inum != nlocal) + error->all(FLERR,fmt::format("inum: {} nlocal: {} are different",inum, nlocal)); + + // Aidan Thompson told RD (26 July 2019) that practically always holds: + // inum = nlocal + // i = ilist(ii) < inum + // j = jlist(jj) < nall + // neighborlist contains neighbor atoms plus skin atoms, + // skin atoms can be removed by setting skin to zero but here + // they are disregarded anyway + + + //determine the maximum number of neighbours + int max_jnum = -1; + int nei = 0; + for (ii = 0; ii < list->inum; ii++) { + i = ilist[ii]; + jnum = numneigh[i]; + nei = nei + jnum; + if (jnum > max_jnum) + max_jnum = jnum; + } + + aceimpl->ace->resize_neighbours_cache(max_jnum); + + //loop over atoms + for (ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + // checking if neighbours are actually within cutoff range is done inside compute_atom + // mapping from LAMMPS atom types ('type' array) to ACE species is done inside compute_atom + // by using 'aceimpl->ace->element_type_mapping' array + // x: [r0 ,r1, r2, ..., r100] + // i = 0 ,1 + // jnum(0) = 50 + // jlist(neigh ind of 0-atom) = [1,2,10,7,99,25, .. 50 element in total] + + try { + aceimpl->ace->compute_atom(i, x, type, jnum, jlist); + } catch (exception &e) { + error->one(FLERR, e.what()); + } + // 'compute_atom' will update the `aceimpl->ace->e_atom` and `aceimpl->ace->neighbours_forces(jj, alpha)` arrays + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + const int jtype = type[j]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + + fij[0] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 0); + fij[1] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 1); + fij[2] = scale[itype][jtype]*aceimpl->ace->neighbours_forces(jj, 2); + + f[i][0] += fij[0]; + f[i][1] += fij[1]; + f[i][2] += fij[2]; + f[j][0] -= fij[0]; + f[j][1] -= fij[1]; + f[j][2] -= fij[2]; + + // tally per-atom virial contribution + if (vflag) + ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, + fij[0], fij[1], fij[2], + -delx, -dely, -delz); } - - // Aidan Thompson told RD (26 July 2019) that practically always holds: - // inum = nlocal - // i = ilist(ii) < inum - // j = jlist(jj) < nall - // neighborlist contains neighbor atoms plus skin atoms, - // skin atoms can be removed by setting skin to zero but here - // they are disregarded anyway - - - //determine the maximum number of neighbours - int max_jnum = -1; - int nei = 0; - for (ii = 0; ii < list->inum; ii++) { - i = ilist[ii]; - jnum = numneigh[i]; - nei = nei + jnum; - if (jnum > max_jnum) - max_jnum = jnum; + // tally energy contribution + if (eflag) { + // evdwl = energy of atom I + evdwl = scale[1][1]*aceimpl->ace->e_atom; + ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); } + } - ace->resize_neighbours_cache(max_jnum); + if (vflag_fdotr) virial_fdotr_compute(); - //loop over atoms - for (ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; - const int itype = type[i]; - - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; - - jlist = firstneigh[i]; - jnum = numneigh[i]; - - // checking if neighbours are actually within cutoff range is done inside compute_atom - // mapping from LAMMPS atom types ('type' array) to ACE species is done inside compute_atom - // by using 'ace->element_type_mapping' array - // x: [r0 ,r1, r2, ..., r100] - // i = 0 ,1 - // jnum(0) = 50 - // jlist(neigh ind of 0-atom) = [1,2,10,7,99,25, .. 50 element in total] - try { - ace->compute_atom(i, x, type, jnum, jlist); - } catch (exception &e) { - error->all(FLERR, e.what()); - exit(EXIT_FAILURE); - } - // 'compute_atom' will update the `ace->e_atom` and `ace->neighbours_forces(jj, alpha)` arrays - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - const int jtype = type[j]; - j &= NEIGHMASK; - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - - fij[0] = scale[itype][jtype]*ace->neighbours_forces(jj, 0); - fij[1] = scale[itype][jtype]*ace->neighbours_forces(jj, 1); - fij[2] = scale[itype][jtype]*ace->neighbours_forces(jj, 2); - - - f[i][0] += fij[0]; - f[i][1] += fij[1]; - f[i][2] += fij[2]; - f[j][0] -= fij[0]; - f[j][1] -= fij[1]; - f[j][2] -= fij[2]; - - // tally per-atom virial contribution - if (vflag) - ev_tally_xyz(i, j, nlocal, newton_pair, 0.0, 0.0, - fij[0], fij[1], fij[2], - -delx, -dely, -delz); - } - - // tally energy contribution - if (eflag) { - // evdwl = energy of atom I - evdwl = scale[1][1]*ace->e_atom; - ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); - } - } - - if (vflag_fdotr) virial_fdotr_compute(); - - - // end modifications YL + // end modifications YL } /* ---------------------------------------------------------------------- */ void PairPACE::allocate() { - allocated = 1; - int n = atom->ntypes; + allocated = 1; + int n = atom->ntypes; - memory->create(setflag, n + 1, n + 1, "pair:setflag"); - memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); - memory->create(map, n + 1, "pair:map"); - memory->create(scale, n + 1, n + 1,"pair:scale"); + memory->create(setflag, n + 1, n + 1, "pair:setflag"); + memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); + memory->create(scale, n + 1, n + 1,"pair:scale"); + map = new int[n+1]; } /* ---------------------------------------------------------------------- @@ -270,41 +263,24 @@ void PairPACE::allocate() { ------------------------------------------------------------------------- */ void PairPACE::settings(int narg, char **arg) { - if (narg > 1) { - error->all(FLERR, - "Illegal pair_style command. Correct form:\n\tpair_style pace\nor\n\tpair_style pace "); - error->all(FLERR, RECURSIVE_KEYWORD); - error->all(FLERR, "or\n\tpair_style pace "); - error->all(FLERR, PRODUCT_KEYWORD); - } - recursive = true; // default evaluator style: RECURSIVE - if (narg > 0) { - if (strcmp(arg[0], RECURSIVE_KEYWORD) == 0) - recursive = true; - else if (strcmp(arg[0], PRODUCT_KEYWORD) == 0) { - recursive = false; - } else { - error->all(FLERR, - "Illegal pair_style command: pair_style pace "); - error->all(FLERR, arg[0]); - error->all(FLERR, "\nCorrect form:\n\tpair_style pace\nor\n\tpair_style pace recursive"); - } - } - - if (comm->me == 0) { - if (screen) fprintf(screen, "ACE version: %d.%d.%d\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); - if (logfile) fprintf(logfile, "ACE version: %d.%d.%d\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); - - if (recursive) { - if (screen) fprintf(screen, "Recursive evaluator is used\n"); - if (logfile) fprintf(logfile, "Recursive evaluator is used\n"); - } else { - if (screen) fprintf(screen, "Product evaluator is used\n"); - if (logfile) fprintf(logfile, "Product evaluator is used\n"); - } - } + if (narg > 1) + error->all(FLERR,"Illegal pair_style command."); + recursive = true; // default evaluator style: RECURSIVE + if (narg > 0) { + if (strcmp(arg[0], RECURSIVE_KEYWORD) == 0) + recursive = true; + else if (strcmp(arg[0], PRODUCT_KEYWORD) == 0) { + recursive = false; + } else error->all(FLERR,"Illegal pair_style command"); + } + if (comm->me == 0) { + utils::logmesg(lmp,fmt::format("ACE version: {}.{}.{}\n", + VERSION_YEAR, VERSION_MONTH, VERSION_DAY)); + if (recursive) utils::logmesg(lmp,"Recursive evaluator is used\n"); + else utils::logmesg(lmp,"Product evaluator is used\n"); + } } /* ---------------------------------------------------------------------- @@ -313,110 +289,64 @@ void PairPACE::settings(int narg, char **arg) { void PairPACE::coeff(int narg, char **arg) { - if (narg < 4) - error->all(FLERR, - "Incorrect args for pair coefficients. Correct form:\npair_coeff * * elem1 elem2 ..."); + if (!allocated) allocate(); - if (!allocated) allocate(); + map_element2type(narg-3,arg+3); - //number of provided elements in pair_coeff line - int ntypes_coeff = narg - 3; + char *potential_file_name = arg[2]; + char **elemtypes = &arg[3]; - if (ntypes_coeff != atom->ntypes) { - char error_message[1024]; - snprintf(error_message, 1024, - "Incorrect args for pair coefficients. You provided %d elements in pair_coeff, but structure has %d atom types", - ntypes_coeff, atom->ntypes); - error->all(FLERR, error_message); + //load potential file + aceimpl->basis_set = new ACECTildeBasisSet(); + if (comm->me == 0) + utils::logmesg(lmp,fmt::format("Loading {}\n", potential_file_name)); + aceimpl->basis_set->load(potential_file_name); + + if (comm->me == 0) { + utils::logmesg(lmp,"Total number of basis functions\n"); + + for (SPECIES_TYPE mu = 0; mu < aceimpl->basis_set->nelements; mu++) { + int n_r1 = aceimpl->basis_set->total_basis_size_rank1[mu]; + int n = aceimpl->basis_set->total_basis_size[mu]; + utils::logmesg(lmp,fmt::format("\t{}: {} (r=1) {} (r>1)\n", aceimpl->basis_set->elements_name[mu], n_r1, n)); } + } - char *type1 = arg[0]; - char *type2 = arg[1]; - char *potential_file_name = arg[2]; - char **elemtypes = &arg[3]; + // read args that map atom types to pACE elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used - // insure I,J args are * * + aceimpl->ace = new ACERecursiveEvaluator(); + aceimpl->ace->set_recursive(recursive); + aceimpl->ace->element_type_mapping.init(atom->ntypes + 1); - if (strcmp(type1, "*") != 0 || strcmp(type2, "*") != 0) - error->all(FLERR, "Incorrect args for pair coefficients"); + const int n = atom->ntypes; + for (int i = 1; i <= n; i++) { + char *elemname = elemtypes[i - 1]; + int atomic_number = AtomicNumberByName_pace(elemname); + if (atomic_number == -1) + error->all(FLERR,fmt::format("'{}' is not a valid element\n", elemname)); - - //load potential file - basis_set = new ACECTildeBasisSet(); - if (comm->me == 0) { - if (screen) fprintf(screen, "Loading %s\n", potential_file_name); - if (logfile) fprintf(logfile, "Loading %s\n", potential_file_name); + SPECIES_TYPE mu = aceimpl->basis_set->get_species_index_by_name(elemname); + if (mu != -1) { + if (comm->me == 0) + utils::logmesg(lmp,fmt::format("Mapping LAMMPS atom type #{}({}) -> " + "ACE species type #{}\n", i, elemname, mu)); + map[i] = mu; + aceimpl->ace->element_type_mapping(i) = mu; // set up LAMMPS atom type to ACE species mapping for ace evaluator + } else { + error->all(FLERR, fmt::format("Element {} is not supported by ACE-potential from file {}", elemname,potential_file_name)); } - basis_set->load(potential_file_name); + } - if (comm->me == 0) { - if (screen) fprintf(screen, "Total number of basis functions\n"); - if (logfile) fprintf(logfile, "Total number of basis functions\n"); - - for (SPECIES_TYPE mu = 0; mu < basis_set->nelements; mu++) { - int n_r1 = basis_set->total_basis_size_rank1[mu]; - int n = basis_set->total_basis_size[mu]; - if (screen) fprintf(screen, "\t%s: %d (r=1) %d (r>1)\n", basis_set->elements_name[mu].c_str(), n_r1, n); - if (logfile) fprintf(logfile, "\t%s: %d (r=1) %d (r>1)\n", basis_set->elements_name[mu].c_str(), n_r1, n); - } + // initialize scale factor + for (int i = 1; i <= n; i++) { + for (int j = i; j <= n; j++) { + scale[i][j] = 1.0; } + } - // read args that map atom types to pACE elements - // map[i] = which element the Ith atom type is, -1 if not mapped - // map[0] is not used - - ace = new ACERecursiveEvaluator(); - ace->set_recursive(recursive); - ace->element_type_mapping.init(atom->ntypes + 1); - - for (int i = 1; i <= atom->ntypes; i++) { - char *elemname = elemtypes[i - 1]; - int atomic_number = AtomicNumberByName_pace(elemname); - if (atomic_number == -1) { - char error_msg[1024]; - snprintf(error_msg, 1024, "String '%s' is not a valid element\n", elemname); - error->all(FLERR, error_msg); - } - SPECIES_TYPE mu = basis_set->get_species_index_by_name(elemname); - if (mu != -1) { - if (comm->me == 0) { - if (screen) - fprintf(screen, "Mapping LAMMPS atom type #%d(%s) -> ACE species type #%d\n", i, elemname, mu); - if (logfile) - fprintf(logfile, "Mapping LAMMPS atom type #%d(%s) -> ACE species type #%d\n", i, elemname, mu); - } - map[i] = mu; - ace->element_type_mapping(i) = mu; // set up LAMMPS atom type to ACE species mapping for ace evaluator - } else { - char error_msg[1024]; - snprintf(error_msg, 1024, "Element %s is not supported by ACE-potential from file %s", elemname, - potential_file_name); - error->all(FLERR, error_msg); - } - } - - // clear setflag since coeff() called once with I,J = * * - int n = atom->ntypes; - for (int i = 1; i <= n; i++) { - for (int j = i; j <= n; j++) { - setflag[i][j] = 1; - scale[i][j] = 1.0; - } - } - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 1; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); - - ace->set_basis(*basis_set, 1); + aceimpl->ace->set_basis(*aceimpl->basis_set, 1); } /* ---------------------------------------------------------------------- @@ -424,15 +354,15 @@ void PairPACE::coeff(int narg, char **arg) { ------------------------------------------------------------------------- */ void PairPACE::init_style() { - if (atom->tag_enable == 0) - error->all(FLERR, "Pair style pACE requires atom IDs"); - if (force->newton_pair == 0) - error->all(FLERR, "Pair style pACE requires newton pair on"); + if (atom->tag_enable == 0) + error->all(FLERR, "Pair style pACE requires atom IDs"); + if (force->newton_pair == 0) + error->all(FLERR, "Pair style pACE requires newton pair on"); - // request a full neighbor list - int irequest = neighbor->request(this, instance_me); - neighbor->requests[irequest]->half = 0; - neighbor->requests[irequest]->full = 1; + // request a full neighbor list + int irequest = neighbor->request(this, instance_me); + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; } /* ---------------------------------------------------------------------- @@ -440,10 +370,10 @@ void PairPACE::init_style() { ------------------------------------------------------------------------- */ double PairPACE::init_one(int i, int j) { - if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); - //cutoff from the basis set's radial functions settings - scale[j][i] = scale[i][j]; - return basis_set->radial_functions->cut(map[i], map[j]); + if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); + //cutoff from the basis set's radial functions settings + scale[j][i] = scale[i][j]; + return aceimpl->basis_set->radial_functions->cut(map[i], map[j]); } /* ---------------------------------------------------------------------- @@ -451,8 +381,8 @@ double PairPACE::init_one(int i, int j) { ---------------------------------------------------------------------- */ void *PairPACE::extract(const char *str, int &dim) { - dim = 2; - if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + dim = 2; + if (strcmp(str,"scale") == 0) return (void *) scale; + return nullptr; } diff --git a/src/USER-PACE/pair_pace.h b/src/USER-PACE/pair_pace.h index 76b08a65c0..b29ee3a7a9 100644 --- a/src/USER-PACE/pair_pace.h +++ b/src/USER-PACE/pair_pace.h @@ -39,58 +39,30 @@ PairStyle(pace,PairPACE) #define LMP_PAIR_PACE_H #include "pair.h" -#include "ace_evaluator.h" -#include "ace_recursive.h" -#include "ace_c_basis.h" namespace LAMMPS_NS { - class PairPACE : public Pair { - public: - PairPACE(class LAMMPS *); +class PairPACE : public Pair { + public: + PairPACE(class LAMMPS *); + virtual ~PairPACE(); - virtual ~PairPACE(); + virtual void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + virtual void init_style(); + double init_one(int, int); - virtual void compute(int, int); + void *extract(const char *, int &); - void settings(int, char **); + protected: + struct ACEImpl *aceimpl; - void coeff(int, char **); - - virtual void init_style(); - - double init_one(int, int); - - void *extract(const char *, int &); - - // virtual double memory_usage(); - - protected: - ACECTildeBasisSet *basis_set = nullptr; - - ACERecursiveEvaluator *ace = nullptr; - - char *potential_file_name; - - virtual void allocate(); - - void read_files(char *, char *); - - inline int equal(double *x, double *y); - - - double rcutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - - int *map; // mapping from atom types to elements - int *jlist_local; - int *type_local; - double **scale; - - bool recursive = false; // "recursive" option for ACERecursiveEvaluator - }; + virtual void allocate(); + double **scale; + bool recursive; // "recursive" option for ACERecursiveEvaluator +}; } #endif From b57025523f58da4ceab22319986e06db4e29ac6a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 19:28:02 -0400 Subject: [PATCH 304/370] honor LAMMPS_POTENTIALS environment variable when loading potential file --- src/USER-PACE/pair_pace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index 527f2a6f06..41551e454c 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -293,7 +293,7 @@ void PairPACE::coeff(int narg, char **arg) { map_element2type(narg-3,arg+3); - char *potential_file_name = arg[2]; + auto potential_file_name = utils::get_potential_file_path(arg[2]); char **elemtypes = &arg[3]; //load potential file From f6f383bf99b33e745be64d6734dd204d87a009f5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 19:29:22 -0400 Subject: [PATCH 305/370] add .gitignore file to lib/pace folder --- lib/pace/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 lib/pace/.gitignore diff --git a/lib/pace/.gitignore b/lib/pace/.gitignore new file mode 100644 index 0000000000..0598083baa --- /dev/null +++ b/lib/pace/.gitignore @@ -0,0 +1,2 @@ +/src +/libpace.a From 8a233a5ec77292123670e5e0856bd032530e0fad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 19:30:38 -0400 Subject: [PATCH 306/370] add unit test reference data for USER-PACE --- .../tests/manybody-pair-pace_product.yaml | 156 ++++++++++++++++++ .../tests/manybody-pair-pace_recursive.yaml | 156 ++++++++++++++++++ 2 files changed, 312 insertions(+) create mode 100644 unittest/force-styles/tests/manybody-pair-pace_product.yaml create mode 100644 unittest/force-styles/tests/manybody-pair-pace_recursive.yaml diff --git a/unittest/force-styles/tests/manybody-pair-pace_product.yaml b/unittest/force-styles/tests/manybody-pair-pace_product.yaml new file mode 100644 index 0000000000..21c37c49be --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-pace_product.yaml @@ -0,0 +1,156 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Wed Apr 7 19:29:52 2021 +epsilon: 5e-13 +skip_tests: +prerequisites: ! | + pair pace +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: pace product +pair_coeff: ! | + * * Cu-PBE-core-rep.ace Cu Cu Cu Cu Cu Cu Cu Cu +extract: ! "" +natoms: 64 +init_vdwl: -161.633164433256 +init_coul: 0 +init_stress: ! |2- + 4.9972088100615499e+00 6.2044830913935627e+00 9.1051638867046787e+00 -3.5472278350778463e+00 1.6694265484458743e+01 1.2476127820340779e+00 +init_forces: ! |2 + 1 -6.2219087614981250e-01 1.4663175178944543e+00 1.0137638901413766e+00 + 2 -1.1376106569501299e+00 -4.6174763313965872e-01 -9.1065044746775559e-01 + 3 2.1030321840370370e-01 -1.8491702608421043e-01 2.5692785978237719e-02 + 4 -8.7721996834879601e-01 1.5265564953914739e+00 6.4946175447488763e-01 + 5 -4.2522149043165169e-01 -3.7218018176382173e-01 -9.1663252333251566e-02 + 6 3.7791326544489656e-01 1.2266089287989812e+00 2.9557107319921827e-01 + 7 -5.3020873901893739e-01 -5.3124732660122731e-01 7.0401499321631211e-01 + 8 -4.7453371627778157e-02 2.6914766341308627e-01 -3.4048361271920741e-01 + 9 -1.5727338601129420e-01 -8.3756943998984656e-01 -1.0686980500960253e+00 + 10 4.1485698120166843e-03 -4.7811767918434078e-01 -1.0586891580297206e+00 + 11 1.5438259205363782e+00 -1.5050047785033229e+00 9.6197857985461699e-01 + 12 -2.5123830465559287e+00 -1.7362105833106261e+00 -1.6289247068121975e+00 + 13 -5.9061498165333037e-01 2.3625898287840648e+00 -3.1399719632578482e-01 + 14 -5.5397546653775487e-01 1.8689085709447488e+00 -2.3086691928371150e-02 + 15 -1.6265821570337315e+00 1.7928198829778783e+00 -1.7156140339072117e+00 + 16 8.1679939937581825e-01 3.9772968007052850e-01 3.1004730854830331e+00 + 17 1.0595934046175022e+00 1.1460004586855164e+00 -1.8847997843937443e+00 + 18 2.0249462959828027e-01 2.6186197454749149e-01 1.4401663320550588e+00 + 19 -5.4631311118700510e-01 -7.9893542481115554e-01 -3.9498484189193867e-01 + 20 -2.7894722368446363e+00 3.3102350276296261e-01 1.9153108358696447e-01 + 21 7.2621138168723165e-01 -6.2245359068793776e-02 -1.1867468416622704e+00 + 22 -2.8699857742027954e+00 2.0263873921216695e+00 -2.5768047926156896e+00 + 23 6.7173035813894433e-01 1.1304059874438197e+00 9.5707129936936708e-01 + 24 8.1087520346689013e-01 9.3244931025572342e-01 1.2800553902585901e+00 + 25 2.8247847798959724e-01 -1.2561285000275449e-01 5.0249723343582131e-01 + 26 -1.2883224887965014e-01 -1.4823080811794720e-01 2.1451743731744269e-01 + 27 8.7218773747963574e-01 -4.8694991909043589e-01 8.0838245267066877e-01 + 28 -8.4108903261132240e-03 4.7660038551589268e-01 2.2692513770082767e+00 + 29 -1.2657298236003225e+00 5.0651440211205545e-01 -4.8138238615461226e-01 + 30 -4.9017825771987117e-01 4.3447662476279558e-01 -3.4664013847475933e-01 + 31 -5.2051576149994172e-01 3.8596959394993430e-01 -3.4070818553119930e-01 + 32 -1.3692783712259324e+00 1.9224558097577280e-01 -2.3226212734495302e-01 + 33 2.0607521792189685e+00 -1.2673195197857356e+00 1.6670068237762361e+00 + 34 -4.3444509217934746e-02 -3.3223620460414396e-02 1.7607017023404770e-01 + 35 5.0753059936755485e-01 -3.2385224472005308e-01 1.0142288303361275e+00 + 36 1.3677004996446801e-01 -9.3517724534410873e-01 2.4335569461986416e-02 + 37 -7.4579131173355373e-01 8.8843839477814257e-01 -9.4789414920423842e-01 + 38 3.9719539842505980e-02 -1.5258728344629927e-01 8.3622980382132700e-03 + 39 8.1730755341737116e-01 -9.8384548843887609e-01 -1.6996132976225720e+00 + 40 1.7801146130924872e+00 -1.1427274274008914e+00 -6.5983603408485103e-01 + 41 5.2820539468557050e-03 -2.3421071155474642e-02 -2.2563348155755425e-01 + 42 -1.5456364604619246e+00 -8.8225129116518508e-01 -5.8763735424108920e-01 + 43 1.1131408674714505e-01 -2.2247577888201988e+00 9.9728168268816919e-02 + 44 1.3854946872101335e+00 -1.5126948458101386e+00 9.7414222691400487e-01 + 45 -4.5981549862059468e-01 8.1397756884858363e-01 -1.3541793681441523e+00 + 46 -6.2619038173039365e-01 -8.2735236769680287e-01 2.2798662790638051e+00 + 47 1.0779718530622200e+00 5.2605298038101200e-01 6.1701114081825081e-01 + 48 3.8637284054399190e-01 3.0866805709781331e-01 -1.6028037248104018e-01 + 49 -8.8513638517173976e-01 -2.2564795567224198e+00 -1.4543286189784184e+00 + 50 4.0710335798111497e-01 1.0605235322146205e+00 -3.9752095773786261e-01 + 51 -9.1955086227825678e-01 1.6763661105933092e+00 1.6016036592489016e+00 + 52 2.4999859814585754e+00 -2.4516798161916005e+00 2.9455125031924960e+00 + 53 1.3494715555333863e+00 1.5041935505267137e+00 1.1203406583029385e+00 + 54 1.0781523968729976e+00 -1.1923649286227966e+00 -9.5279276661349610e-01 + 55 8.9808463906224834e-01 -1.4591385038403597e+00 -1.5496340042814589e+00 + 56 -1.6781965313765140e-01 2.7770530096449575e-01 -9.0012005317367583e-01 + 57 8.4669616061380487e-02 -3.6858526486025139e-01 -5.9756791316798570e-02 + 58 8.5722805697043558e-01 -4.6399147930805790e-01 3.6325830284450400e-01 + 59 1.6110642872174779e+00 9.9355375331449325e-01 -9.4982017793350748e-01 + 60 -1.3129344859566598e+00 -2.5250923468261077e+00 -1.6935614677383237e+00 + 61 -4.4869257920465672e-02 6.9444242511398624e-01 -2.4196506339842316e-01 + 62 -1.1637776716822190e+00 1.1834011745844724e+00 -9.3135952930487587e-01 + 63 9.6457625131492997e-01 -1.4202510282595555e+00 -6.5977083749846954e-01 + 64 1.3468893282796701e+00 1.5138254987169797e+00 2.7159451744492960e+00 +run_vdwl: -161.618480729195 +run_coul: 0 +run_stress: ! |2- + 4.9994648190802469e+00 6.2341889704204814e+00 9.1844870434928065e+00 -3.5139192287217877e+00 1.6660134035412678e+01 1.4298492052949148e+00 +run_forces: ! |2 + 1 -6.2816679628833150e-01 1.4637637672487021e+00 1.0165317420170146e+00 + 2 -1.1422624515775013e+00 -4.7321268150877716e-01 -9.1937052724928292e-01 + 3 1.9863435270459309e-01 -1.8101272698051718e-01 3.8842917970335344e-02 + 4 -8.6907185029044620e-01 1.5294385374560244e+00 6.4103701764704912e-01 + 5 -4.3303851444525354e-01 -3.7930261859668579e-01 -8.2809410717883475e-02 + 6 3.9940995017594572e-01 1.2286053601549636e+00 3.1250581709996106e-01 + 7 -5.1887189298179548e-01 -5.1653500358989046e-01 6.9318256549563484e-01 + 8 -5.4007672382228117e-02 2.6859183359408156e-01 -3.4042178338983115e-01 + 9 -1.7074436045121943e-01 -8.5109770186947620e-01 -1.0773588492848072e+00 + 10 3.0793973322678671e-04 -4.8186595253268472e-01 -1.0405155138263378e+00 + 11 1.5283231048348811e+00 -1.4922676136398514e+00 9.5299400757773478e-01 + 12 -2.5067070901167137e+00 -1.7260607993708745e+00 -1.6244790393474420e+00 + 13 -5.6235790886570680e-01 2.3585631413137618e+00 -2.9127876443329359e-01 + 14 -5.6548461211840872e-01 1.8653022429237700e+00 -3.3242294041994691e-02 + 15 -1.6247793293987234e+00 1.7878424820880410e+00 -1.7100129080118776e+00 + 16 8.1592475815211640e-01 3.9978815670043610e-01 3.0954281982865943e+00 + 17 1.0568502301698139e+00 1.1454676964498280e+00 -1.8730495547882335e+00 + 18 1.8424845063192019e-01 2.7392740222782286e-01 1.4489558473703783e+00 + 19 -5.5999914801363948e-01 -8.1164618021764123e-01 -4.0693565170944346e-01 + 20 -2.7796384097824927e+00 3.1873084687724579e-01 1.7813456086024190e-01 + 21 7.3330693120564727e-01 -8.0395528722245327e-02 -1.2031927072203379e+00 + 22 -2.8714070500131230e+00 2.0341709966821746e+00 -2.5868755001462174e+00 + 23 6.7965142776034648e-01 1.1390245455901293e+00 9.6635789845676201e-01 + 24 8.2281062435904495e-01 9.2819309753370116e-01 1.2754920796056943e+00 + 25 2.8226519759590424e-01 -1.2226596891011678e-01 4.9537642544898125e-01 + 26 -1.3183205688042435e-01 -1.4257647612047622e-01 2.1434508820007092e-01 + 27 8.7792855239715339e-01 -4.9723350353286189e-01 8.1153570058578628e-01 + 28 -2.0947861194287209e-02 4.8894215287088771e-01 2.2752551215641708e+00 + 29 -1.2702068511884055e+00 5.1109069534141316e-01 -4.8571925387760806e-01 + 30 -4.8291102543559505e-01 4.2805907218805661e-01 -3.4628363342745988e-01 + 31 -5.1815876825981022e-01 3.8579011364491556e-01 -3.3978922486345037e-01 + 32 -1.3608082901833720e+00 1.8827011193929857e-01 -2.3469836599399560e-01 + 33 2.0529282523834711e+00 -1.2685983762091522e+00 1.6663497592278897e+00 + 34 -4.5189243354727182e-02 -3.2736561856626163e-02 1.8030687445807031e-01 + 35 5.0972119775588631e-01 -3.2015892710668520e-01 1.0138858093121164e+00 + 36 1.2271707477597629e-01 -9.3118808111966556e-01 6.0812551409211574e-03 + 37 -7.4244159178072111e-01 8.8563960698770794e-01 -9.5166206712247381e-01 + 38 4.5283609418616089e-02 -1.5033288786816132e-01 1.0628470501896768e-02 + 39 8.1272114808168361e-01 -9.7791747752504798e-01 -1.7007525281592790e+00 + 40 1.8000478262438198e+00 -1.1538213789257317e+00 -6.7136411510679861e-01 + 41 1.5499683265522783e-02 -1.3955600748288348e-02 -2.1744779416050455e-01 + 42 -1.5503540998240530e+00 -8.9262908626198989e-01 -5.9864359763177577e-01 + 43 1.0386261899746982e-01 -2.2234594365313654e+00 9.2443698220991327e-02 + 44 1.3872759356889137e+00 -1.5127698142330404e+00 9.7258424666774057e-01 + 45 -4.6739915218621014e-01 8.0388098835321042e-01 -1.3465943067485506e+00 + 46 -6.2872500689429289e-01 -8.2458713276079976e-01 2.2958918389492728e+00 + 47 1.0814994400034377e+00 5.2553860312232092e-01 6.1776419974193064e-01 + 48 3.8751598752151462e-01 3.1426891660378731e-01 -1.6298137257439968e-01 + 49 -9.0904275530250200e-01 -2.2873822047160863e+00 -1.4864379781792141e+00 + 50 4.1358159051664400e-01 1.0570092137239000e+00 -4.0323250644756137e-01 + 51 -9.4172195349527010e-01 1.6996496654949222e+00 1.6115119215552665e+00 + 52 2.5097037619453455e+00 -2.4525324196081129e+00 2.9540058179786848e+00 + 53 1.3720332798470005e+00 1.5342144442319867e+00 1.1653691882985184e+00 + 54 1.0768101277470987e+00 -1.1921583386413552e+00 -9.4962490497040664e-01 + 55 8.8736792497602746e-01 -1.4571034818051574e+00 -1.5335539060163184e+00 + 56 -1.6630858341375376e-01 2.6605463886145830e-01 -8.9638200504290855e-01 + 57 8.2311794363042881e-02 -3.7571896462749871e-01 -5.9456549563766878e-02 + 58 8.5610205446436338e-01 -4.5532402871724648e-01 3.5240564373735805e-01 + 59 1.6277722160751178e+00 1.0048795089638383e+00 -9.5389574412271805e-01 + 60 -1.3396097925873200e+00 -2.5484866844918983e+00 -1.7252656664423354e+00 + 61 -4.1356937053694531e-02 6.9831995565982619e-01 -2.3722369658580467e-01 + 62 -1.1615014571620641e+00 1.1805918165226632e+00 -9.2596032516965732e-01 + 63 9.6753599487408937e-01 -1.4353996747437299e+00 -6.7618187950266095e-01 + 64 1.3730994742564451e+00 1.5481237027388630e+00 2.7374902138995694e+00 +... diff --git a/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml new file mode 100644 index 0000000000..43b52a5391 --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml @@ -0,0 +1,156 @@ +--- +lammps_version: 10 Mar 2021 +date_generated: Wed Apr 7 19:30:07 2021 +epsilon: 5e-13 +skip_tests: +prerequisites: ! | + pair pace +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: pace recursive +pair_coeff: ! | + * * Cu-PBE-core-rep.ace Cu Cu Cu Cu Cu Cu Cu Cu +extract: ! "" +natoms: 64 +init_vdwl: -161.633164433261 +init_coul: 0 +init_stress: ! |2- + 4.9972088100713812e+00 6.2044830914039082e+00 9.1051638867151059e+00 -3.5472278350779094e+00 1.6694265484458967e+01 1.2476127820342575e+00 +init_forces: ! |2 + 1 -6.2219087614976065e-01 1.4663175178944572e+00 1.0137638901413537e+00 + 2 -1.1376106569501236e+00 -4.6174763313970757e-01 -9.1065044746784896e-01 + 3 2.1030321840359212e-01 -1.8491702608427843e-01 2.5692785978129237e-02 + 4 -8.7721996834878824e-01 1.5265564953915360e+00 6.4946175447490173e-01 + 5 -4.2522149043160318e-01 -3.7218018176385625e-01 -9.1663252333276296e-02 + 6 3.7791326544486292e-01 1.2266089287991140e+00 2.9557107319932868e-01 + 7 -5.3020873901893451e-01 -5.3124732660126450e-01 7.0401499321635996e-01 + 8 -4.7453371627832100e-02 2.6914766341310509e-01 -3.4048361271929112e-01 + 9 -1.5727338601131144e-01 -8.3756943998987954e-01 -1.0686980500959902e+00 + 10 4.1485698119566282e-03 -4.7811767918420989e-01 -1.0586891580297877e+00 + 11 1.5438259205364635e+00 -1.5050047785034886e+00 9.6197857985467283e-01 + 12 -2.5123830465558123e+00 -1.7362105833106412e+00 -1.6289247068123103e+00 + 13 -5.9061498165326987e-01 2.3625898287840066e+00 -3.1399719632578593e-01 + 14 -5.5397546653770346e-01 1.8689085709447653e+00 -2.3086691928354244e-02 + 15 -1.6265821570337562e+00 1.7928198829776705e+00 -1.7156140339071948e+00 + 16 8.1679939937577550e-01 3.9772968007061277e-01 3.1004730854830349e+00 + 17 1.0595934046175248e+00 1.1460004586857007e+00 -1.8847997843938362e+00 + 18 2.0249462959833447e-01 2.6186197454741122e-01 1.4401663320550206e+00 + 19 -5.4631311118702253e-01 -7.9893542481102942e-01 -3.9498484189200239e-01 + 20 -2.7894722368447864e+00 3.3102350276278353e-01 1.9153108358694923e-01 + 21 7.2621138168723631e-01 -6.2245359068663686e-02 -1.1867468416622644e+00 + 22 -2.8699857742029091e+00 2.0263873921216184e+00 -2.5768047926156705e+00 + 23 6.7173035813885495e-01 1.1304059874438499e+00 9.5707129936933311e-01 + 24 8.1087520346680431e-01 9.3244931025571798e-01 1.2800553902586222e+00 + 25 2.8247847798945536e-01 -1.2561285000276420e-01 5.0249723343583008e-01 + 26 -1.2883224887964320e-01 -1.4823080811799477e-01 2.1451743731744408e-01 + 27 8.7218773747968470e-01 -4.8694991909036628e-01 8.0838245267060171e-01 + 28 -8.4108903260151635e-03 4.7660038551579958e-01 2.2692513770083211e+00 + 29 -1.2657298236002679e+00 5.0651440211208831e-01 -4.8138238615456286e-01 + 30 -4.9017825771975698e-01 4.3447662476281140e-01 -3.4664013847486475e-01 + 31 -5.2051576149983925e-01 3.8596959395000907e-01 -3.4070818553126514e-01 + 32 -1.3692783712259216e+00 1.9224558097570044e-01 -2.3226212734480328e-01 + 33 2.0607521792189862e+00 -1.2673195197858425e+00 1.6670068237762066e+00 + 34 -4.3444509217972604e-02 -3.3223620460338277e-02 1.7607017023409030e-01 + 35 5.0753059936748002e-01 -3.2385224472009999e-01 1.0142288303361040e+00 + 36 1.3677004996441039e-01 -9.3517724534399915e-01 2.4335569462137843e-02 + 37 -7.4579131173356694e-01 8.8843839477811493e-01 -9.4789414920418880e-01 + 38 3.9719539842571261e-02 -1.5258728344628525e-01 8.3622980381342846e-03 + 39 8.1730755341728512e-01 -9.8384548843884079e-01 -1.6996132976225846e+00 + 40 1.7801146130923835e+00 -1.1427274274009283e+00 -6.5983603408481306e-01 + 41 5.2820539467414857e-03 -2.3421071155573910e-02 -2.2563348155758098e-01 + 42 -1.5456364604620965e+00 -8.8225129116507839e-01 -5.8763735424098651e-01 + 43 1.1131408674736287e-01 -2.2247577888201659e+00 9.9728168268968409e-02 + 44 1.3854946872102469e+00 -1.5126948458100051e+00 9.7414222691401664e-01 + 45 -4.5981549862049609e-01 8.1397756884859851e-01 -1.3541793681441470e+00 + 46 -6.2619038173035535e-01 -8.2735236769680376e-01 2.2798662790638025e+00 + 47 1.0779718530621707e+00 5.2605298038103576e-01 6.1701114081812414e-01 + 48 3.8637284054407789e-01 3.0866805709788758e-01 -1.6028037248101001e-01 + 49 -8.8513638517169380e-01 -2.2564795567223652e+00 -1.4543286189782592e+00 + 50 4.0710335798118663e-01 1.0605235322144930e+00 -3.9752095773780305e-01 + 51 -9.1955086227837013e-01 1.6763661105933743e+00 1.6016036592489449e+00 + 52 2.4999859814584600e+00 -2.4516798161916613e+00 2.9455125031925271e+00 + 53 1.3494715555332963e+00 1.5041935505267034e+00 1.1203406583029645e+00 + 54 1.0781523968730000e+00 -1.1923649286229243e+00 -9.5279276661359580e-01 + 55 8.9808463906211189e-01 -1.4591385038403633e+00 -1.5496340042814931e+00 + 56 -1.6781965313775016e-01 2.7770530096449070e-01 -9.0012005317363286e-01 + 57 8.4669616061344807e-02 -3.6858526486015031e-01 -5.9756791316800374e-02 + 58 8.5722805697030136e-01 -4.6399147930816353e-01 3.6325830284449651e-01 + 59 1.6110642872176364e+00 9.9355375331453510e-01 -9.4982017793350770e-01 + 60 -1.3129344859565715e+00 -2.5250923468261557e+00 -1.6935614677383823e+00 + 61 -4.4869257920441788e-02 6.9444242511398635e-01 -2.4196506339840404e-01 + 62 -1.1637776716821653e+00 1.1834011745845063e+00 -9.3135952930485300e-01 + 63 9.6457625131507396e-01 -1.4202510282595464e+00 -6.5977083749854104e-01 + 64 1.3468893282798624e+00 1.5138254987169519e+00 2.7159451744492755e+00 +run_vdwl: -161.618480729193 +run_coul: 0 +run_stress: ! |2- + 4.9994648190880460e+00 6.2341889704281970e+00 9.1844870435007469e+00 -3.5139192287216519e+00 1.6660134035412629e+01 1.4298492052947611e+00 +run_forces: ! |2 + 1 -6.2816679628832128e-01 1.4637637672488530e+00 1.0165317420171567e+00 + 2 -1.1422624515773547e+00 -4.7321268150894835e-01 -9.1937052724939328e-01 + 3 1.9863435270447563e-01 -1.8101272698046844e-01 3.8842917970311100e-02 + 4 -8.6907185029051970e-01 1.5294385374559754e+00 6.4103701764724941e-01 + 5 -4.3303851444527064e-01 -3.7930261859680259e-01 -8.2809410717699622e-02 + 6 3.9940995017606218e-01 1.2286053601548976e+00 3.1250581709979730e-01 + 7 -5.1887189298196845e-01 -5.1653500358999127e-01 6.9318256549549417e-01 + 8 -5.4007672382224883e-02 2.6859183359401456e-01 -3.4042178338972828e-01 + 9 -1.7074436045121416e-01 -8.5109770186939693e-01 -1.0773588492847035e+00 + 10 3.0793973323051810e-04 -4.8186595253265396e-01 -1.0405155138263271e+00 + 11 1.5283231048349268e+00 -1.4922676136399666e+00 9.5299400757780717e-01 + 12 -2.5067070901166972e+00 -1.7260607993709931e+00 -1.6244790393474351e+00 + 13 -5.6235790886583970e-01 2.3585631413136179e+00 -2.9127876443333595e-01 + 14 -5.6548461211843171e-01 1.8653022429237356e+00 -3.3242294041971987e-02 + 15 -1.6247793293987416e+00 1.7878424820878918e+00 -1.7100129080120188e+00 + 16 8.1592475815216303e-01 3.9978815670041690e-01 3.0954281982866050e+00 + 17 1.0568502301698155e+00 1.1454676964498558e+00 -1.8730495547881063e+00 + 18 1.8424845063197498e-01 2.7392740222789114e-01 1.4489558473704491e+00 + 19 -5.5999914801367834e-01 -8.1164618021765156e-01 -4.0693565170939688e-01 + 20 -2.7796384097825526e+00 3.1873084687730341e-01 1.7813456086038751e-01 + 21 7.3330693120563484e-01 -8.0395528722151582e-02 -1.2031927072201976e+00 + 22 -2.8714070500131141e+00 2.0341709966822590e+00 -2.5868755001463439e+00 + 23 6.7965142776034937e-01 1.1390245455901691e+00 9.6635789845673215e-01 + 24 8.2281062435890928e-01 9.2819309753390167e-01 1.2754920796057649e+00 + 25 2.8226519759595764e-01 -1.2226596891014743e-01 4.9537642544899713e-01 + 26 -1.3183205688038924e-01 -1.4257647612039717e-01 2.1434508820029102e-01 + 27 8.7792855239706757e-01 -4.9723350353285928e-01 8.1153570058585001e-01 + 28 -2.0947861194201500e-02 4.8894215287086157e-01 2.2752551215641588e+00 + 29 -1.2702068511883076e+00 5.1109069534141138e-01 -4.8571925387763182e-01 + 30 -4.8291102543552133e-01 4.2805907218813599e-01 -3.4628363342741275e-01 + 31 -5.1815876825973306e-01 3.8579011364505383e-01 -3.3978922486349478e-01 + 32 -1.3608082901834111e+00 1.8827011193937446e-01 -2.3469836599383653e-01 + 33 2.0529282523835013e+00 -1.2685983762092712e+00 1.6663497592278267e+00 + 34 -4.5189243354751718e-02 -3.2736561856755692e-02 1.8030687445809970e-01 + 35 5.0972119775587099e-01 -3.2015892710665028e-01 1.0138858093119485e+00 + 36 1.2271707477597758e-01 -9.3118808111974460e-01 6.0812551408806932e-03 + 37 -7.4244159178063873e-01 8.8563960698757693e-01 -9.5166206712249257e-01 + 38 4.5283609418585336e-02 -1.5033288786827403e-01 1.0628470501999519e-02 + 39 8.1272114808181617e-01 -9.7791747752517932e-01 -1.7007525281592044e+00 + 40 1.8000478262439097e+00 -1.1538213789257521e+00 -6.7136411510685423e-01 + 41 1.5499683265592791e-02 -1.3955600748503419e-02 -2.1744779416054441e-01 + 42 -1.5503540998240890e+00 -8.9262908626199444e-01 -5.9864359763176522e-01 + 43 1.0386261899753707e-01 -2.2234594365314631e+00 9.2443698220934262e-02 + 44 1.3872759356888453e+00 -1.5127698142329729e+00 9.7258424666771137e-01 + 45 -4.6739915218619787e-01 8.0388098835315858e-01 -1.3465943067486295e+00 + 46 -6.2872500689439892e-01 -8.2458713276081630e-01 2.2958918389493181e+00 + 47 1.0814994400035058e+00 5.2553860312226619e-01 6.1776419974197272e-01 + 48 3.8751598752146438e-01 3.1426891660371681e-01 -1.6298137257451450e-01 + 49 -9.0904275530255685e-01 -2.2873822047160055e+00 -1.4864379781792907e+00 + 50 4.1358159051644028e-01 1.0570092137240017e+00 -4.0323250644759429e-01 + 51 -9.4172195349516652e-01 1.6996496654948405e+00 1.6115119215552218e+00 + 52 2.5097037619454046e+00 -2.4525324196079747e+00 2.9540058179785182e+00 + 53 1.3720332798469679e+00 1.5342144442320667e+00 1.1653691882983437e+00 + 54 1.0768101277471369e+00 -1.1921583386412453e+00 -9.4962490497026519e-01 + 55 8.8736792497605987e-01 -1.4571034818051218e+00 -1.5335539060162722e+00 + 56 -1.6630858341372168e-01 2.6605463886156522e-01 -8.9638200504305587e-01 + 57 8.2311794363030891e-02 -3.7571896462756421e-01 -5.9456549563895990e-02 + 58 8.5610205446440457e-01 -4.5532402871718020e-01 3.5240564373727451e-01 + 59 1.6277722160751129e+00 1.0048795089638642e+00 -9.5389574412266476e-01 + 60 -1.3396097925873169e+00 -2.5484866844917313e+00 -1.7252656664424246e+00 + 61 -4.1356937053699777e-02 6.9831995565994065e-01 -2.3722369658585374e-01 + 62 -1.1615014571620197e+00 1.1805918165227427e+00 -9.2596032516965954e-01 + 63 9.6753599487398723e-01 -1.4353996747436160e+00 -6.7618187950256603e-01 + 64 1.3730994742563347e+00 1.5481237027388883e+00 2.7374902138994806e+00 +... From a84ac392a34c7e3f6d33e8fc5aea33ac8963ac40 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 23:25:22 -0400 Subject: [PATCH 307/370] silence compiler warnings --- src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 2247a9467c..d1f9d33e8a 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -581,7 +581,7 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, { double r2inv,r6inv,r,grij,expm2,t,erfc1,prefactor,prefactor2; double fraction,table,forcecoul,forcecoul2,forcelj; - double rrij,expn2,erfc2,expb,ecoul,evdwl,trx,tr,ftr; + double rrij,expn2,erfc2,ecoul,evdwl,trx,tr,ftr; int itable; From 1ca38db9dfde1b3c34bf9e1eb804f484f8dcc753 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 7 Apr 2021 23:26:21 -0400 Subject: [PATCH 308/370] simplify and avoid temporary buffers when piping to/from gzip --- src/dump.cpp | 32 ++++++++++++++----------------- src/fix_tmd.cpp | 49 ++++++++++++++++++++++------------------------- src/library.cpp | 15 +++++---------- src/read_data.cpp | 16 +++++++++------- src/reader.cpp | 16 +++++++++------- 5 files changed, 60 insertions(+), 68 deletions(-) diff --git a/src/dump.cpp b/src/dump.cpp index 031364dada..c483d90fc3 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -14,16 +14,16 @@ #include "dump.h" #include "atom.h" -#include "irregular.h" -#include "update.h" -#include "domain.h" -#include "group.h" -#include "output.h" -#include "modify.h" -#include "fix.h" #include "compute.h" -#include "memory.h" +#include "domain.h" #include "error.h" +#include "fix.h" +#include "group.h" +#include "irregular.h" +#include "memory.h" +#include "modify.h" +#include "output.h" +#include "update.h" #include @@ -141,12 +141,9 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) if (strchr(filename,'*')) multifile = 1; - char *suffix = filename + strlen(filename) - strlen(".bin"); - if (suffix > filename && strcmp(suffix,".bin") == 0) binary = 1; - suffix = filename + strlen(filename) - strlen(".gz"); - if (suffix > filename && strcmp(suffix,".gz") == 0) compressed = 1; - suffix = filename + strlen(filename) - strlen(".zst"); - if (suffix > filename && strcmp(suffix,".zst") == 0) compressed = 1; + if (utils::strmatch(filename, "\\.bin$")) binary = 1; + if (utils::strmatch(filename, "\\.gz$") + || utils::strmatch(filename, "\\.zst$")) compressed = 1; } /* ---------------------------------------------------------------------- */ @@ -582,12 +579,11 @@ void Dump::openfile() if (filewriter) { if (compressed) { #ifdef LAMMPS_GZIP - char gzip[128]; - sprintf(gzip,"gzip -6 > %s",filecurrent); + auto gzip = fmt::format("gzip -6 > {}",filecurrent); #ifdef _WIN32 - fp = _popen(gzip,"wb"); + fp = _popen(gzip.c_str(),"wb"); #else - fp = popen(gzip,"w"); + fp = popen(gzip.c_str(),"w"); #endif #else error->one(FLERR,"Cannot open gzipped file"); diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 8cff132c63..f462b0633b 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -18,19 +18,18 @@ #include "fix_tmd.h" +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "respa.h" +#include "update.h" + #include #include -#include "atom.h" -#include "update.h" -#include "modify.h" -#include "domain.h" -#include "group.h" -#include "respa.h" -#include "force.h" -#include "memory.h" -#include "error.h" - - using namespace LAMMPS_NS; using namespace FixConst; @@ -520,31 +519,29 @@ void FixTMD::readfile(char *file) void FixTMD::open(char *file) { - compressed = 0; - char *suffix = file + strlen(file) - 3; - if (suffix > file && strcmp(suffix,".gz") == 0) compressed = 1; - if (!compressed) fp = fopen(file,"r"); - else { + if (utils::strmatch(file,"\\.gz$")) { + compressed = 1; + #ifdef LAMMPS_GZIP - char gunzip[128]; - snprintf(gunzip,128,"gzip -c -d %s",file); + auto gunzip = fmt::format("gzip -c -d {}",file); #ifdef _WIN32 - fp = _popen(gunzip,"rb"); + fp = _popen(gunzip.c_str(),"rb"); #else - fp = popen(gunzip,"r"); + fp = popen(gunzip.c_str(),"r"); #endif #else - error->one(FLERR,"Cannot open gzipped file"); + error->one(FLERR,"Cannot open gzipped file without gzip support"); #endif + } else { + compressed = 0; + fp = fopen(file,"r"); } - if (fp == nullptr) { - char str[128]; - snprintf(str,128,"Cannot open file %s",file); - error->one(FLERR,str); - } + if (fp == nullptr) + error->one(FLERR,fmt::format("Cannot open file {}: {}", + file, utils::getsyserror())); } /* ---------------------------------------------------------------------- */ diff --git a/src/library.cpp b/src/library.cpp index b72c8d7220..300aafc293 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4734,19 +4734,14 @@ void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr c BEGIN_CAPTURE { int ifix = lmp->modify->find_fix(id); - if (ifix < 0) { - char str[128]; - snprintf(str, 128, "Can not find fix with ID '%s'!", id); - lmp->error->all(FLERR,str); - } + if (ifix < 0) + lmp->error->all(FLERR,fmt::format("Cannot find fix with ID '{}'!", id)); Fix *fix = lmp->modify->fix[ifix]; - if (strcmp("external",fix->style) != 0) { - char str[128]; - snprintf(str, 128, "Fix '%s' is not of style external!", id); - lmp->error->all(FLERR,str); - } + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,fmt::format("Fix '{}' is not of style " + "external!", id)); FixExternal * fext = (FixExternal*) fix; fext->set_callback(callback, caller); diff --git a/src/read_data.cpp b/src/read_data.cpp index 09fb8f3eae..cc3b2e5965 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1954,13 +1954,12 @@ int ReadData::reallocate(int **pcount, int cmax, int amax) void ReadData::open(char *file) { - compressed = 0; - char *suffix = file + strlen(file) - 3; - if (suffix > file && strcmp(suffix,".gz") == 0) compressed = 1; - if (!compressed) fp = fopen(file,"r"); - else { + if (utils::strmatch(file,"\\.gz$")) { + compressed = 1; + #ifdef LAMMPS_GZIP - std::string gunzip = fmt::format("gzip -c -d {}",file); + auto gunzip = fmt::format("gzip -c -d {}",file); + #ifdef _WIN32 fp = _popen(gunzip.c_str(),"rb"); #else @@ -1968,8 +1967,11 @@ void ReadData::open(char *file) #endif #else - error->one(FLERR,"Cannot open gzipped file: " + utils::getsyserror()); + error->one(FLERR,"Cannot open gzipped file without gzip support"); #endif + } else { + compressed = 0; + fp = fopen(file,"r"); } if (fp == nullptr) diff --git a/src/reader.cpp b/src/reader.cpp index a4bc8d816f..c22a9f7e5d 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -37,13 +37,12 @@ void Reader::open_file(const char *file) { if (fp != nullptr) close_file(); - compressed = 0; - const char *suffix = file + strlen(file) - 3; - if (suffix > file && strcmp(suffix,".gz") == 0) compressed = 1; - if (!compressed) fp = fopen(file,"r"); - else { + if (utils::strmatch(file,"\\.gz$")) { + compressed = 1; + #ifdef LAMMPS_GZIP - std::string gunzip = fmt::format("gzip -c -d {}",file); + auto gunzip = fmt::format("gzip -c -d {}",file); + #ifdef _WIN32 fp = _popen(gunzip.c_str(),"rb"); #else @@ -51,8 +50,11 @@ void Reader::open_file(const char *file) #endif #else - error->one(FLERR,"Cannot open gzipped file: " + utils::getsyserror()); + error->one(FLERR,"Cannot open gzipped file without gzip support"); #endif + } else { + compressed = 0; + fp = fopen(file,"r"); } if (fp == nullptr) From d22d6ad45d97028977f916b92276d1cad819874a Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Thu, 8 Apr 2021 11:52:49 +0200 Subject: [PATCH 309/370] cmake/USER-PACE.cmake: update PACELIB_URL and PACELIB_MD5 (new source files with whitespaces) lib/pace: add Makefile, Install.py use make remove the LICENSE from src/USER-PACE --- cmake/Modules/Packages/USER-PACE.cmake | 8 +- lib/pace/Install.py | 16 +- lib/pace/Makefile | 38 ++ src/USER-PACE/LICENSE | 674 ------------------------- 4 files changed, 46 insertions(+), 690 deletions(-) create mode 100644 lib/pace/Makefile delete mode 100644 src/USER-PACE/LICENSE diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake index 008d32444c..b953278e75 100644 --- a/cmake/Modules/Packages/USER-PACE.cmake +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -1,11 +1,11 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "9ebb087cba7e4ca041fde52f7e9e640c" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.upd.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "8041e3de7254815eb3ff0a11e2cc84ea" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) # download library sources to build folder -file(DOWNLOAD ${PACELIB_URL} libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) +file(DOWNLOAD ${PACELIB_URL} ./libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) # uncompress downloaded sources execute_process( @@ -20,7 +20,7 @@ file(GLOB PACE_EVALUATOR_SOURCES ${CMAKE_BINARY_DIR}/lammps-user-pace-*/USER-PAC list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) -set_target_properties(pace PROPERTIES OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) +set_target_properties(pace PROPERTIES OUTPUT_NAME pace${LAMMPS_MACHINE}) target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) target_link_libraries(lammps PRIVATE pace) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 640971e011..5f72157611 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -18,11 +18,11 @@ parser = ArgumentParser(prog='Install.py', # settings thisdir = fullpath('.') -version = "v.2021.2.3" +version = "v.2021.2.3.upd" # known checksums for different PACE versions. used to validate the download. checksums = { \ - 'v.2021.2.3' : '9ebb087cba7e4ca041fde52f7e9e640c', \ + 'v.2021.2.3.upd' : '8041e3de7254815eb3ff0a11e2cc84ea', \ } @@ -89,17 +89,9 @@ if buildflag: cmd = 'cd "%s"; rm -rf "%s"; tar -xvf %s; mv %s %s' % (thisdir, src_folder, archive_filename, unarchived_folder_name, src_folder) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) - # configure - - build_folder = "%s/build"%(thisdir) - print("Configuring libpace ...") - cmd = 'cd %s && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release' % (thisdir) - txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) - if verboseflag: print(txt.decode("UTF-8")) - # build print("Building libpace ...") - cmd = 'cd "%s" && make -j2 && cp libpace.a %s/' % (build_folder, thisdir) + cmd = 'make lib -j2' txt = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) if verboseflag: print(txt.decode("UTF-8")) @@ -107,5 +99,5 @@ if buildflag: # remove source files print("Removing pace build files and archive ...") - cmd = 'rm %s; rm -rf %s' % (download_filename, build_folder) + cmd = 'rm %s; make clean-build' % (download_filename) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) \ No newline at end of file diff --git a/lib/pace/Makefile b/lib/pace/Makefile new file mode 100644 index 0000000000..baaef0b837 --- /dev/null +++ b/lib/pace/Makefile @@ -0,0 +1,38 @@ +SHELL = /bin/sh + +# ------ FILES ------ + +SRC_FILES = $(wildcard src/USER-PACE/*.cpp) +SRC = $(filter-out src/USER-PACE/pair_pace.cpp, $(SRC_FILES)) + +# ------ DEFINITIONS ------ + +LIB = libpace.a +OBJ = $(SRC:.cpp=.o) + + +# ------ SETTINGS ------ +CXXFLAGS = -O2 -fPIC -Isrc/USER-PACE + +ARCHIVE = ar +ARCHFLAG = -rc +DEPFLAGS = -M +USRLIB = +SYSLIB = + +# ------ MAKE PROCEDURE ------ + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ) + +# ------ COMPILE RULES ------ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# ------ CLEAN ------ +clean-all: + -rm -f *~ $(OBJ) $(LIB) + +clean-build: + -rm -f *~ $(OBJ) \ No newline at end of file diff --git a/src/USER-PACE/LICENSE b/src/USER-PACE/LICENSE deleted file mode 100644 index f288702d2f..0000000000 --- a/src/USER-PACE/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. From 73ee7805dc9dae77d2adf005925cf63ca4a69a7e Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Thu, 8 Apr 2021 12:13:33 +0200 Subject: [PATCH 310/370] remove GPL3 license terms from src/USER-PACE/pair_pace.* delete lib/pace/CMakeLists.txt --- lib/pace/CMakeLists.txt | 19 ------------------- lib/pace/TODO | 30 ------------------------------ src/USER-PACE/pair_pace.cpp | 16 +--------------- src/USER-PACE/pair_pace.h | 16 +--------------- 4 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 lib/pace/CMakeLists.txt delete mode 100644 lib/pace/TODO diff --git a/lib/pace/CMakeLists.txt b/lib/pace/CMakeLists.txt deleted file mode 100644 index 2884c83cb9..0000000000 --- a/lib/pace/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 3.7) # CMake version check -project(aceevaluator) -set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard - - -set(PACE_EVALUATOR_PATH ${CMAKE_CURRENT_LIST_DIR}/src/USER-PACE) -# message("CMakeLists.txt DEBUG: PACE_EVALUATOR_PATH=${PACE_EVALUATOR_PATH}") -set(PACE_EVALUATOR_SRC_PATH ${PACE_EVALUATOR_PATH}) - -FILE(GLOB PACE_EVALUATOR_SOURCE_FILES ${PACE_EVALUATOR_SRC_PATH}/*.cpp) -list(FILTER PACE_EVALUATOR_SOURCE_FILES EXCLUDE REGEX ".*pair_pace.*") -set(PACE_EVALUATOR_INCLUDE_DIR ${PACE_EVALUATOR_SRC_PATH}) - - -##### aceevaluator ##### -add_library(aceevaluator ${PACE_EVALUATOR_SOURCE_FILES}) -target_include_directories(aceevaluator PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR}) -target_compile_options(aceevaluator PRIVATE -O3) -set_target_properties(aceevaluator PROPERTIES OUTPUT_NAME pace${LAMMPS_MACHINE}) diff --git a/lib/pace/TODO b/lib/pace/TODO deleted file mode 100644 index 8021916923..0000000000 --- a/lib/pace/TODO +++ /dev/null @@ -1,30 +0,0 @@ -[TODO/DONE] pair_pace.cpp and pair_pace.h will have to go into src/USER-PACE and thus also need to conform to our requirements. - -[TODO] also src/USER-PACE would need to have an Install.sh file that integrates the settings from the lib folder into the conventional build process. -[TODO] there would have to be a lib/pace folder for building/interfacing to the library. - -[TODO] how you organize your repo is up to you. a better way to describe what you would have to do is to point you to examples. -which of the examples is relevant depends on what build system you are using for your "PACE" external package. - -If you are using CMake to build it, you can look at the KIM package -If you are using autoconf/automake, you can look at the USER-PLUMED package -If you are using neither (just a plain Makefile), you can look at the VORONOI or QUIP package -The following additional modifications are needed: - -[TODO] lib/pace: needs one or more Makefile.lammps, a README and an Install.py file -[TODO] src/Makefile: needs support for the USER-PACE package and compiling via lib-pace. Also the package needs to be added to the PACKEXT and PACKLIB variables - -[DONE] cmake/Modules/Packages/USER-PACE.cmake needs to be added -[DONE] cmake/CMakeLists.txt needs to include it in case the package is enabled. - -[TODO] doc/src/Build_extra.rst needs to include the build instructions for CMake and traditional make -[TODO] doc/src/Package_user.rst and doc/src/Package_details.rst needs to contain relevant information and links - - -Because of the different build systems, there are different steps required, but each of the examples I've pointed out are tested and used regularly and thus should be working sufficiently well. -Mind you the QUIP package is set up in such a way, that no automatic download is possible and a manual download and compilation is required. So that is the least preferred and least convenient option. - -We are happy to provide more details, but that requires that you first have something that already is following either of the suggested variants, so that we don't have to discuss in all generality. - -I would also suggest to close this pull request here, leave all files in place, but then start a new branch from the current master and then move the few things over you need to retain, -add the build environment files and then start working on getting it to do what it should. \ No newline at end of file diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index 41551e454c..c12753603a 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -7,21 +7,7 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, ^2: University of Cambridge, Cambridge, United Kingdom ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA ^4: University of British Columbia, Vancouver, BC, Canada - - - This FILENAME is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ +*/ // diff --git a/src/USER-PACE/pair_pace.h b/src/USER-PACE/pair_pace.h index b29ee3a7a9..37509cff5e 100644 --- a/src/USER-PACE/pair_pace.h +++ b/src/USER-PACE/pair_pace.h @@ -7,21 +7,7 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, ^2: University of Cambridge, Cambridge, United Kingdom ^3: Sandia National Laboratories, Albuquerque, New Mexico, USA ^4: University of British Columbia, Vancouver, BC, Canada - - - This FILENAME is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ +*/ // From ac5bd8a4f7e7f759a0505afa3f3cbdf97fcbb846 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 08:44:18 -0400 Subject: [PATCH 311/370] correct the description of how the F dot r contributions are computed --- doc/src/compute_pressure.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/src/compute_pressure.rst b/doc/src/compute_pressure.rst index f69f70daba..3c98208261 100644 --- a/doc/src/compute_pressure.rst +++ b/doc/src/compute_pressure.rst @@ -46,13 +46,14 @@ system volume (or area in 2d). The second term is the virial, equal to -dU/dV, computed for all pairwise as well as 2-body, 3-body, 4-body, many-body, and long-range interactions, where :math:`r_i` and :math:`f_i` are the position and force vector of atom *i*, and the black -dot indicates a dot product. When periodic boundary conditions are -used, N' necessarily includes periodic image (ghost) atoms outside the -central box, and the position and force vectors of ghost atoms are thus -included in the summation. When periodic boundary conditions are not -used, N' = N = the number of atoms in the system. :doc:`Fixes ` -that impose constraints (e.g. the :doc:`fix shake ` command) -also contribute to the virial term. +dot indicates a dot product. This is computed in parallel for each +sub-domain and then summed over all parallel processes. Thus N' +necessarily includes atoms from neighboring sub-domains (so-called ghost +atoms) and the position and force vectors of ghost atoms are thus +included in the summation. Only when running in serial and without +periodic boundary conditions is N' = N = the number of atoms in the +system. :doc:`Fixes ` that impose constraints (e.g. the :doc:`fix +shake ` command) may also contribute to the virial term. A symmetric pressure tensor, stored as a 6-element vector, is also calculated by this compute. The 6 components of the vector are From 74a37964188469aad2fa5d57bb1858cf7b048bf4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 08:51:33 -0400 Subject: [PATCH 312/370] avoid ambiguous precedence through using parentheses. update unit test reference --- src/MOLECULE/angle_cosine_periodic.cpp | 10 +-- .../tests/angle-cosine_periodic.yaml | 80 +++++++++---------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 0df103c333..6d4252e8b3 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -17,17 +17,17 @@ #include "angle_cosine_periodic.h" -#include #include "atom.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -224,7 +224,7 @@ void AngleCosinePeriodic::coeff(int narg, char **arg) double AngleCosinePeriodic::equilibrium_angle(int i) { - return MY_PI*(1.0 - (b[i]>0)?0.0:1.0/static_cast(multiplicity[i])); + return MY_PI*(1.0 - ((b[i]>0) ? 0.0 : (1.0/static_cast(multiplicity[i])))); } /* ---------------------------------------------------------------------- diff --git a/unittest/force-styles/tests/angle-cosine_periodic.yaml b/unittest/force-styles/tests/angle-cosine_periodic.yaml index 1c6cb7158d..84d8ff1194 100644 --- a/unittest/force-styles/tests/angle-cosine_periodic.yaml +++ b/unittest/force-styles/tests/angle-cosine_periodic.yaml @@ -1,6 +1,6 @@ --- -lammps_version: 10 Mar 2021 -date_generated: Tue Apr 6 18:38:56 2021 +lammps_version: 8 Apr 2021 +date_generated: Thu Apr 8 09:28:11 2021 epsilon: 2.5e-13 prerequisites: ! | atom full @@ -11,32 +11,32 @@ input_file: in.fourmol angle_style: cosine/periodic angle_coeff: ! | 1 75.0 1 2 - 2 45.0 1 2 + 2 45.0 -1 2 3 50.0 -1 3 4 100.0 -1 4 -equilibrium: 4 1.5707963267948966 1.5707963267948966 0 0 +equilibrium: 4 3.141592653589793 1.5707963267948966 2.0943951023931957 2.356194490192345 extract: ! "" natoms: 29 -init_energy: 946.676664091363 -init_stress: ! |2- - 3.8581448829084906e+00 -6.3926599144452858e+01 6.0068454261544439e+01 1.4347370855129017e+02 1.0109551149053127e+02 4.9470344115369670e+01 +init_energy: 605.3643061001458 +init_stress: ! |- + -1.7082420754402889e+01 -7.3281097507808681e+00 2.4410530505183818e+01 8.5827033671406951e+01 1.4260977966148616e+02 4.1579557432232576e+01 init_forces: ! |2 1 7.9609486050127529e+00 -3.9274211736421961e+01 -3.8917410871887981e+01 2 4.6997439470662350e+00 3.8052682089524090e+01 3.0599010994189470e+01 - 3 -4.4330179925982058e+01 -1.6514501437366098e+00 1.9894582317318523e+01 - 4 1.1465928779203908e+01 -7.1462736556935234e+00 -1.8983545733370338e+01 - 5 2.7634466780141157e+01 1.5504150132065057e+01 1.0078115065618357e+01 - 6 2.2512674572611367e+01 -5.4260358088923418e+01 -6.0646506351853276e+01 + 3 -7.1532072701475698e+01 9.6873528247272844e+01 7.3410935137796983e+01 + 4 3.1784763224659116e+01 -4.4133218046130608e+01 -6.2234613362865147e+01 + 5 5.8817481848549889e+01 -2.5112568523390145e+01 3.9611729278121981e+00 + 6 -8.7258065964885336e+00 -4.2663580774228997e+01 -1.6819642012415606e+01 7 -1.5578858996464229e+01 1.3895348629116569e+01 -3.3939856789628062e+00 - 8 -2.6028225001107934e+00 4.7418887884887312e+01 1.2659217319984802e+02 - 9 9.4419020144376677e+00 -1.3812152922900303e+01 1.2280697239365450e+00 - 10 3.7181742871134183e+01 -2.6592777970320334e+01 -1.0034832175946605e+02 - 11 1.1888648487599809e+01 -1.7288532453781471e+00 -1.8714004234488471e+00 - 12 1.3452345752647041e+01 3.9195153629390539e+01 -3.9429673136141247e+01 - 13 -4.6656310032990458e+00 -1.2502935413462930e+01 1.4918864440944628e+01 - 14 -2.1383527724886850e+01 -9.3422692044635554e+00 7.5125645645164223e+00 - 15 -8.0644375221897171e+00 -2.6783296801963008e+00 6.9267625241565547e+00 - 16 -7.0395776185793807e+01 4.3227686209287491e+01 3.0567216126495769e+01 + 8 -1.6678237064738614e+01 -2.6557373913973738e+01 8.7708427797183326e+00 + 9 -9.4419020144376677e+00 1.3812152922900303e+01 -1.2280697239365450e+00 + 10 1.0844630504236606e+02 1.9274264686364820e+01 1.2594098114786526e+01 + 11 -1.1888648487599809e+01 1.7288532453781471e+00 1.8714004234488471e+00 + 12 9.7432958614920665e+01 1.1284647087939499e+02 -1.3445218835244805e+02 + 13 -2.2887258478933525e+01 -5.9815335453575649e+01 4.1237962971772127e+01 + 14 -4.6498844054867675e+01 -3.0251289808967520e+01 1.5556535565006259e+01 + 15 -5.3477741242848616e+01 -1.7885978453267143e+01 4.6284681424489207e+01 + 16 -7.3215663693592745e+01 1.7514552522777997e+01 7.4857846653898914e+00 17 2.0782832048872386e+01 -2.8304296512773977e+01 1.5273484998106287e+01 18 1.6481336531704756e+00 1.7222946144801426e+01 -6.9896289164966490e+01 19 -2.0180190840279820e+01 -2.5140421523544326e+01 2.9933594625645306e+01 @@ -50,27 +50,27 @@ init_forces: ! |2 27 -8.7971258084923178e+00 7.2217511410368814e+01 -2.4599681382405976e+01 28 -1.9235439225569891e+01 -4.3179911322776611e+01 1.0030656861974458e+00 29 2.8032565034062209e+01 -2.9037600087592210e+01 2.3596615696208531e+01 -run_energy: 945.667120914027 -run_stress: ! |2- - 4.9007195370705645e+00 -6.4584848054201885e+01 5.9684128517131313e+01 1.4440631784196160e+02 1.0147779649040916e+02 5.0605123164347972e+01 +run_energy: 603.8182365368202 +run_stress: ! |- + -1.6098625319219664e+01 -7.7961962067566510e+00 2.3894821525976329e+01 8.7036156470651477e+01 1.4262918929621054e+02 4.2523803236880880e+01 run_forces: ! |2 - 1 8.0595707378962782e+00 -3.9275884216073550e+01 -3.8921834622274609e+01 - 2 4.6450877231394490e+00 3.7989319504376653e+01 3.0709930231636147e+01 - 3 -4.4174062041610540e+01 -1.3116774304574319e+00 1.9852389406583850e+01 - 4 1.1432955350908090e+01 -7.3978491536336328e+00 -1.8963452260213845e+01 - 5 2.7565769765719310e+01 1.5533965769082254e+01 1.0064393083030197e+01 - 6 2.2437947870916961e+01 -5.4321180615060769e+01 -6.0748488446866872e+01 - 7 -1.5585343433722571e+01 1.3904433399215314e+01 -3.4020204287915634e+00 - 8 -2.7173598979194153e+00 4.7428178462168347e+01 1.2654691883960646e+02 - 9 9.4915406599908749e+00 -1.3885257714808199e+01 1.2160209239091246e+00 - 10 3.7036130179485966e+01 -2.6384482125884212e+01 -1.0013051660330657e+02 - 11 1.1913327728618880e+01 -1.7105485662994653e+00 -1.8898750666441195e+00 - 12 1.3449580650332301e+01 3.9344535800585398e+01 -3.9552691785632291e+01 - 13 -4.6002052262583266e+00 -1.2370495939576998e+01 1.4765847794019894e+01 - 14 -2.1313398317698834e+01 -9.6666833306404527e+00 7.4826992840481967e+00 - 15 -8.0459573339780484e+00 -2.8098768831377434e+00 7.2021609989661499e+00 - 16 -7.0394187900784956e+01 4.3284348202675552e+01 3.0478355256814506e+01 - 17 2.0798603484964556e+01 -2.8350845162531051e+01 1.5290163395115368e+01 + 1 8.1036664069391833e+00 -3.9279459516104339e+01 -3.8959949625007155e+01 + 2 4.6488532958171156e+00 3.7987813821226069e+01 3.0712083303318757e+01 + 3 -7.1419656269516480e+01 9.7015207052323333e+01 7.3123837986656483e+01 + 4 3.1774739774255771e+01 -4.4324760214341296e+01 -6.1918121921961003e+01 + 5 5.8630133295649813e+01 -2.5003101567718115e+01 3.8957656941403842e+00 + 6 -8.6686835699933500e+00 -4.2717543793109854e+01 -1.6944132920021204e+01 + 7 -1.5605967450730276e+01 1.3924972058096937e+01 -3.4081311693274161e+00 + 8 -1.6735469954990947e+01 -2.6654949908594496e+01 8.9412902423392993e+00 + 9 -9.4705763934675620e+00 1.3861186924074314e+01 -1.2218212802251793e+00 + 10 1.0864309846473817e+02 1.9311615651482960e+01 1.2534898619395602e+01 + 11 -1.1889594908454491e+01 1.6849924892427488e+00 1.9039966312260486e+00 + 12 9.6643785665770423e+01 1.1329932305772147e+02 -1.3435213826206018e+02 + 13 -2.2815824864999897e+01 -5.9701629573330088e+01 4.1148977584672039e+01 + 14 -4.6226658006998740e+01 -3.0469540424436548e+01 1.5534272011399247e+01 + 15 -5.3141801628038777e+01 -1.8156497866651446e+01 4.6272398149175629e+01 + 16 -7.3254211788300807e+01 1.7569251761827239e+01 7.4522974142679850e+00 + 17 2.0784167932320894e+01 -2.8346879951708846e+01 1.5284477542010659e+01 18 1.7456021018344252e+00 1.7528557172698406e+01 -7.0852460721917453e+01 19 -2.0389936120749365e+01 -2.5462340563923114e+01 3.0421727677614534e+01 20 1.8644334018914940e+01 7.9337833912247095e+00 4.0430733044302912e+01 From 492ddbbcfa1361c979b80650587da9f63de6b049 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 09:32:24 -0400 Subject: [PATCH 313/370] simplify --- unittest/force-styles/yaml_writer.cpp | 31 ++++----------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/unittest/force-styles/yaml_writer.cpp b/unittest/force-styles/yaml_writer.cpp index b5082c361f..d299b7a879 100644 --- a/unittest/force-styles/yaml_writer.cpp +++ b/unittest/force-styles/yaml_writer.cpp @@ -13,6 +13,7 @@ #include "yaml_writer.h" #include "yaml.h" +#include "fmt/format.h" #include #include @@ -51,41 +52,17 @@ YamlWriter::~YamlWriter() void YamlWriter::emit(const std::string &key, const double value) { - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, - (yaml_char_t *)key.c_str(), key.size(), 1, 0, - YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); - char buf[256]; - snprintf(buf, 256, "%.15g", value); - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, (yaml_char_t *)buf, - strlen(buf), 1, 0, YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); + emit(key,fmt::format("{}",value)); } void YamlWriter::emit(const std::string &key, const long value) { - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, - (yaml_char_t *)key.c_str(), key.size(), 1, 0, - YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); - char buf[256]; - snprintf(buf, 256, "%ld", value); - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, (yaml_char_t *)buf, - strlen(buf), 1, 0, YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); + emit(key,fmt::format("{}",value)); } void YamlWriter::emit(const std::string &key, const int value) { - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, - (yaml_char_t *)key.c_str(), key.size(), 1, 0, - YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); - char buf[256]; - snprintf(buf, 256, "%d", value); - yaml_scalar_event_initialize(&event, NULL, (yaml_char_t *)YAML_STR_TAG, (yaml_char_t *)buf, - strlen(buf), 1, 0, YAML_PLAIN_SCALAR_STYLE); - yaml_emitter_emit(&emitter, &event); + emit(key,fmt::format("{}",value)); } void YamlWriter::emit(const std::string &key, const std::string &value) From d1fd2f74d1046e4177b8714f4cf72ed47f7c87c8 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Thu, 8 Apr 2021 16:06:05 +0200 Subject: [PATCH 314/370] update PACELIB_URL (tackling some PGI warnings): v.2021.2.3.upd2 update lib/pace/Makefile: -O3 optimization --- cmake/Modules/Packages/USER-PACE.cmake | 4 ++-- lib/pace/Install.py | 4 ++-- lib/pace/Makefile | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake index b953278e75..e8262f7d40 100644 --- a/cmake/Modules/Packages/USER-PACE.cmake +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.upd.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "8041e3de7254815eb3ff0a11e2cc84ea" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.upd2.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "8fd1162724d349b930e474927197f20d" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 5f72157611..91aa8b3a46 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -18,11 +18,11 @@ parser = ArgumentParser(prog='Install.py', # settings thisdir = fullpath('.') -version = "v.2021.2.3.upd" +version = "v.2021.2.3.upd2" # known checksums for different PACE versions. used to validate the download. checksums = { \ - 'v.2021.2.3.upd' : '8041e3de7254815eb3ff0a11e2cc84ea', \ + 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', \ } diff --git a/lib/pace/Makefile b/lib/pace/Makefile index baaef0b837..c2e1892ddd 100644 --- a/lib/pace/Makefile +++ b/lib/pace/Makefile @@ -12,11 +12,10 @@ OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ -CXXFLAGS = -O2 -fPIC -Isrc/USER-PACE +CXXFLAGS = -O3 -fPIC -Isrc/USER-PACE ARCHIVE = ar ARCHFLAG = -rc -DEPFLAGS = -M USRLIB = SYSLIB = @@ -35,4 +34,4 @@ clean-all: -rm -f *~ $(OBJ) $(LIB) clean-build: - -rm -f *~ $(OBJ) \ No newline at end of file + -rm -f *~ $(OBJ) From 2d19282961eb2af5195f1038111ed3c5164e51b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 13:45:37 -0400 Subject: [PATCH 315/370] reorder include statements in RIGID package --- src/RIGID/fix_rattle.cpp | 15 +++++++------- src/RIGID/fix_rigid.cpp | 32 +++++++++++++++--------------- src/RIGID/fix_rigid_nh.cpp | 24 +++++++++++----------- src/RIGID/fix_rigid_nvt_small.cpp | 1 + src/RIGID/fix_shake.cpp | 33 ++++++++++++++++--------------- 5 files changed, 55 insertions(+), 50 deletions(-) diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index aef3cb3964..90aa6d487a 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -17,17 +17,18 @@ #include "fix_rattle.h" -#include -#include #include "atom.h" -#include "update.h" -#include "modify.h" -#include "domain.h" -#include "force.h" #include "comm.h" +#include "domain.h" +#include "error.h" +#include "force.h" #include "math_extra.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 26bbb9477f..3cd4f5dbc8 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -13,29 +13,29 @@ #include "fix_rigid.h" -#include - -#include -#include "math_extra.h" -#include "math_eigen.h" #include "atom.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" -#include "domain.h" -#include "update.h" -#include "respa.h" -#include "modify.h" -#include "group.h" #include "comm.h" -#include "random_mars.h" -#include "force.h" -#include "input.h" -#include "variable.h" -#include "math_const.h" -#include "memory.h" +#include "domain.h" #include "error.h" +#include "force.h" +#include "group.h" +#include "input.h" +#include "math_const.h" +#include "math_eigen.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "respa.h" #include "rigid_const.h" +#include "update.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 4dec04370e..3c4e332fd2 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -18,22 +18,24 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nh.h" -#include -#include -#include "math_extra.h" + #include "atom.h" +#include "comm.h" #include "compute.h" #include "domain.h" -#include "update.h" -#include "modify.h" -#include "fix_deform.h" -#include "group.h" -#include "comm.h" -#include "force.h" -#include "kspace.h" -#include "memory.h" #include "error.h" +#include "fix_deform.h" +#include "force.h" +#include "group.h" +#include "kspace.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" #include "rigid_const.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/RIGID/fix_rigid_nvt_small.cpp b/src/RIGID/fix_rigid_nvt_small.cpp index 0bcebd866d..0392f9c881 100644 --- a/src/RIGID/fix_rigid_nvt_small.cpp +++ b/src/RIGID/fix_rigid_nvt_small.cpp @@ -18,6 +18,7 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nvt_small.h" + #include "error.h" using namespace LAMMPS_NS; diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 390fe88309..5662e63c88 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -13,25 +13,26 @@ #include "fix_shake.h" +#include "angle.h" +#include "atom.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_respa.h" +#include "force.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "molecule.h" +#include "respa.h" +#include "update.h" + #include #include #include -#include "atom.h" -#include "atom_vec.h" -#include "molecule.h" -#include "update.h" -#include "respa.h" -#include "modify.h" -#include "domain.h" -#include "force.h" -#include "bond.h" -#include "angle.h" -#include "comm.h" -#include "group.h" -#include "fix_respa.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; From 22a337b3935de957c94184d0859dfc3c0778903b Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Thu, 8 Apr 2021 13:00:20 -0600 Subject: [PATCH 316/370] Updated READMEs in lib/pace and src/USER-PACE --- lib/pace/README | 13 +++++++++++-- src/USER-PACE/README | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/USER-PACE/README diff --git a/lib/pace/README b/lib/pace/README index e9a1ab820a..ddc6f7f7a7 100644 --- a/lib/pace/README +++ b/lib/pace/README @@ -1,9 +1,18 @@ -This directory contains files required to use the USER-PACE package. +This directory contains files required to use the USER-PACE package, +which provides the pace pair style, an efficient implementation of +the Atomic Cluster Expansion potential (ACE). +ACE is a methodology for deriving a highly accurate classical potential +fit to a large archive of quantum mechanical (DFT) data. +This package was written by Yury Lysogorskiy and others +at ICAMS, the Interdisciplinary Centre for Advanced Materials Simulation, +Ruhr University Bochum, Germany, http://www.icams.de You can type "make lib-pace" from the src directory to see help on how to download and build this library via make commands, or you can do the same thing by typing "python Install.py" from within this directory. +More information about the USER-PACE implementation of ACE +is available here: - +https://github.com/ICAMS/lammps-user-pace diff --git a/src/USER-PACE/README b/src/USER-PACE/README new file mode 100644 index 0000000000..476edaef76 --- /dev/null +++ b/src/USER-PACE/README @@ -0,0 +1,23 @@ +The USER-PACE package, +provides the pace pair style, an efficient implementation of +the Atomic Cluster Expansion potential (ACE). +ACE is a methodology for deriving a highly accurate classical potential +fit to a large archive of quantum mechanical (DFT) data. +This package was written by Yury Lysogorskiy and others +at ICAMS, the Interdisciplinary Centre for Advanced Materials Simulation, +Ruhr University Bochum, Germany, http://www.icams.de + +This package requires a library that can be downloaded and built +in lib/pace or somewhere else, +which must be done before building LAMMPS with this +package. Details of the download, build, and install process for +this package usng traditional make (not CMake) are given in the +lib/pace/README file, and scripts are +provided to help automate the process. Also see the LAMMPS manual for +general information on building LAMMPS with external libraries +using either traditional make or CMake. + +More information about the USER-PACE implementation of ACE +is available here: + +https://github.com/ICAMS/lammps-user-pace From a39dc9f9b224118e54330e67d6a240dfab91d352 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Thu, 8 Apr 2021 13:36:04 -0600 Subject: [PATCH 317/370] Added minimal info on downloading and building PACE library --- doc/src/Build_extras.rst | 32 ++++++++++++++++++++++++++++++++ doc/src/Packages_details.rst | 4 ++++ src/USER-PACE/README | 22 +++++++++++----------- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 3af018c656..726374a012 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -52,6 +52,7 @@ This is the list of packages that may require additional steps. * :ref:`USER-MESONT ` * :ref:`USER-MOLFILE ` * :ref:`USER-NETCDF ` + * :ref:`USER-PACE ` * :ref:`USER-PLUMED ` * :ref:`USER-OMP ` * :ref:`USER-QMMM ` @@ -1247,6 +1248,37 @@ be built for the most part with all major versions of the C++ language. ---------- +.. _user-pace: + +USER-PACE package +----------------------------- + +This package requires a library that can be downloaded and built +in lib/pace or somewhere else, which must be done before building +LAMMPS with this package. + +.. tabs:: + + .. tab:: CMake build + + The library download and build will happen automatically when USER-PACE + is requested. + + .. tab:: Traditional make + + You can download and build the USER-PACE library + in one step from the ``lammps/src`` dir, using these commands, + which invoke the ``lib/pace/Install.py`` script. + + .. code-block:: bash + + $ make lib-pace # print help message + $ make lib-pace args="-b" # download and build the default version in lib/pace + + You should not need to edit the ``lib/pace/Makefile.lammps`` file. + +---------- + .. _user-plumed: USER-PLUMED package diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 1964a83717..b10983a35b 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -1378,6 +1378,10 @@ Aidan Thompson^3, Gabor Csanyi^2, Christoph Ortner^4, Ralf Drautz^1. ^4: University of British Columbia, Vancouver, BC, Canada +**Install:** + +This package has :ref:`specific installation instructions ` on the :doc:`Build extras ` page. + **Supporting info:** * src/USER-PACE: filenames -> commands diff --git a/src/USER-PACE/README b/src/USER-PACE/README index 476edaef76..3d85c806e9 100644 --- a/src/USER-PACE/README +++ b/src/USER-PACE/README @@ -1,18 +1,18 @@ -The USER-PACE package, -provides the pace pair style, an efficient implementation of -the Atomic Cluster Expansion potential (ACE). -ACE is a methodology for deriving a highly accurate classical potential -fit to a large archive of quantum mechanical (DFT) data. +The USER-PACE package provides the pace pair style, +an efficient implementation of the Atomic Cluster Expansion +potential (ACE). + +ACE is a methodology for deriving a highly accurate classical +potential fit to a large archive of quantum mechanical (DFT) data. This package was written by Yury Lysogorskiy and others at ICAMS, the Interdisciplinary Centre for Advanced Materials Simulation, -Ruhr University Bochum, Germany, http://www.icams.de +Ruhr University Bochum, Germany (http://www.icams.de). This package requires a library that can be downloaded and built -in lib/pace or somewhere else, -which must be done before building LAMMPS with this -package. Details of the download, build, and install process for -this package usng traditional make (not CMake) are given in the -lib/pace/README file, and scripts are +in lib/pace or somewhere else, which must be done before building +LAMMPS with this package. Details of the download, build, and +install process for this package using traditional make (not CMake) +are given in the lib/pace/README file, and scripts are provided to help automate the process. Also see the LAMMPS manual for general information on building LAMMPS with external libraries using either traditional make or CMake. From 0aee75857a6e7fa320862255b81eff32f30c336f Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Thu, 8 Apr 2021 14:09:19 -0600 Subject: [PATCH 318/370] Eliminated doc build warnings --- doc/src/Build_package.rst | 22 +++++++++++----------- doc/src/Packages_user.rst | 2 ++ doc/src/pair_style.rst | 5 +++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index f9fc52f8db..91531f51ec 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -30,17 +30,17 @@ steps, as explained on the :doc:`Build extras ` page. These links take you to the extra instructions for those select packages: -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`COMPRESS ` | :ref:`GPU ` | :ref:`KIM ` | :ref:`KOKKOS ` | :ref:`LATTE ` | :ref:`MESSAGE ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`MSCG ` | :ref:`OPT ` | :ref:`POEMS ` | :ref:`PYTHON ` | :ref:`VORONOI ` | :ref:`USER-ADIOS ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-ATC ` | :ref:`USER-AWPMD ` | :ref:`USER-COLVARS ` | :ref:`USER-H5MD ` | :ref:`USER-INTEL ` | :ref:`USER-MOLFILE ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-NETCDF ` | :ref:`USER-PLUMED ` | :ref:`USER-OMP ` | :ref:`USER-QMMM ` | :ref:`USER-QUIP ` | :ref:`USER-SCAFACOS ` | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ -| :ref:`USER-SMD ` | :ref:`USER-VTK ` | | | | | -+----------------------------------+----------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +| :ref:`COMPRESS ` | :ref:`GPU ` | :ref:`KIM ` | :ref:`KOKKOS ` | :ref:`LATTE ` | :ref:`MESSAGE ` | ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +| :ref:`MSCG ` | :ref:`OPT ` | :ref:`POEMS ` | :ref:`PYTHON ` | :ref:`VORONOI ` | :ref:`USER-ADIOS ` | ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +| :ref:`USER-ATC ` | :ref:`USER-AWPMD ` | :ref:`USER-COLVARS ` | :ref:`USER-H5MD ` | :ref:`USER-INTEL ` | :ref:`USER-MOLFILE ` | ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +| :ref:`USER-NETCDF ` | :ref:`USER-PACE ` | :ref:`USER-PLUMED ` | :ref:`USER-OMP ` | :ref:`USER-QMMM ` | :ref:`USER-QUIP ` | ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ +| :ref:`USER-SCAFACOS ` | :ref:`USER-SMD ` | :ref:`USER-VTK ` | | | | ++--------------------------------------+--------------------------------+------------------------------------+------------------------------+--------------------------------+--------------------------------------+ The mechanism for including packages is simple but different for CMake versus make. diff --git a/doc/src/Packages_user.rst b/doc/src/Packages_user.rst index a3efaf15c8..00d1dfb67b 100644 --- a/doc/src/Packages_user.rst +++ b/doc/src/Packages_user.rst @@ -81,6 +81,8 @@ package: +------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+ | :ref:`USER-OMP ` | OpenMP-enabled styles | :doc:`Speed omp ` | `Benchmarks `_ | no | +------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+ +| :ref:`USER-PACE ` | Fast implementation of Atomic Cluster Expansion (ACE) potential | :doc:`pair pace ` | USER/pace | ext | ++------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+ | :ref:`USER-PHONON ` | phonon dynamical matrix | :doc:`fix phonon ` | USER/phonon | no | +------------------------------------------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------+---------+ | :ref:`USER-PLUMED ` | :ref:`PLUMED ` free energy library | :doc:`fix plumed ` | USER/plumed | ext | diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 89530895c4..a64fc67194 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -98,7 +98,7 @@ accelerated styles exist. * :doc:`zero ` - neighbor list but no interactions * :doc:`adp ` - angular dependent potential (ADP) of Mishin -* :doc:`agni ` - machine learned potential mapping atomic environment to forces +* :doc:`agni ` - AGNI machine-learning potential * :doc:`airebo ` - AIREBO potential of Stuart * :doc:`airebo/morse ` - AIREBO with Morse instead of LJ * :doc:`atm ` - Axilrod-Teller-Muto potential @@ -278,6 +278,7 @@ accelerated styles exist. * :doc:`oxrna2/hbond ` - * :doc:`oxrna2/stk ` - * :doc:`oxrna2/xstk ` - +* :doc:`pace ` - Atomic Cluster Expansion (ACE) machine-learning potential * :doc:`peri/eps ` - peridynamic EPS potential * :doc:`peri/lps ` - peridynamic LPS potential * :doc:`peri/pmb ` - peridynamic PMB potential @@ -295,7 +296,7 @@ accelerated styles exist. * :doc:`smd/ulsph ` - * :doc:`smtbq ` - * :doc:`mliap ` - Multiple styles of machine-learning potential -* :doc:`snap ` - SNAP quantum-accurate potential +* :doc:`snap ` - SNAP machine-learning potential * :doc:`soft ` - Soft (cosine) potential * :doc:`sph/heatconduction ` - * :doc:`sph/idealgas ` - From c660dcefd2c6bcf7d6811c158a65b68a85b000d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 17:42:32 -0400 Subject: [PATCH 319/370] add minimal framework for pair style hybrid/scaled --- src/pair_hybrid_scaled.cpp | 201 +++++++++++++++++++++++++++++++++++++ src/pair_hybrid_scaled.h | 63 ++++++++++++ 2 files changed, 264 insertions(+) create mode 100644 src/pair_hybrid_scaled.cpp create mode 100644 src/pair_hybrid_scaled.h diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp new file mode 100644 index 0000000000..9f3a5d44be --- /dev/null +++ b/src/pair_hybrid_scaled.cpp @@ -0,0 +1,201 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "pair_hybrid_scaled.h" + +#include "atom.h" +#include "error.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairHybridScaled::PairHybridScaled(LAMMPS *lmp) : + PairHybrid(lmp), fsum(nullptr), + scaleval(nullptr), scaleidx(nullptr), scalevar(nullptr) +{ + nscalevar = 0; + nmaxfsum = -1; +} + +/* ---------------------------------------------------------------------- */ + +PairHybridScaled::~PairHybridScaled() +{ + for (int i=0; i < nscalevar; ++i) + delete[] scalevar[i]; + delete[] scalevar; + + if (nmaxfsum > 0) + memory->destroy(fsum); + + if (allocated) { + memory->destroy(scaleval); + memory->destroy(scaleidx); + } +} +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairHybridScaled::allocate() +{ + PairHybrid::allocate(); + + const int n = atom->ntypes; + + memory->create(scaleval,n+1,n+1,"pair:scaleval"); + memory->create(scaleidx,n+1,n+1,"pair:scaleidx"); + for (int i = 1; i <= n; i++) { + for (int j = i; j <= n; j++) { + scaleval[i][j] = 0.0; + scaleidx[i][j] = -1; + } + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairHybridScaled::coeff(int narg, char **arg) +{ + if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + + // 3rd arg = scale factor for sub-style, must be either + // a constant or equal stye or compatible variable + + double scale = utils::numeric(FLERR,arg[2],false,lmp); + + // 4th arg = pair sub-style name + // 5th arg = pair sub-style index if name used multiple times + // + // allow for "none" as valid sub-style name + + int multflag; + int m; + + for (m = 0; m < nstyles; m++) { + multflag = 0; + if (strcmp(arg[3],keywords[m]) == 0) { + if (multiple[m]) { + multflag = 1; + if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); + if (multiple[m] == utils::inumeric(FLERR,arg[4],false,lmp)) break; + else continue; + } else break; + } + } + + int none = 0; + if (m == nstyles) { + if (strcmp(arg[3],"none") == 0) none = 1; + else error->all(FLERR,"Pair coeff for hybrid has invalid style"); + } + + // move 1st/2nd args to 3rd/4th args + // if multflag: move 1st/2nd args to 4th/5th args + // just copy ptrs, since arg[] points into original input line + + arg[3+multflag] = arg[1]; + arg[2+multflag] = arg[0]; + + // invoke sub-style coeff() starting with 1st remaining arg + + if (!none) styles[m]->coeff(narg-2-multflag,arg+2+multflag); + + // set setflag and which type pairs map to which sub-style + // if sub-style is none: set hybrid subflag, wipe out map + // else: set hybrid setflag & map only if substyle setflag is set + // if sub-style is new for type pair, add as multiple mapping + // if sub-style exists for type pair, don't add, just update coeffs + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + if (none) { + setflag[i][j] = 1; + nmap[i][j] = 0; + count++; + } else if (styles[m]->setflag[i][j]) { + int k; + for (k = 0; k < nmap[i][j]; k++) + if (map[i][j][k] == m) break; + if (k == nmap[i][j]) map[i][j][nmap[i][j]++] = m; + setflag[i][j] = 1; + scaleval[i][j] = scale; + scaleidx[i][j] = -1; + count++; + } + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + + +/* ---------------------------------------------------------------------- + we need to handle Pair::svector special for hybrid/scaled +------------------------------------------------------------------------- */ + +void PairHybridScaled::init_svector() +{ + // single_extra = list all sub-style single_extra + // allocate svector + + single_extra = 0; + for (int m = 0; m < nstyles; m++) + single_extra += styles[m]->single_extra; + + if (single_extra) { + delete [] svector; + svector = new double[single_extra]; + } +} + +/* ---------------------------------------------------------------------- + we need to handle Pair::svector special for hybrid/scaled +------------------------------------------------------------------------- */ + +void PairHybridScaled::copy_svector(int itype, int jtype) +{ + int n=0; + Pair *this_style; + + // fill svector array. + // copy data from active styles and use 0.0 for inactive ones + for (int m = 0; m < nstyles; m++) { + for (int k = 0; k < nmap[itype][jtype]; ++k) { + if (m == map[itype][jtype][k]) { + this_style = styles[m]; + } else { + this_style = nullptr; + } + } + for (int l = 0; l < styles[m]->single_extra; ++l) { + if (this_style) { + svector[n++] = this_style->svector[l]; + } else { + svector[n++] = 0.0; + } + } + } +} diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h new file mode 100644 index 0000000000..d0d2d8838a --- /dev/null +++ b/src/pair_hybrid_scaled.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(hybrid/scaled,PairHybridScaled) + +#else + +#ifndef LMP_PAIR_HYBRID_SCALED_H +#define LMP_PAIR_HYBRID_SCALED_H + +#include "pair_hybrid.h" + +namespace LAMMPS_NS { + +class PairHybridScaled : public PairHybrid { + public: + PairHybridScaled(class LAMMPS *); + virtual ~PairHybridScaled(); + void coeff(int, char **); + //void compute(int, int); + + void init_svector(); + void copy_svector(int,int); + + protected: + double **fsum; + double **scaleval; + int **scaleidx; + char **scalevar; + int nscalevar; + int nmaxfsum; + + void allocate(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Pair coeff for hybrid has invalid style + +Style in pair coeff must have been listed in pair_style command. + +*/ From a441c7b379b38ecda9a19415d167d246b2da5409 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 17:44:13 -0400 Subject: [PATCH 320/370] simplify hybrid coeff parsing. check for number is already done with conversion --- src/pair_hybrid.cpp | 7 ++----- src/pair_hybrid_overlay.cpp | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index c7b6048139..c12ec67351 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -468,10 +468,7 @@ void PairHybrid::coeff(int narg, char **arg) if (multiple[m]) { multflag = 1; if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); - if (!isdigit(arg[3][0])) - error->all(FLERR,"Incorrect args for pair coefficients"); - int index = utils::inumeric(FLERR,arg[3],false,lmp); - if (index == multiple[m]) break; + if (multiple[m] == utils::inumeric(FLERR,arg[3],false,lmp)) break; else continue; } else break; } @@ -492,7 +489,7 @@ void PairHybrid::coeff(int narg, char **arg) // invoke sub-style coeff() starting with 1st remaining arg - if (!none) styles[m]->coeff(narg-1-multflag,&arg[1+multflag]); + if (!none) styles[m]->coeff(narg-1-multflag,arg+1+multflag); // if sub-style only allows one pair coeff call (with * * and type mapping) // then unset setflag/map assigned to that style before setting it below diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index fc78a8aef7..814b3b2f20 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -17,7 +17,6 @@ #include "error.h" #include -#include using namespace LAMMPS_NS; @@ -51,10 +50,7 @@ void PairHybridOverlay::coeff(int narg, char **arg) if (multiple[m]) { multflag = 1; if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); - if (!isdigit(arg[3][0])) - error->all(FLERR,"Incorrect args for pair coefficients"); - int index = utils::inumeric(FLERR,arg[3],false,lmp); - if (index == multiple[m]) break; + if (multiple[m] == utils::inumeric(FLERR,arg[3],false,lmp)) break; else continue; } else break; } @@ -75,7 +71,7 @@ void PairHybridOverlay::coeff(int narg, char **arg) // invoke sub-style coeff() starting with 1st remaining arg - if (!none) styles[m]->coeff(narg-1-multflag,&arg[1+multflag]); + if (!none) styles[m]->coeff(narg-1-multflag,arg+1+multflag); // set setflag and which type pairs map to which sub-style // if sub-style is none: set hybrid subflag, wipe out map From 8ed6d80b851a4dbe02aa61bcd50ca12e5d3c15b1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 8 Apr 2021 21:02:28 -0400 Subject: [PATCH 321/370] first working version, forces only, no restart --- doc/src/pair_hybrid.rst | 98 ++++++---- src/pair_hybrid.h | 2 +- src/pair_hybrid_scaled.cpp | 358 ++++++++++++++++++++++++++++++++----- src/pair_hybrid_scaled.h | 17 +- 4 files changed, 386 insertions(+), 89 deletions(-) diff --git a/doc/src/pair_hybrid.rst b/doc/src/pair_hybrid.rst index 558c326175..c851423029 100644 --- a/doc/src/pair_hybrid.rst +++ b/doc/src/pair_hybrid.rst @@ -2,6 +2,7 @@ .. index:: pair_style hybrid/kk .. index:: pair_style hybrid/overlay .. index:: pair_style hybrid/overlay/kk +.. index:: pair_style hybrid/scaled pair_style hybrid command ========================= @@ -13,6 +14,8 @@ pair_style hybrid/overlay command Accelerator Variants: *hybrid/overlay/kk* +pair_style hybrid/scale command + Syntax """""" @@ -20,8 +23,10 @@ Syntax pair_style hybrid style1 args style2 args ... pair_style hybrid/overlay style1 args style2 args ... + pair_style hybrid/scaled factor1 style1 args factor2 style 2 args ... * style1,style2 = list of one or more pair styles and their arguments +* factor1,factor2 = scale factors for pair styles, may be a variable Examples """""""" @@ -37,15 +42,24 @@ Examples pair_coeff * * lj/cut 1.0 1.0 pair_coeff * * coul/long + variable one equal ramp(1.0,0.0) + variable two equal 1.0-v_one + pair_style hybrid/scaled v_one lj/cut 2.5 v_two morse 2.5 + pair_coeff 1 1 lj/cut 1.0 1.0 2.5 + pair_coeff 1 1 morse 1.0 1.0 1.0 2.5 + Description """"""""""" -The *hybrid* and *hybrid/overlay* styles enable the use of multiple -pair styles in one simulation. With the *hybrid* style, exactly one -pair style is assigned to each pair of atom types. With the -*hybrid/overlay* style, one or more pair styles can be assigned to -each pair of atom types. The assignment of pair styles to type pairs -is made via the :doc:`pair_coeff ` command. +The *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles enable the +use of multiple pair styles in one simulation. With the *hybrid* style, +exactly one pair style is assigned to each pair of atom types. With the +*hybrid/overlay* and *hybrid/scaled* styles, one or more pair styles can +be assigned to each pair of atom types. The assignment of pair styles +to type pairs is made via the :doc:`pair_coeff ` command. +The *hybrid/scaled* style differs from the *hybrid/overlay* style by +requiring a factor for each pair style that is used to scale all +forces and energies computed by the pair style. Here are two examples of hybrid simulations. The *hybrid* style could be used for a simulation of a metal droplet on a LJ surface. The @@ -61,12 +75,19 @@ it would be more efficient to use the single combined potential, but in general any combination of pair potentials can be used together in to produce an interaction that is not encoded in any single pair_style file, e.g. adding Coulombic forces between granular particles. +The *hybrid/scaled* style enables more complex combinations of pair +styles than a simple sum as *hybrid/overlay* does. Furthermore, since +the scale factors can be variables, they can change during a simulation +which would allow to smoothly switch between two different pair styles +or two different parameter sets. All pair styles that will be used are listed as "sub-styles" following -the *hybrid* or *hybrid/overlay* keyword, in any order. Each -sub-style's name is followed by its usual arguments, as illustrated in -the example above. See the doc pages of individual pair styles for a -listing and explanation of the appropriate arguments. +the *hybrid* or *hybrid/overlay* keyword, in any order. In case of the +*hybrid/scaled* pair style each sub-style is prefixed with its scale +factor. The scale factor may be an equal style (or equivalent) +variable. Each sub-style's name is followed by its usual arguments, as +illustrated in the example above. See the doc pages of individual pair +styles for a listing and explanation of the appropriate arguments. Note that an individual pair style can be used multiple times as a sub-style. For efficiency this should only be done if your model @@ -143,16 +164,16 @@ one sub-style. Just as with a simulation using a single pair style, if you specify the same atom type pair in a second pair_coeff command, the previous assignment will be overwritten. -For the *hybrid/overlay* style, each atom type pair I,J can be -assigned to one or more sub-styles. If you specify the same atom type -pair in a second pair_coeff command with a new sub-style, then the -second sub-style is added to the list of potentials that will be -calculated for two interacting atoms of those types. If you specify -the same atom type pair in a second pair_coeff command with a -sub-style that has already been defined for that pair of atoms, then -the new pair coefficients simply override the previous ones, as in the -normal usage of the pair_coeff command. E.g. these two sets of -commands are the same: +For the *hybrid/overlay* and *hybrid/scaled* style, each atom type pair +I,J can be assigned to one or more sub-styles. If you specify the same +atom type pair in a second pair_coeff command with a new sub-style, then +the second sub-style is added to the list of potentials that will be +calculated for two interacting atoms of those types. If you specify the +same atom type pair in a second pair_coeff command with a sub-style that +has already been defined for that pair of atoms, then the new pair +coefficients simply override the previous ones, as in the normal usage +of the pair_coeff command. E.g. these two sets of commands are the +same: .. code-block:: LAMMPS @@ -170,19 +191,20 @@ data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands, or by mixing as described below. -For both the *hybrid* and *hybrid/overlay* styles, every atom type -pair I,J (where I <= J) must be assigned to at least one sub-style via -the :doc:`pair_coeff ` command as in the examples above, or -in the data file read by the :doc:`read_data `, or by mixing -as described below. +For all of the *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles, +every atom type pair I,J (where I <= J) must be assigned to at least one +sub-style via the :doc:`pair_coeff ` command as in the +examples above, or in the data file read by the :doc:`read_data +`, or by mixing as described below. If you want there to be no interactions between a particular pair of atom types, you have 3 choices. You can assign the type pair to some sub-style and use the :doc:`neigh_modify exclude type ` command. You can assign it to some sub-style and set the coefficients -so that there is effectively no interaction (e.g. epsilon = 0.0 in a -LJ potential). Or, for *hybrid* and *hybrid/overlay* simulations, you -can use this form of the pair_coeff command in your input script: +so that there is effectively no interaction (e.g. epsilon = 0.0 in a LJ +potential). Or, for *hybrid*, *hybrid/overlay*, or *hybrid/scaled* +simulations, you can use this form of the pair_coeff command in your +input script: .. code-block:: LAMMPS @@ -260,7 +282,10 @@ the specific syntax, requirements and restrictions. ---------- The potential energy contribution to the overall system due to an -individual sub-style can be accessed and output via the :doc:`compute pair ` command. +individual sub-style can be accessed and output via the :doc:`compute +pair ` command. Note that in the case of pair style +*hybrid/scaled* this is the **unscaled** potential energy of the +selected sub-style. ---------- @@ -388,12 +413,12 @@ The hybrid pair styles supports the :doc:`pair_modify ` shift, table, and tail options for an I,J pair interaction, if the associated sub-style supports it. -For the hybrid pair styles, the list of sub-styles and their -respective settings are written to :doc:`binary restart files `, so a :doc:`pair_style ` command does -not need to specified in an input script that reads a restart file. -However, the coefficient information is not stored in the restart -file. Thus, pair_coeff commands need to be re-specified in the -restart input script. +For the hybrid pair styles, the list of sub-styles and their respective +settings are written to :doc:`binary restart files `, so a +:doc:`pair_style ` command does not need to specified in an +input script that reads a restart file. However, the coefficient +information is not stored in the restart file. Thus, pair_coeff +commands need to be re-specified in the restart input script. These pair styles support the use of the *inner*\ , *middle*\ , and *outer* keywords of the :doc:`run_style respa ` command, if @@ -409,6 +434,9 @@ e.g. *lj/cut/coul/long* or *buck/coul/long*\ . You must insure that the short-range Coulombic cutoff used by each of these long pair styles is the same or else LAMMPS will generate an error. +Pair style *hybrid/scaled* currently only works for non-accelerated +pair styles. + Related commands """""""""""""""" diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index 7717d1fd51..3bde620514 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -37,7 +37,7 @@ class PairHybrid : public Pair { PairHybrid(class LAMMPS *); virtual ~PairHybrid(); virtual void compute(int, int); - void settings(int, char **); + virtual void settings(int, char **); virtual void coeff(int, char **); void init_style(); double init_one(int, int); diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 9f3a5d44be..7e1d634627 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -15,7 +15,12 @@ #include "atom.h" #include "error.h" +#include "force.h" +#include "input.h" #include "memory.h" +#include "respa.h" +#include "update.h" +#include "variable.h" #include @@ -23,11 +28,9 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairHybridScaled::PairHybridScaled(LAMMPS *lmp) : - PairHybrid(lmp), fsum(nullptr), - scaleval(nullptr), scaleidx(nullptr), scalevar(nullptr) +PairHybridScaled::PairHybridScaled(LAMMPS *lmp) + : PairHybrid(lmp), fsum(nullptr), scaleval(nullptr), scaleidx(nullptr) { - nscalevar = 0; nmaxfsum = -1; } @@ -35,36 +38,307 @@ PairHybridScaled::PairHybridScaled(LAMMPS *lmp) : PairHybridScaled::~PairHybridScaled() { - for (int i=0; i < nscalevar; ++i) - delete[] scalevar[i]; - delete[] scalevar; - - if (nmaxfsum > 0) - memory->destroy(fsum); - - if (allocated) { - memory->destroy(scaleval); - memory->destroy(scaleidx); - } + memory->destroy(fsum); + memory->destroy(scaleval); } + /* ---------------------------------------------------------------------- - allocate all arrays + call each sub-style's compute() or compute_outer() function + accumulate sub-style global/peratom energy/virial in hybrid + for global vflag = VIRIAL_PAIR: + each sub-style computes own virial[6] + sum sub-style virial[6] to hybrid's virial[6] + for global vflag = VIRIAL_FDOTR: + call sub-style with adjusted vflag to prevent it calling + virial_fdotr_compute() + hybrid calls virial_fdotr_compute() on final accumulated f ------------------------------------------------------------------------- */ -void PairHybridScaled::allocate() +void PairHybridScaled::compute(int eflag, int vflag) { - PairHybrid::allocate(); + int i,j,m,n; - const int n = atom->ntypes; + // update scale values from variables where needed - memory->create(scaleval,n+1,n+1,"pair:scaleval"); - memory->create(scaleidx,n+1,n+1,"pair:scaleidx"); - for (int i = 1; i <= n; i++) { - for (int j = i; j <= n; j++) { - scaleval[i][j] = 0.0; - scaleidx[i][j] = -1; + 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()); + vals[i] = input->variable->compute_equal(j); + } + for (i = 0; i < nstyles; ++i) { + if (scaleidx[i] >= 0) + scaleval[i] = vals[scaleidx[i]]; + } + delete[] vals; + } + + // check if no_virial_fdotr_compute is set and global component of + // incoming vflag = VIRIAL_FDOTR + // if so, reset vflag as if global component were VIRIAL_PAIR + // necessary since one or more sub-styles cannot compute virial as F dot r + + if (no_virial_fdotr_compute && (vflag & VIRIAL_FDOTR)) + vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR); + + ev_init(eflag,vflag); + + // grow fsum array if needed, and copy existing forces (usually 0.0) to it. + + if (atom->nmax > nmaxfsum) { + memory->destroy(fsum); + nmaxfsum = atom->nmax; + memory->create(fsum,nmaxfsum,3,"pair:fsum"); + } + const int nall = atom->nlocal + atom->nghost; + auto f = atom->f; + for (i = 0; i < nall; ++i) { + fsum[i][0] = f[i][0]; + fsum[i][1] = f[i][1]; + fsum[i][2] = f[i][2]; + } + + // check if global component of incoming vflag = VIRIAL_FDOTR + // if so, reset vflag passed to substyle so VIRIAL_FDOTR is turned off + // necessary so substyle will not invoke virial_fdotr_compute() + + int vflag_substyle; + if (vflag & VIRIAL_FDOTR) vflag_substyle = vflag & ~VIRIAL_FDOTR; + else vflag_substyle = vflag; + + double *saved_special = save_special(); + + // check if we are running with r-RESPA using the hybrid keyword + + Respa *respa = nullptr; + respaflag = 0; + if (utils::strmatch(update->integrate_style,"^respa")) { + respa = (Respa *) update->integrate; + if (respa->nhybrid_styles > 0) respaflag = 1; + } + + for (m = 0; m < nstyles; m++) { + + // clear forces + + memset(&f[0][0],0,nall*3*sizeof(double)); + + set_special(m); + + if (!respaflag || (respaflag && respa->hybrid_compute[m])) { + + // invoke compute() unless compute flag is turned off or + // outerflag is set and sub-style has a compute_outer() method + + if (styles[m]->compute_flag == 0) continue; + if (outerflag && styles[m]->respa_enable) + styles[m]->compute_outer(eflag,vflag_substyle); + else styles[m]->compute(eflag,vflag_substyle); + } + + // add scaled forces to global sum + const double scale = scaleval[m]; + for (i = 0; i < nall; ++i) { + fsum[i][0] += scale*f[i][0]; + fsum[i][1] += scale*f[i][1]; + fsum[i][2] += scale*f[i][2]; + } + + restore_special(saved_special); + + // jump to next sub-style if r-RESPA does not want global accumulated data + + if (respaflag && !respa->tally_global) continue; + + if (eflag_global) { + eng_vdwl += scale * styles[m]->eng_vdwl; + eng_coul += scale * styles[m]->eng_coul; + } + if (vflag_global) { + for (n = 0; n < 6; n++) virial[n] += scale * styles[m]->virial[n]; + } + if (eflag_atom) { + n = atom->nlocal; + if (force->newton_pair) n += atom->nghost; + double *eatom_substyle = styles[m]->eatom; + for (i = 0; i < n; i++) eatom[i] += scale * eatom_substyle[i]; + } + if (vflag_atom) { + n = atom->nlocal; + if (force->newton_pair) n += atom->nghost; + double **vatom_substyle = styles[m]->vatom; + for (i = 0; i < n; i++) + for (j = 0; j < 6; j++) + vatom[i][j] += scale * vatom_substyle[i][j]; + } + + // substyles may be CENTROID_SAME or CENTROID_AVAIL + + if (cvflag_atom) { + n = atom->nlocal; + if (force->newton_pair) n += atom->nghost; + if (styles[m]->centroidstressflag == CENTROID_AVAIL) { + double **cvatom_substyle = styles[m]->cvatom; + for (i = 0; i < n; i++) + for (j = 0; j < 9; j++) + cvatom[i][j] += scale * cvatom_substyle[i][j]; + } else { + double **vatom_substyle = styles[m]->vatom; + for (i = 0; i < n; i++) { + for (j = 0; j < 6; j++) { + cvatom[i][j] += scale * vatom_substyle[i][j]; + } + for (j = 6; j < 9; j++) { + cvatom[i][j] += scale * vatom_substyle[i][j-3]; + } + } + } } } + + // copy accumulated forces to original force array + + for (i = 0; i < nall; ++i) { + f[i][0] = fsum[i][0]; + f[i][1] = fsum[i][1]; + f[i][2] = fsum[i][2]; + } + delete [] saved_special; + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + create one pair style for each arg in list +------------------------------------------------------------------------- */ + +void PairHybridScaled::settings(int narg, char **arg) +{ + if (narg < 1) error->all(FLERR,"Illegal pair_style command"); + if (lmp->kokkos && !utils::strmatch(force->pair_style,"^hybrid.*/kk$")) + error->all(FLERR,fmt::format("Must use pair_style {}/kk with Kokkos", + force->pair_style)); + + // delete old lists, since cannot just change settings + + if (nstyles > 0) { + for (int m = 0; m < nstyles; m++) { + delete styles[m]; + delete [] keywords[m]; + if (special_lj[m]) delete [] special_lj[m]; + if (special_coul[m]) delete [] special_coul[m]; + } + delete[] styles; + delete[] keywords; + delete[] multiple; + delete[] special_lj; + delete[] special_coul; + delete[] compute_tally; + delete[] scaleval; + delete[] scaleidx; + scalevars.clear(); + } + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cutghost); + memory->destroy(nmap); + memory->destroy(map); + } + allocated = 0; + + // allocate list of sub-styles as big as possibly needed if no extra args + + styles = new Pair*[narg]; + keywords = new char*[narg]; + multiple = new int[narg]; + + special_lj = new double*[narg]; + special_coul = new double*[narg]; + compute_tally = new int[narg]; + + scaleval = new double[narg]; + scaleidx = new int[narg]; + scalevars.reserve(narg); + + // allocate each sub-style + // allocate uses suffix, but don't store suffix version in keywords, + // else syntax in coeff() will not match + // call settings() with set of args that are not pair style names + // use force->pair_map to determine which args these are + + int iarg,jarg,dummy; + + iarg = 0; + nstyles = 0; + while (iarg < narg-1) { + + // first process scale factor or variable + // idx < 0 indicates constant value otherwise index in variable name list + + double val = 0.0; + int idx = -1; + if (utils::strmatch(arg[iarg],"^v_")) { + for (std::size_t i=0; i < scalevars.size(); ++i) { + if (scalevars[i] == arg[iarg]+2) { + idx = i; + break; + } + } + if (idx < 0) { + idx = scalevars.size(); + scalevars.push_back(arg[iarg]+2); + } + } else { + val = utils::numeric(FLERR,arg[iarg],false,lmp); + } + scaleval[nstyles] = val; + scaleidx[nstyles] = idx; + ++iarg; + + if (utils::strmatch(arg[iarg],"^hybrid")) + error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument"); + if (strcmp(arg[iarg],"none") == 0) + error->all(FLERR,"Pair style hybrid cannot have none as an argument"); + + styles[nstyles] = force->new_pair(arg[iarg],1,dummy); + force->store_style(keywords[nstyles],arg[iarg],0); + special_lj[nstyles] = special_coul[nstyles] = nullptr; + compute_tally[nstyles] = 1; + + // determine list of arguments for pair style settings + // by looking for the next known pair style name. + + jarg = iarg + 1; + while ((jarg < narg) + && !force->pair_map->count(arg[jarg]) + && !lmp->match_style("pair",arg[jarg])) jarg++; + + // decrement to account for scale factor except when last argument + + if (jarg < narg) --jarg; + + styles[nstyles]->settings(jarg-iarg-1,arg+iarg+1); + iarg = jarg; + nstyles++; + } + + // multiple[i] = 1 to M if sub-style used multiple times, else 0 + + for (int i = 0; i < nstyles; i++) { + int count = 0; + for (int j = 0; j < nstyles; j++) { + if (strcmp(keywords[j],keywords[i]) == 0) count++; + if (j == i) multiple[i] = count; + } + if (count == 1) multiple[i] = 0; + } + + // set pair flags from sub-style flags + + flags(); } /* ---------------------------------------------------------------------- @@ -80,14 +354,8 @@ void PairHybridScaled::coeff(int narg, char **arg) utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - // 3rd arg = scale factor for sub-style, must be either - // a constant or equal stye or compatible variable - - double scale = utils::numeric(FLERR,arg[2],false,lmp); - - // 4th arg = pair sub-style name - // 5th arg = pair sub-style index if name used multiple times - // + // 3rd arg = pair sub-style name + // 4th arg = pair sub-style index if name used multiple times // allow for "none" as valid sub-style name int multflag; @@ -95,11 +363,14 @@ void PairHybridScaled::coeff(int narg, char **arg) for (m = 0; m < nstyles; m++) { multflag = 0; - if (strcmp(arg[3],keywords[m]) == 0) { + if (strcmp(arg[2],keywords[m]) == 0) { if (multiple[m]) { multflag = 1; - if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); - if (multiple[m] == utils::inumeric(FLERR,arg[4],false,lmp)) break; + if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!isdigit(arg[3][0])) + error->all(FLERR,"Incorrect args for pair coefficients"); + int index = utils::inumeric(FLERR,arg[3],false,lmp); + if (index == multiple[m]) break; else continue; } else break; } @@ -107,20 +378,20 @@ void PairHybridScaled::coeff(int narg, char **arg) int none = 0; if (m == nstyles) { - if (strcmp(arg[3],"none") == 0) none = 1; + if (strcmp(arg[2],"none") == 0) none = 1; else error->all(FLERR,"Pair coeff for hybrid has invalid style"); } - // move 1st/2nd args to 3rd/4th args - // if multflag: move 1st/2nd args to 4th/5th args + // move 1st/2nd args to 2nd/3rd args + // if multflag: move 1st/2nd args to 3rd/4th args // just copy ptrs, since arg[] points into original input line - arg[3+multflag] = arg[1]; - arg[2+multflag] = arg[0]; + arg[2+multflag] = arg[1]; + arg[1+multflag] = arg[0]; // invoke sub-style coeff() starting with 1st remaining arg - if (!none) styles[m]->coeff(narg-2-multflag,arg+2+multflag); + if (!none) styles[m]->coeff(narg-1-multflag,&arg[1+multflag]); // set setflag and which type pairs map to which sub-style // if sub-style is none: set hybrid subflag, wipe out map @@ -141,8 +412,6 @@ void PairHybridScaled::coeff(int narg, char **arg) if (map[i][j][k] == m) break; if (k == nmap[i][j]) map[i][j][nmap[i][j]++] = m; setflag[i][j] = 1; - scaleval[i][j] = scale; - scaleidx[i][j] = -1; count++; } } @@ -151,7 +420,6 @@ void PairHybridScaled::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } - /* ---------------------------------------------------------------------- we need to handle Pair::svector special for hybrid/scaled ------------------------------------------------------------------------- */ diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h index d0d2d8838a..a8bd5517ec 100644 --- a/src/pair_hybrid_scaled.h +++ b/src/pair_hybrid_scaled.h @@ -22,27 +22,28 @@ PairStyle(hybrid/scaled,PairHybridScaled) #include "pair_hybrid.h" +#include +#include + namespace LAMMPS_NS { class PairHybridScaled : public PairHybrid { public: PairHybridScaled(class LAMMPS *); virtual ~PairHybridScaled(); - void coeff(int, char **); - //void compute(int, int); + virtual void compute(int, int); + virtual void settings(int, char**); + virtual void coeff(int, char **); void init_svector(); void copy_svector(int,int); protected: double **fsum; - double **scaleval; - int **scaleidx; - char **scalevar; - int nscalevar; + double *scaleval; + int *scaleidx; + std::vector scalevars; int nmaxfsum; - - void allocate(); }; } From ae27d3bf4cdea5a86b8f3bfe1681c2cb3d990fc6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 00:31:43 -0400 Subject: [PATCH 322/370] add support for single() and read/write_restart() --- src/pair_hybrid.h | 6 +- src/pair_hybrid_scaled.cpp | 126 ++++++++++++++++++++++++++++++++++++- src/pair_hybrid_scaled.h | 4 ++ 3 files changed, 130 insertions(+), 6 deletions(-) diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index 3bde620514..ca79163fc2 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -42,9 +42,9 @@ class PairHybrid : public Pair { void init_style(); double init_one(int, int); void setup(); - void write_restart(FILE *); - void read_restart(FILE *); - double single(int, int, int, int, double, double, double, double &); + virtual void write_restart(FILE *); + virtual void read_restart(FILE *); + virtual double single(int, int, int, int, double, double, double, double &); void modify_params(int narg, char **arg); double memory_usage(); diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 7e1d634627..da8631dcf8 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -14,11 +14,13 @@ #include "pair_hybrid_scaled.h" #include "atom.h" +#include "comm.h" #include "error.h" #include "force.h" #include "input.h" #include "memory.h" #include "respa.h" +#include "suffix.h" #include "update.h" #include "variable.h" @@ -39,7 +41,9 @@ PairHybridScaled::PairHybridScaled(LAMMPS *lmp) PairHybridScaled::~PairHybridScaled() { memory->destroy(fsum); - memory->destroy(scaleval); + memory->destroy(tsum); + delete[] scaleval; + delete[] scaleidx; } /* ---------------------------------------------------------------------- @@ -299,15 +303,20 @@ void PairHybridScaled::settings(int narg, char **arg) ++iarg; if (utils::strmatch(arg[iarg],"^hybrid")) - error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument"); + error->all(FLERR,"Pair style hybrid/scaled cannot have hybrid as an argument"); if (strcmp(arg[iarg],"none") == 0) - error->all(FLERR,"Pair style hybrid cannot have none as an argument"); + error->all(FLERR,"Pair style hybrid/scaled cannot have none as an argument"); styles[nstyles] = force->new_pair(arg[iarg],1,dummy); force->store_style(keywords[nstyles],arg[iarg],0); special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; + if ((((PairHybridScaled *)styles[nstyles])->suffix_flag + & (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0) + error->all(FLERR,"Pair style hybrid/scaled does not support " + "accelerator styles"); + // determine list of arguments for pair style settings // by looking for the next known pair style name. @@ -341,6 +350,60 @@ void PairHybridScaled::settings(int narg, char **arg) flags(); } +/* ---------------------------------------------------------------------- + call sub-style to compute single interaction + error if sub-style does not support single() call + since overlay could have multiple sub-styles, sum results explicitly +------------------------------------------------------------------------- */ + +double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_lj, double &fforce) +{ + if (nmap[itype][jtype] == 0) + error->one(FLERR,"Invoked pair single on pair style none"); + + // update scale values from variables where needed + + 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()); + vals[i] = input->variable->compute_equal(j); + } + for (i = 0; i < nstyles; ++i) { + if (scaleidx[i] >= 0) + scaleval[i] = vals[scaleidx[i]]; + } + delete[] vals; + } + + double fone; + fforce = 0.0; + double esum = 0.0; + double scale; + + for (int m = 0; m < nmap[itype][jtype]; m++) { + if (rsq < styles[map[itype][jtype][m]]->cutsq[itype][jtype]) { + if (styles[map[itype][jtype][m]]->single_enable == 0) + error->one(FLERR,"Pair hybrid sub-style does not support single call"); + + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) + error->one(FLERR,"Pair hybrid single calls do not support" + " per sub-style special bond values"); + + scale = scaleval[map[itype][jtype][m]]; + esum += scale * styles[map[itype][jtype][m]]->single(i,j,itype,jtype,rsq, + factor_coul,factor_lj,fone); + fforce += scale * fone; + } + } + + if (single_extra) copy_svector(itype,jtype); + return esum; +} + /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ @@ -420,6 +483,63 @@ void PairHybridScaled::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairHybridScaled::write_restart(FILE *fp) +{ + PairHybrid::write_restart(fp); + + fwrite(scaleval,sizeof(double),nstyles,fp); + fwrite(scaleidx,sizeof(int),nstyles,fp); + + int n = scalevars.size(); + fwrite(&n,sizeof(int),1,fp); + for (auto var : scalevars) { + n = var.size() + 1; + fwrite(&n,sizeof(int),1,fp); + fwrite(var.c_str(),sizeof(char),n,fp); + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairHybridScaled::read_restart(FILE *fp) +{ + PairHybrid::read_restart(fp); + + delete[] scaleval; + delete[] scaleidx; + scalevars.clear(); + scaleval = new double[nstyles]; + scaleidx = new int[nstyles]; + + int n, me = comm->me; + if (me == 0) { + utils::sfread(FLERR,scaleval,sizeof(double),nstyles,fp,nullptr,error); + utils::sfread(FLERR,scaleidx,sizeof(int),nstyles,fp,nullptr,error); + } + MPI_Bcast(scaleval,nstyles,MPI_DOUBLE,0,world); + MPI_Bcast(scaleidx,nstyles,MPI_INT,0,world); + + char *tmp; + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&n,1,MPI_INT,0,world); + scalevars.resize(n); + for (size_t j=0; j < scalevars.size(); ++j) { + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); + MPI_Bcast(&n,1,MPI_INT,0,world); + tmp = new char[n]; + if (me == 0) utils::sfread(FLERR,tmp,sizeof(char),n,fp,nullptr,error); + MPI_Bcast(tmp,n,MPI_CHAR,0,world); + scalevars[j] = tmp; + delete[] tmp; + } +} + /* ---------------------------------------------------------------------- we need to handle Pair::svector special for hybrid/scaled ------------------------------------------------------------------------- */ diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h index a8bd5517ec..fbfcdab23a 100644 --- a/src/pair_hybrid_scaled.h +++ b/src/pair_hybrid_scaled.h @@ -35,6 +35,10 @@ class PairHybridScaled : public PairHybrid { virtual void settings(int, char**); virtual void coeff(int, char **); + virtual void write_restart(FILE *); + virtual void read_restart(FILE *); + virtual double single(int, int, int, int, double, double, double, double &); + void init_svector(); void copy_svector(int,int); From 73a33abb44fe8bd2907c044a1652867db3d82e83 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 00:32:06 -0400 Subject: [PATCH 323/370] add unit test for hybrid/scaled --- .../tests/mol-pair-hybrid-scaled.yaml | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml diff --git a/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml b/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml new file mode 100644 index 0000000000..cc3acb50f0 --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-hybrid-scaled.yaml @@ -0,0 +1,104 @@ +--- +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:45 2021 +epsilon: 5e-14 +skip_tests: gpu intel omp +prerequisites: ! | + atom full + pair lj/cut + pair coul/cut +pre_commands: ! | + variable scale equal 1.0 +post_commands: ! | + pair_modify mix arithmetic +input_file: in.fourmol +pair_style: hybrid/scaled v_scale lj/cut 8.0 0.6 coul/cut 8.0 0.4 coul/cut 8.0 +pair_coeff: ! | + 1 1 lj/cut 0.02 2.5 8 + 1 2 lj/cut 0.01 1.75 8 + 1 3 lj/cut 0.02 2.85 8 + 1 4 lj/cut 0.0173205 2.8 8 + 1 5 lj/cut 0.0173205 2.8 8 + 2 2 lj/cut 0.005 1 8 + 2 3 lj/cut 0.01 2.1 8 + 2 4 lj/cut 0.005 0.5 8 + 2 5 lj/cut 0.00866025 2.05 8 + 3 3 lj/cut 0.02 3.2 8 + 3 4 lj/cut 0.0173205 3.15 8 + 3 5 lj/cut 0.0173205 3.15 8 + 4 4 lj/cut 0.015 3.1 8 + 4 5 lj/cut 0.015 3.1 8 + 5 5 lj/cut 0.015 3.1 8 + * * coul/cut 1 + * * coul/cut 2 +extract: ! "" +natoms: 29 +init_vdwl: 749.237031537357 +init_coul: -127.494586297384 +init_stress: ! |2- + 2.1525607963688685e+03 2.1557327421151899e+03 4.6078904881742919e+03 -7.6038602729615206e+02 1.6844266627640316e+01 6.6957549356541904e+02 +init_forces: ! |2 + 1 -2.1092656751925425e+01 2.6988675971196511e+02 3.3315496490210148e+02 + 2 1.5859534558925552e+02 1.2807631885753918e+02 -1.8817306436807144e+02 + 3 -1.3530454720678361e+02 -3.8712939850050407e+02 -1.4565941679363837e+02 + 4 -7.8195539840070643e+00 2.1451967639963558e+00 -5.9041143405612999e+00 + 5 -2.9163954623584245e+00 -3.3469203159528891e+00 1.2074681739853981e+01 + 6 -8.2989063447195736e+02 9.6019318342576571e+02 1.1479359629470548e+03 + 7 5.7874538635311936e+01 -3.3533985555183068e+02 -1.7140659049826711e+03 + 8 1.4280513303191131e+02 -1.0509295075299345e+02 4.0233495763755388e+02 + 9 8.0984846358566287e+01 7.9600519879262990e+01 3.5197302607961126e+02 + 10 5.3089511229361369e+02 -6.0998478582862322e+02 -1.8376190026890427e+02 + 11 -3.3416993160125812e+00 -4.7792759715873308e+00 -1.0199030124309976e+01 + 12 2.0837574127335213e+01 9.8678992274266921e+00 -6.6547856883058829e+00 + 13 7.7163253261199216e+00 -3.2213746930547997e+00 -1.5767800864580894e-01 + 14 -4.6138299494911639e+00 1.1336312962250332e+00 -8.7660603717255832e+00 + 15 1.6301594996052212e-02 8.3212544078493291e+00 2.0473863128880430e+00 + 16 4.6221152690976908e+02 -3.3124444344467344e+02 -1.1865036959698600e+03 + 17 -4.5568726200724092e+02 3.2159231068141992e+02 1.1980747895060381e+03 + 18 1.2559081069243214e+00 6.6417071126352401e+00 -9.8829024661057083e+00 + 19 1.6184514948299680e+00 -1.6594104323923884e+00 5.6561121961572223e+00 + 20 -3.4526823962510336e+00 -3.1794201827804485e+00 4.2593058942069533e+00 + 21 -6.9075184494915916e+01 -8.0130885501011278e+01 2.1539206802020570e+02 + 22 -1.0659100672969126e+02 -2.5122518903211912e+01 -1.6283765584018167e+02 + 23 1.7515797811309091e+02 1.0400246780074602e+02 -5.2024018223038112e+01 + 24 3.4171625917777114e+01 -2.0194713552213176e+02 1.0982444762500101e+02 + 25 -1.4493448920889654e+02 2.0799041369281703e+01 -1.2091050237305346e+02 + 26 1.0983611557367320e+02 1.8026252731144598e+02 1.2199612526237862e+01 + 27 4.8962849172262665e+01 -2.1594262411895852e+02 8.6423873663236122e+01 + 28 -1.7556665080686602e+02 7.2243004627719102e+01 -1.1798867746650107e+02 + 29 1.2734696054095977e+02 1.4335517724642804e+02 3.2138218235426962e+01 +run_vdwl: 719.583657033589 +run_coul: -127.40544584254 +run_stress: ! |2- + 2.1066855251881925e+03 2.1118463017620702e+03 4.3411898896739367e+03 -7.3939094916433964e+02 3.4004309224046892e+01 6.3091802194682043e+02 +run_forces: ! |2 + 1 -1.8063372896871861e+01 2.6678105157873705e+02 3.2402996659149238e+02 + 2 1.5330358878115447e+02 1.2380492572678898e+02 -1.8151333240574237e+02 + 3 -1.3354888440944052e+02 -3.7931758440809585e+02 -1.4288689214683646e+02 + 4 -7.7881294728555828e+00 2.1395223669670709e+00 -5.8946911982403414e+00 + 5 -2.9015406841040750e+00 -3.3190775902304690e+00 1.2028378254388521e+01 + 6 -8.0488833369818803e+02 9.1802981835006187e+02 1.0244099127408372e+03 + 7 5.5465440662485150e+01 -3.1049131627300432e+02 -1.5711945284966396e+03 + 8 1.3295629283853211e+02 -9.6566834572636509e+01 3.9097872808487460e+02 + 9 7.8594917874857543e+01 7.6787239820699739e+01 3.4114513928465578e+02 + 10 5.2093084326233679e+02 -5.9871672888830824e+02 -1.8144904320802175e+02 + 11 -3.3489474910616370e+00 -4.7299066233626039e+00 -1.0148722292306179e+01 + 12 2.0817110693939330e+01 9.8621648346024777e+00 -6.7801624810903709e+00 + 13 7.6705047254095406e+00 -3.1868508087899996e+00 -1.5820764985177732e-01 + 14 -4.5784791310044675e+00 1.1138053855319887e+00 -8.6502065778611730e+00 + 15 -2.0858645012343142e-03 8.3343285345071436e+00 2.0653788728248101e+00 + 16 4.3381526742384807e+02 -3.1216388880293573e+02 -1.1109931745334770e+03 + 17 -4.2715774864577224e+02 3.0231264864237801e+02 1.1227484174344033e+03 + 18 1.2031503133104606e+00 6.6109154581424221e+00 -9.8172457746610178e+00 + 19 1.6542029696015907e+00 -1.6435312394752812e+00 5.6634735276627497e+00 + 20 -3.4397850729417945e+00 -3.1640002526012512e+00 4.1983600861482540e+00 + 21 -6.8065111490654829e+01 -7.8373161130023504e+01 2.1145341222255522e+02 + 22 -1.0497862711706458e+02 -2.4878742273401844e+01 -1.5988817620288421e+02 + 23 1.7253257365878264e+02 1.0200250230245655e+02 -5.1030905034776815e+01 + 24 3.5759299481226734e+01 -2.0057859782619599e+02 1.1032111627497152e+02 + 25 -1.4570195714964908e+02 2.0679748005808605e+01 -1.2162175868970056e+02 + 26 1.0901403460528100e+02 1.7901644500696690e+02 1.2412674623332103e+01 + 27 4.8035883250870448e+01 -2.1205445789284894e+02 8.4315888267103702e+01 + 28 -1.7229323056476886e+02 7.0823266235363889e+01 -1.1557273097021344e+02 + 29 1.2500312314724302e+02 1.4088629633289813e+02 3.1828931397054006e+01 +... From f2039b56675cce11f90c09b0cd4ad23d0f4b4e00 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 00:36:29 -0400 Subject: [PATCH 324/370] add hybrid/scaled pair style to summary tables --- doc/src/Commands_pair.rst | 2 +- doc/src/pair_style.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 080f3eff20..e82713f8a4 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -26,6 +26,7 @@ OPT. * :doc:`zero ` * :doc:`hybrid (k) ` * :doc:`hybrid/overlay (k) ` + * :doc:`hybrid/scaled ` * :doc:`kim ` * :doc:`list ` * @@ -33,7 +34,6 @@ OPT. * * * - * * :doc:`adp (o) ` * :doc:`agni (o) ` * :doc:`airebo (io) ` diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 89530895c4..bc2340d729 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -95,6 +95,7 @@ accelerated styles exist. * :doc:`none ` - turn off pairwise interactions * :doc:`hybrid ` - multiple styles of pairwise interactions * :doc:`hybrid/overlay ` - multiple styles of superposed pairwise interactions +* :doc:`hybrid/scaled ` - multiple styles of scaled superposed pairwise interactions * :doc:`zero ` - neighbor list but no interactions * :doc:`adp ` - angular dependent potential (ADP) of Mishin From de158c40ad83a815546a1e07884c1ca37eb2a310 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 00:38:58 -0400 Subject: [PATCH 325/370] add support for torque --- src/pair_hybrid_scaled.cpp | 21 ++++++++++++++++++++- src/pair_hybrid_scaled.h | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index da8631dcf8..92cdc767fe 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -31,7 +31,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairHybridScaled::PairHybridScaled(LAMMPS *lmp) - : PairHybrid(lmp), fsum(nullptr), scaleval(nullptr), scaleidx(nullptr) + : PairHybrid(lmp), fsum(nullptr), tsum(nullptr), + scaleval(nullptr), scaleidx(nullptr) { nmaxfsum = -1; } @@ -92,15 +93,23 @@ void PairHybridScaled::compute(int eflag, int vflag) if (atom->nmax > nmaxfsum) { memory->destroy(fsum); + if (atom->torque_flag) memory->destroy(tsum); nmaxfsum = atom->nmax; memory->create(fsum,nmaxfsum,3,"pair:fsum"); + if (atom->torque_flag) memory->create(tsum,nmaxfsum,3,"pair:tsum"); } const int nall = atom->nlocal + atom->nghost; auto f = atom->f; + auto t = atom->torque; for (i = 0; i < nall; ++i) { fsum[i][0] = f[i][0]; fsum[i][1] = f[i][1]; fsum[i][2] = f[i][2]; + if (atom->torque_flag) { + tsum[i][0] = t[i][0]; + tsum[i][1] = t[i][1]; + tsum[i][2] = t[i][2]; + } } // check if global component of incoming vflag = VIRIAL_FDOTR @@ -147,6 +156,11 @@ void PairHybridScaled::compute(int eflag, int vflag) fsum[i][0] += scale*f[i][0]; fsum[i][1] += scale*f[i][1]; fsum[i][2] += scale*f[i][2]; + if (atom->torque_flag) { + tsum[i][0] += scale*t[i][0]; + tsum[i][1] += scale*t[i][1]; + tsum[i][2] += scale*t[i][2]; + } } restore_special(saved_special); @@ -207,6 +221,11 @@ void PairHybridScaled::compute(int eflag, int vflag) f[i][0] = fsum[i][0]; f[i][1] = fsum[i][1]; f[i][2] = fsum[i][2]; + if (atom->torque_flag) { + t[i][0] = tsum[i][0]; + t[i][1] = tsum[i][1]; + t[i][2] = tsum[i][2]; + } } delete [] saved_special; diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h index fbfcdab23a..38a031ad84 100644 --- a/src/pair_hybrid_scaled.h +++ b/src/pair_hybrid_scaled.h @@ -43,7 +43,7 @@ class PairHybridScaled : public PairHybrid { void copy_svector(int,int); protected: - double **fsum; + double **fsum, **tsum; double *scaleval; int *scaleidx; std::vector scalevars; From 4c23ecfd4ff4c856e3b65d48fa4aad3f36409b46 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 00:47:22 -0400 Subject: [PATCH 326/370] error out on special atom styles --- src/pair_hybrid_scaled.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 92cdc767fe..27a02a8d90 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -14,6 +14,7 @@ #include "pair_hybrid_scaled.h" #include "atom.h" +#include "atom_vec.h" #include "comm.h" #include "error.h" #include "force.h" @@ -243,6 +244,9 @@ void PairHybridScaled::settings(int narg, char **arg) error->all(FLERR,fmt::format("Must use pair_style {}/kk with Kokkos", force->pair_style)); + if (atom->avec->forceclearflag) + error->all(FLERR,"Atom style is not compatible with pair_style hybrid/scaled"); + // delete old lists, since cannot just change settings if (nstyles > 0) { From 7b45b691f4a926328f53fdcc95c9d78261656269 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Fri, 9 Apr 2021 13:31:40 +0200 Subject: [PATCH 327/370] pair_pace.cpp: check that units are "metal" update ace-evaluator (download link + md5sum in cmake and make build systems): accept multilines comment at the beginning of potential.ace file add first comment line for potentials/Cu-PBE-core-rep.ace --- cmake/Modules/Packages/USER-PACE.cmake | 4 ++-- lib/pace/Install.py | 12 +++++++----- potentials/Cu-PBE-core-rep.ace | 2 ++ src/USER-PACE/pair_pace.cpp | 5 +++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake index e8262f7d40..df1fb023a5 100644 --- a/cmake/Modules/Packages/USER-PACE.cmake +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.2.3.upd2.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "8fd1162724d349b930e474927197f20d" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.4.9.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "4db54962fbd6adcf8c18d46e1798ceb5" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index 91aa8b3a46..08bbb331bb 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -12,20 +12,22 @@ from argparse import ArgumentParser sys.path.append('..') from install_helpers import fullpath, geturl, checkmd5sum -parser = ArgumentParser(prog='Install.py', - description="LAMMPS library build wrapper script") - # settings thisdir = fullpath('.') -version = "v.2021.2.3.upd2" +version = 'v.2021.4.9' # known checksums for different PACE versions. used to validate the download. checksums = { \ - 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', \ + 'v.2021.2.3.upd2' : '8fd1162724d349b930e474927197f20d', + 'v.2021.4.9' : '4db54962fbd6adcf8c18d46e1798ceb5', } +parser = ArgumentParser(prog='Install.py', + description="LAMMPS library build wrapper script") + + # help message HELP = """ diff --git a/potentials/Cu-PBE-core-rep.ace b/potentials/Cu-PBE-core-rep.ace index 338675f718..511bb9af7f 100644 --- a/potentials/Cu-PBE-core-rep.ace +++ b/potentials/Cu-PBE-core-rep.ace @@ -1,3 +1,5 @@ +# DATE: 2021-04-08 UNITS: metal CONTRIBUTOR: Yury Lysogorskiy CITATION: npj Comp. Mat., submitted (2021) + nelements=1 elements: Cu diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index c12753603a..f59291b33e 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -25,6 +25,7 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" +#include "update.h" #include #include @@ -252,6 +253,10 @@ void PairPACE::settings(int narg, char **arg) { if (narg > 1) error->all(FLERR,"Illegal pair_style command."); + // ACE potentials are parameterized in metal units + if (strcmp("metal",update->unit_style) != 0) + error->all(FLERR,"ACE potentials require 'metal' units"); + recursive = true; // default evaluator style: RECURSIVE if (narg > 0) { if (strcmp(arg[0], RECURSIVE_KEYWORD) == 0) From 924a331342b5a1a57df988c4656b25992ecab067 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 09:08:39 -0400 Subject: [PATCH 328/370] avoid uninitialized data usage reported by coverity scan --- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp | 3 +-- src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 51dca15e7b..136472f1cd 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -1261,6 +1261,7 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, k_tangential = tangential_coeffs[0]; damp_tangential = tangential_coeffs[1]*damp_normal_prefactor; + Fscrit = tangential_coeffs[2] * Fncrit; int thist0 = tangential_history_index; int thist1 = thist0 + 1; @@ -1346,7 +1347,6 @@ void FixWallGran::granular(double rsq, double dx, double dy, double dz, } // rescale frictional displacements and forces if needed - Fscrit = tangential_coeffs[2] * Fncrit; fs = sqrt(fs1*fs1 + fs2*fs2 + fs3*fs3); if (fs > Fscrit) { shrmag = sqrt(history[thist0]*history[thist0] + diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index d1f9d33e8a..72fa4ff064 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -586,9 +586,9 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, int itable; r2inv = 1.0/rsq; + r = sqrt(rsq); if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) { - r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); @@ -621,7 +621,6 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, forcecoul2 = 0.0; prefactor2 = 0.0; } else { - r = sqrt(rsq); rrij = lj2[itype][jtype]*r; expn2 = exp(-rrij*rrij); erfc2 = erfc(rrij); diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index c7fcac855a..4e52226eaf 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -586,9 +586,9 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, int itable; r2inv = 1.0/rsq; + r = sqrt(rsq); if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) { - r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); @@ -613,7 +613,6 @@ double PairMM3Switch3CoulGaussLong::single(int i, int j, int itype, int jtype, } else forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - r = sqrt(rsq); expb = lj3[itype][jtype]*exp(-lj1[itype][jtype]*r); forcelj = expb*lj1[itype][jtype]*r; r6inv = r2inv*r2inv*r2inv; From 97977e3e68d1e60e84c3883cfa8ec7f986eef730 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 09:44:23 -0400 Subject: [PATCH 329/370] incorrect check for additional argument in pair_modify nofdotr --- src/pair.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pair.cpp b/src/pair.cpp index 767fa638cf..0d90b0ce39 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -204,7 +204,6 @@ void Pair::modify_params(int narg, char **arg) else error->all(FLERR,"Illegal pair_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"nofdotr") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); no_virial_fdotr_compute = 1; ++iarg; } else error->all(FLERR,"Illegal pair_modify command"); From d507c57c8a0b7c22b978e49a03a750433d4073d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 09:45:09 -0400 Subject: [PATCH 330/370] add missing zeroing of the torque array, reformat code --- src/pair_hybrid_scaled.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 27a02a8d90..62b94d9ba9 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -134,9 +134,10 @@ void PairHybridScaled::compute(int eflag, int vflag) for (m = 0; m < nstyles; m++) { - // clear forces + // clear forces and torques memset(&f[0][0],0,nall*3*sizeof(double)); + if (atom->torque_flag) memset(&t[0][0],0,nall*3*sizeof(double)); set_special(m); @@ -171,17 +172,17 @@ void PairHybridScaled::compute(int eflag, int vflag) if (respaflag && !respa->tally_global) continue; if (eflag_global) { - eng_vdwl += scale * styles[m]->eng_vdwl; - eng_coul += scale * styles[m]->eng_coul; + eng_vdwl += scale*styles[m]->eng_vdwl; + eng_coul += scale*styles[m]->eng_coul; } if (vflag_global) { - for (n = 0; n < 6; n++) virial[n] += scale * styles[m]->virial[n]; + for (n = 0; n < 6; n++) virial[n] += scale*styles[m]->virial[n]; } if (eflag_atom) { n = atom->nlocal; if (force->newton_pair) n += atom->nghost; double *eatom_substyle = styles[m]->eatom; - for (i = 0; i < n; i++) eatom[i] += scale * eatom_substyle[i]; + for (i = 0; i < n; i++) eatom[i] += scale*eatom_substyle[i]; } if (vflag_atom) { n = atom->nlocal; @@ -189,7 +190,7 @@ void PairHybridScaled::compute(int eflag, int vflag) double **vatom_substyle = styles[m]->vatom; for (i = 0; i < n; i++) for (j = 0; j < 6; j++) - vatom[i][j] += scale * vatom_substyle[i][j]; + vatom[i][j] += scale*vatom_substyle[i][j]; } // substyles may be CENTROID_SAME or CENTROID_AVAIL @@ -201,22 +202,22 @@ void PairHybridScaled::compute(int eflag, int vflag) double **cvatom_substyle = styles[m]->cvatom; for (i = 0; i < n; i++) for (j = 0; j < 9; j++) - cvatom[i][j] += scale * cvatom_substyle[i][j]; + cvatom[i][j] += scale*cvatom_substyle[i][j]; } else { double **vatom_substyle = styles[m]->vatom; for (i = 0; i < n; i++) { for (j = 0; j < 6; j++) { - cvatom[i][j] += scale * vatom_substyle[i][j]; + cvatom[i][j] += scale*vatom_substyle[i][j]; } for (j = 6; j < 9; j++) { - cvatom[i][j] += scale * vatom_substyle[i][j-3]; + cvatom[i][j] += scale*vatom_substyle[i][j-3]; } } } } } - // copy accumulated forces to original force array + // copy accumulated scaled forces to original force array for (i = 0; i < nall; ++i) { f[i][0] = fsum[i][0]; From b6b101f29af3c18df6bc223c5e12aa2e8e0fb376 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 09:54:47 -0400 Subject: [PATCH 331/370] update melt example to use velocity with loop geom for consistent velocities --- examples/melt/in.melt | 2 +- examples/melt/log.27Nov18.melt.g++.4 | 85 ------------------- ...Nov18.melt.g++.1 => log.8Apr21.melt.g++.1} | 50 +++++------ examples/melt/log.8Apr21.melt.g++.4 | 85 +++++++++++++++++++ 4 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 examples/melt/log.27Nov18.melt.g++.4 rename examples/melt/{log.27Nov18.melt.g++.1 => log.8Apr21.melt.g++.1} (51%) create mode 100644 examples/melt/log.8Apr21.melt.g++.4 diff --git a/examples/melt/in.melt b/examples/melt/in.melt index 8431a4344e..f169dc2ffc 100644 --- a/examples/melt/in.melt +++ b/examples/melt/in.melt @@ -9,7 +9,7 @@ create_box 1 box create_atoms 1 box mass 1 1.0 -velocity all create 3.0 87287 +velocity all create 3.0 87287 loop geom pair_style lj/cut 2.5 pair_coeff 1 1 1.0 1.0 2.5 diff --git a/examples/melt/log.27Nov18.melt.g++.4 b/examples/melt/log.27Nov18.melt.g++.4 deleted file mode 100644 index 927895b1cd..0000000000 --- a/examples/melt/log.27Nov18.melt.g++.4 +++ /dev/null @@ -1,85 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 3d Lennard-Jones melt - -units lj -atom_style atomic - -lattice fcc 0.8442 -Lattice spacing in x,y,z = 1.6796 1.6796 1.6796 -region box block 0 10 0 10 0 10 -create_box 1 box -Created orthogonal box = (0 0 0) to (16.796 16.796 16.796) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 4000 atoms - Time spent = 0.00041604 secs -mass 1 1.0 - -velocity all create 3.0 87287 - -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 2.5 - -neighbor 0.3 bin -neigh_modify every 20 delay 0 check no - -fix 1 all nve - -#dump id all atom 50 dump.melt - -#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 2 pad 3 - -#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 -#dump_modify 3 pad 3 - -thermo 50 -run 250 -Neighbor list info ... - update every 20 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 12 12 12 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 2.705 | 2.705 | 2.705 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 3 -6.7733681 0 -2.2744931 -3.7033504 - 50 1.6754119 -4.7947589 0 -2.2822693 5.6615925 - 100 1.6503357 -4.756014 0 -2.2811293 5.8050524 - 150 1.6596605 -4.7699432 0 -2.2810749 5.7830138 - 200 1.6371874 -4.7365462 0 -2.2813789 5.9246674 - 250 1.6323462 -4.7292021 0 -2.2812949 5.9762238 -Loop time of 0.223329 on 4 procs for 250 steps with 4000 atoms - -Performance: 483592.231 tau/day, 1119.426 timesteps/s -97.3% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.15881 | 0.16314 | 0.16859 | 0.9 | 73.05 -Neigh | 0.02472 | 0.025218 | 0.025828 | 0.3 | 11.29 -Comm | 0.025185 | 0.030091 | 0.034351 | 1.9 | 13.47 -Output | 0.00015163 | 0.00019169 | 0.00030899 | 0.0 | 0.09 -Modify | 0.0037532 | 0.0038366 | 0.0040054 | 0.2 | 1.72 -Other | | 0.00085 | | | 0.38 - -Nlocal: 1000 ave 1010 max 982 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Nghost: 2703.75 ave 2713 max 2689 min -Histogram: 1 0 0 0 0 0 0 2 0 1 -Neighs: 37915.5 ave 39239 max 36193 min -Histogram: 1 0 0 0 0 1 1 0 0 1 - -Total # of neighbors = 151662 -Ave neighs/atom = 37.9155 -Neighbor list builds = 12 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/melt/log.27Nov18.melt.g++.1 b/examples/melt/log.8Apr21.melt.g++.1 similarity index 51% rename from examples/melt/log.27Nov18.melt.g++.1 rename to examples/melt/log.8Apr21.melt.g++.1 index 69b39e6011..a3b6d003db 100644 --- a/examples/melt/log.27Nov18.melt.g++.1 +++ b/examples/melt/log.8Apr21.melt.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (8 Apr 2021) using 1 OpenMP thread(s) per MPI task # 3d Lennard-Jones melt @@ -6,17 +6,17 @@ units lj atom_style atomic lattice fcc 0.8442 -Lattice spacing in x,y,z = 1.6796 1.6796 1.6796 +Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962 region box block 0 10 0 10 0 10 create_box 1 box -Created orthogonal box = (0 0 0) to (16.796 16.796 16.796) +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (16.795962 16.795962 16.795962) 1 by 1 by 1 MPI processor grid create_atoms 1 box Created 4000 atoms - Time spent = 0.000645638 secs + create_atoms CPU = 0.002 seconds mass 1 1.0 -velocity all create 3.0 87287 +velocity all create 3.0 87287 loop geom pair_style lj/cut 2.5 pair_coeff 1 1 1.0 1.0 2.5 @@ -48,38 +48,38 @@ Neighbor list info ... pair build: half/bin/atomonly/newton stencil: half/bin/3d/newton bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.221 | 3.221 | 3.221 Mbytes +Per MPI rank memory allocation (min/avg/max) = 3.222 | 3.222 | 3.222 Mbytes Step Temp E_pair E_mol TotEng Press 0 3 -6.7733681 0 -2.2744931 -3.7033504 - 50 1.6758903 -4.7955425 0 -2.2823355 5.670064 - 100 1.6458363 -4.7492704 0 -2.2811332 5.8691042 - 150 1.6324555 -4.7286791 0 -2.280608 5.9589514 - 200 1.6630725 -4.7750988 0 -2.2811136 5.7364886 - 250 1.6275257 -4.7224992 0 -2.281821 5.9567365 -Loop time of 0.729809 on 1 procs for 250 steps with 4000 atoms + 50 1.6842865 -4.8082494 0 -2.2824513 5.5666131 + 100 1.6712577 -4.7875609 0 -2.281301 5.6613913 + 150 1.6444751 -4.7471034 0 -2.2810074 5.8614211 + 200 1.6471542 -4.7509053 0 -2.2807916 5.8805431 + 250 1.6645597 -4.7774327 0 -2.2812174 5.7526089 +Loop time of 1.61045 on 1 procs for 250 steps with 4000 atoms -Performance: 147983.915 tau/day, 342.555 timesteps/s +Performance: 67062.020 tau/day, 155.236 timesteps/s 99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.60661 | 0.60661 | 0.60661 | 0.0 | 83.12 -Neigh | 0.092198 | 0.092198 | 0.092198 | 0.0 | 12.63 -Comm | 0.013581 | 0.013581 | 0.013581 | 0.0 | 1.86 -Output | 0.0001452 | 0.0001452 | 0.0001452 | 0.0 | 0.02 -Modify | 0.014395 | 0.014395 | 0.014395 | 0.0 | 1.97 -Other | | 0.002878 | | | 0.39 +Pair | 1.3961 | 1.3961 | 1.3961 | 0.0 | 86.69 +Neigh | 0.13555 | 0.13555 | 0.13555 | 0.0 | 8.42 +Comm | 0.037732 | 0.037732 | 0.037732 | 0.0 | 2.34 +Output | 0.0003345 | 0.0003345 | 0.0003345 | 0.0 | 0.02 +Modify | 0.038016 | 0.038016 | 0.038016 | 0.0 | 2.36 +Other | | 0.002731 | | | 0.17 -Nlocal: 4000 ave 4000 max 4000 min +Nlocal: 4000.00 ave 4000 max 4000 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 5499 ave 5499 max 5499 min +Nghost: 5506.00 ave 5506 max 5506 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 151513 ave 151513 max 151513 min +Neighs: 151788.0 ave 151788 max 151788 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Total # of neighbors = 151513 -Ave neighs/atom = 37.8783 +Total # of neighbors = 151788 +Ave neighs/atom = 37.947000 Neighbor list builds = 12 Dangerous builds not checked -Total wall time: 0:00:00 +Total wall time: 0:00:01 diff --git a/examples/melt/log.8Apr21.melt.g++.4 b/examples/melt/log.8Apr21.melt.g++.4 new file mode 100644 index 0000000000..1edbeac7aa --- /dev/null +++ b/examples/melt/log.8Apr21.melt.g++.4 @@ -0,0 +1,85 @@ +LAMMPS (8 Apr 2021) + using 1 OpenMP thread(s) per MPI task +# 3d Lennard-Jones melt + +units lj +atom_style atomic + +lattice fcc 0.8442 +Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962 +region box block 0 10 0 10 0 10 +create_box 1 box +Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (16.795962 16.795962 16.795962) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 4000 atoms + create_atoms CPU = 0.001 seconds +mass 1 1.0 + +velocity all create 3.0 87287 loop geom + +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 2.5 + +neighbor 0.3 bin +neigh_modify every 20 delay 0 check no + +fix 1 all nve + +#dump id all atom 50 dump.melt + +#dump 2 all image 25 image.*.jpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 2 pad 3 + +#dump 3 all movie 25 movie.mpg type type # axes yes 0.8 0.02 view 60 -30 +#dump_modify 3 pad 3 + +thermo 50 +run 250 +Neighbor list info ... + update every 20 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 12 12 12 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 2.706 | 2.706 | 2.706 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 3 -6.7733681 0 -2.2744931 -3.7033504 + 50 1.6842865 -4.8082494 0 -2.2824513 5.5666131 + 100 1.6712577 -4.7875609 0 -2.281301 5.6613913 + 150 1.6444751 -4.7471034 0 -2.2810074 5.8614211 + 200 1.6471542 -4.7509053 0 -2.2807916 5.8805431 + 250 1.6645597 -4.7774327 0 -2.2812174 5.7526089 +Loop time of 0.490832 on 4 procs for 250 steps with 4000 atoms + +Performance: 220034.754 tau/day, 509.340 timesteps/s +96.7% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.35932 | 0.37256 | 0.38746 | 1.9 | 75.90 +Neigh | 0.035928 | 0.038449 | 0.042344 | 1.3 | 7.83 +Comm | 0.053452 | 0.068917 | 0.08485 | 5.3 | 14.04 +Output | 0.00015545 | 0.00023746 | 0.00047684 | 0.0 | 0.05 +Modify | 0.0096958 | 0.0097951 | 0.0098989 | 0.1 | 2.00 +Other | | 0.0008721 | | | 0.18 + +Nlocal: 1000.00 ave 1008 max 987 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Nghost: 2711.25 ave 2728 max 2693 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Neighs: 37947.0 ave 38966 max 37338 min +Histogram: 1 1 0 1 0 0 0 0 0 1 + +Total # of neighbors = 151788 +Ave neighs/atom = 37.947000 +Neighbor list builds = 12 +Dangerous builds not checked +Total wall time: 0:00:00 From 08471cb88ed0a88d6dc0e83d2dc758ab73080124 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 10:29:36 -0400 Subject: [PATCH 332/370] update path to updated log file --- unittest/python/python-formats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/python/python-formats.py b/unittest/python/python-formats.py index c093e9bebb..ca877b8305 100644 --- a/unittest/python/python-formats.py +++ b/unittest/python/python-formats.py @@ -4,7 +4,7 @@ from lammps.formats import LogFile, AvgChunkFile EXAMPLES_DIR=os.path.abspath(os.path.join(__file__, '..', '..', '..', 'examples')) -DEFAULT_STYLE_EXAMPLE_LOG="melt/log.27Nov18.melt.g++.1" +DEFAULT_STYLE_EXAMPLE_LOG="melt/log.8Apr21.melt.g++.1" MULTI_STYLE_EXAMPLE_LOG="peptide/log.27Nov18.peptide.g++.1" AVG_CHUNK_FILE="VISCOSITY/profile.13Oct16.nemd.2d.g++.1" From ded22bf8bc68cc20cc6333866fe447af0d7d3c02 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 11:36:10 -0400 Subject: [PATCH 333/370] Minor changes to dump_atom_gz/dump_atom_zstd --- src/COMPRESS/dump_atom_gz.cpp | 5 +---- src/COMPRESS/dump_atom_zstd.cpp | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 071af2167d..254e146800 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -11,16 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "dump_atom_gz.h" #include "domain.h" +#include "dump_atom_gz.h" #include "error.h" -#include "file_writer.h" #include "update.h" - #include - using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index 300a4c81cb..dd744b5d49 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -43,7 +43,7 @@ DumpAtomZstd::~DumpAtomZstd() /* ---------------------------------------------------------------------- generic opening of a dump file - ASCII or binary or zstdipped + ASCII or binary or compressed some derived classes override this function ------------------------------------------------------------------------- */ @@ -180,7 +180,7 @@ int DumpAtomZstd::modify_param(int narg, char **arg) return 2; } } catch (FileWriterException &e) { - error->one(FLERR, e.what()); + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; From 2682663df6ac7ee5092b2df090a95c5349074471 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 11:41:45 -0400 Subject: [PATCH 334/370] Use GzFileWriter in dump cfg/gz --- src/COMPRESS/dump_cfg_gz.cpp | 88 ++++++++----------- src/COMPRESS/dump_cfg_gz.h | 5 +- src/COMPRESS/dump_cfg_zstd.cpp | 3 +- unittest/formats/test_dump_cfg_compressed.cpp | 4 +- 4 files changed, 41 insertions(+), 59 deletions(-) diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 378baf502f..6bbf118789 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -11,41 +11,30 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "dump_cfg_gz.h" #include "atom.h" #include "domain.h" +#include "dump_cfg_gz.h" #include "error.h" #include "update.h" - #include - using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - gzFp = nullptr; - - compression_level = Z_BEST_COMPRESSION; - if (!compressed) error->all(FLERR,"Dump cfg/gz only writes compressed files"); } - /* ---------------------------------------------------------------------- */ DumpCFGGZ::~DumpCFGGZ() { - if (gzFp) gzclose(gzFp); - gzFp = nullptr; - fp = nullptr; } - /* ---------------------------------------------------------------------- generic opening of a dump file ASCII or binary or gzipped @@ -95,17 +84,12 @@ void DumpCFGGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - std::string mode; - if (append_flag) { - mode = fmt::format("ab{}", compression_level); - } else { - mode = fmt::format("wb{}", compression_level); + try { + writer.open(filecurrent, append_flag); + } catch (FileWriterException &e) { + error->one(FLERR, e.what()); } - - gzFp = gzopen(filecurrent, mode.c_str()); - - if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); - } else gzFp = nullptr; + } // delete string with timestep replaced @@ -127,30 +111,30 @@ void DumpCFGGZ::write_header(bigint n) if (atom->peri_flag) scale = atom->pdscale; else if (unwrapflag == 1) scale = UNWRAPEXPAND; - char str[64]; - sprintf(str,"Number of particles = %s\n",BIGINT_FORMAT); - gzprintf(gzFp,str,n); - gzprintf(gzFp,"A = %g Angstrom (basic length-scale)\n",scale); - gzprintf(gzFp,"H0(1,1) = %g A\n",domain->xprd); - gzprintf(gzFp,"H0(1,2) = 0 A \n"); - gzprintf(gzFp,"H0(1,3) = 0 A \n"); - gzprintf(gzFp,"H0(2,1) = %g A \n",domain->xy); - gzprintf(gzFp,"H0(2,2) = %g A\n",domain->yprd); - gzprintf(gzFp,"H0(2,3) = 0 A \n"); - gzprintf(gzFp,"H0(3,1) = %g A \n",domain->xz); - gzprintf(gzFp,"H0(3,2) = %g A \n",domain->yz); - gzprintf(gzFp,"H0(3,3) = %g A\n",domain->zprd); - gzprintf(gzFp,".NO_VELOCITY.\n"); - gzprintf(gzFp,"entry_count = %d\n",nfield-2); + std::string header = fmt::format("Number of particles = {}\n", n); + header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); + header += fmt::format("H0(1,1) = {0:g} A\n",domain->xprd); + header += fmt::format("H0(1,2) = 0 A \n"); + header += fmt::format("H0(1,3) = 0 A \n"); + header += fmt::format("H0(2,1) = {0:g} A \n",domain->xy); + header += fmt::format("H0(2,2) = {0:g} A\n",domain->yprd); + header += fmt::format("H0(2,3) = 0 A \n"); + header += fmt::format("H0(3,1) = {0:g} A \n",domain->xz); + header += fmt::format("H0(3,2) = {0:g} A \n",domain->yz); + header += fmt::format("H0(3,3) = {0:g} A\n",domain->zprd); + header += fmt::format(".NO_VELOCITY.\n"); + header += fmt::format("entry_count = {}\n",nfield-2); for (int i = 0; i < nfield-5; i++) - gzprintf(gzFp,"auxiliary[%d] = %s\n",i,auxname[i]); + header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]); + + writer.write(header.c_str(), header.length()); } /* ---------------------------------------------------------------------- */ void DumpCFGGZ::write_data(int n, double *mybuf) { - gzwrite(gzFp,mybuf,sizeof(char)*n); + writer.write(mybuf, n); } /* ---------------------------------------------------------------------- */ @@ -160,11 +144,11 @@ void DumpCFGGZ::write() DumpCFG::write(); if (filewriter) { if (multifile) { - gzclose(gzFp); - gzFp = nullptr; + writer.close(); } else { - if (flush_flag) - gzflush(gzFp,Z_SYNC_FLUSH); + if (flush_flag && writer.isopen()) { + writer.flush(); + } } } } @@ -175,16 +159,16 @@ int DumpCFGGZ::modify_param(int narg, char **arg) { int consumed = DumpCFG::modify_param(narg, arg); if (consumed == 0) { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - int min_level = Z_DEFAULT_COMPRESSION; - int max_level = Z_BEST_COMPRESSION; - compression_level = utils::inumeric(FLERR, arg[1], false, lmp); - if (compression_level < min_level || compression_level > max_level) - error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); - return 2; + try { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException &e) { + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; } - diff --git a/src/COMPRESS/dump_cfg_gz.h b/src/COMPRESS/dump_cfg_gz.h index 0c6ed24f06..2844902a38 100644 --- a/src/COMPRESS/dump_cfg_gz.h +++ b/src/COMPRESS/dump_cfg_gz.h @@ -21,7 +21,7 @@ DumpStyle(cfg/gz,DumpCFGGZ) #define LMP_DUMP_CFG_GZ_H #include "dump_cfg.h" -#include +#include "gz_file_writer.h" namespace LAMMPS_NS { @@ -31,8 +31,7 @@ class DumpCFGGZ : public DumpCFG { virtual ~DumpCFGGZ(); protected: - int compression_level; - gzFile gzFp; // file pointer for the compressed output stream + GzFileWriter writer; virtual void openfile(); virtual void write_header(bigint); diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index 459649c70a..978e695d1a 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -21,7 +21,6 @@ #include "domain.h" #include "dump_cfg_zstd.h" #include "error.h" -#include "file_writer.h" #include "update.h" #include @@ -46,7 +45,7 @@ DumpCFGZstd::~DumpCFGZstd() /* ---------------------------------------------------------------------- generic opening of a dump file - ASCII or binary or zstdipped + ASCII or binary or compressed some derived classes override this function ------------------------------------------------------------------------- */ diff --git a/unittest/formats/test_dump_cfg_compressed.cpp b/unittest/formats/test_dump_cfg_compressed.cpp index 20f902091b..6d5e8bcf04 100644 --- a/unittest/formats/test_dump_cfg_compressed.cpp +++ b/unittest/formats/test_dump_cfg_compressed.cpp @@ -234,7 +234,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param) command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields)); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 compression_level 12"); ); } @@ -248,7 +248,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param) command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"), fields)); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); ); } From 77de0273be242bd6bae9bd0e59fd99a69ff1449d Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 12:37:14 -0400 Subject: [PATCH 335/370] Fix typo --- src/dump_local.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 53a82b496f..8b9b309aff 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -112,7 +112,7 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : label = utils::strdup("ENTRIES"); - // if wildcard expansion occurred, free earg memory from exapnd_args() + // if wildcard expansion occurred, free earg memory from expand_args() if (expand) { for (int i = 0; i < nfield; i++) delete [] earg[i]; From e0e031aa4324082c53654df333b82ea2d4b9b0c0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 13:38:18 -0400 Subject: [PATCH 336/370] Correct dump_modify example in docs --- doc/src/dump_modify.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index 753cce703c..d072df5d4d 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -362,7 +362,7 @@ settings, reverting all values to their default format. compute 1 all property/local batom1 batom2 dump 1 all local 100 tmp.bonds index c_1[1] c_1[2] - dump_modify 1 format "%d %0.0f %0.0f" + dump_modify 1 format line "%d %0.0f %0.0f" will output the two atom IDs for atoms in each bond as integers. If the dump_modify command were omitted, they would appear as From 5c9a5ba8ac03f51ac1e3bf0457cc1742f003e4e7 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 14:48:38 -0400 Subject: [PATCH 337/370] Add missing code to allow customized formatting in dump local --- src/dump_local.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 8b9b309aff..dac8066236 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -225,6 +225,46 @@ int DumpLocal::modify_param(int narg, char **arg) delete [] label; label = utils::strdup(arg[1]); return 2; + } else if (strcmp(arg[0],"format") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + + if (strcmp(arg[1],"none") == 0) { + // just clear format_column_user allocated by this dump child class + for (int i = 0; i < nfield; i++) { + delete [] format_column_user[i]; + format_column_user[i] = nullptr; + } + return 2; + } else if (strcmp(arg[1],"int") == 0) { + delete [] format_int_user; + format_int_user = utils::strdup(arg[2]); + delete [] format_bigint_user; + int n = strlen(format_int_user) + 8; + format_bigint_user = new char[n]; + // replace "d" in format_int_user with bigint format specifier + // use of &str[1] removes leading '%' from BIGINT_FORMAT string + char *ptr = strchr(format_int_user,'d'); + if (ptr == nullptr) + error->all(FLERR, + "Dump_modify int format does not contain d character"); + char str[8]; + sprintf(str,"%s",BIGINT_FORMAT); + *ptr = '\0'; + sprintf(format_bigint_user,"%s%s%s",format_int_user,&str[1],ptr+1); + *ptr = 'd'; + + } else if (strcmp(arg[1],"float") == 0) { + delete [] format_float_user; + format_float_user = utils::strdup(arg[2]); + + } else { + int i = utils::inumeric(FLERR,arg[1],false,lmp) - 1; + if (i < 0 || i >= nfield) + error->all(FLERR,"Illegal dump_modify command"); + if (format_column_user[i]) delete [] format_column_user[i]; + format_column_user[i] = utils::strdup(arg[2]); + } + return 3; } return 0; } From dc71d8030694fb6c55588b94913182aa8f482f70 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 14:49:07 -0400 Subject: [PATCH 338/370] Add dump local tests --- unittest/formats/CMakeLists.txt | 5 + unittest/formats/test_dump_local.cpp | 195 +++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 unittest/formats/test_dump_local.cpp diff --git a/unittest/formats/CMakeLists.txt b/unittest/formats/CMakeLists.txt index be0d14c47d..4c6de98729 100644 --- a/unittest/formats/CMakeLists.txt +++ b/unittest/formats/CMakeLists.txt @@ -102,6 +102,11 @@ target_link_libraries(test_dump_cfg PRIVATE lammps GTest::GMock GTest::GTest) add_test(NAME DumpCfg COMMAND test_dump_cfg WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_tests_properties(DumpCfg PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") +add_executable(test_dump_local test_dump_local.cpp) +target_link_libraries(test_dump_local PRIVATE lammps GTest::GMock GTest::GTest) +add_test(NAME DumpLocal COMMAND test_dump_local WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_tests_properties(DumpLocal PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") + if(BUILD_TOOLS) set_tests_properties(DumpAtom PROPERTIES ENVIRONMENT "BINARY2TXT_BINARY=$") set_tests_properties(DumpCustom PROPERTIES ENVIRONMENT "BINARY2TXT_BINARY=$") diff --git a/unittest/formats/test_dump_local.cpp b/unittest/formats/test_dump_local.cpp new file mode 100644 index 0000000000..fb38ca08ad --- /dev/null +++ b/unittest/formats/test_dump_local.cpp @@ -0,0 +1,195 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "../testing/core.h" +#include "../testing/systems/melt.h" +#include "../testing/utils.h" +#include "fmt/format.h" +#include "output.h" +#include "thermo.h" +#include "utils.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + +using ::testing::Eq; + +char *BINARY2TXT_BINARY = nullptr; +bool verbose = false; + +class DumpLocalTest : public MeltTest { + std::string dump_style = "local"; + +public: + void enable_triclinic() + { + BEGIN_HIDE_OUTPUT(); + command("change_box all triclinic"); + END_HIDE_OUTPUT(); + } + + void generate_dump(std::string dump_file, std::string dump_options, std::string dump_modify_options, int ntimesteps) + { + BEGIN_HIDE_OUTPUT(); + command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, dump_options)); + + if (!dump_modify_options.empty()) { + command(fmt::format("dump_modify id {}", dump_modify_options)); + } + + command(fmt::format("run {} post no", ntimesteps)); + END_HIDE_OUTPUT(); + } + + void continue_dump(int ntimesteps) + { + BEGIN_HIDE_OUTPUT(); + command(fmt::format("run {} pre no post no", ntimesteps)); + END_HIDE_OUTPUT(); + } + + void SetUp() override { + MeltTest::SetUp(); + + BEGIN_HIDE_OUTPUT(); + command("compute comp all pair/local dist eng"); + END_HIDE_OUTPUT(); + } +}; + +TEST_F(DumpLocalTest, run0) +{ + auto dump_file = "dump_local_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 873); + + ASSERT_THAT(lines[0], Eq("ITEM: TIMESTEP")); + ASSERT_EQ(std::stoi(lines[1]), 0); + + ASSERT_THAT(lines[2], Eq("ITEM: NUMBER OF ENTRIES")); + ASSERT_EQ(std::stoi(lines[3]), 864); + + ASSERT_THAT(lines[4], Eq("ITEM: BOX BOUNDS pp pp pp")); + ASSERT_EQ(utils::split_words(lines[5]).size(), 2); + ASSERT_EQ(utils::split_words(lines[6]).size(), 2); + ASSERT_EQ(utils::split_words(lines[7]).size(), 2); + ASSERT_THAT(lines[8], Eq("ITEM: ENTRIES index c_comp[1] ")); + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq("1 1.18765 ")); + delete_file(dump_file); +} + +TEST_F(DumpLocalTest, format_line_run0) +{ + auto dump_file = "dump_local_format_line_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "format line \"%d %20.8g\"", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq("1 1.1876539 ")); + delete_file(dump_file); +} + +TEST_F(DumpLocalTest, format_int_run0) +{ + auto dump_file = "dump_local_format_int_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "format int \"%20d\"", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq(" 1 1.18765 ")); + delete_file(dump_file); +} + +TEST_F(DumpLocalTest, format_float_run0) +{ + auto dump_file = "dump_local_format_float_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "format float \"%20.5g\"", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq("1 1.1877 ")); + delete_file(dump_file); +} + +TEST_F(DumpLocalTest, format_column_run0) +{ + auto dump_file = "dump_local_format_column_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "format 1 \"%20d\"", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq(" 1 1.18765 ")); + delete_file(dump_file); +} + +TEST_F(DumpLocalTest, no_buffer_run0) +{ + auto dump_file = "dump_local_format_line_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "buffer no", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 873); + + ASSERT_THAT(lines[0], Eq("ITEM: TIMESTEP")); + ASSERT_EQ(std::stoi(lines[1]), 0); + + ASSERT_THAT(lines[2], Eq("ITEM: NUMBER OF ENTRIES")); + ASSERT_EQ(std::stoi(lines[3]), 864); + + ASSERT_THAT(lines[4], Eq("ITEM: BOX BOUNDS pp pp pp")); + ASSERT_EQ(utils::split_words(lines[5]).size(), 2); + ASSERT_EQ(utils::split_words(lines[6]).size(), 2); + ASSERT_EQ(utils::split_words(lines[7]).size(), 2); + ASSERT_THAT(lines[8], Eq("ITEM: ENTRIES index c_comp[1] ")); + ASSERT_EQ(utils::split_words(lines[9]).size(), 2); + ASSERT_THAT(lines[9], Eq("1 1.18765 ")); + delete_file(dump_file); +} + +int main(int argc, char **argv) +{ + MPI_Init(&argc, &argv); + ::testing::InitGoogleMock(&argc, argv); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = utils::split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } + + BINARY2TXT_BINARY = getenv("BINARY2TXT_BINARY"); + + if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; + + int rv = RUN_ALL_TESTS(); + MPI_Finalize(); + return rv; +} From d19cd8fb115bcab444b10742a692d913253a3231 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 14:49:45 -0400 Subject: [PATCH 339/370] Fix test --- unittest/formats/test_dump_atom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/formats/test_dump_atom.cpp b/unittest/formats/test_dump_atom.cpp index 5161eece3e..669f4d38bd 100644 --- a/unittest/formats/test_dump_atom.cpp +++ b/unittest/formats/test_dump_atom.cpp @@ -135,7 +135,7 @@ TEST_F(DumpAtomTest, no_scale_run0) TEST_F(DumpAtomTest, no_buffer_no_scale_run0) { auto dump_file = "dump_no_buffer_no_scale_run0.melt"; - generate_dump(dump_file, "scale no", 0); + generate_dump(dump_file, "buffer no scale no", 0); ASSERT_FILE_EXISTS(dump_file); auto lines = read_lines(dump_file); From cf41ea6fafae8f9d69cd32429c433856f2c7b10f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 15:42:28 -0400 Subject: [PATCH 340/370] Update dump local and local/gz --- src/COMPRESS/dump_local_gz.cpp | 118 ++++++++-------- src/COMPRESS/dump_local_gz.h | 5 +- src/COMPRESS/dump_local_zstd.cpp | 33 ++++- unittest/formats/test_dump_local.cpp | 66 +++++++++ .../formats/test_dump_local_compressed.cpp | 133 +++++++++++++++++- 5 files changed, 285 insertions(+), 70 deletions(-) diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index e8065a848a..a0a39b51e0 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -11,24 +11,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "dump_local_gz.h" #include "domain.h" +#include "dump_local_gz.h" #include "error.h" #include "update.h" - #include - using namespace LAMMPS_NS; DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - gzFp = nullptr; - - compression_level = Z_BEST_COMPRESSION; - if (!compressed) error->all(FLERR,"Dump local/gz only writes compressed files"); } @@ -38,12 +32,8 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocalGZ::~DumpLocalGZ() { - if (gzFp) gzclose(gzFp); - gzFp = nullptr; - fp = nullptr; } - /* ---------------------------------------------------------------------- generic opening of a dump file ASCII or binary or gzipped @@ -93,17 +83,12 @@ void DumpLocalGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - std::string mode; - if (append_flag) { - mode = fmt::format("ab{}", compression_level); - } else { - mode = fmt::format("wb{}", compression_level); + try { + writer.open(filecurrent, append_flag); + } catch (FileWriterException &e) { + error->one(FLERR, e.what()); } - - gzFp = gzopen(filecurrent, mode.c_str()); - - if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); - } else gzFp = nullptr; + } // delete string with timestep replaced @@ -112,29 +97,34 @@ void DumpLocalGZ::openfile() void DumpLocalGZ::write_header(bigint ndump) { + std::string header; + if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - gzprintf(gzFp,"ITEM: UNITS\n%s\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) gzprintf(gzFp,"ITEM: TIME\n%.16g\n",compute_time()); - gzprintf(gzFp,"ITEM: TIMESTEP\n"); - gzprintf(gzFp,BIGINT_FORMAT "\n",update->ntimestep); - gzprintf(gzFp,"ITEM: NUMBER OF %s\n",label); - gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); - if (domain->triclinic) { - gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); - } else { - gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } - gzprintf(gzFp,"ITEM: %s %s\n",label,columns); + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: {} {}\n", label, columns); + + writer.write(header.c_str(), header.length()); } } @@ -143,19 +133,28 @@ void DumpLocalGZ::write_header(bigint ndump) void DumpLocalGZ::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - gzwrite(gzFp,mybuf,sizeof(char)*n); - + writer.write(mybuf, sizeof(char)*n); } else { - int i,j; + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; int m = 0; - for (i = 0; i < n; i++) { - for (j = 0; j < size_one; j++) { - if (vtype[j] == INT) - gzprintf(gzFp,vformat[j],static_cast (mybuf[m])); - else gzprintf(gzFp,vformat[j],mybuf[m]); + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (vtype[j] == Dump::INT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } + + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump local/gz output"); + } m++; } - gzprintf(gzFp,"\n"); + writer.write("\n", 1); } } } @@ -167,11 +166,11 @@ void DumpLocalGZ::write() DumpLocal::write(); if (filewriter) { if (multifile) { - gzclose(gzFp); - gzFp = nullptr; + writer.close(); } else { - if (flush_flag) - gzflush(gzFp,Z_SYNC_FLUSH); + if (flush_flag && writer.isopen()) { + writer.flush(); + } } } } @@ -182,14 +181,15 @@ int DumpLocalGZ::modify_param(int narg, char **arg) { int consumed = DumpLocal::modify_param(narg, arg); if (consumed == 0) { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - int min_level = Z_DEFAULT_COMPRESSION; - int max_level = Z_BEST_COMPRESSION; - compression_level = utils::inumeric(FLERR, arg[1], false, lmp); - if (compression_level < min_level || compression_level > max_level) - error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); - return 2; + try { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException &e) { + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/src/COMPRESS/dump_local_gz.h b/src/COMPRESS/dump_local_gz.h index b3f7c7dcf8..7feb6a8945 100644 --- a/src/COMPRESS/dump_local_gz.h +++ b/src/COMPRESS/dump_local_gz.h @@ -21,7 +21,7 @@ DumpStyle(local/gz,DumpLocalGZ) #define LMP_DUMP_LOCAL_GZ_H #include "dump_local.h" -#include +#include "gz_file_writer.h" namespace LAMMPS_NS { @@ -31,8 +31,7 @@ class DumpLocalGZ : public DumpLocal { virtual ~DumpLocalGZ(); protected: - int compression_level; - gzFile gzFp; // file pointer for the compressed output stream + GzFileWriter writer; virtual void openfile(); virtual void write_header(bigint); diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index d26555d282..a4303f3b25 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -17,15 +17,13 @@ #ifdef LAMMPS_ZSTD -#include "dump_local_zstd.h" #include "domain.h" +#include "dump_local_zstd.h" #include "error.h" #include "update.h" - #include - using namespace LAMMPS_NS; DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : @@ -42,7 +40,6 @@ DumpLocalZstd::~DumpLocalZstd() { } - /* ---------------------------------------------------------------------- generic opening of a dump file ASCII or binary or gzipped @@ -145,7 +142,31 @@ void DumpLocalZstd::write_header(bigint ndump) void DumpLocalZstd::write_data(int n, double *mybuf) { - writer.write(mybuf, sizeof(char)*n); + if (buffer_flag == 1) { + writer.write(mybuf, sizeof(char)*n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (vtype[j] == Dump::INT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } + + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump local/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } } /* ---------------------------------------------------------------------- */ @@ -184,7 +205,7 @@ int DumpLocalZstd::modify_param(int narg, char **arg) return 2; } } catch (FileWriterException &e) { - error->one(FLERR, e.what()); + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/unittest/formats/test_dump_local.cpp b/unittest/formats/test_dump_local.cpp index fb38ca08ad..b122d71849 100644 --- a/unittest/formats/test_dump_local.cpp +++ b/unittest/formats/test_dump_local.cpp @@ -93,6 +93,18 @@ TEST_F(DumpLocalTest, run0) delete_file(dump_file); } +TEST_F(DumpLocalTest, label_run0) +{ + auto dump_file = "dump_local_label_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "label ELEMENTS", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_THAT(lines[2], Eq("ITEM: NUMBER OF ELEMENTS")); + ASSERT_THAT(lines[8], Eq("ITEM: ELEMENTS index c_comp[1] ")); + delete_file(dump_file); +} + TEST_F(DumpLocalTest, format_line_run0) { auto dump_file = "dump_local_format_line_run0.melt"; @@ -170,6 +182,60 @@ TEST_F(DumpLocalTest, no_buffer_run0) delete_file(dump_file); } +TEST_F(DumpLocalTest, with_units_run0) +{ + auto dump_file = "dump_with_units_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "units yes", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 875); + + ASSERT_THAT(lines[0], Eq("ITEM: UNITS")); + ASSERT_THAT(lines[1], Eq("lj")); + + ASSERT_THAT(lines[2], Eq("ITEM: TIMESTEP")); + ASSERT_EQ(std::stoi(lines[3]), 0); + + ASSERT_THAT(lines[4], Eq("ITEM: NUMBER OF ENTRIES")); + ASSERT_EQ(std::stoi(lines[5]), 864); +} + +TEST_F(DumpLocalTest, with_time_run0) +{ + auto dump_file = "dump_with_time_run0.melt"; + generate_dump(dump_file, "index c_comp[1]", "time yes", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + ASSERT_EQ(lines.size(), 875); + + ASSERT_THAT(lines[0], Eq("ITEM: TIME")); + ASSERT_THAT(std::stof(lines[1]), 0.0); + + ASSERT_THAT(lines[2], Eq("ITEM: TIMESTEP")); + ASSERT_EQ(std::stoi(lines[3]), 0); + + ASSERT_THAT(lines[4], Eq("ITEM: NUMBER OF ENTRIES")); + ASSERT_EQ(std::stoi(lines[5]), 864); +} + +TEST_F(DumpLocalTest, triclinic_run0) +{ + auto dump_file = "dump_local_triclinic_run0.melt"; + enable_triclinic(); + generate_dump(dump_file, "index c_comp[1]", "", 0); + + ASSERT_FILE_EXISTS(dump_file); + auto lines = read_lines(dump_file); + + ASSERT_THAT(lines[4], Eq("ITEM: BOX BOUNDS xy xz yz pp pp pp")); + ASSERT_EQ(utils::split_words(lines[5]).size(), 3); + ASSERT_EQ(utils::split_words(lines[6]).size(), 3); + ASSERT_EQ(utils::split_words(lines[7]).size(), 3); + delete_file(dump_file); +} + int main(int argc, char **argv) { MPI_Init(&argc, &argv); diff --git a/unittest/formats/test_dump_local_compressed.cpp b/unittest/formats/test_dump_local_compressed.cpp index 95656071fc..cd217354af 100644 --- a/unittest/formats/test_dump_local_compressed.cpp +++ b/unittest/formats/test_dump_local_compressed.cpp @@ -69,6 +69,135 @@ TEST_F(DumpLocalCompressTest, compressed_run0) delete_file(converted_file_0); } +TEST_F(DumpLocalCompressTest, compressed_no_buffer_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "no_buffer_run*.melt.local"; + auto base_name_0 = "no_buffer_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "index c_comp[1]"; + + if(compression_style == "local/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", "buffer no checksum yes", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + +TEST_F(DumpLocalCompressTest, compressed_with_time_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "with_time_run*.melt.local"; + auto base_name_0 = "with_time_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "index c_comp[1]"; + + if(compression_style == "local/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes", "time yes checksum yes", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, fields, "time yes", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + +TEST_F(DumpLocalCompressTest, compressed_with_units_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "with_units_run*.melt.local"; + auto base_name_0 = "with_units_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "index c_comp[1]"; + + if(compression_style == "local/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes", "units yes checksum yes", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, fields, "units yes", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + +TEST_F(DumpLocalCompressTest, compressed_triclinic_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + enable_triclinic(); + + auto base_name = "triclinic_run*.melt.local"; + auto base_name_0 = "triclinic_run0.melt.local"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "index c_comp[1]"; + + if(compression_style == "local/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "", "checksum yes", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + TEST_F(DumpLocalCompressTest, compressed_multi_file_run1) { if (!COMPRESS_BINARY) GTEST_SKIP(); @@ -209,7 +338,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param) command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.local"), fields)); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 compression_level 12"); ); } @@ -224,7 +353,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param) command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.local"), fields)); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); ); } From eb3cddb028f475b3a3478dbba5abe358bfc4539a Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 15:46:18 -0400 Subject: [PATCH 341/370] Update docs to include format support in dump local variants --- doc/src/dump_modify.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index d072df5d4d..07f00c4030 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -308,9 +308,9 @@ performed with dump style *xtc*\ . ---------- -The *format* keyword can be used to change the default numeric format -output by the text-based dump styles: *atom*\ , *custom*\ , *cfg*\ , and -*xyz* styles, and their MPIIO variants. Only the *line* or *none* +The *format* keyword can be used to change the default numeric format output +by the text-based dump styles: *atom*\ , *local*\ , *custom*\ , *cfg*\ , and +*xyz* styles, and their MPIIO variants. Only the *line* or *none* options can be used with the *atom* and *xyz* styles. All the specified format strings are C-style formats, e.g. as used by From c17ee12989b95e2fc160032494d19380230879f3 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 15:57:17 -0400 Subject: [PATCH 342/370] Update dump xyz/gz --- src/COMPRESS/dump_xyz_gz.cpp | 57 +++++++------------ src/COMPRESS/dump_xyz_gz.h | 5 +- src/COMPRESS/dump_xyz_zstd.cpp | 3 +- unittest/formats/test_dump_xyz_compressed.cpp | 4 +- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index c63d354e80..5c90c48d0f 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -15,19 +15,13 @@ #include "error.h" #include "update.h" - #include - using namespace LAMMPS_NS; DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - gzFp = nullptr; - - compression_level = Z_BEST_COMPRESSION; - if (!compressed) error->all(FLERR,"Dump xyz/gz only writes compressed files"); } @@ -37,12 +31,8 @@ DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZGZ::~DumpXYZGZ() { - if (gzFp) gzclose(gzFp); - gzFp = nullptr; - fp = nullptr; } - /* ---------------------------------------------------------------------- generic opening of a dump file ASCII or binary or gzipped @@ -92,17 +82,12 @@ void DumpXYZGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - std::string mode; - if (append_flag) { - mode = fmt::format("ab{}", compression_level); - } else { - mode = fmt::format("wb{}", compression_level); + try { + writer.open(filecurrent, append_flag); + } catch (FileWriterException &e) { + error->one(FLERR, e.what()); } - - gzFp = gzopen(filecurrent, mode.c_str()); - - if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); - } else gzFp = nullptr; + } // delete string with timestep replaced @@ -112,8 +97,9 @@ void DumpXYZGZ::openfile() void DumpXYZGZ::write_header(bigint ndump) { if (me == 0) { - gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); - gzprintf(gzFp,"Atoms. Timestep: " BIGINT_FORMAT "\n",update->ntimestep); + std::string header = fmt::format("{}\n", ndump); + header += fmt::format("Atoms. Timestep: {}\n", update->ntimestep); + writer.write(header.c_str(), header.length()); } } @@ -121,7 +107,7 @@ void DumpXYZGZ::write_header(bigint ndump) void DumpXYZGZ::write_data(int n, double *mybuf) { - gzwrite(gzFp,mybuf,sizeof(char)*n); + writer.write(mybuf, n); } /* ---------------------------------------------------------------------- */ @@ -131,11 +117,11 @@ void DumpXYZGZ::write() DumpXYZ::write(); if (filewriter) { if (multifile) { - gzclose(gzFp); - gzFp = nullptr; + writer.close(); } else { - if (flush_flag) - gzflush(gzFp,Z_SYNC_FLUSH); + if (flush_flag && writer.isopen()) { + writer.flush(); + } } } } @@ -146,14 +132,15 @@ int DumpXYZGZ::modify_param(int narg, char **arg) { int consumed = DumpXYZ::modify_param(narg, arg); if (consumed == 0) { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - int min_level = Z_DEFAULT_COMPRESSION; - int max_level = Z_BEST_COMPRESSION; - compression_level = utils::inumeric(FLERR, arg[1], false, lmp); - if (compression_level < min_level || compression_level > max_level) - error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); - return 2; + try { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException &e) { + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/src/COMPRESS/dump_xyz_gz.h b/src/COMPRESS/dump_xyz_gz.h index 834db488a5..2fce0a3f5a 100644 --- a/src/COMPRESS/dump_xyz_gz.h +++ b/src/COMPRESS/dump_xyz_gz.h @@ -21,7 +21,7 @@ DumpStyle(xyz/gz,DumpXYZGZ) #define LMP_DUMP_XYZ_GZ_H #include "dump_xyz.h" -#include +#include "gz_file_writer.h" namespace LAMMPS_NS { @@ -31,8 +31,7 @@ class DumpXYZGZ : public DumpXYZ { virtual ~DumpXYZGZ(); protected: - int compression_level; - gzFile gzFp; // file pointer for the compressed output stream + GzFileWriter writer; virtual void openfile(); virtual void write_header(bigint); diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index 7c5b73d0ba..03edf561b1 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -19,7 +19,6 @@ #include "dump_xyz_zstd.h" #include "error.h" -#include "file_writer.h" #include "update.h" #include @@ -158,7 +157,7 @@ int DumpXYZZstd::modify_param(int narg, char **arg) return 2; } } catch (FileWriterException &e) { - error->one(FLERR, e.what()); + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/unittest/formats/test_dump_xyz_compressed.cpp b/unittest/formats/test_dump_xyz_compressed.cpp index dad7911b4c..b627cb5a99 100644 --- a/unittest/formats/test_dump_xyz_compressed.cpp +++ b/unittest/formats/test_dump_xyz_compressed.cpp @@ -195,7 +195,7 @@ TEST_F(DumpXYZCompressTest, compressed_modify_bad_param) command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.xyz"))); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 compression_level 12"); ); } @@ -208,7 +208,7 @@ TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param) command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.xyz"))); END_HIDE_OUTPUT(); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); ); } From 511f64fde4ab569d2ac9bde67c9e9c6d6aa7e3da Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 16:36:30 -0400 Subject: [PATCH 343/370] Update dump custom/gz --- src/COMPRESS/dump_atom_gz.cpp | 4 +- src/COMPRESS/dump_atom_zstd.cpp | 4 +- src/COMPRESS/dump_cfg_gz.cpp | 4 +- src/COMPRESS/dump_cfg_zstd.cpp | 4 +- src/COMPRESS/dump_custom_gz.cpp | 98 +++++++++---------- src/COMPRESS/dump_custom_gz.h | 5 +- src/COMPRESS/dump_custom_zstd.cpp | 7 +- src/COMPRESS/dump_local_gz.cpp | 5 +- src/COMPRESS/dump_local_zstd.cpp | 4 +- src/COMPRESS/dump_xyz_gz.cpp | 4 +- src/COMPRESS/dump_xyz_zstd.cpp | 4 +- .../formats/test_dump_custom_compressed.cpp | 33 ++++++- 12 files changed, 106 insertions(+), 70 deletions(-) diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 254e146800..b3b202e373 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -71,7 +71,9 @@ void DumpAtomGZ::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index dd744b5d49..f739a53322 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -79,7 +79,9 @@ void DumpAtomZstd::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 6bbf118789..23c0d82429 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -73,7 +73,9 @@ void DumpCFGGZ::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index 978e695d1a..5bc6ac86dc 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -81,7 +81,9 @@ void DumpCFGZstd::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index 4f03a4a232..5cecf22b5d 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -11,39 +11,28 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "dump_custom_gz.h" #include "domain.h" +#include "dump_custom_gz.h" #include "error.h" #include "update.h" - #include - using namespace LAMMPS_NS; DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { - gzFp = nullptr; - - compression_level = Z_BEST_COMPRESSION; - if (!compressed) error->all(FLERR,"Dump custom/gz only writes compressed files"); } - /* ---------------------------------------------------------------------- */ DumpCustomGZ::~DumpCustomGZ() { - if (gzFp) gzclose(gzFp); - gzFp = nullptr; - fp = nullptr; } - /* ---------------------------------------------------------------------- generic opening of a dump file ASCII or binary or gzipped @@ -82,7 +71,9 @@ void DumpCustomGZ::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; @@ -93,17 +84,12 @@ void DumpCustomGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - std::string mode; - if (append_flag) { - mode = fmt::format("ab{}", compression_level); - } else { - mode = fmt::format("wb{}", compression_level); + try { + writer.open(filecurrent, append_flag); + } catch (FileWriterException &e) { + error->one(FLERR, e.what()); } - - gzFp = gzopen(filecurrent, mode.c_str()); - - if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); - } else gzFp = nullptr; + } // delete string with timestep replaced @@ -112,29 +98,34 @@ void DumpCustomGZ::openfile() void DumpCustomGZ::write_header(bigint ndump) { + std::string header; + if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - gzprintf(gzFp,"ITEM: UNITS\n%s\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); } - if (time_flag) gzprintf(gzFp,"ITEM: TIME\n%.16g\n",compute_time()); - gzprintf(gzFp,"ITEM: TIMESTEP\n"); - gzprintf(gzFp,BIGINT_FORMAT "\n",update->ntimestep); - gzprintf(gzFp,"ITEM: NUMBER OF ATOMS\n"); - gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); - if (domain->triclinic == 0) { - gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); - gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); - } else { - gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } - gzprintf(gzFp,"ITEM: ATOMS %s\n",columns); + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: ATOMS {}\n", columns); + + writer.write(header.c_str(), header.length()); } } @@ -142,7 +133,7 @@ void DumpCustomGZ::write_header(bigint ndump) void DumpCustomGZ::write_data(int n, double *mybuf) { - gzwrite(gzFp,mybuf,sizeof(char)*n); + writer.write(mybuf, n); } /* ---------------------------------------------------------------------- */ @@ -152,11 +143,11 @@ void DumpCustomGZ::write() DumpCustom::write(); if (filewriter) { if (multifile) { - gzclose(gzFp); - gzFp = nullptr; + writer.close(); } else { - if (flush_flag) - gzflush(gzFp,Z_SYNC_FLUSH); + if (flush_flag && writer.isopen()) { + writer.flush(); + } } } } @@ -167,14 +158,15 @@ int DumpCustomGZ::modify_param(int narg, char **arg) { int consumed = DumpCustom::modify_param(narg, arg); if (consumed == 0) { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - int min_level = Z_DEFAULT_COMPRESSION; - int max_level = Z_BEST_COMPRESSION; - compression_level = utils::inumeric(FLERR, arg[1], false, lmp); - if (compression_level < min_level || compression_level > max_level) - error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); - return 2; + try { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException &e) { + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/src/COMPRESS/dump_custom_gz.h b/src/COMPRESS/dump_custom_gz.h index 184f3563f1..db30b944ec 100644 --- a/src/COMPRESS/dump_custom_gz.h +++ b/src/COMPRESS/dump_custom_gz.h @@ -21,7 +21,7 @@ DumpStyle(custom/gz,DumpCustomGZ) #define LMP_DUMP_CUSTOM_GZ_H #include "dump_custom.h" -#include +#include "gz_file_writer.h" namespace LAMMPS_NS { @@ -31,8 +31,7 @@ class DumpCustomGZ : public DumpCustom { virtual ~DumpCustomGZ(); protected: - int compression_level; - gzFile gzFp; // file pointer for the compressed output stream + GzFileWriter writer; virtual void openfile(); virtual void write_header(bigint); diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index 3aa3f874ea..bd248bd0fc 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -20,7 +20,6 @@ #include "domain.h" #include "dump_custom_zstd.h" #include "error.h" -#include "file_writer.h" #include "update.h" #include @@ -79,7 +78,9 @@ void DumpCustomZstd::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; @@ -184,7 +185,7 @@ int DumpCustomZstd::modify_param(int narg, char **arg) return 2; } } catch (FileWriterException &e) { - error->one(FLERR, e.what()); + error->one(FLERR, fmt::format("Illegal dump_modify command: {}", e.what())); } } return consumed; diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index a0a39b51e0..9b0ac0c344 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -27,7 +27,6 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Dump local/gz only writes compressed files"); } - /* ---------------------------------------------------------------------- */ DumpLocalGZ::~DumpLocalGZ() @@ -72,7 +71,9 @@ void DumpLocalGZ::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index a4303f3b25..05cd0bb1ae 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -78,7 +78,9 @@ void DumpLocalZstd::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index 5c90c48d0f..0697f19ce3 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -71,7 +71,9 @@ void DumpXYZGZ::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index 03edf561b1..cb75542337 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -78,7 +78,9 @@ void DumpXYZZstd::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + if (remove(nameslist[fileidx]) != 0) { + error->warning(FLERR, fmt::format("Could not delete {}", nameslist[fileidx])); + } delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/unittest/formats/test_dump_custom_compressed.cpp b/unittest/formats/test_dump_custom_compressed.cpp index fb70206590..5ad231d440 100644 --- a/unittest/formats/test_dump_custom_compressed.cpp +++ b/unittest/formats/test_dump_custom_compressed.cpp @@ -58,6 +58,35 @@ TEST_F(DumpCustomCompressTest, compressed_run1) delete_file(converted_file); } +TEST_F(DumpCustomCompressTest, compressed_with_time_run1) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "with_time_custom_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + + if(compression_style == "custom/zstd") { + generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes", "time yes checksum yes", 1); + } else { + generate_text_and_compressed_dump(text_file, compressed_file, fields, "time yes", 1); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file); + ASSERT_FILE_EXISTS(compressed_file); + + auto converted_file = convert_compressed_to_text(compressed_file); + + ASSERT_FILE_EXISTS(converted_file); + ASSERT_FILE_EQUAL(text_file, converted_file); + delete_file(text_file); + delete_file(compressed_file); + delete_file(converted_file); +} + TEST_F(DumpCustomCompressTest, compressed_triclinic_run1) { if (!COMPRESS_BINARY) GTEST_SKIP(); @@ -222,7 +251,7 @@ TEST_F(DumpCustomCompressTest, compressed_modify_bad_param) auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields)); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 compression_level 12"); ); } @@ -234,7 +263,7 @@ TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param) auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"), fields)); - TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*", + TEST_FAILURE(".*ERROR on proc 0: Illegal dump_modify command: Compression level must in the range of.*", command("dump_modify id1 pad 3 compression_level 12"); ); } From 234c75550722fa48ceff16456696e71628567124 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 17:08:57 -0400 Subject: [PATCH 344/370] Add missing types in dump local --- src/COMPRESS/dump_local_gz.cpp | 4 ++++ src/COMPRESS/dump_local_zstd.cpp | 4 ++++ src/dump_local.cpp | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 9b0ac0c344..7ffb8d80ff 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -144,6 +144,10 @@ void DumpLocalGZ::write_data(int n, double *mybuf) int written = 0; if (vtype[j] == Dump::INT) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else if (vtype[j] == Dump::DOUBLE) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } else if (vtype[j] == Dump::BIGINT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); } else { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index 05cd0bb1ae..4d7fe9361b 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -155,6 +155,10 @@ void DumpLocalZstd::write_data(int n, double *mybuf) int written = 0; if (vtype[j] == Dump::INT) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else if (vtype[j] == Dump::DOUBLE) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } else if (vtype[j] == Dump::BIGINT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); } else { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index dac8066236..0f8d139f66 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -179,6 +179,8 @@ void DumpLocal::init_style() vformat[i] = utils::strdup(std::string(format_int_user) + " "); else if (vtype[i] == Dump::DOUBLE && format_float_user) vformat[i] = utils::strdup(std::string(format_float_user) + " "); + else if (vtype[i] == Dump::BIGINT && format_bigint_user) + vformat[i] = utils::strdup(std::string(format_bigint_user) + " "); else vformat[i] = utils::strdup(word + " "); ++i; } @@ -375,6 +377,10 @@ int DumpLocal::convert_string(int n, double *mybuf) for (j = 0; j < size_one; j++) { if (vtype[j] == Dump::INT) offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) + offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); + else if (vtype[j] == Dump::BIGINT) + offset += sprintf(&sbuf[offset],vformat[j],static_cast (mybuf[m])); else offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); m++; @@ -409,6 +415,8 @@ void DumpLocal::write_lines(int n, double *mybuf) for (i = 0; i < n; i++) { for (j = 0; j < size_one; j++) { if (vtype[j] == Dump::INT) fprintf(fp,vformat[j],static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) fprintf(fp,vformat[j],mybuf[m]); + else if (vtype[j] == Dump::BIGINT) fprintf(fp,vformat[j],static_cast(mybuf[m])); else fprintf(fp,vformat[j],mybuf[m]); m++; } From 242881af55578f6ca137865241415d3ba45a787b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 17:45:45 -0400 Subject: [PATCH 345/370] Make dump custom/gz, custom/zstd compatible to 'buffer no' option --- src/COMPRESS/dump_custom_gz.cpp | 30 ++++++++++++++++++- src/COMPRESS/dump_custom_zstd.cpp | 30 ++++++++++++++++++- .../formats/test_dump_custom_compressed.cpp | 29 ++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index 5cecf22b5d..9a3fc39d0a 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -133,7 +133,35 @@ void DumpCustomGZ::write_header(bigint ndump) void DumpCustomGZ::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag == 1) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < nfield; j++) { + int written = 0; + if (vtype[j] == Dump::INT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else if (vtype[j] == Dump::DOUBLE) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } else if (vtype[j] == Dump::STRING) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + } else if (vtype[j] == Dump::BIGINT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump custom/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } } /* ---------------------------------------------------------------------- */ diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index bd248bd0fc..b3f0971bf5 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -146,7 +146,35 @@ void DumpCustomZstd::write_header(bigint ndump) void DumpCustomZstd::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag == 1) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < nfield; j++) { + int written = 0; + if (vtype[j] == Dump::INT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } else if (vtype[j] == Dump::DOUBLE) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + } else if (vtype[j] == Dump::STRING) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + } else if (vtype[j] == Dump::BIGINT) { + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump custom/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } } /* ---------------------------------------------------------------------- */ diff --git a/unittest/formats/test_dump_custom_compressed.cpp b/unittest/formats/test_dump_custom_compressed.cpp index 5ad231d440..cb45c1b837 100644 --- a/unittest/formats/test_dump_custom_compressed.cpp +++ b/unittest/formats/test_dump_custom_compressed.cpp @@ -87,6 +87,35 @@ TEST_F(DumpCustomCompressTest, compressed_with_time_run1) delete_file(converted_file); } +TEST_F(DumpCustomCompressTest, compressed_no_buffer_run1) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "no_buffer_custom_run1.melt"; + auto text_file = text_dump_filename(base_name); + auto compressed_file = compressed_dump_filename(base_name); + auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz"; + + if(compression_style == "custom/zstd") { + generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no", "buffer no checksum yes", 1); + } else { + generate_text_and_compressed_dump(text_file, compressed_file, fields, "buffer no", 1); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file); + ASSERT_FILE_EXISTS(compressed_file); + + auto converted_file = convert_compressed_to_text(compressed_file); + + ASSERT_FILE_EXISTS(converted_file); + ASSERT_FILE_EQUAL(text_file, converted_file); + delete_file(text_file); + delete_file(compressed_file); + delete_file(converted_file); +} + TEST_F(DumpCustomCompressTest, compressed_triclinic_run1) { if (!COMPRESS_BINARY) GTEST_SKIP(); From e5ee210f58a380b605a94f2539a67f34ecfe4807 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 9 Apr 2021 18:02:55 -0400 Subject: [PATCH 346/370] Make dump atom/gz, atom/zstd compatible to 'buffer no' option --- src/COMPRESS/dump_atom_gz.cpp | 28 ++++++++++++++++++- src/COMPRESS/dump_atom_zstd.cpp | 28 ++++++++++++++++++- .../formats/test_dump_atom_compressed.cpp | 28 +++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index b3b202e373..7b54fd8e62 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -135,7 +135,33 @@ void DumpAtomGZ::write_header(bigint ndump) void DumpAtomGZ::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag == 1) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + int written = 0; + if (image_flag == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, format, + static_cast (mybuf[m]), static_cast (mybuf[m+1]), + mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast (mybuf[m+5]), + static_cast (mybuf[m+6]), static_cast (mybuf[m+7])); + } else { + written = snprintf(vbuffer, VBUFFER_SIZE, format, + static_cast (mybuf[m]), static_cast (mybuf[m+1]), + mybuf[m+2],mybuf[m+3],mybuf[m+4]); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump atom/gz output"); + } + + m += size_one; + } + } } /* ---------------------------------------------------------------------- */ diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index f739a53322..b53ebb2269 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -143,7 +143,33 @@ void DumpAtomZstd::write_header(bigint ndump) void DumpAtomZstd::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag == 1) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + int written = 0; + if (image_flag == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, format, + static_cast (mybuf[m]), static_cast (mybuf[m+1]), + mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast (mybuf[m+5]), + static_cast (mybuf[m+6]), static_cast (mybuf[m+7])); + } else { + written = snprintf(vbuffer, VBUFFER_SIZE, format, + static_cast (mybuf[m]), static_cast (mybuf[m+1]), + mybuf[m+2],mybuf[m+3],mybuf[m+4]); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump atom/gz output"); + } + + m += size_one; + } + } } /* ---------------------------------------------------------------------- */ diff --git a/unittest/formats/test_dump_atom_compressed.cpp b/unittest/formats/test_dump_atom_compressed.cpp index da68acee2a..aeb747004e 100644 --- a/unittest/formats/test_dump_atom_compressed.cpp +++ b/unittest/formats/test_dump_atom_compressed.cpp @@ -61,6 +61,34 @@ TEST_F(DumpAtomCompressTest, compressed_run0) delete_file(converted_file); } +TEST_F(DumpAtomCompressTest, compressed_no_buffer_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto text_file = text_dump_filename("no_buffer_run0.melt"); + auto compressed_file = compressed_dump_filename("no_buffer_run0.melt"); + + if(compression_style == "atom/zstd") { + generate_text_and_compressed_dump(text_file, compressed_file, "", "", "buffer no", "buffer no checksum yes", 0); + } else { + generate_text_and_compressed_dump(text_file, compressed_file, "", "buffer no", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file); + ASSERT_FILE_EXISTS(compressed_file); + + auto converted_file = convert_compressed_to_text(compressed_file); + + ASSERT_THAT(converted_file, Eq(converted_dump_filename("no_buffer_run0.melt"))); + ASSERT_FILE_EXISTS(converted_file); + ASSERT_FILE_EQUAL(text_file, converted_file); + delete_file(text_file); + delete_file(compressed_file); + delete_file(converted_file); +} + TEST_F(DumpAtomCompressTest, compressed_multi_file_run1) { if (!COMPRESS_BINARY) GTEST_SKIP(); From a69c5a5cae0f745adcb09d638de1cf1ceacb575c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 20:19:04 -0400 Subject: [PATCH 347/370] fix bugs in shell putenv and getenv style variables. add more unit tests. --- src/input.cpp | 4 ++-- src/variable.cpp | 3 +-- unittest/commands/test_simple_commands.cpp | 13 +++++++++---- unittest/commands/test_variables.cpp | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index f96cf8c75c..3f3c7cb2e6 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1250,9 +1250,9 @@ void Input::shell() for (int i = 1; i < narg; i++) { rv = 0; #ifdef _WIN32 - if (arg[i]) rv = _putenv(arg[i]); + if (arg[i]) rv = _putenv(utils::strdup(arg[i])); #else - if (arg[i]) rv = putenv(arg[i]); + if (arg[i]) rv = putenv(utils::strdup(arg[i])); #endif rv = (rv < 0) ? errno : 0; MPI_Reduce(&rv,&err,1,MPI_INT,MPI_MAX,0,world); diff --git a/src/variable.cpp b/src/variable.cpp index 1a4feb3573..437efaf540 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -341,8 +341,7 @@ void Variable::set(int narg, char **arg) which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; - copy(1,&arg[2],data[nvar]); - data[nvar][1] = utils::strdup("(undefined)"); + data[nvar][0] = utils::strdup(arg[2]); // SCALARFILE for strings or numbers // which = 1st value diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 9bd6e74c9b..6ee783a8e1 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -20,8 +20,8 @@ #include "output.h" #include "update.h" #include "utils.h" +#include "variable.h" -#include "fmt/format.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "../testing/core.h" @@ -398,6 +398,7 @@ TEST_F(SimpleCommandsTest, Shell) { BEGIN_HIDE_OUTPUT(); command("shell putenv TEST_VARIABLE=simpletest"); + command("variable simple1 getenv TEST_VARIABLE"); END_HIDE_OUTPUT(); char *test_var = getenv("TEST_VARIABLE"); @@ -405,18 +406,22 @@ TEST_F(SimpleCommandsTest, Shell) ASSERT_THAT(test_var, StrEq("simpletest")); BEGIN_HIDE_OUTPUT(); - command("shell putenv TEST_VARIABLE=simpletest"); - command("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2"); + command("shell putenv TEST_VARIABLE=simpletest2"); + command("shell putenv TEST_VARIABLE2=simpletest OTHER_VARIABLE=2"); END_HIDE_OUTPUT(); char *test_var2 = getenv("TEST_VARIABLE2"); char *other_var = getenv("OTHER_VARIABLE"); ASSERT_NE(test_var2, nullptr); - ASSERT_THAT(test_var2, StrEq("simpletest2")); + ASSERT_THAT(test_var2, StrEq("simpletest")); ASSERT_NE(other_var, nullptr); ASSERT_THAT(other_var, StrEq("2")); + + test_var = getenv("TEST_VARIABLE"); + ASSERT_NE(test_var, nullptr); + ASSERT_THAT(test_var, StrEq("simpletest2")); } TEST_F(SimpleCommandsTest, CiteMe) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 97f874a856..f31959c3ff 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -122,6 +122,8 @@ TEST_F(VariableTest, CreateDelete) file_vars(); ASSERT_EQ(variable->nvar, 1); BEGIN_HIDE_OUTPUT(); + command("shell putenv TEST_VARIABLE=simpletest2"); + command("shell putenv TEST_VARIABLE2=simpletest OTHER_VARIABLE=2"); command("variable one index 1 2 3 4"); command("variable two equal 1"); command("variable two equal 2"); @@ -133,8 +135,8 @@ TEST_F(VariableTest, CreateDelete) command("variable five2 loop 10 200 pad"); command("variable six world one"); command("variable seven format two \"%5.2f\""); - command("variable eight getenv PWD"); - command("variable eight getenv XXXXX"); + command("variable eight getenv TEST_VARIABLE2"); + command("variable eight getenv XXX"); command("variable nine file test_variable.file"); command("variable ten internal 1.0"); command("variable ten internal 10.0"); @@ -167,6 +169,14 @@ TEST_F(VariableTest, CreateDelete) unlink("MYFILE"); ASSERT_THAT(variable->retrieve("file"), StrEq("0")); + BEGIN_HIDE_OUTPUT(); + command("variable seven delete"); + command("variable seven getenv TEST_VARIABLE"); + command("variable eight getenv OTHER_VARIABLE"); + END_HIDE_OUTPUT(); + ASSERT_THAT(variable->retrieve("seven"), StrEq("simpletest2")); + ASSERT_THAT(variable->retrieve("eight"), StrEq("2")); + ASSERT_EQ(variable->equalstyle(variable->find("one")), 0); ASSERT_EQ(variable->equalstyle(variable->find("two")), 1); ASSERT_EQ(variable->equalstyle(variable->find("ten")), 1); From c16e4f241fbc00ed6dbf30ca7d74cce360db068f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 20:37:01 -0400 Subject: [PATCH 348/370] replace "leaky" call to putenv() with setenv() on non-windows platforms --- src/input.cpp | 11 ++++++++++- unittest/commands/test_simple_commands.cpp | 20 +++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 3f3c7cb2e6..9079cdd76c 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1252,7 +1252,16 @@ void Input::shell() #ifdef _WIN32 if (arg[i]) rv = _putenv(utils::strdup(arg[i])); #else - if (arg[i]) rv = putenv(utils::strdup(arg[i])); + if (arg[i]) { + std::string vardef(arg[i]); + auto found = vardef.find_first_of("="); + if (found == std::string::npos) { + rv = setenv(vardef.c_str(),"",1); + } else { + rv = setenv(vardef.substr(0,found).c_str(), + vardef.substr(found+1).c_str(),1); + } + } #endif rv = (rv < 0) ? errno : 0; MPI_Reduce(&rv,&err,1,MPI_INT,MPI_MAX,0,world); diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 6ee783a8e1..e8cebe98e2 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -398,30 +398,28 @@ TEST_F(SimpleCommandsTest, Shell) { BEGIN_HIDE_OUTPUT(); command("shell putenv TEST_VARIABLE=simpletest"); - command("variable simple1 getenv TEST_VARIABLE"); END_HIDE_OUTPUT(); - char *test_var = getenv("TEST_VARIABLE"); + const char *test_var = getenv("TEST_VARIABLE"); ASSERT_NE(test_var, nullptr); ASSERT_THAT(test_var, StrEq("simpletest")); BEGIN_HIDE_OUTPUT(); - command("shell putenv TEST_VARIABLE=simpletest2"); + command("shell putenv TEST_VARIABLE"); command("shell putenv TEST_VARIABLE2=simpletest OTHER_VARIABLE=2"); END_HIDE_OUTPUT(); - char *test_var2 = getenv("TEST_VARIABLE2"); - char *other_var = getenv("OTHER_VARIABLE"); + test_var = getenv("TEST_VARIABLE2"); + ASSERT_NE(test_var, nullptr); + ASSERT_THAT(test_var, StrEq("simpletest")); - ASSERT_NE(test_var2, nullptr); - ASSERT_THAT(test_var2, StrEq("simpletest")); - - ASSERT_NE(other_var, nullptr); - ASSERT_THAT(other_var, StrEq("2")); + test_var = getenv("OTHER_VARIABLE"); + ASSERT_NE(test_var, nullptr); + ASSERT_THAT(test_var, StrEq("2")); test_var = getenv("TEST_VARIABLE"); ASSERT_NE(test_var, nullptr); - ASSERT_THAT(test_var, StrEq("simpletest2")); + ASSERT_THAT(test_var, StrEq("")); } TEST_F(SimpleCommandsTest, CiteMe) From 552d13b9e4141ec90899325234b41ef7bf896218 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 21:43:02 -0400 Subject: [PATCH 349/370] print message only on MPI rank 0 --- src/finish.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finish.cpp b/src/finish.cpp index 810155f1b0..28596e3a72 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -401,7 +401,7 @@ void Finish::end(int flag) } #endif - if (lmp->kokkos && lmp->kokkos->ngpus > 0) + if ((comm->me == 0) && lmp->kokkos && (lmp->kokkos->ngpus > 0)) if (const char* env_clb = getenv("CUDA_LAUNCH_BLOCKING")) if (!(strcmp(env_clb,"1") == 0)) { error->warning(FLERR,"Timing breakdown may not be accurate " From 7a2910f05feef1bb460d48f7beb3c11573eb698e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 21:44:34 -0400 Subject: [PATCH 350/370] must have num == 2 for getenv style variables --- src/variable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/variable.cpp b/src/variable.cpp index 437efaf540..5c22981255 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -337,11 +337,12 @@ void Variable::set(int narg, char **arg) } if (nvar == maxvar) grow(); style[nvar] = GETENV; - num[nvar] = 1; + num[nvar] = 2; which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; data[nvar][0] = utils::strdup(arg[2]); + data[nvar][1] = utils::strdup("(undefined)"); // SCALARFILE for strings or numbers // which = 1st value From 96f59a58d3738104bae82dcc91868aeb042d09eb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 21:53:18 -0400 Subject: [PATCH 351/370] be a little more paranoid about avoiding memory leakage --- src/variable.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 5c22981255..d903490219 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1252,7 +1252,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); expect = OP; - char *contents; + char *contents = nullptr; i = find_matching_paren(str,i,contents,ivar); i++; @@ -2068,7 +2068,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) // ---------------- if (str[i] == '(') { - char *contents; + char *contents = nullptr; i = find_matching_paren(str,i,contents,ivar); i++; @@ -3286,6 +3286,7 @@ int Variable::find_matching_paren(char *str, int i, char *&contents, int ivar) int istop = i; int n = istop - istart - 1; + delete[] contents; contents = new char[n+1]; strncpy(contents,&str[istart+1],n); contents[n] = '\0'; @@ -4827,7 +4828,7 @@ double Variable::evaluate_boolean(char *str) error->all(FLERR,"Invalid Boolean syntax in if command"); expect = OP; - char *contents; + char *contents = nullptr; i = find_matching_paren(str,i,contents,-1); i++; From 0496fd27dbb8cace53090f3e4fb81abdad489816 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 22:49:25 -0400 Subject: [PATCH 352/370] reorder include files --- src/pair_hybrid.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index c12ec67351..48ba1ccff7 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -14,20 +14,19 @@ #include "pair_hybrid.h" -#include -#include #include "atom.h" -#include "force.h" -#include "pair.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "update.h" #include "comm.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" #include "respa.h" - #include "suffix.h" +#include "update.h" + +#include using namespace LAMMPS_NS; From 0d325f22219239a52d3b2b7ca8344749814b51bc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 22:50:16 -0400 Subject: [PATCH 353/370] error out when scale factor variables do not exist --- src/pair_hybrid_scaled.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 62b94d9ba9..7a30c9a3ee 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -71,6 +71,9 @@ void PairHybridScaled::compute(int eflag, int vflag) 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,fmt::format("Variable '{}' not found when updating " + "scale factors",scalevars[i])); vals[i] = input->variable->compute_equal(j); } for (i = 0; i < nstyles; ++i) { From ec6e2d35cbd46fe5cdbcb3bacfebc0bd6c06dbf6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 9 Apr 2021 22:50:51 -0400 Subject: [PATCH 354/370] complete update of the hybrid documentation for hybrid/scaled --- doc/src/pair_hybrid.rst | 157 +++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 74 deletions(-) diff --git a/doc/src/pair_hybrid.rst b/doc/src/pair_hybrid.rst index c851423029..9fdba318d9 100644 --- a/doc/src/pair_hybrid.rst +++ b/doc/src/pair_hybrid.rst @@ -59,35 +59,40 @@ be assigned to each pair of atom types. The assignment of pair styles to type pairs is made via the :doc:`pair_coeff ` command. The *hybrid/scaled* style differs from the *hybrid/overlay* style by requiring a factor for each pair style that is used to scale all -forces and energies computed by the pair style. +forces, energies and stresses computed by each sub-style. Because of +the additional complexity, the *hybrid/scaled* style will have more +overhead and thus will be a bit slower than *hybrid/overlay*. Here are two examples of hybrid simulations. The *hybrid* style could -be used for a simulation of a metal droplet on a LJ surface. The -metal atoms interact with each other via an *eam* potential, the -surface atoms interact with each other via a *lj/cut* potential, and -the metal/surface interaction is also computed via a *lj/cut* -potential. The *hybrid/overlay* style could be used as in the second -example above, where multiple potentials are superposed in an additive -fashion to compute the interaction between atoms. In this example, -using *lj/cut* and *coul/long* together gives the same result as if -the *lj/cut/coul/long* potential were used by itself. In this case, -it would be more efficient to use the single combined potential, but -in general any combination of pair potentials can be used together in -to produce an interaction that is not encoded in any single pair_style -file, e.g. adding Coulombic forces between granular particles. -The *hybrid/scaled* style enables more complex combinations of pair -styles than a simple sum as *hybrid/overlay* does. Furthermore, since -the scale factors can be variables, they can change during a simulation -which would allow to smoothly switch between two different pair styles -or two different parameter sets. +be used for a simulation of a metal droplet on a LJ surface. The metal +atoms interact with each other via an *eam* potential, the surface atoms +interact with each other via a *lj/cut* potential, and the metal/surface +interaction is also computed via a *lj/cut* potential. The +*hybrid/overlay* style could be used as in the second example above, +where multiple potentials are superposed in an additive fashion to +compute the interaction between atoms. In this example, using *lj/cut* +and *coul/long* together gives the same result as if the +*lj/cut/coul/long* potential were used by itself. In this case, it +would be more efficient to use the single combined potential, but in +general any combination of pair potentials can be used together in to +produce an interaction that is not encoded in any single pair_style +file, e.g. adding Coulombic forces between granular particles. The +*hybrid/scaled* style enables more complex combinations of pair styles +than a simple sum as *hybrid/overlay* does; there may be fractional +contributions from sub-styles or contributions may be subtracted with a +negative scale factor. Furthermore, since the scale factors can be +variables that may change during a simulation, which would allow, for +instance, to smoothly switch between two different pair styles or two +different parameter sets. All pair styles that will be used are listed as "sub-styles" following the *hybrid* or *hybrid/overlay* keyword, in any order. In case of the -*hybrid/scaled* pair style each sub-style is prefixed with its scale -factor. The scale factor may be an equal style (or equivalent) -variable. Each sub-style's name is followed by its usual arguments, as -illustrated in the example above. See the doc pages of individual pair -styles for a listing and explanation of the appropriate arguments. +*hybrid/scaled* pair style, each sub-style is prefixed with a scale +factor. The scale factor is either a floating point number or an equal +style (or equivalent) variable. Each sub-style's name is followed by its +usual arguments, as illustrated in the examples above. See the doc +pages of individual pair styles for a listing and explanation of the +appropriate arguments. Note that an individual pair style can be used multiple times as a sub-style. For efficiency this should only be done if your model @@ -164,7 +169,7 @@ one sub-style. Just as with a simulation using a single pair style, if you specify the same atom type pair in a second pair_coeff command, the previous assignment will be overwritten. -For the *hybrid/overlay* and *hybrid/scaled* style, each atom type pair +For the *hybrid/overlay* and *hybrid/scaled* styles, each atom type pair I,J can be assigned to one or more sub-styles. If you specify the same atom type pair in a second pair_coeff command with a new sub-style, then the second sub-style is added to the list of potentials that will be @@ -187,15 +192,15 @@ same: Coefficients must be defined for each pair of atoms types via the :doc:`pair_coeff ` command as described above, or in the -data file or restart files read by the :doc:`read_data ` or -:doc:`read_restart ` commands, or by mixing as described -below. +data file read by the :doc:`read_data ` commands, or by +mixing as described below. For all of the *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles, every atom type pair I,J (where I <= J) must be assigned to at least one sub-style via the :doc:`pair_coeff ` command as in the examples above, or in the data file read by the :doc:`read_data -`, or by mixing as described below. +`, or by mixing as described below. Also all sub-styles +must be used at least once in a :doc:`pair_coeff ` command. If you want there to be no interactions between a particular pair of atom types, you have 3 choices. You can assign the type pair to some @@ -208,22 +213,22 @@ input script: .. code-block:: LAMMPS - pair_coeff 2 3 none + pair_coeff 2 3 none or this form in the "Pair Coeffs" section of the data file: .. parsed-literal:: - 3 none + 3 none If an assignment to *none* is made in a simulation with the -*hybrid/overlay* pair style, it wipes out all previous assignments of -that atom type pair to sub-styles. +*hybrid/overlay* or *hybrid/scaled* pair style, it wipes out all +previous assignments of that pair of atom types to sub-styles. Note that you may need to use an :doc:`atom_style ` hybrid command in your input script, if atoms in the simulation will need attributes from several atom styles, due to using multiple pair -potentials. +styles with different requirements. ---------- @@ -232,8 +237,9 @@ for applying weightings that change the strength of pairwise interactions between pairs of atoms that are also 1-2, 1-3, and 1-4 neighbors in the molecular bond topology, as normally set by the :doc:`special_bonds ` command. Different weights can be -assigned to different pair hybrid sub-styles via the :doc:`pair_modify special ` command. This allows multiple force fields -to be used in a model of a hybrid system, however, there is no consistent +assigned to different pair hybrid sub-styles via the :doc:`pair_modify +special ` command. This allows multiple force fields to be +used in a model of a hybrid system, however, there is no consistent approach to determine parameters automatically for the interactions between the two force fields, this is only recommended when particles described by the different force fields do not mix. @@ -307,28 +313,27 @@ Pair_style hybrid allows interactions between type pairs 2-2, 1-2, could even add a second interaction for 1-1 to be computed by another pair style, assuming pair_style hybrid/overlay is used. -But you should not, as a general rule, attempt to exclude the -many-body interactions for some subset of the type pairs within the -set of 1,3,4 interactions, e.g. exclude 1-1 or 1-3 interactions. That -is not conceptually well-defined for many-body interactions, since the +But you should not, as a general rule, attempt to exclude the many-body +interactions for some subset of the type pairs within the set of 1,3,4 +interactions, e.g. exclude 1-1 or 1-3 interactions. That is not +conceptually well-defined for many-body interactions, since the potential will typically calculate energies and foces for small groups of atoms, e.g. 3 or 4 atoms, using the neighbor lists of the atoms to -find the additional atoms in the group. It is typically non-physical -to think of excluding an interaction between a particular pair of -atoms when the potential computes 3-body or 4-body interactions. +find the additional atoms in the group. However, you can still use the pair_coeff none setting or the :doc:`neigh_modify exclude ` command to exclude certain type pairs from the neighbor list that will be passed to a many-body sub-style. This will alter the calculations made by a many-body -potential, since it builds its list of 3-body, 4-body, etc -interactions from the pair list. You will need to think carefully as -to whether it produces a physically meaningful result for your model. +potential beyond the specific pairs, since it builds its list of 3-body, +4-body, etc interactions from the pair lists. You will need to think +**carefully** as to whether excluding such pairs produces a physically +meaningful result for your model. For example, imagine you have two atom types in your model, type 1 for atoms in one surface, and type 2 for atoms in the other, and you wish to use a Tersoff potential to compute interactions within each -surface, but not between surfaces. Then either of these two command +surface, but not between the surfaces. Then either of these two command sequences would implement that model: .. code-block:: LAMMPS @@ -345,9 +350,9 @@ Either way, only neighbor lists with 1-1 or 2-2 interactions would be passed to the Tersoff potential, which means it would compute no 3-body interactions containing both type 1 and 2 atoms. -Here is another example, using hybrid/overlay, to use 2 many-body -potentials together, in an overlapping manner. Imagine you have CNT -(C atoms) on a Si surface. You want to use Tersoff for Si/Si and Si/C +Here is another example to use 2 many-body potentials together in an +overlapping manner using hybrid/overlay. Imagine you have CNT (C atoms) +on a Si surface. You want to use Tersoff for Si/Si and Si/C interactions, and AIREBO for C/C interactions. Si atoms are type 1; C atoms are type 2. Something like this will work: @@ -358,9 +363,9 @@ atoms are type 2. Something like this will work: pair_coeff * * airebo CH.airebo NULL C Note that to prevent the Tersoff potential from computing C/C -interactions, you would need to modify the SiC.tersoff file to turn -off C/C interaction, i.e. by setting the appropriate coefficients to -0.0. +interactions, you would need to **modify** the SiC.tersoff potential +file to turn off C/C interaction, i.e. by setting the appropriate +coefficients to 0.0. ---------- @@ -368,18 +373,19 @@ Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are functionally the same as the corresponding style without the suffix. They have been optimized to run faster, depending on your available hardware, as discussed on the :doc:`Speed packages ` doc -page. +page. Pair style *hybrid/scaled* does (currently) not support the +*gpu*, *omp*, *kk*, or *intel* suffix. -Since the *hybrid* and *hybrid/overlay* styles delegate computation to -the individual sub-styles, the suffix versions of the *hybrid* and -*hybrid/overlay* styles are used to propagate the corresponding suffix -to all sub-styles, if those versions exist. Otherwise the -non-accelerated version will be used. +Since the *hybrid*, *hybrid/overlay*, *hybrid/scaled* styles delegate +computation to the individual sub-styles, the suffix versions of the +*hybrid* and *hybrid/overlay* styles are used to propagate the +corresponding suffix to all sub-styles, if those versions +exist. Otherwise the non-accelerated version will be used. -The individual accelerated sub-styles are part of the GPU, USER-OMP -and OPT packages, respectively. They are only enabled if LAMMPS was -built with those packages. See the :doc:`Build package ` -doc page for more info. +The individual accelerated sub-styles are part of the GPU, KOKKOS, +USER-INTEL, USER-OMP, and OPT packages, respectively. They are only +enabled if LAMMPS was built with those packages. See the :doc:`Build +package ` doc page for more info. You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the :doc:`-suffix command-line switch ` when you invoke LAMMPS, or you can use the @@ -397,17 +403,17 @@ Any pair potential settings made via the :doc:`pair_modify ` command are passed along to all sub-styles of the hybrid potential. -For atom type pairs I,J and I != J, if the sub-style assigned to I,I -and J,J is the same, and if the sub-style allows for mixing, then the +For atom type pairs I,J and I != J, if the sub-style assigned to I,I and +J,J is the same, and if the sub-style allows for mixing, then the coefficients for I,J can be mixed. This means you do not have to specify a pair_coeff command for I,J since the I,J type pair will be -assigned automatically to the sub-style defined for both I,I and J,J -and its coefficients generated by the mixing rule used by that -sub-style. For the *hybrid/overlay* style, there is an additional -requirement that both the I,I and J,J pairs are assigned to a single -sub-style. See the "pair_modify" command for details of mixing rules. -See the See the doc page for the sub-style to see if allows for -mixing. +assigned automatically to the sub-style defined for both I,I and J,J and +its coefficients generated by the mixing rule used by that sub-style. +For the *hybrid/overlay* and *hybrid/scaled* style, there is an +additional requirement that both the I,I and J,J pairs are assigned to a +single sub-style. See the :doc:`pair_modify ` command for +details of mixing rules. See the See the doc page for the sub-style to +see if allows for mixing. The hybrid pair styles supports the :doc:`pair_modify ` shift, table, and tail options for an I,J pair interaction, if the @@ -418,7 +424,10 @@ settings are written to :doc:`binary restart files `, so a :doc:`pair_style ` command does not need to specified in an input script that reads a restart file. However, the coefficient information is not stored in the restart file. Thus, pair_coeff -commands need to be re-specified in the restart input script. +commands need to be re-specified in the restart input script. For pair +style *hybrid/scaled* also the names of any variables used as scale +factors are restored, but not the variables themselves, so those may +need to be redefined when continuing from a restart. These pair styles support the use of the *inner*\ , *middle*\ , and *outer* keywords of the :doc:`run_style respa ` command, if @@ -435,7 +444,7 @@ short-range Coulombic cutoff used by each of these long pair styles is the same or else LAMMPS will generate an error. Pair style *hybrid/scaled* currently only works for non-accelerated -pair styles. +pair styles and pair styles from the OPT package. Related commands """""""""""""""" From d88cf587b2743e1b94436acc293a14ad5def69ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Apr 2021 00:25:00 -0400 Subject: [PATCH 355/370] add pair style coul/cut/global and fix restart/data bugs in coul/cut --- doc/src/Commands_pair.rst | 1 + doc/src/pair_coul.rst | 14 ++- doc/src/pair_style.rst | 1 + src/pair_coul_cut.cpp | 61 ++++++++-- src/pair_coul_cut.h | 6 +- src/pair_coul_cut_global.cpp | 44 +++++++ src/pair_coul_cut_global.h | 55 +++++++++ unittest/force-styles/test_pair_style.cpp | 1 - .../force-styles/tests/mol-pair-coul_cut.yaml | 114 +++++++++--------- .../tests/mol-pair-coul_cut_global.yaml | 85 +++++++++++++ 10 files changed, 311 insertions(+), 71 deletions(-) create mode 100644 src/pair_coul_cut_global.cpp create mode 100644 src/pair_coul_cut_global.h create mode 100644 unittest/force-styles/tests/mol-pair-coul_cut_global.yaml diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index e82713f8a4..60996b9c65 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -69,6 +69,7 @@ OPT. * :doc:`comb3 ` * :doc:`cosine/squared ` * :doc:`coul/cut (gko) ` + * :doc:`coul/cut/global (o) ` * :doc:`coul/cut/soft (o) ` * :doc:`coul/debye (gko) ` * :doc:`coul/diel (o) ` diff --git a/doc/src/pair_coul.rst b/doc/src/pair_coul.rst index 4def43647f..b8303622aa 100644 --- a/doc/src/pair_coul.rst +++ b/doc/src/pair_coul.rst @@ -10,6 +10,8 @@ .. index:: pair_style coul/dsf/gpu .. index:: pair_style coul/dsf/kk .. index:: pair_style coul/dsf/omp +.. index:: pair_style coul/cut/global +.. index:: pair_style coul/cut/global/omp .. index:: pair_style coul/long .. index:: pair_style coul/long/omp .. index:: pair_style coul/long/kk @@ -40,6 +42,11 @@ pair_style coul/dsf command Accelerator Variants: *coul/dsf/gpu*, *coul/dsf/kk*, *coul/dsf/omp* +pair_style coul/cut/global command +================================== + +Accelerator Variants: *coul/cut/omp* + pair_style coul/long command ============================ @@ -76,8 +83,8 @@ Syntax pair_style coul/cut cutoff pair_style coul/debye kappa cutoff pair_style coul/dsf alpha cutoff + pair_style coul/cut/global cutoff pair_style coul/long cutoff - pair_style coul/long/gpu cutoff pair_style coul/wolf alpha cutoff pair_style coul/streitz cutoff keyword alpha pair_style tip4p/cut otype htype btype atype qdist cutoff @@ -245,6 +252,11 @@ Streitz-Mintmire parameterization for the material being modeled. ---------- +Pair style *coul/cut/global* computes the same Coulombic interactions +as style *coul/cut* except that it allows only a single global cutoff +and thus makes it compatible for use in combination with long-range +coulomb styles in :doc:`hybrid pair styles `. + Styles *coul/long* and *coul/msm* compute the same Coulombic interactions as style *coul/cut* except that an additional damping factor is applied so it can be used in conjunction with the diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index bc2340d729..49eac18aa8 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -133,6 +133,7 @@ accelerated styles exist. * :doc:`comb3 ` - charge-optimized many-body (COMB3) potential * :doc:`cosine/squared ` - Cooke-Kremer-Deserno membrane model potential * :doc:`coul/cut ` - cutoff Coulomb potential +* :doc:`coul/cut/global ` - cutoff Coulomb potential * :doc:`coul/cut/soft ` - Coulomb potential with a soft core * :doc:`coul/debye ` - cutoff Coulomb potential with Debye screening * :doc:`coul/diel ` - Coulomb potential with dielectric permittivity diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 44ddd424d9..428c12c2e0 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -13,22 +13,24 @@ #include "pair_coul_cut.h" -#include -#include #include "atom.h" #include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairCoulCut::PairCoulCut(LAMMPS *lmp) : Pair(lmp) {} +PairCoulCut::PairCoulCut(LAMMPS *lmp) : Pair(lmp) { + writedata = 1; +} /* ---------------------------------------------------------------------- */ @@ -208,8 +210,10 @@ void PairCoulCut::init_style() double PairCoulCut::init_one(int i, int j) { - if (setflag[i][j] == 0) + if (setflag[i][j] == 0) { cut[i][j] = mix_distance(cut[i][i],cut[j][j]); + scale[i][j] = 1.0; + } scale[j][i] = scale[i][j]; @@ -225,11 +229,15 @@ void PairCoulCut::write_restart(FILE *fp) write_restart_settings(fp); int i,j; - for (i = 1; i <= atom->ntypes; i++) + for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { + fwrite(&scale[i][j],sizeof(double),1,fp); fwrite(&setflag[i][j],sizeof(int),1,fp); - if (setflag[i][j]) fwrite(&cut[i][j],sizeof(double),1,fp); + if (setflag[i][j]) { + fwrite(&cut[i][j],sizeof(double),1,fp); + } } + } } /* ---------------------------------------------------------------------- @@ -243,15 +251,21 @@ void PairCoulCut::read_restart(FILE *fp) int i,j; int me = comm->me; - for (i = 1; i <= atom->ntypes; i++) + for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); + if (me == 0) { + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); + } + MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + if (me == 0) + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } + } } /* ---------------------------------------------------------------------- @@ -281,6 +295,27 @@ void PairCoulCut::read_restart_settings(FILE *fp) MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairCoulCut::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d\n",i); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairCoulCut::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g\n",i,j,cut[i][j]); +} + /* ---------------------------------------------------------------------- */ double PairCoulCut::single(int i, int j, int /*itype*/, int /*jtype*/, diff --git a/src/pair_coul_cut.h b/src/pair_coul_cut.h index 5fed8344e2..fe44c0d8a4 100644 --- a/src/pair_coul_cut.h +++ b/src/pair_coul_cut.h @@ -30,15 +30,17 @@ class PairCoulCut : public Pair { virtual ~PairCoulCut(); virtual void compute(int, int); virtual void settings(int, char **); - void coeff(int, char **); + virtual void coeff(int, char **); void init_style(); double init_one(int, int); void write_restart(FILE *); void read_restart(FILE *); virtual void write_restart_settings(FILE *); virtual void read_restart_settings(FILE *); + virtual void write_data(FILE *); + virtual void write_data_all(FILE *); virtual double single(int, int, int, int, double, double, double, double &); - void *extract(const char *, int &); + virtual void *extract(const char *, int &); protected: double cut_global; diff --git a/src/pair_coul_cut_global.cpp b/src/pair_coul_cut_global.cpp new file mode 100644 index 0000000000..fa3d394092 --- /dev/null +++ b/src/pair_coul_cut_global.cpp @@ -0,0 +1,44 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "pair_coul_cut_global.h" + +#include "error.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairCoulCutGlobal::coeff(int narg, char **arg) +{ + if (narg != 2) + error->all(FLERR,"Incorrect args for pair coefficients"); + + PairCoulCut::coeff(narg,arg); +} + + +/* ---------------------------------------------------------------------- */ + +void *PairCoulCutGlobal::extract(const char *str, int &dim) +{ + dim = 0; + if (strcmp(str,"cut_coul") == 0) return (void *) &cut_global; + dim = 2; + if (strcmp(str,"scale") == 0) return (void *) scale; + return nullptr; +} diff --git a/src/pair_coul_cut_global.h b/src/pair_coul_cut_global.h new file mode 100644 index 0000000000..4b3a8ddbaa --- /dev/null +++ b/src/pair_coul_cut_global.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(coul/cut/global,PairCoulCutGlobal) + +#else + +#ifndef LMP_PAIR_COUL_CUT_GLOBAL_H +#define LMP_PAIR_COUL_CUT_GLOBAL_H + +#include "pair_coul_cut.h" + +namespace LAMMPS_NS { + +class PairCoulCutGlobal : public PairCoulCut { + public: + PairCoulCutGlobal(class LAMMPS *lmp) : PairCoulCut(lmp) {} + void coeff(int, char **); + void *extract(const char *, int &); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Pair style coul/cut requires atom attribute q + +The atom style defined does not have these attributes. + +*/ diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 5ea7fc371c..057f2b5352 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -25,7 +25,6 @@ #include "atom.h" #include "compute.h" -#include "fmt/format.h" #include "force.h" #include "info.h" #include "input.h" diff --git a/unittest/force-styles/tests/mol-pair-coul_cut.yaml b/unittest/force-styles/tests/mol-pair-coul_cut.yaml index 921e682a9a..09e97a3a8d 100644 --- a/unittest/force-styles/tests/mol-pair-coul_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_cut.yaml @@ -1,7 +1,8 @@ --- -lammps_version: 10 Feb 2021 -date_generated: Fri Feb 26 23:08:42 2021 +lammps_version: 8 Apr 2021 +date_generated: Sat Apr 10 00:22:24 2021 epsilon: 1e-13 +skip_tests: prerequisites: ! | atom full pair coul/cut @@ -11,17 +12,22 @@ post_commands: ! | input_file: in.fourmol pair_style: coul/cut 8.0 pair_coeff: ! | - * * + 1 1 + 2 2 7.0 + 2 3 7.5 + 3 3 + 4 4 8.0 + 5 5 extract: ! | cut_coul 2 natoms: 29 init_vdwl: 0 -init_coul: -127.494586297384 +init_coul: -93.55664334073657 init_stress: ! |- - -2.6824547034957277e+01 -4.3162775104089022e+01 -5.7507264158338124e+01 -8.2055093564543602e-01 -7.9072701063929465e+00 3.0552092014126533e+00 + -2.0535385669481379e+01 -1.6145387915767863e+01 -5.6875869755487301e+01 -4.1550674863524968e+00 -7.0519267473420957e+00 2.6305371873347489e+00 init_forces: ! |2 1 2.2407335289699457e+00 -5.8916421262140251e-02 4.2668639853362533e-01 - 2 3.0979928510686561e-01 -2.1737695778193569e+00 -1.8762407787145119e+00 + 2 -1.2152150177208687e-01 -3.4650575893033708e+00 -1.3360477574570087e+00 3 -1.5509825092714681e-02 -8.6264917303471161e-02 3.0367577692877928e-02 4 5.1555686582278520e-02 1.0144901459000669e-02 -3.0866112200648410e-01 5 -3.9871973553557233e-01 7.0523075214913145e-01 -7.8022318023030612e-02 @@ -30,57 +36,57 @@ init_forces: ! |2 8 -1.7087898110045159e+00 4.1818078578969917e+00 2.4290227133489601e+00 9 1.8279010754687195e+00 -5.6724899047236770e+00 1.6512690951588267e+00 10 -2.9363989744075952e-01 4.2512276557131090e-01 -2.0317384271111175e-01 - 11 -9.8868358921602750e-01 1.1284880357946445e+00 -5.3995772876854398e-01 + 11 -9.6854530039287257e-01 1.2818484089934798e+00 -4.0964874266313867e-01 12 3.3104189805348057e+00 -7.6522029601079322e-01 1.2706541181424338e+00 - 13 -3.8231563183336364e-01 -1.1565866576649098e-02 -8.7140102078706039e-03 - 14 -1.2285578202646528e+00 4.4726948380599840e-01 -1.5341285475604788e-02 - 15 2.2085158688210516e-01 -1.6336214445566244e-01 -9.6577522905262758e-01 + 13 -3.0889352958622951e-01 2.5103266106999866e-01 1.0669227367631845e-01 + 14 -1.2634615134073266e+00 5.9356329877397740e-01 2.0097321421686021e-01 + 15 3.4164194917662777e-01 -1.3968217225075463e-02 -1.0754490238146823e+00 16 -1.0515762083518698e+00 -3.6728607969167482e-01 2.7987602083946292e+00 - 17 -2.3442527695736954e+00 6.0494781225943264e+00 -7.7669898420813883e+00 - 18 1.2747707302049942e+00 6.6751091235431907e+00 -9.9139029454048035e+00 - 19 1.6181330640335625e+00 -1.6591712461142003e+00 5.6543694708933723e+00 - 20 -3.4516847879389365e+00 -3.1783992642977736e+00 4.2589367844805865e+00 - 21 2.4909407783496178e+00 1.4847928289095484e+00 -1.0503546063193097e+01 - 22 1.4973505700836185e+00 1.0712683327319574e+00 6.7413935914321712e+00 - 23 -4.4865766347042468e+00 -3.8185091520236116e+00 4.2817682561025867e+00 - 24 -2.4197806588078703e+00 9.8687406957238029e+00 -2.3585711007230041e+00 - 25 3.5804022684917332e+00 -3.1080767536674005e+00 3.9458463586096970e+00 - 26 -2.0751789623087848e+00 -7.6352193307876766e+00 -4.5052467808202223e-01 - 27 -2.8475395052833852e+00 1.1111959093179417e+01 -4.4252374188335644e+00 - 28 4.8464204075747359e+00 -5.2910383050538492e+00 4.0808901405648896e+00 - 29 -1.2636120082903082e+00 -6.1719354975176035e+00 9.2219267915908476e-01 + 17 -2.4272925242862877e+00 5.1482976415440387e+00 -6.9745861917436480e+00 + 18 -3.3422585449197340e-01 1.0468316830549977e+01 -9.5556804718861983e+00 + 19 1.8166530000757015e+00 -1.4461616747597046e+00 7.5536140661465714e+00 + 20 -3.2356613999008608e+00 -3.8668819868868143e+00 5.3737386596536343e+00 + 21 4.0222635030104259e+00 1.6132349119387515e+00 -1.0241718963154419e+01 + 22 1.4374544034911272e+00 -9.5656370964487103e-01 6.5980789669241569e+00 + 23 -4.4376821117692176e+00 -3.8947548010087796e+00 4.1208787227921038e+00 + 24 -1.5247815933638265e+00 1.1713843272625617e+01 -6.0248223323521604e+00 + 25 3.1898863386468577e+00 -4.1364515802851436e+00 3.9097585091440594e+00 + 26 -2.2629415636619381e+00 -8.5609820249335087e+00 -1.1581224704665538e+00 + 27 -3.6829593583586151e+00 1.0444039166475267e+01 -3.7821850434646627e+00 + 28 5.4031537104784855e+00 -4.4754845440910707e+00 3.6816742644554843e+00 + 29 -1.2926003313820287e+00 -6.0718114858636643e+00 7.3448520698640607e-02 run_vdwl: 0 -run_coul: -127.551092913469 +run_coul: -93.61491356191763 run_stress: ! |- - -2.6928416018548067e+01 -4.3177725729834854e+01 -5.7444951165085541e+01 -8.5814323779813129e-01 -7.9912081348585087e+00 2.9897259857467389e+00 + -2.0637957613066451e+01 -1.6150296923318230e+01 -5.6826659025532969e+01 -4.1943798944102859e+00 -7.1336719665040942e+00 2.5570315775315215e+00 run_forces: ! |2 - 1 2.2424368291189611e+00 -5.7157845887417236e-02 4.3210281185121069e-01 - 2 3.0183044940246062e-01 -2.1770211242302246e+00 -1.8796316672405435e+00 - 3 -1.5579134024760494e-02 -8.6577075665555045e-02 3.0374580927846943e-02 - 4 5.2605597845996610e-02 1.0081774332824270e-02 -3.0969764881211892e-01 - 5 -3.9802063955902828e-01 7.0541551998225649e-01 -7.9105180426906119e-02 - 6 2.0115016302231399e+00 -3.7433268305651115e+00 -2.9688564502920158e+00 - 7 -3.2650169036425236e-01 7.4540116984953042e-01 3.8864116015671808e+00 - 8 -1.6992053224967520e+00 4.1770597030834642e+00 2.4329396564406349e+00 - 9 1.8250267620013743e+00 -5.6775189439742455e+00 1.6562371734234631e+00 - 10 -2.9411864176775349e-01 4.2484150168808632e-01 -2.0454722162066086e-01 - 11 -9.8864600485826815e-01 1.1292383541031983e+00 -5.3894807546123469e-01 - 12 3.3107287761242974e+00 -7.6414239662660099e-01 1.2747075215620911e+00 - 13 -3.8336813011366144e-01 -1.2486400314578122e-02 -9.4718485253563467e-03 - 14 -1.2290837060322926e+00 4.4862678961891689e-01 -1.5069551071827086e-02 - 15 2.2244012017801007e-01 -1.6546887582342559e-01 -9.6944707732754809e-01 - 16 -1.0531155341397860e+00 -3.6654926990083037e-01 2.7960996028622298e+00 - 17 -2.3452245945824948e+00 6.0586966641613316e+00 -7.7701709031633026e+00 - 18 1.2287925114358347e+00 6.6283596097346500e+00 -9.8694991818018014e+00 - 19 1.6548495610099294e+00 -1.6299328734082061e+00 5.6681416753764280e+00 - 20 -3.4405939298489487e+00 -3.1595057592530829e+00 4.2031829943411507e+00 - 21 2.4999236613139768e+00 1.4581441593082431e+00 -1.0498791509490704e+01 - 22 1.5230738475837411e+00 1.0948611353935194e+00 6.7461577757855986e+00 - 23 -4.5208030817248321e+00 -3.8176488387685179e+00 4.2715025892256220e+00 - 24 -2.4424910840260479e+00 9.8889784537097576e+00 -2.3784455147561552e+00 - 25 3.6199382208005479e+00 -3.1023007862101899e+00 3.9803408068580102e+00 - 26 -2.0901080780170158e+00 -7.6586474495008154e+00 -4.6300658746615819e-01 - 27 -2.8661140489132810e+00 1.1127847846706011e+01 -4.4084385064798797e+00 - 28 4.8657388732889295e+00 -5.2969930881855793e+00 4.0790567237989928e+00 - 29 -1.2659132198580254e+00 -6.1822751233574085e+00 9.0587140991575621e-01 + 1 2.2425199864949272e+00 -5.7185268117056043e-02 4.3203484436437956e-01 + 2 -1.2953282231918894e-01 -3.4675950045872330e+00 -1.3398768542921780e+00 + 3 -1.5576933865004368e-02 -8.6576616933096762e-02 3.0374805119446222e-02 + 4 5.2594937495592908e-02 1.0083837924927244e-02 -3.0970246073870022e-01 + 5 -3.9802884083965534e-01 7.0541446618110337e-01 -7.9104505633399519e-02 + 6 2.0114733380305516e+00 -3.7433607398217483e+00 -2.9688665724203247e+00 + 7 -3.2646062589844127e-01 7.4545113602886504e-01 3.8864515374233779e+00 + 8 -1.6992144552176487e+00 4.1770867949498349e+00 2.4329479646797592e+00 + 9 1.8250302102601557e+00 -5.6775183441065051e+00 1.6562334058459376e+00 + 10 -2.9411499784567297e-01 4.2483825717579743e-01 -2.0454944575981404e-01 + 11 -9.6852892734814910e-01 1.2825160904684365e+00 -4.0863298208468957e-01 + 12 3.3107072705734946e+00 -7.6411402305007570e-01 1.2747076834264663e+00 + 13 -3.0999843695510060e-01 2.5003385487095964e-01 1.0600468871727173e-01 + 14 -1.2638813019667337e+00 5.9487350384637094e-01 2.0105698487957110e-01 + 15 3.4335793714273627e-01 -1.5950553742170387e-02 -1.0791712067698431e+00 + 16 -1.0530808398954454e+00 -3.6657367999349177e-01 2.7960862384014673e+00 + 17 -2.4285042656947571e+00 5.1576639561985473e+00 -6.9782029543394053e+00 + 18 -3.7929628350149169e-01 1.0420786070107907e+01 -9.5123267863543006e+00 + 19 1.8527235581340016e+00 -1.4163845910512083e+00 7.5667871079591533e+00 + 20 -3.2257007148929735e+00 -3.8484754900366887e+00 5.3176481256299590e+00 + 21 4.0318672433929734e+00 1.5871903248026678e+00 -1.0237421892763503e+01 + 22 1.4629760972442929e+00 -9.3386175185967235e-01 6.6032592166314519e+00 + 23 -4.4717803858275476e+00 -3.8939153227171523e+00 4.1111064353488365e+00 + 24 -1.5477331915053858e+00 1.1733740828713346e+01 -6.0432763590713154e+00 + 25 3.2290132418876336e+00 -4.1305242042670889e+00 3.9442459043882159e+00 + 26 -2.2770020178904948e+00 -8.5834251121651697e+00 -1.1704818988226089e+00 + 27 -3.7015228676694329e+00 1.0459984537547431e+01 -3.7654963783953805e+00 + 28 5.4222452431134922e+00 -4.4818388539753489e+00 3.6800169942739531e+00 + 29 -1.2945511546367356e+00 -6.0823641023924875e+00 5.8148360356210294e-02 ... diff --git a/unittest/force-styles/tests/mol-pair-coul_cut_global.yaml b/unittest/force-styles/tests/mol-pair-coul_cut_global.yaml new file mode 100644 index 0000000000..817c7c76ca --- /dev/null +++ b/unittest/force-styles/tests/mol-pair-coul_cut_global.yaml @@ -0,0 +1,85 @@ +--- +lammps_version: 10 Feb 2021 +date_generated: Fri Feb 26 23:08:42 2021 +epsilon: 1e-13 +prerequisites: ! | + atom full + pair coul/cut/global +pre_commands: ! "" +post_commands: ! "" +input_file: in.fourmol +pair_style: coul/cut/global 8.0 +pair_coeff: ! | + * * +extract: ! | + cut_coul 0 +natoms: 29 +init_vdwl: 0 +init_coul: -127.494586297384 +init_stress: ! |- + -2.6824547034957277e+01 -4.3162775104089022e+01 -5.7507264158338124e+01 -8.2055093564543602e-01 -7.9072701063929465e+00 3.0552092014126533e+00 +init_forces: ! |2 + 1 2.2407335289699457e+00 -5.8916421262140251e-02 4.2668639853362533e-01 + 2 3.0979928510686561e-01 -2.1737695778193569e+00 -1.8762407787145119e+00 + 3 -1.5509825092714681e-02 -8.6264917303471161e-02 3.0367577692877928e-02 + 4 5.1555686582278520e-02 1.0144901459000669e-02 -3.0866112200648410e-01 + 5 -3.9871973553557233e-01 7.0523075214913145e-01 -7.8022318023030612e-02 + 6 2.0159901805654243e+00 -3.7483112004912753e+00 -2.9733937038705189e+00 + 7 -3.2885029720170206e-01 7.5012396443748963e-01 3.8958946746344409e+00 + 8 -1.7087898110045159e+00 4.1818078578969917e+00 2.4290227133489601e+00 + 9 1.8279010754687195e+00 -5.6724899047236770e+00 1.6512690951588267e+00 + 10 -2.9363989744075952e-01 4.2512276557131090e-01 -2.0317384271111175e-01 + 11 -9.8868358921602750e-01 1.1284880357946445e+00 -5.3995772876854398e-01 + 12 3.3104189805348057e+00 -7.6522029601079322e-01 1.2706541181424338e+00 + 13 -3.8231563183336364e-01 -1.1565866576649098e-02 -8.7140102078706039e-03 + 14 -1.2285578202646528e+00 4.4726948380599840e-01 -1.5341285475604788e-02 + 15 2.2085158688210516e-01 -1.6336214445566244e-01 -9.6577522905262758e-01 + 16 -1.0515762083518698e+00 -3.6728607969167482e-01 2.7987602083946292e+00 + 17 -2.3442527695736954e+00 6.0494781225943264e+00 -7.7669898420813883e+00 + 18 1.2747707302049942e+00 6.6751091235431907e+00 -9.9139029454048035e+00 + 19 1.6181330640335625e+00 -1.6591712461142003e+00 5.6543694708933723e+00 + 20 -3.4516847879389365e+00 -3.1783992642977736e+00 4.2589367844805865e+00 + 21 2.4909407783496178e+00 1.4847928289095484e+00 -1.0503546063193097e+01 + 22 1.4973505700836185e+00 1.0712683327319574e+00 6.7413935914321712e+00 + 23 -4.4865766347042468e+00 -3.8185091520236116e+00 4.2817682561025867e+00 + 24 -2.4197806588078703e+00 9.8687406957238029e+00 -2.3585711007230041e+00 + 25 3.5804022684917332e+00 -3.1080767536674005e+00 3.9458463586096970e+00 + 26 -2.0751789623087848e+00 -7.6352193307876766e+00 -4.5052467808202223e-01 + 27 -2.8475395052833852e+00 1.1111959093179417e+01 -4.4252374188335644e+00 + 28 4.8464204075747359e+00 -5.2910383050538492e+00 4.0808901405648896e+00 + 29 -1.2636120082903082e+00 -6.1719354975176035e+00 9.2219267915908476e-01 +run_vdwl: 0 +run_coul: -127.551092913469 +run_stress: ! |- + -2.6928416018548067e+01 -4.3177725729834854e+01 -5.7444951165085541e+01 -8.5814323779813129e-01 -7.9912081348585087e+00 2.9897259857467389e+00 +run_forces: ! |2 + 1 2.2424368291189611e+00 -5.7157845887417236e-02 4.3210281185121069e-01 + 2 3.0183044940246062e-01 -2.1770211242302246e+00 -1.8796316672405435e+00 + 3 -1.5579134024760494e-02 -8.6577075665555045e-02 3.0374580927846943e-02 + 4 5.2605597845996610e-02 1.0081774332824270e-02 -3.0969764881211892e-01 + 5 -3.9802063955902828e-01 7.0541551998225649e-01 -7.9105180426906119e-02 + 6 2.0115016302231399e+00 -3.7433268305651115e+00 -2.9688564502920158e+00 + 7 -3.2650169036425236e-01 7.4540116984953042e-01 3.8864116015671808e+00 + 8 -1.6992053224967520e+00 4.1770597030834642e+00 2.4329396564406349e+00 + 9 1.8250267620013743e+00 -5.6775189439742455e+00 1.6562371734234631e+00 + 10 -2.9411864176775349e-01 4.2484150168808632e-01 -2.0454722162066086e-01 + 11 -9.8864600485826815e-01 1.1292383541031983e+00 -5.3894807546123469e-01 + 12 3.3107287761242974e+00 -7.6414239662660099e-01 1.2747075215620911e+00 + 13 -3.8336813011366144e-01 -1.2486400314578122e-02 -9.4718485253563467e-03 + 14 -1.2290837060322926e+00 4.4862678961891689e-01 -1.5069551071827086e-02 + 15 2.2244012017801007e-01 -1.6546887582342559e-01 -9.6944707732754809e-01 + 16 -1.0531155341397860e+00 -3.6654926990083037e-01 2.7960996028622298e+00 + 17 -2.3452245945824948e+00 6.0586966641613316e+00 -7.7701709031633026e+00 + 18 1.2287925114358347e+00 6.6283596097346500e+00 -9.8694991818018014e+00 + 19 1.6548495610099294e+00 -1.6299328734082061e+00 5.6681416753764280e+00 + 20 -3.4405939298489487e+00 -3.1595057592530829e+00 4.2031829943411507e+00 + 21 2.4999236613139768e+00 1.4581441593082431e+00 -1.0498791509490704e+01 + 22 1.5230738475837411e+00 1.0948611353935194e+00 6.7461577757855986e+00 + 23 -4.5208030817248321e+00 -3.8176488387685179e+00 4.2715025892256220e+00 + 24 -2.4424910840260479e+00 9.8889784537097576e+00 -2.3784455147561552e+00 + 25 3.6199382208005479e+00 -3.1023007862101899e+00 3.9803408068580102e+00 + 26 -2.0901080780170158e+00 -7.6586474495008154e+00 -4.6300658746615819e-01 + 27 -2.8661140489132810e+00 1.1127847846706011e+01 -4.4084385064798797e+00 + 28 4.8657388732889295e+00 -5.2969930881855793e+00 4.0790567237989928e+00 + 29 -1.2659132198580254e+00 -6.1822751233574085e+00 9.0587140991575621e-01 +... From d81f03706cb8783020c990f6701933036c05e16f Mon Sep 17 00:00:00 2001 From: tc387 Date: Mon, 12 Apr 2021 01:30:36 -0500 Subject: [PATCH 356/370] Added an example using real units. --- .../charge_regulation/data.chreg-acid-real | 235 ++++++++++++++++++ .../misc/charge_regulation/in.chreg-acid-real | 44 ++++ .../log.11Apr21.chreg-acid-real.g++.1 | 145 +++++++++++ .../log.11Apr21.chreg-acid-real.g++.4 | 145 +++++++++++ 4 files changed, 569 insertions(+) create mode 100644 examples/USER/misc/charge_regulation/data.chreg-acid-real create mode 100644 examples/USER/misc/charge_regulation/in.chreg-acid-real create mode 100644 examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 create mode 100644 examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 diff --git a/examples/USER/misc/charge_regulation/data.chreg-acid-real b/examples/USER/misc/charge_regulation/data.chreg-acid-real new file mode 100644 index 0000000000..1f005a155b --- /dev/null +++ b/examples/USER/misc/charge_regulation/data.chreg-acid-real @@ -0,0 +1,235 @@ +LAMMPS data file generated by get_input.py + +219 atoms +3 atom types +-180 180 xlo xhi +-180 180 ylo yhi +-180 180 zlo zhi + +Masses + +1 20 +2 20 +3 20 + +Atoms + +1 1 0 18.70795854 -60.24998141 144.0092784 +2 1 -1 -130.9166548 -58.17450505 59.42690807 +3 1 -1 -125.5489258 58.46696329 77.38308245 +4 1 -1 46.8178314 -169.1807517 143.6272062 +5 1 -1 -162.2028908 -135.2407217 -129.3455357 +6 1 -1 -69.93717134 136.6009615 -140.3684699 +7 1 -1 -92.39022725 0.88313303 -156.091658 +8 1 -1 150.5452585 -15.59052452 3.326246397 +9 1 -1 171.8072626 172.9794849 75.84528386 +10 1 -1 -3.808294794 171.5056017 -19.13183671 +11 1 -1 68.90552852 86.21187482 24.628687 +12 1 -1 -73.4512319 54.41387468 86.90435812 +13 1 -1 35.26889793 14.52239846 -149.5100547 +14 1 -1 -173.4235696 31.85993966 -30.27092231 +15 1 -1 26.52275652 -34.29527864 -91.86288894 +16 1 -1 -87.96846598 -127.5856503 -97.6057498 +17 1 -1 -154.4848498 -53.45277349 -49.99665917 +18 1 -1 98.62055171 61.22620607 58.21550969 +19 1 -1 -41.50240351 82.79211492 -36.80199381 +20 1 -1 28.75979595 121.8830702 -107.1045784 +21 1 -1 32.46858199 119.7785312 -159.9729476 +22 1 -1 159.2306995 -136.6051631 -172.6738992 +23 1 -1 102.0172393 -120.2283106 99.20908244 +24 1 -1 123.7452923 63.55770833 165.9991324 +25 1 -1 21.47248943 -121.2255157 -153.2060898 +26 1 -1 119.9343938 -11.67643844 -81.47418783 +27 1 -1 138.3518387 -111.6909718 52.34478391 +28 1 -1 -63.98455793 -173.4943975 28.8937153 +29 1 -1 151.1941205 32.1957053 2.770016951 +30 1 -1 9.678451862 40.32965827 -107.4138803 +31 1 -1 -50.13343476 147.3853225 -117.9277823 +32 1 -1 -71.89428479 68.56083346 -179.8533411 +33 1 -1 -124.7615264 41.48173515 41.18558752 +34 1 -1 37.21218965 -170.6314486 18.86382891 +35 1 -1 136.6419056 46.16558949 45.50222572 +36 1 -1 -117.9745136 -106.7487877 29.70172113 +37 1 -1 57.41607893 -135.959946 79.2519303 +38 1 -1 99.2146782 13.37903953 65.55038181 +39 1 -1 -172.1483566 -24.09752036 -73.64723741 +40 1 -1 155.6386288 60.79647905 -137.6687854 +41 1 -1 -63.53265172 104.1203088 115.6442718 +42 1 -1 -17.57295284 90.38545929 148.3687022 +43 1 -1 -132.9077114 109.8788504 152.5487953 +44 1 -1 16.09488244 -168.1200949 81.85901273 +45 1 -1 112.2904059 -47.57448978 39.12664557 +46 1 -1 -126.2033528 29.5901835 -10.20047838 +47 1 -1 15.56623544 -118.8796306 -87.74057744 +48 1 -1 -62.53683723 -50.93540139 -8.324528194 +49 1 -1 112.4826277 -47.2269151 148.0087872 +50 1 -1 -50.1494905 -103.3112513 -103.8344246 +51 1 -1 -87.11540287 -177.3205662 -114.041712 +52 1 -1 48.0517504 56.41745572 -69.94172272 +53 1 -1 -125.3768674 89.18463079 -121.5525657 +54 1 -1 157.6559442 89.89879164 -104.7846361 +55 1 -1 -60.30935405 -178.4439001 53.67216823 +56 1 -1 101.3842749 -156.3782696 -125.6200241 +57 1 -1 33.71034745 14.19807232 -56.33090362 +58 1 -1 31.34283781 114.2588441 177.621698 +59 1 -1 167.8681492 -33.73721495 17.70943601 +60 1 -1 50.73906277 165.7201913 -94.6041936 +61 1 -1 84.42400278 -113.8271268 -11.73087326 +62 1 -1 -146.6200007 -87.0115127 -164.2802459 +63 1 -1 -17.94345563 -5.266117623 -114.4770608 +64 1 -1 -161.6618755 -81.21577064 -68.78715057 +65 1 -1 178.3275787 144.9284223 75.80861878 +66 1 -1 81.54873843 -83.6941478 -69.75163018 +67 1 -1 -41.13190239 113.6079886 -6.669536125 +68 1 -1 -108.5270482 -89.08499627 -39.32427247 +69 1 -1 -41.97432027 -32.96246695 65.11935497 +70 1 -1 -39.09020679 10.47027922 -53.26049629 +71 1 -1 -168.3760012 -85.85704062 27.51501191 +72 1 -1 -7.699755475 21.59960856 26.43069039 +73 1 -1 87.36704757 14.21816794 -107.2504322 +74 1 -1 153.4284087 136.6052131 -126.1502487 +75 1 -1 -175.3682642 25.88313064 123.6455547 +76 1 -1 90.96648194 175.4891969 32.84622917 +77 1 -1 -77.3297511 139.285477 -24.02526586 +78 1 -1 -21.80051132 76.35556687 53.9496888 +79 1 -1 36.00388293 84.74463507 124.0379428 +80 1 -1 8.341344194 -176.0991953 -90.11296078 +81 1 -1 13.79742378 -101.263178 81.37760753 +82 1 -1 -150.1706978 153.3081009 125.261789 +83 1 -1 -176.434078 -91.73850736 -13.91415701 +84 1 -1 19.14212656 -8.014482902 53.93954558 +85 1 -1 -133.3111329 174.2862517 104.1616036 +86 1 -1 141.4028288 71.58712061 62.57853826 +87 1 -1 -55.41310448 84.69012271 -53.69230074 +88 1 -1 7.57030387 -82.51421069 121.7019339 +89 1 -1 6.593627122 170.3286085 -47.07783075 +90 1 -1 167.9772199 -52.51603119 -77.32359634 +91 1 -1 9.68753279 2.580696533 63.63273049 +92 1 -1 -157.900078 -78.41001295 -74.97298362 +93 1 -1 157.7779932 -77.61759639 83.11626672 +94 1 -1 8.735687555 -51.63741526 149.2886008 +95 1 -1 166.3370649 158.0395191 2.108272744 +96 1 -1 -136.2080224 -0.233620925 170.1641304 +97 1 -1 54.59763504 77.34086464 -34.97254442 +98 1 -1 -53.93524806 -102.0122253 -46.27109402 +99 1 -1 -148.8398471 -62.976886 79.28200649 +100 1 -1 -134.367229 -153.7685306 -62.89913905 +101 2 1 85.68701047 47.45902631 136.9309939 +102 2 1 -168.7218611 -136.4862888 34.82926874 +103 2 1 -85.14342147 -27.50852705 22.44064244 +104 2 1 -125.9841936 -166.432033 69.22175254 +105 2 1 78.40196016 32.48784706 134.5355212 +106 2 1 -158.7356866 172.6075363 -168.6081077 +107 2 1 -97.70696089 125.0552693 152.541151 +108 2 1 47.42532862 117.2059839 -26.2001494 +109 2 1 58.97843054 49.16794046 -45.70255405 +110 2 1 -113.2077086 -147.4896474 -109.0593944 +111 2 1 133.7818478 137.2370883 -74.12887346 +112 2 1 -151.8619681 -55.72321046 39.00697883 +113 2 1 -101.5491513 -113.5421107 -135.9492067 +114 2 1 -105.4410412 63.66017268 62.00391546 +115 2 1 -84.37716183 -35.78408568 -7.089644848 +116 2 1 140.387382 -75.00992841 -159.2710691 +117 2 1 157.3753205 145.1311104 -98.29723102 +118 2 1 -126.8885841 157.4914592 -47.04455377 +119 2 1 52.06885202 -100.2669325 38.59257737 +120 2 1 -54.06789629 137.7750035 -116.8953091 +121 2 1 -29.14739431 94.50860741 -51.527097 +122 2 1 -145.9322739 154.5384232 112.3421798 +123 2 1 -32.24342538 -22.90490626 -133.4101075 +124 2 1 155.0953371 97.30799449 -13.02231424 +125 2 1 -109.6079033 -42.89844953 -51.80376701 +126 2 1 -150.2770445 -55.20818421 147.7312972 +127 2 1 -26.96028917 151.3053234 51.82429115 +128 2 1 -42.51040448 55.12547194 -10.01649745 +129 2 1 -154.7332138 -166.4922488 75.56066422 +130 2 1 179.3252381 50.98353603 -103.842222 +131 2 1 -87.64561442 -167.4026399 -37.04977996 +132 2 1 -141.7543098 32.23109989 44.99445113 +133 2 1 121.3596596 -6.092779973 129.6856923 +134 2 1 124.4836766 -86.35531223 85.50625099 +135 2 1 140.6305506 -165.9843021 -35.3966949 +136 2 1 -89.51258901 36.2123163 54.25434215 +137 2 1 107.5306105 58.22419926 141.7457531 +138 2 1 -51.03564423 -166.277591 119.3103596 +139 2 1 106.3738063 153.673561 100.7747233 +140 2 1 -105.1662471 -49.88388187 -163.5658795 +141 2 1 -123.4063552 104.6405545 -157.1806703 +142 2 1 30.68517662 111.7365757 -128.0988407 +143 2 1 -70.66650991 -36.87088431 101.1920697 +144 2 1 59.85584345 28.56015074 -148.8751279 +145 2 1 76.34296857 -18.88899045 11.99663247 +146 2 1 -127.898772 9.029786744 -155.2067979 +147 2 1 -61.47407783 106.6906337 -32.24644961 +148 2 1 -41.82882356 105.2048819 95.67134776 +149 2 1 64.70518204 -125.5606981 -130.2221179 +150 2 1 -95.86998176 64.01110464 -62.69889224 +151 2 1 -3.893149866 -170.4938796 -173.9425756 +152 2 1 -142.5571999 -115.9852755 -42.33527796 +153 2 1 -170.1094774 67.22933296 -69.41406448 +154 2 1 -135.7002446 -117.3853245 -77.66219554 +155 2 1 97.68794466 -176.3481416 64.0577303 +156 2 1 98.30084322 -179.1048324 157.6098802 +157 2 1 -61.74657154 71.45180441 36.21267022 +158 2 1 148.9924395 8.130617629 2.580809806 +159 2 1 -7.179797893 131.8852645 48.92705878 +160 2 1 166.7210737 111.3028256 122.5151765 +161 2 1 160.4061661 105.4292149 147.9164951 +162 2 1 70.35573238 -156.217711 -37.86968306 +163 2 1 37.82167168 128.9612675 113.5371453 +164 2 1 -149.4650805 40.2544478 -89.16446826 +165 2 1 23.15794976 -35.62998186 -128.5225995 +166 2 1 148.5909499 65.59167763 44.47571026 +167 2 1 38.20567747 91.06090259 167.2556933 +168 2 1 -173.8935359 124.3001041 -123.4154022 +169 2 1 -113.0780192 -112.7185827 -75.51909042 +170 2 1 -47.52814398 -162.0232543 -40.84518679 +171 2 1 164.6580923 96.26106544 -67.52475023 +172 2 1 -166.687599 -28.28821753 -80.04284273 +173 2 1 9.786487166 -133.5748603 -110.4924395 +174 2 1 73.69685916 -130.6229707 -12.1566579 +175 2 1 90.69039384 -12.53964183 -156.8650452 +176 2 1 -1.065055548 123.2458955 9.207883208 +177 2 1 175.3144942 -62.38332615 89.50309521 +178 2 1 -135.5554643 -135.3786299 -12.22599884 +179 2 1 -65.15130962 -12.87802388 -85.25728639 +180 2 1 -161.9760397 -159.2069523 72.10033228 +181 2 1 -116.5200037 9.430944126 5.8294178 +182 2 1 -28.85454266 -176.0245493 -141.7245957 +183 2 1 63.2968571 -114.4145268 -168.891953 +184 2 1 -61.61686575 -158.2947391 162.9099557 +185 2 1 51.43661765 119.3411567 4.253266919 +186 2 1 50.78017633 47.93871152 129.5527454 +187 2 1 151.0842128 -27.15258927 -161.0800505 +188 2 1 -63.76595621 -118.2333675 -55.31381078 +189 2 1 -103.5498203 -55.20725862 -73.28180307 +190 2 1 -165.1300235 72.52455317 27.04945294 +191 2 1 68.10471264 124.0704131 -0.252243467 +192 2 1 79.29794618 142.8637277 -42.01908928 +193 2 1 167.6806551 20.41616629 -147.6924841 +194 2 1 -135.8036012 64.48710622 102.1923975 +195 2 1 98.55703781 -115.0070794 78.85760695 +196 2 1 15.16187488 19.73322691 -170.7866955 +197 2 1 151.0729333 50.92372407 -173.3272023 +198 2 1 42.92899709 -139.8564977 161.7836767 +199 2 1 -123.3797296 144.2768906 93.18435951 +200 2 1 83.46684339 160.4439871 16.84583748 +201 2 1 -9.982765467 138.2373541 -55.3263136 +202 2 1 -161.6023131 -141.5797686 -64.66795638 +203 2 1 2.63144963 -54.92560391 117.5540027 +204 2 1 -70.31638318 175.5673808 -103.3383852 +205 2 1 -4.543770763 -40.50287551 98.39515078 +206 2 1 19.2926167 -2.671035153 112.1413205 +207 2 1 76.93260202 177.3949067 -126.2787212 +208 2 1 131.8183006 132.4167597 131.6586696 +209 2 1 -82.9844547 -85.47123292 92.81285561 +210 3 -1 115.4743016 -5.981969165 65.81311346 +211 3 -1 -86.91538943 171.1823129 -45.00079 +212 3 -1 174.0893311 141.4009485 159.8631805 +213 3 -1 164.8739505 64.21237704 -8.113691614 +214 3 -1 -75.49748308 40.97887837 158.0779944 +215 3 -1 45.16399203 72.25791157 159.9861897 +216 3 -1 105.7676225 -56.05853127 3.624467826 +217 3 -1 166.8523536 -151.4993186 -151.6124408 +218 3 -1 -43.30886503 46.05330597 155.3934201 +219 3 -1 -5.592027058 2.85325065 11.39381158 \ No newline at end of file diff --git a/examples/USER/misc/charge_regulation/in.chreg-acid-real b/examples/USER/misc/charge_regulation/in.chreg-acid-real new file mode 100644 index 0000000000..195b163d96 --- /dev/null +++ b/examples/USER/misc/charge_regulation/in.chreg-acid-real @@ -0,0 +1,44 @@ +# Charge regulation lammps for simple weak electrolyte + +units real +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid-real + +#real units +variable sigma equal 7.2 # particle diameter 0.72 nm +variable temperature equal 298 # temperature 298 K +variable kb index 0.0019872067 # kB in Kcal/mol/K +variable epsilon equal ${kb}*${temperature} +variable tunit equal 2000 # time unit is 2000 fs +variable timestep equal 0.005*${tunit} + +variable cut_long equal 12.5*${sigma} +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0)*${sigma} +velocity all create ${temperature} 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_coeff * * ${epsilon} ${sigma} +kspace_style pppm 1.0e-3 +dielectric 78 +pair_modify shift yes + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin $(v_temperature) $(v_temperature) $(v_tunit) 123 +fix_modify fT temp dtemp + +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep ${timestep} +run 2000 diff --git a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 new file mode 100644 index 0000000000..3b766d662d --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 @@ -0,0 +1,145 @@ +LAMMPS (10 Feb 2021) +# Charge regulation lammps for simple weak electrolyte + +units real +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid-real +Reading data file ... + orthogonal box = (-180.00000 -180.00000 -180.00000) to (180.00000 180.00000 180.00000) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 219 atoms + read_data CPU = 0.002 seconds + +#real units +variable sigma equal 7.2 # particle diameter 0.72 nm +variable temperature equal 298 # temperature 298 K +variable kb index 0.0019872067 # kB in Kcal/mol/K +variable epsilon equal ${kb}*${temperature} +variable epsilon equal 0.0019872067*${temperature} +variable epsilon equal 0.0019872067*298 +variable tunit equal 2000 # time unit is 2000 fs +variable timestep equal 0.005*${tunit} +variable timestep equal 0.005*2000 + +variable cut_long equal 12.5*${sigma} +variable cut_long equal 12.5*7.2 +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0)*${sigma} +variable cut_lj equal 2^(1.0/6.0)*7.2 +velocity all create ${temperature} 8008 loop geom +velocity all create 298 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_style lj/cut/coul/long 8.08172674782749 ${cut_long} +pair_style lj/cut/coul/long 8.08172674782749 90 +pair_coeff * * ${epsilon} ${sigma} +pair_coeff * * 0.5921875966 ${sigma} +pair_coeff * * 0.5921875966 7.2 +kspace_style pppm 1.0e-3 +dielectric 78 +pair_modify shift yes + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin $(v_temperature) $(v_temperature) $(v_tunit) 123 +fix fT all langevin 298 $(v_temperature) $(v_tunit) 123 +fix fT all langevin 298 298 $(v_tunit) 123 +fix fT all langevin 298 298 2000 123 +fix_modify fT temp dtemp + +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery 100 nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery 100 nmc 100 seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep ${timestep} +timestep 10 +run 2000 +PPPM initialization ... + using 12-bit tables for long-range coulomb (../kspace.cpp:339) + G vector (1/distance) = 0.019408615 + grid = 8 8 8 + stencil order = 5 + estimated absolute RMS force accuracy = 0.00012527706 + estimated relative force accuracy = 3.7726815e-07 + using double precision KISS FFT + 3d grid and FFT values/proc = 2197 512 +0 atoms in group FixChargeRegulation:exclusion_group:chareg +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 93 + ghost atom cutoff = 93 + binsize = 46.5, bins = 8 8 8 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.707 | 3.707 | 3.707 Mbytes +Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] + 0 -6.4798431 298 0 0 1 99 0 0 109 10 + 100 -6.9219668 306.44177 100 77 15 85 0 0 94 9 + 200 -6.8175255 306.64254 200 164 23 77 0 0 87 10 + 300 -5.2482381 331.67831 300 248 21 79 0 0 85 6 + 400 -7.4531538 285.3495 400 326 17 83 0 0 89 6 + 500 -6.9662528 286.2123 500 408 14 86 0 0 95 9 + 600 -6.528214 291.41762 600 492 14 86 0 0 95 9 + 700 -6.290871 271.50948 700 567 14 86 0 0 96 10 + 800 -6.4944741 300.66261 800 650 23 77 0 0 83 6 + 900 -8.0414672 305.6179 900 731 25 75 0 0 84 9 + 1000 -8.5694583 297.69733 1000 810 25 75 0 0 83 8 + 1100 -8.9364878 292.52429 1100 891 22 78 0 0 88 10 + 1200 -8.733737 316.79814 1200 963 21 79 0 0 88 9 + 1300 -8.0946506 350.85016 1300 1043 21 79 0 0 88 9 + 1400 -7.1835794 283.90836 1400 1128 17 83 0 0 93 10 + 1500 -6.5673667 306.70066 1500 1208 23 77 0 0 87 10 + 1600 -7.0819412 272.07245 1600 1288 21 79 0 0 89 10 + 1700 -5.8907481 301.00694 1700 1365 28 72 0 0 84 12 + 1800 -4.9932405 282.95729 1800 1447 24 76 0 0 82 6 + 1900 -4.3273176 296.96436 1900 1527 22 78 0 0 86 8 + 2000 -4.4859306 299.76741 2000 1600 26 74 0 0 81 7 +Loop time of 1.15911 on 1 procs for 2000 steps with 188 atoms + +Performance: 1490.798 ns/day, 0.016 hours/ns, 1725.460 timesteps/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.036171 | 0.036171 | 0.036171 | 0.0 | 3.12 +Kspace | 0.37716 | 0.37716 | 0.37716 | 0.0 | 32.54 +Neigh | 0.022399 | 0.022399 | 0.022399 | 0.0 | 1.93 +Comm | 0.005311 | 0.005311 | 0.005311 | 0.0 | 0.46 +Output | 0.000745 | 0.000745 | 0.000745 | 0.0 | 0.06 +Modify | 0.71566 | 0.71566 | 0.71566 | 0.0 | 61.74 +Other | | 0.001663 | | | 0.14 + +Nlocal: 188.000 ave 188 max 188 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 411.000 ave 411 max 411 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1268.00 ave 1268 max 1268 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 1268 +Ave neighs/atom = 6.7446809 +Neighbor list builds = 2195 +Dangerous builds = 15 +Total wall time: 0:00:01 diff --git a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 new file mode 100644 index 0000000000..7ab22c1f36 --- /dev/null +++ b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 @@ -0,0 +1,145 @@ +LAMMPS (10 Feb 2021) +# Charge regulation lammps for simple weak electrolyte + +units real +atom_style charge +neighbor 3.0 bin +read_data data.chreg-acid-real +Reading data file ... + orthogonal box = (-180.00000 -180.00000 -180.00000) to (180.00000 180.00000 180.00000) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 219 atoms + read_data CPU = 0.002 seconds + +#real units +variable sigma equal 7.2 # particle diameter 0.72 nm +variable temperature equal 298 # temperature 298 K +variable kb index 0.0019872067 # kB in Kcal/mol/K +variable epsilon equal ${kb}*${temperature} +variable epsilon equal 0.0019872067*${temperature} +variable epsilon equal 0.0019872067*298 +variable tunit equal 2000 # time unit is 2000 fs +variable timestep equal 0.005*${tunit} +variable timestep equal 0.005*2000 + +variable cut_long equal 12.5*${sigma} +variable cut_long equal 12.5*7.2 +variable nevery equal 100 +variable nmc equal 100 +variable pH equal 7.0 +variable pKa equal 6.0 +variable pIm equal 3.0 +variable pIp equal 3.0 + +variable cut_lj equal 2^(1.0/6.0)*${sigma} +variable cut_lj equal 2^(1.0/6.0)*7.2 +velocity all create ${temperature} 8008 loop geom +velocity all create 298 8008 loop geom + +pair_style lj/cut/coul/long ${cut_lj} ${cut_long} +pair_style lj/cut/coul/long 8.08172674782749 ${cut_long} +pair_style lj/cut/coul/long 8.08172674782749 90 +pair_coeff * * ${epsilon} ${sigma} +pair_coeff * * 0.5921875966 ${sigma} +pair_coeff * * 0.5921875966 7.2 +kspace_style pppm 1.0e-3 +dielectric 78 +pair_modify shift yes + +######### VERLET INTEGRATION WITH LANGEVIN THERMOSTAT ########### +fix fnve all nve +compute dtemp all temp +compute_modify dtemp dynamic yes +fix fT all langevin $(v_temperature) $(v_temperature) $(v_tunit) 123 +fix fT all langevin 298 $(v_temperature) $(v_tunit) 123 +fix fT all langevin 298 298 $(v_tunit) 123 +fix fT all langevin 298 298 2000 123 +fix_modify fT temp dtemp + +fix chareg all charge/regulation 2 3 acid_type 1 pH ${pH} pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa ${pKa} pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp ${pIp} pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm ${pIm} lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery ${nevery} nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery 100 nmc ${nmc} seed 2345 tempfixid fT +fix chareg all charge/regulation 2 3 acid_type 1 pH 7 pKa 6 pIp 3 pIm 3 lunit_nm 0.1 nevery 100 nmc 100 seed 2345 tempfixid fT +thermo 100 +thermo_style custom step pe c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] +timestep ${timestep} +timestep 10 +run 2000 +PPPM initialization ... + using 12-bit tables for long-range coulomb (../kspace.cpp:339) + G vector (1/distance) = 0.019408615 + grid = 8 8 8 + stencil order = 5 + estimated absolute RMS force accuracy = 0.00012527706 + estimated relative force accuracy = 3.7726815e-07 + using double precision KISS FFT + 3d grid and FFT values/proc = 1053 128 +0 atoms in group FixChargeRegulation:exclusion_group:chareg +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (../neighbor.cpp:486) +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 93 + ghost atom cutoff = 93 + binsize = 46.5, bins = 8 8 8 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.624 | 3.624 | 3.624 Mbytes +Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] + 0 -6.4798431 298 0 0 1 99 0 0 109 10 + 100 -7.9144028 317.49717 100 73 15 85 0 0 94 9 + 200 -5.9183735 315.31348 200 157 24 76 0 0 86 10 + 300 -6.7851544 295.82718 300 243 21 79 0 0 86 7 + 400 -6.3777493 297.53619 400 316 16 84 0 0 91 7 + 500 -6.0281518 287.62012 500 398 15 85 0 0 93 8 + 600 -8.4403907 301.30302 600 483 14 86 0 0 94 8 + 700 -9.6450828 305.33793 700 563 15 85 0 0 96 11 + 800 -6.1034312 307.18396 800 646 20 80 0 0 85 5 + 900 -7.3098915 295.21039 900 729 24 76 0 0 86 10 + 1000 -6.721795 316.34459 1000 803 25 75 0 0 84 9 + 1100 -7.389073 326.53025 1100 882 23 77 0 0 87 10 + 1200 -9.6721231 327.15878 1200 958 20 80 0 0 89 9 + 1300 -7.4738885 295.09338 1300 1045 20 80 0 0 88 8 + 1400 -7.8136191 297.62074 1400 1127 18 82 0 0 92 10 + 1500 -7.6522652 284.20977 1500 1204 24 76 0 0 85 9 + 1600 -8.473883 293.37704 1600 1283 22 78 0 0 92 14 + 1700 -5.7030629 327.53233 1700 1366 26 74 0 0 83 9 + 1800 -6.1817998 278.22073 1800 1447 21 79 0 0 84 5 + 1900 -5.3113964 293.69193 1900 1526 24 76 0 0 85 9 + 2000 -5.5827334 307.91424 2000 1599 26 74 0 0 80 6 +Loop time of 0.547632 on 4 procs for 2000 steps with 186 atoms + +Performance: 3155.407 ns/day, 0.008 hours/ns, 3652.091 timesteps/s +99.5% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.008417 | 0.01004 | 0.010817 | 1.0 | 1.83 +Kspace | 0.17103 | 0.17157 | 0.17208 | 0.1 | 31.33 +Neigh | 0.004536 | 0.0052815 | 0.005857 | 0.7 | 0.96 +Comm | 0.023141 | 0.02398 | 0.02617 | 0.8 | 4.38 +Output | 0.000556 | 0.00063325 | 0.000864 | 0.0 | 0.12 +Modify | 0.33403 | 0.33441 | 0.33471 | 0.1 | 61.07 +Other | | 0.001711 | | | 0.31 + +Nlocal: 46.5000 ave 48 max 44 min +Histogram: 1 0 0 0 0 1 0 0 0 2 +Nghost: 241.500 ave 244 max 238 min +Histogram: 1 0 0 0 0 1 0 0 1 1 +Neighs: 303.750 ave 333 max 286 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 1215 +Ave neighs/atom = 6.5322581 +Neighbor list builds = 2196 +Dangerous builds = 12 +Total wall time: 0:00:00 From 7d95943b7e2ddb500addba2f69e78d7821eed3b5 Mon Sep 17 00:00:00 2001 From: tc387 Date: Mon, 12 Apr 2021 01:46:39 -0500 Subject: [PATCH 357/370] increased bin size in example input file to avoid dangerous builds --- .../misc/charge_regulation/in.chreg-acid-real | 2 +- .../log.11Apr21.chreg-acid-real.g++.1 | 66 +++++++------- .../log.11Apr21.chreg-acid-real.g++.4 | 88 +++++++++---------- 3 files changed, 78 insertions(+), 78 deletions(-) diff --git a/examples/USER/misc/charge_regulation/in.chreg-acid-real b/examples/USER/misc/charge_regulation/in.chreg-acid-real index 195b163d96..d7225f33ea 100644 --- a/examples/USER/misc/charge_regulation/in.chreg-acid-real +++ b/examples/USER/misc/charge_regulation/in.chreg-acid-real @@ -2,7 +2,7 @@ units real atom_style charge -neighbor 3.0 bin +neighbor 10.0 bin read_data data.chreg-acid-real #real units diff --git a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 index 3b766d662d..6e50ea5ef3 100644 --- a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 +++ b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.1 @@ -3,7 +3,7 @@ LAMMPS (10 Feb 2021) units real atom_style charge -neighbor 3.0 bin +neighbor 10.0 bin read_data data.chreg-acid-real Reading data file ... orthogonal box = (-180.00000 -180.00000 -180.00000) to (180.00000 180.00000 180.00000) @@ -83,16 +83,16 @@ WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulo Neighbor list info ... update every 1 steps, delay 10 steps, check yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 93 - ghost atom cutoff = 93 - binsize = 46.5, bins = 8 8 8 + master list distance cutoff = 100 + ghost atom cutoff = 100 + binsize = 50, bins = 8 8 8 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair lj/cut/coul/long, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton stencil: half/bin/3d/newton bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.707 | 3.707 | 3.707 Mbytes +Per MPI rank memory allocation (min/avg/max) = 3.708 | 3.708 | 3.708 Mbytes Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] 0 -6.4798431 298 0 0 1 99 0 0 109 10 100 -6.9219668 306.44177 100 77 15 85 0 0 94 9 @@ -104,42 +104,42 @@ Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] 700 -6.290871 271.50948 700 567 14 86 0 0 96 10 800 -6.4944741 300.66261 800 650 23 77 0 0 83 6 900 -8.0414672 305.6179 900 731 25 75 0 0 84 9 - 1000 -8.5694583 297.69733 1000 810 25 75 0 0 83 8 - 1100 -8.9364878 292.52429 1100 891 22 78 0 0 88 10 - 1200 -8.733737 316.79814 1200 963 21 79 0 0 88 9 - 1300 -8.0946506 350.85016 1300 1043 21 79 0 0 88 9 - 1400 -7.1835794 283.90836 1400 1128 17 83 0 0 93 10 - 1500 -6.5673667 306.70066 1500 1208 23 77 0 0 87 10 - 1600 -7.0819412 272.07245 1600 1288 21 79 0 0 89 10 - 1700 -5.8907481 301.00694 1700 1365 28 72 0 0 84 12 - 1800 -4.9932405 282.95729 1800 1447 24 76 0 0 82 6 - 1900 -4.3273176 296.96436 1900 1527 22 78 0 0 86 8 - 2000 -4.4859306 299.76741 2000 1600 26 74 0 0 81 7 -Loop time of 1.15911 on 1 procs for 2000 steps with 188 atoms + 1000 -8.5694583 298.73349 1000 810 25 75 0 0 83 8 + 1100 -8.6677368 269.67435 1100 894 22 78 0 0 87 9 + 1200 -8.2246183 284.14886 1200 969 22 78 0 0 88 10 + 1300 -7.7674621 320.04838 1300 1040 23 77 0 0 85 8 + 1400 -9.5186335 303.48091 1400 1124 18 82 0 0 93 11 + 1500 -5.8437493 271.40712 1500 1204 25 75 0 0 83 8 + 1600 -5.9149181 268.24708 1600 1285 23 77 0 0 90 13 + 1700 -6.5047738 303.79732 1700 1369 27 73 0 0 84 11 + 1800 -7.3010139 308.98213 1800 1450 22 78 0 0 83 5 + 1900 -6.3505397 306.94357 1900 1527 22 78 0 0 86 8 + 2000 -5.7144173 287.06184 2000 1605 27 73 0 0 80 7 +Loop time of 1.17189 on 1 procs for 2000 steps with 187 atoms -Performance: 1490.798 ns/day, 0.016 hours/ns, 1725.460 timesteps/s -99.5% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 1474.535 ns/day, 0.016 hours/ns, 1706.638 timesteps/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.036171 | 0.036171 | 0.036171 | 0.0 | 3.12 -Kspace | 0.37716 | 0.37716 | 0.37716 | 0.0 | 32.54 -Neigh | 0.022399 | 0.022399 | 0.022399 | 0.0 | 1.93 -Comm | 0.005311 | 0.005311 | 0.005311 | 0.0 | 0.46 -Output | 0.000745 | 0.000745 | 0.000745 | 0.0 | 0.06 -Modify | 0.71566 | 0.71566 | 0.71566 | 0.0 | 61.74 -Other | | 0.001663 | | | 0.14 +Pair | 0.035807 | 0.035807 | 0.035807 | 0.0 | 3.06 +Kspace | 0.37689 | 0.37689 | 0.37689 | 0.0 | 32.16 +Neigh | 0.008694 | 0.008694 | 0.008694 | 0.0 | 0.74 +Comm | 0.004793 | 0.004793 | 0.004793 | 0.0 | 0.41 +Output | 0.000746 | 0.000746 | 0.000746 | 0.0 | 0.06 +Modify | 0.74292 | 0.74292 | 0.74292 | 0.0 | 63.39 +Other | | 0.00205 | | | 0.17 -Nlocal: 188.000 ave 188 max 188 min +Nlocal: 187.000 ave 187 max 187 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 411.000 ave 411 max 411 min +Nghost: 437.000 ave 437 max 437 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1268.00 ave 1268 max 1268 min +Neighs: 1500.00 ave 1500 max 1500 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Total # of neighbors = 1268 -Ave neighs/atom = 6.7446809 -Neighbor list builds = 2195 -Dangerous builds = 15 +Total # of neighbors = 1500 +Ave neighs/atom = 8.0213904 +Neighbor list builds = 2080 +Dangerous builds = 0 Total wall time: 0:00:01 diff --git a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 index 7ab22c1f36..927e29c1f3 100644 --- a/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 +++ b/examples/USER/misc/charge_regulation/log.11Apr21.chreg-acid-real.g++.4 @@ -3,7 +3,7 @@ LAMMPS (10 Feb 2021) units real atom_style charge -neighbor 3.0 bin +neighbor 10.0 bin read_data data.chreg-acid-real Reading data file ... orthogonal box = (-180.00000 -180.00000 -180.00000) to (180.00000 180.00000 180.00000) @@ -83,9 +83,9 @@ WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulo Neighbor list info ... update every 1 steps, delay 10 steps, check yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 93 - ghost atom cutoff = 93 - binsize = 46.5, bins = 8 8 8 + master list distance cutoff = 100 + ghost atom cutoff = 100 + binsize = 50, bins = 8 8 8 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair lj/cut/coul/long, perpetual attributes: half, newton on @@ -95,51 +95,51 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 3.624 | 3.624 | 3.624 Mbytes Step PotEng c_dtemp f_chareg[1] f_chareg[2] f_chareg[3] f_chareg[4] f_chareg[5] f_chareg[6] f_chareg[7] f_chareg[8] 0 -6.4798431 298 0 0 1 99 0 0 109 10 - 100 -7.9144028 317.49717 100 73 15 85 0 0 94 9 - 200 -5.9183735 315.31348 200 157 24 76 0 0 86 10 - 300 -6.7851544 295.82718 300 243 21 79 0 0 86 7 - 400 -6.3777493 297.53619 400 316 16 84 0 0 91 7 - 500 -6.0281518 287.62012 500 398 15 85 0 0 93 8 - 600 -8.4403907 301.30302 600 483 14 86 0 0 94 8 - 700 -9.6450828 305.33793 700 563 15 85 0 0 96 11 - 800 -6.1034312 307.18396 800 646 20 80 0 0 85 5 - 900 -7.3098915 295.21039 900 729 24 76 0 0 86 10 - 1000 -6.721795 316.34459 1000 803 25 75 0 0 84 9 - 1100 -7.389073 326.53025 1100 882 23 77 0 0 87 10 - 1200 -9.6721231 327.15878 1200 958 20 80 0 0 89 9 - 1300 -7.4738885 295.09338 1300 1045 20 80 0 0 88 8 - 1400 -7.8136191 297.62074 1400 1127 18 82 0 0 92 10 - 1500 -7.6522652 284.20977 1500 1204 24 76 0 0 85 9 - 1600 -8.473883 293.37704 1600 1283 22 78 0 0 92 14 - 1700 -5.7030629 327.53233 1700 1366 26 74 0 0 83 9 - 1800 -6.1817998 278.22073 1800 1447 21 79 0 0 84 5 - 1900 -5.3113964 293.69193 1900 1526 24 76 0 0 85 9 - 2000 -5.5827334 307.91424 2000 1599 26 74 0 0 80 6 -Loop time of 0.547632 on 4 procs for 2000 steps with 186 atoms + 100 -7.6327126 304.68909 100 73 15 85 0 0 94 9 + 200 -6.1699041 272.19597 200 156 24 76 0 0 87 11 + 300 -7.7876571 288.90801 300 240 20 80 0 0 87 7 + 400 -6.3239918 274.65708 400 315 16 84 0 0 90 6 + 500 -5.3978659 257.49208 500 398 15 85 0 0 93 8 + 600 -5.6433949 322.52048 600 477 18 82 0 0 90 8 + 700 -6.5351367 269.20244 700 558 18 82 0 0 91 9 + 800 -6.2093085 315.21326 800 638 24 76 0 0 83 7 + 900 -7.0795998 311.93228 900 719 28 72 0 0 82 10 + 1000 -6.4668438 281.72674 1000 796 27 73 0 0 81 8 + 1100 -6.2377994 318.48594 1100 875 25 75 0 0 84 9 + 1200 -6.6305072 304.9091 1200 950 23 77 0 0 87 10 + 1300 -5.9624552 286.05027 1300 1029 22 78 0 0 86 8 + 1400 -4.4695814 261.81053 1400 1111 20 80 0 0 90 10 + 1500 -5.6928652 293.72403 1500 1191 24 76 0 0 86 10 + 1600 -6.8715413 290.47065 1600 1275 22 78 0 0 90 12 + 1700 -6.5067505 292.74735 1700 1356 25 75 0 0 85 10 + 1800 -5.3902702 307.79012 1800 1434 22 78 0 0 83 5 + 1900 -5.1407153 318.48918 1900 1510 21 79 0 0 87 8 + 2000 -4.9514719 281.87771 2000 1589 25 75 0 0 82 7 +Loop time of 0.562889 on 4 procs for 2000 steps with 189 atoms -Performance: 3155.407 ns/day, 0.008 hours/ns, 3652.091 timesteps/s -99.5% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 3069.876 ns/day, 0.008 hours/ns, 3553.097 timesteps/s +99.6% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.008417 | 0.01004 | 0.010817 | 1.0 | 1.83 -Kspace | 0.17103 | 0.17157 | 0.17208 | 0.1 | 31.33 -Neigh | 0.004536 | 0.0052815 | 0.005857 | 0.7 | 0.96 -Comm | 0.023141 | 0.02398 | 0.02617 | 0.8 | 4.38 -Output | 0.000556 | 0.00063325 | 0.000864 | 0.0 | 0.12 -Modify | 0.33403 | 0.33441 | 0.33471 | 0.1 | 61.07 -Other | | 0.001711 | | | 0.31 +Pair | 0.008399 | 0.010383 | 0.011765 | 1.2 | 1.84 +Kspace | 0.17501 | 0.17543 | 0.1757 | 0.1 | 31.17 +Neigh | 0.001833 | 0.0021325 | 0.002293 | 0.4 | 0.38 +Comm | 0.023099 | 0.024255 | 0.026645 | 0.9 | 4.31 +Output | 0.000465 | 0.000546 | 0.000783 | 0.0 | 0.10 +Modify | 0.3464 | 0.34669 | 0.34698 | 0.0 | 61.59 +Other | | 0.003452 | | | 0.61 -Nlocal: 46.5000 ave 48 max 44 min -Histogram: 1 0 0 0 0 1 0 0 0 2 -Nghost: 241.500 ave 244 max 238 min -Histogram: 1 0 0 0 0 1 0 0 1 1 -Neighs: 303.750 ave 333 max 286 min -Histogram: 2 0 0 0 1 0 0 0 0 1 +Nlocal: 47.2500 ave 57 max 41 min +Histogram: 1 1 0 1 0 0 0 0 0 1 +Nghost: 285.750 ave 303 max 263 min +Histogram: 1 0 0 0 1 0 0 0 1 1 +Neighs: 403.500 ave 548 max 324 min +Histogram: 2 0 0 1 0 0 0 0 0 1 -Total # of neighbors = 1215 -Ave neighs/atom = 6.5322581 -Neighbor list builds = 2196 -Dangerous builds = 12 +Total # of neighbors = 1614 +Ave neighs/atom = 8.5396825 +Neighbor list builds = 2081 +Dangerous builds = 0 Total wall time: 0:00:00 From bc25fa82688cb7506143454774115f0471dada1f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 09:59:02 -0400 Subject: [PATCH 358/370] full integration into documentation build system --- doc/src/Commands_fix.rst | 1 + doc/src/fix.rst | 1 + doc/src/fix_charge_regulation.rst | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 4793568288..671716e89d 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -46,6 +46,7 @@ OPT. * :doc:`bond/react ` * :doc:`bond/swap ` * :doc:`box/relax ` + * :doc:`charge/regulation ` * :doc:`client/md ` * :doc:`cmap ` * :doc:`colvars ` diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 2e516faa4e..109bfb00be 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -189,6 +189,7 @@ accelerated styles exist. * :doc:`bond/react ` - apply topology changes to model reactions * :doc:`bond/swap ` - Monte Carlo bond swapping * :doc:`box/relax ` - relax box size during energy minimization +* :doc:`charge/regulation ` - Monte Carlo sampling of charge regulation * :doc:`client/md ` - MD client for client/server simulations * :doc:`cmap ` - enables CMAP cross-terms of the CHARMM force field * :doc:`colvars ` - interface to the collective variables "Colvars" library diff --git a/doc/src/fix_charge_regulation.rst b/doc/src/fix_charge_regulation.rst index fb63c8d7a5..ef91db1e59 100644 --- a/doc/src/fix_charge_regulation.rst +++ b/doc/src/fix_charge_regulation.rst @@ -225,7 +225,7 @@ quantities: Restrictions """""""""""" -This fix is part of the USER-MISC package. It is only enabled if LAMMPS +This fix is part of the MC package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. @@ -243,7 +243,9 @@ the LJ potential must be shifted so that it vanishes at the cutoff. This can be easily achieved using the :doc:`pair_modify ` command, i.e., by using: *pair_modify shift yes*. -Note: Region restrictions are not yet implemented. +.. note:: + + Region restrictions are not yet implemented. Related commands """""""""""""""" @@ -253,7 +255,11 @@ Related commands Default """"""" -pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0; acid_type = -1; base_type = -1; lunit_nm = 0.71; temp = 1.0; nevery = 100; nmc = 100; xrd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves = [1/3, 1/3, 1/3], group-ID = all + +pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0; +acid_type = -1; base_type = -1; lunit_nm = 0.71; temp = 1.0; nevery = +100; nmc = 100; xrd = 0; seed = 0; tag = no; onlysalt = no, pmcmoves = +[1/3, 1/3, 1/3], group-ID = all ---------- @@ -267,4 +273,4 @@ pH = 7.0; pKa = 100.0; pKb = 100.0; pIp = 5.0; pIm = 5.0; pKs = 14.0; acid_type .. _Landsgesell: -**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, "Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning", Macromolecules 53, 3007–3020 (2020). +**(Landsgesell)** J. Landsgesell, P. Hebbeker, O. Rud, R. Lunkad, P. Kosovan, and C. Holm, "Grand-reaction method for simulations of ionization equilibria coupled to ion partitioning", Macromolecules 53, 3007-3020 (2020). From 0c2fc07cc5462e28cd228028aea4be3070c981d0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:00:52 -0400 Subject: [PATCH 359/370] add USER-OMP version of pair style coul/cut/global --- src/USER-OMP/pair_coul_cut_global_omp.cpp | 44 ++++++++++++++++++ src/USER-OMP/pair_coul_cut_global_omp.h | 55 +++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/USER-OMP/pair_coul_cut_global_omp.cpp create mode 100644 src/USER-OMP/pair_coul_cut_global_omp.h diff --git a/src/USER-OMP/pair_coul_cut_global_omp.cpp b/src/USER-OMP/pair_coul_cut_global_omp.cpp new file mode 100644 index 0000000000..36fee39fc8 --- /dev/null +++ b/src/USER-OMP/pair_coul_cut_global_omp.cpp @@ -0,0 +1,44 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "pair_coul_cut_global_omp.h" + +#include "error.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairCoulCutGlobalOMP::coeff(int narg, char **arg) +{ + if (narg != 2) + error->all(FLERR,"Incorrect args for pair coefficients"); + + PairCoulCut::coeff(narg,arg); +} + + +/* ---------------------------------------------------------------------- */ + +void *PairCoulCutGlobalOMP::extract(const char *str, int &dim) +{ + dim = 0; + if (strcmp(str,"cut_coul") == 0) return (void *) &cut_global; + dim = 2; + if (strcmp(str,"scale") == 0) return (void *) scale; + return nullptr; +} diff --git a/src/USER-OMP/pair_coul_cut_global_omp.h b/src/USER-OMP/pair_coul_cut_global_omp.h new file mode 100644 index 0000000000..a2cb4a1dbe --- /dev/null +++ b/src/USER-OMP/pair_coul_cut_global_omp.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(coul/cut/global/omp,PairCoulCutGlobalOMP) + +#else + +#ifndef LMP_PAIR_COUL_CUT_GLOBAL_OMP_H +#define LMP_PAIR_COUL_CUT_GLOBAL_OMP_H + +#include "pair_coul_cut_omp.h" + +namespace LAMMPS_NS { + +class PairCoulCutGlobalOMP : public PairCoulCutOMP { + public: + PairCoulCutGlobalOMP(class LAMMPS *lmp) : PairCoulCutOMP(lmp) {} + void coeff(int, char **); + void *extract(const char *, int &); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Pair style coul/cut requires atom attribute q + +The atom style defined does not have these attributes. + +*/ From 9658b8e645f1fb611e52e1771e3a4b4cd6be7224 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:05:52 -0400 Subject: [PATCH 360/370] move fix charge/regulation to MC package (examples stay in place for now) --- doc/src/Packages_details.rst | 6 +++++- src/{USER-MISC => MC}/fix_charge_regulation.cpp | 0 src/{USER-MISC => MC}/fix_charge_regulation.h | 0 src/USER-MISC/README | 1 - 4 files changed, 5 insertions(+), 2 deletions(-) rename src/{USER-MISC => MC}/fix_charge_regulation.cpp (100%) rename src/{USER-MISC => MC}/fix_charge_regulation.h (100%) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index b662ae73c7..d5c011012d 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -585,7 +585,7 @@ MC package Several fixes and a pair style that have Monte Carlo (MC) or MC-like attributes. These include fixes for creating, breaking, and swapping bonds, for performing atomic swaps, and performing grand-canonical MC -(GCMC) in conjunction with dynamics. +(GCMC) or similar processes in conjunction with dynamics. **Supporting info:** @@ -593,8 +593,12 @@ bonds, for performing atomic swaps, and performing grand-canonical MC * :doc:`fix atom/swap ` * :doc:`fix bond/break ` * :doc:`fix bond/create ` +* :doc:`fix bond/create/angle ` * :doc:`fix bond/swap ` +* :doc:`fix charge/regulation ` * :doc:`fix gcmc ` +* :doc:`fix tfmc ` +* :doc:`fix widom ` * :doc:`pair_style dsmc ` * https://lammps.sandia.gov/movies.html#gcmc diff --git a/src/USER-MISC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp similarity index 100% rename from src/USER-MISC/fix_charge_regulation.cpp rename to src/MC/fix_charge_regulation.cpp diff --git a/src/USER-MISC/fix_charge_regulation.h b/src/MC/fix_charge_regulation.h similarity index 100% rename from src/USER-MISC/fix_charge_regulation.h rename to src/MC/fix_charge_regulation.h diff --git a/src/USER-MISC/README b/src/USER-MISC/README index ef25a0c116..314fe6146e 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -53,7 +53,6 @@ dihedral_style table/cut, Mike Salerno, ksalerno@pha.jhu.edu, 11 May 18 fix accelerate/cos, Zheng Gong (ENS de Lyon), z.gong@outlook.com, 24 Apr 20 fix addtorque, Laurent Joly (U Lyon), ljoly.ulyon at gmail.com, 8 Aug 11 fix ave/correlate/long, Jorge Ramirez (UPM Madrid), jorge.ramirez at upm.es, 21 Oct 2015 -fix charge_regulation, Tine Curk and Jiaxing Yuan, tcurk5@gmail.com, 02 Feb 2021 fix electron/stopping/fit, James Stewart (SNL), jstewa .at. sandia.gov, 23 Sep 2020 fix electron/stopping, Konstantin Avchaciov, k.avchachov at gmail.com, 26 Feb 2019 fix ffl, David Wilkins (EPFL Lausanne), david.wilkins @ epfl.ch, 28 Sep 2018 From 0c79673d931091f8628c2f705c5133c39a471fed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:14:31 -0400 Subject: [PATCH 361/370] make fix charge/regulation compatible with USER-INTEL package --- src/MC/fix_charge_regulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 5479082158..0aa3def153 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -45,7 +45,6 @@ #include #include - using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -1082,6 +1081,7 @@ double FixChargeRegulation::energy_full() { if (force->kspace) force->kspace->compute(eflag, vflag); + if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force) modify->post_force(vflag); if (modify->n_end_of_step) modify->end_of_step(); update->eflag_global = update->ntimestep; From a572142e6f4088eddf0f48e8a5d76232a0ee23ec Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:25:10 -0400 Subject: [PATCH 362/370] fix inconsistent new/delete --- src/MC/fix_charge_regulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 0aa3def153..797d7fb5b0 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -130,7 +130,7 @@ FixChargeRegulation::~FixChargeRegulation() { delete random_equal; delete random_unequal; - delete idftemp; + delete[] idftemp; if (group) { int igroupall = group->find("all"); From 65ba022c2a0ce3ab6e4822bfdc279679e511822c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:25:24 -0400 Subject: [PATCH 363/370] simplify --- src/MC/fix_charge_regulation.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 797d7fb5b0..47adad3f6d 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -1295,10 +1295,7 @@ void FixChargeRegulation::options(int narg, char **arg) { } else if (strcmp(arg[iarg], "tempfixid") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix charge/regulation command"); - int n = strlen(arg[iarg + 1]) + 1; - delete[] idftemp; - idftemp = new char[n]; - strcpy(idftemp, arg[iarg + 1]); + idftemp = utils::strdup(arg[iarg+1]); setThermoTemperaturePointer(); iarg += 2; } else if (strcmp(arg[iarg], "rxd") == 0) { @@ -1371,9 +1368,7 @@ void FixChargeRegulation::options(int narg, char **arg) { ngroupsmax * sizeof(char *), "fix_charge_regulation:groupstrings"); } - int n = strlen(arg[iarg + 1]) + 1; - groupstrings[ngroups] = new char[n]; - strcpy(groupstrings[ngroups], arg[iarg + 1]); + groupstrings[ngroups] = utils::strdup(arg[iarg+1]); ngroups++; iarg += 2; } else error->all(FLERR, "Illegal fix charge/regulation command"); From 82e1c4fb121c7e5c33f40406b0ed0c6f1b831121 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 10:25:39 -0400 Subject: [PATCH 364/370] silence compiler warnings --- src/MC/fix_charge_regulation.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 47adad3f6d..34391b86fb 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -14,6 +14,7 @@ /* ---------------------------------------------------------------------- Contributing author: Tine Curk (tcurk5@gmail.com) and Jiaxing Yuan (yuanjiaxing123@hotmail.com) ------------------------------------------------------------------------- */ + #include "fix_charge_regulation.h" #include "angle.h" @@ -652,7 +653,7 @@ void FixChargeRegulation::backward_ions() { double energy_before = energy_stored; double factor; - int mask1_tmp, mask2_tmp; + int mask1_tmp = 0, mask2_tmp = 0; double *dummyp = nullptr; int m1 = -1, m2 = -1; @@ -724,12 +725,6 @@ void FixChargeRegulation::backward_ions() { atom->mask[m2] = mask2_tmp; } } - } else { - // reassign original charge and mask - if (m1 >= 0) { - atom->q[m1] = 1; - atom->mask[m1] = mask1_tmp; - } } } } @@ -738,7 +733,7 @@ void FixChargeRegulation::forward_ions_multival() { double energy_before = energy_stored; double factor = 1; - double *dummyp; + double *dummyp = nullptr; int mm[salt_charge_ratio + 1];// particle ID array for all ions to be inserted if (salt_charge[0] <= -salt_charge[1]) { @@ -792,7 +787,7 @@ void FixChargeRegulation::backward_ions_multival() { double energy_before = energy_stored; double factor = 1; - double *dummyp; // dummy pointer + double *dummyp = nullptr; // dummy pointer int mm[salt_charge_ratio + 1]; // particle ID array for all deleted ions double qq[salt_charge_ratio + 1]; // charge array for all deleted ions int mask_tmp[salt_charge_ratio + 1]; // temporary mask array From 3925bcc1dee5be618f25b293ad234ced6e5e5366 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 13:35:42 -0400 Subject: [PATCH 365/370] apply requested changes do pair style hybrid doc --- doc/src/pair_hybrid.rst | 60 ++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/doc/src/pair_hybrid.rst b/doc/src/pair_hybrid.rst index 9fdba318d9..e4e253caf9 100644 --- a/doc/src/pair_hybrid.rst +++ b/doc/src/pair_hybrid.rst @@ -14,7 +14,8 @@ pair_style hybrid/overlay command Accelerator Variants: *hybrid/overlay/kk* -pair_style hybrid/scale command +pair_style hybrid/scaled command +================================== Syntax """""" @@ -42,6 +43,10 @@ Examples pair_coeff * * lj/cut 1.0 1.0 pair_coeff * * coul/long + pair_style hybrid/scaled 0.5 tersoff 0.5 sw + pair_coeff * * tersoff Si.tersoff Si + pair_coeff * * sw Si.sw Si + variable one equal ramp(1.0,0.0) variable two equal 1.0-v_one pair_style hybrid/scaled v_one lj/cut 2.5 v_two morse 2.5 @@ -57,11 +62,11 @@ exactly one pair style is assigned to each pair of atom types. With the *hybrid/overlay* and *hybrid/scaled* styles, one or more pair styles can be assigned to each pair of atom types. The assignment of pair styles to type pairs is made via the :doc:`pair_coeff ` command. -The *hybrid/scaled* style differs from the *hybrid/overlay* style by -requiring a factor for each pair style that is used to scale all -forces, energies and stresses computed by each sub-style. Because of -the additional complexity, the *hybrid/scaled* style will have more -overhead and thus will be a bit slower than *hybrid/overlay*. +The major difference between the *hybrid/overlay* and *hybrid/scaled* +styles is that the *hybrid/scaled* adds a scale factor for each +sub-style contribution to forces, energies and stresses. Because of the +added complexity, the *hybrid/scaled* style has more overhead and thus +may be slower than *hybrid/overlay*. Here are two examples of hybrid simulations. The *hybrid* style could be used for a simulation of a metal droplet on a LJ surface. The metal @@ -76,34 +81,35 @@ and *coul/long* together gives the same result as if the would be more efficient to use the single combined potential, but in general any combination of pair potentials can be used together in to produce an interaction that is not encoded in any single pair_style -file, e.g. adding Coulombic forces between granular particles. The -*hybrid/scaled* style enables more complex combinations of pair styles -than a simple sum as *hybrid/overlay* does; there may be fractional -contributions from sub-styles or contributions may be subtracted with a -negative scale factor. Furthermore, since the scale factors can be -variables that may change during a simulation, which would allow, for -instance, to smoothly switch between two different pair styles or two -different parameter sets. +file, e.g. adding Coulombic forces between granular particles. + +If the *hybrid/scaled* style is used instead of *hybrid/overlay*\ , +contributions from sub-styles are weighted by their scale factors, which +may be fractional or even negative. Furthermore the scale factors may +be variables that may change during a simulation. This enables +switching smoothly between two different pair styles or two different +parameter sets during a run. All pair styles that will be used are listed as "sub-styles" following the *hybrid* or *hybrid/overlay* keyword, in any order. In case of the *hybrid/scaled* pair style, each sub-style is prefixed with a scale factor. The scale factor is either a floating point number or an equal -style (or equivalent) variable. Each sub-style's name is followed by its -usual arguments, as illustrated in the examples above. See the doc -pages of individual pair styles for a listing and explanation of the -appropriate arguments. +style (or equivalent) variable. Each sub-style's name is followed by +its usual arguments, as illustrated in the examples above. See the doc +pages of the individual pair styles for a listing and explanation of the +appropriate arguments for them. Note that an individual pair style can be used multiple times as a -sub-style. For efficiency this should only be done if your model -requires it. E.g. if you have different regions of Si and C atoms and -wish to use a Tersoff potential for pure Si for one set of atoms, and -a Tersoff potential for pure C for the other set (presumably with some -third potential for Si-C interactions), then the sub-style *tersoff* -could be listed twice. But if you just want to use a Lennard-Jones or -other pairwise potential for several different atom type pairs in your -model, then you should just list the sub-style once and use the -pair_coeff command to assign parameters for the different type pairs. +sub-style. For efficiency reasons this should only be done if your +model requires it. E.g. if you have different regions of Si and C atoms +and wish to use a Tersoff potential for pure Si for one set of atoms, +and a Tersoff potential for pure C for the other set (presumably with +some third potential for Si-C interactions), then the sub-style +*tersoff* could be listed twice. But if you just want to use a +Lennard-Jones or other pairwise potential for several different atom +type pairs in your model, then you should just list the sub-style once +and use the pair_coeff command to assign parameters for the different +type pairs. .. note:: From ee38452f14d3cd1d8549cae15223443606c7dd46 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 14:52:17 -0400 Subject: [PATCH 366/370] fix bug causing a failed download when using cmake -B --- cmake/Modules/Packages/USER-PACE.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/Packages/USER-PACE.cmake b/cmake/Modules/Packages/USER-PACE.cmake index df1fb023a5..66f228017c 100644 --- a/cmake/Modules/Packages/USER-PACE.cmake +++ b/cmake/Modules/Packages/USER-PACE.cmake @@ -5,7 +5,7 @@ mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) # download library sources to build folder -file(DOWNLOAD ${PACELIB_URL} ./libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) +file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz SHOW_PROGRESS EXPECTED_HASH MD5=${PACELIB_MD5}) # uncompress downloaded sources execute_process( From 04248c2ccdf41f8e2977e72ce99f1a45715e3463 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 14:52:35 -0400 Subject: [PATCH 367/370] finalize CMake build docs --- doc/src/Build_extras.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 726374a012..12bb33f264 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -1255,14 +1255,23 @@ USER-PACE package This package requires a library that can be downloaded and built in lib/pace or somewhere else, which must be done before building -LAMMPS with this package. +LAMMPS with this package. The code for the library can be found +at: `https://github.com/ICAMS/lammps-user-pace/ `_ .. tabs:: .. tab:: CMake build - The library download and build will happen automatically when USER-PACE - is requested. + By default the library will be downloaded from the git repository + and built automatically when the USER-PACE package is enabled with + ``-D PKG_USER-PACE=yes``. The location for the sources may be + customized by setting the variable ``PACELIB_URL`` when + configuring with CMake (e.g. to use a local archive on machines + without internet access). Since CMake checks the validity of the + archive with ``md5sum`` you may also need to set ``PACELIB_MD5`` + if you provide a different library version than what is downloaded + automatically. + .. tab:: Traditional make From f1e5d1115169ecbdb8977ed3bfd57d24667b2d51 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 12 Apr 2021 14:52:53 -0400 Subject: [PATCH 368/370] add LAMMPS distribution header --- src/USER-PACE/pair_pace.cpp | 13 +++++++++++++ src/USER-PACE/pair_pace.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/USER-PACE/pair_pace.cpp b/src/USER-PACE/pair_pace.cpp index f59291b33e..d6eda0f511 100644 --- a/src/USER-PACE/pair_pace.cpp +++ b/src/USER-PACE/pair_pace.cpp @@ -1,3 +1,16 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + /* Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, diff --git a/src/USER-PACE/pair_pace.h b/src/USER-PACE/pair_pace.h index 37509cff5e..4d5ddcb9e8 100644 --- a/src/USER-PACE/pair_pace.h +++ b/src/USER-PACE/pair_pace.h @@ -1,3 +1,13 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + /* Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, Sarath Menon^1, Matteo Rinaldi^1, Thomas Hammerschmidt^1, Matous Mrovec^1, From 47814292a119f42bd77881e1854c5fae23449695 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 12 Apr 2021 19:57:27 -0400 Subject: [PATCH 369/370] Make dump cfg/gz, cfg/zstd compatible to 'buffer no' option --- src/COMPRESS/dump_cfg_gz.cpp | 67 ++++++++++++++++++- src/COMPRESS/dump_cfg_zstd.cpp | 67 ++++++++++++++++++- unittest/formats/test_dump_cfg_compressed.cpp | 33 +++++++++ 3 files changed, 165 insertions(+), 2 deletions(-) diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 23c0d82429..c5942c1fc5 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -136,7 +136,72 @@ void DumpCFGGZ::write_header(bigint n) void DumpCFGGZ::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + if (unwrapflag == 0) { + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (j == 0) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%f \n", mybuf[m]); + } else if (j == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); + } else if (j >= 2) { + if (vtype[j] == Dump::INT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + else if (vtype[j] == Dump::STRING) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + else if (vtype[j] == Dump::BIGINT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump cfg/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } else if (unwrapflag == 1) { + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (j == 0) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%f \n", mybuf[m]); + } else if (j == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); + } else if (j >= 2 && j <= 4) { + double unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], unwrap_coord); + } else if (j >= 5) { + if (vtype[j] == Dump::INT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + else if (vtype[j] == Dump::STRING) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + else if (vtype[j] == Dump::BIGINT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump cfg/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } + } } /* ---------------------------------------------------------------------- */ diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index 5bc6ac86dc..0ea92f3807 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -148,7 +148,72 @@ void DumpCFGZstd::write_header(bigint n) void DumpCFGZstd::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + if (unwrapflag == 0) { + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (j == 0) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%f \n", mybuf[m]); + } else if (j == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); + } else if (j >= 2) { + if (vtype[j] == Dump::INT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + else if (vtype[j] == Dump::STRING) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + else if (vtype[j] == Dump::BIGINT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump cfg/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } else if (unwrapflag == 1) { + int m = 0; + for (int i = 0; i < n; i++) { + for (int j = 0; j < size_one; j++) { + int written = 0; + if (j == 0) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%f \n", mybuf[m]); + } else if (j == 1) { + written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); + } else if (j >= 2 && j <= 4) { + double unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], unwrap_coord); + } else if (j >= 5) { + if (vtype[j] == Dump::INT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + else if (vtype[j] == Dump::DOUBLE) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); + else if (vtype[j] == Dump::STRING) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); + else if (vtype[j] == Dump::BIGINT) + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + } + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump cfg/gz output"); + } + m++; + } + writer.write("\n", 1); + } + } + } } /* ---------------------------------------------------------------------- */ diff --git a/unittest/formats/test_dump_cfg_compressed.cpp b/unittest/formats/test_dump_cfg_compressed.cpp index 6d5e8bcf04..1a00f9520e 100644 --- a/unittest/formats/test_dump_cfg_compressed.cpp +++ b/unittest/formats/test_dump_cfg_compressed.cpp @@ -66,6 +66,39 @@ TEST_F(DumpCfgCompressTest, compressed_run0) delete_file(converted_file_0); } +TEST_F(DumpCfgCompressTest, compressed_no_buffer_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "no_buffer_run*.melt.cfg"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + + auto base_name_0 = "no_buffer_run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + + if(compression_style == "cfg/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no", "buffer no", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, fields, "buffer no", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + TEST_F(DumpCfgCompressTest, compressed_unwrap_run0) { if (!COMPRESS_BINARY) GTEST_SKIP(); From dba3cce883b8c89fa5a012818990f4d851532bc1 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 12 Apr 2021 20:03:58 -0400 Subject: [PATCH 370/370] Make dump xyz/gz, xyz/zstd compatible to 'buffer no' option --- src/COMPRESS/dump_xyz_gz.cpp | 19 +++++++++++- src/COMPRESS/dump_xyz_zstd.cpp | 19 +++++++++++- unittest/formats/test_dump_xyz_compressed.cpp | 31 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index 0697f19ce3..abd6e7fa78 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -109,7 +109,24 @@ void DumpXYZGZ::write_header(bigint ndump) void DumpXYZGZ::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + int written = snprintf(vbuffer, VBUFFER_SIZE, format, + typenames[static_cast (mybuf[m+1])], + mybuf[m+2],mybuf[m+3],mybuf[m+4]); + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump xyz/gz output"); + } + m += size_one; + } + } } /* ---------------------------------------------------------------------- */ diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index cb75542337..74e482717b 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -120,7 +120,24 @@ void DumpXYZZstd::write_header(bigint ndump) void DumpXYZZstd::write_data(int n, double *mybuf) { - writer.write(mybuf, n); + if (buffer_flag) { + writer.write(mybuf, n); + } else { + constexpr size_t VBUFFER_SIZE = 256; + char vbuffer[VBUFFER_SIZE]; + int m = 0; + for (int i = 0; i < n; i++) { + int written = snprintf(vbuffer, VBUFFER_SIZE, format, + typenames[static_cast (mybuf[m+1])], + mybuf[m+2],mybuf[m+3],mybuf[m+4]); + if (written > 0) { + writer.write(vbuffer, written); + } else if (written < 0) { + error->one(FLERR, "Error while writing dump xyz/gz output"); + } + m += size_one; + } + } } /* ---------------------------------------------------------------------- */ diff --git a/unittest/formats/test_dump_xyz_compressed.cpp b/unittest/formats/test_dump_xyz_compressed.cpp index b627cb5a99..d9aa8e370d 100644 --- a/unittest/formats/test_dump_xyz_compressed.cpp +++ b/unittest/formats/test_dump_xyz_compressed.cpp @@ -60,6 +60,37 @@ TEST_F(DumpXYZCompressTest, compressed_run0) delete_file(converted_file_0); } +TEST_F(DumpXYZCompressTest, compressed_no_buffer_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "no_buffer_run*.melt.xyz"; + auto base_name_0 = "no_buffer_run0.melt.xyz"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + + if(compression_style == "xyz/zstd") { + generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no", "buffer no", 0); + } else { + generate_text_and_compressed_dump(text_files, compressed_files, "", "buffer no", 0); + } + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + TEST_F(DumpXYZCompressTest, compressed_multi_file_run1) { if (!COMPRESS_BINARY) GTEST_SKIP();