1 Introduction

The field of computational quantum chemistry has experienced extraordinary progress to date due to advances in computing power and the development of new algorithms. While advances have been reached, still there are limitations in the size and/or complexity of the systems that can be studied. In the second decade of the twenty-first century, the words of Paul Dirac in 1929 [1] still echo: the underlying physical laws necessary for the mathematical theory of a large part of physics and the whole of chemistry are thus completely known, and the difficulty is only that the exact application of these laws leads to equations much too complicated to be soluble. Today, Dirac’s statement still remains true and many of the equations governing the chemical phenomena are still too complex to solve using today’s computational resources.

To answer complex chemical phenomena, computational quantum chemistry has suffered multiple numerical approximations and simplifications. Some are approximations to the fundamental equations such as the Born–Oppenheimer approximation that greatly simplifies the Schrödinger equation by considering that the much heavier nuclei remain stationary during the calculation. Other approximations, for example, empirical and semiempirical methods, consider simplified forms of the first-principles underlying equations that are typically faster to solve. Other classes of methods in computational chemistry have abandoned the quantum chemical principles altogether, and classical approximations to the potential energy surfaces based on empirical force fields were developed, as they are computationally less intensive than quantum chemical electronic structure calculations. Empirical force fields are currently the methods of choice for studies of large systems in biology and materials science, for example conformational studies of proteins or DNA and protein–ligand binding thermodynamics. However, empirical force fields have severe limitations: limited applicability, difficulty in describing complex chemistries, and inability to describe systems where formation and breakage of bonds occur. Empirical force fields are highly parameterized and typically include terms for bonds, angles, and torsions plus non-bonding terms [2]. Empirical force fields are limited to the systems used in developing the parameters (e.g., proteins, lipids, DNA/RNA, etc.) and the parameterizations usually cover sp, sp 2, and sp 3 hybridizations. It is extremely difficult to cover complex chemical spaces with force fields, for example when transition metals are involved. The harmonic nature of force fields does not typically allow for breaking and formation of chemical bonds. In contrast, quantum chemical methods can describe most systems, but are still limited to small models, at least when compared to typical systems studied by classical force fields. QM/MM mix quantum chemical methods with empirical force fields and, thus, are able to study large adequate to describe large systems. QM/MM methods work better when the quantum region is highly localized but are, in general, inadequate to describe the dynamics of large systems.

Currently, many systems in biophysics, biochemistry, materials science, nanomedicine, etc., cannot be described using existing methodologies. These systems have huge chemical spaces that are impossible to cover using existing empirical force field methods and are too big for current quantum mechanics (QM) techniques, even the best linear scaling methods. There is a clear “capabilities gap” in existing computational methodologies that need to be urgently addressed. Not only emerging fields such as nanomedicine or materials science would benefit from new computational methodologies based on QM. Traditional applications of classical force field methods would benefit as well. For example, it is estimated that half of all proteins are metalloproteins [3]. Simulations of metalloproteins would greatly benefit from fast QM methods since existing classical force fields have problems describing such systems.

In summary, new computational methodologies are needed to bridge the “capabilities gap” between current quantum chemical methods and classical force fields. In the base Hartree–Fock method, the major contributors to the cost of the calculation are the computation of the two-electron-repulsion integrals (ERIs), with a formally quartically scaling O(N 4), although for large systems the scaling asymptotically approaches O(N 2), diagonalization of the Fock matrix with a cubically scaling O(N 3), and the self-consistent field (SCF) procedure that typically adds more than ten iterations for small systems. Development of new computational methodologies based on QM will have to address each of the restrictions in order to achieve acceptable speeds. The aim of the current work is to develop an alternative technique, based on accurate numerical approximations, for the fast computation of ERIs.

It was already apparent in the 1950s that calculations of polyatomic systems based on Slater-type orbitals would be intractable. The breakthrough occurred when Boys proposed basis functions based on Cartesian Gaussian functions [4]. Importantly, it was found that linear combinations of Gaussians, designated as contracted Gaussians, could approximate atomic orbitals with great accuracy. Ever since, contracted Gaussians have been the basis set of choice, being used in all of the major program packages.

Computation of ERIs has a long history. Initially, all molecular integrals were calculated explicitly since closed formulas for integrals over Gaussians were easily derived. The explicit analytical formulas being specific to each integral do not allow the systematic calculation of integrals of higher angular momentum. Several recursive methodologies were then developed and gained acceptance in modern computational quantum chemistry programs. In this category are included the methods of Rys polynomials [5, 6], McMurchie and Davidson [7] and Obara and Saika [8]. More recently, approximated methodologies have been developed to speed up the computation of ERIs, for example, approaches using density fitting or the Cholesky decomposition. A very good and recent review of the calculation of ERIs has been published by Reine et al. [9].

The methodology to compute ERIs proposed in this work differs in concept and praxis relative to previous and current approaches. Existing methodologies need to be generic and applicable to any basis set. In contrast, the method being proposed approximates a predetermined basis set and is designed to be fast using simple linear algebra operations. The new computational methodology will use single-ζ (double-ζ for transition metals) basis sets. This paper is a proof-of-concept on the development of accurate numerical approximations to the explicit analytical formulas for ERIs. The work will focus on the integral \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) with atoms A, B, and C being carbon. The choice of three-center integrals offers significant advantages. The numerical approximations are simpler in three-center ERIs than in four-center ERIs because fewer coordinates are required for the approximations. By keeping all elements the same, significant symmetry relationships are introduced and smaller domains for the coordinates can be considered (see Sect. 4; Fig. S1), thus reducing the number of target points that are required for the numerical approximations. Three-center ERIs are very important within density fitting approaches, in particular ERIs of the type \(( {\phi_{A} \phi_{B} |\eta_{C} })\), where \(\eta_{C}\) is used in the expansion of the product \(\phi_{C} ( r )\phi_{D} ( r)\) [9]. The four-center integrals will be approximated using a different approach and will be the subject of a different publication.

2 Theoretical background

2.1 Revisit the explicit analytical calculation of two-electron-repulsion integrals

In the early years of computational chemistry, ERIs were calculated using explicit analytical formulas [10]. The notation used for the explicit expressions of ERIs over Cartesian Gaussian functions is kept as close as possible to the one used by Clementi [11]. An important concept in molecular orbital theory is the expansion of the basis functions \(\phi_{i} ( A)\) as liner combinations of primitive Cartesian Gaussian type functions (GTFs):

$$\phi_{i} ( A) = \mathop \sum \limits_{a = 1}^{N} c_{i,a} \eta_{a} ( A)$$
(1)

Cartesian GTFs are composed of a radial Gaussian function multiplied by Cartesian coordinates x, y, and z with exponents \(l_{i}\), \(m_{i}\), and \(n_{i}\).

$$\eta_{i} ( A) = x_{A}^{{l_{i} }} y_{A}^{{m_{i} }} z_{A}^{{n_{i} }} \left( { - \alpha_{i} r_{A}^{2} } \right)$$
(2)

