qml.qchem.scf

scf(mol, n_steps=50, tol=1e-08)[source]

Return a function that performs the self-consistent-field calculations.

In the Hartree-Fock method, molecular orbitals are typically constructed as a linear combination of atomic orbitals

\[\phi_i(r) = \sum_{\mu} C_{\mu i} \chi_{\mu}(r),\]

with coefficients \(C_{\mu i}\) that are initially unknown. The self-consistent-field iterations are performed to find a converged set of molecular orbital coefficients that minimize the total energy of the molecular system. This optimization problem can be reduced to solving a linear system of equations which are usually written as

\[FC = SCE,\]

where \(E\) is a diagonal matrix of eigenvalues, representing the molecular orbital energies, \(C\) is the matrix of molecular orbital coefficients, \(S\) is the overlap matrix and \(F\) is the Fock matrix, which also depends on the coefficients. Fixing an initial guess \(C_0\), the corresponding \(F_0\) is built and the system \(F_0C_0 = SC_0E\) is solved to obtain a solution \(C_1\). This process is iteratively repeated until the coefficients are converged.

The key step in in this process is constructing the Fock matrix which is defined as

\[F = H + \frac{1}{2} J - K,\]

where \(H\), \(J\) and \(K\) are the core Hamiltonian matrix, Coulomb matrix and exchange matrix, respectively. The entries of \(H\) are computed from the electronic kinetic energy and the electron-nuclear attraction integrals, which are integrals over atomic basis functions. The elements of the \(J\) and \(K\) matrices are obtained from the Coulomb and exchange integrals over the basis functions.

Following the procedure in [Lehtola et al. Molecules 2020, 25, 1218], we express the molecular orbital coefficients in terms of a matrix \(X\) as \(C = X \tilde{C}\) which gives the following transformed equation

\[\tilde{F} \tilde{C} = \tilde{S} \tilde{C} E,\]

where \(\tilde{F} = X^T F X\), \(\tilde{S} = X^T S X\) and \(S\) is the overlap matrix. We chose \(X\) such that \(\tilde{S} = 1\) as

\[X = V \Lambda^{-1/2} V^T,\]

where \(V\) and \(\Lambda\) are the eigenvectors and eigenvalues of \(S\), respectively. This gives the eigenvalue equation

\[\tilde{F}\tilde{C} = \tilde{C}E,\]

which is solved with conventional methods iteratively.

Parameters
  • mol (Molecule) – the molecule object

  • n_steps (int) – the number of iterations

  • tol (float) – convergence tolerance

Returns

function that performs the self-consistent-field calculations

Return type

function

Example

>>> symbols  = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]], requires_grad = False)
>>> alpha = np.array([[3.42525091, 0.62391373, 0.1688554],
>>>                   [3.42525091, 0.62391373, 0.1688554]], requires_grad=True)
>>> mol = qml.qchem.Molecule(symbols, geometry, alpha=alpha)
>>> args = [alpha]
>>> v_fock, coeffs, fock_matrix, h_core, rep_tensor = scf(mol)(*args)
>>> v_fock
array([-0.67578019,  0.94181155])