src/IntRank2/CartMx2A.cc
/* This function will assume that the irreducible Cartesian spatial tensor
   array A (symmetric) has non-zero asymmetry but that it is diagonal. That is,
   eta != 0 but A contains no off-diagonal elements. It will attempt to 
   generate three Euler angles EA:{alpha,beta,gamma} that relate to the tensor
   PAS to the input array axes. In this case, eta=# & A diagonal, there are
   five angle combinations that will maintain a symmetric tensor under rotation
   from the PAS. The function will return false if we do not catch the proper
   Euler angles.

                I: EA = {0,0,0}                   II: EA = {0,90,0}           

         1      [ eta-1   0    0 ]          1      [  2    0    0   ] 
         - del  |   0  -eta-1  0 |          - del  |  0 -eta-1  0   |
         2   zz [   0     0    2 ]          2   zz [  0    0  eta-1 ]


             III: EA = {0,90,180}                   II: EA = {0,90,0}           

         1      [-eta-1   0    0 ]          1      [  2    0    0   ] 
         - del  |   0   eta-1  0 |          - del  |  0 -eta-1  0   |
         2   zz [   0     0    2 ]          2   zz [  0    0  eta-1 ]

                        
                               III: EA = {alpha,0,0}

             1      [ eta*cos(2*alpha)-1           0          0 ]         
             - del  |         0          -eta*cos(2*alpha)-1  0 |
             2   zz [         0                    0          2 ]         
*/
This function will assume that the irreducible Cartesian spatial tensor
array A (symmetric) has non-zero asymmetry but that it is diagonal. That is,
eta != 0 but A contains no off-diagonal elements. It will attempt to
generate three Euler angles EA:{alpha,beta,gamma} that relate to the tensor
PAS to the input array axes. In this case, eta=# & A diagonal, there are
five angle combinations that will maintain a symmetric tensor under rotation
from the PAS. The function will return false if we do not catch the proper
Euler angles.












