src/Solids/Powder.cc
/* These functions set the powder according the the article by Cheng et. al.:
                                                                          
"Investigations of a nonrandom numerical method for multidimensional integration",
         Vera B. Cheng, Henry H. Suzukawa Jr. and Max Wolfsberg,
                      J.Chem.Phys, 59, 3992-9, (1973)                           

   The array pa contains values related to the powder orientation angle beta,
   or equivalently the angle theta. Given a powder quality value, PAQ, there
   will be N = pa[PAQ] crystallite orientations set in powder. For the kth 
   orientation, the angle beta will be given by PI*(k/N)..... this is
   just evenly incremented down from the z-axis within [0, PI) as in a
   spherical powder. The orientation probablity will be sin(beta), again as
   in a spherical powder. Of course the first value, k=0, will never be used
   since sin(theta) = 0.  The 2nd orientation angle, phi (or equivalently
   alpha), for the kth orientation is given by a somewhat more cryptic formula.
   For this powder, alpha = 2*PI*{(pb[PAQ]*k) % N}/N. This odd incrementation
   is of course the reason the Cheng powder differs from a spherical one.    */
These functions set the powder according the the article by Cheng et. al.:
"Investigations of a nonrandom numerical method for multidimensional integration",
Vera B. Cheng, Henry H. Suzukawa Jr.

The array pa contains values related to the powder orientation angle beta,
or equivalently the angle theta. Given a powder quality value, PAQ, there
will be N = pa[PAQ] crystallite orientations set in powder. For the kth
orientation, the angle beta will be given by PI*(k/N)..... this is
just evenly incremented down from the z-axis within [0, PI) as in a
spherical powder. The orientation probablity will be sin(beta), again as
in a spherical powder. Of course the first value, k=0, will never be used
since sin(theta) = 0.  The 2nd orientation angle, phi (or equivalently
alpha), for the kth orientation is given by a somewhat more cryptic formula.
For this powder, alpha = 2*PI*{(pb[PAQ]*k) % N}/N. This odd incrementation
is of course the reason the Cheng powder differs from a spherical one.
These functions set the powder according the the article by Cheng et . al . : " Investigations of a nonrandom numerical method for multidimensional integration " Vera B . Cheng Henry H . Suzukawa Jr . The array pa contains values related to the powder orientation angle beta or equivalently the angle theta . Given a powder quality value PAQ there will be N = pa [ PAQ ] crystallite orientations set in powder . For the kth orientation the angle beta will be given by PI * ( k / N ) ..... this is just evenly incremented down from the z - axis within [ 0 PI ) as in a spherical powder . The orientation probablity will be sin ( beta ) again as in a spherical powder . Of course the first value k = 0 will never be used since sin ( theta ) = 0 . The 2nd orientation angle phi ( or equivalently alpha ) for the kth orientation is given by a somewhat more cryptic formula . For this powder alpha = 2 * PI * { ( pb [ PAQ ] * k ) % N } / N . This odd incrementation is of course the reason the Cheng powder differs from a spherical one .
void Powder::Cheng(int PAQ)
  {
  _EAs.clear();					
  _Ps.clear();					
  _PN = string("Spherical");			
  _A3 =false;					
  if(PAQ > 22) PAQ = 22;			
  if(PAQ < 0)  PAQ = abs(PAQ);			
  int pa[] = {  2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,
                        2584,4181,6765,10946,17711,28657,43368,75025};
  int pb[] = {  1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,
                        1597,2584,4181,6765,10946,17711,28657};
  int N       = pa[PAQ];
  int M       = pb[PAQ];
  double binc = 180.0/double(N);		
  double ainc = 360.0*double(M)/double(N);	
  double alpha, beta;
  double sf;
  for(int i=1; i<N; i++)			
    {
    beta  =  binc * double(i);			
    alpha =  ainc * (i%N);		
    sf    = sin(beta*DEG2RAD);			
    _EAs.push_back(EAngles(alpha,beta,0,true));	
    _Ps.push_back(sin(beta*DEG2RAD));		
    }
  }
void Powder :: Cheng ( int PAQ ) { _EAs . clear ( ) ; _Ps . clear ( ) ; _PN = string ( " " ) ; _A3 = false ; if ( PAQ > 22 ) PAQ = 22 ; if ( PAQ < 0 ) PAQ = abs ( PAQ ) ; int pa [ ] = { 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144 , 233 , 377 , 610 , 987 , 1597 , 2584 , 4181 , 6765 , 10946 , 17711 , 28657 , 43368 , 75025 } ; int pb [ ] = { 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144 , 233 , 377 , 610 , 987 , 1597 , 2584 , 4181 , 6765 , 10946 , 17711 , 28657 } ; int N = pa [ PAQ ] ; int M = pb [ PAQ ] ; double binc = 180.0 / double ( N ) ; double ainc = 360.0 * double ( M ) / double ( N ) ; double alpha , beta ; double sf ; for ( int i = 1 ; i < N ; i ++ ) { beta = binc * double ( i ) ; alpha = ainc * ( i % N ) ; sf = sin ( beta * DEG2RAD ) ; _EAs . push_back ( EAngles ( alpha , beta , 0 , true ) ) ; _Ps . push_back ( sin ( beta * DEG2RAD ) ) ; } }
These functions set the powder according the the article by Cheng et.
These functions set the powder according the the article by Cheng et .
// Remove existing angles // Remove existing probabilties // Name powder spherical // It is two angle powder // Insure max quality of 22 // Insure quality is positive // Beta increment // Alpha increment // Loop over orientations //   Angle beta  = theta //   Angle alpha = phi //   Scaling factor //   Store these angles //   Store this  probability