| 1 |
/* |
| 2 |
* The MIT License |
| 3 |
|
| 4 |
Conograph (powder auto-indexing program) |
| 5 |
|
| 6 |
Copyright (c) <2012> <Ryoko Oishi-Tomiyasu, KEK> |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
of this software and associated documentation files (the "Software"), to deal |
| 10 |
in the Software without restriction, including without limitation the rights |
| 11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
copies of the Software, and to permit persons to whom the Software is |
| 13 |
furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice shall be included in |
| 16 |
all copies or substantial portions of the Software. |
| 17 |
|
| 18 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 |
THE SOFTWARE. |
| 25 |
* |
| 26 |
*/ |
| 27 |
#include "../utility_func/chToDouble.hh" |
| 28 |
#include "../utility_lattice_reduction/put_Minkowski_reduced_lattice.hh" |
| 29 |
#include "OutputInfo.hh" |
| 30 |
#include "ReducedLatticeToCheckBravais.hh" |
| 31 |
#include "LatticeFigureOfMeritToCheckSymmetry.hh" |
| 32 |
|
| 33 |
const string LatticeFigureOfMeritToCheckSymmetry::CS_LABEL[NUM_LS] = |
| 34 |
{ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14" }; |
| 35 |
|
| 36 |
LatticeFigureOfMeritToCheckSymmetry::LatticeFigureOfMeritToCheckSymmetry(const Double& rhs) |
| 37 |
: m_label(-1), m_latfom(rhs), |
| 38 |
m_S_red( SymMat43_VCData( SymMat<VCData>(3), NRMat<Int4>(4,3) ) ) |
| 39 |
{ |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
LatticeFigureOfMeritToCheckSymmetry::LatticeFigureOfMeritToCheckSymmetry(const BravaisType& brat, |
| 44 |
const SymMat43_VCData& S, |
| 45 |
const ePeakShiftFunctionType& type, |
| 46 |
const Double& wave_length, |
| 47 |
const vector<ZParawError>& peak_shift_param_rad) |
| 48 |
: m_label(-1), |
| 49 |
m_S_red( SymMat43_VCData( SymMat<VCData>(3), NRMat<Int4>(4,3) ) ) |
| 50 |
{ |
| 51 |
this->setLatticeConstants43(brat, S); |
| 52 |
m_latfom.setPeakShiftParamRadian(type, wave_length, peak_shift_param_rad); |
| 53 |
m_num_lattice_found = 0; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
#ifdef DEBUG |
| 58 |
static bool checkInitialLatticeParameters( |
| 59 |
const BravaisType& brat, |
| 60 |
const SymMat43_VCData& S_red) |
| 61 |
{ |
| 62 |
const SymMat<Double> dbl_S_red( chToDouble(S_red.first) ); |
| 63 |
|
| 64 |
if( brat.enumPointGroup() == Ci && brat.enumBravaisLattice() == Prim ) |
| 65 |
{ |
| 66 |
assert( dbl_S_red(2,2)*0.9999 < dbl_S_red(1,1) && dbl_S_red(1,1)*0.9999 < dbl_S_red(0,0) |
| 67 |
&& fabs( dbl_S_red(0,1) ) * 1.9999 < dbl_S_red(1,1) |
| 68 |
&& fabs( dbl_S_red(0,2) ) * 1.9999 < dbl_S_red(2,2) |
| 69 |
&& fabs( dbl_S_red(1,2) ) * 1.9999 < dbl_S_red(2,2) ); |
| 70 |
} |
| 71 |
else if( brat.enumPointGroup() == C2h_Y && brat.enumBravaisLattice() == Prim ) |
| 72 |
{ |
| 73 |
assert( 0.0 <= dbl_S_red(0,2) && dbl_S_red(2,2)*0.9999 < dbl_S_red(0,0) |
| 74 |
&& fabs( dbl_S_red(0,2) ) * 1.9999 < dbl_S_red(2,2) && fabs( dbl_S_red(0,2) ) * 1.9999 < dbl_S_red(0,0) ); |
| 75 |
} |
| 76 |
else if( brat.enumPointGroup() == C2h_Z && brat.enumBravaisLattice() == Prim ) |
| 77 |
{ |
| 78 |
assert( 0.0 <= dbl_S_red(0,1) && dbl_S_red(1,1)*0.9999 < dbl_S_red(0,0) |
| 79 |
&& fabs( dbl_S_red(0,1) ) * 1.9999 < dbl_S_red(0,0) && fabs( dbl_S_red(0,1) ) * 1.9999 < dbl_S_red(1,1) ); |
| 80 |
} |
| 81 |
else if( brat.enumPointGroup() == C2h_X && brat.enumBravaisLattice() == Prim ) |
| 82 |
{ |
| 83 |
assert( 0.0 <= dbl_S_red(1,2) && dbl_S_red(2,2)*0.9999 < dbl_S_red(1,1) |
| 84 |
&& fabs( dbl_S_red(1,2) ) * 1.9999 < dbl_S_red(1,1) && fabs( dbl_S_red(1,2) ) * 1.9999 < dbl_S_red(2,2) ); |
| 85 |
} |
| 86 |
else if( brat.enumPointGroup() == C2h_Y && brat.enumBravaisLattice() == BaseZ ) |
| 87 |
{ |
| 88 |
assert( 0.0 <= dbl_S_red(0,2) && fabs( dbl_S_red(0,2) ) * 1.9999 < dbl_S_red(2,2) && fabs( dbl_S_red(0,2) ) * 0.9999 < dbl_S_red(0,0) ); |
| 89 |
} |
| 90 |
else if( brat.enumPointGroup() == C2h_Z && brat.enumBravaisLattice() == BaseX ) |
| 91 |
{ |
| 92 |
assert( 0.0 <= dbl_S_red(0,1) && fabs( dbl_S_red(0,1) ) * 1.9999 < dbl_S_red(0,0) && fabs( dbl_S_red(0,1) ) * 0.9999 < dbl_S_red(1,1) ); |
| 93 |
} |
| 94 |
else if( brat.enumPointGroup() == C2h_X && brat.enumBravaisLattice() == BaseY ) |
| 95 |
{ |
| 96 |
assert( 0.0 <= dbl_S_red(1,2) && fabs( dbl_S_red(1,2) ) * 1.9999 < dbl_S_red(1,1) && fabs( dbl_S_red(1,2) ) * 0.9999 < dbl_S_red(2,2) ); |
| 97 |
} |
| 98 |
else if( brat.enumPointGroup() == D2h |
| 99 |
&& brat.enumBravaisLattice() != BaseX |
| 100 |
&& brat.enumBravaisLattice() != BaseY |
| 101 |
&& brat.enumBravaisLattice() != BaseZ ) |
| 102 |
{ |
| 103 |
assert( dbl_S_red(2,2)*0.9999 < dbl_S_red(1,1) && dbl_S_red(1,1)*0.9999 < dbl_S_red(0,0) ); |
| 104 |
} |
| 105 |
|
| 106 |
const SymMat<VCData> S_super = transform_sym_matrix(S_red.second, S_red.first); |
| 107 |
assert( S_super(0,1) <= VCData() |
| 108 |
&& S_super(0,2) <= VCData() |
| 109 |
&& S_super(0,3) <= VCData() |
| 110 |
&& S_super(1,2) <= VCData() |
| 111 |
&& S_super(1,3) <= VCData() |
| 112 |
&& S_super(2,3) <= VCData() ); |
| 113 |
|
| 114 |
SymMat<VCData> S_red_cp = S_red.first; |
| 115 |
cal_average_crystal_system(brat.enumPointGroup(), S_red_cp); |
| 116 |
assert( S_red.first(0,0).putVecCoef() == S_red_cp(0,0).putVecCoef() ); |
| 117 |
assert( S_red.first(1,1).putVecCoef() == S_red_cp(1,1).putVecCoef() ); |
| 118 |
assert( S_red.first(2,2).putVecCoef() == S_red_cp(2,2).putVecCoef() ); |
| 119 |
assert( S_red.first(0,1).putVecCoef() == S_red_cp(0,1).putVecCoef() ); |
| 120 |
assert( S_red.first(0,2).putVecCoef() == S_red_cp(0,2).putVecCoef() ); |
| 121 |
assert( S_red.first(1,2).putVecCoef() == S_red_cp(1,2).putVecCoef() ); |
| 122 |
|
| 123 |
return true; |
| 124 |
} |
| 125 |
#endif |
| 126 |
|
| 127 |
|
| 128 |
void LatticeFigureOfMeritToCheckSymmetry::setLatticeConstants43(const BravaisType& brat, const SymMat43_VCData& S) |
| 129 |
{ |
| 130 |
m_S_red = S; |
| 131 |
assert( checkInitialLatticeParameters(brat, m_S_red) ); |
| 132 |
|
| 133 |
m_latfom.setLatticeConstants43(brat, SymMat43_Double(chToDouble(m_S_red.first), m_S_red.second)); |
| 134 |
m_num_lattice_found = 0; |
| 135 |
// for(Int4 i=0; i<NUM_LS; i++) m_lattice_equiv[i].clear(); |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsMonoclinic(const ePointGroup& epg_new, |
| 142 |
const Double& cv2, |
| 143 |
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 144 |
{ |
| 145 |
ans.clear(); |
| 146 |
|
| 147 |
SymMat<VCData> ans0 = m_S_red.first; |
| 148 |
cal_average_crystal_system(C2h_X, ans0); |
| 149 |
|
| 150 |
SymMat<VCData> S_red(3); |
| 151 |
NRMat<Int4> trans_mat2; |
| 152 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 153 |
{ |
| 154 |
if( epg_new == C2h_X ) |
| 155 |
{ |
| 156 |
S_red = ans0; |
| 157 |
trans_mat2 = m_S_red.second; |
| 158 |
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 159 |
} |
| 160 |
else if( epg_new == C2h_Y ) |
| 161 |
{ |
| 162 |
S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
| 163 |
trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
| 164 |
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 165 |
} |
| 166 |
else // if( epg_new == C2h_Z ) |
| 167 |
{ |
| 168 |
S_red = transform_sym_matrix(put_matrix_YZX(), ans0); |
| 169 |
trans_mat2 = mprod(m_S_red.second, put_matrix_ZXY()); |
| 170 |
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 171 |
} |
| 172 |
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 173 |
} |
| 174 |
|
| 175 |
ans0 = m_S_red.first; |
| 176 |
cal_average_crystal_system(C2h_Y, ans0); |
| 177 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 178 |
{ |
| 179 |
if( epg_new == C2h_X ) |
| 180 |
{ |
| 181 |
S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
| 182 |
trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
| 183 |
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 184 |
} |
| 185 |
else if( epg_new == C2h_Y ) |
| 186 |
{ |
| 187 |
S_red = ans0; |
| 188 |
trans_mat2 = m_S_red.second; |
| 189 |
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 190 |
} |
| 191 |
else // if( epg_new == C2h_Z ) |
| 192 |
{ |
| 193 |
S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
| 194 |
trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
| 195 |
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 196 |
} |
| 197 |
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 198 |
} |
| 199 |
|
| 200 |
ans0 = m_S_red.first; |
| 201 |
cal_average_crystal_system(C2h_Z, ans0); |
| 202 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 203 |
{ |
| 204 |
if( epg_new == C2h_X ) |
| 205 |
{ |
| 206 |
S_red = transform_sym_matrix(put_matrix_ZXY(), ans0); |
| 207 |
trans_mat2 = mprod(m_S_red.second, put_matrix_YZX()); |
| 208 |
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 209 |
} |
| 210 |
else if( epg_new == C2h_Y ) |
| 211 |
{ |
| 212 |
S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
| 213 |
trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
| 214 |
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 215 |
} |
| 216 |
else // if( epg_new == C2h_Z ) |
| 217 |
{ |
| 218 |
S_red = ans0; |
| 219 |
trans_mat2 = m_S_red.second; |
| 220 |
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 221 |
} |
| 222 |
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 223 |
} |
| 224 |
|
| 225 |
return !( ans.empty() ); |
| 226 |
} |
| 227 |
|
| 228 |
|
| 229 |
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsOrthorhombic(const Double& cv2, |
| 230 |
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 231 |
{ |
| 232 |
ans.clear(); |
| 233 |
|
| 234 |
const BravaisType& brat = m_latfom.putBravaisType(); |
| 235 |
|
| 236 |
SymMat<VCData> ans0 = m_S_red.first; |
| 237 |
cal_average_crystal_system(D2h, ans0); |
| 238 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 239 |
{ |
| 240 |
if( brat.enumBravaisLattice() == BaseX ) |
| 241 |
{ |
| 242 |
if( ans0(1,1) < ans0(2,2) ) |
| 243 |
{ |
| 244 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_ZYX(), ans0), mprod( m_S_red.second, put_matrix_ZYX() ) ) ); |
| 245 |
} |
| 246 |
else |
| 247 |
{ |
| 248 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_YZX(), ans0), mprod( m_S_red.second, put_matrix_ZXY() ) ) ); |
| 249 |
} |
| 250 |
} |
| 251 |
else if( brat.enumBravaisLattice() == BaseY ) |
| 252 |
{ |
| 253 |
if( ans0(0,0) < ans0(2,2) ) |
| 254 |
{ |
| 255 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_ZXY(), ans0), mprod( m_S_red.second, put_matrix_YZX() ) ) ); |
| 256 |
} |
| 257 |
else |
| 258 |
{ |
| 259 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_XZY(), ans0), mprod( m_S_red.second, put_matrix_XZY() ) ) ); |
| 260 |
} |
| 261 |
} |
| 262 |
else if( brat.enumBravaisLattice() == BaseZ ) |
| 263 |
{ |
| 264 |
if( ans0(0,0) < ans0(1,1) ) |
| 265 |
{ |
| 266 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_YXZ(), ans0), mprod( m_S_red.second, put_matrix_YXZ() ) ) ); |
| 267 |
} |
| 268 |
else |
| 269 |
{ |
| 270 |
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_XYZ(), ans0), m_S_red.second ) ); |
| 271 |
} |
| 272 |
} |
| 273 |
else |
| 274 |
{ |
| 275 |
NRMat<Int4> trans_mat = m_S_red.second; |
| 276 |
putMinkowskiReducedOrthorhombic(brat.enumBravaisLattice(), ans0, trans_mat); |
| 277 |
ans.insert( SymMat43_VCData(ans0, trans_mat ) ); |
| 278 |
} |
| 279 |
return true; |
| 280 |
} |
| 281 |
return false; |
| 282 |
} |
| 283 |
|
| 284 |
|
| 285 |
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsTetragonal(const Double& cv2, |
| 286 |
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 287 |
{ |
| 288 |
ans.clear(); |
| 289 |
|
| 290 |
SymMat<VCData> ans0 = m_S_red.first; |
| 291 |
cal_average_crystal_system(D4h_X, ans0); |
| 292 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 293 |
{ |
| 294 |
ans.insert( SymMat43_VCData( |
| 295 |
transform_sym_matrix(put_matrix_YZX(), ans0), mprod( m_S_red.second, put_matrix_ZXY() ) ) ); |
| 296 |
} |
| 297 |
|
| 298 |
ans0 = m_S_red.first; |
| 299 |
cal_average_crystal_system(D4h_Y, ans0); |
| 300 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 301 |
{ |
| 302 |
ans.insert( SymMat43_VCData( |
| 303 |
transform_sym_matrix(put_matrix_XZY(), ans0), mprod( m_S_red.second, put_matrix_XZY() ) ) ); |
| 304 |
} |
| 305 |
|
| 306 |
ans0 = m_S_red.first; |
| 307 |
cal_average_crystal_system(D4h_Z, ans0); |
| 308 |
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 309 |
{ |
| 310 |
ans.insert( SymMat43_VCData(ans0, m_S_red.second ) ); |
| 311 |
} |
| 312 |
|
| 313 |
return !( ans.empty() ); |
| 314 |
} |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsHexagonal(const ePointGroup& epg_new, const Double& cv2, |
| 320 |
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 321 |
{ |
| 322 |
ans.clear(); |
| 323 |
const BravaisType& brat = m_latfom.putBravaisType(); |
| 324 |
|
| 325 |
SymMat43_VCData ans2(SymMat<VCData>(3), NRMat<Int4>(3,3)); |
| 326 |
|
| 327 |
if( brat.enumPointGroup() == C2h_X ) |
| 328 |
{ |
| 329 |
ans2.first = transform_sym_matrix(put_matrix_YZX(), m_S_red.first); |
| 330 |
ans2.second = mprod( m_S_red.second, put_matrix_ZXY() ); |
| 331 |
} |
| 332 |
else if( brat.enumPointGroup() == C2h_Y ) |
| 333 |
{ |
| 334 |
ans2.first = transform_sym_matrix(put_matrix_ZXY(), m_S_red.first); |
| 335 |
ans2.second = mprod( m_S_red.second, put_matrix_YZX() ); |
| 336 |
} |
| 337 |
else // if( brat.enumPointGroup() == C2h_Z ) |
| 338 |
{ |
| 339 |
ans2.first = transform_sym_matrix(put_matrix_XYZ(), m_S_red.first); |
| 340 |
ans2.second = m_S_red.second; |
| 341 |
} |
| 342 |
|
| 343 |
if( ans2.first(0,1) < VCData() ) |
| 344 |
{ |
| 345 |
ans2.first(0,1) *= -1; |
| 346 |
ans2.second[0][0] *= -1; |
| 347 |
ans2.second[1][0] *= -1; |
| 348 |
ans2.second[2][0] *= -1; |
| 349 |
} |
| 350 |
|
| 351 |
SymMat<VCData> ans0 = ans2.first; |
| 352 |
cal_average_crystal_system(epg_new, ans2.first); |
| 353 |
if( check_equiv_m(ans2.first, ans0, cv2 ) ) |
| 354 |
{ |
| 355 |
ans.insert( ans2 ); |
| 356 |
return true; |
| 357 |
} |
| 358 |
else return false; |
| 359 |
} |
| 360 |
|
| 361 |
|
| 362 |
bool LatticeFigureOfMeritToCheckSymmetry::checkLatticeSymmetry(const ePointGroup& epg_new, const Double& cv2, |
| 363 |
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 364 |
{ |
| 365 |
ans.clear(); |
| 366 |
const BravaisType& brat = m_latfom.putBravaisType(); |
| 367 |
if( epg_new == Ci || epg_new == brat.enumPointGroup() ) |
| 368 |
{ |
| 369 |
ans.insert( m_S_red ); |
| 370 |
return true; |
| 371 |
} |
| 372 |
|
| 373 |
if( epg_new == C2h_X || epg_new == C2h_Y || epg_new == C2h_Z ) |
| 374 |
{ |
| 375 |
assert( brat.enumPointGroup() == Ci ); |
| 376 |
assert( brat.enumBravaisLattice() == Prim ); |
| 377 |
|
| 378 |
return checkIfLatticeIsMonoclinic(epg_new, cv2, ans); |
| 379 |
} |
| 380 |
else if( epg_new == D4h_Z ) |
| 381 |
{ |
| 382 |
assert( brat.enumPointGroup() == D2h ); |
| 383 |
assert( brat.enumBravaisLattice() == Prim |
| 384 |
|| brat.enumBravaisLattice() == Inner ); |
| 385 |
|
| 386 |
return checkIfLatticeIsTetragonal(cv2, ans); |
| 387 |
} |
| 388 |
else if( epg_new == D2h ) |
| 389 |
{ |
| 390 |
assert( brat.enumPointGroup() != Ci || brat.enumBravaisLattice() == Prim ); |
| 391 |
assert( brat.enumPointGroup() != C2h_Z || brat.enumBravaisLattice() == BaseX ); |
| 392 |
assert( brat.enumPointGroup() != C2h_X || brat.enumBravaisLattice() == BaseY ); |
| 393 |
assert( brat.enumPointGroup() != C2h_Y || brat.enumBravaisLattice() == BaseZ ); |
| 394 |
assert( brat.enumBravaisLattice() != Rhom_hex ); |
| 395 |
|
| 396 |
return checkIfLatticeIsOrthorhombic(cv2, ans); |
| 397 |
} |
| 398 |
else if( epg_new == D6h ) |
| 399 |
{ |
| 400 |
assert( brat.enumBravaisLattice() == Prim ); |
| 401 |
assert( brat.enumPointGroup() == C2h_X |
| 402 |
|| brat.enumPointGroup() == C2h_Y |
| 403 |
|| brat.enumPointGroup() == C2h_Z ); |
| 404 |
return checkIfLatticeIsHexagonal(epg_new, cv2, ans); |
| 405 |
} |
| 406 |
else |
| 407 |
{ |
| 408 |
assert( epg_new == Oh ); |
| 409 |
assert( brat.enumBravaisLattice() == Prim |
| 410 |
|| brat.enumBravaisLattice() == Inner |
| 411 |
|| brat.enumBravaisLattice() == Face ); |
| 412 |
|
| 413 |
SymMat43_VCData ans2 = m_S_red; |
| 414 |
cal_average_crystal_system(epg_new, ans2.first); |
| 415 |
if( check_equiv_m(ans2.first, m_S_red.first, cv2 ) ) |
| 416 |
{ |
| 417 |
ans.insert( ans2 ); |
| 418 |
return true; |
| 419 |
} |
| 420 |
} |
| 421 |
return !(ans.empty()); |
| 422 |
} |
| 423 |
|
| 424 |
|
| 425 |
void LatticeFigureOfMeritToCheckSymmetry::putEquivalentLatticeConstantsDegreeWithOtherCentring( |
| 426 |
const eABCaxis& abc_axis, const eRHaxis& rh_axis, |
| 427 |
vector< pair< eCrystalSystem, SymMat<Double> > >& ans) const |
| 428 |
{ |
| 429 |
ans.clear(); |
| 430 |
|
| 431 |
static const Double EPS = 0.04; |
| 432 |
|
| 433 |
// Calculate figures of merit as triclinic |
| 434 |
const ReducedLatticeToCheckBravais RLCB(abc_axis, rh_axis, false, EPS, this->putInitialForm()); |
| 435 |
|
| 436 |
if( m_latfom.enumCrystalSystem() != Rhombohedral ) |
| 437 |
{ |
| 438 |
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Rhombohedral, abc_axis, rh_axis)); |
| 439 |
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 440 |
{ |
| 441 |
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Rhombohedral, chToDouble(it->first) ) ); |
| 442 |
} |
| 443 |
} |
| 444 |
if( m_latfom.enumBravaisLattice() != Face ) |
| 445 |
{ |
| 446 |
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Orthorhombic_F, abc_axis, rh_axis)); |
| 447 |
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 448 |
{ |
| 449 |
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Orthorhombic_F, chToDouble(it->first) ) ); |
| 450 |
} |
| 451 |
} |
| 452 |
if( m_latfom.enumBravaisLattice() != Inner ) |
| 453 |
{ |
| 454 |
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Orthorhombic_I, abc_axis, rh_axis)); |
| 455 |
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 456 |
{ |
| 457 |
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Orthorhombic_I, chToDouble(it->first) ) ); |
| 458 |
} |
| 459 |
} |
| 460 |
if( m_latfom.enumBravaisLattice() != BaseX && m_latfom.enumBravaisLattice() != BaseY && m_latfom.enumBravaisLattice() != BaseZ ) |
| 461 |
{ |
| 462 |
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Monoclinic_B, abc_axis, rh_axis)); |
| 463 |
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 464 |
{ |
| 465 |
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Monoclinic_B, chToDouble(it->first) ) ); |
| 466 |
} |
| 467 |
} |
| 468 |
|
| 469 |
NRMat<Int4> trans_mat; |
| 470 |
SymMat<Double> S_red(3); |
| 471 |
if( m_latfom.enumCrystalSystem() == Rhombohedral || m_latfom.enumBravaisLattice() != Prim ) |
| 472 |
{ |
| 473 |
const SymMat<Double> S_super = put_sym_matrix_size4to3(this->putInitialSellingReducedForm()); |
| 474 |
putTransformMatrixToMinkowskiReduced(Inverse3(S_super), trans_mat); |
| 475 |
transpose_square_matrix(trans_mat); |
| 476 |
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Triclinic, transform_sym_matrix(Inverse3(trans_mat), S_super) ) ); |
| 477 |
} |
| 478 |
} |
| 479 |
|
| 480 |
|
| 481 |
void LatticeFigureOfMeritToCheckSymmetry::putEquivalentLatticeConstantsDegreeWithOtherCentring( |
| 482 |
const eABCaxis& abc_axis, const eRHaxis& rh_axis, |
| 483 |
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >& ans) const |
| 484 |
{ |
| 485 |
vector< pair< eCrystalSystem, SymMat<Double> > > ans0; |
| 486 |
putEquivalentLatticeConstantsDegreeWithOtherCentring(abc_axis, rh_axis, ans0); |
| 487 |
|
| 488 |
ans.clear(); |
| 489 |
ans.resize( ans0.size() ); |
| 490 |
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >::iterator it2 = ans.begin(); |
| 491 |
for(vector< pair< eCrystalSystem, SymMat<Double> > >::const_iterator it=ans0.begin(); it<ans0.end(); it++, it2++) |
| 492 |
{ |
| 493 |
it2->first = it->first; |
| 494 |
LatticeFigureOfMerit::putLatticeConstantsDegree( BravaisType(it->first, abc_axis, rh_axis), it->second, abc_axis, rh_axis, it2->second.first, it2->second.second ); |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
void LatticeFigureOfMeritToCheckSymmetry::printLatticeInformation( |
| 500 |
const vector<LatticeFigureOfMeritToCheckSymmetry> lattice_result[], |
| 501 |
const OutputInfo outinfo[], |
| 502 |
const eABCaxis& abc_axis, |
| 503 |
const eRHaxis& rh_axis, |
| 504 |
const Int4& label_start0, |
| 505 |
ostream* os) const |
| 506 |
{ |
| 507 |
m_latfom.printLatticeInformation(abc_axis, rh_axis, label_start0, os); |
| 508 |
|
| 509 |
// const FracMat mat_sell_to_min = FInverse3( put_transform_matrix_row4to3( putLatticeFigureOfMerit().putOptimizedFormWithTransformMatrixToSellingReduced().second) ); |
| 510 |
// const SymMat<Double> dbl_S_init = transform_sym_matrix(mat_sell_to_min.mat, |
| 511 |
// put_sym_matrix_size4to3( this->putInitialSellingReducedForm() ) ) / (mat_sell_to_min.denom*mat_sell_to_min.denom); |
| 512 |
// const SymMat<Double>& dbl_S_init = this->putInitialSellingReducedForm(); |
| 513 |
|
| 514 |
// os->width(label_start); *os << ""; |
| 515 |
// *os << "<!-- A*, B*, C*, D*, E*, F*(angstrom^(-2)) first given by peak-positions.-->\n"; |
| 516 |
// os->width(label_start); *os << ""; |
| 517 |
// *os << "<InitialReciprocalLatticeParameters>"; |
| 518 |
// os->width(14); |
| 519 |
// *os << dbl_S_init(0,0); |
| 520 |
// os->width(14); |
| 521 |
// *os << dbl_S_init(1,1); |
| 522 |
// os->width(14); |
| 523 |
// *os << dbl_S_init(2,2); |
| 524 |
// os->width(14); |
| 525 |
// *os << dbl_S_init(1,2); |
| 526 |
// os->width(14); |
| 527 |
// *os << dbl_S_init(0,2); |
| 528 |
// os->width(14); |
| 529 |
// *os << dbl_S_init(0,1); |
| 530 |
// *os << " </InitialReciprocalLatticeParameters>\n"; |
| 531 |
|
| 532 |
Int4 label_start = label_start0; |
| 533 |
os->width(label_start); |
| 534 |
*os << "" << "<NumberOfLatticesInNeighborhood>"; |
| 535 |
os->width(14); |
| 536 |
*os << this->putNumberOfLatticesInNeighborhood(); |
| 537 |
*os << " </NumberOfLatticesInNeighborhood>\n\n"; |
| 538 |
|
| 539 |
os->width(label_start); |
| 540 |
*os << "" << "<EquivalentLatticeCandidates>\n"; |
| 541 |
label_start++; |
| 542 |
|
| 543 |
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > > lattice_equiv; |
| 544 |
this->putEquivalentLatticeConstantsDegreeWithOtherCentring(abc_axis, rh_axis, lattice_equiv); |
| 545 |
|
| 546 |
for(vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >::const_iterator it=lattice_equiv.begin(); it<lattice_equiv.end(); it++) |
| 547 |
{ |
| 548 |
os->width(label_start); *os << ""; |
| 549 |
*os << "<LatticeCandidate>\n"; |
| 550 |
label_start++; |
| 551 |
|
| 552 |
os->width(label_start); *os << ""; |
| 553 |
*os << "<CrystalSystem>"; |
| 554 |
os->width(17); |
| 555 |
*os << put_cs_name(it->first, abc_axis); |
| 556 |
*os << " </CrystalSystem>\n"; |
| 557 |
|
| 558 |
os->width(label_start); |
| 559 |
*os << "" << "<LatticeParameters>"; |
| 560 |
os->width(14); |
| 561 |
*os << it->second.first[0]; |
| 562 |
os->width(14); |
| 563 |
*os << it->second.first[1]; |
| 564 |
os->width(14); |
| 565 |
*os << it->second.first[2]; |
| 566 |
os->width(14); |
| 567 |
*os << it->second.second[0]; |
| 568 |
os->width(14); |
| 569 |
*os << it->second.second[1]; |
| 570 |
os->width(14); |
| 571 |
*os << it->second.second[2]; |
| 572 |
*os << " </LatticeParameters>\n"; |
| 573 |
|
| 574 |
label_start--; |
| 575 |
os->width(label_start); *os << ""; |
| 576 |
*os << "</LatticeCandidate>\n"; |
| 577 |
} |
| 578 |
|
| 579 |
label_start--; |
| 580 |
os->width(label_start); *os << ""; |
| 581 |
*os << "</EquivalentLatticeCandidates>\n\n"; |
| 582 |
} |