def test_aux_e2(self): cell = pgto.Cell() cell.unit = 'B' cell.a = numpy.eye(3) * 3. cell.gs = numpy.array([20,20,20]) cell.atom = 'He 0 1 1; He 1 1 0' cell.basis = { 'He': [[0, (0.8, 1.0)], [0, (1.2, 1.0)]] } cell.verbose = 0 cell.build(0, 0) auxcell = incore.format_aux_basis(cell) cell.nimgs = auxcell.nimgs = [3,3,3] a1 = incore.aux_e2(cell, auxcell, 'cint3c1e_sph') self.assertAlmostEqual(finger(a1), 0.1208944790152819, 9) a2 = incore.aux_e2(cell, auxcell, 'cint3c1e_sph', aosym='s2ij') self.assertTrue(numpy.allclose(a1, lib.unpack_tril(a2, axis=0).reshape(a1.shape))) numpy.random.seed(3) kpti_kptj = [numpy.random.random(3)]*2 a1 = incore.aux_e2(cell, auxcell, 'cint3c1e_sph', kpti_kptj=kpti_kptj) self.assertAlmostEqual(finger(a1), -0.073719031689332651-0.054002639392614758j, 9) a2 = incore.aux_e2(cell, auxcell, 'cint3c1e_sph', aosym='s2ij', kpti_kptj=kpti_kptj) self.assertTrue(numpy.allclose(a1, lib.unpack_tril(a2, 1, axis=0).reshape(a1.shape))) numpy.random.seed(1) kpti_kptj = numpy.random.random((2,3)) a1 = incore.aux_e2(cell, auxcell, 'cint3c1e_sph', kpti_kptj=kpti_kptj) self.assertAlmostEqual(finger(a1), 0.039329191948685879-0.039836453846241987j, 9)
def test_fill_2c2e(self): cell = pgto.Cell() cell.unit = 'B' cell.a = numpy.eye(3) * 3. cell.gs = [20]*3 cell.atom = 'He 0 1 1; He 1 1 0' cell.basis = { 'He': [[0, (0.8, 1.0)], [0, (1.2, 1.0)]] } cell.verbose = 0 cell.build(0, 0) auxcell = incore.format_aux_basis(cell) cell.rcut = 3.5 a1 = incore.fill_2c2e(cell, cell) self.assertAlmostEqual(finger(a1), 33.981935245408039, 9) a2 = incore.fill_2c2e(cell, cell, hermi=1) self.assertTrue(numpy.allclose(a1, a2)) numpy.random.seed(1) k = numpy.random.random(3) a1 = incore.fill_2c2e(cell, cell, kpt=k) self.assertAlmostEqual(finger(a1), 2.1912890905216189+1.5010437341376976j, 9)
def test_aux_e2(self): cell = pgto.Cell() cell.unit = 'B' cell.a = numpy.eye(3) * 3. cell.mesh = numpy.array([41] * 3) cell.atom = 'He 0 1 1; He 1 1 0' cell.basis = {'He': [[0, (0.8, 1.0)], [0, (1.2, 1.0)]]} cell.verbose = 0 cell.build(0, 0) auxcell = incore.format_aux_basis(cell) a1 = incore.aux_e2(cell, auxcell, 'int3c1e_sph') self.assertAlmostEqual(lib.fp(a1), 0.1208944790152819, 9) a2 = incore.aux_e2(cell, auxcell, 'int3c1e_sph', aosym='s2ij') self.assertTrue( numpy.allclose(a1, lib.unpack_tril(a2, axis=0).reshape(a1.shape))) numpy.random.seed(3) kpt = numpy.random.random(3) kptij_lst = numpy.array([[kpt, kpt]]) a1 = incore.aux_e2(cell, auxcell, 'int3c1e_sph', kptij_lst=kptij_lst) self.assertAlmostEqual(lib.fp(a1), -0.073719031689332651 - 0.054002639392614758j, 9) a2 = incore.aux_e2(cell, auxcell, 'int3c1e_sph', aosym='s2', kptij_lst=kptij_lst) self.assertTrue( numpy.allclose(a1, lib.unpack_tril(a2, 1, axis=0).reshape(a1.shape))) numpy.random.seed(1) kptij_lst = numpy.random.random((1, 2, 3)) a1 = incore.aux_e2(cell, auxcell, 'int3c1e_sph', kptij_lst=kptij_lst) self.assertAlmostEqual(lib.fp(a1), 0.039329191948685879 - 0.039836453846241987j, 9)