modernize and remove dead code
This commit is contained in:
@ -362,8 +362,9 @@ TEST(AngleStyle, plain)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, epsilon);
|
EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, 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 (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);
|
EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, 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 (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);
|
EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with angle style hybrid
|
// TODO: this is currently broken for OPENMP with angle style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -515,8 +517,8 @@ TEST(AngleStyle, omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with angle style hybrid
|
// TODO: this is currently broken for OPENMP with angle style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -532,124 +534,124 @@ TEST(AngleStyle, omp)
|
|||||||
|
|
||||||
TEST(AngleStyle, kokkos_omp)
|
TEST(AngleStyle, kokkos_omp)
|
||||||
{
|
{
|
||||||
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
||||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||||
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP();
|
if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP();
|
||||||
|
|
||||||
LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite",
|
LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite",
|
||||||
"-k", "on", "t", "4", "-sf", "kk"};
|
"-k", "on", "t", "4", "-sf", "kk"};
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||||
|
|
||||||
std::string output = ::testing::internal::GetCapturedStdout();
|
std::string output = ::testing::internal::GetCapturedStdout();
|
||||||
if (verbose) std::cout << output;
|
if (verbose) std::cout << output;
|
||||||
|
|
||||||
if (!lmp) {
|
if (!lmp) {
|
||||||
std::cerr << "One or more prerequisite styles with /kk suffix\n"
|
std::cerr << "One or more prerequisite styles with /kk suffix\n"
|
||||||
"are not available in this LAMMPS configuration:\n";
|
"are not available in this LAMMPS configuration:\n";
|
||||||
for (auto &prerequisite : test_config.prerequisites) {
|
for (auto &prerequisite : test_config.prerequisites) {
|
||||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||||
|
}
|
||||||
|
GTEST_SKIP();
|
||||||
}
|
}
|
||||||
GTEST_SKIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||||
EXPECT_THAT(output, HasSubstr("Loop time"));
|
EXPECT_THAT(output, HasSubstr("Loop time"));
|
||||||
|
|
||||||
// abort if running in parallel and not all atoms are local
|
// abort if running in parallel and not all atoms are local
|
||||||
const int nlocal = lmp->atom->nlocal;
|
const int nlocal = lmp->atom->nlocal;
|
||||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||||
|
|
||||||
// relax error a bit for KOKKOS package
|
// relax error a bit for KOKKOS package
|
||||||
double epsilon = 5.0 * test_config.epsilon;
|
double epsilon = 5.0 * test_config.epsilon;
|
||||||
|
|
||||||
ErrorStats stats;
|
ErrorStats stats;
|
||||||
auto angle = lmp->force->angle;
|
auto angle = lmp->force->angle;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
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);
|
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();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon);
|
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 (print_stats) std::cerr << "init_energy stats, newton on: " << stats << std::endl;
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
run_lammps(lmp);
|
run_lammps(lmp);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon);
|
EXPECT_FORCES("run_forces (newton on)", lmp->atom, test_config.run_forces, 10 * epsilon);
|
||||||
EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, epsilon);
|
EXPECT_STRESS("run_stress (newton on)", angle->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, 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 (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
||||||
}
|
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
restart_lammps(lmp, test_config);
|
cleanup_lammps(lmp, test_config);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
lmp = init_lammps(args, test_config, false);
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
angle = lmp->force->angle;
|
// skip over these tests if newton bond is forced to be on
|
||||||
EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon);
|
if (lmp->force->newton_bond == 0) {
|
||||||
EXPECT_STRESS("restart_stress", angle->virial, test_config.init_stress, epsilon);
|
angle = lmp->force->angle;
|
||||||
|
|
||||||
stats.reset();
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon);
|
EXPECT_STRESS("init_stress (newton off)", angle->virial, test_config.init_stress,
|
||||||
if (print_stats) std::cerr << "restart_energy stats:" << stats << std::endl;
|
2 * epsilon);
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
stats.reset();
|
||||||
data_lammps(lmp, test_config);
|
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (print_stats) std::cerr << "init_energy stats, newton off:" << stats << std::endl;
|
||||||
|
|
||||||
angle = lmp->force->angle;
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon);
|
run_lammps(lmp);
|
||||||
EXPECT_STRESS("data_stress", angle->virial, test_config.init_stress, epsilon);
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
stats.reset();
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(angle->energy, test_config.init_energy, epsilon);
|
EXPECT_STRESS("run_stress (newton off)", angle->virial, test_config.run_stress, epsilon);
|
||||||
if (print_stats) std::cerr << "data_energy stats:" << stats << std::endl;
|
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
stats.reset();
|
||||||
cleanup_lammps(lmp, test_config);
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
TEST(AngleStyle, numdiff)
|
||||||
{
|
{
|
||||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||||
@ -766,11 +768,11 @@ TEST(AngleStyle, single)
|
|||||||
nangletypes));
|
nangletypes));
|
||||||
|
|
||||||
if (utils::strmatch(test_config.angle_style, "^spica")) {
|
if (utils::strmatch(test_config.angle_style, "^spica")) {
|
||||||
command("pair_style lj/spica 8.0");
|
command("pair_style lj/spica 8.0");
|
||||||
command("pair_coeff * * lj9_6 0.02 2.5");
|
command("pair_coeff * * lj9_6 0.02 2.5");
|
||||||
} else {
|
} else {
|
||||||
command("pair_style zero 8.0");
|
command("pair_style zero 8.0");
|
||||||
command("pair_coeff * *");
|
command("pair_coeff * *");
|
||||||
}
|
}
|
||||||
|
|
||||||
command("angle_style " + test_config.angle_style);
|
command("angle_style " + test_config.angle_style);
|
||||||
|
|||||||
@ -362,8 +362,9 @@ TEST(BondStyle, plain)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, epsilon);
|
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with bond style hybrid
|
// TODO: this is currently broken for OPENMP with bond style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -517,8 +519,8 @@ TEST(BondStyle, omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with bond style hybrid
|
// TODO: this is currently broken for OPENMP with bond style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -584,13 +586,13 @@ TEST(BondStyle, kokkos_omp)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton on)", bond->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
|
||||||
|
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
//if (test_config.bond_style.substr(0, 6) != "hybrid")
|
// if (test_config.bond_style.substr(0, 6) != "hybrid")
|
||||||
// EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
// EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
||||||
|
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
||||||
@ -621,13 +623,13 @@ TEST(BondStyle, kokkos_omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.run_energy, epsilon);
|
||||||
|
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with bond style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
//if (test_config.bond_style.substr(0, 6) != "hybrid")
|
// if (test_config.bond_style.substr(0, 6) != "hybrid")
|
||||||
// EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
// EXPECT_FP_LE_WITH_EPS(bond->energy, energy, epsilon);
|
||||||
|
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
||||||
|
|||||||
@ -363,8 +363,9 @@ TEST(DihedralStyle, plain)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, epsilon);
|
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton off)", dihedral->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(dihedral->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with dihedral style hybrid
|
// TODO: this is currently broken for OPENMP with dihedral style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -519,8 +521,8 @@ TEST(DihedralStyle, omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with dihedral style hybrid
|
// TODO: this is currently broken for OPENMP with dihedral style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// 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);
|
EXPECT_STRESS("run_stress (newton on)", dihedral->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
|
||||||
|
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid
|
||||||
@ -623,8 +625,8 @@ TEST(DihedralStyle, kokkos_omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.run_energy, epsilon);
|
||||||
|
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with dihedral style hybrid
|
||||||
|
|||||||
@ -356,8 +356,9 @@ TEST(ImproperStyle, plain)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, epsilon);
|
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton off)", improper->virial, test_config.run_stress, epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
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);
|
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with improper style hybrid
|
// TODO: this is currently broken for OPENMP with improper style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
@ -512,8 +514,8 @@ TEST(ImproperStyle, omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
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, test_config.run_energy, epsilon);
|
||||||
// TODO: this is currently broken for OPENMP with improper style hybrid
|
// TODO: this is currently broken for OPENMP with improper style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// 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 (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP();
|
||||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||||
|
|
||||||
LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite",
|
LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen",
|
||||||
"-k", "on", "t", "4", "-sf", "kk"};
|
"-nocite", "-k", "on", "t", "4",
|
||||||
|
"-sf", "kk"};
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||||
@ -579,12 +582,12 @@ TEST(ImproperStyle, kokkos_omp)
|
|||||||
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton on)", improper->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
int id = lmp->modify->find_compute("sum");
|
auto *icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
double energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
//if (test_config.improper_style.substr(0, 6) != "hybrid")
|
// if (test_config.improper_style.substr(0, 6) != "hybrid")
|
||||||
// EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
// EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
if (print_stats) std::cerr << "run_energy stats, newton on: " << stats << std::endl;
|
||||||
|
|
||||||
@ -614,12 +617,12 @@ TEST(ImproperStyle, kokkos_omp)
|
|||||||
10 * epsilon);
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
icompute = lmp->modify->get_compute_by_id("sum");
|
||||||
energy = lmp->modify->compute[id]->compute_scalar();
|
if (icompute) icompute->compute_scalar();
|
||||||
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
|
EXPECT_FP_LE_WITH_EPS(improper->energy, test_config.run_energy, epsilon);
|
||||||
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
|
// FIXME: this is currently broken ??? for KOKKOS with improper style hybrid
|
||||||
// needs to be fixed in the main code somewhere. Not sure where, though.
|
// needs to be fixed in the main code somewhere. Not sure where, though.
|
||||||
//if (test_config.improper_style.substr(0, 6) != "hybrid")
|
// if (test_config.improper_style.substr(0, 6) != "hybrid")
|
||||||
// EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
// EXPECT_FP_LE_WITH_EPS(improper->energy, energy, epsilon);
|
||||||
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
if (print_stats) std::cerr << "run_energy stats, newton off:" << stats << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user