X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fprograms%2Fmdrun%2Ftests%2Fpull.cpp;h=41c692a5b0f26d2369e170a4e59e6354117b062d;hb=2acfc914079ae665c4f2ce16ec951565eaebbbff;hp=48665c68e0ff2024cd5d952e8dba8ff92a0c5323;hpb=dc25e5beb2f8c0c9eea3e00130cd1882570e695a;p=alexxy%2Fgromacs.git diff --git a/src/programs/mdrun/tests/pull.cpp b/src/programs/mdrun/tests/pull.cpp index 48665c68e0..41c692a5b0 100644 --- a/src/programs/mdrun/tests/pull.cpp +++ b/src/programs/mdrun/tests/pull.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -71,14 +72,10 @@ namespace { /*! \brief Database of energy tolerances on the various systems. */ -std::unordered_map energyToleranceForSystem_g = { - { { "spc216", relativeToleranceAsFloatingPoint(1, 1e-4) } } -}; +std::unordered_map energyToleranceForSystem_g = { { { "spc216", 1e-4 } } }; /*! \brief Database of pressure tolerances on the various systems. */ -std::unordered_map pressureToleranceForSystem_g = { - { { "spc216", relativeToleranceAsFloatingPoint(1, 2e-4) } } -}; +std::unordered_map pressureToleranceForSystem_g = { { { "spc216", 2e-4 } } }; const std::unordered_map>> c_mdpPullParams = { { { "umbrella-3D", @@ -125,7 +122,26 @@ const std::unordered_map pull-coord1-init = 0.6 + { "pull-coord2-k", "25" } // -> pull-coord1-k = 2^2*25 = 100 + } } } }; //! Helper type @@ -155,6 +171,14 @@ void addBasicMdpValues(MdpFieldValues* mdpFieldValues) (*mdpFieldValues)["vdwtype"] = "Cut-off"; } +bool isTransformationPullSetup(const std::string& pullSetupName) +{ + const auto* pattern{ "transformation" }; + // std::regex_constants::icase - TO IGNORE CASE. + auto rx = std::regex{ pattern, std::regex_constants::icase }; + return std::regex_search(pullSetupName, rx); +} + TEST_P(PullIntegrationTest, WithinTolerances) { auto params = GetParam(); @@ -195,13 +219,23 @@ TEST_P(PullIntegrationTest, WithinTolerances) } // Do mdrun { + // conver the tolerance to relative floating point tolerance + auto energyTolerance = energyToleranceForSystem_g.at(simulationName); + auto pressureTolerance = pressureToleranceForSystem_g.at(simulationName); + if (isTransformationPullSetup(pullSetup)) // need to increase the tolerance a bit due to numerical evaluations + { + energyTolerance *= 10; + pressureTolerance *= 10; + } + auto relativeEnergyTolerance = relativeToleranceAsFloatingPoint(1, energyTolerance); + auto relativePressureTolerance = relativeToleranceAsFloatingPoint(1, pressureTolerance); CommandLine mdrunCaller; ASSERT_EQ(0, runner_.callMdrun(mdrunCaller)); EnergyTermsToCompare energyTermsToCompare{ { - { interaction_function[F_COM_PULL].longname, energyToleranceForSystem_g.at(simulationName) }, - { interaction_function[F_EPOT].longname, energyToleranceForSystem_g.at(simulationName) }, - { interaction_function[F_EKIN].longname, energyToleranceForSystem_g.at(simulationName) }, - { interaction_function[F_PRES].longname, pressureToleranceForSystem_g.at(simulationName) }, + { interaction_function[F_COM_PULL].longname, relativeEnergyTolerance }, + { interaction_function[F_EPOT].longname, relativeEnergyTolerance }, + { interaction_function[F_EKIN].longname, relativeEnergyTolerance }, + { interaction_function[F_PRES].longname, relativePressureTolerance }, } }; TestReferenceData refData; auto checker = refData.rootChecker() @@ -216,7 +250,8 @@ INSTANTIATE_TEST_SUITE_P(PullTest, ::testing::Combine(::testing::Values("spc216"), ::testing::Values("umbrella-3D", "umbrella-2D", - "constraint-flatbottom"))); + "constraint-flatbottom", + "transformation-coord-umbrella-3D"))); } // namespace } // namespace test