Пример #1
0
def cas_22_pt(HHdist, xfnal, cfnal, hybs, basis='sto3g', output=None):
    ''' Don't include 0 in hybs; will do this automatically
    '''
    if output is None:
        output = 'H2_{:.1f}.log'.format(HHdist)
    mol = gto.M(atom='H 0 0 0; H 0 0 {:.1f}'.format(HHdist),
                basis=basis,
                symmetry=True,
                output=output,
                verbose=4)
    hf = scf.RHF(mol)
    hf.kernel()
    ks = dft.RKS(mol)
    #ks.grids.level = 9
    ks.xc = xfnal + ', ' + cfnal
    e_rks = ks.kernel()
    ot = otfnal.transfnal(ks)
    mc = mcscf.CASSCF(hf, 2, 2)
    mc.fcisolver = fci.solver(mol, singlet=True, symm=True)
    #mc.fix_spin_(ss=0)
    e_cas = mc.kernel()[0]
    assert (mc.converged)
    e_pdft = mcpdft.kernel(mc, ot)
    e_hyb = []
    for hyb in hybs:
        ks.xc = '{0:.2f}*HF + {1:.2f}*{2:s}, {3:s}'.format(
            hyb, 1.0 - hyb, xfnal, cfnal)
        e_hyb.append(ks.kernel())
        ot.otxc = 't{0:.2f}*HF + {1:.2f}*{2:s}, {3:s}'.format(
            hyb, 1.0 - hyb, xfnal, cfnal)
        e_hyb.append(mcpdft.kernel(mc, ot))
    return [e_cas, e_pdft, e_rks] + [e for e in e_hyb]
Пример #2
0
def ref_pt(HHdist, gga_fnal, hyb_gga_fnal, basis='sto3g', output=None):
    if output is None:
        output = 'H2_{:.1f}_ref.log'.format(HHdist)
    mol = gto.M(atom='H 0 0 0; H 0 0 {:.1f}'.format(HHdist),
                basis=basis,
                symmetry=True,
                output=output,
                verbose=4)
    hf = scf.RHF(mol)
    hf.kernel()
    ks = dft.RKS(mol)
    #ks.grids.level = 9
    ks.xc = gga_fnal
    e_gga = ks.kernel()
    ks.xc = hyb_gga_fnal
    e_hyb_gga = ks.kernel()
    ks.xc = gga_fnal
    ot = otfnal.transfnal(ks)
    mc = mcscf.CASSCF(hf, 2, 2)
    mc.fcisolver = fci.solver(mol, singlet=True, symm=True)
    #mc.fix_spin_(ss=0)
    e_cas = mc.kernel()[0]
    assert (mc.converged)
    e_pdft = mcpdft.kernel(mc, ot)
    return e_cas, e_gga, e_hyb_gga, e_pdft
Пример #3
0
els_rel = ls_rel.kernel()[0]

print("CASSCF high-spin energy: {:.8f}".format(ehs))
print("CASSCF (vertical) low-spin energy: {:.8f}".format(els_vert))
print("CASSCF (relaxed) low-spin energy: {:.8f}".format(els_rel))
print("CASSCF vertical excitation energy (eV): {:.8f}".format(
    27.2114 * (els_vert - ehs)))
print("CASSCF relaxed excitation energy (eV): {:.8f}".format(27.2114 *
                                                             (els_rel - ehs)))

ks = dft.UKS(mol)
ks.xc = 'pbe'
ks.grids.level = 9
ot = otfnal.transfnal(ks)

els_vert = mcpdft.kernel(ls_vert, ot)[0]
els_rel = mcpdft.kernel(ls_rel, ot)[0]
ehs = mcpdft.kernel(hs, ot)[0]
print("MC-PDFT (tPBE) high-spin energy: {:.8f}".format(ehs))
print("MC-PDFT (tPBE) (vertical) low-spin energy: {:.8f}".format(els_vert))
print("MC-PDFT (tPBE) (relaxed) low-spin energy: {:.8f}".format(els_rel))
print("MC-PDFT (tPBE) vertical excitation energy (eV): {:.8f}".format(
    27.2114 * (els_vert - ehs)))
print("MC-PDFT (tPBE) relaxed excitation energy (eV): {:.8f}".format(
    27.2114 * (els_rel - ehs)))

ks = dft.UKS(mol)
ks.xc = 'blyp'
#ks.grids.level = 9
ot = otfnal.transfnal(ks)