Ca, Da = diag_H(H, nbeta) Cb, Db = diag_H(H, nalpha) t = time.time() E = 0.0 Enuc = mol.nuclear_repulsion_energy() Eold = 0.0 # Initialize the JK object jk = psi4.core.JK.build(wfn.basisset()) jk.initialize() # Build a DIIS helper object diisa = scf_helper.DIIS_helper() diisb = scf_helper.DIIS_helper() print('\nTotal time taken for setup: %.3f seconds' % (time.time() - t)) print('\nStart SCF iterations:\n') t = time.time() for SCF_ITER in range(1, maxiter + 1): # Build Fock matrices J, K = scf_helper.compute_jk(jk, [Ca[:, :nbeta], Cb[:, :nalpha]]) J = J[0] + J[1] Fa = H + J - K[0] Fb = H + J - K[1]
Docc = np.dot(Cnocc, Cnocc.T) Cndocc = C[:, :ndocc] Ddocc = np.dot(Cndocc, Cndocc.T) t = time.time() E = 0.0 Enuc = mol.nuclear_repulsion_energy() Eold = 0.0 iter_type = 'CORE' # Initialize the JK object jk = psi4.core.JK.build(wfn.basisset()) jk.initialize() # Build a DIIS helper object diis = scf_helper.DIIS_helper() print('\nTotal time taken for setup: %.3f seconds' % (time.time() - t)) print('\nStart SCF iterations:\n') t = time.time() for SCF_ITER in range(1, maxiter + 1): # Build a and b fock matrices J, K = scf_helper.compute_jk(jk, [C[:, :nocc], C[:, :ndocc]]) J = J[0] + J[1] Fa = H + J - K[0] Fb = H + J - K[1] # Build MO Fock matrix
print('\nNumber of occupied orbitals: %d\n' % ndocc) print('Number of basis functions: %d\n' % nbf) # Build H_core V = mints.ao_potential() T = mints.ao_kinetic() H = T.clone() H.add(V) # Orthogonalizer A = S^(-1/2) A = mints.ao_overlap() A.power(-0.5, 1.e-16) # Build diis diis = helper_HF.DIIS_helper(max_vec=6) # Diagonalize routine def build_orbitals(diag): Fp = psi4.core.Matrix.triplet(A, diag, A, True, False, True) Cp = psi4.core.Matrix(nbf, nbf) eigvals = psi4.core.Vector(nbf) Fp.diagonalize(Cp, eigvals, psi4.core.DiagonalizeOrder.Ascending) C = psi4.core.Matrix.doublet(A, Cp, False, False) Cocc = psi4.core.Matrix(nbf, ndocc) Cocc.np[:] = C.np[:, :ndocc]