Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 4
0
def eri3c(me, sp1, sp2, R1, R2, sp3, R3, **kvargs):
    """ Computes three-center Electron Repulsion Integrals.
    atomic orbitals of second species must contain the Hartree potentials of radial functions (product orbitals)"""
    from pyscf.nao.m_ao_matelem import build_3dgrid3c
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
    #from pyscf.nao.m_ao_eval import ao_eval as ao_eval

    grids = build_3dgrid3c(me, sp1, sp2, R1, R2, sp3, R3, **kvargs)

    ao1 = grids.weights * ao_eval(me.aos[0], R1, sp1, grids.coords)
    ao2 = ao_eval(me.aos[0], R2, sp2, grids.coords)
    aoao = np.einsum('ar,br->abr', ao1, ao2)
    pbf = ao_eval(me.aos[1], R3, sp3, grids.coords)

    abp2eri = np.einsum('abr,pr->abp', aoao, pbf)
    return abp2eri
Ejemplo n.º 5
0
def eri3c(me, sp1,sp2,R1,R2, sp3,R3, **kvargs):
    """ Computes three-center Electron Repulsion Integrals.
    atomic orbitals of second species must contain the Hartree potentials of radial functions (product orbitals)"""
    from pyscf.nao.m_ao_matelem import build_3dgrid3c
    from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
    #from pyscf.nao.m_ao_eval import ao_eval as ao_eval
    
    grids = build_3dgrid3c(me, sp1,sp2,R1,R2, sp3,R3, **kvargs)

    ao1 = grids.weights * ao_eval(me.aos[0], R1, sp1, grids.coords)
    ao2 = ao_eval(me.aos[0], R2, sp2, grids.coords)
    aoao = np.einsum('ar,br->abr', ao1, ao2)
    pbf = ao_eval(me.aos[1], R3, sp3, grids.coords)
    
    abp2eri = np.einsum('abr,pr->abp',aoao,pbf)
    return abp2eri
Ejemplo n.º 6
0
 def eval_ao(self, feval, coords, comp, shls_slice=None, non0tab=None, out=None):
   """ Computes the values of all atomic orbitals for a set of given Cartesian coordinates.
      This function should be similar to the pyscf's function eval_gto()... """
   from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
   assert feval=="GTOval_sph_deriv0"
   assert shls_slice is None
   assert non0tab is None
   assert comp==1
   aos = ao_eval(self.ao_log, np.zeros(3), 0, coords)
   return aos
Ejemplo n.º 7
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
Ejemplo n.º 8
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
Ejemplo n.º 9
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
Ejemplo n.º 10
0
 def eval_ao(self,
             feval,
             coords,
             comp,
             shls_slice=None,
             non0tab=None,
             out=None):
     """ Computes the values of all atomic orbitals for a set of given Cartesian coordinates.
    This function should be similar to the pyscf's function eval_gto()... """
     from pyscf.nao.m_ao_eval_libnao import ao_eval_libnao as ao_eval
     assert feval == "GTOval_sph_deriv0"
     assert shls_slice is None
     assert non0tab is None
     assert comp == 1
     aos = ao_eval(self.ao_log, np.zeros(3), 0, coords)
     return aos