enforce using a single thread with Kokkos and SNAP or PACE
This commit is contained in:
@ -32,9 +32,9 @@
|
|||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "pair.h"
|
#include "pair.h"
|
||||||
|
#include "platform.h"
|
||||||
#include "universe.h"
|
#include "universe.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -356,7 +356,7 @@ TEST(PairStyle, plain)
|
|||||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||||
#endif
|
#endif
|
||||||
auto pair = lmp->force->pair;
|
auto pair = lmp->force->pair;
|
||||||
|
|
||||||
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)", pair->virial, test_config.init_stress, epsilon);
|
EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, epsilon);
|
||||||
@ -392,10 +392,11 @@ TEST(PairStyle, plain)
|
|||||||
|
|
||||||
// skip over these tests if newton pair is forced to be on
|
// skip over these tests if newton pair is forced to be on
|
||||||
if (lmp->force->newton_pair == 0) {
|
if (lmp->force->newton_pair == 0) {
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 3 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
3 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
||||||
@ -424,7 +425,7 @@ TEST(PairStyle, plain)
|
|||||||
restart_lammps(lmp, test_config);
|
restart_lammps(lmp, test_config);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("restart_stress", pair->virial, test_config.init_stress, epsilon);
|
EXPECT_STRESS("restart_stress", pair->virial, test_config.init_stress, epsilon);
|
||||||
@ -440,7 +441,7 @@ TEST(PairStyle, plain)
|
|||||||
restart_lammps(lmp, test_config, true);
|
restart_lammps(lmp, test_config, true);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, epsilon);
|
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, epsilon);
|
||||||
@ -455,7 +456,7 @@ TEST(PairStyle, plain)
|
|||||||
data_lammps(lmp, test_config);
|
data_lammps(lmp, test_config);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("data_stress", pair->virial, test_config.init_stress, epsilon);
|
EXPECT_STRESS("data_stress", pair->virial, test_config.init_stress, epsilon);
|
||||||
|
|
||||||
@ -537,130 +538,7 @@ TEST(PairStyle, omp)
|
|||||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||||
#endif
|
#endif
|
||||||
auto pair = lmp->force->pair;
|
auto pair = lmp->force->pair;
|
||||||
ErrorStats stats;
|
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
|
||||||
EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, 10 * epsilon);
|
|
||||||
|
|
||||||
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 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, 5* epsilon);
|
|
||||||
EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon);
|
|
||||||
|
|
||||||
stats.reset();
|
|
||||||
int id = lmp->modify->find_compute("sum");
|
|
||||||
double 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 on: " << stats << std::endl;
|
|
||||||
|
|
||||||
// skip over these tests if newton pair is forced to be on
|
|
||||||
if (lmp->force->newton_pair == 0) {
|
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
|
||||||
cleanup_lammps(lmp, test_config);
|
|
||||||
lmp = init_lammps(argc, argv, test_config, false);
|
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, epsilon);
|
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
|
||||||
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon);
|
|
||||||
|
|
||||||
stats.reset();
|
|
||||||
id = lmp->modify->find_compute("sum");
|
|
||||||
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();
|
|
||||||
restart_lammps(lmp, test_config, true);
|
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
|
||||||
|
|
||||||
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
|
||||||
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
|
||||||
|
|
||||||
stats.reset();
|
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, 5 * epsilon);
|
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, 5 * epsilon);
|
|
||||||
if (print_stats) std::cerr << "nofdotr_energy stats:" << stats << std::endl;
|
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
|
||||||
cleanup_lammps(lmp, test_config);
|
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST(PairStyle, 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();
|
|
||||||
|
|
||||||
const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite",
|
|
||||||
"-k", "on", "t", "4", "-sf", "kk"};
|
|
||||||
|
|
||||||
// cannot run dpd styles with more than 1 thread due to using multiple pRNGs
|
|
||||||
if (utils::strmatch(test_config.pair_style, "^dpd")) args[9] = "1";
|
|
||||||
|
|
||||||
char **argv = (char **)args;
|
|
||||||
int argc = sizeof(args) / sizeof(char *);
|
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
|
||||||
LAMMPS *lmp = init_lammps(argc, argv, 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;
|
|
||||||
// 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
|
|
||||||
auto pair = lmp->force->pair;
|
|
||||||
ErrorStats stats;
|
ErrorStats stats;
|
||||||
|
|
||||||
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);
|
||||||
@ -694,10 +572,11 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
lmp = init_lammps(argc, argv, test_config, false);
|
lmp = init_lammps(argc, argv, test_config, false);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, epsilon);
|
||||||
@ -709,7 +588,8 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress, 10 * epsilon);
|
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
stats.reset();
|
stats.reset();
|
||||||
id = lmp->modify->find_compute("sum");
|
id = lmp->modify->find_compute("sum");
|
||||||
@ -724,7 +604,141 @@ TEST(PairStyle, kokkos_omp)
|
|||||||
restart_lammps(lmp, test_config, true);
|
restart_lammps(lmp, test_config, true);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
|
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
||||||
|
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
|
|
||||||
|
stats.reset();
|
||||||
|
EXPECT_FP_LE_WITH_EPS(pair->eng_vdwl, test_config.init_vdwl, 5 * epsilon);
|
||||||
|
EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, 5 * epsilon);
|
||||||
|
if (print_stats) std::cerr << "nofdotr_energy stats:" << stats << std::endl;
|
||||||
|
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
cleanup_lammps(lmp, test_config);
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(PairStyle, 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();
|
||||||
|
|
||||||
|
const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite",
|
||||||
|
"-k", "on", "t", "4", "-sf", "kk"};
|
||||||
|
|
||||||
|
// cannot run dpd styles in plain or hybrid with more than 1 thread due to using multiple pRNGs
|
||||||
|
if (utils::strmatch(test_config.pair_style, "^dpd") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " dpd"))
|
||||||
|
args[9] = "1";
|
||||||
|
// cannot run snap styles in plain or hybrid with more than 1 thread due to implementation
|
||||||
|
if (utils::strmatch(test_config.pair_style, "^snap") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " snap"))
|
||||||
|
args[9] = "1";
|
||||||
|
// cannot run pace styles in plain or hybrid with more than 1 thread due to implementation
|
||||||
|
if (utils::strmatch(test_config.pair_style, "^pace") ||
|
||||||
|
utils::strmatch(test_config.pair_style, " pace"))
|
||||||
|
args[9] = "1";
|
||||||
|
|
||||||
|
char **argv = (char **)args;
|
||||||
|
int argc = sizeof(args) / sizeof(char *);
|
||||||
|
|
||||||
|
::testing::internal::CaptureStdout();
|
||||||
|
LAMMPS *lmp = init_lammps(argc, argv, 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;
|
||||||
|
// 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
|
||||||
|
auto pair = lmp->force->pair;
|
||||||
|
ErrorStats stats;
|
||||||
|
|
||||||
|
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
|
EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
|
|
||||||
|
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 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, 5 * epsilon);
|
||||||
|
EXPECT_STRESS("run_stress (newton on)", pair->virial, test_config.run_stress, 10 * epsilon);
|
||||||
|
|
||||||
|
stats.reset();
|
||||||
|
int id = lmp->modify->find_compute("sum");
|
||||||
|
double 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 on: " << stats << std::endl;
|
||||||
|
|
||||||
|
// skip over these tests if newton pair is forced to be on
|
||||||
|
if (lmp->force->newton_pair == 0) {
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
cleanup_lammps(lmp, test_config);
|
||||||
|
lmp = init_lammps(argc, argv, test_config, false);
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 5 * epsilon);
|
||||||
|
EXPECT_STRESS("run_stress (newton off)", pair->virial, test_config.run_stress,
|
||||||
|
10 * epsilon);
|
||||||
|
|
||||||
|
stats.reset();
|
||||||
|
id = lmp->modify->find_compute("sum");
|
||||||
|
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();
|
||||||
|
restart_lammps(lmp, test_config, true);
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
@ -804,7 +818,7 @@ TEST(PairStyle, gpu)
|
|||||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||||
#endif
|
#endif
|
||||||
ErrorStats stats;
|
ErrorStats stats;
|
||||||
auto pair = lmp->force->pair;
|
auto pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
@ -888,7 +902,7 @@ TEST(PairStyle, intel)
|
|||||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||||
|
|
||||||
ErrorStats stats;
|
ErrorStats stats;
|
||||||
auto pair = lmp->force->pair;
|
auto pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon);
|
EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||||
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
@ -991,7 +1005,7 @@ TEST(PairStyle, opt)
|
|||||||
restart_lammps(lmp, test_config, true);
|
restart_lammps(lmp, test_config, true);
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
|
||||||
pair = lmp->force->pair;
|
pair = lmp->force->pair;
|
||||||
|
|
||||||
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
EXPECT_FORCES("nofdotr_forces", lmp->atom, test_config.init_forces, 5 * epsilon);
|
||||||
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
EXPECT_STRESS("nofdotr_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||||
|
|||||||
Reference in New Issue
Block a user