Пример #1
0
    def test_olvp(self):
        cell = make_cell1(4, 20)
        s0 = get_ovlp(cell)
        s1 = scfint.get_ovlp(cell)
        self.assertAlmostEqual(numpy.linalg.norm(s0-s1), 0, 8)
        self.assertAlmostEqual(finger(s1), 1.3229918679678208, 10)

        s0 = get_ovlp(cell, kpt=k)
        s1 = scfint.get_ovlp(cell, kpt=k)
        self.assertAlmostEqual(numpy.linalg.norm(s0-s1), 0, 8)
Пример #2
0
    def get_ovlp(self, cell=None, kpt=None):
        if cell is None: cell = self.cell
        if kpt is None: kpt = self.kpt

        if self.analytic_int:
            logger.info(self, "Using analytic integrals")
            return scfint.get_ovlp(cell, kpt)
        else:
            return get_ovlp(cell, kpt)
Пример #3
0
    def test_becke_grids(self):
        L = 4.
        n = 30
        cell = pgto.Cell()
        cell.h = numpy.eye(3)*L
        cell.h[0,1] = cell.h[1,2] = L / 2
        cell.gs = numpy.array([n,n,n])

        cell.atom =[['He' , ( L/2+0., L/2+0. ,   L/2+1.)],
                    ['He' , ( L/2+1., L/2+0. ,   L/2+1.)]]
        cell.basis = {'He': [[0, (1.0, 1.0)]]}
        cell.build()
        kpt = None
        s1 = get_ovlp(cell, kpt)
        s2 = scfint.get_ovlp(cell, kpt)
        self.assertAlmostEqual(numpy.linalg.norm(s1-s2), 0, 5)
Пример #4
0
def get_ovlp(mf, cell, kpts):
    '''Get the overlap AO matrices at sampled k-points.

    Args:
        kpts : (nkpts, 3) ndarray

    Returns:
        ovlp_kpts : (nkpts, nao, nao) ndarray
    '''
    nkpts = len(kpts)
    nao = cell.nao_nr()
    ovlp_kpts = np.zeros((nkpts,nao,nao), np.complex128)
    for k in range(nkpts):
        kpt = kpts[k,:]
        if mf.analytic_int:
            ovlp_kpts[k,:,:] = scfint.get_ovlp(cell, kpt)
        else:
            ovlp_kpts[k,:,:] = pbchf.get_ovlp(cell, kpt)
    return ovlp_kpts
Пример #5
0
    def test_becke_grids(self):
        L = 4.
        n = 30
        cell = pgto.Cell()
        cell.h = numpy.eye(3)*L
        cell.h[0,1] = cell.h[1,2] = L / 2
        cell.gs = numpy.array([n,n,n])

        cell.atom =[['He' , ( L/2+0., L/2+0. ,   L/2+1.)],
                    ['He' , ( L/2+1., L/2+0. ,   L/2+1.)]]
        cell.basis = {'He': [[0, (1.0, 1.0)]]}
        cell.build()
        grids = gen_grid.BeckeGrids(cell)
        grids.level = 3
        grids.build()
        s1 = get_ovlp(cell, grids)
        s2 = scfint.get_ovlp(cell)
        self.assertAlmostEqual(numpy.linalg.norm(s1-s2), 0, 5)
        self.assertEqual(grids.weights.size, 14829)
Пример #6
0
 def test_olvp(self):
     cell = make_cell1(4, 20)
     cell.nimgs = [2,2,2]
     s1 = scfint.get_ovlp(cell)
     self.assertAlmostEqual(finger(s1), 1.3229918679678208, 10)