def test_with_x2c_scanner(self): mc1 = mcscf.UCASCI(m, 5, (4, 2)).x2c() mc1.kernel() self.assertAlmostEqual(mc1.e_tot, -75.782441558951504, 8) mc1 = mcscf.UCASCI(m, 5, (4, 2)).x2c().as_scanner().as_scanner() mc1(mol) self.assertAlmostEqual(mc1.e_tot, -75.782441558951504, 8)
def setUpModule(): global mol, m, mc, molsym, msym b = 1.4 mol = gto.M( verbose=7, output='/dev/null', atom=[["O", (0., 0., 0.)], [1, (0., -0.757, 0.587)], [1, (0., 0.757, 0.587)]], basis='631g', spin=2, ) m = scf.UHF(mol) m.conv_tol = 1e-10 m.scf() mc = mcscf.UCASCI(m, 5, (4, 2)).run() b = 1.4 molsym = gto.M( verbose=7, output='/dev/null', atom=[["O", (0., 0., 0.)], [1, (0., -0.757, 0.587)], [1, (0., 0.757, 0.587)]], basis='631g', spin=2, symmetry=True, ) msym = scf.UHF(molsym) msym.conv_tol = 1e-10 msym.scf()
def test_get_h2eff(self): mc1 = mcscf.approx_hessian(mcscf.UCASCI(m, 5, (4, 2), ncore=(2, 2))) mc1.max_memory = 0 eri1 = mc1.get_h2eff((m.mo_coeff[0][:, 2:7], m.mo_coeff[1][:, 2:7])) eri2 = mc1.get_h2cas((m.mo_coeff[0][:, 2:7], m.mo_coeff[1][:, 2:7])) self.assertAlmostEqual(abs(eri1[0] - eri2[0]).max(), 0, 12) self.assertAlmostEqual(abs(eri1[1] - eri2[1]).max(), 0, 12) self.assertAlmostEqual(abs(eri1[2] - eri2[2]).max(), 0, 12)
def test_get_veff(self): mc1 = mcscf.UCASCI(m.view(dft.rks.RKS), 5, (4, 2)) nao = mol.nao_nr() dm = numpy.random.random((2, nao, nao)) dm = dm + dm.transpose(0, 2, 1) veff1 = mc1.get_veff(mol, dm) veff2 = m.get_veff(mol, dm) self.assertAlmostEqual(float(abs(veff1 - veff2).max()), 0, 12)
def test_multi_roots_spin_square(self): mc = mcscf.UCASCI(m, 5, (4,2)) mc.fcisolver.nroots = 2 mc.natorb = True mc.kernel() self.assertAlmostEqual(mc.e_tot[0], -75.73319012518794, 9) self.assertAlmostEqual(mc.e_tot[1], -75.63476344994703, 9) ss, s1 = mc.spin_square() self.assertAlmostEqual(ss[0], 2.005756795092406, 7) self.assertAlmostEqual(ss[1], 2.006105024567947, 7) self.assertAlmostEqual(s1[0], 3.003835411664498, 7) self.assertAlmostEqual(s1[1], 3.004067259278958, 7) dm1 = mc.analyze() self.assertAlmostEqual(lib.finger(dm1[0]), -5.7326112327013377, 5) self.assertAlmostEqual(lib.finger(dm1[1]), 0.70360224576388797, 5) self.assertAlmostEqual(lib.finger(dm1[0]+dm1[1]), -5.0290089869374492, 5)
def test_sort_mo(self): mc1 = mcscf.UCASCI(msym, 5, (4, 2)) mo = mc1.sort_mo([[3, 5, 6, 4, 7], [3, 4, 5, 6, 7]]) mc1.kernel(mo) self.assertAlmostEqual(mc1.e_tot, mc.e_tot, 9)
def test_ucasci(self): mc = mcscf.UCASCI(msym, 4, (3, 1)) emc = mc.kernel()[0] self.assertAlmostEqual(emc, -108.77486560653847, 7)
b = 1.4 mol = gto.M( verbose = 7, output = '/dev/null', atom = [ ["O" , (0. , 0. , 0.)], [1 , (0. , -0.757 , 0.587)], [1 , (0. , 0.757 , 0.587)] ], basis = '631g', spin = 2, ) m = scf.UHF(mol) m.conv_tol = 1e-10 m.scf() mc = mcscf.UCASCI(m, 5, (4,2)).run() b = 1.4 molsym = gto.M( verbose = 7, output = '/dev/null', atom = [ ["O" , (0. , 0. , 0.)], [1 , (0. , -0.757 , 0.587)], [1 , (0. , 0.757 , 0.587)] ], basis = '631g', spin = 2, symmetry = True, ) msym = scf.UHF(molsym) msym.conv_tol = 1e-10