def TDDFT(mf): if hasattr(mf, 'xc'): if mf._numint.libxc.is_hybrid_xc(mf.xc): return rks.TDDFT(mf) else: return rks.TDDFTNoHybrid(mf) else: return rhf.TDHF(mf)
def test_tddft_b3lyp(self): mf = dft.RKS(mol) mf.xc = 'b3lyp' mf.grids.prune = None mf.scf() td = rks.TDDFT(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.29609453661341, 7)
def test_tddft_b3pw91(self): mf = dft.RKS(mol) mf.xc = 'b3pw91' mf.grids.prune = None mf.scf() td = rks.TDDFT(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.218912874291014, 7)
def test_tddft_b88p86(self): mf = dft.RKS(mol) mf.xc = 'b88,p86' mf.grids.prune = None mf.scf() td = rks.TDDFT(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -40.462005239920558, 7)
def test_tddft_lda(self): mf = dft.RKS(mol) mf.xc = 'lda, vwn_rpa' mf.grids.prune = None mf.scf() td = rks.TDDFT(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.059050077236151, 7)
def TDDFT(mf): from pyscf import scf mf = scf.addons.convert_to_rhf(mf) if hasattr(mf, 'xc'): if mf._numint.libxc.is_hybrid_xc(mf.xc): return rks.TDDFT(mf) else: return rks.TDDFTNoHybrid(mf) else: return rhf.TDHF(mf)
def test_tddft_b3lyp_xcfun(self): dft.numint._NumInt.libxc = dft.xcfun mf = dft.RKS(mol) mf.xc = 'b3lyp' mf.grids.prune = None mf.scf() td = rks.TDDFT(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 dft.numint._NumInt.libxc = dft.libxc self.assertAlmostEqual( finger(es), finger([ 9.88975514, 9.88975514, 15.16643994, 30.55289462, 30.55289462 ]), 7)