Skip to content

Commit

Permalink
update the comparison threshold for fortran/test-eri
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Jan 14, 2022
1 parent d3694ca commit 1ba2b2e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib/libint/tests/fortran/test-eri.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::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.)
double 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);
Expand Down Expand Up @@ -516,15 +521,15 @@ 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;
REQUIRE(test_eri_c_f(contrdepth, am1, c1, alpha1, A,
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
Expand All @@ -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
}
Expand Down

0 comments on commit 1ba2b2e

Please sign in to comment.