# GPU-Accelerated Fock Matrix Computation with Efficient Reduction
## 2 Background
### Hartree-Fock Method  
The Schrodinger equation,  
\[\hat{H}\Psi=E\Psi, \tag{2}\]  
is a fundamental equation of quantum mechanics and primarily describes the behavior of electrons in quantum chemistry. The Hamiltonian \(\hat{H}\) is an operator that accounts for the kinetic energy and Coulomb energy of the atomic nuclei and electrons, and \(E\) represents the energy of a given system. It takes the form of an eigenvalue equation, and by solving Equation (2) with the atoms and their coordinates of the chemical system as input, we can obtain the wave function \(\Psi\) as output. While the wave function describes the orbitals of electrons within the system, Equation (2) involves the multivariate function \(\Psi(\mathbf{r}_{1},\mathbf{r}_{2},\ldots,\mathbf{r}_{N_{e}})\) contributed by \(N_{e}\) electrons at position \(\mathbf{r}\), becoming a many-body problem. In the Hartree-Fock method, the \(N\)-electron wave function \(\Psi\) is approximated using single-electron wave functions \(\phi\), which simplifies Equation (2) into the Hartree-Fock equation for \(M\) molecular orbitals  
\[\hat{F}\phi_{i}(\mathbf{r})=\varepsilon_{i}\phi_{i}(\mathbf{r}), \tag{3}\]  
where \(\hat{F}\) is the Fock operator, \(\varepsilon_{i}\) represents the orbital energies, and the molecular orbitals \(\phi_{i}\) is the wave function for a single-electron in a given system or molecule (\(1\leq i\leq M\)). However, Equation (3) is an integro-differential equation, making it difficult to directly determine the molecular orbitals \(\phi_{i}\). Therefore, Equation (3) is transformed into an algebraic equation by introducing the Linear Combination of Atomic Orbitals (LCAO) approximation  
\[\phi_{i}(\mathbf{r})=C_{1i}\chi_{1}(\mathbf{r})+C_{2i}\chi_{2}(\mathbf{r})+\cdots+C_{Mi} \chi_{M}(\mathbf{r}), \tag{4}\]  
which expresses the molecular orbitals \(\phi_{i}\) as a linear combination of atomic orbitals \(\chi_{\mu}(1\leq\mu\leq M)\). Equation (4) allows us to reduce the complex problem of finding molecular orbitals to determining the orbital coefficients \(C_{\mu i}\). By expanding the molecular orbitals using Equation (4), the Hartree-Fock equation is reduced to the Roothaan-Hall equation  
\[\mathbf{F}\mathbf{C}=\varepsilon\mathbf{S}\mathbf{C}, \tag{5}\]  
where \(\mathbf{S}\) is the overlap matrix and \(\mathbf{F}\) is the Fock matrix, the central focus of this paper. Equation (5) is a generalized eigenvalue problem and can be expressed in matrix form using \(M\times M\) matrices as follows:\[ \begin{pmatrix}F_{11}&\cdots&F_{1M}\\ \vdots&\ddots&\vdots\\ F_{M1}&\cdots&F_{MM}\end{pmatrix}\begin{pmatrix}C_{11}&\cdots&C_{1M}\\ \vdots&\ddots&\vdots\\ C_{M1}&\cdots&C_{MM}\end{pmatrix} \\ = \begin{pmatrix}\varepsilon_{1}&&O\\ &\ddots&\\ O&&\varepsilon_{M}\end{pmatrix}\begin{pmatrix}S_{11}&\cdots&S_{1M}\\ \vdots&\ddots&\vdots\\ S_{M1}&\cdots&S_{MM}\end{pmatrix}\begin{pmatrix}C_{11}&\cdots&C_{1M}\\ \vdots&\ddots&\vdots\\ C_{M1}&\cdots&C_{MM}\end{pmatrix} . \tag{6}\]  
As shown in Equation (6), the number of orbitals \(M\) determines the computational cost of the Hartree-Fock method, and its value depends on the atom count and atomic numbers in a chemical system. By solving the Roothaan-Hall equation using atomic orbitals approximated with known trial functions, the orbital coefficients \(C_{\mu i}\) and orbital energies \(\varepsilon_{i}\) are obtained as eigenvectors and eigenvalues, respectively. The Fock matrix is defined using several molecular integrals and orbital coefficients,  
\[F_{\mu\
u}=h_{\mu\
u}+\sum_{\lambda=1}^{M}\sum_{\sigma=1}^{M}D_{ \lambda\sigma}(2(\mu\
u|\lambda\sigma)-(\mu\lambda|\
u\sigma))=h_{\mu\
u}+2J_ {\mu\
u}-K_{\mu\
u}, \tag{7}\] \[J_{\mu\
u}=\sum_{\lambda=1}^{M}\sum_{\sigma=1}^{M}D_{\lambda \sigma}(\mu\
u|\lambda\sigma),\] (8) \[K_{\mu\
u}=\sum_{\lambda=1}^{M}\sum_{\sigma=1}^{M}D_{\lambda \sigma}(\mu\lambda|\
u\sigma), \tag{9}\]  
where \(h_{\mu\
u}\) denotes a value of one-electron integrals calculated as the sum of the kinetic energy integrals and nuclear attraction integrals [29].