Exemplo n.º 1
0
 def prod(ij):
     i, j = divmod(ij, nao)
     rhoR = aoR_k1[:, i] * aoR_k2[:, j].conj()
     rhoG = tools.fftk(rhoR, cell.gs, expmikr)
     vG = coulG * rhoG
     vR = tools.ifftk(vG, cell.gs, expmikr.conj())
     return vR
Exemplo n.º 2
0
Arquivo: hf.py Projeto: ncrubin/pyscf
def get_vkR_(mf, cell, aoR_k1, aoR_k2, kpt1, kpt2):
    '''Get the real-space 2-index "exchange" potential V_{i,k1; j,k2}(r).

    Kwargs:
        kpts : (nkpts, 3) ndarray
            The sampled k-points; may be required for G=0 correction.

    Returns:
        vR : (ngs, nao, nao) ndarray
            The real-space "exchange" potential at every grid point, for all
            AO pairs.

    Note:
        This is essentially a density-fitting or resolution-of-the-identity.
        The returned object is of size ngs*nao**2 and could be precomputed and
        saved in vhfopt.
    '''
    coords = pyscf.pbc.dft.gen_grid.gen_uniform_grids(cell)
    ngs, nao = aoR_k1.shape

    coulG = tools.get_coulG(cell, kpt1-kpt2, exx=True, mf=mf)

    vR = np.zeros((ngs,nao,nao), dtype=np.complex128)
    for i in range(nao):
        for j in range(nao):
            rhoR = aoR_k1[:,i] * aoR_k2[:,j].conj()
            rhoG = tools.fftk(rhoR, cell.gs, coords, kpt1-kpt2)
            vG = coulG*rhoG
            vR[:,i,j] = tools.ifftk(vG, cell.gs, coords, kpt1-kpt2)
    return vR
Exemplo n.º 3
0
 def prod(ij):
     i, j = divmod(ij, nao)
     rhoR = aoR_k1[:,i] * aoR_k2[:,j].conj()
     rhoG = tools.fftk(rhoR, cell.gs, expmikr)
     vG = coulG*rhoG
     vR = tools.ifftk(vG, cell.gs, expmikr.conj())
     return vR
Exemplo n.º 4
0
def get_vkR(mydf, cell, aoR_k1, aoR_k2, kpt1, kpt2, coords, gs, exxdiv):
    '''Get the real-space 2-index "exchange" potential V_{i,k1; j,k2}(r)
    where {i,k1} = exp^{i k1 r) |i> , {j,k2} = exp^{-i k2 r) <j|

    Kwargs:
        kpt1, kpt2 : (3,) ndarray
            The sampled k-points; may be required for G=0 correction.

    Returns:
        vR : (ngs, nao, nao) ndarray
            The real-space "exchange" potential at every grid point, for all
            AO pairs.

    Note:
        This is essentially a density-fitting or resolution-of-the-identity.
        The returned object is of size ngs*nao**2
    '''
    ngs, nao = aoR_k1.shape
    expmikr = np.exp(-1j * np.dot(kpt1 - kpt2, coords.T))
    mydf.exxdiv = exxdiv
    coulG = tools.get_coulG(cell, kpt1 - kpt2, True, mydf, gs)

    aoR_k1 = np.asarray(aoR_k1.T, order='C')
    aoR_k2 = np.asarray(aoR_k2.T, order='C')
    vR = np.empty((nao, nao, ngs), dtype=np.complex128)
    for i in range(nao):
        rhoR = aoR_k1 * aoR_k2[i].conj()
        rhoG = tools.fftk(rhoR, gs, expmikr)
        vG = rhoG * coulG
        vR[:, i] = tools.ifftk(vG, gs, expmikr.conj())
    vR = vR.transpose(2, 0, 1)

    if aoR_k1.dtype == np.double and aoR_k2.dtype == np.double:
        return vR.real
    else:
        return vR
Exemplo n.º 5
0
def get_vkR(mydf, cell, aoR_k1, aoR_k2, kpt1, kpt2, coords, gs, exxdiv):
    """Get the real-space 2-index "exchange" potential V_{i,k1; j,k2}(r)
    where {i,k1} = exp^{i k1 r) |i> , {j,k2} = exp^{-i k2 r) <j|

    Kwargs:
        kpt1, kpt2 : (3,) ndarray
            The sampled k-points; may be required for G=0 correction.

    Returns:
        vR : (ngs, nao, nao) ndarray
            The real-space "exchange" potential at every grid point, for all
            AO pairs.

    Note:
        This is essentially a density-fitting or resolution-of-the-identity.
        The returned object is of size ngs*nao**2
    """
    ngs, nao = aoR_k1.shape
    expmikr = np.exp(-1j * np.dot(kpt1 - kpt2, coords.T))
    mydf.exxdiv = exxdiv
    coulG = tools.get_coulG(cell, kpt1 - kpt2, True, mydf, gs)

    aoR_k1 = np.asarray(aoR_k1.T, order="C")
    aoR_k2 = np.asarray(aoR_k2.T, order="C")
    vR = np.empty((nao, nao, ngs), dtype=np.complex128)
    for i in range(nao):
        rhoR = aoR_k1 * aoR_k2[i].conj()
        rhoG = tools.fftk(rhoR, gs, expmikr)
        vG = rhoG * coulG
        vR[:, i] = tools.ifftk(vG, gs, expmikr.conj())
    vR = vR.transpose(2, 0, 1)

    if aoR_k1.dtype == np.double and aoR_k2.dtype == np.double:
        return vR.real
    else:
        return vR