The basic steps required to derive the explicit analytical formula of \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) are briefly described. Testing the novel numerical algorithms on three-center ERIs is important because they are significantly simpler than the four-center counterparts, due to having fewer degrees of spatial freedom, while still requiring the same techniques to perform the approximation. ERIs over basis functions are themselves written as linear combinations of the primitive GTFs:

$$\left( {\phi_{\text{A}} \phi_{\text{B}} |\phi_{\text{C}} \phi_{\text{D}} } \right) = \mathop \sum \limits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} \left( {\eta_{\text{A}} \eta_{\text{B}} |\eta_{\text{C}} \eta_{\text{D}} } \right)$$
(3)

The advantage of using GTFs stemming from the Gaussian product rule is that the product of two GTFs is another GTF. In Eq. (3), the product of the first pair centered at A and B results in the general formula:

$$\begin{aligned} \eta \left( {\alpha_{1} ,{\mathbf{A}},l_{1} } \right)\eta \left( {\alpha_{2} ,{\mathbf{B}},l_{2} } \right) & = \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right) \\ & \quad \times \mathop \sum \limits_{i = 0}^{{l_{1} + l_{2} }} f_{i} \left( {l_{1} ,l_{2} ,\overline{\text{PA}}_{x} ,\overline{\text{PB}}_{x} } \right)x_{P}^{i} \exp \left( { - \gamma_{1} x_{P}^{2} } \right) \\ & \quad \times \mathop \sum \limits_{j = 0}^{{m_{1} + m_{2} }} f_{j} \left( {m_{1} ,m_{2} ,\overline{\text{PA}}_{y} ,\overline{\text{PB}}_{y} } \right)y_{P}^{j} \exp \left( { - \gamma_{1} y_{P}^{2} } \right) \\ & \quad \times \mathop \sum \limits_{k = 0}^{{n_{1} + n_{2} }} f_{k} \left( {n_{1} ,n_{2} ,\overline{\text{PA}}_{z} ,\overline{\text{PB}}_{z} } \right)z_{P}^{k} \exp \left( { - \gamma_{1} z_{P}^{2} } \right) \\ \end{aligned}$$
(4)

with

$$\gamma_{1} = \alpha_{1} + \alpha_{2}$$
(5)

and

$${\mathbf{P}} = \frac{{\alpha_{1} {\mathbf{A}} + \alpha_{2} {\mathbf{B}}}}{{\gamma_{1} }}$$
(6)

Similar equations can be derived for the second pair with:

$$\gamma_{2} = \alpha_{3} + \alpha_{4}$$
(7)

and

$${\mathbf{Q}} = \frac{{\alpha_{3} {\mathbf{C}} + \alpha_{4} {\mathbf{D}}}}{{\gamma_{2} }}$$
(8)

The functions \(f_{i}\), …, \(f_{{k^{\prime } }}\) appearing in Eq. (4) result from the application of the binomial theorem to the products of Gaussian functions. Their generic formula is:

$$f_{i} \left( {l_{1} ,l_{2} ,A,B} \right) = \mathop \sum \limits_{{j = \max \left( {0,i - l_{2} } \right)}}^{{\hbox{min} \left( {i,l_{1} } \right)}} \frac{{l_{1} !l_{2} !A^{{l_{1} - j}} B^{{l_{2} - i + j}} }}{{j!\left( {l_{1} - j} \right)!\left( {i - j} \right)!\left( {l_{2} - i + j} \right)!}} .$$
(9)

Explicit values of the function \(f_{i} ( {l_{1} ,l_{2} ,A,B} )\) are given in Table 1 up to l 1 + l 2 = 4. Substituting the pairs \(\eta ( {\alpha_{1} ,{\mathbf{A}},l_{1} })\eta ( {\alpha_{2} ,{\mathbf{B}},l_{2} } )\) and \(\eta ( {\alpha_{3} ,{\mathbf{C}},l_{3} })\eta ( {\alpha_{4} ,{\mathbf{D}},l_{4} } )\) into Eq. (3) results in the formal formula for the explicit analytical calculation of ERIs (Eq. 10) where the normalization factors are written as \(N_{\alpha }\).

Table 1 Possible values of the f function as a function of the quantum numbers l 1, l 2 and generic parameters A and B
$$\begin{aligned} \left( {\phi_{A} \phi_{B} |\phi_{C} \phi_{D} } \right) & = \mathop \sum \limits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} \left( {\eta_{A} \eta_{B} |\eta_{C} \eta_{D} } \right) \\ & = \mathop \sum \limits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} N_{a} N_{b} N_{c} N_{d} \\ & \quad \times \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right)\exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{CD}}^{2} /\gamma_{1} } \right) \\ & \quad \times \mathop \sum \limits_{i = 0}^{{l_{1} + l_{2} }} f_{i} \left( {l_{1} ,l_{2} ,\overline{\text{PA}}_{x} ,\overline{\text{PB}}_{x} } \right)\mathop \sum \limits_{j = 0}^{{m_{1} + m_{2} }} f_{j} \left( {m_{1} ,m_{2} ,\overline{\text{PA}}_{y} ,\overline{\text{PB}}_{y} } \right) \times \mathop \sum \limits_{k = 0}^{{n_{1} + n_{2} }} f_{k} \left( {n_{1} ,n_{2} ,\overline{\text{PA}}_{z} ,\overline{\text{PB}}_{z} } \right) \\ & \quad \times \mathop \sum \limits_{{i^{'} = 0}}^{{l_{3} + l_{4} }} f_{{i^{'} }} \left( {l_{3} ,l_{4} ,\overline{\text{QC}}_{x} ,\overline{\text{QD}}_{x} } \right)\mathop \sum \limits_{{j^{'} = 0}}^{{m_{3} + m_{4} }} f_{{j^{'} }} \left( {m_{3} ,m_{4} ,\overline{\text{QC}}_{y} ,\overline{\text{QD}}_{y} } \right)\mathop \sum \limits_{{k^{'} = 0}}^{{n_{3} + n_{4} }} f_{{k^{'} }} \left( {n_{3} ,n_{4} ,\overline{\text{QC}}_{z} ,\overline{\text{QD}}_{z} } \right) \\ & \quad \times \iint {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} \frac{1}{{r_{12} }}\exp \left( { - \gamma_{1} r_{{P_{1} }}^{2} - \gamma_{2} r_{{Q_{2} }}^{2} } \right){\text{d}}V_{1} {\text{d}}V_{2} } \\ \end{aligned}$$
(10)

A simplified notation, \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \},\) is introduced for the integral \(\mathop {\iint }\nolimits x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} \frac{1}{{r_{12} }}\exp ( { - \gamma_{1} r_{{P_{1} }}^{2} - \gamma_{2} r_{{Q_{2} }}^{2} } ){\text{d}}V_{1} {\text{d}}V_{2}\) in the remaining of the text.

