Beispiel #1
0
def overlap_ni(me, sp1, R1, sp2, R2, **kw):
    """
      Computes overlap for an atom pair. The atom pair is given by a pair of species indices
      and the coordinates of the atoms.
      Args: 
        sp1,sp2 : specie indices, and
        R1,R2 :   respective coordinates in Bohr, atomic units
      Result:
        matrix of orbital overlaps
      The procedure uses the numerical integration in coordinate space.
    """
    from pyscf.nao.m_ao_matelem import build_3dgrid
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval  #_libnao

    grids = build_3dgrid(me, sp1, R1, sp2, R2, **kw)

    ao1 = ao_eval(me.ao1, R1, sp1, grids.coords)
    ao1 = ao1 * grids.weights

    ao2 = ao_eval(me.ao2, R2, sp2, grids.coords)

    overlaps = np.einsum("ij,kj->ik", ao1,
                         ao2)  #      overlaps = np.matmul(ao1, ao2.T)

    return overlaps
Beispiel #2
0
def xc_scalar_ni(me, sp1, R1, sp2, R2, xc_code, deriv, **kw):
    from pyscf.dft.libxc import eval_xc
    """
    Computes overlap for an atom pair. The atom pair is given by a pair of species indices
    and the coordinates of the atoms.
    Args: 
      sp1,sp2 : specie indices, and
      R1,R2 :   respective coordinates in Bohr, atomic units
    Result:
      matrix of orbital overlaps
    The procedure uses the numerical integration in coordinate space.
  """
    grids = build_3dgrid(me, sp1, R1, sp2, R2, **kw)
    rho = dens_libnao(grids.coords, me.sv.nspin)
    exc, vxc, fxc, kxc = libxc.eval_xc(xc_code,
                                       rho.T,
                                       spin=me.sv.nspin - 1,
                                       deriv=deriv)

    ao1 = ao_eval(me.ao1, R1, sp1, grids.coords)

    if deriv == 1:
        #print(' vxc[0].shape ', vxc[0].shape)
        ao1 = ao1 * grids.weights * vxc[0]
    elif deriv == 2:
        ao1 = ao1 * grids.weights * fxc[0]
    else:
        print(' deriv ', deriv)
        raise RuntimeError('!deriv!')

    ao2 = ao_eval(me.ao2, R2, sp2, grids.coords)
    overlaps = blas.dgemm(1.0, ao1, ao2.T)

    return overlaps
Beispiel #3
0
def eri2c(me, sp1,R1,sp2,R2, **kvargs):
    """ Computes two-center Electron Repulsion Integrals. This is normally done between product basis functions"""
    from pyscf.nao.m_ao_matelem import build_3dgrid
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
    
    grids = build_3dgrid(me, sp1,np.array(R1), sp2,np.array(R2), **kvargs)

    pf = grids.weights * ao_eval(me.ao2,         np.array(R1), sp1, grids.coords)
    qv =                 ao_eval(me.ao2_hartree, np.array(R2), sp2, grids.coords)

    pq2eri = np.einsum('pr,qr->pq',pf,qv)
    return pq2eri
Beispiel #4
0
def dipole_ni(me, sp1, R1, sp2, R2, **kvargs):
    """
      Computes overlap for an atom pair. The atom pair is given by a pair of species indices
      and the coordinates of the atoms.
      Args: 
        sp1,sp2 : specie indices, and
        R1,R2 :   respective coordinates in Bohr, atomic units
      Result:
        matrix of orbital overlaps
      The procedure uses the numerical integration in coordinate space.
    """
    from pyscf.nao.m_ao_matelem import build_3dgrid
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval

    grids = build_3dgrid(me, sp1, R1, sp2, R2, **kvargs)

    ao1 = ao_eval(me.ao1, R1, sp1, grids.coords)
    ao1 = ao1 * grids.weights
    ko1 = np.einsum('ik,oi->koi', grids.coords, ao1)
    ao2 = ao_eval(me.ao1, R2, sp2, grids.coords)
    koo2dip = np.einsum("koi,pi->kop", ko1, ao2)

    return koo2dip
Beispiel #5
0
def dipole_ni(me, sp1, R1, sp2, R2, **kvargs):
    """
      Computes overlap for an atom pair. The atom pair is given by a pair of species indices
      and the coordinates of the atoms.
      Args: 
        sp1,sp2 : specie indices, and
        R1,R2 :   respective coordinates in Bohr, atomic units
      Result:
        matrix of orbital overlaps
      The procedure uses the numerical integration in coordinate space.
    """
    from pyscf.nao.m_ao_matelem import build_3dgrid
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
    
    grids = build_3dgrid(me, sp1, R1, sp2, R2, **kvargs)

    ao1 = ao_eval(me.ao1, R1, sp1, grids.coords)
    ao1 = ao1 * grids.weights
    ko1 = np.einsum('ik,oi->koi', grids.coords, ao1)
    ao2 = ao_eval(me.ao1, R2, sp2, grids.coords)
    koo2dip = np.einsum("koi,pi->kop", ko1, ao2)

    return koo2dip
Beispiel #6
0
def overlap_ni(me, sp1,R1, sp2,R2, **kvargs):
    """
      Computes overlap for an atom pair. The atom pair is given by a pair of species indices
      and the coordinates of the atoms.
      Args: 
        sp1,sp2 : specie indices, and
        R1,R2 :   respective coordinates in Bohr, atomic units
      Result:
        matrix of orbital overlaps
      The procedure uses the numerical integration in coordinate space.
    """
    from pyscf.nao.m_ao_matelem import build_3dgrid
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval #_libnao

    grids = build_3dgrid(me, sp1, R1, sp2, R2, **kvargs)

    ao1 = ao_eval(me.ao1, R1, sp1, grids.coords)
    ao1 = ao1 * grids.weights

    ao2 = ao_eval(me.ao2, R2, sp2, grids.coords)

    overlaps = np.einsum("ij,kj->ik", ao1, ao2) #      overlaps = np.matmul(ao1, ao2.T)

    return overlaps