src/IntRank2/IntRank2A.cc
/* Each interaction stores one set of Euler Angles {alpha, beta, gamma} that
   describe its orientation with respect to its principal axis system (PAS).
   Typically these angles are those that relate the PAS to the laboratory
   frame, but they may easily be used to relate the PAS to some other frame
   (molecular, diffusion, ......). However, GAMMA contains composite
   rotations well suited for employing any number of reference frames. We are
   usually quite happy if no orientation is specified and we then just set the
   tensor in its PAS.  However, this is controlled by the warnings flag.

   All parameters will be prefixed with Pbase so that derived classes may use
   their own naming convention.  The default Pbase is "IR2" for this class.
   The easiest way to specify the orientation (after simply not setting it)
   is through use of a set of Euler angles { alpha, beta, gamma }. This may be
   done either with individual angles (e.g. IR2alpha, IR2beta, IR2gamma) or
   with a single Euler angle set (e.g. IR2EAngles). Another useful way, albeit
   more complicated, is to specify the 5 Cartesian tensor components directly,
   { Axx, Axy, Axz, Ayy, Ayz, Azz }. In that case the orientation and 
   asymmetry are both tied into the same set of values so they must both be
   determined at the same time.  Worse, this often demands an iterative
   proceedure to determine the Euler angles.                                 */
Each interaction stores one set of Euler Angles {alpha, beta, gamma} that
describe its orientation with respect to its principal axis system (PAS).
Typically these angles are those that relate the PAS to the laboratory
frame, but they may easily be used to relate the PAS to some other frame
(molecular, diffusion, ......). However, GAMMA contains composite
rotations well suited for employing any number of reference frames. We are
usually quite happy if no orientation is specified and we then just set the
tensor in its PAS.  However, this is controlled by the warnings flag.

All parameters will be prefixed with Pbase so that derived classes may use
their own naming convention.  The default Pbase is "IR2" for this class.
The easiest way to specify the orientation (after simply not setting it)
is through use of a set of Euler angles { alpha, beta, gamma }. This may be
done either with individual angles  or
with a single Euler angle set . Another useful way, albeit
more complicated, is to specify the 5 Cartesian tensor components directly,
{ Axx, Axy, Axz, Ayy, Ayz, Azz }. In that case the orientation and
asymmetry are both tied into the same set of values so they must both be
determined at the same time.  Worse, this often demands an iterative
proceedure to determine the Euler angles.
Each interaction stores one set of Euler Angles { alpha beta gamma } that describe its orientation with respect to its principal axis system ( PAS ) . Typically these angles are those that relate the PAS to the laboratory frame but they may easily be used to relate the PAS to some other frame ( molecular diffusion ...... ) . However GAMMA contains composite rotations well suited for employing any number of reference frames . We are usually quite happy if no orientation is specified and we then just set the tensor in its PAS . However this is controlled by the warnings flag . All parameters will be prefixed with Pbase so that derived classes may use their own naming convention . The default Pbase is " IR2 " for this class . The easiest way to specify the orientation ( after simply not setting it ) is through use of a set of Euler angles { alpha beta gamma } . This may be done either with individual angles or with a single Euler angle set . Another useful way albeit more complicated is to specify the 5 Cartesian tensor components directly { Axx Axy Axz Ayy Ayz Azz } . In that case the orientation and asymmetry are both tied into the same set of values so they must both be determined at the same time . Worse this often demands an iterative proceedure to determine the Euler angles .
bool IntRank2A::getOrientation(const ParameterSet& pset, const string& Pbase,
                              EAngles& EA, int idxI, int idxS, bool warn) const
  {
  string Nidx = "";                             
  if(idxI >= 0)                                 
    {                                           
    Nidx  = string("(") + Gdec(idxI);            
    if(idxS > 0)                                
       Nidx += string(",")+Gdec(idxS);           
    Nidx += string(")");                        
    }
  double pdatad;                                
  string pstate;                                
  string pname = Pbase + "EAngles" + Nidx;	
  coord EAtmp;					
  ParameterSet::const_iterator item;         
  item  = pset.seek(pname);			
  if(item != pset.end())			
    {						
    EAtmp = coord(*item);			
    EA.alpha(EAtmp.x() * DEG2RAD);		
    EA.beta(EAtmp.y()  * DEG2RAD);		
    EA.gamma(EAtmp.z() * DEG2RAD); 		
    return true;
    }
  double alpha=0, beta=0, gamma=0;              
  pname = Pbase + "Alpha" + Nidx; 		
  if(pset.getDouble(pname, pdatad))             
    {                                           
    alpha = pdatad*DEG2RAD;                     
    pname = Pbase + "Beta" + Nidx;              
    if(pset.getDouble(pname, pdatad))           
      beta = pdatad*DEG2RAD;                    
    pname = Pbase + "Gamma" + Nidx;             
    if(pset.getDouble(pname, pdatad))           
      gamma = pdatad*DEG2RAD;                   
    EA = EAngles(alpha,beta,gamma);             
    return true;
    }
  pname = Pbase + "Theta" + Nidx;               
  if(pset.getDouble(pname, pdatad))             
    {                                           
    beta = pdatad*DEG2RAD;			
    pname = Pbase + "Phi" + Nidx;               
    if(pset.getDouble(pname, pdatad))           
      alpha = pdatad*DEG2RAD;			
    EA = EAngles(alpha,beta,gamma);             
    return true;
    }
  pname = Pbase + "alpha" + Nidx; 		
  if(pset.getDouble(pname, pdatad))             
    {                                           
    alpha = pdatad*DEG2RAD;                     
    pname = Pbase + "beta" + Nidx;              
    if(pset.getDouble(pname, pdatad))           
      beta = pdatad*DEG2RAD;                    
    pname = Pbase + "gamma" + Nidx;             
    if(pset.getDouble(pname, pdatad))           
      gamma = pdatad*DEG2RAD;                   
    EA = EAngles(alpha,beta,gamma);             
    return true;
    }
  if(warn)					
    {						
    IR2Aerror(51,1);				
    IR2Aerror(52,1);				
    }
  return false;                                 
  }
