Esempio n. 1
0
 def test_energy1(self):
     mol = gto.M(
         verbose = 0,
         atom = '''
         O   0 0 0
         O   0 0 1.207''',
         basis = '6-31g',
         spin = 2)
     m = scf.RHF(mol)
     m.scf()
     mc = mcscf.CASCI(m, 6, 8)
     mc.fcisolver.conv_tol = 1e-16
     mc.kernel()
     e = nevpt2.sc_nevpt(mc)
     self.assertAlmostEqual(e, -0.16978532268234559, 6)
mc.chkfile = 'hs_mc.chk'
mo = scf.chkfile.load('hs_mc.chk', "mcscf/mo_coeff")
mc.fcisolver = DMRGCI(mol,maxM=500, tol =1e-8)
#
# Tune DMRG parameters.  It's not necessary in most scenario.
#
#mc.fcisolver.outputlevel = 3
#mc.fcisolver.scheduleSweeps = [0, 4, 8, 12, 16, 20, 24, 28, 30, 34]
#mc.fcisolver.scheduleMaxMs  = [200, 400, 800, 1200, 2000, 4000, 3000, 2000, 1000, 500]
#mc.fcisolver.scheduleTols   = [0.0001, 0.0001, 0.0001, 0.0001, 1e-5, 1e-6, 1e-7, 1e-7, 1e-7, 1e-7 ]
#mc.fcisolver.scheduleNoises = [0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0, 0.0, 0.0, 0.0]
#mc.fcisolver.twodot_to_onedot = 38
#mc.fcisolver.maxIter = 50
mc.casci(mo)

#
# DMRG-NEVPT2
#
# There is a fast DMRG-NEVPT2 implementation.  See also the example
# pyscf/examples/dmrg/02-dmrg_nevpt2.py
#
sc_nevpt(mc)


##################################################
#
# Don't forget to clean up the scratch.  DMRG calculation can produce large
# amount of temporary files.
#
##################################################
Esempio n. 3
0
    sol = COSMO(mol)
    sol.eps = -1
    mf = cosmo_for_scf(scf.RHF(mol), sol)
    mf.init_guess = 'atom' # otherwise it cannot converge to the correct result!
    escf = mf.kernel()  
 
    sol.eps = 37
    mc = mcscf.CASSCF(mf, 4, 4)
    mc = cosmo_for_mcscf(mc, sol)
    mo = mc.sort_mo([3,4,6,7])
    emc = mc.kernel(mo)[0]
    assert(abs(emc+75.6377646267)<1.e-6)
    
    mc = mcscf.CASCI(mf, 4, 4)
    mc = cosmo_for_casci(mc, sol)
    eci = mc.kernel()[0]
    assert(abs(eci+75.5789635682)<1.e-6)

    # Single-step CASCI
    sol.dm = sol._dm_guess
    #sol.casci_max_cycle = 1
    mc = mcscf.CASCI(mf, 4, 4)
    mc = cosmo_for_casci(mc, sol)
    eci = mc.kernel()[0]
    assert(abs(eci+75.5789635647)<1.e-6)

    from pyscf.mrpt.nevpt2 import sc_nevpt
    ec = sc_nevpt(mc)
    assert(abs(ec+0.128805510364)<1.e-6)
Esempio n. 4
0
 def test_energy(self):
     e = nevpt2.sc_nevpt(mc)
     self.assertAlmostEqual(e, -0.10315217594326213, 7)
