From b13667b856d14510c556c1ff1f8f691d80bdd3ed Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 14 Jan 2022 13:44:26 -0500 Subject: [PATCH] update the comparison threshold for fortran/test-eri --- src/lib/libint/tests/fortran/test-eri.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/libint/tests/fortran/test-eri.cc b/src/lib/libint/tests/fortran/test-eri.cc index 0fa977841..a046403e3 100644 --- a/src/lib/libint/tests/fortran/test-eri.cc +++ b/src/lib/libint/tests/fortran/test-eri.cc @@ -480,7 +480,12 @@ bool test_eri_c_f(int &contrdepth, int &am1, double *c1, double *alpha1, double TEST_CASE("Fortran ERI", "[eri]") { - const double threshold = std::numeric_limits::epsilon() * 10; + // recipe from eri/test.cc + const double ABSOLUTE_DEVIATION_THRESHOLD = 5.0E-14; // indicate failure if any integral differs in absolute sense by more than this + // loss of precision in HRR likely limits precision for high-L (e.g. (dp|dd), (dd|dd), etc.) + auto absolute_derivation_threshold = [&](int deriv_order) { + return ABSOLUTE_DEVIATION_THRESHOLD * std::pow(3., deriv_order > 2 ? deriv_order-2 : 0); + }; int am1 = std::min(1, LIBINT2_MAX_AM_eri); int am2 = std::min(0, LIBINT2_MAX_AM_eri); @@ -516,7 +521,7 @@ TEST_CASE("Fortran ERI", "[eri]") { am2, c2, alpha2, B, am3, c3, alpha3, C, am4, c4, alpha4, D, - deriv_order, threshold)); + deriv_order, absolute_derivation_threshold(deriv_order))); #if INCLUDE_ERI >= 1 deriv_order = 1; @@ -524,7 +529,7 @@ TEST_CASE("Fortran ERI", "[eri]") { am2, c2, alpha2, B, am3, c3, alpha3, C, am4, c4, alpha4, D, - deriv_order, threshold)); + deriv_order, absolute_derivation_threshold(deriv_order))); #endif #if INCLUDE_ERI >= 2 @@ -533,7 +538,7 @@ TEST_CASE("Fortran ERI", "[eri]") { am2, c2, alpha2, B, am3, c3, alpha3, C, am4, c4, alpha4, D, - deriv_order, threshold)); + deriv_order, absolute_derivation_threshold(deriv_order))); #endif #endif // INCLUDE_ERI }