src/Solids/Powder.cc
/* This function generates the simplest powder, just linear angle increments
   over the entire sphere. There will be Nbeta beta angles taken down from the
   +z axis spanning the range of (0, PI) or from (0, PI/2]. At each of these
   angles there will be Nalpha alpha angles taken over from the +x axis. These 
   second angles span the range of [0, 2PI). Since the probablity of having
   the orientation with beta = 0 and beta = PI is zero, these angles will NOT
   be included in the Euler angle set. The flag uhonly dictates if the beta
   range stays in the upper-hemisphere or not, the former allowed only if the
   number of alpha angles is set to 1. Having Nalpha=1 and uhonly=true should
   only be used when there is no asymmetry in the powder. Lastly, since the
   number of alpha angles is constant regardless of the angle beta, there is
   a scaling factor of sin(beta) applicable to each orientation at beta.
   This will clearly be a very direct, abeit computationally slow, means of
   generating an effective set of orientations overa a powder.               */
This function generates the simplest powder, just linear angle increments
over the entire sphere. There will be Nbeta beta angles taken down from the
+z axis spanning the range of (0, PI) or from (0, PI/2]. At each of these
angles there will be Nalpha alpha angles taken over from the +x axis. These
second angles span the range of [0, 2PI). Since the probablity of having
the orientation with beta = 0 and beta = PI is zero, these angles will NOT
be included in the Euler angle set. The flag uhonly dictates if the beta
range stays in the upper-hemisphere or not, the former allowed only if the
number of alpha angles is set to 1. Having Nalpha=1 and uhonly=true should
only be used when there is no asymmetry in the powder. Lastly, since the
number of alpha angles is constant regardless of the angle beta, there is
a scaling factor of sin(beta) applicable to each orientation at beta.
This will clearly be a very direct, abeit computationally slow, means of
generating an effective set of orientations overa a powder.
This function generates the simplest powder just linear angle increments over the entire sphere . There will be Nbeta beta angles taken down from the + z axis spanning the range of ( 0 PI ) or from ( 0 PI / 2 ] . At each of these angles there will be Nalpha alpha angles taken over from the + x axis . These second angles span the range of [ 0 2PI ) . Since the probablity of having the orientation with beta = 0 and beta = PI is zero these angles will NOT be included in the Euler angle set . The flag uhonly dictates if the beta range stays in the upper - hemisphere or not the former allowed only if the number of alpha angles is set to 1 . Having Nalpha = 1 and uhonly = true should only be used when there is no asymmetry in the powder . Lastly since the number of alpha angles is constant regardless of the angle beta there is a scaling factor of sin ( beta ) applicable to each orientation at beta . This will clearly be a very direct abeit computationally slow means of generating an effective set of orientations overa a powder .
void Powder::Spherical(int Nbeta, int Nalpha, bool uhonly)
  {
  _EAs.clear();					
  _Ps.clear();					
  _PN = string("Spherical");			
  _A3 =false;					
  if(Nalpha) uhonly = false;			
  double bmax   = uhonly?90.0:180.0;		
  int    nbspan = uhonly?Nbeta:Nbeta+1;		
  double binc   = bmax/double(nbspan); 		
  double beta   = binc;				
  double ainc   = 360.0/double(Nalpha); 
  double alph   = 0;				
  double sf;					
  int i,j;
  for(i=0; i<Nbeta; i++, beta+=binc)		
    {
    sf = sin(beta*DEG2RAD);			
    if(uhonly && beta==90.0) sf/=2.0;		
    _EAs.push_back(EAngles(0,beta,0,true));	
    _Ps.push_back(sin(beta*DEG2RAD));		
    for(j=1; j<Nalpha; j++)			
      {
      alph = double(j)*ainc;			
      _EAs.push_back(EAngles(alph,beta,0,true));
      _Ps.push_back(sin(beta*DEG2RAD));		
      }
    }
  }
void Powder :: Spherical ( int Nbeta , int Nalpha , bool uhonly ) { _EAs . clear ( ) ; _Ps . clear ( ) ; _PN = string ( " " ) ; _A3 = false ; if ( Nalpha ) uhonly = false ; double bmax = uhonly ? 90.0 : 180.0 ; int nbspan = uhonly ? Nbeta : Nbeta + 1 ; double binc = bmax / double ( nbspan ) ; double beta = binc ; double ainc = 360.0 / double ( Nalpha ) ; double alph = 0 ; double sf ; int i , j ; for ( i = 0 ; i < Nbeta ; i ++ , beta += binc ) { sf = sin ( beta * DEG2RAD ) ; if ( uhonly && beta == 90.0 ) sf /= 2.0 ; _EAs . push_back ( EAngles ( 0 , beta , 0 , true ) ) ; _Ps . push_back ( sin ( beta * DEG2RAD ) ) ; for ( j = 1 ; j < Nalpha ; j ++ ) { alph = double ( j ) * ainc ; _EAs . push_back ( EAngles ( alph , beta , 0 , true ) ) ; _Ps . push_back ( sin ( beta * DEG2RAD ) ) ; } } }
This function generates the simplest powder, just linear angle increments
over the entire sphere.
This function generates the simplest powder just linear angle increments over the entire sphere .
// Remove existing angles // Remove existing probabilties // Name powder spherical // It is two angle powder // Alpha average full sphere // Maximum beta to compute // Number beta points to span  // Beta angle increment // Start at first beta (not 0) // Start at first alpha (0)  // Scaling factor // Loop over beta angles (theta) //   Use this  probability //   Half if at 90 & half-sphere //   Store these angles //   Store this  probability //   Loop alpha angles (phi) //     The angle alpha //     Store these angles //     Store this  probability