qml.qchem.factorize¶
- factorize(two_electron, tol_factor=1e-05, tol_eigval=1e-05)[source]¶
Return the double-factorized form of a two-electron integral tensor in spatial basis.
The two-electron tensor \(V\), in chemist notation, is first factorized in terms of symmetric matrices \(L^{(r)}\) such that \(V_{ijkl} = \sum_r^R L_{ij}^{(r)} L_{kl}^{(r) T}\). The rank \(R\) is determined by a threshold error. Then, each matrix \(L^{(r)}\) is diagonalized and its eigenvalues (and corresponding eigenvectors) are truncated at a threshold error.
- Parameters
two_electron (array[array[float]]) – two-electron integral tensor in the molecular orbital basis arranged in chemist notation
tol_factor (float) – threshold error value for discarding the negligible factors
tol_eigval (float) – threshold error value for discarding the negligible factor eigenvalues
- Returns
tuple containing symmetric matrices (factors) approximating the two-electron integral tensor, truncated eigenvalues of the generated factors, and truncated eigenvectors of the generated factors
- Return type
tuple(array[array[float]], list[array[float]], list[array[float]])
Example
>>> symbols = ['H', 'H'] >>> geometry = np.array([[0.0, 0.0, 0.0], ... [1.398397361, 0.0, 0.0]], requires_grad=False) >>> mol = qml.qchem.Molecule(symbols, geometry) >>> core, one, two = qml.qchem.electron_integrals(mol)() >>> two = np.swapaxes(two, 1, 3) # convert to chemist notation >>> factors, eigvals, eigvecs = factorize(two, 1e-5, 1e-5) >>> print(factors) [[[ 1.06723440e-01 9.73575768e-15] [ 8.36288956e-15 -1.04898533e-01]] [[-2.20945401e-13 -4.25688222e-01] [-4.25688222e-01 -2.98228790e-13]] [[-8.14472856e-01 5.01669019e-13] [ 5.01689072e-13 -8.28642140e-01]]]
Theory
The second quantized electronic Hamiltonian is constructed in terms of fermionic creation, \(a^{\dagger}\) , and annihilation, \(a\), operators as [arXiv:1902.02134]
\[H = \sum_{\alpha \in \{\uparrow, \downarrow \} } \sum_{pq} h_{pq} a_{p,\alpha}^{\dagger} a_{q, \alpha} + \frac{1}{2} \sum_{\alpha, \beta \in \{\uparrow, \downarrow \} } \sum_{pqrs} h_{pqrs} a_{p, \alpha}^{\dagger} a_{q, \beta}^{\dagger} a_{r, \beta} a_{s, \alpha},\]where \(h_{pq}\) and \(h_{pqrs}\) are the one- and two-electron integrals computed as
\[h_{pq} = \int \phi_p(r)^* \left ( -\frac{\nabla_r^2}{2} - \sum_i \frac{Z_i}{|r-R_i|} \right) \phi_q(r) dr,\]and
\[h_{pqrs} = \int \frac{\phi_p(r_1)^* \phi_q(r_2)^* \phi_r(r_2) \phi_s(r_1)}{|r_1 - r_2|} dr_1 dr_2.\]The two-electron integrals can be rearranged in the so-called chemist notation which gives
\[V_{pqrs} = \int \frac{\phi_p(r_1)^* \phi_q(r_1)^* \phi_r(r_2) \phi_s(r_2)}{|r_1 - r_2|} dr_1 dr_2,\]and the molecular Hamiltonian can be rewritten as
\[H = \sum_{\alpha \in \{\uparrow, \downarrow \} } \sum_{pq} T_{pq} a_{p,\alpha}^{\dagger} a_{q, \alpha} + \frac{1}{2} \sum_{\alpha, \beta \in \{\uparrow, \downarrow \} } \sum_{pqrs} V_{pqrs} a_{p, \alpha}^{\dagger} a_{q, \alpha} a_{r, \beta}^{\dagger} a_{s, \beta},\]with
\[T_{pq} = h_{pq} - \frac{1}{2} \sum_s h_{pssq}.\]This notation allows a low-rank factorization of the two-electron integral. The objective of the factorization is to find a set of symmetric matrices, \(L^{(r)}\), such that
\[V_{ijkl} = \sum_r^R L_{ij}^{(r)} L_{kl}^{(r) T},\]with the rank \(R \leq n^2\) where \(n\) is the number of molecular orbitals. The matrices \(L^{(r)}\) are diagonalized and for each matrix the eigenvalues that are smaller than a given threshold (and their corresponding eigenvectors) are discarded.
The factorization algorithm has the following steps [arXiv:1902.02134]:
Reshape the \(n \times n \times n \times n\) two-electron tensor to a \(n^2 \times n^2\) matrix where \(n\) is the number of orbitals.
Diagonalize the resulting matrix and keep the \(r\) eigenvectors that have corresponding eigenvalues larger than a threshold.
Multiply the eigenvectors by the square root of the eigenvalues to obtain matrices \(L^{(r)}\).
Reshape the selected eigenvectors to \(n \times n\) matrices.
Diagonalize the \(n \times n\) matrices and for each matrix keep the eigenvalues (and their corresponding eigenvectors) that are larger than a threshold.