Calculation of ERIs according to Eq. (10) requires repeated evaluations of \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\), “f” functions, normalization factors, and the two exponential functions \(\exp ( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } )\) and \(\exp ( { - \alpha_{3} \alpha_{4} \overline{\text{CD}}^{2} /\gamma_{2} } )\) over multiple loops. There are loops over the contraction coefficients, \(c_{a}\), \(c_{b}\), \(c_{c}\), and \(c_{d}\), and the indices i, j, etc. The indices i, j, etc., determine the “f” functions and the integrals \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\). The index i runs between zero and \(l_{1} + l_{2}\) and similarly for j, k, \(i^{\prime }\), …, which depend on \(m_{1} + m_{2}\), \(n_{1} + n_{2}\), \(l_{3} + l_{4}\), etc. When the exponents i, j, … are zero, the corresponding \(x_{{P_{1} }}^{i}\), \(y_{{P_{1} }}^{j}\) terms are indicated as “1” in \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\).

Although the complexity of the integrals \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\) increases with larger values of l 1, l 2, …, each is a well-defined function of \({\mathbf{P}}\) and \({\mathbf{Q}}\), through the distance \(\overline{\text{PQ}}\) and the corresponding nonzero projections along the Cartesian axis \(\overline{\text{PQ}}_{x}\), \(\overline{\text{PQ}}_{y}\), and \(\overline{\text{PQ}}_{z}\). Recalling the definitions of \({\mathbf{P}}\) and \({\mathbf{Q}}\) from Eqs. (6) to (8), respectively, the integrals \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\) are functions of the coordinates of A, B, C, and D (A, B, and C in the three-center case).

The main purpose of this work is to illustrate how the three-center integrals \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\), when carbon atoms are placed at the centers A, B, and C, can be calculated accurately through numerical approximation. In the following Sections, the specific simplifications introduced by considering a three-center ERI and the mathematical details of the numerical approximations are discussed.

2.2 Numerical fitting of three-center two-electron-repulsion integrals (p xA p xB |p xC p xC )

Calculation of the three-center ERI \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) involves significant simplifications resulting from many of the “f” factors becoming null, according to Table 1. After the null terms are omitted, Eq. (10) can be rewritten as:

$$\begin{aligned} \left( {p_{xA} p_{xB} |p_{xC} p_{xC} } \right) & = \mathop \sum \limits_{a,b,c} c_{a} c_{b} c_{c}^{2} N_{a} N_{b} N_{c}^{2} \times \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right) \\ & \quad \times \left[ {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} \left\{ {111|x_{{Q_{2} }}^{2} 11} \right\} + \left( {\overline{\text{PA}}_{x} + \overline{\text{PB}}_{x} } \right)\left\{ {x_{{P_{1} }} 11|x_{{Q_{2} }}^{2} 11} \right\} + \left\{ {x_{{P_{1} }}^{2} 11|x_{{Q_{2} }}^{2} 11} \right\}} \right] \\ \end{aligned}$$
(11)

The expressions of \(\{ {x_{{P_{1} }}^{2} 11|x_{{Q_{2} }}^{2} 11} \}\), \(\{ {x_{{P_{1} }} 11|x_{{Q_{2} }}^{2} 11} \}\), and \(\{ {111|x_{{Q_{2} }}^{2} 11} \}\) are, respectively:

$$\begin{aligned} \left\{ {x_{{P_{1} }}^{2} 11|x_{{Q_{2} }}^{2} 11} \right\} & = \frac{{\pi^{5/2} }}{{2\beta \left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }} \times \left\{ {4\beta^{2} F_{4} \left( t \right)\overline{\text{PQ}}_{x}^{4} - 12\beta F_{3} \left( t \right)\overline{\text{PQ}}_{x}^{2} + \left[ {2\left( {\gamma_{1} + \gamma_{2} } \right)\overline{\text{PQ}}_{x}^{2} + 3} \right]F_{2} \left( t \right)} \right. \\ & \quad \left. { - \frac{{\left( {\gamma_{1} + \gamma_{2} } \right)}}{\beta }F_{1} \left( t \right) + \frac{{\left( {\gamma_{1} + \gamma_{2} } \right)}}{\beta }F_{0} \left( t \right)} \right\} \\ \end{aligned}$$
(12a)
$$\left\{ {x_{{P_{1} }} 11|x_{{Q_{2} }}^{2} 11} \right\} = \frac{{\pi^{5/2} }}{{\beta \left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }}\left\{ {2\gamma_{2} \beta F_{3} \left( t \right)\overline{\text{PQ}}_{x}^{3} - \left[ {2\gamma_{2} F_{2} \left( t \right) + \left( {\gamma_{1} + \gamma_{2} } \right)F_{1} \left( t \right)} \right]\overline{\text{PQ}}_{x} } \right\}$$
(12b)
$$\left\{ {111|x_{{Q_{2} }}^{2} 11} \right\} = \frac{{\pi^{5/2} }}{{\beta \left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }}\left[ {2\gamma_{2}^{2} F_{2} \left( t \right)\overline{\text{PQ}}_{x}^{2} - \frac{{\gamma_{2} \left( {\gamma_{1} + \gamma_{2} } \right)}}{{\gamma_{1} }}F_{1} \left( t \right) + \frac{{\left( {\gamma_{1} + \gamma_{2} } \right)^{2} }}{{\gamma_{1} }}F_{0} \left( t \right)} \right]$$
(12c)

where β is defined as \(( {\gamma_{1} \gamma_{2} } )/( {\gamma_{1} + \gamma_{2} } )\) and the terms \(F_{n} ( t)\) are the Boys function:

$$F_{n} ( t) = \mathop \int \limits_{0}^{1} x^{2n} \exp \left( { - tx^{2} } \right){\text{d}}x$$
(13)

The evaluation of the Boys function had a recent renewed interest and was the subject of recent publications [12, 13]. A different algorithm was developed for this work and will be discussed in a forthcoming paper.

The integrals \(\{ {x_{{P_{1} }}^{i} y_{{P_{1} }}^{j} z_{{P_{1} }}^{k} |x_{{Q_{2} }}^{{i^{\prime } }} y_{{Q_{2} }}^{{j^{\prime } }} z_{{Q_{2} }}^{{k^{\prime } }} } \}\) have important characteristics that can be explored to simplify the numerical approximations. The factors \(\gamma_{1}\), \(\gamma_{2}\), and \(\beta\) depend on the orbital exponents and are unaffected by geometrical changes. The Boys functions \(F_{n} ( t)\) depend on the orbital exponents and separation between points P and Q, being independent of the spatial orientation of the system. In contrast, the factor \(\overline{\text{PQ}}_{x}\) (also y and z), which is the x component of the vector \({\mathbf{PQ}}\), depends on the orientation of the system. The “f” functions also introduce terms that depend on the orientation of the system, \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\) and \(( {\overline{\text{PA}}_{x} + \overline{\text{PB}}_{x} } )\) (see Table 1 and Eq. 11).

