def test_init(self): from pyscf.pbc import dft cell_u = cell.copy() cell_u.spin = 2 self.assertTrue(isinstance(pscf.RKS (cell ), dft.rks.RKS )) self.assertTrue(isinstance(pscf.RKS (cell_u), dft.roks.ROKS )) self.assertTrue(isinstance(pscf.UKS (cell ), dft.uks.UKS )) self.assertTrue(isinstance(pscf.ROKS (cell ), dft.roks.ROKS )) self.assertTrue(isinstance(pscf.KS (cell ), dft.rks.RKS )) self.assertTrue(isinstance(pscf.KS (cell_u), dft.uks.UKS )) self.assertTrue(isinstance(pscf.KRKS (cell ), dft.krks.KRKS )) self.assertTrue(isinstance(pscf.KRKS (cell_u), dft.krks.KRKS )) self.assertTrue(isinstance(pscf.KUKS (cell ), dft.kuks.KUKS )) self.assertTrue(isinstance(pscf.KROKS(cell ), dft.kroks.KROKS)) self.assertTrue(isinstance(pscf.KKS (cell ), dft.krks.KRKS )) self.assertTrue(isinstance(pscf.KKS (cell_u), dft.kuks.KUKS )) self.assertTrue(isinstance(pscf.RHF (cell ), pscf.hf.RHF )) self.assertTrue(isinstance(pscf.RHF (cell_u), pscf.rohf.ROHF )) self.assertTrue(isinstance(pscf.KRHF (cell ), pscf.khf.KRHF )) self.assertTrue(isinstance(pscf.KRHF (cell_u), pscf.khf.KRHF )) self.assertTrue(isinstance(pscf.UHF (cell ), pscf.uhf.UHF )) self.assertTrue(isinstance(pscf.KUHF (cell_u), pscf.kuhf.KUHF )) self.assertTrue(isinstance(pscf.GHF (cell ), pscf.ghf.GHF )) self.assertTrue(isinstance(pscf.KGHF (cell_u), pscf.kghf.KGHF )) self.assertTrue(isinstance(pscf.ROHF (cell ), pscf.rohf.ROHF )) self.assertTrue(isinstance(pscf.ROHF (cell_u), pscf.rohf.ROHF )) self.assertTrue(isinstance(pscf.KROHF(cell ), pscf.krohf.KROHF)) self.assertTrue(isinstance(pscf.KROHF(cell_u), pscf.krohf.KROHF)) self.assertTrue(isinstance(pscf.HF (cell ), pscf.hf.RHF )) self.assertTrue(isinstance(pscf.HF (cell_u), pscf.uhf.UHF )) self.assertTrue(isinstance(pscf.KHF (cell ), pscf.khf.KRHF )) self.assertTrue(isinstance(pscf.KHF (cell_u), pscf.kuhf.KUHF ))
def test_getattr(self): from pyscf.pbc import scf, dft, cc, tdscf cell = pgto.M(atom='He', a=np.eye(3) * 4, basis={'He': [[0, (1, 1)]]}) self.assertEqual(cell.HF().__class__, scf.HF(cell).__class__) self.assertEqual(cell.KS().__class__, dft.KS(cell).__class__) self.assertEqual(cell.UKS().__class__, dft.UKS(cell).__class__) self.assertEqual(cell.KROHF().__class__, scf.KROHF(cell).__class__) self.assertEqual(cell.KKS().__class__, dft.KKS(cell).__class__) self.assertEqual(cell.CCSD().__class__, cc.ccsd.RCCSD) self.assertEqual(cell.TDA().__class__, tdscf.rhf.TDA) self.assertEqual(cell.TDBP86().__class__, tdscf.rks.TDDFTNoHybrid) self.assertEqual(cell.TDB3LYP().__class__, tdscf.rks.TDDFT) self.assertEqual(cell.KCCSD().__class__, cc.kccsd_rhf.KRCCSD) self.assertEqual(cell.KTDA().__class__, tdscf.krhf.TDA) self.assertEqual(cell.KTDBP86().__class__, tdscf.krks.TDDFTNoHybrid) self.assertRaises(AttributeError, lambda: cell.xyz) self.assertRaises(AttributeError, lambda: cell.TDxyz)