evaleev / libint

Libint: high-performance library for computing Gaussian integrals in quantum mechanics
Other
229 stars 95 forks source link

fix Taylor-based boys engine #243

Closed evaleev closed 2 years ago

evaleev commented 2 years ago

this replaces wrongly-committed https://github.com/evaleev/libint/commit/9e92fad0b085aeab275bce51c7c212c624dd55d2

bingao commented 2 years ago

Thank you @evaleev I am going to test this fix and let you know once I have the results. Have a nice day.

bingao commented 2 years ago

Hi @evaleev

I did more tests. But first, let me summarize how I modified the codes so that you could check whether I did it correctly. I use Libint 2.7.1 (at https://github.com/evaleev/libint/releases/download/v2.7.1/libint-2.7.1.tgz) and I only changed the header file include/libint2/boys.h. Explicitly, line 490 is changed to:


              INTERPOLATION_ORDER + 1, 2 * (mmax + INTERPOLATION_ORDER)) {

and line 519 is changed to:

        max_m_ = mmax + INTERPOLATION_ORDER;

Then I generated 100,000 Chebyshev nodes in the range [0, 5000] as arguments and ran libint2::FmEval_Taylor<double, 7> with different maximum orders mmax of Boys functions. The maximum relative errors are as follows,

mmax=10, x=33.71441750639815, Fm=5.1433037645936454e-11, relative-error=9.023136785781899e-07
mmax=20, x=33.71441750639815, Fm=1.2931369521894102e-14, relative-error=0.005797678663402387
mmax=30, x=33.71441750639815, Fm=6.07970246113155e-16, relative-error=0.36380102185311175
mmax=40, x=33.71441750639815, Fm=8.544638342987548e-16, relative-error=6.13036696828868
mmax=50, x=33.71441750639815, Fm=1.5023921087296925e-14, relative-error=241.59856375362048
mmax=60, x=33.71441750639815, Fm=1.9784131483155954e-12, relative-error=48431.592216900586

It seems that the performance of libint2::FmEval_Taylor<double, 7> is still not satisfied if I did not do anything incorrectly.

One more thing, I notice that there is an assert() statement in the Taylor interpolation (include/libint2/boys.h):

        assert(mmax <= 63);

Does it mean that we can not compute Boys functions with Taylor interpolation for orders greater than 63?

Thank you.