# Efficient GPU Implementation of the McMurchie-Davidson Method for Shell-Based ERI Computations
## 4 Proposed Method
### Shell-Based ERI Computation  
From the definition of the Boys function in Equation (26), one can observe that the arguments of the Boys function are determined by the terms \(n\) and \(\omega|\mathbf{P}-\mathbf{P}^{\prime}|^{2}\). Whereas the former denotes the order of the Boys function, the latter is a parameter encoding the distance between Gaussian functions. Moreover, based on the definitions of \(\omega,\mathbf{P},\) and \(\mathbf{P}^{\prime}\), the reader may easily confirm that the computed values corresponding to the Boys function in the GTO-ERI with similar \(\alpha,\beta,\gamma,\delta,\mathbf{A},\mathbf{B},\mathbf{C}\) and \(\mathbf{D}\) are identical. Although evaluating computationally expensive Boys functions looks imperative for general GTOs showing distinct configurations of coefficient \(\alpha\) and center \(\mathbf{A}\), [PERSON] et al. [24] proposed the concept of a _shell_ to overcome the inevitable inefficiencies behind computing Boys functions repeatedly. Concretely speaking, a _shell_ is a set of GTOs with identical coefficient \(\alpha\) and center \(\mathbf{A}\), and is defined as follows:  
\[S_{\xi}(w,\mathbf{r},\mathbf{A},\alpha)=\big{\{}d_{\xi}G_{\xi}(\{\xi_{x},\xi_{y},\xi_{ z}\},\mathbf{r},\mathbf{A},\alpha)\mid\xi_{x},\xi_{y},\xi_{z}\geq 0,\xi_{x}+\xi_{y}+\xi_{z}=w \big{\}}. \tag{27}\]Here, \(d_{\xi}\) is the coefficient parameter as defined in Equation (7). Similarly, \(G_{\xi}(\xi_{x},\xi_{y},\xi_{z},r,A,\alpha)\) refers to the GTOs, as described in Equation (7), and is defined as:  
\[G_{\xi}(\{\xi_{x},\xi_{y},\xi_{z}\},r,A,\alpha)=c(x-A_{x})^{\xi_{x}}(y-A_{y})^{ \xi_{y}}(z-A_{z})^{\xi_{z}}\exp\Bigl{(}-\alpha|r-A|^{2}\Bigr{)}.\]  
From the above-mentioned definitions, a _shell_ is conceptualized as the set of GTOs with similar values of coefficient \(\alpha\), center \(A\), and the sum of azimuthal quantum numbers \(\xi_{x}+\xi_{y}+\xi_{z}\). Comparable to the definition of basis functions, _shells_ are often classified by the above-mentioned configurations and by following the order nomenclature of s-, p-, d-, and f-shells, and so on. Additionally, the number of GTOs within a _shell_ is determined by the sum of the azimuthal quantum numbers, as defined in Equation (27). For ease of reference to the reader, Table 2 presents the total number of GTOs available in each shell, which is derived from the fact that the number of non-negative integer pairs \((t,u,v)\) satisfying \(t+u+v=k\) is given by  
\[\frac{(k+2)!}{k!2!}=\frac{(k+2)(k+1)}{2}.\]  
Having presented the formal definition of a _shell_, we can also formally present the concept of ERIs with four shells using _shell_ concepts (termed shell-based ERI), as follows:  
\[(\xi\eta|\theta\kappa)=\iint S_{\xi}(\mathbf{r}_{1})S_{\eta}(\mathbf{r}_{1})\frac{1}{ r_{12}}S_{\theta}(\mathbf{r}_{2})S_{\kappa}(\mathbf{r}_{2})d\mathbf{r}_{1}d\mathbf{r}_{2}. \tag{28}\]  
In the above, parameters other than the coordinate vector \(\mathbf{r}\) are omitted for simplicity. Furthermore, in order to provide a glimpse of the configuration of shell-based ERIs, Figure 3 shows an example of shell-based ERIs with two s-shells \((S_{0},S_{1})\) and two p-shells \((S_{2},S_{3})\). Whereas the s-shell consists of one GTO, the p-shell consists of three GTOs, and thus three GTO-ERIs. Also, by observing Figure 3, shell-based ERIs are classified according to the type of shell they contain. For instance, the term \((ss|\) denotes that a _bra_ consists of two s-shells, and the term \(|sp)\) denotes that a _ket_ consists of one s-shell and one p-shell. Shell-based ERIs consisting of the above-mentioned types can also be classified as \((ss|sp)\). As an example, the upper right part of Figure 3 shows the configuration of \((ss|sp)\). When computing the GTO-ERIs within four shells, computational performance and throughput can be improved by efficiently reusing precomputed values of the Boys function.