bool IntRank2A :: getOrientation ( const ParameterSet & pset , const string & Pbase , EAngles & EA , int idxI , int idxS , bool warn ) const { string Nidx = " " ; if ( idxI >= 0 ) { Nidx = string ( " " ) + Gdec ( idxI ) ; if ( idxS > 0 ) Nidx += string ( " " ) + Gdec ( idxS ) ; Nidx += string ( " " ) ; } double pdatad ; string pstate ; string pname = Pbase + " " + Nidx ; coord EAtmp ; ParameterSet :: const_iterator item ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { EAtmp = coord ( * item ) ; EA . alpha ( EAtmp . x ( ) * DEG2RAD ) ; EA . beta ( EAtmp . y ( ) * DEG2RAD ) ; EA . gamma ( EAtmp . z ( ) * DEG2RAD ) ; return true ; } double alpha = 0 , beta = 0 , gamma = 0 ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) { alpha = pdatad * DEG2RAD ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) beta = pdatad * DEG2RAD ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) gamma = pdatad * DEG2RAD ; EA = EAngles ( alpha , beta , gamma ) ; return true ; } pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) { beta = pdatad * DEG2RAD ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) alpha = pdatad * DEG2RAD ; EA = EAngles ( alpha , beta , gamma ) ; return true ; } pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) { alpha = pdatad * DEG2RAD ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) beta = pdatad * DEG2RAD ; pname = Pbase + " " + Nidx ; if ( pset . getDouble ( pname , pdatad ) ) gamma = pdatad * DEG2RAD ; EA = EAngles ( alpha , beta , gamma ) ; return true ; } if ( warn ) { IR2Aerror ( 51 , 1 ) ; IR2Aerror ( 52 , 1 ) ; } return false ; }
Each interaction stores one set of Euler Angles {alpha, beta, gamma} that
describe its orientation with respect to its principal axis system (PAS).
Each interaction stores one set of Euler Angles { alpha beta gamma } that describe its orientation with respect to its principal axis system ( PAS ) .
// Name addition per index // Suffix only if idxI > -1 //   Add idxI index to name //   as (# //   If idxS > 0 add it to //   to suffix as ,# (#,# //   Finish suffix (#) or (#,#) // Double for angle value // Temp string for parsing //         Try And Read A Set Of Euler Angles { Alpha, Beta, Gamma } //                    ( These Will Externally Be in Degrees ) // Euler angles parameter name // Temp coordinate for read // Pix in parameter list // Get the pix for parameter // If the parameter is found // then we glean the EAngles //   Read as a coordnate (deg) //   Set Euler angles, we //   convert degrees to  //   radians for storage //         Try And Read 3 Individual Euler Angles { Alpha, Beta, Gamma } //                    ( These Will Externally Be in Degrees ) // Temp Euler angles // Parameter name for alpha // If it's been found // we look for beta and gamma //   Keep the alpha value //   Parameter name for beta //   Look for beta value //   Keep beta value if found //   Parameter name for gamma //   Look for gamma value //   Keep gamma value if found //   Set Euler angles //               Try And Read Euler Angles { Theta, Phi, --- } //                    ( These Will Externally Be in Degrees ) // Parameter name for theta // If it's been found // we look for phi also //   Keep theta value if found //   Parameter name for phi //   Look for phi value //   Keep phi value if found //   Set Euler angles //         Try And Read 3 Individual Euler Angles { alpha, beta, gamma } //                    ( These Will Externally Be in Degrees ) // Parameter name for alpha // If it's been found // we look for beta and gamma //   Keep the alpha value //   Parameter name for beta //   Look for beta value //   Keep beta value if found //   Parameter name for gamma //   Look for gamma value //   Keep gamma value if found //   Set Euler angles //                      Issue Warnings If No Angle Found //                         (Only If Warning Flag Set) // Warn if desired & cannot // find any orientation angles //    Cant find orient. angles //    Unable to set orientation // Could not find orientation