def test_mc1step_9o8e(self): mc = mcscf.density_fit(mcscf.CASSCF(mf, 9, 8)) mc.conv_tol = 1e-8 mo = mf.mo_coeff.copy() mo[:,[15,16,17,18]] = mf.mo_coeff[:,[17,18,15,16]] emc = mc.mc1step(mo)[0] self.assertAlmostEqual(emc, -230.72211519779304, 6)
def test_get_h2eff(self): mc1 = mcscf.CASSCF(m, 4, 4).approx_hessian() eri1 = mc1.get_h2eff(m.mo_coeff[:,5:9]) eri2 = mc1.get_h2cas(m.mo_coeff[:,5:9]) self.assertAlmostEqual(abs(eri1-eri2).max(), 0, 12) mc1 = mcscf.density_fit(mcscf.CASSCF(m, 4, 4)) eri1 = mc1.get_h2eff(m.mo_coeff[:,5:9]) eri2 = mc1.get_h2cas(m.mo_coeff[:,5:9]) self.assertTrue(abs(eri1-eri2).max() > 1e-5)
def test_get_h2eff(self): mc1 = mcscf.CASSCF(m, 4, 4).approx_hessian() eri1 = mc1.get_h2eff(m.mo_coeff[:, 5:9]) eri2 = mc1.get_h2cas(m.mo_coeff[:, 5:9]) self.assertAlmostEqual(abs(eri1 - eri2).max(), 0, 12) mc1 = mcscf.density_fit(mcscf.CASSCF(m, 4, 4)) eri1 = mc1.get_h2eff(m.mo_coeff[:, 5:9]) eri2 = mc1.get_h2cas(m.mo_coeff[:, 5:9]) self.assertTrue(abs(eri1 - eri2).max() > 1e-5)
mol.verbose = 4 mol.output = 'fepor.out' mol.spin = 4 mol.symmetry = True mol.build() mf = scf.ROHF(mol) mf = scf.fast_newton(mf) # # CAS(8e, 11o) # # mcscf.density_fit approximates the orbital hessian. It does not affect # CASSCF results. # mc = mcscf.density_fit(mcscf.CASSCF(mf, 11, 8)) idx = [i for i,s in enumerate(mol.spheric_labels(1)) if 'Fe 3d' in s or 'Fe 4d' in s] mo = dmet_cas(mc, mf.make_rdm1(), idx) mc.fcisolver.wfnsym = 'Ag' mc.kernel(mo) #mc.analyze() e_q = mc.e_tot # -2244.82910509839 cas_q = mc.mo_coeff[:,mc.ncore:mc.ncore+mc.ncas]
def test_h1e_for_cas(self): mc = mcscf.density_fit(mcscf.CASSCF(m, 4, 4)) mo = m.mo_coeff h0 = mcscf.casci.h1e_for_cas(mc, mo, 4, 5)[0] h1 = mcscf.mc1step.h1e_for_cas(mc, mo, mc.ao2mo(mo)) self.assertTrue(numpy.allclose(h0, h1))
def test_mc2step_symm_6o6e(self): mc = mcscf.density_fit(mcscf.CASSCF(msym, 6, 6)) emc = mc.mc2step()[0] self.assertAlmostEqual(emc, -108.980105451388, 7)
def test_mc2step_symm_4o4e(self): mc = mcscf.density_fit(mcscf.CASSCF(msym, 4, 4)) emc = mc.mc2step()[0] self.assertAlmostEqual(emc, -108.913786407955, 7) self.assertAlmostEqual(numpy.linalg.norm(mc.analyze()), 2.7015375913946591, 4)
mol.spin = 4 mol.symmetry = True mol.build() mf = scf.ROHF(mol) mf = scf.fast_newton(mf) # # CAS(16e, 20o) # # mcscf.density_fit approximates the orbital hessian. It does not affect # results. The N-2pz orbitals introduces more entanglement to environment. # 5 bath orbitals which have the strongest entanglement to impurity are # considered in active space. # mc = mcscf.density_fit(dmrgscf.dmrgci.DMRGSCF(mf, 20, 16)) idx = [i for i,s in enumerate(mol.spheric_labels(1)) if 'Fe 3d' in s or 'Fe 4d' in s or 'Fe 4s' in s or 'N 2pz' in s] mo = dmet_cas(mc, mf.make_rdm1(), idx) mc.fcisolver.wfnsym = 'Ag' mc.kernel(mo) #mc.analyze() e_q = mc.e_tot # -2244.90267106288 cas_q = mc.mo_coeff[:,mc.ncore:mc.ncore+mc.ncas] # # call DMRG-NEVPT2 (about 2 days, 100 GB memory) # ept2_q = mrpt.nevpt2.sc_nevpt(mc)
def test_mc1step_4o4e(self): mc = mcscf.density_fit(mcscf.CASSCF(mf, 4, 4)) mc.conv_tol = 1e-8 emc = mc.mc1step()[0] self.assertAlmostEqual(emc, -230.6627383823, 7)
mol.spin = 4 mol.symmetry = True mol.build() mf = scf.ROHF(mol) mf = scf.fast_newton(mf) # # CAS(16e, 20o) # # mcscf.density_fit approximates the orbital hessian. It does not affect # results. The N-2pz orbitals introduces more entanglement to environment. # 5 bath orbitals which have the strongest entanglement to impurity are # considered in active space. # mc = mcscf.density_fit(dmrgscf.dmrgci.DMRGSCF(mf, 20, 16)) idx = [ i for i, s in enumerate(mol.spheric_labels(1)) if 'Fe 3d' in s or 'Fe 4d' in s or 'Fe 4s' in s or 'N 2pz' in s ] mo = dmet_cas(mc, mf.make_rdm1(), idx) mc.fcisolver.wfnsym = 'Ag' mc.kernel(mo) #mc.analyze() e_q = mc.e_tot # -2244.90267106288 cas_q = mc.mo_coeff[:, mc.ncore:mc.ncore + mc.ncas] # # call DMRG-NEVPT2 (about 2 days, 100 GB memory) #
['H' , (-3.1855 , -3.1752 , 0.0000)], ['H' , (3.1855 , -3.1752 , 0.0000)], ] mol.basis = 'ccpvdz' mol.verbose = 4 mol.output = 'fepor.out' mol.spin = 4 mol.symmetry = True mol.build() mf = scf.ROHF(mol) mf = scf.fast_newton(mf) idx3d4d = [i for i,s in enumerate(mol.spheric_labels(1)) if 'Fe 3d' in s or 'Fe 4d' in s] ncas, nelecas, mo = dmet_cas.guess_cas(mf, mf.make_rdm1(), idx3d) mc = mcscf.density_fit(mcscf.CASSCF(mf, ncas, nelecas) mc.kernel(mo) e_q = mc.e_tot # -2244.82910509839 ################################################## # # Triplet # ##################################################
pyscf/example/scf/23-decorate_scf.py as an exmple ''' mol = gto.Mole() mol.build( atom = [ ["C", (-0.65830719, 0.61123287, -0.00800148)], ["C", ( 0.73685281, 0.61123287, -0.00800148)], ["C", ( 1.43439081, 1.81898387, -0.00800148)], ["C", ( 0.73673681, 3.02749287, -0.00920048)], ["C", (-0.65808819, 3.02741487, -0.00967948)], ["C", (-1.35568919, 1.81920887, -0.00868348)], ["H", (-1.20806619, -0.34108413, -0.00755148)], ["H", ( 1.28636081, -0.34128013, -0.00668648)], ["H", ( 2.53407081, 1.81906387, -0.00736748)], ["H", ( 1.28693681, 3.97963587, -0.00925948)], ["H", (-1.20821019, 3.97969587, -0.01063248)], ["H", (-2.45529319, 1.81939187, -0.00886348)],], basis = 'ccpvtz' ) mf = scf.RHF(mol) mf.conv_tol = 1e-8 e = mf.kernel() mc = mcscf.density_fit(mcscf.CASSCF(mf, 6, 6)) mo = mc.sort_mo([17,20,21,22,23,30]) mc.kernel(mo) print('E(CAS) = %.12f, ref = -230.848493421389' % mc.e_tot)
def test_mc2step_4o4e_df(self): mc = mcscf.density_fit(mcscf.CASSCF(m, 4, 4), auxbasis='weigend') emc = mc.mc2step()[0] self.assertAlmostEqual(emc, -108.91052310869014, 7)
H 1.43795729 -5.04060815 0.04985411 H -1.27684987 -5.06877289 -0.12824309 H -5.00855059 -1.41765215 -0.01035659 H -5.04737524 1.29653551 0.17667822 H -1.40616152 5.05922415 0.08331755 H 1.31031821 5.09342413 -0.07916045 H 5.04427471 1.43839473 0.01993186 H 5.08063140 -1.27727697 0.17277168 O 0.09029280 0.03455842 -2.06604676 H 0.10929032 -0.90694603 -2.34586589 H -0.74736518 0.39995573 -2.42321963 O -0.05312529 -0.01378499 1.85709184 H 0.85240106 0.06013925 2.23423092 """ mol.basis = "cc-pvdz" mol.output = "fepor5.out" mol.charge = 1 mol.spin = 4 mol.build() mf = scf.RHF(mol) mf.level_shift_factor = 1.5 # mf.chkfile = 'fepor5.chk' mf = scf.fast_scf(mf) mc = mcscf.density_fit(mcscf.CASSCF(mf, 10, 10)) # search Fe 3d orbitals for DMET impurity idx = [i for i, s in enumerate(mol.spheric_labels(1)) if "Fe 3d" in s] mo = dmet_cas.dmet_cas(mc, mf.make_rdm1(), idx) mc.kernel(mo)
def test_mc2step_4o4e(self): mc = mcscf.density_fit(mcscf.CASSCF(m, 4, 4)) emc = mc.mc2step()[0] self.assertAlmostEqual(emc, -108.913786407955, 7) self.assertAlmostEqual(numpy.linalg.norm(mc.analyze()), 4.17096333, 4)