예제 #1
0
 def test_mc1step_9o8e(self):
     mc = mcscf.approx_hessian(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)
예제 #2
0
 def test_casci_from_uhf(self):
     mf = scf.UHF(mol)
     mf.scf()
     mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 4, 4))
     emc = mc.mc1step()[0]
     self.assertAlmostEqual(emc, -108.913786407955, 7)
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -108.913786407955, 7)
예제 #3
0
 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)
예제 #4
0
파일: test_casci.py 프로젝트: sunqm/pyscf
    def test_get_h2eff(self):
        mc1 = mcscf.approx_hessian(mcscf.CASCI(m, 4, 4))
        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.CASCI(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)
예제 #5
0
mol.spin = 4
mol.symmetry = True
mol.build()

mf = scf.ROHF(mol)
mf = scf.fast_newton(mf)

#
# CAS(16e, 20o)
#
# mcscf.approx_hessian 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.approx_hessian(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)
#
예제 #6
0
 def test_mc2step_symm_4o4e(self):
     mc = mcscf.approx_hessian(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)
예제 #7
0
 def test_mc2step_symm_6o6e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(msym, 6, 6))
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -108.980105451388, 7)
예제 #8
0
mol.verbose = 4
mol.output = 'fepor.out'
mol.spin = 4
mol.symmetry = True
mol.build()

mf = scf.ROHF(mol)
mf = scf.fast_newton(mf)
# ao_labels are keyword(s) to match the AOs generated by mol.ao_labels()
# function.  ao_labels can be a string, or a pattern of regular expression
# or a list of strings/patterns.  The code can detect the format and find
# the AOs to be taken into the active space.
# See also function gto.mole.search_ao_label for the rules of ao_pattern
ao_pattern = ['Fe 3d', 'Fe 4d']
ncas, nelecas, mo = dmet_cas.guess_cas(mf, mf.make_rdm1(), ao_pattern)
mc = mcscf.approx_hessian(mcscf.CASSCF(mf, ncas, nelecas))
mc.kernel(mo)
e_q = mc.e_tot  # -2244.82910509839







##################################################
#
# Triplet
#
##################################################
예제 #9
0
파일: test_bz_df.py 프로젝트: zzy2014/pyscf
 def test_mc2step_4o4e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 4, 4), auxbasis='weigend')
     mc.conv_tol = 1e-8
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -230.6627383822, 7)
예제 #10
0
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.approx_hessian approximates the orbital hessian.  It does not affect
# CASSCF results.
#
mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 11, 8))
# Function mol.search_ao_label returns the indices of the required AOs
# It is equivalent to the following expression
#idx = [i for i,s in enumerate(mol.ao_labels()) if 'Fe 3d' in s or 'Fe 4d' in s]
idx = mol.search_ao_label(['Fe 3d', 'Fe 4d'])
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]

##################################################
#
# Triplet
예제 #11
0
 def test_mc1step_4o4e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 4, 4))
     mc.conv_tol = 1e-8
     emc = mc.mc1step()[0]
     self.assertAlmostEqual(emc, -230.6627383823, 7)
예제 #12
0
 def test_mc1step_4o4e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 4, 4))
     mc.conv_tol = 1e-8
     emc = mc.mc1step()[0]
     self.assertAlmostEqual(emc, -230.6627383823, 7)
예제 #13
0
 def test_mc2step_4o4e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 4, 4), auxbasis='weigend')
     mc.conv_tol = 1e-8
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -230.6627383822, 7)
예제 #14
0
Approximate CASSCF orbital hessian with density fitting integrals
'''

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.approx_hessian(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)

예제 #15
0
mol.spin = 4
mol.symmetry = True
mol.build()

mf = scf.ROHF(mol)
mf = scf.fast_newton(mf)

#
# CAS(16e, 20o)
#
# mcscf.approx_hessian 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.approx_hessian(dmrgscf.dmrgci.DMRGSCF(mf, 20, 16))
# Function mol.search_ao_label returns the indices of the required AOs
# It is equivalent to the following expression
#idx = [i for i,s in enumerate(mol.ao_labels())
#       if 'Fe 3d' in s or 'Fe 4d' in s or 'Fe 4s' in s or 'N 2pz' in s]
idx = mol.search_ao_label(['Fe 3d', 'Fe 4d', 'Fe 4s', 'N 2pz'])
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)
예제 #16
0
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.approx_hessian approximates the orbital hessian.  It does not affect
# CASSCF results.
#
mc = mcscf.approx_hessian(mcscf.CASSCF(mf, 11, 8))
# Function mol.search_ao_label returns the indices of the required AOs
# It is equivalent to the following expression
#idx = [i for i,s in enumerate(mol.ao_labels()) if 'Fe 3d' in s or 'Fe 4d' in s]
idx = mol.search_ao_label(['Fe 3d', 'Fe 4d'])
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]



예제 #17
0
파일: test_n2_df.py 프로젝트: pyscf/pyscf
 def test_mc1step_symm_4o4e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(msym, 4, 4), auxbasis='weigend')
     emc = mc.mc1step()[0]
     self.assertAlmostEqual(emc, -108.913786407955, 7)
     self.assertAlmostEqual(numpy.linalg.norm(mc.analyze()),
                            2.7015375913946591, 4)
예제 #18
0
파일: test_n2_df.py 프로젝트: pyscf/pyscf
 def test_mc2step_6o6e_high_cost(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(m, 6, 6), auxbasis='weigend')
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -108.980105451388, 7)
예제 #19
0
 def test_mc2step_symm_6o6e(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(msym, 6, 6))
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -108.980105451388, 7)
예제 #20
0
 def test_mc2step_6o6e_high_cost(self):
     mc = mcscf.approx_hessian(mcscf.CASSCF(m, 6, 6), auxbasis='weigend')
     emc = mc.mc2step()[0]
     self.assertAlmostEqual(emc, -108.980105451388, 7)