def energy_correction(basis_sets, deriv, ref_energies): low_cbs_hess = corl_xtpl_helgaker_2("basis set xtpl Hess", basis_sets[1], deriv[2], basis_sets[0], deriv[1]) low_cbs_e = corl_xtpl_helgaker_2("basis set xtpl E", basis_sets[1], ref_energies[2], basis_sets[0], ref_energies[1]) # This is, for instance, mp2/[T,Q]Z + CCSD(T)/DZ - mp2/DZ + SCF/QZ final_hess = Matrix.from_array(low_cbs_hess.np + deriv[0].np - deriv[3].np + deriv[4].np) final_en = low_cbs_e + ref_energies[0] - ref_energies[3] + ref_energies[4] return final_en, final_hess, low_cbs_e
Px += (4.0 * J_mo - K_mo - Kt_mo).reshape(prod.nrot) Mx += (Kt_mo - K_mo).reshape(prod.nrot) P[:, jb] = Px M[:, jb] = Mx Px_2, Mx_2 = prod.jk_RHF(fake_guess[:, jb]) P2[:, jb] = Px_2 M2[:, jb] = Mx_2 NH = np.einsum("ij,jk->ik", M, P) NH2 = np.einsum("ij,jk->ik", M2, P2) w, X = np.linalg.eig(NH) w_NH = np.sqrt(w[w.argsort()]) w, X = np.linalg.eig(NH2) w_NH2 = np.sqrt(w[w.argsort()]) Mhalf2 = Matrix.from_array(M2) Mhalf = Matrix.from_array(M) Mhalf.power(0.5, 1.0e-16) Mhalf2.power(0.5, 1.0e-16) Mhalf = Mhalf.to_array() Mhalf2 = Mhalf2.to_array() H = np.einsum("ij,jk,km->im", Mhalf, P, Mhalf) H2 = np.einsum("ij,jk,km->im", Mhalf2, P2, Mhalf2) w, X = np.linalg.eigh(H) w_H = np.sqrt(w[w.argsort()]) w, X = np.linalg.eigh(H2) w_H2 = np.sqrt(w[w.argsort()]) wm, X = np.linalg.eig(M) wp, X = np.linalg.eig(P)