@@ -0,0 +1,1348 @@
+#!/usr/bin/env python%0A%0Aimport unittest%0Aimport numpy as np%0Aimport scipy.linalg%0Afrom pyscf.pbc import gto%0Afrom pyscf.pbc import scf%0Afrom pyscf.pbc import dft%0A%0AL = 2%0Acell = gto.Cell()%0Acell.unit = 'B'%0Acell.a = np.diag(%5BL,L,L%5D)%0Acell.gs = np.array(%5B5,5,5%5D)%0Acell.atom = %5B%5B'He', (L/2.,L/2.,L/2.)%5D%5D%0Acell.basis = %7B 'He': %5B%5B0, (1.0, 1.0)%5D%5D %7D%0Acell.build()%0A%0Adef finger(a):%0A    a = np.asarray(a)%0A    return np.dot(a.ravel(), np.cos(np.arange(a.size)))%0A%0Aclass KnowValues(unittest.TestCase):%0A    def test_band(self):%0A        mf = scf.RHF(cell).run()%0A        kpts = cell.make_kpts(%5B10,1,1%5D)%0A        bands = %5B%5D%0A        for kpt in kpts:%0A            fock = mf.get_hcore(kpt=kpt) + mf.get_veff(kpt_band=kpt)%0A            ovlp = mf.get_ovlp(kpt=kpt)%0A            bands.append(mf.eig(fock, ovlp)%5B0%5D)%0A        self.assertAlmostEqual(finger(bands), 6.7327210318311597, 8)%0A%0A    def test_band_kscf(self):%0A        kpts = cell.make_kpts(%5B2,1,1%5D)%0A        kmf = dft.KRKS(cell, kpts=kpts).run()%0A        bands = %5B%5D%0A        h1 = kmf.get_hcore()%0A        s1 = kmf.get_ovlp()%0A        for i, kpt in enumerate(kpts):%0A            fock = h1%5Bi%5D + kmf.get_veff(kpt_band=kpt)%0A            bands.append(scipy.linalg.eigh(fock, s1%5Bi%5D)%5B0%5D)%0A        self.assertAlmostEqual(finger(bands), -0.76745129086774599, 8)%0A%0A%0Aif __name__ == '__main__':%0A    print(%22Full Tests for kpt-bands%22)%0A    unittest.main()%0A%0A

Add tests for kpt-bands