Example #1
0
void CnvMapEvalComponent(int Lmax,double *ecoef,double *plm,
                      double *phi,int n,double *ecomp) {

  int i,m,L,k; 
  for (i=0;i<n;i++) ecomp[i]=0.0;
  for (m=0;m<=Lmax;m++) {
    for (L=m;L<=Lmax;L++) {
       k=CnvMapIndexLegendre(L,m);
       for (i=0;i<n;i++) {
         if (m==0) ecomp[i]=ecomp[i]+ecoef[k*n+i]*PLM(L,m,i);
         else ecomp[i]=ecomp[i]+ecoef[k*n+i]*PLM(L,m,i)*cos(m*phi[i])+
              ecoef[(k+1)*n+i]*PLM(L,m,i)*sin(m*phi[i]); 
       }
    }
  }
}
Example #2
0
aligned_char_ref alloc (unsigned int n)
{
  register aligned_char_ref p = n ? (aligned_char_ref)malloc(n) : (aligned_char_ref)alloc_0 ;
#ifdef DEBUG_ALLOC
  static unsigned int counter = 0 ;
  PLM("alloc(%u): %p. Allocated: %u", n, p, ++counter) ;
#endif
  return p ;
}
void CMolecularSystem::YLM(int l, int m, double theta, double phi, double &realYLM, double &imgYLM)
{
  double factor;
  double m_PLM;
  m_PLM = PLM(l,m,cos(theta));
  factor = ((2.0*double(l) + 1.0)*constants.factorials[l-m]) / (4.0*pi*constants.factorials[l+m]);
  realYLM = sqrt(factor) * m_PLM * cos(double(m)*phi);
  imgYLM  = sqrt(factor) * m_PLM * sin(double(m)*phi);
}
Example #4
0
int alloc_realloc (aligned_char_ref *x, unsigned int n)
{
  aligned_char_ref y = n ? (aligned_char_ref)realloc(*x, n) : (free(*x), alloc_0) ;
#ifdef DEBUG_ALLOC
  PLM("alloc_realloc(&%p) -> new address = %p", *x, y) ;
#endif
  if (!y) return 0 ;
  *x = y ;
  return 1 ;
}
Example #5
0
void alloc_free (void *p)
{
  register int e = errno ;
#ifdef DEBUG_ALLOC
  static unsigned int counter = 0 ;
  PLM("alloc_free(%p). Freed: %u", p, ++counter) ;
#endif
#ifndef HASMALLOC0
  if (p != alloc_0)
#endif
  free(p) ;
  errno = e ;
}