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