def test_khf(self): mf = scf.sfx2c1e(scf.KRHF(cell)) mf.with_df = df.PWDF(cell) mf.kpts = cell.make_kpts([3,1,1]) dm = mf.get_init_guess() h1 = mf.get_hcore() self.assertAlmostEqual(numpy.einsum('ij,ji', dm[0], h1[0]),-0.547189217727+0j, 9) self.assertAlmostEqual(numpy.einsum('ij,ji', dm[1], h1[1]),-0.167141476114+0j, 9) self.assertAlmostEqual(numpy.einsum('ij,ji', dm[2], h1[2]),-0.167141476114+0j, 9)
def test_hf(self): mf = scf.sfx2c1e(scf.RHF(cell)) mf.with_df = df.PWDF(cell) dm = mf.get_init_guess() h1 = mf.get_hcore() self.assertAlmostEqual(numpy.einsum('ij,ji', dm, h1), -0.547189217727 + 0j, 9) kpts = cell.make_kpts([3, 1, 1]) h1 = mf.get_hcore(kpt=kpts[1]) self.assertAlmostEqual(numpy.einsum('ij,ji', dm, h1), -0.167141476114 + 0j, 9)
def test_khf(self): lib.param.LIGHT_SPEED, c = 2, lib.param.LIGHT_SPEED mf = scf.sfx2c1e(scf.KRHF(cell)) mf.with_df = df.PWDF(cell) mf.kpts = cell.make_kpts([3,1,1]) dm = mf.get_init_guess() h1 = mf.get_hcore() self.assertAlmostEqual(numpy.einsum('ij,ji', dm[0], h1[0]),-0.547189217727+0j, 9) self.assertAlmostEqual(numpy.einsum('ij,ji', dm[1], h1[1]),-0.167141476114+0j, 9) self.assertAlmostEqual(numpy.einsum('ij,ji', dm[2], h1[2]),-0.167141476114+0j, 9) lib.param.LIGHT_SPEED = c