Esempio n. 5
0
        output="out-casscf",
        atom=[["H", (0.0, 0.0, i - 3.5)] for i in range(8)],
        basis={"H": "sto-3g"},
        symmetry="d2h",
    )
    m = scf.RHF(mol)
    m.scf()

    mc = mcscf.CASCI(m, 4, 4)
    mc.fcisolver.nroots = 2
    mc.casci()

    file = open("MO", "w")
    pickle.dump(mc.mo_coeff, file)
    file.close()
    ci_nevpt_e1 = sc_nevpt(mc, ci=mc.ci[0])
    ci_nevpt_e2 = sc_nevpt(mc, ci=mc.ci[1])

    b = 1.4
    mol = gto.Mole()
    mol.build(
        verbose=7,
        output="out-dmrg",
        atom=[["H", (0.0, 0.0, i - 3.5)] for i in range(8)],
        basis={"H": "sto-3g"},
        symmetry="d2h",
    )
    m = scf.RHF(mol)
    m.scf()

    file = open("MO", "r")
Esempio n. 6
0
#
# 2. Frozen solvation of ground state for excited states
#
# Assigning certain density matrix to sol.dm can force the solvent object to
# compute the solvation correction with the given density matrix.
# sol._dm_guess is the system density matrix of the last iteration from
# previous calculation.  Setting "sol.dm = sol._dm_guess" freezes the
# ground state solvent effects in the excitated calculation.
#
sol.dm = sol._dm_guess
mc = cosmo.cosmo_(mcscf.CASCI(mf, 5, 6), sol)
mc.fcisolver.nroots = 2
mc.kernel(mo)

e_state0 = mc.e_tot[0] + sc_nevpt(mc, ci=mc.ci[0])
e_state1 = mc.e_tot[1] + sc_nevpt(mc, ci=mc.ci[1])
print('Excitation E = %.9g' % (e_state1-e_state0))



##################################################
#
# Emission
#
##################################################

#
# 1. Equilibrium solvation for excited state.
#
# "sol.dm = None" relaxes the solvent to equilibruim wrt excited state
Esempio n. 7
0
mc = dmrgscf.dmrgci.DMRGSCF(m, 8, 8)
mc.state_average_([.5,.5])
e_0 = mc.kernel()[0]

#
# Run DMRGCI for 2 excited states
#
mc = mcscf.CASCI(m, 8, 8)
mc.fcisolver = dmrgscf.drmgci.DMRGCI(mol, maxM=200)
mc.fcisolver.nroots = 2
e_0 = mc.kernel()[0]

#
# Computing NEVPT2 based on state-specific DMRG-CASCI calculation
#
dmrg_nevpt_e1 = sc_nevpt(mc, ci=mc.ci[0])
dmrg_nevpt_e2 = sc_nevpt(mc, ci=mc.ci[1])
print('DE = %.9g' % (e_0[1]+dmrg_nevpt_e2) - (e_0[0]+dmrg_nevpt_e1))



##################################################
#
# State-specific
#
##################################################

#
# Optimize orbitals for first excited state
#
mc = dmrgscf.dmrgci.DMRGSCF(m, 8, 8)
Esempio n. 8
0
    sol = COSMO(mol)
    sol.eps = -1
    mf = cosmo_for_scf(scf.RHF(mol), sol)
    mf.init_guess = 'atom' # otherwise it cannot converge to the correct result!
    escf = mf.kernel()  
 
    sol.eps = 37
    mc = mcscf.CASSCF(mf, 4, 4)
    mc = cosmo_for_mcscf(mc, sol)
    mo = mc.sort_mo([3,4,6,7])
    emc = mc.kernel(mo)[0]
    assert(abs(emc+75.6377646267)<1.e-6)
    
    mc = mcscf.CASCI(mf, 4, 4)
    mc = cosmo_for_casci(mc, sol)
    eci = mc.kernel()[0]
    assert(abs(eci+75.5789635682)<1.e-6)

    # Single-step CASCI
    sol.dm = sol._dm_guess
    #sol.casci_max_cycle = 1
    mc = mcscf.CASCI(mf, 4, 4)
    mc = cosmo_for_casci(mc, sol)
    eci = mc.kernel()[0]
    assert(abs(eci+75.5789635647)<1.e-6)

    from pyscf.mrpt.nevpt2 import sc_nevpt
    ec = sc_nevpt(mc)
    assert(abs(ec+0.128805510364)<1.e-6)