Exemplo n.º 1
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
Exemplo n.º 2
0
Arquivo: mf.py Projeto: chrinide/pyscf
 def dens_elec(self, coords, dm): # Compute electronic density for a given density matrix and on a given set of coordinates
   from pyscf.nao.m_dens_libnao import dens_libnao
   from pyscf.nao.m_init_dm_libnao import init_dm_libnao
   from pyscf.nao.m_init_dens_libnao import init_dens_libnao
   if not self.init_sv_libnao : raise RuntimeError('not self.init_sv_libnao')
   if init_dm_libnao(dm) is None : raise RuntimeError('init_dm_libnao(dm) is None')
   if init_dens_libnao()!=0 : raise RuntimeError('init_dens_libnao()!=0')
   return dens_libnao(coords, self.nspin)
Exemplo n.º 3
0
 def dens_elec(self, coords, dm):
     """ Compute electronic density for a given density matrix and on a given set of coordinates """
     from pyscf.nao.m_dens_libnao import dens_libnao
     from pyscf.nao.m_init_dm_libnao import init_dm_libnao
     from pyscf.nao.m_init_dens_libnao import init_dens_libnao
     if not self.init_sv_libnao:
         raise RuntimeError('not self.init_sv_libnao')
     if init_dm_libnao(dm) is None:
         raise RuntimeError('init_dm_libnao(dm) is None')
     if init_dens_libnao() != 0: raise RuntimeError('init_dens_libnao()!=0')
     return dens_libnao(coords, self.nspin)