The algorithm developed for the calculation of ERIs is based on the multivariate numerical approximation of all functions contributing to the integrals in the desired interval. The terms contributing to Eq. (11) consisting of products of Eqs. (12a)–(12c) and their respective “f” terms from Table 1 have complex spatial dependencies resulting from the Boys functions, \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\), \(( {\overline{\text{PA}}_{x} + \overline{\text{PB}}_{x} } )\), and \(\overline{\text{PQ}}_{x}\) terms. The strategy used in this work consists in recasting the terms making the total ERI in terms of simpler functions which are products of the rotationally dependent functions \(\overline{\text{PQ}}_{x}\), \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\), and \(( {\overline{\text{PA}}_{x} + \overline{\text{PB}}_{x} } )\), designated as \(g_{n}^{\text{rot}}\), and a rotationally invariant term, \(G_{n}\). The index n is the exponent of \(\overline{\text{PQ}}_{x}\). In addition to the \(g_{n}^{\text{rot}}\) and \(G_{n}\) terms, there is an additional rotationally dependent term derived from \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\), \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\). The corresponding rotationally invariant term is designated as \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\). Using the terms of \(\overline{\text{PQ}}_{x}^{4}\) for illustration, the rotationally dependent functions \(g_{4}^{\text{rot}}\) and the corresponding rotationally independent term \(G_{4}\) are calculated as:

$$g_{4}^{\text{rot}} \left( {\overline{\text{PQ}}_{x}^{4} } \right) = \frac{{\mathop \sum \nolimits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} N_{a} N_{b} N_{c}^{2} \times \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right) \times \frac{{4\pi^{5/2} \beta }}{{2\left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }} \times \left( {\overline{\text{PQ}}_{x}^{4} } \right) \times F_{4} \left( t \right)}}{{\mathop \sum \nolimits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} N_{a} N_{b} N_{c}^{2} \times \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right) \times \frac{{4\pi^{5/2} \beta }}{{2\left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }} \times F_{4} \left( t \right)}}$$
(14)
$$G_{4} = \mathop \sum \limits_{a,b,c,d} c_{a} c_{b} c_{c} c_{d} N_{a} N_{b} N_{c}^{2} \times \exp \left( { - \alpha_{1} \alpha_{2} \overline{\text{AB}}^{2} /\gamma_{1} } \right) \times \frac{{4\pi^{5/2} \beta }}{{2\left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }} \times F_{4} \left( t \right)$$
(15)

The important rotationally invariant term \(G_{0}\), which makes a direct contribution to the total computed ERI, is

$$\begin{aligned} & G_{0} \\ & \quad = \frac{{\pi^{5/2} }}{{\beta \left( {\gamma_{1} + \gamma_{2} } \right)^{7/2} }}\left[ {6F_{2} \left( t \right) - \frac{{2\left( {\gamma_{1} + \gamma_{2} } \right)}}{\beta }F_{1} \left( t \right) + \frac{{2\left( {\gamma_{1} + \gamma_{2} } \right)}}{\beta }F_{0} \left( t \right) - \frac{{\gamma_{2} \left( {\gamma_{1} + \gamma_{2} } \right)}}{{\gamma_{1} }}F_{1} \left( t \right) + \frac{{\left( {\gamma_{1} + \gamma_{2} } \right)^{2} }}{{\gamma_{1} }}F_{0} \left( t \right)} \right] \\ \end{aligned}$$
(16)

3 Mathematical background

3.1 Multivariate approximation

In many applications, it is convenient to introduce approximate functions. An approximate function \(g( {\mathbf{x}} )\) is a function that given m data points x approximates the target values produced by the function \(f( {\mathbf{x}})\) as closely as possible according to some metric. The approximant \(g( {\mathbf{x}} )\) is desired to be as smooth and compact as possible. The need to approximate often occurs when it is too costly or complex to use the true function, or even when the true function is unknown. The mathematical theory of approximation is well documented (see for example Ref. [14]).

This work explores the possibility of approximating the complex and computationally costly Eq. (11) with simpler, and faster to evaluate, functions. All approximants are based on polynomial expansions (Eq. 17), in which the coefficients \(a_{i}\) are scalars and the basis functions \(H_{i} ( {\mathbf{x}} )\) can take different forms:

$$f( {\mathbf{x}}) = a_{0} + a_{1} H_{1} ( {\mathbf{x}}) + \cdots + a_{n} H_{n}( {\mathbf{x}})$$
(17)

The main criterion to determine the quality of an approximation is the measurement of the “distance” between target data points and the same set of points as obtained by the specified approximating function (approximant). It is important that the target and approximated points are as close as possible. A suitable metric to account for the global different between the set of true values and their respective approximations used extensively in this work is the l 2-norm.Footnote 1

The multivariate scheme developed in this work to approximate ERIs consists of multiple levels of bivariate (or univariate) approximants, with the fitting variables of a given level being expressed in terms of the variables of the next immediate level. The methodology is illustrated with the help of a 3-dimensional model depicted in Fig. 1. To approximate the point \(f( {x_{1} ,x_{2} ,x_{3} })\), represented by the red sphere, a numerical approximant \(g( {x_{1} ,x_{2} } )\) of all points on the \(( {x_{1} ,x_{2} })\) plane is first developed. The function \(g( {x_{1} ,x_{2} } )\) is expanded in terms of primitive functions \(H_{i} ( {x_{1} ,x_{2} })\) according to Eq. (17). The dependency of \(x_{3}\), which is illustrated in Fig. 1 by the vector originating at the blue sphere, is carried by fitting parameters \(a_{i}\) as functions of \(x_{3}\). In mathematical terms, the dependency of the fitting parameters \(a_{i}\) is given by another expansion similar to Eq. (17). The basis functions are represented by \(H_{i}^{\prime } ( {x_{3} } )\) and the expansion has adjustable coefficients \(a_{i}^{\prime }\):

Fig. 1
figure 1

Illustration of the spatial dependency of multilayered approximating functions

$$a\left( {x_{3} } \right) = a_{0}^{\prime } + \mathop \sum \limits_{i = 1}^{{n^{\prime } }} a_{i}^{\prime } H_{i}^{\prime } \left( {x_{3} } \right)$$
(18)

The process can be repeated multiple times, generating complex dependencies of multivariate functions. However, as the number of fitting parameters grows very fast with each additional layer of variable dependencies, in practice, the process is limited to a small number of layers.

In this work, the need for smooth functions arises because of the multiple dependencies of the variables. Since the fitting parameters carry additional dependencies themselves, it is important that they are as smooth as possible to avoid discontinuities that make the next level fittings more complex. Other important criteria in defining the fitting process are computational efficiency, simplicity of algorithm implementation, and future evolution of the method. When designing algorithms for numerical approximation, it is important to consider how fast and accurate the method is in the present and to have a clear plan for future development.

