1

During writing my own two-electron integration library I faced an issue of dealing with integrals that have very small values beyond the C/C++ double data type. Basically, most integrals turn out to be NaN. So, the prescreening is apparently necessary.

Referring to this thread I see how the prescreening is done, but I have just a little concern. Is there a simple method/algorithm of calculating (ab|ab) and (cd|cd) integrals or am I supposed to calculate them as if they were regular 4-index integrals? Maybe there's a transformation that can be used to calculate them as 1-electron integrals? I lack the mathematical education and am trying to learn things on the fly.

  • 1
    NaN is not the same as a very small value, it is typically the result of an "illegal" mathematical operation. If this were one of my own codes I would be very suspicious of a bug, not underflow. Why do you think these NaNs are indicating very small values? – Ian Bush May 27 '22 at 19:39
  • I checked by manual calculations. A few values that appeared NaNs are something like 6E-78. I did consider it as a bug, but the math I coded doesn't seem wrong. – Dmitry Govorov May 27 '22 at 19:44
  • I would strongly recommend comparing the results you are getting with a recognized library that should give the same results. https://github.com/sunqm/libcint is one possibility. https://github.com/evaleev/libint is another. General code to calculate 4 centre Gaussian integrals is not trivial, and having a robust testing environment is essential. – Ian Bush May 27 '22 at 19:51
  • I know about that and will test, but not until it's a working library. I'm quite confident that NaNs are caused by the out-of-range arithmetics.

    The question about implementing the Schwartz inequality is still open and important.

    – Dmitry Govorov May 27 '22 at 19:55
  • Please start testing before it is a "working" library. When I did an integral implementation (in Python) I did never encounter underflow problems. It was always just a bug in my programming. – Erik Kjellgren Jun 07 '22 at 09:16

0 Answers0