'E1ux': (1, 1), 'E1uy': (1, 0) } solver1.prefix = "solver1" solver1.epsilon2 = 1.e-7 solver1.stochastic = False solver2 = shci.SHCI(mol) solver2.irrep_nelec = { 'A1g': (2, 1), 'A1u': (1, 1), 'E1ux': (1, 0), 'E1uy': (1, 1) } solver2.prefix = "solver2" solver2.epsilon2 = 1.e-7 solver2.stochastic = False mycas = shci.SHCISCF(myhf, 8, 8) mcscf.state_average_mix_(mycas, [solver1, solver2], numpy.ones(2) / 2) mycas.kernel() print "Total Time: ", time.time() - t0 # File cleanup os.system("rm *.bkp") os.system("rm *.txt") os.system("rm shci.e") os.system("rm *.dat") os.system("rm FCIDUMP")
'E2gy': 0, 'E2uy': 0, 'E2ux': 0 } ehf = mf.kernel() #mf.analyze() # # state-average over 1 triplet + 2 singlets # Note direct_spin1 solver is called here because the CI solver will take # spin-mix solution as initial guess which may break the spin symmetry # required by direct_spin0 solver # weights = np.ones(3) / 3 solver1 = fci.direct_spin1_symm.FCI(mol) solver1.spin = 2 solver1 = fci.addons.fix_spin(solver1, shift=.2, ss=2) solver1.nroots = 1 solver2 = fci.direct_spin0_symm.FCI(mol) solver2.spin = 0 solver2.nroots = 2 mc = mcscf.CASSCF(mf, 8, 8) mcscf.state_average_mix_(mc, [solver1, solver2], weights) # Mute warning msgs mc.check_sanity = lambda *args: None mc.verbose = 4 mc.kernel()
solver3.spin = 3 solver3.wfnsym = 'B3' solver3.nroots = 1 solver4 = fci.direct_spin1.FCI(mol) solver4 = fci.addons.fix_spin(solver2, ss=3 / 2 * (3 / 2 + 1)) solver4.spin = 3 solver4.wfnsym = 'B4' solver4.nroots = 1 solver5 = fci.direct_spin1.FCI(mol) solver5 = fci.addons.fix_spin(solver2, ss=5 / 2 * (5 / 2 + 1)) solver5.spin = 3 solver5.wfnsym = 'A' solver5.nroots = 1 # We use the MP2 nat orbs as the entanglement is calculated for them. mc = mcscf.CASSCF(mf, len(act_mos), act_ele) mo = mcscf.sort_mo(mc, no, np.array(act_mos) + 1) mcscf.state_average_mix_(mc, [solver1, solver2, solver3, solver4, solver5], weights) ener = mc.kernel(mo) print('Excitation from A to B2: ', (solver1.e_tot - solver2.e_tot) * 27.2114, 'eV') print('Excitation from A to B3: ', (solver1.e_tot - solver3.e_tot) * 27.2114, 'eV') print('Excitation from A to B4: ', (solver1.e_tot - solver4.e_tot) * 27.2114, 'eV') print('Excitation from spin 3 to 5: ', (solver1.e_tot - solver5.e_tot) * 27.2114, 'eV')
# # dmrgsolver1 to handle singlet and dmrgsolver2 to handle triplet # dmrgsolver1 = DMRGCI(mol) dmrgsolver1.nroots = 2 dmrgsolver1.weights = [.5, .5] dmrgsolver2 = DMRGCI(mol) # # Note one must assign different scratches to the different DMRG solvers. # Mixing the scratch directories can cause DMRG program fail. # dmrgsolver1.scratchDirectory = '/scratch/dmrg1' dmrgsolver2.scratchDirectory = '/scratch/dmrg2' mc = mcscf.CASSCF(m, 8, 8) mcscf.state_average_mix_(mc, [dmrgsolver1, dmrgsolver2], weights) mc.kernel() print(mc.e_tot) # # state-average over states of different spatial symmetry # mol.build(symmetry='D2h') m = scf.RHF(mol) m.kernel() weights = [.2, .4, .4] dmrgsolver1 = DMRGCI(mol) dmrgsolver1.wfnsym = 'Ag' dmrgsolver1.scratchDirectory = '/scratch/dmrg1' dmrgsolver2 = DMRGCI(mol)
spin = 2) myhf = scf.RHF(mol) myhf.kernel() ##USE SHCISCF solver1 = shci.SHCI(mol) solver1.irrep_nelec = {'A1g' : (2,1), 'A1u' :(1,1), 'E1ux' : (1,1), 'E1uy' : (1,0)} solver1.prefix = "solver1" solver1.epsilon2 = 1.e-7 solver1.stochastic = False solver2 = shci.SHCI(mol) solver2.irrep_nelec = {'A1g' : (2,1), 'A1u' :(1,1), 'E1ux' : (1,0), 'E1uy' : (1,1)} solver2.prefix = "solver2" solver2.epsilon2 = 1.e-7 solver2.stochastic = False mycas = shci.SHCISCF(myhf, 8, 8) mcscf.state_average_mix_(mycas, [solver1, solver2], numpy.ones(2)/2) mycas.kernel() print "Total Time: ", time.time() - t0 # File cleanup os.system("rm *.bkp") os.system("rm *.txt") os.system("rm shci.e") os.system("rm *.dat") os.system("rm FCIDUMP")
no, occ = nat_orbs_obj(mp2) # UHF UCISD mci = ci.UCISD(mf).run() no, occ = nat_orbs_obj(mci) # RHF UCCSD dm0 = mf.make_rdm1() mf = scf.RHF(mol) mf.kernel(dm0=dm0) mcc = cc.UCCSD(mf).run() no, occ = nat_orbs_obj(mcc) # Run a symmetric CASCI to test symmetric natural orbitals. mc = mcscf.CASCI(mf, 6, 6) solver1 = fci.direct_spin0_symm.FCI(mol) solver1.spin = final_spin solver1.wfnsym = 'A1g' solver1 = fci.addons.fix_spin(solver1, ss=final_spin / 2 * (final_spin / 2 + 1)) solver1.nroots = 1 solver2 = fci.direct_spin1_symm.FCI(mol) solver2.spin = excited_spin solver2.wfnsym = 'E1ux' solver2 = fci.addons.fix_spin(solver2, ss=excited_spin / 2 * (excited_spin / 2 + 1)) solver2.nroots = 1 mcscf.state_average_mix_(mc, [solver1, solver2], [0.5, 0.5]) mc.kernel(no)
mol.basis = 'cc-pvtz-dk' mol.spin = 0 mol.build() mf = scf.ROHF(mol).x2c() mf.kernel() # # The active space can be generated by pyscf.mcscf.avas.avas function # from pyscf.mcscf import avas # See also 43-dmet_cas.py and function gto.mole.search_ao_label for the rules # of "ao_labels" in the following ao_labels = ['Fe 3d', 'C 2pz'] norb, ne_act, orbs = avas.avas(mf, ao_labels, canonicalize=False) weights = numpy.ones(13)/13 solver1 = fci.addons.fix_spin(fci.direct_spin1.FCI(mol), ss=2) # <S^2> = 2 for Triplet solver1.spin = 2 solver1.nroots = 6 solver2 = fci.addons.fix_spin(fci.direct_spin1.FCI(mol), ss=0) # <S^2> = 0 for Singlet solver2.spin = 0 solver2.nroots = 7 mycas = mcscf.CASSCF(mf, norb, ne_act) mycas.chkfile ='fecp2_3dpz.chk' mcscf.state_average_mix_(mycas, [solver1, solver2], weights) mycas.verbose = 6 mycas.kernel(orbs)
dmrgsolver1.nroots = 2 dmrgsolver1.spin = 0 dmrgsolver1.weights = [.5, .5] dmrgsolver1.mpiprefix = 'mpirun -np 4' dmrgsolver2 = DMRGCI(mol) dmrgsolver2.spin = 2 dmrgsolver2.mpiprefix = 'mpirun -np 4' # # Note one must assign different scratches to the different DMRG solvers. # Mixing the scratch directories can cause DMRG program fail. # dmrgsolver1.scratchDirectory = '/scratch/dmrg1' dmrgsolver2.scratchDirectory = '/scratch/dmrg2' mc = mcscf.CASSCF(m, 8, 8) mcscf.state_average_mix_(mc, [dmrgsolver1, dmrgsolver2], weights) mc.kernel() print(mc.e_tot) # # state-average over states of different spatial symmetry # mol.build(symmetry='D2h') m = scf.RHF(mol) m.kernel() weights = [.2, .4, .4] dmrgsolver1 = DMRGCI(mol)
# # dmrgsolver1 to handle singlet and dmrgsolver2 to handle triplet # dmrgsolver1 = DMRGCI(mol) dmrgsolver1.nroots = 2 dmrgsolver1.weights = [.5, .5] dmrgsolver2 = DMRGCI(mol) # # Note one must assign different scratches to the different DMRG solvers. # Mixing the scratch directories can cause DMRG program fail. # dmrgsolver1.scratchDirectory = '/scratch/dmrg1' dmrgsolver2.scratchDirectory = '/scratch/dmrg2' mc = mcscf.CASSCF(m, 8, 8) mcscf.state_average_mix_(mc, [solver1, solver2], weights) mc.kernel() print(mc.e_tot) # # state-average over states of different spatial symmetry # mol.build(symmetry='D2h') m = scf.RHF(mol) m.kernel() weights = [.2, .4, .4] dmrgsolver1 = DMRGCI(mol)