The fitting functions were chosen to be bivariate Chebyshev orthogonal polynomials. Chebyshev polynomials form an important class of functions in curve fitting [15]. A similar expansion can be developed for surfaces \(f( {x,y} )\) where the polynomial is based on to Chebyshev series with \(\bar{x},\bar{y} \in [ { - 1,1} ] \times [ { - 1,1} ]\):

$$f\left( {x,y} \right) = \mathop \sum \limits_{i = 0}^{{n_{x} }} \mathop \sum \limits_{j = 0}^{{n_{y} }} a_{ij} T_{i} \left( {\bar{x}} \right)T_{j} \left( {\bar{y}} \right)$$
(19)

The 2-dimensional Chebyshev expansion was evaluated directly by computing the polynomials and summing all contributions according to Eq. (19).

3.2 Choice of coordinates

Each of the terms \(g_{n}^{\text{rot}}\), \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} })\), \(G_{n}\), and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) required to calculate ERIs according to the prescription of Eqs. (14)–(16) can be expressed in terms of a finite number of variables. Fitting of three-center ERIs requires six coordinates that are used to position the atomic centers carrying the basis functions. Importantly, only the total number of variables has to be fulfilled and not the nature of the individual coordinates as long as they provide the spatial assignment of the atomic centers. It is, however, advisable to use combinations of variables that lead to simpler fitting expressions, in addition to having physical meanings that can be related to common geometrical transformations. In this respect, bond distances, angles, and torsions are prime candidates.

The protocol followed in this work consists in separating the rotationally dependent terms of \(\overline{\text{PQ}}_{x}^{n}\) and \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\) from the rotational invariant counterparts. The set of coordinates chosen for the fitting of the rotationally invariant part is two distances, \(r_{1}\) and \(r_{2}\), and the internal angle α. \(r_{1}\) is the distance between the centers A and B and \(r_{2}\) is the separation between \({\mathbf{C}}\) and the midpoint of \({\mathbf{AB}}\), represented by \({\mathbf{O}}\). α is the angle \(\widehat{\text{COA}}\) (see Fig. 2). The projection \(\overline{\text{PQ}}_{x}\) (also \(\overline{\text{PQ}}_{y}\) and \(\overline{\text{PQ}}_{z}\)) and \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\) require special attention since they affect the rotational invariance of the integrals. Its spatial dependency is significantly more complex, requiring an extra set of coordinates. The extra variables are the polar spherical coordinates θ and φ, which are used to position the atomic center C and the dihedral angle τ, which is used to determine the relative orientation of centers A (and B) relative to C (see Fig. 2).

Fig. 2
figure 2

Illustration of the coordinates used in the fitting of three-center electron-repulsion integrals

4 Results and discussion

The following section is dedicated to evaluating the accuracy, and speed, of the numerical algorithm to approximate ERIs. Emphasis is placed on testing the ability of the method to accurately reproduce the integral \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) with carbon atoms at A, B, and C. All calculations were based on the STO-6G basis set. This basis set is sufficiently small to allow computation of the many target ERIs used in the parameterization in a reasonable time. All calculations were done on an AMD Ryzen 1700 CPU and 24 GByte of RAM memory. All codes were compiled with Gfortran using the –O3 compiler flag. The approximation of the rotationally independent terms is discussed first, with \(G_{4}\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) being used as examples. Afterward, the fitting of the rotationally dependent terms is analyzed. The approximating methodologies are illustrated with the help of \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\), since it is the largest contributor to the total ERI and is also representative of the other terms. The accuracy and speed of the multivariate methodology of approximation are discussed in Sects. 4.2 and 4.3.

The goodness-of-fit of the approximants was measured in terms of the root-mean-square error (RMSE). RMSE measures the total deviation of the computed from the target values, and a value closer to zero indicates the fit is good and is useful for prediction.

The domains of the variables influencing the rotation of the systems are \(\alpha \in [ {0,180^\circ } ]\) and \(\tau ,\theta ,\varphi \in [ {0,90^\circ } ]\). The domains of τ, θ, and φ are limited to 90° because of the symmetry relations resulting from having the same element at the positions A, B, and C. Figure S1 illustrates the symmetry effects for the dependencies of (α, τ) and (θ, φ) for the function \(g_{4}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{4} } )\).

4.1 Fitting the rotationally independent terms \(G_{n} ( {\alpha ,r_{1} ,r_{2} })\) and \(G_{{\overline{PA}_{x} \overline{PB}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\)

The protocol described in Sect. 3.1 for the multivariate fitting of the different terms making the explicit analytical expression of the ERIs starts with the initial fitting of rotationally invariant functions \(G_{n} ( {\alpha ,r_{1} ,r_{2} } )\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} })\). In most cases, these are auxiliary functions used to create smoother rotationally dependent surfaces that are easier to fit, although \(G_{0} ( {\alpha ,r_{1} ,r_{2} })\) contributes directly to the final integral (Eq. 16). The dependencies of \(G_{n}\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) are on the angle α and distances r 1 and r 2. The protocol followed in this work for the fitting of \(G_{n} ( {\alpha ,r_{1} ,r_{2} } )\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\) calls to the initial fitting of the α dependency. The plots of \(G_{n} ( {\alpha ,r_{1} ,r_{2} })\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\) functions relative to α (with r1 and r2 fixed) show a similar symmetric sinusoidal curve. The dependency of \(G_{4} ( {\alpha ,r_{1} = 2.6\; {\text{a}} . {\text{u}} .,r_{2} = 5.0 \;{\text{a}} . {\text{u}} .} )\) is illustrated on Fig. S2. The function of choice for the fitting of the dependency of α, in radians, was a rational polynomial written of the form:

$$f^{\prime } ( \alpha ) =\Delta \left( {r_{1} ,r_{2} } \right)\left( {\frac{{a_{1} \left( {r_{1} ,r_{2} } \right)\alpha^{2} + a_{2} \left( {r_{1} ,r_{2} } \right)\alpha^{4} }}{{1.0 + a_{3} \left( {r_{1} ,r_{2} } \right)\alpha^{2} + a_{4} \left( {r_{1} ,r_{2} } \right)\alpha^{4} + a_{5} \left( {r_{1} ,r_{2} } \right)\alpha^{6} }}} \right) + a_{0} \left( {r_{1} ,r_{2} } \right)$$
(20)

The dependency of each \(a_{i}\) term on \(( {r_{1} ,r_{2} })\) is highlighted in Eq. (20), in accordance with the multivariate fitting algorithm described in Sect. 3.1. The rational expansion was found to be acceptable in terms of computational cost and accuracy. Because of the dependence of the coefficients on the distances r 1 and r 2, it is important to keep the polynomial expansion above as compact as possible.

