| 146 | 
  | 
 | 
| 147 | 
  | 
void SimInfo::calcHmatInv( void ) { | 
| 148 | 
  | 
   | 
| 149 | 
+ | 
  int oldOrtho; | 
| 150 | 
  | 
  int i,j; | 
| 151 | 
  | 
  double smallDiag; | 
| 152 | 
  | 
  double tol; | 
| 154 | 
  | 
 | 
| 155 | 
  | 
  invertMat3( Hmat, HmatInv ); | 
| 156 | 
  | 
 | 
| 156 | 
– | 
  // Check the inverse to make sure it is sane: | 
| 157 | 
– | 
 | 
| 158 | 
– | 
  matMul3( Hmat, HmatInv, sanity ); | 
| 159 | 
– | 
     | 
| 157 | 
  | 
  // check to see if Hmat is orthorhombic | 
| 158 | 
  | 
   | 
| 159 | 
< | 
  smallDiag = Hmat[0][0]; | 
| 160 | 
< | 
  if(smallDiag > Hmat[1][1]) smallDiag = Hmat[1][1]; | 
| 161 | 
< | 
  if(smallDiag > Hmat[2][2]) smallDiag = Hmat[2][2]; | 
| 159 | 
> | 
  oldOrtho = orthoRhombic; | 
| 160 | 
> | 
 | 
| 161 | 
> | 
  smallDiag = fabs(Hmat[0][0]); | 
| 162 | 
> | 
  if(smallDiag > fabs(Hmat[1][1])) smallDiag = fabs(Hmat[1][1]); | 
| 163 | 
> | 
  if(smallDiag > fabs(Hmat[2][2])) smallDiag = fabs(Hmat[2][2]); | 
| 164 | 
  | 
  tol = smallDiag * 1E-6; | 
| 165 | 
  | 
 | 
| 166 | 
  | 
  orthoRhombic = 1; | 
| 169 | 
  | 
    for (j = 0 ; j < 3; j++) { | 
| 170 | 
  | 
      if (i != j) { | 
| 171 | 
  | 
        if (orthoRhombic) { | 
| 172 | 
< | 
          if (Hmat[i][j] >= tol) orthoRhombic = 0; | 
| 172 | 
> | 
          if ( fabs(Hmat[i][j]) >= tol) orthoRhombic = 0; | 
| 173 | 
  | 
        }         | 
| 174 | 
  | 
      } | 
| 175 | 
  | 
    } | 
| 176 | 
  | 
  } | 
| 177 | 
+ | 
 | 
| 178 | 
+ | 
  if( oldOrtho != orthoRhombic ){ | 
| 179 | 
+ | 
     | 
| 180 | 
+ | 
    if( orthoRhombic ){ | 
| 181 | 
+ | 
      sprintf( painCave.errMsg, | 
| 182 | 
+ | 
               "Hmat is switching from Non-Orthorhombic to OrthoRhombic\n" | 
| 183 | 
+ | 
               "       If this is a bad thing change the ortho tolerance in SimInfo.\n" ); | 
| 184 | 
+ | 
      simError(); | 
| 185 | 
+ | 
    } | 
| 186 | 
+ | 
    else { | 
| 187 | 
+ | 
      sprintf( painCave.errMsg, | 
| 188 | 
+ | 
               "Hmat is switching from Orthorhombic to Non-OrthoRhombic\n" | 
| 189 | 
+ | 
               "       If this is a bad thing change the ortho tolerance in SimInfo.\n" ); | 
| 190 | 
+ | 
      simError(); | 
| 191 | 
+ | 
    } | 
| 192 | 
+ | 
  } | 
| 193 | 
  | 
} | 
| 194 | 
  | 
 | 
| 195 | 
  | 
double SimInfo::matDet3(double a[3][3]) { |