modernize and remove dead code

This commit is contained in:
Axel Kohlmeyer
2024-08-22 21:03:29 -04:00
parent 01bbd60568
commit 42dec6fe6e
4 changed files with 150 additions and 141 deletions

View File

@ -362,8 +362,9 @@ TEST(AngleStyle, plain)
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();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->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;
@ -393,8 +394,8 @@ TEST(AngleStyle, plain)
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();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->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;
@ -480,8 +481,9 @@ TEST(AngleStyle, omp)
EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with angle style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -515,8 +517,8 @@ TEST(AngleStyle, omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with angle style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -582,8 +584,9 @@ TEST(AngleStyle, kokkos_omp)
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();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->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;
@ -613,8 +616,8 @@ TEST(AngleStyle, kokkos_omp)
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();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->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;
@ -649,7 +652,6 @@ TEST(AngleStyle, kokkos_omp)
if (!verbose) ::testing::internal::GetCapturedStdout();
};
TEST(AngleStyle, numdiff)
{
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();

View File

@ -362,8 +362,9 @@ TEST(BondStyle, plain)
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
@ -393,8 +394,8 @@ TEST(BondStyle, plain)
EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress, epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
@ -482,8 +483,9 @@ TEST(BondStyle, omp)
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with bond style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -517,8 +519,8 @@ TEST(BondStyle, omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with bond style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -584,8 +586,8 @@ TEST(BondStyle, kokkos_omp)
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid
@ -621,8 +623,8 @@ TEST(BondStyle, kokkos_omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid

View File

@ -363,8 +363,9 @@ TEST(DihedralStyle, plain)
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
@ -394,8 +395,8 @@ TEST(DihedralStyle, plain)
EXPECT_STRESS("run_stress (newton off)", dihedral->virial, test_config.run_stress, epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
@ -484,8 +485,9 @@ TEST(DihedralStyle, omp)
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with dihedral style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -519,8 +521,8 @@ TEST(DihedralStyle, omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with dihedral style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -587,8 +589,8 @@ TEST(DihedralStyle, kokkos_omp)
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid
@ -623,8 +625,8 @@ TEST(DihedralStyle, kokkos_omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid

View File

@ -356,8 +356,9 @@ TEST(ImproperStyle, plain)
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
@ -387,8 +388,8 @@ TEST(ImproperStyle, plain)
EXPECT_STRESS("run_stress (newton off)", improper->virial, test_config.run_stress, epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
@ -477,8 +478,9 @@ TEST(ImproperStyle, omp)
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
double energy = 0.0;
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with improper style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -512,8 +514,8 @@ TEST(ImproperStyle, omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) energy = icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
// TODO: this is currently broken for OPENMP with improper style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -532,8 +534,9 @@ TEST(ImproperStyle, kokkos_omp)
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite",
"-k", "on", "t", "4", "-sf", "kk"};
LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen",
"-nocite", "-k", "on", "t", "4",
"-sf", "kk"};
::testing::internal::CaptureStdout();
LAMMPS *lmp = init_lammps(args, test_config, true);
@ -579,8 +582,8 @@ TEST(ImproperStyle, kokkos_omp)
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon);
stats.reset();
int id = lmp->modify->find_compute("sum");
double energy = lmp->modify->compute[id]->compute_scalar();
auto *icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.
@ -614,8 +617,8 @@ TEST(ImproperStyle, kokkos_omp)
10 * epsilon);
stats.reset();
id = lmp->modify->find_compute("sum");
energy = lmp->modify->compute[id]->compute_scalar();
icompute = lmp->modify->get_compute_by_id("sum");
if (icompute) icompute->compute_scalar();
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
// needs to be fixed in the main code somewhere. Not sure where, though.