The dependency of the coefficients \(a_{0}\) and \(a_{5}\) in Eq. (20) on \(( {r_{1} ,r_{2} } )\) is illustrated in Fig. 3. The key assumption of this work that the fitting coefficients of a polynomial approximant at a certain level have smooth spatial dependencies of the variables of the next level, and thus, are able to carry that spatial dependency, is fully fulfilled. Although no rigorous mathematical proof is presented, the surfaces of \(a_{i}\) and \(\Delta\) are smooth and can be approximated using the multivariate techniques presented before. Each coefficient \(a_{i} ( {r_{1} ,r_{2} } )\) and \(\Delta\) were fitted with bivariate Chebyshev polynomials with arguments \(\bar{r}_{1}\) and \(\bar{r}_{2}\) (see Eq. 1). The order of the expansion was truncated at order 20. It is the largest order of the Chebyshev polynomials used in this work. The computational cost of using such a long expansion is not prohibitive for two reasons. First, each increase in the order of the Chebyshev polynomial only contributes its associated number of parameters times the number of parameters of the univariate polynomial expansion of α. Second, the rotationally invariant terms only need to be calculated once and can be stored. The same rotationally invariant term, \(G_{n} ( {\alpha ,r_{1} ,r_{2} } )\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} })\), can be used in the fitting of all ERIs regardless of involving p x , p y, or p z functions. The explicit expression for fitting all spatial dependencies of \(G_{n} ( {\alpha ,r_{1} ,r_{2} } )\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\), combining Eq. (2) above with the bivariate \(( {r_{1} ,r_{2} } )\) Chebyshev polynomial for each of the coefficients \(a_{i}\) is

$$\begin{aligned} & G_{n} \left( {\alpha ,r_{1} ,r_{2} } \right)\quad \hbox{or}\quad G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} \left( {\alpha ,r_{1} ,r_{2} } \right) \\ & \quad = \left( {\mathop \sum \limits_{i = 0}^{n} \mathop \sum \limits_{j = 0}^{n} a_{ij}^{{\left(\Delta \right)}} T_{i} \left( {\bar{r}_{1} } \right)T_{j} \left( {\bar{r}_{2} } \right)} \right) \times \left[ {\frac{{\left( {\mathop \sum \nolimits_{i = 0}^{n} \mathop \sum \nolimits_{j = 0}^{n} a_{ij}^{\left( 1 \right)} T_{i} \left( {\bar{r}_{1} } \right)T_{j} \left( {\bar{r}_{2} } \right)} \right)\alpha^{2} + \cdots }}{{1.0 + \left( {\mathop \sum \nolimits_{i = 0}^{n} \mathop \sum \nolimits_{j = 0}^{n} a_{ij}^{\left( 3 \right)} T_{i} \left( {\bar{r}_{1} } \right)T_{j} \left( {\bar{r}_{2} } \right)} \right)\alpha^{2} + \cdots }}} \right] \\ & \quad + \left( {\mathop \sum \limits_{i = 0}^{n} \mathop \sum \limits_{j = 0}^{n} a_{ij}^{\left( 0 \right)} T_{i} \left( {\bar{r}_{1} } \right)T_{j} \left( {\bar{r}_{2} } \right)} \right) \\ \end{aligned}$$
(21)

where \(T_{i} ( {\bar{r}_{1} } )\) is the Chebyshev polynomial of the first kind of degree \(i\) with argument \(\bar{r}_{1}\), and \(T_{j} ( {\bar{r}_{2} })\) is similarly defined for \(j\) and \(\bar{r}_{2}\). The approximations are extremely accurate with overall RMSEs lower than 5.0E−09. The residuals for \(G_{n} ( {\alpha ,r_{1} ,r_{2} } )\) and \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\) are plotted in Figs. S3 and S4, respectively, for α = 49.1° and τ = 66.7°.

Fig. 3
figure 3

Illustration of the spatial dependency of a 0 and a 5 of the rotationally independent term. \(G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }} ( {\alpha ,r_{1} ,r_{2} } )\). The surfaces are smooth and suitable for accurate approximation

4.2 Fitting the rotationally dependent terms \({\varvec{g}}_{\varvec{n}}^{{\mathbf{rot}}} (\overline{{{\mathbf{PQ}}}} _{\varvec{x}}^{\varvec{n}})\) and \({\varvec{g}}^{{\mathbf{rot}}} (\overline{{{\mathbf{PA}}}} _{\varvec{x}} \overline{{{\mathbf{PB}}}} _{\varvec{x}})\)

The rotationally dependent functions hold the effects of the \(\overline{\text{PQ}}_{x}^{n}\), \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\), and \(( {\overline{\text{PA}}_{x} + \overline{\text{PB}}_{x} })\) terms in the three-center ERI of the kind \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\). These are considerably more challenging to approximate, since they depend on six variables instead of the three variables in the rotationally independent terms.

Two quantities were defined to measure the contribution of each term to the total ERI: the average absolute percentage contribution (AAPC) and maximum absolute percentage contribution (MAPC). The absolute value of each term was chosen because each can be positive or negative. The AAPC and MAPC quantities are calculated for the term f a as, respectively, \({\text{AAPC}} = 100 \times \left[ {\mathop \sum \nolimits_{i}^{n} \left( {\left| {f_{a,i} } \right|/n\left( {\left| {f_{1,i} } \right| + \cdots + \left| {f_{7,i} } \right|} \right)} \right)} \right]\) and \(100 \times \hbox{max} [ {| {f_{a,i} } |/( {| {f_{1,i} } | + \cdots + | {f_{7,i} }|})}]\). Values closer to 100% indicate a stronger contribution to the integral and likewise values close to zero mean smaller contributions. The most significant contributors are the rotationally independent term \(G_{0}\) and the rotationally dependent function of \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\). Interestingly, all the terms containing the projections \(\overline{\text{PQ}}_{x}\) make considerably smaller contributions (see Table 2). According to the relevance of each term, different expansions can be defined without imparting significantly the accuracy of the approximation. The \(G_{0}\) term is already fitted with the highest order of any Chebyshev polynomial, and the accuracy of the approximations can be hardly improved.

Table 2 Average absolute percentage contribution (AAPC) and maximum absolute percentage contribution (AAPC) of each term contributing to \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\)

The fitting protocol for \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} })\) and \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) requires three layers of fittings using bivariate Chebyshev polynomials. The pairing of variables is: \(( {\theta ,\varphi })\)  \(( {\alpha ,\tau } )\) → \(( {r_{1} ,r_{2} } )\). In the first step, fitting functions \(f( {\theta ,\varphi } )\) are determined for each of the target points \(( {\alpha ,\tau ,r_{1} ,r_{2} } )\) (see Eq. 22a). The coefficients \(a_{ij}\) carry the dependency of the remaining variables α, τ, r 1, and r 2. In the second level of optimization, each of the coefficients \(a_{ij}\) is fitted similarly with a bivariate Chebyshev polynomial (Eq. 22b). The fitting coefficients \(b_{kl}^{ij}\) carry the dependency of \(( {r_{1} ,r_{2} } )\) and each is fitted in the third level of fittings (Eq. 22c).

