pair style rann does not support per-atom stress or pair_modify nofdotr

This commit is contained in:
Axel Kohlmeyer
2021-07-11 20:03:52 -04:00
parent d774cd5ddc
commit 6134164ad3
4 changed files with 62 additions and 59 deletions

View File

@ -523,36 +523,39 @@ TEST(PairStyle, plain)
EXPECT_FP_LE_WITH_EPS(pair->eng_coul, test_config.init_coul, epsilon);
if (print_stats) std::cerr << "restart_energy stats:" << stats << std::endl;
if (!verbose) ::testing::internal::CaptureStdout();
restart_lammps(lmp, test_config, true);
if (!verbose) ::testing::internal::GetCapturedStdout();
// pair style rann does not support pair_modify nofdotr
if (test_config.pair_style != "rann") {
if (!verbose) ::testing::internal::CaptureStdout();
restart_lammps(lmp, test_config, true);
if (!verbose) ::testing::internal::GetCapturedStdout();
f = lmp->atom->f;
tag = lmp->atom->tag;
stats.reset();
ASSERT_EQ(nlocal + 1, f_ref.size());
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);
f = lmp->atom->f;
tag = lmp->atom->tag;
stats.reset();
ASSERT_EQ(nlocal + 1, f_ref.size());
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 << "nofdotr_forces stats:" << stats << std::endl;
pair = lmp->force->pair;
stress = pair->virial;
stats.reset();
EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon);
if (print_stats) std::cerr << "nofdotr_stress stats:" << 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 << "nofdotr_energy stats:" << stats << std::endl;
}
if (print_stats) std::cerr << "nofdotr_forces stats:" << stats << std::endl;
pair = lmp->force->pair;
stress = pair->virial;
stats.reset();
EXPECT_FP_LE_WITH_EPS(stress[0], test_config.init_stress.xx, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[1], test_config.init_stress.yy, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[2], test_config.init_stress.zz, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[3], test_config.init_stress.xy, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[4], test_config.init_stress.xz, epsilon);
EXPECT_FP_LE_WITH_EPS(stress[5], test_config.init_stress.yz, epsilon);
if (print_stats) std::cerr << "nofdotr_stress stats:" << 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 << "nofdotr_energy stats:" << stats << std::endl;
if (!verbose) ::testing::internal::CaptureStdout();
data_lammps(lmp, test_config);
@ -1091,9 +1094,9 @@ TEST(PairStyle, intel)
// pair styles sw and tersoff and airebo INTEL package variants require newton on,
// but that also requires fdotr for /intel
if ((test_config.pair_style != "sw") && (test_config.pair_style != "tersoff")
&& (test_config.pair_style != "rebo") && (test_config.pair_style != "airebo")
&& (test_config.pair_style != "airebo/morse")) {
if ((test_config.pair_style != "sw") && (test_config.pair_style != "tersoff") &&
(test_config.pair_style != "rebo") && (test_config.pair_style != "airebo") &&
(test_config.pair_style != "airebo/morse")) {
if (!verbose) ::testing::internal::CaptureStdout();
restart_lammps(lmp, test_config, true, true);