コード例 #1
0
ファイル: m_ao_eval.py プロジェクト: chrinide/pyscf
def ao_eval_(ao, ra, isp, coords, res):
  """
    Compute the values of atomic orbitals on given grid points
    Args:
      ao  : instance of ao_log_c class
      ra  : vector where the atomic orbitals from "ao" are centered
      isp : specie index for which we compute
      coords: coordinates on which we compute
    Returns:
      res[norbs,ncoord] : array of atomic orbital values
  """
  jmx_sp = ao.sp_mu2j[isp].max()
  rsh = np.zeros((jmx_sp+1)**2)
  coeffs = np.zeros((6))
  res.fill(0.0)
  rcutmx = ao.sp2rcut[isp]
  for icrd,coord in enumerate(coords-ra):
    rsphar(coord, jmx_sp, rsh)
    r = np.sqrt((coord**2).sum())
    if r>rcutmx: continue
    ir = comp_coeffs_(ao.interp_rr, r, coeffs)
    for j,ff,s,f in zip(ao.sp_mu2j[isp],ao.psi_log_rl[isp],ao.sp_mu2s[isp],ao.sp_mu2s[isp][1:]):
      fval = (ff[ir:ir+6]*coeffs).sum() if j==0 else (ff[ir:ir+6]*coeffs).sum()*r**j
      res[s:f,icrd] = fval * rsh[j*(j+1)-j:j*(j+1)+j+1]
  
  return 0
コード例 #2
0
def ao_eval_(ao, ra, isp, coords, res):
  """
    Compute the values of atomic orbitals on given grid points
    Args:
      ao  : instance of ao_log_c class
      ra  : vector where the atomic orbitals from "ao" are centered
      isp : specie index for which we compute
      coords: coordinates on which we compute
    Returns:
      res[norbs,ncoord] : array of atomic orbital values
  """
  jmx_sp = ao.sp_mu2j[isp].max()
  rsh = np.zeros((jmx_sp+1)**2)
  coeffs = np.zeros((6))
  res.fill(0.0)
  rcutmx = ao.sp2rcut[isp]
  for icrd,coord in enumerate(coords-ra):
    rsphar(coord, jmx_sp, rsh)
    r = np.sqrt((coord**2).sum())
    if r>rcutmx: continue
    ir = comp_coeffs_(ao.interp_rr, r, coeffs)
    for j,ff,s,f in zip(ao.sp_mu2j[isp],ao.psi_log_rl[isp],ao.sp_mu2s[isp],ao.sp_mu2s[isp][1:]):
      fval = (ff[ir:ir+6]*coeffs).sum() if j==0 else (ff[ir:ir+6]*coeffs).sum()*r**j
      res[s:f,icrd] = fval * rsh[j*(j+1)-j:j*(j+1)+j+1]
  
  return 0
コード例 #3
0
def comp_coeffs(self, r):
  i2coeff = np.zeros(6)
  k = comp_coeffs_(self, r, i2coeff)
  return k,i2coeff