$$g^{\text{rot}} \approx f\left( {\theta ,\varphi } \right)_{{|\alpha^{0} ,\tau^{0} ,r_{1}^{0} ,r_{2}^{0} }} = \left( {\mathop \sum \limits_{i = 0}^{n} \mathop \sum \limits_{j = 0}^{n} a_{ij} \left( {\alpha ,\tau ,r_{1} ,r_{2} } \right)T_{i} \left( {\bar{\theta }} \right)T_{j} \left( {\bar{\varphi }} \right)} \right)$$
(22a)
$$a_{ij} \left( {\alpha ,\tau } \right)_{{|r_{1}^{0} ,r_{2}^{0} }} = \left( {\mathop \sum \limits_{k = 0}^{n} \mathop \sum \limits_{l = 0}^{n} b_{kl}^{ij} \left( {r_{1} ,r_{2} } \right)T_{k} \left( {\bar{\alpha }} \right)T_{l} \left( {\bar{\tau }} \right)} \right)$$
(22b)
$$b_{kl}^{ij} \left( {r_{1} ,r_{2} } \right) = \left( {\mathop \sum \limits_{i = 0}^{n} \mathop \sum \limits_{j = 0}^{n} c_{mn}^{ij,kl} T_{m} \left( {\bar{r}_{1} } \right)T_{n} \left( {\bar{r}_{2} } \right)} \right)$$
(22c)

In Eq. (22), the superscript “0” means that the corresponding variable assumes a fixed value.

Figure 4 illustrates selected surfaces \(f( {\theta ,\varphi })\) for specific values of \(( {r_{1} ,r_{2} })\), and \(( {\alpha ,\tau })\). All surfaces have similar Gaussian-like shapes. It is noteworthy that to facilitate the numerical approximations, the surfaces were symmetrized through the change in coordinate \(\theta^{*} = 180^{^\circ } - \theta\). The functions of \(\overline{\text{PQ}}_{x}^{n}\) were approximated with Chebyshev polynomials of order 14. The rotationally dependent function of \(\overline{\text{PA}}_{x} \overline{\text{PB}}_{x}\) was approximated with Chebyshev polynomials of different orders, from 8 to 20. The overall results are discussed in Sect. 4.3.

Fig. 4
figure 4

Illustration of the dependency of θ and φ for fixed values of r 1, r 2, α, and τ for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} })\). a, b show the effect of varying α and τ, whereas b and c illustrate the effect of varying r 1, r 2. Fitting of each surface will require calculation of the coefficients a ij of Eq. (22a)

The next step in the fitting process consists in fitting the \(a_{ij} ( {\alpha ,\tau } )\) surfaces. Figure 5 illustrates the coefficients a 1 and a 231 of the \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) term for r 1 = 2.5 a.u. and r 2 = 5.0 a.u. Similarly to the approximation of the rotationally independent terms, the bivariate surfaces \(a_{ij} ( {\alpha ,\tau } )\) are smooth and were easily approximated with bivariate Chebyshev polynomials. It was opted to approximate the \(a_{ij} ( {\alpha ,\tau } )\) and \(f( {\theta ,\varphi } )\) surfaces with the Chebyshev polynomials of the same order for simplicity.

Fig. 5
figure 5

Illustration of dependency of the coefficients a ij of Eq. (22a) on the angles α and τ for fixed values of r 1 = 2.5 a.u. and r 2 = 5.0 a.u for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\). The surfaces are smooth and have distinctive magnitudes that can be explored to reduce the order of the polynomials used in the fittings

The final step in the approximation of the rotationally dependent functions is the fitting of the coefficients \(b_{kl}^{ij} ( {r_{1} ,r_{2} } )\). In Fig. 6, the surfaces corresponding to \(b_{1}^{1}\) and \(b_{2}^{231}\) for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) are shown as a function of the remaining coordinates \(r_{1}\) and \(r_{2}\). The dependency of the \(b_{kl}^{ij}\) coefficients is considerably simpler with the functions being monotonically increasing or decreasing in \(r_{1}\) (i.e., for fixed values of \(r_{2}\)). Important simplifications can be introduced in the approximation of the \(b_{kl}^{ij}\) coefficients since many can be eliminated due to their small contribution to the \(a_{ij} ( {\alpha ,\tau } )\) terms. While the terms derived from \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } )\) were approximated by Chebyshev polynomials of order 14, the effect of the length of the Chebyshev polynomials on the accuracy was tested for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\). \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) was chosen because of all rotationally dependent terms is single largest contributor to the total ERI. The quality of the different approximants of \(( {\theta ,\varphi } )\), \(a_{ij} ( {\alpha ,\tau } )\), and \(b_{kl}^{ij} ( {r_{1} ,r_{2} } )\) is gauged in Table 3, where goodness-of-fit results are presented and compared for the rotationally dependent terms. The total number of nonzero \(b_{kl}^{ij}\) terms is also shown. They determine the speed and accuracy of the proposed methodology. Starting with the \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) term, the RMSE values are good for all Chebyshev expansions and are systematically improved for higher orders. Very important is the slow growth of the number of nonzero \(b_{kl}^{ij}\) terms, meaning improvements of accuracy come with small additional computational costs. For the \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } )\) terms, accuracy varies significantly, ranging from RMSE values of ~ 10−7 for \(g_{3}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{3} } )\) and ~ 10−5 for \(g_{2}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{2} } )( {l_{1} + l_{2} = 2} )\). Importantly, the highest RMSE occurs for terms with the lowest number of nonzero terms, opening the possibility of improving the accuracy without significant additional computational costs by using longer expansions for terms with fewer nonzero elements. The improvement of the accuracy with higher-order expansions is shown pictorially in Fig. S5 where histograms of residuals are plotted for the four expansions used for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\). The spread of the residuals becomes increasingly narrower and with the expansion of order 20 most errors are in the interval [−5.0E−06, 5.0E−06]. It is important to stretch that approximation with bivariate Chebyshev polynomials provides a way to systematically improve the quality of the approximation.

Fig. 6
figure 6

Illustration of the dependency of the coefficients \(b_{kl}^{ij} ( {r_{1} ,r_{2} } )\) of Eq. (22b) on the distances r 1 and r 2 for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\). The surface on the left (a) is for \(b_{1}^{1} ( {r_{1} ,r_{2} } )\) and the surface on the right (b) is for \(b_{2}^{231} ( {r_{1} ,r_{2} } )\). The surfaces are monotonically increasing or decreasing in the r 1 direction, i.e., for fixed r 2. These surfaces can be approximated with more compact Chebyshev polynomials, thus reducing the overall computational cost

Table 3 Goodness-of-fit estimates and number of nonzero elements \(b_{kl}^{ij}\) for terms \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } ),n = 1,2,3,4\) and \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\)

4.3 Adding all together: assembly of the computed \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) two-electron-repulsion integral