This function will assume that the irreducible Cartesian spatial tensor array A ( symmetric ) has non - zero asymmetry but that it is diagonal . That is eta ! = 0 but A contains no off - diagonal elements . It will attempt to generate three Euler angles EA : { alpha beta gamma } that relate to the tensor PAS to the input array axes . In this case eta = # & A diagonal there are five angle combinations that will maintain a symmetric tensor under rotation from the PAS . The function will return false if we do not catch the proper Euler angles .
bool CartMx2A::DiagASymCartEA()			
  {
  string fct("DiagASymCartEA");				
  ConvMeth = 3;						
  TrackConv(ConvMeth);					
  if(!EtaVal)
    {
    C2Aerror(27, 1);					
    C2Aerror(26, fct, 1);				
    C2Afatal(30);					
    }
  if(A.is_zero())					
    {
    C2Aerror(17, 1);					
    C2Aerror(26, fct, 1);				
    C2Afatal(30);					
    }
  if(!PASDelzz)
    {
    C2Aerror(18, 1);					
    C2Aerror(26, fct, 1);				
    C2Afatal(30);					
    }
  if(!A.is_diagonal())					
    {
    C2Aerror(19, 1);					
    C2Aerror(26, fct, 1);				
    C2Afatal(30);					
    }
  double axx = A.getRe(0,0) - AisoVal;
  double ayy = A.getRe(1,1) - AisoVal;
  double azz = A.getRe(2,2) - AisoVal;
  double alpha;
  double dx, dy, dz;
  if(fabs(azz - PASDelzz) < DifCut)			
    {							
    dx = -0.5*PASDelzz*(1.0-EtaVal);			
    dy = -0.5*PASDelzz*(1.0+EtaVal);
    if(fabs(axx-dx)<DifCut && fabs(ayy-dy)<DifCut)
      { EA = EAngles(0,0,0); return true; }
    alpha = .5*acos((1./EtaVal)*(2.*axx/PASDelzz + 1.));
    dx = -0.5*PASDelzz*(1.0-EtaVal*cos(2.0*alpha));
    dy = -0.5*PASDelzz*(1.0+EtaVal*cos(2.0*alpha));
    if(fabs(axx-dx)<DifCut && fabs(ayy-dy)<DifCut)	
      { EA = EAngles(alpha,0,0); return true; }
    alpha = 0.5*acos((1.0/EtaVal)*(-2.0*axx/PASDelzz + 1.0));
    dx =- 0.5*PASDelzz*(1.0-EtaVal*cos(2.0*alpha));
    dy =- 0.5*PASDelzz*(1.0+EtaVal*cos(2.0*alpha));
    if(fabs(axx-dx)<DifCut && fabs(ayy-dy)<DifCut)
      { EA = EAngles(alpha,PI,0); return true; }
    dx = -0.5*PASDelzz*(1.0-EtaVal);			
    dy = -0.5*PASDelzz*(1.0+EtaVal);
    if(fabs(axx-dy)<DifCut && fabs(ayy-dx)<DifCut)	 3rd case
      { EA = EAngles(0,PI,PI/2.); return true; }	
cout << "\nTROUBLE CONVERTING ASYMMETRIC TENSOR WITH Azz = PAS delzz";
    }
  if(fabs(axx - PASDelzz) < DifCut)			
    {							 2nd case
    dy = -0.5*PASDelzz*(1.0+EtaVal); 			
    dz = -0.5*PASDelzz*(1.0-EtaVal);
    if(fabs(ayy-dy)<DifCut && fabs(azz-dz)<DifCut)
      { EA = EAngles(0,PI/2.0,0); return true; }
    if(fabs(azz - 0.5*PASDelzz*(EtaVal-1.0)) < DifCut)
      { EA = EAngles(0,PI/2.0,0); return true; }
    if(fabs(azz - 0.5*PASDelzz*(-EtaVal-1.0)) < DifCut)
      { EA = EAngles(0,PI/2.0,PI/2.0); return true; }
    double gamma = 0.5*acos((1.0/EtaVal)*(2.0*azz/PASDelzz + 1.0));
           dy = -0.25*PASDelzz*(3.0+EtaVal*cos(2.0*gamma) + cos(2.0*gamma) - 1);
           dz =  0.50*PASDelzz*(EtaVal*cos(2.0*gamma) - 1.0);
    if(fabs(ayy-dy)<DifCut && fabs(azz-dz)<DifCut)
      { EA = EAngles(0,PI/2.0,gamma); return true; }
cout << "\nTROUBLE CONVERTING ASYMMETRIC TENSOR WITH Axx = PAS delzz";
    }
  if(fabs(ayy - PASDelzz) < DifCut)			
    {
    dx = -0.5*PASDelzz*(1.0+EtaVal); 			
    dz = -0.5*PASDelzz*(1.0-EtaVal);
    if(fabs(axx-dx)<DifCut && fabs(azz-dz)<DifCut)
      { EA = EAngles(PI/2.0,PI/2.0,0.0); return true; }
    if(fabs(axx-dz)<DifCut && fabs(azz-dx)<DifCut)
      { EA = EAngles(PI/2.0,PI/2.0,PI/2.0); return true; }
cout << "\nTROUBLE CONVERTING ASYMMETRIC TENSOR WITH Ayy = PAS delzz";
    }
  TrackConv(16);					
  return false;
  }
