From 42b4ff4cc5570d6bdd5afaddbcca214d27bbbb91 Mon Sep 17 00:00:00 2001 From: alphataubio Date: Sat, 8 Jun 2024 21:31:31 -0400 Subject: [PATCH] revert to develop test_angle_style, kokkos_omp test is in kokkos-unit-testing branch --- unittest/force-styles/test_angle_style.cpp | 126 +-------------------- 1 file changed, 1 insertion(+), 125 deletions(-) diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index 683ce48877..010fabd6e2 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -138,9 +138,8 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton } command("run 0 post no"); - command("variable write_data_pair index ii"); command("write_restart " + cfg.basename + ".restart"); - command("write_data " + cfg.basename + ".data pair ${write_data_pair}"); + command("write_data " + cfg.basename + ".data"); command("write_coeff " + cfg.basename + "-coeffs.in"); return lmp; @@ -530,126 +529,6 @@ TEST(AngleStyle, omp) if (!verbose) ::testing::internal::GetCapturedStdout(); }; -TEST(AngleStyle, kokkos_omp) -{ - if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); - if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); - if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); - - LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite", - "-k", "on", "t", "4", "-sf", "kk"}; - - ::testing::internal::CaptureStdout(); - LAMMPS *lmp = init_lammps(args, test_config, true); - - std::string output = ::testing::internal::GetCapturedStdout(); - if (verbose) std::cout << output; - - if (!lmp) { - std::cerr << "One or more prerequisite styles with /kk 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); - - // relax error a bit for KOKKOS package - double epsilon = 5.0 * test_config.epsilon; - - ErrorStats stats; - auto angle = lmp->force->angle; - - EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon); - EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, epsilon); - - stats.reset(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); - if (print_stats) std::cerr << "init_energy stats, newton on: " << stats << std::endl; - - if (!verbose) ::testing::internal::CaptureStdout(); - run_lammps(lmp); - if (!verbose) ::testing::internal::GetCapturedStdout(); - - EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon); - EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, epsilon); - - stats.reset(); - int id = lmp->modify->find_compute("sum"); - double energy = lmp->modify->compute[id]->compute_scalar(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.run_energy, epsilon); - EXPECT_FP_LE_WITH_EPS(angle->energy, energy, epsilon); - if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl; - - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - lmp = init_lammps(args, test_config, false); - if (!verbose) ::testing::internal::GetCapturedStdout(); - - // skip over these tests if newton bond is forced to be on - if (lmp->force->newton_bond == 0) { - angle = lmp->force->angle; - - EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon); - EXPECT_STRESS("init_stress (newton off)", angle->virial, test_config.init_stress, - 2 * epsilon); - - stats.reset(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, 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(); - - EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon); - EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, epsilon); - - stats.reset(); - id = lmp->modify->find_compute("sum"); - energy = lmp->modify->compute[id]->compute_scalar(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.run_energy, epsilon); - EXPECT_FP_LE_WITH_EPS(angle->energy, energy, epsilon); - if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl; - } - - if (!verbose) ::testing::internal::CaptureStdout(); - restart_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - - angle = lmp->force->angle; - EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon); - EXPECT_STRESS("restart_stress", angle->virial, test_config.init_stress, epsilon); - - stats.reset(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); - if (print_stats) std::cerr << "restart_energy stats:" << stats << std::endl; - - if (!verbose) ::testing::internal::CaptureStdout(); - data_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); - - angle = lmp->force->angle; - EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon); - EXPECT_STRESS("data_stress", angle->virial, test_config.init_stress, epsilon); - - stats.reset(); - EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon); - if (print_stats) std::cerr << "data_energy stats:" << stats << std::endl; - - if (!verbose) ::testing::internal::CaptureStdout(); - cleanup_lammps(lmp, test_config); - if (!verbose) ::testing::internal::GetCapturedStdout(); -}; - - TEST(AngleStyle, numdiff) { if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP(); @@ -707,9 +586,6 @@ TEST(AngleStyle, single) { if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); - // angle-spica test not compatible with pair zero - if (utils::strmatch(test_config.angle_style, "^spica")) GTEST_SKIP(); - LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"}; // create a LAMMPS instance with standard settings to detect the number of atom types