The culmination of this work on the numerical approximation of ERIs is the assembly of the calculated \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) ERIs from the different terms discussed above and the comparison with the real explicit analytical values. The contributors to the calculated ERI are the rotationally invariant term G 0, the rotationally dependent terms \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } ) \cdot G_{n}\) and \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } ) \cdot G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\). The approximation of G 0 was unique, using the highest order expansion of this work (Chebyshev polynomials of order 20 for the dependency of r 1 and r 2). Goodness-of-fit results for the total ERI are shown in Table 4. The results do not represent the full potential of the methodology since the contributions from both \(g_{2}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{2} } ) \cdot G_{2}\) terms dominate. For this reason, there is no improvement when using Chebyshev polynomials of order 20 for \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } ) \cdot G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) relative to order 14. However, the RMSEs for some of the \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } ) \cdot G_{n}\) terms can be improved approximately an order of magnitude by using longer Chebyshev polynomials as in \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) terms (see Table 3). It is important to stretch not only the magnitude, but also the distribution of the residuals. In Fig. 7, the residuals for r 1 = 2.5 a.u., r 2 = 5.0 a.u., α = 49.1°, 165.5°, and τ = 66.7°, 61.6° are plotted as a function of θ and φ for two Chebyshev expansions of \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) (order 20 and order 14). The dominant effect of both \(g_{2}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{2} } ) \cdot G_{2}\) terms is evident on Fig. 7a where the total ERI surface follows roughly the contributions from \(g_{2}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{2} } ) \cdot G_{2} ( {l_{1} + l_{2} = 0} )\) and \(g_{2}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{2} } ) \cdot G_{2} ( {l_{1} + l_{2} = 2} )\) (see Fig S3 for plots of \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } ) \cdot G_{n}\) and Fig S4 for plots of \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } ) \cdot G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\)). When \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } ) \cdot G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) is also fitted with Chebyshev polynomials of order 14, the resulting ERI does not show any dominant contributions since all terms have a similar effect. The biggest residual is approximately one order of magnitude smaller when \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } ) \cdot G_{{\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} }}\) is fitted with polynomials of order 20. It is important to stretch that accuracy can be systematically improved by using longer expansions for the fitting of selected \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } ) \cdot G_{n}\) terms. The same pattern was found for other points, and in the future an exhaustive statistical study will be performed to better understand the spatial dependencies of the total fitted ERIs.

Table 4 Goodness-of-fit estimates and total execution timings for the approximated \(( {p_{xA} p_{xB} |p_{xC} p_{xD} } )\) ERI
Fig. 7
figure 7

Illustration of the residuals of the total computed ERI for two fittings of the term \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) (Chebyshev polynomials of order 20 and 14). The rotationally dependent terms \(g_{n}^{\text{rot}} ( {\overline{\text{PQ}}_{x}^{n} } )\) were only fitted with Chebyshev polynomials of order 14. Fitting \(g^{\text{rot}} ( {\overline{\text{PA}}_{x} \overline{\text{PB}}_{x} } )\) with order 20 polynomials results in residuals one order of magnitude smaller than when fitting with order 14 polynomials. Importantly, the biggest absolute residuals are typically localized at θ = 90° and φ = 0°

The timings of the calculation of 505,000 ERIs using the numerical approximated developed in this work and a reference method are given in Table 4. The reference results are from Uquantchem [16] which computes ERIs using Rys polynomials [5, 6]. The total execution time of the present method is mostly dependent on the number of nonzero \(b_{kl}^{ij}\) terms. Importantly, longer Chebyshev expansions result in significant improvements of accuracy, while adding comparatively fewer \(b_{kl}^{ij}\) terms. It is safe to say that the methodology developed in this work can be systematically improved with only a small penalty on the total execution time. Despite the significant results, with a speedup of 12.6, consideration of the timings required for the numerical approximation of ERIs is secondary in this work. The calculations were performed monolithically using fixed polynomial expansions for most fittings, and no optimizations of the fitting polynomials were attempted. In the future, specific optimizations will be introduced and Chebyshev polynomials of different orders will be tested to provide the best cost/benefit result.

5 Conclusions and future prospects

This work is the first step of a large effort to develop novel tight-binding computational methodologies to study large and complex systems. In the path to faster and more generic computational quantum methods, three aspects are the most significant: (1) computation of ERIs, theoretically an O(N 4) process, although for large systems, the asymptotic scaling approaches O(N 2), (2) diagonalization, itself an O(N 3) process, and (3) the SCF iterations. The focus of this work was on the efficient and accurate computation of ERIs. The approach consisted in using multivariate approximation techniques to reproduce pre-computed target data. It is a proof-of-concept work aimed at demonstrating the feasibility of such approximations. To my best knowledge, this was the first time that such techniques have been published.

The test system was the three-center ERI \(( {p_{xA} p_{xB} |p_{xC} p_{xC} } )\) with all atoms being carbons. Having all atoms the same, introduced important symmetry relations that reduced the amount of data required to develop the approximations. In the initial phase of development, when multiple calculations were needed to generate adequate target data, it was important to keep the number of calculations to a minimum. The same holds for the target basis set. The small STO-6G basis set was used because it allowed efficient calculation of the many ERIs required as target data.

The methodology for the numerical approximation consisted in decomposing a six-variable problem, and a three-variable problem, into three-bivariate problems, and one-univariate plus one-bivariate problem, respectively. The chosen approximating functions were bivariate Chebyshev polynomials and a univariate rational polynomial. The assumption was that for each sequential variable reduction, the approximating coefficients yield a continuous function that can be approximated by another set of polynomial approximants. If the approximating coefficients of a certain layer span a continuous surface, they can be fitted in the next layer of approximations using the same techniques. Although no mathematical justification was attempted, it was indeed verified that all surfaces and the single curve are continuous and could be accurately approximated. It is important to remember that the novel methodology to approximate ERIs is not general and is not intended to replace existing methodologies.

The results are excellent with reasonably small errors. In plots of residuals for two specific points, the best approximant gives absolute errors significantly less than 1.0E−05, for most of the approximating domains. This means that the approximating methodology is able to maintain the rotational invariance of the computed integrals. Importantly, the new approach does not depend on the size of the contractions of the basis set. Although it was not a priority of this work, and no special attempts were made to optimize the speed of the numerical approximations, the methodology is very fast. Without specific optimization of the different Chebyshev expansions, the numerical approximation of the ERIs is 12.6 times faster than the calculation of the same ERIs using Rys polynomials as implemented in Uquantchem [16]. Considerable speed gains are expected from using optimized numerical libraries and GPU computing.

The first major development in the future will be the creation of a library of approximated ERIs, starting with the most common elements in Biology: H, C, N, O, S, Na, K, Cl, Fe, Zn, Cu, and Ni. Appropriate single- and double-ζ basis sets will be developed for these elements, and a new tight-binding approach will be implemented to take advantage of this work.

In conclusion, this work opens new perspectives to the future of computational chemistry, for example in molecular simulations of large and complex systems. The efficient computation of ERIs eliminates a significant barrier to the generalization of computational quantum methods to large systems and will allow the development of specialized quantum-based methodologies that will be simultaneously fast and accurate.