bool CartMx2A :: DiagASymCartEA ( ) { string fct ( " " ) ; ConvMeth = 3 ; TrackConv ( ConvMeth ) ; if ( ! EtaVal ) { C2Aerror ( 27 , 1 ) ; C2Aerror ( 26 , fct , 1 ) ; C2Afatal ( 30 ) ; } if ( A . is_zero ( ) ) { C2Aerror ( 17 , 1 ) ; C2Aerror ( 26 , fct , 1 ) ; C2Afatal ( 30 ) ; } if ( ! PASDelzz ) { C2Aerror ( 18 , 1 ) ; C2Aerror ( 26 , fct , 1 ) ; C2Afatal ( 30 ) ; } if ( ! A . is_diagonal ( ) ) { C2Aerror ( 19 , 1 ) ; C2Aerror ( 26 , fct , 1 ) ; C2Afatal ( 30 ) ; } double axx = A . getRe ( 0 , 0 ) - AisoVal ; double ayy = A . getRe ( 1 , 1 ) - AisoVal ; double azz = A . getRe ( 2 , 2 ) - AisoVal ; double alpha ; double dx , dy , dz ; if ( fabs ( azz - PASDelzz ) < DifCut ) { dx = -0.5 * PASDelzz * ( 1.0 - EtaVal ) ; dy = -0.5 * PASDelzz * ( 1.0 + EtaVal ) ; if ( fabs ( axx - dx ) < DifCut && fabs ( ayy - dy ) < DifCut ) { EA = EAngles ( 0 , 0 , 0 ) ; return true ; } alpha = .5 * acos ( ( 1. / EtaVal ) * ( 2. * axx / PASDelzz + 1. ) ) ; dx = -0.5 * PASDelzz * ( 1.0 - EtaVal * cos ( 2.0 * alpha ) ) ; dy = -0.5 * PASDelzz * ( 1.0 + EtaVal * cos ( 2.0 * alpha ) ) ; if ( fabs ( axx - dx ) < DifCut && fabs ( ayy - dy ) < DifCut ) { EA = EAngles ( alpha , 0 , 0 ) ; return true ; } alpha = 0.5 * acos ( ( 1.0 / EtaVal ) * ( -2.0 * axx / PASDelzz + 1.0 ) ) ; dx = - 0.5 * PASDelzz * ( 1.0 - EtaVal * cos ( 2.0 * alpha ) ) ; dy = - 0.5 * PASDelzz * ( 1.0 + EtaVal * cos ( 2.0 * alpha ) ) ; if ( fabs ( axx - dx ) < DifCut && fabs ( ayy - dy ) < DifCut ) { EA = EAngles ( alpha , PI , 0 ) ; return true ; } dx = -0.5 * PASDelzz * ( 1.0 - EtaVal ) ; dy = -0.5 * PASDelzz * ( 1.0 + EtaVal ) ; if ( fabs ( axx - dy ) < DifCut && fabs ( ayy - dx ) < DifCut ) { EA = EAngles ( 0 , PI , PI / 2. ) ; return true ; } cout << " \n " ; } if ( fabs ( axx - PASDelzz ) < DifCut ) { dy = -0.5 * PASDelzz * ( 1.0 + EtaVal ) ; dz = -0.5 * PASDelzz * ( 1.0 - EtaVal ) ; if ( fabs ( ayy - dy ) < DifCut && fabs ( azz - dz ) < DifCut ) { EA = EAngles ( 0 , PI / 2.0 , 0 ) ; return true ; } if ( fabs ( azz - 0.5 * PASDelzz * ( EtaVal - 1.0 ) ) < DifCut ) { EA = EAngles ( 0 , PI / 2.0 , 0 ) ; return true ; } if ( fabs ( azz - 0.5 * PASDelzz * ( - EtaVal - 1.0 ) ) < DifCut ) { EA = EAngles ( 0 , PI / 2.0 , PI / 2.0 ) ; return true ; } double gamma = 0.5 * acos ( ( 1.0 / EtaVal ) * ( 2.0 * azz / PASDelzz + 1.0 ) ) ; dy = -0.25 * PASDelzz * ( 3.0 + EtaVal * cos ( 2.0 * gamma ) + cos ( 2.0 * gamma ) - 1 ) ; dz = 0.50 * PASDelzz * ( EtaVal * cos ( 2.0 * gamma ) - 1.0 ) ; if ( fabs ( ayy - dy ) < DifCut && fabs ( azz - dz ) < DifCut ) { EA = EAngles ( 0 , PI / 2.0 , gamma ) ; return true ; } cout << " \n " ; } if ( fabs ( ayy - PASDelzz ) < DifCut ) { dx = -0.5 * PASDelzz * ( 1.0 + EtaVal ) ; dz = -0.5 * PASDelzz * ( 1.0 - EtaVal ) ; if ( fabs ( axx - dx ) < DifCut && fabs ( azz - dz ) < DifCut ) { EA = EAngles ( PI / 2.0 , PI / 2.0 , 0.0 ) ; return true ; } if ( fabs ( axx - dz ) < DifCut && fabs ( azz - dx ) < DifCut ) { EA = EAngles ( PI / 2.0 , PI / 2.0 , PI / 2.0 ) ; return true ; } cout << " \n " ; } TrackConv ( 16 ) ; return false ; }
This function will assume that the irreducible Cartesian spatial tensor
array A (symmetric) has non-zero asymmetry but that it is diagonal.
This function will assume that the irreducible Cartesian spatial tensor array A ( symmetric ) has non - zero asymmetry but that it is diagonal .
// Our function name // Our conversion type // Track conv. process // Eta is zero // Bad function call // Cant get EA // Zero array // Cartesian array 0 // Bad function call // Cant get EA // Anisotropy 0 // Bad function call // Cant get EA // Array not diagonal // Non-diag. array // Bad function call // Cant get EA // if PASDelzz = azz // Look for true PAS // i.e. I: EA = {0,0,0} // Look for // iLook for // i.e. I: EA = {0,0,0} // Look for 3rd case // III: EA = {0,180,90} // If PASDelzz = axx // Look for 2nd case // II: EA = {0,90,0} // If PASDelzz = ayy // IV: EA = {90,90,0} // Track conv. process