Skip to content

Commit c8ba80d

Browse files
author
Tristan Youngs
committed
Impropers.
1 parent a1d3067 commit c8ba80d

4 files changed

Lines changed: 23 additions & 10 deletions

File tree

tests/ff/assignment-Ludwig-py5.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ TEST(LudwigPy5AssignmentTest, Py5)
3232
EXPECT_TRUE(testSpeciesBond(species.getBond(1, 6), {BondFunctions::Form::Harmonic, "k=3071 eq=1.08"}));
3333
EXPECT_TRUE(testSpeciesAngle(species.getAngle(11, 0, 1), {AngleFunctions::Form::Harmonic, "k=585.8 eq=121.5"}));
3434
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(0, 1, 2, 3), {TorsionFunctions::Form::Cosine, "15.178 2 180 1"}));
35-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(0, 1, 5, 11), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
36-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(1, 0, 2, 6), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
37-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(2, 1, 3, 7), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
38-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(3, 2, 4, 8), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
39-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(4, 3, 5, 9), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
40-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(5, 0, 4, 10), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
35+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(0, 1, 5, 11), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
36+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(1, 0, 2, 6), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
37+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(2, 1, 3, 7), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
38+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(3, 2, 4, 8), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
39+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(4, 3, 5, 9), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
40+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(5, 0, 4, 10), {TorsionFunctions::Form::Cosine, "4.606 2 180 1"}));
4141
}
4242
}; // namespace UnitTest

tests/ff/assignment-UFF-nmethylformamide.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TEST(UFFNMethylFormamideAssignmentTest, NMethylFormamide)
3535
6.0e-5));
3636
EXPECT_TRUE(
3737
testSpeciesTorsion(species.getTorsion(0, 1, 2, 4), {TorsionFunctions::Form::UFFCosine, "101.9308 2 180"}, 2.0e-5));
38-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(1, 0, 2, 3), {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}));
39-
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(2, 5, 1, 4), {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}));
38+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(1, 0, 2, 3), {TorsionFunctions::Form::FourierN, "209.2 1 -1 0"}));
39+
EXPECT_TRUE(testSpeciesImproper(species.getImproper(2, 5, 1, 4), {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}));
4040
}
4141
}; // namespace UnitTest

tests/ff/assignment-UFF4MOF-mof5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ TEST(UFF4MOFMOF5AssignmentTest, MOF5)
6363
EXPECT_TRUE(testSpeciesTorsion(species.getTorsion(178, 122, 26, 117),
6464
{TorsionFunctions::Form::UFFCosine, "96.4708 2 180"}, 5.0e-5));
6565
EXPECT_TRUE(
66-
testSpeciesTorsion(species.getTorsion(178, 122, 133, 226), {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}));
66+
testSpeciesImproper(species.getImproper(178, 122, 133, 226), {TorsionFunctions::Form::FourierN, "25.104 1 -1 0"}));
6767
}
6868
}; // namespace UnitTest

tests/testing.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ checkIntramolecularTerms(const std::string &term, const InteractionPotential<Int
158158
a.parent()->name()),
159159
expectedParams, a.interactionPotential(), tolerance);
160160
}
161-
// Test species torsion / improper term
161+
// Test species torsion term
162162
[[nodiscard]] testing::AssertionResult testSpeciesTorsion(OptionalReferenceWrapper<const SpeciesTorsion> optTorsion,
163163
const InteractionPotential<TorsionFunctions> &expectedParams,
164164
double tolerance)
@@ -171,6 +171,19 @@ checkIntramolecularTerms(const std::string &term, const InteractionPotential<Int
171171
t.parent()->name()),
172172
expectedParams, t.interactionPotential(), tolerance);
173173
}
174+
// Test species improper term
175+
[[nodiscard]] testing::AssertionResult testSpeciesImproper(OptionalReferenceWrapper<const SpeciesImproper> optImproper,
176+
const InteractionPotential<TorsionFunctions> &expectedParams,
177+
double tolerance)
178+
{
179+
if (!optImproper)
180+
return testing::AssertionFailure() << "No improper provided to test";
181+
auto &i = (*optImproper).get();
182+
return checkIntramolecularTerms(std::format("Improper {} in species '{}'",
183+
joinStrings(i.atoms(), "-", [](const auto &atom) { return atom->index(); }),
184+
i.parent()->name()),
185+
expectedParams, i.interactionPotential(), tolerance);
186+
}
174187
// Test consistency between the two supplied double-keyed Data1D maps
175188
bool testDoubleKeyedMap(std::string_view mapContents, const DoubleKeyedMap<Data1D> &mapA, const DoubleKeyedMap<Data1D> &mapB,
176189
double testThreshold)

0 commit comments

Comments
 (0)