def TDA(mf): from pyscf import scf mf = scf.addons.convert_to_rhf(mf) if hasattr(mf, 'xc'): return rks.TDA(mf) else: return rhf.TDA(mf)
def test_tda_b3lypg(self): mf = dft.RKS(mol) mf.xc = 'b3lypg' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.385520327568869, 7)
def test_tda_b3pw91(self): mf = dft.RKS(mol) mf.xc = 'b3pw91' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.313632163628363, 7)
def test_tda_lda(self): mf = dft.RKS(mol) mf.xc = 'lda,vwn' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -41.201828219760415, 7)
def test_tda_lda_triplet(self): mf = dft.RKS(mol) mf.xc = 'lda,vwn' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.singlet = False td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -39.988118769202416, 7)
def test_tda_b3lyp_triplet(self): mf = dft.RKS(mol) mf.xc = 'b3lyp' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.singlet = False td.nstates = 5 es = td.kernel()[0] * 27.2114 self.assertAlmostEqual(finger(es), -40.020204585289648, 7)
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.TDA(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 dft.numint._NumInt.libxc = dft.libxc self.assertAlmostEqual(finger(es), -41.393122257109056, 7)
def test_tda_lda_xcfun(self): dft.numint._NumInt.libxc = dft.xcfun mf = dft.RKS(mol) mf.xc = 'lda,vwn' mf.grids.prune = None mf.scf() td = rks.TDA(mf) td.nstates = 5 es = td.kernel()[0] * 27.2114 dft.numint._NumInt.libxc = dft.libxc self.assertAlmostEqual(finger(es), -41.201828219760415, 6)
def TDA(mf): if hasattr(mf, 'xc'): return rks.TDA(mf) else: return rhf.TDA(mf)