Merge pull request #4540 from evoyiatzis/fix-adapt-dihedral
extend fix adapt to treat dihedrals
This commit is contained in:
@ -746,3 +746,44 @@ TEST(DihedralStyle, numdiff)
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
TEST(DihedralStyle, extract)
|
||||
{
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
LAMMPS::argv args = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = nullptr;
|
||||
try {
|
||||
lmp = init_lammps(args, test_config, true);
|
||||
} catch (std::exception &e) {
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
FAIL() << e.what();
|
||||
}
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto prerequisite : test_config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = dihedral->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_EQ(dim, extract.second);
|
||||
}
|
||||
ptr = dihedral->extract("does_not_exist", dim);
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
@ -19,7 +19,10 @@ dihedral_coeff: ! |
|
||||
3 56.0 0 110 0.0
|
||||
4 23.0 1 180 0.5
|
||||
5 19.0 3 90 1.0
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k 1
|
||||
n 1
|
||||
d 1
|
||||
natoms: 29
|
||||
init_energy: 1317.959844120986
|
||||
init_stress: ! |2-
|
||||
|
||||
@ -19,7 +19,10 @@ dihedral_coeff: ! |
|
||||
3 56.0 0 110 0.0
|
||||
4 23.0 1 180 0.5
|
||||
5 19.0 3 90 1.0
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k 1
|
||||
n 1
|
||||
d 1
|
||||
natoms: 29
|
||||
init_energy: 1317.959844120986
|
||||
init_stress: ! |2-
|
||||
|
||||
@ -17,7 +17,13 @@ dihedral_coeff: ! |
|
||||
* at 75 42 31 75 42 31 120 50
|
||||
* aat 75 120 160
|
||||
* bb13 75 1.4 1.4
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k1 1
|
||||
k2 1
|
||||
k3 1
|
||||
phi1 1
|
||||
phi2 1
|
||||
phi3 1
|
||||
natoms: 29
|
||||
init_energy: 3355.0074717375933
|
||||
init_stress: ! |2-
|
||||
|
||||
@ -16,7 +16,9 @@ dihedral_coeff: ! |
|
||||
3 15.0 -10.0
|
||||
4 12.0 0.0
|
||||
5 11.0 45.0
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k 1
|
||||
phi0 1
|
||||
natoms: 29
|
||||
init_energy: 10643.96352037142
|
||||
init_stress: ! |2-
|
||||
|
||||
@ -16,7 +16,10 @@ dihedral_coeff: ! |
|
||||
3 56 10 32
|
||||
4 23 80 61
|
||||
5 19 90 13
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
a 1
|
||||
b 1
|
||||
c 1
|
||||
natoms: 29
|
||||
init_energy: 4634.436545707672
|
||||
init_stress: ! |-
|
||||
|
||||
@ -16,7 +16,12 @@ dihedral_coeff: ! |
|
||||
3 56 10 32 84 52
|
||||
4 23 80 61 83 74
|
||||
5 19 90 13 15 58
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
a1 1
|
||||
a2 1
|
||||
a3 1
|
||||
a4 1
|
||||
a5 1
|
||||
natoms: 29
|
||||
init_energy: 2854.9857316566695
|
||||
init_stress: ! |2-
|
||||
|
||||
@ -16,7 +16,11 @@ dihedral_coeff: ! |
|
||||
3 56 10 32 84
|
||||
4 23 80 61 83
|
||||
5 19 90 13 15
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k1 1
|
||||
k2 1
|
||||
k3 1
|
||||
k4 1
|
||||
natoms: 29
|
||||
init_energy: 2260.6834525285753
|
||||
init_stress: ! |-
|
||||
|
||||
@ -17,7 +17,9 @@ dihedral_coeff: ! |
|
||||
3 25 100
|
||||
4 35 110
|
||||
5 85 120
|
||||
extract: ! ""
|
||||
extract: ! |
|
||||
k 1
|
||||
phi0 1
|
||||
natoms: 29
|
||||
init_energy: 6216.314347066598
|
||||
init_stress: ! |2-
|
||||
|
||||
Reference in New Issue
Block a user