| 1 |
rtomiyasu |
3 |
/* |
| 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 |
rtomiyasu |
16 |
// default c'tor for GUI |
| 37 |
|
|
LatticeFigureOfMeritToCheckSymmetry::LatticeFigureOfMeritToCheckSymmetry() |
| 38 |
|
|
: m_label(-1), |
| 39 |
|
|
m_S_red( SymMat43_VCData( SymMat<VCData>(3), NRMat<Int4>(4,3) ) ) |
| 40 |
|
|
{ |
| 41 |
|
|
m_num_lattice_found = 0; |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
|
| 45 |
rtomiyasu |
3 |
LatticeFigureOfMeritToCheckSymmetry::LatticeFigureOfMeritToCheckSymmetry(const Double& rhs) |
| 46 |
|
|
: m_label(-1), m_latfom(rhs), |
| 47 |
|
|
m_S_red( SymMat43_VCData( SymMat<VCData>(3), NRMat<Int4>(4,3) ) ) |
| 48 |
|
|
{ |
| 49 |
|
|
} |
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
LatticeFigureOfMeritToCheckSymmetry::LatticeFigureOfMeritToCheckSymmetry(const BravaisType& brat, |
| 53 |
|
|
const SymMat43_VCData& S, |
| 54 |
|
|
const ePeakShiftFunctionType& type, |
| 55 |
|
|
const Double& wave_length, |
| 56 |
|
|
const vector<ZParawError>& peak_shift_param_rad) |
| 57 |
|
|
: m_label(-1), |
| 58 |
|
|
m_S_red( SymMat43_VCData( SymMat<VCData>(3), NRMat<Int4>(4,3) ) ) |
| 59 |
|
|
{ |
| 60 |
|
|
this->setLatticeConstants43(brat, S); |
| 61 |
|
|
m_latfom.setPeakShiftParamRadian(type, wave_length, peak_shift_param_rad); |
| 62 |
|
|
m_num_lattice_found = 0; |
| 63 |
|
|
} |
| 64 |
|
|
|
| 65 |
|
|
|
| 66 |
|
|
#ifdef DEBUG |
| 67 |
|
|
static bool checkInitialLatticeParameters( |
| 68 |
|
|
const BravaisType& brat, |
| 69 |
|
|
const SymMat43_VCData& S_red) |
| 70 |
|
|
{ |
| 71 |
|
|
const SymMat<Double> dbl_S_red( chToDouble(S_red.first) ); |
| 72 |
|
|
|
| 73 |
|
|
if( brat.enumPointGroup() == Ci && brat.enumBravaisLattice() == Prim ) |
| 74 |
|
|
{ |
| 75 |
|
|
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) |
| 76 |
|
|
&& fabs( dbl_S_red(0,1) ) * 1.9999 < dbl_S_red(1,1) |
| 77 |
|
|
&& fabs( dbl_S_red(0,2) ) * 1.9999 < dbl_S_red(2,2) |
| 78 |
|
|
&& fabs( dbl_S_red(1,2) ) * 1.9999 < dbl_S_red(2,2) ); |
| 79 |
|
|
} |
| 80 |
|
|
else if( brat.enumPointGroup() == C2h_Y && brat.enumBravaisLattice() == Prim ) |
| 81 |
|
|
{ |
| 82 |
|
|
assert( 0.0 <= dbl_S_red(0,2) && dbl_S_red(2,2)*0.9999 < dbl_S_red(0,0) |
| 83 |
|
|
&& 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) ); |
| 84 |
|
|
} |
| 85 |
|
|
else if( brat.enumPointGroup() == C2h_Z && brat.enumBravaisLattice() == Prim ) |
| 86 |
|
|
{ |
| 87 |
|
|
assert( 0.0 <= dbl_S_red(0,1) && dbl_S_red(1,1)*0.9999 < dbl_S_red(0,0) |
| 88 |
|
|
&& 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) ); |
| 89 |
|
|
} |
| 90 |
|
|
else if( brat.enumPointGroup() == C2h_X && brat.enumBravaisLattice() == Prim ) |
| 91 |
|
|
{ |
| 92 |
|
|
assert( 0.0 <= dbl_S_red(1,2) && dbl_S_red(2,2)*0.9999 < dbl_S_red(1,1) |
| 93 |
|
|
&& 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) ); |
| 94 |
|
|
} |
| 95 |
|
|
else if( brat.enumPointGroup() == C2h_Y && brat.enumBravaisLattice() == BaseZ ) |
| 96 |
|
|
{ |
| 97 |
|
|
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) ); |
| 98 |
|
|
} |
| 99 |
|
|
else if( brat.enumPointGroup() == C2h_Z && brat.enumBravaisLattice() == BaseX ) |
| 100 |
|
|
{ |
| 101 |
|
|
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) ); |
| 102 |
|
|
} |
| 103 |
|
|
else if( brat.enumPointGroup() == C2h_X && brat.enumBravaisLattice() == BaseY ) |
| 104 |
|
|
{ |
| 105 |
|
|
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) ); |
| 106 |
|
|
} |
| 107 |
|
|
else if( brat.enumPointGroup() == D2h |
| 108 |
|
|
&& brat.enumBravaisLattice() != BaseX |
| 109 |
|
|
&& brat.enumBravaisLattice() != BaseY |
| 110 |
|
|
&& brat.enumBravaisLattice() != BaseZ ) |
| 111 |
|
|
{ |
| 112 |
|
|
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) ); |
| 113 |
|
|
} |
| 114 |
|
|
|
| 115 |
|
|
const SymMat<VCData> S_super = transform_sym_matrix(S_red.second, S_red.first); |
| 116 |
|
|
assert( S_super(0,1) <= VCData() |
| 117 |
|
|
&& S_super(0,2) <= VCData() |
| 118 |
|
|
&& S_super(0,3) <= VCData() |
| 119 |
|
|
&& S_super(1,2) <= VCData() |
| 120 |
|
|
&& S_super(1,3) <= VCData() |
| 121 |
|
|
&& S_super(2,3) <= VCData() ); |
| 122 |
|
|
|
| 123 |
|
|
SymMat<VCData> S_red_cp = S_red.first; |
| 124 |
|
|
cal_average_crystal_system(brat.enumPointGroup(), S_red_cp); |
| 125 |
|
|
assert( S_red.first(0,0).putVecCoef() == S_red_cp(0,0).putVecCoef() ); |
| 126 |
|
|
assert( S_red.first(1,1).putVecCoef() == S_red_cp(1,1).putVecCoef() ); |
| 127 |
|
|
assert( S_red.first(2,2).putVecCoef() == S_red_cp(2,2).putVecCoef() ); |
| 128 |
|
|
assert( S_red.first(0,1).putVecCoef() == S_red_cp(0,1).putVecCoef() ); |
| 129 |
|
|
assert( S_red.first(0,2).putVecCoef() == S_red_cp(0,2).putVecCoef() ); |
| 130 |
|
|
assert( S_red.first(1,2).putVecCoef() == S_red_cp(1,2).putVecCoef() ); |
| 131 |
|
|
|
| 132 |
|
|
return true; |
| 133 |
|
|
} |
| 134 |
|
|
#endif |
| 135 |
|
|
|
| 136 |
|
|
|
| 137 |
|
|
void LatticeFigureOfMeritToCheckSymmetry::setLatticeConstants43(const BravaisType& brat, const SymMat43_VCData& S) |
| 138 |
|
|
{ |
| 139 |
|
|
m_S_red = S; |
| 140 |
|
|
assert( checkInitialLatticeParameters(brat, m_S_red) ); |
| 141 |
|
|
|
| 142 |
|
|
m_latfom.setLatticeConstants43(brat, SymMat43_Double(chToDouble(m_S_red.first), m_S_red.second)); |
| 143 |
|
|
m_num_lattice_found = 0; |
| 144 |
|
|
// for(Int4 i=0; i<NUM_LS; i++) m_lattice_equiv[i].clear(); |
| 145 |
|
|
} |
| 146 |
|
|
|
| 147 |
|
|
|
| 148 |
|
|
|
| 149 |
|
|
|
| 150 |
|
|
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsMonoclinic(const ePointGroup& epg_new, |
| 151 |
|
|
const Double& cv2, |
| 152 |
|
|
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 153 |
|
|
{ |
| 154 |
|
|
ans.clear(); |
| 155 |
|
|
|
| 156 |
|
|
SymMat<VCData> ans0 = m_S_red.first; |
| 157 |
|
|
cal_average_crystal_system(C2h_X, ans0); |
| 158 |
|
|
|
| 159 |
|
|
SymMat<VCData> S_red(3); |
| 160 |
|
|
NRMat<Int4> trans_mat2; |
| 161 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 162 |
|
|
{ |
| 163 |
|
|
if( epg_new == C2h_X ) |
| 164 |
|
|
{ |
| 165 |
|
|
S_red = ans0; |
| 166 |
|
|
trans_mat2 = m_S_red.second; |
| 167 |
|
|
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 168 |
|
|
} |
| 169 |
|
|
else if( epg_new == C2h_Y ) |
| 170 |
|
|
{ |
| 171 |
|
|
S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
| 172 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
| 173 |
|
|
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 174 |
|
|
} |
| 175 |
|
|
else // if( epg_new == C2h_Z ) |
| 176 |
|
|
{ |
| 177 |
|
|
S_red = transform_sym_matrix(put_matrix_YZX(), ans0); |
| 178 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_ZXY()); |
| 179 |
|
|
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 180 |
|
|
} |
| 181 |
|
|
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 182 |
|
|
} |
| 183 |
|
|
|
| 184 |
|
|
ans0 = m_S_red.first; |
| 185 |
|
|
cal_average_crystal_system(C2h_Y, ans0); |
| 186 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 187 |
|
|
{ |
| 188 |
|
|
if( epg_new == C2h_X ) |
| 189 |
|
|
{ |
| 190 |
|
|
S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
| 191 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
| 192 |
|
|
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 193 |
|
|
} |
| 194 |
|
|
else if( epg_new == C2h_Y ) |
| 195 |
|
|
{ |
| 196 |
|
|
S_red = ans0; |
| 197 |
|
|
trans_mat2 = m_S_red.second; |
| 198 |
|
|
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 199 |
|
|
} |
| 200 |
|
|
else // if( epg_new == C2h_Z ) |
| 201 |
|
|
{ |
| 202 |
|
|
S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
| 203 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
| 204 |
|
|
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 205 |
|
|
} |
| 206 |
|
|
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 207 |
|
|
} |
| 208 |
|
|
|
| 209 |
|
|
ans0 = m_S_red.first; |
| 210 |
|
|
cal_average_crystal_system(C2h_Z, ans0); |
| 211 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 212 |
|
|
{ |
| 213 |
|
|
if( epg_new == C2h_X ) |
| 214 |
|
|
{ |
| 215 |
|
|
S_red = transform_sym_matrix(put_matrix_ZXY(), ans0); |
| 216 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_YZX()); |
| 217 |
|
|
putMinkowskiReducedMonoclinicP(1, 2, S_red, trans_mat2); |
| 218 |
|
|
} |
| 219 |
|
|
else if( epg_new == C2h_Y ) |
| 220 |
|
|
{ |
| 221 |
|
|
S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
| 222 |
|
|
trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
| 223 |
|
|
putMinkowskiReducedMonoclinicP(0, 2, S_red, trans_mat2); |
| 224 |
|
|
} |
| 225 |
|
|
else // if( epg_new == C2h_Z ) |
| 226 |
|
|
{ |
| 227 |
|
|
S_red = ans0; |
| 228 |
|
|
trans_mat2 = m_S_red.second; |
| 229 |
|
|
putMinkowskiReducedMonoclinicP(0, 1, S_red, trans_mat2); |
| 230 |
|
|
} |
| 231 |
|
|
ans.insert( SymMat43_VCData( S_red, trans_mat2) ); |
| 232 |
|
|
} |
| 233 |
|
|
|
| 234 |
|
|
return !( ans.empty() ); |
| 235 |
|
|
} |
| 236 |
|
|
|
| 237 |
|
|
|
| 238 |
|
|
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsOrthorhombic(const Double& cv2, |
| 239 |
|
|
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 240 |
|
|
{ |
| 241 |
|
|
ans.clear(); |
| 242 |
|
|
|
| 243 |
|
|
const BravaisType& brat = m_latfom.putBravaisType(); |
| 244 |
|
|
|
| 245 |
|
|
SymMat<VCData> ans0 = m_S_red.first; |
| 246 |
|
|
cal_average_crystal_system(D2h, ans0); |
| 247 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 248 |
|
|
{ |
| 249 |
|
|
if( brat.enumBravaisLattice() == BaseX ) |
| 250 |
|
|
{ |
| 251 |
|
|
if( ans0(1,1) < ans0(2,2) ) |
| 252 |
|
|
{ |
| 253 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_ZYX(), ans0), mprod( m_S_red.second, put_matrix_ZYX() ) ) ); |
| 254 |
|
|
} |
| 255 |
|
|
else |
| 256 |
|
|
{ |
| 257 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_YZX(), ans0), mprod( m_S_red.second, put_matrix_ZXY() ) ) ); |
| 258 |
|
|
} |
| 259 |
|
|
} |
| 260 |
|
|
else if( brat.enumBravaisLattice() == BaseY ) |
| 261 |
|
|
{ |
| 262 |
|
|
if( ans0(0,0) < ans0(2,2) ) |
| 263 |
|
|
{ |
| 264 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_ZXY(), ans0), mprod( m_S_red.second, put_matrix_YZX() ) ) ); |
| 265 |
|
|
} |
| 266 |
|
|
else |
| 267 |
|
|
{ |
| 268 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_XZY(), ans0), mprod( m_S_red.second, put_matrix_XZY() ) ) ); |
| 269 |
|
|
} |
| 270 |
|
|
} |
| 271 |
|
|
else if( brat.enumBravaisLattice() == BaseZ ) |
| 272 |
|
|
{ |
| 273 |
|
|
if( ans0(0,0) < ans0(1,1) ) |
| 274 |
|
|
{ |
| 275 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_YXZ(), ans0), mprod( m_S_red.second, put_matrix_YXZ() ) ) ); |
| 276 |
|
|
} |
| 277 |
|
|
else |
| 278 |
|
|
{ |
| 279 |
|
|
ans.insert( SymMat43_VCData( transform_sym_matrix(put_matrix_XYZ(), ans0), m_S_red.second ) ); |
| 280 |
|
|
} |
| 281 |
|
|
} |
| 282 |
|
|
else |
| 283 |
|
|
{ |
| 284 |
|
|
NRMat<Int4> trans_mat = m_S_red.second; |
| 285 |
|
|
putMinkowskiReducedOrthorhombic(brat.enumBravaisLattice(), ans0, trans_mat); |
| 286 |
|
|
ans.insert( SymMat43_VCData(ans0, trans_mat ) ); |
| 287 |
|
|
} |
| 288 |
|
|
return true; |
| 289 |
|
|
} |
| 290 |
|
|
return false; |
| 291 |
|
|
} |
| 292 |
|
|
|
| 293 |
|
|
|
| 294 |
|
|
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsTetragonal(const Double& cv2, |
| 295 |
|
|
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 296 |
|
|
{ |
| 297 |
|
|
ans.clear(); |
| 298 |
|
|
|
| 299 |
|
|
SymMat<VCData> ans0 = m_S_red.first; |
| 300 |
|
|
cal_average_crystal_system(D4h_X, ans0); |
| 301 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 302 |
|
|
{ |
| 303 |
|
|
ans.insert( SymMat43_VCData( |
| 304 |
|
|
transform_sym_matrix(put_matrix_YZX(), ans0), mprod( m_S_red.second, put_matrix_ZXY() ) ) ); |
| 305 |
|
|
} |
| 306 |
|
|
|
| 307 |
|
|
ans0 = m_S_red.first; |
| 308 |
|
|
cal_average_crystal_system(D4h_Y, ans0); |
| 309 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 310 |
|
|
{ |
| 311 |
|
|
ans.insert( SymMat43_VCData( |
| 312 |
|
|
transform_sym_matrix(put_matrix_XZY(), ans0), mprod( m_S_red.second, put_matrix_XZY() ) ) ); |
| 313 |
|
|
} |
| 314 |
|
|
|
| 315 |
|
|
ans0 = m_S_red.first; |
| 316 |
|
|
cal_average_crystal_system(D4h_Z, ans0); |
| 317 |
|
|
if( check_equiv_m(ans0, m_S_red.first, cv2 ) ) |
| 318 |
|
|
{ |
| 319 |
|
|
ans.insert( SymMat43_VCData(ans0, m_S_red.second ) ); |
| 320 |
|
|
} |
| 321 |
|
|
|
| 322 |
|
|
return !( ans.empty() ); |
| 323 |
|
|
} |
| 324 |
|
|
|
| 325 |
|
|
|
| 326 |
|
|
|
| 327 |
|
|
|
| 328 |
|
|
bool LatticeFigureOfMeritToCheckSymmetry::checkIfLatticeIsHexagonal(const ePointGroup& epg_new, const Double& cv2, |
| 329 |
|
|
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 330 |
|
|
{ |
| 331 |
|
|
ans.clear(); |
| 332 |
|
|
const BravaisType& brat = m_latfom.putBravaisType(); |
| 333 |
|
|
|
| 334 |
|
|
SymMat43_VCData ans2(SymMat<VCData>(3), NRMat<Int4>(3,3)); |
| 335 |
|
|
|
| 336 |
|
|
if( brat.enumPointGroup() == C2h_X ) |
| 337 |
|
|
{ |
| 338 |
|
|
ans2.first = transform_sym_matrix(put_matrix_YZX(), m_S_red.first); |
| 339 |
|
|
ans2.second = mprod( m_S_red.second, put_matrix_ZXY() ); |
| 340 |
|
|
} |
| 341 |
|
|
else if( brat.enumPointGroup() == C2h_Y ) |
| 342 |
|
|
{ |
| 343 |
|
|
ans2.first = transform_sym_matrix(put_matrix_ZXY(), m_S_red.first); |
| 344 |
|
|
ans2.second = mprod( m_S_red.second, put_matrix_YZX() ); |
| 345 |
|
|
} |
| 346 |
|
|
else // if( brat.enumPointGroup() == C2h_Z ) |
| 347 |
|
|
{ |
| 348 |
|
|
ans2.first = transform_sym_matrix(put_matrix_XYZ(), m_S_red.first); |
| 349 |
|
|
ans2.second = m_S_red.second; |
| 350 |
|
|
} |
| 351 |
|
|
|
| 352 |
|
|
if( ans2.first(0,1) < VCData() ) |
| 353 |
|
|
{ |
| 354 |
|
|
ans2.first(0,1) *= -1; |
| 355 |
|
|
ans2.second[0][0] *= -1; |
| 356 |
|
|
ans2.second[1][0] *= -1; |
| 357 |
|
|
ans2.second[2][0] *= -1; |
| 358 |
|
|
} |
| 359 |
|
|
|
| 360 |
|
|
SymMat<VCData> ans0 = ans2.first; |
| 361 |
|
|
cal_average_crystal_system(epg_new, ans2.first); |
| 362 |
|
|
if( check_equiv_m(ans2.first, ans0, cv2 ) ) |
| 363 |
|
|
{ |
| 364 |
|
|
ans.insert( ans2 ); |
| 365 |
|
|
return true; |
| 366 |
|
|
} |
| 367 |
|
|
else return false; |
| 368 |
|
|
} |
| 369 |
|
|
|
| 370 |
|
|
|
| 371 |
|
|
bool LatticeFigureOfMeritToCheckSymmetry::checkLatticeSymmetry(const ePointGroup& epg_new, const Double& cv2, |
| 372 |
|
|
map< SymMat<VCData>, NRMat<Int4> >& ans) const |
| 373 |
|
|
{ |
| 374 |
|
|
ans.clear(); |
| 375 |
|
|
const BravaisType& brat = m_latfom.putBravaisType(); |
| 376 |
|
|
if( epg_new == Ci || epg_new == brat.enumPointGroup() ) |
| 377 |
|
|
{ |
| 378 |
|
|
ans.insert( m_S_red ); |
| 379 |
|
|
return true; |
| 380 |
|
|
} |
| 381 |
|
|
|
| 382 |
|
|
if( epg_new == C2h_X || epg_new == C2h_Y || epg_new == C2h_Z ) |
| 383 |
|
|
{ |
| 384 |
|
|
assert( brat.enumPointGroup() == Ci ); |
| 385 |
|
|
assert( brat.enumBravaisLattice() == Prim ); |
| 386 |
|
|
|
| 387 |
|
|
return checkIfLatticeIsMonoclinic(epg_new, cv2, ans); |
| 388 |
|
|
} |
| 389 |
|
|
else if( epg_new == D4h_Z ) |
| 390 |
|
|
{ |
| 391 |
|
|
assert( brat.enumPointGroup() == D2h ); |
| 392 |
|
|
assert( brat.enumBravaisLattice() == Prim |
| 393 |
|
|
|| brat.enumBravaisLattice() == Inner ); |
| 394 |
|
|
|
| 395 |
|
|
return checkIfLatticeIsTetragonal(cv2, ans); |
| 396 |
|
|
} |
| 397 |
|
|
else if( epg_new == D2h ) |
| 398 |
|
|
{ |
| 399 |
|
|
assert( brat.enumPointGroup() != Ci || brat.enumBravaisLattice() == Prim ); |
| 400 |
|
|
assert( brat.enumPointGroup() != C2h_Z || brat.enumBravaisLattice() == BaseX ); |
| 401 |
|
|
assert( brat.enumPointGroup() != C2h_X || brat.enumBravaisLattice() == BaseY ); |
| 402 |
|
|
assert( brat.enumPointGroup() != C2h_Y || brat.enumBravaisLattice() == BaseZ ); |
| 403 |
|
|
assert( brat.enumBravaisLattice() != Rhom_hex ); |
| 404 |
|
|
|
| 405 |
|
|
return checkIfLatticeIsOrthorhombic(cv2, ans); |
| 406 |
|
|
} |
| 407 |
|
|
else if( epg_new == D6h ) |
| 408 |
|
|
{ |
| 409 |
|
|
assert( brat.enumBravaisLattice() == Prim ); |
| 410 |
|
|
assert( brat.enumPointGroup() == C2h_X |
| 411 |
|
|
|| brat.enumPointGroup() == C2h_Y |
| 412 |
|
|
|| brat.enumPointGroup() == C2h_Z ); |
| 413 |
|
|
return checkIfLatticeIsHexagonal(epg_new, cv2, ans); |
| 414 |
|
|
} |
| 415 |
|
|
else |
| 416 |
|
|
{ |
| 417 |
|
|
assert( epg_new == Oh ); |
| 418 |
|
|
assert( brat.enumBravaisLattice() == Prim |
| 419 |
|
|
|| brat.enumBravaisLattice() == Inner |
| 420 |
|
|
|| brat.enumBravaisLattice() == Face ); |
| 421 |
|
|
|
| 422 |
|
|
SymMat43_VCData ans2 = m_S_red; |
| 423 |
|
|
cal_average_crystal_system(epg_new, ans2.first); |
| 424 |
|
|
if( check_equiv_m(ans2.first, m_S_red.first, cv2 ) ) |
| 425 |
|
|
{ |
| 426 |
|
|
ans.insert( ans2 ); |
| 427 |
|
|
return true; |
| 428 |
|
|
} |
| 429 |
|
|
} |
| 430 |
|
|
return !(ans.empty()); |
| 431 |
|
|
} |
| 432 |
|
|
|
| 433 |
|
|
|
| 434 |
|
|
void LatticeFigureOfMeritToCheckSymmetry::putEquivalentLatticeConstantsDegreeWithOtherCentring( |
| 435 |
|
|
const eABCaxis& abc_axis, const eRHaxis& rh_axis, |
| 436 |
|
|
vector< pair< eCrystalSystem, SymMat<Double> > >& ans) const |
| 437 |
|
|
{ |
| 438 |
|
|
ans.clear(); |
| 439 |
|
|
|
| 440 |
rtomiyasu |
12 |
static const Double cv2 = 0.04; |
| 441 |
|
|
static const Double resol2 = 0.06; |
| 442 |
rtomiyasu |
3 |
|
| 443 |
|
|
// Calculate figures of merit as triclinic |
| 444 |
rtomiyasu |
12 |
const ReducedLatticeToCheckBravais RLCB(abc_axis, rh_axis, false, cv2, this->putInitialForm()); |
| 445 |
|
|
const SymMat<Double> S_obtuse = this->putInitialSellingReducedForm(); |
| 446 |
rtomiyasu |
3 |
|
| 447 |
|
|
if( m_latfom.enumCrystalSystem() != Rhombohedral ) |
| 448 |
|
|
{ |
| 449 |
|
|
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Rhombohedral, abc_axis, rh_axis)); |
| 450 |
|
|
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 451 |
|
|
{ |
| 452 |
rtomiyasu |
12 |
const SymMat<Double> S_red = chToDouble(it->first); |
| 453 |
|
|
if( !check_equiv_s(S_obtuse, transform_sym_matrix(it->second, S_red), resol2) ) continue; |
| 454 |
|
|
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Rhombohedral, S_red) ); |
| 455 |
rtomiyasu |
3 |
} |
| 456 |
|
|
} |
| 457 |
|
|
if( m_latfom.enumBravaisLattice() != Face ) |
| 458 |
|
|
{ |
| 459 |
|
|
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Orthorhombic_F, abc_axis, rh_axis)); |
| 460 |
|
|
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 461 |
|
|
{ |
| 462 |
rtomiyasu |
12 |
const SymMat<Double> S_red = chToDouble(it->first); |
| 463 |
|
|
if( !check_equiv_s(S_obtuse, transform_sym_matrix(it->second, S_red), resol2) ) continue; |
| 464 |
|
|
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Orthorhombic_F, S_red ) ); |
| 465 |
rtomiyasu |
3 |
} |
| 466 |
|
|
} |
| 467 |
|
|
if( m_latfom.enumBravaisLattice() != Inner ) |
| 468 |
|
|
{ |
| 469 |
|
|
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Orthorhombic_I, abc_axis, rh_axis)); |
| 470 |
|
|
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 471 |
|
|
{ |
| 472 |
rtomiyasu |
12 |
const SymMat<Double> S_red = chToDouble(it->first); |
| 473 |
|
|
if( !check_equiv_s(S_obtuse, transform_sym_matrix(it->second, S_red), resol2) ) continue; |
| 474 |
|
|
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Orthorhombic_I, S_red ) ); |
| 475 |
rtomiyasu |
3 |
} |
| 476 |
|
|
} |
| 477 |
|
|
if( m_latfom.enumBravaisLattice() != BaseX && m_latfom.enumBravaisLattice() != BaseY && m_latfom.enumBravaisLattice() != BaseZ ) |
| 478 |
|
|
{ |
| 479 |
|
|
const map< SymMat<VCData>, NRMat<Int4> >& S_red_tray = RLCB.checkBravaisLatticeType(BravaisType(Monoclinic_B, abc_axis, rh_axis)); |
| 480 |
|
|
for(map< SymMat<VCData>, NRMat<Int4> >::const_iterator it=S_red_tray.begin(); it!=S_red_tray.end(); it++) |
| 481 |
|
|
{ |
| 482 |
rtomiyasu |
12 |
const SymMat<Double> S_red = chToDouble(it->first); |
| 483 |
|
|
if( !check_equiv_s(S_obtuse, transform_sym_matrix(it->second, S_red), resol2) ) continue; |
| 484 |
|
|
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Monoclinic_B, S_red ) ); |
| 485 |
rtomiyasu |
3 |
} |
| 486 |
|
|
} |
| 487 |
|
|
|
| 488 |
|
|
NRMat<Int4> trans_mat; |
| 489 |
|
|
SymMat<Double> S_red(3); |
| 490 |
|
|
if( m_latfom.enumCrystalSystem() == Rhombohedral || m_latfom.enumBravaisLattice() != Prim ) |
| 491 |
|
|
{ |
| 492 |
|
|
const SymMat<Double> S_super = put_sym_matrix_size4to3(this->putInitialSellingReducedForm()); |
| 493 |
|
|
putTransformMatrixToMinkowskiReduced(Inverse3(S_super), trans_mat); |
| 494 |
|
|
transpose_square_matrix(trans_mat); |
| 495 |
|
|
ans.push_back( pair< eCrystalSystem, SymMat<Double> >(Triclinic, transform_sym_matrix(Inverse3(trans_mat), S_super) ) ); |
| 496 |
|
|
} |
| 497 |
|
|
} |
| 498 |
|
|
|
| 499 |
|
|
|
| 500 |
|
|
void LatticeFigureOfMeritToCheckSymmetry::putEquivalentLatticeConstantsDegreeWithOtherCentring( |
| 501 |
|
|
const eABCaxis& abc_axis, const eRHaxis& rh_axis, |
| 502 |
|
|
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >& ans) const |
| 503 |
|
|
{ |
| 504 |
|
|
vector< pair< eCrystalSystem, SymMat<Double> > > ans0; |
| 505 |
|
|
putEquivalentLatticeConstantsDegreeWithOtherCentring(abc_axis, rh_axis, ans0); |
| 506 |
|
|
|
| 507 |
|
|
ans.clear(); |
| 508 |
|
|
ans.resize( ans0.size() ); |
| 509 |
|
|
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >::iterator it2 = ans.begin(); |
| 510 |
|
|
for(vector< pair< eCrystalSystem, SymMat<Double> > >::const_iterator it=ans0.begin(); it<ans0.end(); it++, it2++) |
| 511 |
|
|
{ |
| 512 |
|
|
it2->first = it->first; |
| 513 |
|
|
LatticeFigureOfMerit::putLatticeConstantsDegree( BravaisType(it->first, abc_axis, rh_axis), it->second, abc_axis, rh_axis, it2->second.first, it2->second.second ); |
| 514 |
|
|
} |
| 515 |
|
|
} |
| 516 |
|
|
|
| 517 |
|
|
|
| 518 |
|
|
void LatticeFigureOfMeritToCheckSymmetry::printLatticeInformation( |
| 519 |
|
|
const vector<LatticeFigureOfMeritToCheckSymmetry> lattice_result[], |
| 520 |
|
|
const OutputInfo outinfo[], |
| 521 |
|
|
const eABCaxis& abc_axis, |
| 522 |
|
|
const eRHaxis& rh_axis, |
| 523 |
|
|
const Int4& label_start0, |
| 524 |
|
|
ostream* os) const |
| 525 |
|
|
{ |
| 526 |
|
|
m_latfom.printLatticeInformation(abc_axis, rh_axis, label_start0, os); |
| 527 |
|
|
|
| 528 |
|
|
// const FracMat mat_sell_to_min = FInverse3( put_transform_matrix_row4to3( putLatticeFigureOfMerit().putOptimizedFormWithTransformMatrixToSellingReduced().second) ); |
| 529 |
|
|
// const SymMat<Double> dbl_S_init = transform_sym_matrix(mat_sell_to_min.mat, |
| 530 |
|
|
// put_sym_matrix_size4to3( this->putInitialSellingReducedForm() ) ) / (mat_sell_to_min.denom*mat_sell_to_min.denom); |
| 531 |
|
|
// const SymMat<Double>& dbl_S_init = this->putInitialSellingReducedForm(); |
| 532 |
|
|
|
| 533 |
|
|
// os->width(label_start); *os << ""; |
| 534 |
|
|
// *os << "<!-- A*, B*, C*, D*, E*, F*(angstrom^(-2)) first given by peak-positions.-->\n"; |
| 535 |
|
|
// os->width(label_start); *os << ""; |
| 536 |
|
|
// *os << "<InitialReciprocalLatticeParameters>"; |
| 537 |
|
|
// os->width(14); |
| 538 |
|
|
// *os << dbl_S_init(0,0); |
| 539 |
|
|
// os->width(14); |
| 540 |
|
|
// *os << dbl_S_init(1,1); |
| 541 |
|
|
// os->width(14); |
| 542 |
|
|
// *os << dbl_S_init(2,2); |
| 543 |
|
|
// os->width(14); |
| 544 |
|
|
// *os << dbl_S_init(1,2); |
| 545 |
|
|
// os->width(14); |
| 546 |
|
|
// *os << dbl_S_init(0,2); |
| 547 |
|
|
// os->width(14); |
| 548 |
|
|
// *os << dbl_S_init(0,1); |
| 549 |
|
|
// *os << " </InitialReciprocalLatticeParameters>\n"; |
| 550 |
|
|
|
| 551 |
|
|
Int4 label_start = label_start0; |
| 552 |
|
|
os->width(label_start); |
| 553 |
|
|
*os << "" << "<NumberOfLatticesInNeighborhood>"; |
| 554 |
|
|
os->width(14); |
| 555 |
|
|
*os << this->putNumberOfLatticesInNeighborhood(); |
| 556 |
|
|
*os << " </NumberOfLatticesInNeighborhood>\n\n"; |
| 557 |
|
|
|
| 558 |
|
|
os->width(label_start); |
| 559 |
|
|
*os << "" << "<EquivalentLatticeCandidates>\n"; |
| 560 |
|
|
label_start++; |
| 561 |
|
|
|
| 562 |
|
|
vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > > lattice_equiv; |
| 563 |
|
|
this->putEquivalentLatticeConstantsDegreeWithOtherCentring(abc_axis, rh_axis, lattice_equiv); |
| 564 |
|
|
|
| 565 |
|
|
for(vector< pair< eCrystalSystem, pair< VecDat3<Double>, VecDat3<Double> > > >::const_iterator it=lattice_equiv.begin(); it<lattice_equiv.end(); it++) |
| 566 |
|
|
{ |
| 567 |
|
|
os->width(label_start); *os << ""; |
| 568 |
|
|
*os << "<LatticeCandidate>\n"; |
| 569 |
|
|
label_start++; |
| 570 |
|
|
|
| 571 |
|
|
os->width(label_start); *os << ""; |
| 572 |
|
|
*os << "<CrystalSystem>"; |
| 573 |
|
|
os->width(17); |
| 574 |
|
|
*os << put_cs_name(it->first, abc_axis); |
| 575 |
|
|
*os << " </CrystalSystem>\n"; |
| 576 |
|
|
|
| 577 |
|
|
os->width(label_start); |
| 578 |
|
|
*os << "" << "<LatticeParameters>"; |
| 579 |
|
|
os->width(14); |
| 580 |
|
|
*os << it->second.first[0]; |
| 581 |
|
|
os->width(14); |
| 582 |
|
|
*os << it->second.first[1]; |
| 583 |
|
|
os->width(14); |
| 584 |
|
|
*os << it->second.first[2]; |
| 585 |
|
|
os->width(14); |
| 586 |
|
|
*os << it->second.second[0]; |
| 587 |
|
|
os->width(14); |
| 588 |
|
|
*os << it->second.second[1]; |
| 589 |
|
|
os->width(14); |
| 590 |
|
|
*os << it->second.second[2]; |
| 591 |
|
|
*os << " </LatticeParameters>\n"; |
| 592 |
|
|
|
| 593 |
|
|
label_start--; |
| 594 |
|
|
os->width(label_start); *os << ""; |
| 595 |
|
|
*os << "</LatticeCandidate>\n"; |
| 596 |
|
|
} |
| 597 |
|
|
|
| 598 |
|
|
label_start--; |
| 599 |
|
|
os->width(label_start); *os << ""; |
| 600 |
|
|
*os << "</EquivalentLatticeCandidates>\n\n"; |
| 601 |
|
|
} |