Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Conograph/trunk/src/lattice_symmetry/ReducedLatticeToCheckBravais.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (show annotations) (download) (as text)
Wed Sep 7 04:38:51 2016 UTC (7 years, 6 months ago) by rtomiyasu
File MIME type: text/x-c++src
File size: 23928 byte(s)
The output format for base-centered monoclinic cells was corrected.
1 /*
2 * The MIT License
3
4 BLDConograph (Bravais lattice determination module in Conograph)
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 <limits>
28 #include "check_equiv.hh"
29 #include "ReducedLatticeToCheckBravais.hh"
30 #include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh"
31 #include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh"
32 #include "../utility_func/zmath.hh"
33 #include "../utility_data_structure/FracMat.hh"
34
35
36 static void put_transform_matrix_from_sell_to_neighbor_base(vector< NRMat<Int4> >& arg,
37 const bool& does_prudent_search)
38 {
39 static const Int4 ISIZE = 69;
40 static const Int4 mat_tray[ISIZE][3][3]
41 = {
42 { { 1, 0, 0 },
43 { 0, 1, 0 },
44 { 0, 0, 1 } },
45 { { 1, 0, 0 },
46 { 0, 0, 1 },
47 { 0, 1, 0 } },
48 { { 1, 0, 0 },
49 { 0, 1, 1 },
50 { 0, -1, 0 } },
51 { { 1, 0, 0 },
52 { 0, -1, 0 },
53 { 0, 1, 1 } },
54 { { 1, 0, 0 },
55 { -1, 1, 0 },
56 { 0, 0, 1 } },
57 { { 1, 0, 0 },
58 { -1, 1, 0 },
59 { 0, -1, -1 } },
60 { { 1, 0, 0 },
61 { 0, 0, 1 },
62 { -1, 1, 0 } },
63 { { 1, 0, 0 },
64 { 0, -1, -1 },
65 { -1, 1, 0 } },
66 { { 1, 0, 0 },
67 { 0, 0, 1 },
68 { 0, -1, -1 } },
69 { { 1, 0, 0 },
70 { 0, -1, -1 },
71 { 0, 0, 1 } },
72 { { 1, 0, 0 },
73 { 0, 1, 1 },
74 { -1, 0, -1 } },
75 { { 1, 0, 0 },
76 { 0, 0, 1 },
77 { -1, -1, -1 } },
78 { { 0, 0, 1 },
79 { 1, 0, 0 },
80 { 0, 1, 0 } },
81 { { -1, 1, 0 },
82 { 1, 0, 0 },
83 { 0, 0, 1 } },
84 { { -1, 1, 0 },
85 { 1, 0, 0 },
86 { 0, -1, -1 } },
87 { { 0, 0, 1 },
88 { 1, 0, 0 },
89 { -1, 1, 0 } },
90 { { 0, 0, 1 },
91 { 1, 0, 0 },
92 { 0, -1, -1 } },
93 { { 0, 0, 1 },
94 { 1, 0, 0 },
95 { -1, -1, -1 } },
96 { { -1, 1, 0 },
97 { 0, 0, 1 },
98 { 1, 0, 0 } },
99 { { 0, 0, 1 },
100 { -1, 1, 0 },
101 { 1, 0, 0 } },
102 { { 0, 0, 1 },
103 { -1, -1, -1 },
104 { 1, 0, 0 } },
105 { { 1, 0, 0 },
106 { 0, 1, 0 },
107 { -1, 0, 1 } },
108 { { 1, 0, 0 },
109 { 0, 1, 0 },
110 { 0, -1, -1 } },
111 { { 1, 0, 0 },
112 { -1, 0, 1 },
113 { 0, 1, 0 } },
114 { { 1, 0, 0 },
115 { 0, -1, -1 },
116 { 0, 1, 0 } },
117 { { 1, 0, 0 },
118 { 0, 0, 1 },
119 { 0, -1, 0 } },
120 { { 1, 0, 0 },
121 { -1, 1, -1 },
122 { 0, -1, 0 } },
123 { { 1, 0, 0 },
124 { 0, -1, 0 },
125 { 0, 0, 1 } },
126 { { 1, 0, 0 },
127 { 0, -1, 0 },
128 { -1, 1, -1 } },
129 { { 1, 0, 0 },
130 { 0, 1, 1 },
131 { 0, 0, -1 } },
132 { { 1, 0, 0 },
133 { 0, 0, -1 },
134 { 0, 1, 1 } },
135 { { 1, 0, 0 },
136 { 0, 0, -1 },
137 { -1, -1, 0 } },
138 { { 1, 0, 0 },
139 { 0, 1, 1 },
140 { -1, -1, 0 } },
141 { { 1, 0, 0 },
142 { -1, -1, 0 },
143 { 0, 0, -1 } },
144 { { 1, 0, 0 },
145 { -1, -1, 0 },
146 { 0, 1, 1 } },
147 { { 1, 0, 0 },
148 { 0, 0, 1 },
149 { -1, 1, -1 } },
150 { { 1, 0, 0 },
151 { -1, 1, -1 },
152 { 0, 0, 1 } },
153 { { 1, 0, 0 },
154 { -1, 0, 1 },
155 { 0, -1, -1 } },
156 { { 1, 0, 0 },
157 { 0, -1, -1 },
158 { -1, 0, 1 } },
159 { { -1, 0, 1 },
160 { 1, 0, 0 },
161 { 0, 1, 0 } },
162 { { 0, -1, -1 },
163 { 1, 0, 0 },
164 { 0, 1, 0 } },
165 { { 0, 0, 1 },
166 { 1, 0, 0 },
167 { 0, -1, 0 } },
168 { { -1, 1, -1 },
169 { 1, 0, 0 },
170 { 0, -1, 0 } },
171 { { 0, 1, 1 },
172 { 1, 0, 0 },
173 { 0, 0, -1 } },
174 { { 0, 0, -1 },
175 { 1, 0, 0 },
176 { 0, 1, 1 } },
177 { { 0, 0, -1 },
178 { 1, 0, 0 },
179 { -1, -1, 0 } },
180 { { 0, 1, 1 },
181 { 1, 0, 0 },
182 { -1, -1, 0 } },
183 { { -1, -1, 0 },
184 { 1, 0, 0 },
185 { 0, 0, -1 } },
186 { { -1, -1, 0 },
187 { 1, 0, 0 },
188 { 0, 1, 1 } },
189 { { 0, 0, 1 },
190 { 1, 0, 0 },
191 { -1, 1, -1 } },
192 { { -1, 1, -1 },
193 { 1, 0, 0 },
194 { 0, 0, 1 } },
195 { { -1, 0, 1 },
196 { 1, 0, 0 },
197 { 0, -1, -1 } },
198 { { 0, -1, -1 },
199 { 1, 0, 0 },
200 { -1, 0, 1 } },
201 { { 0, 1, 1 },
202 { 0, 0, -1 },
203 { 1, 0, 0 } },
204 { { 0, 0, -1 },
205 { 0, 1, 1 },
206 { 1, 0, 0 } },
207 { { 0, 0, -1 },
208 { -1, -1, 0 },
209 { 1, 0, 0 } },
210 { { 0, 1, 1 },
211 { -1, -1, 0 },
212 { 1, 0, 0 } },
213 { { -1, -1, 0 },
214 { 0, 0, -1 },
215 { 1, 0, 0 } },
216 { { -1, -1, 0 },
217 { 0, 1, 1 },
218 { 1, 0, 0 } },
219 { { 0, 0, 1 },
220 { -1, 1, -1 },
221 { 1, 0, 0 } },
222 { { -1, 1, -1 },
223 { 0, 0, 1 },
224 { 1, 0, 0 } },
225 { { -1, 0, 1 },
226 { 0, -1, -1 },
227 { 1, 0, 0 } },
228 { { 0, -1, -1 },
229 { -1, 0, 1 },
230 { 1, 0, 0 } },
231 { { 1, 1, 0 },
232 { 0, 0, 1 },
233 { 0, -1, -1 } },
234 { { 1, 1, 0 },
235 { 0, -1, -1 },
236 { 0, 0, 1 } },
237 { { 0, 0, 1 },
238 { 1, 1, 0 },
239 { 0, -1, -1 } },
240 { { 0, -1, -1 },
241 { 1, 1, 0 },
242 { 0, 0, 1 } },
243 { { 0, 0, 1 },
244 { 0, -1, -1 },
245 { 1, 1, 0 } },
246 { { 0, -1, -1 },
247 { 0, 0, 1 },
248 { 1, 1, 0 } }
249 };
250
251 const Int4 ISIZE2 = (does_prudent_search?ISIZE:21);
252 arg.clear();
253 arg.resize(ISIZE2, NRMat<Int4>(3,3));
254 for(Int4 i=0; i<ISIZE2; i++)
255 {
256 NRMat<Int4>& arg_ref = arg[i];
257 const Int4 (*mat)[3] = mat_tray[i];
258 for(Int4 i2=0; i2<3; i2++)
259 {
260 for(Int4 j2=0; j2<3; j2++)
261 {
262 arg_ref[i2][j2] = mat[i2][j2];
263 }
264 }
265 }
266 }
267
268
269 static void put_transform_matrix_from_sell_to_neighbor_rhom(vector< NRMat<Int4> >& arg,
270 const bool& does_prudent_search)
271 {
272 static const Int4 ISIZE = 64;
273 static const Int4 mat_tray[ISIZE][3][3]
274 = {
275 { { 1, 0, 0 },
276 { 0, 1, 0 },
277 { 0, 0, 1 } },
278 { { 1, 0, 0 },
279 { 0, 1, 0 },
280 { -1, -1, -1 } },
281 { { 1, 0, 0 },
282 { -1, -1, -1 },
283 { 0, 1, 0 } },
284 { { 1, 0, 0 },
285 { -1, 0, 1 },
286 { 0, -1, 0 } },
287 { { 1, 0, 0 },
288 { 0, 1, -1 },
289 { 0, -1, 0 } },
290 { { 1, 0, 0 },
291 { 0, -1, 0 },
292 { -1, 0, 1 } },
293 { { 1, 0, 0 },
294 { 0, -1, 0 },
295 { 0, 1, -1 } },
296 { { 1, 0, 0 },
297 { -1, 0, 1 },
298 { 0, 1, -1 } },
299 { { 1, 0, 0 },
300 { 0, 1, -1 },
301 { -1, 0, 1 } },
302 { { -1, -1, -1 },
303 { 1, 0, 0 },
304 { 0, 1, 0 } },
305 { { -1, 0, 1 },
306 { 1, 0, 0 },
307 { 0, -1, 0 } },
308 { { 0, 1, -1 },
309 { 1, 0, 0 },
310 { 0, -1, 0 } },
311 { { -1, 0, 1 },
312 { 1, 0, 0 },
313 { 0, 1, -1 } },
314 { { 0, 1, -1 },
315 { 1, 0, 0 },
316 { -1, 0, 1 } },
317 { { -1, 0, 1 },
318 { 0, 1, -1 },
319 { 1, 0, 0 } },
320 { { 0, 1, -1 },
321 { -1, 0, 1 },
322 { 1, 0, 0 } },
323 { { 1, 0, 0 },
324 { 0, 1, 1 },
325 { 0, -1, 0 } },
326 { { 1, 0, 0 },
327 { -1, 0, -1 },
328 { 0, -1, 0 } },
329 { { 1, 0, 0 },
330 { 0, -1, 0 },
331 { 0, 1, 1 } },
332 { { 1, 0, 0 },
333 { 0, -1, 0 },
334 { -1, 0, -1 } },
335 { { 1, 0, 0 },
336 { 0, 1, 1 },
337 { -1, -1, 0 } },
338 { { 1, 0, 0 },
339 { -1, -1, 0 },
340 { 0, 1, 1 } },
341 { { 0, 1, 1 },
342 { 1, 0, 0 },
343 { 0, -1, 0 } },
344 { { -1, 0, -1 },
345 { 1, 0, 0 },
346 { 0, -1, 0 } },
347 { { 0, 1, 1 },
348 { 1, 0, 0 },
349 { -1, -1, 0 } },
350 { { -1, -1, 0 },
351 { 1, 0, 0 },
352 { 0, 1, 1 } },
353 { { 0, 1, 1 },
354 { -1, -1, 0 },
355 { 1, 0, 0 } },
356 { { -1, -1, 0 },
357 { 0, 1, 1 },
358 { 1, 0, 0 } },
359 { { 1, 0, 0 },
360 { 0, 1, 0 },
361 { 0, 0, -1 } },
362 { { 1, 0, 0 },
363 { 0, 1, 0 },
364 { -1, 0, 1 } },
365 { { 1, 0, 0 },
366 { 0, 1, 0 },
367 { 0, -1, -1 } },
368 { { 1, 0, 0 },
369 { 0, 1, 0 },
370 { -1, -1, 1 } },
371 { { 1, 0, 0 },
372 { 0, 0, -1 },
373 { 0, 1, 0 } },
374 { { 1, 0, 0 },
375 { -1, 0, 1 },
376 { 0, 1, 0 } },
377 { { 1, 0, 0 },
378 { 0, -1, -1 },
379 { 0, 1, 0 } },
380 { { 1, 0, 0 },
381 { -1, -1, 1 },
382 { 0, 1, 0 } },
383 { { 1, 0, 0 },
384 { -1, 1, -1 },
385 { 0, -1, 0 } },
386 { { 1, 0, 0 },
387 { 0, -1, 0 },
388 { -1, 1, -1 } },
389 { { 1, 0, 0 },
390 { -1, 1, 0 },
391 { 0, -1, -1 } },
392 { { 1, 0, 0 },
393 { 0, -1, -1 },
394 { -1, 1, 0 } },
395 { { 1, 0, 0 },
396 { 0, 1, 0 },
397 { 0, -1, 1 } },
398 { { 1, 0, 0 },
399 { 0, 1, 0 },
400 { -1, 0, -1 } },
401 { { 1, 0, 0 },
402 { 0, 0, -1 },
403 { 0, -1, 0 } },
404 { { -1, 0, 1 },
405 { 1, 0, 0 },
406 { 0, 1, 0 } },
407 { { 0, -1, -1 },
408 { 1, 0, 0 },
409 { 0, 1, 0 } },
410 { { -1, -1, 1 },
411 { 1, 0, 0 },
412 { 0, 1, 0 } },
413 { { -1, 1, -1 },
414 { 1, 0, 0 },
415 { 0, -1, 0 } },
416 { { 1, 0, 0 },
417 { 0, -1, 0 },
418 { -1, 1, 1 } },
419 { { -1, 1, 0 },
420 { 1, 0, 0 },
421 { 0, -1, -1 } },
422 { { 0, -1, -1 },
423 { 1, 0, 0 },
424 { -1, 1, 0 } },
425 { { 1, 0, 0 },
426 { 0, -1, 1 },
427 { 0, 1, 0 } },
428 { { 1, 0, 0 },
429 { -1, 0, -1 },
430 { 0, 1, 0 } },
431 { { 0, -1, 1 },
432 { 1, 0, 0 },
433 { 0, 1, 0 } },
434 { { -1, 0, -1 },
435 { 1, 0, 0 },
436 { 0, 1, 0 } },
437 { { -1, 1, 1 },
438 { 1, 0, 0 },
439 { 0, -1, 0 } },
440 { { 1, 0, 0 },
441 { -1, 1, 1 },
442 { 0, -1, 0 } },
443 { { -1, 1, 0 },
444 { 0, -1, -1 },
445 { 1, 0, 0 } },
446 { { 0, -1, -1 },
447 { -1, 1, 0 },
448 { 1, 0, 0 } },
449 { { -1, -1, 0 },
450 { 0, 1, -1 },
451 { 1, 0, 0 } },
452 { { 0, 1, -1 },
453 { -1, -1, 0 },
454 { 1, 0, 0 } },
455 { { -1, -1, 0 },
456 { 1, 0, 0 },
457 { 0, 1, -1 } },
458 { { 0, 1, -1 },
459 { 1, 0, 0 },
460 { -1, -1, 0 } },
461 { { 1, 0, 0 },
462 { -1, -1, 0 },
463 { 0, 1, -1 } },
464 { { 1, 0, 0 },
465 { 0, 1, -1 },
466 { -1, -1, 0 } }
467 };
468
469 const Int4 ISIZE2 = (does_prudent_search?ISIZE:16);
470 arg.clear();
471 arg.resize(ISIZE2, NRMat<Int4>(3,3));
472 for(Int4 i=0; i<ISIZE2; i++)
473 {
474 NRMat<Int4>& arg_ref = arg[i];
475 const Int4 (*mat)[3] = mat_tray[i];
476 for(Int4 i2=0; i2<3; i2++)
477 {
478 for(Int4 j2=0; j2<3; j2++)
479 {
480 arg_ref[i2][j2] = mat[i2][j2];
481 }
482 }
483 }
484 }
485
486
487
488
489 // The second variable is the inverse matrix of the first variable.
490 static vector< vector< pair< NRMat<Int4>, FracMat > > > put_Transform_Matrix_base()
491 {
492 static const NRMat<Int4> tmat_prim_to_Acell1 = transpose( BravaisType::putTransformMatrixFromPrimitiveToBase(BaseA_Axis) );
493 static const NRMat<Int4> tmat_prim_to_Bcell1 = transpose( BravaisType::putTransformMatrixFromPrimitiveToBase(BaseB_Axis) );
494 static const NRMat<Int4> tmat_prim_to_Ccell1 = transpose( BravaisType::putTransformMatrixFromPrimitiveToBase(BaseC_Axis) );
495
496 vector< vector< pair< NRMat<Int4>, FracMat > > > S_min_to_sell(6);
497 vector< pair< NRMat<Int4>, FracMat > >& S_minA_to_sell_qck = S_min_to_sell[(size_t)BaseA_Axis*2];
498 vector< pair< NRMat<Int4>, FracMat > >& S_minA_to_sell_prd = S_min_to_sell[(size_t)BaseA_Axis*2+1];
499 vector< pair< NRMat<Int4>, FracMat > >& S_minB_to_sell_qck = S_min_to_sell[(size_t)BaseB_Axis*2];
500 vector< pair< NRMat<Int4>, FracMat > >& S_minB_to_sell_prd = S_min_to_sell[(size_t)BaseB_Axis*2+1];
501 vector< pair< NRMat<Int4>, FracMat > >& S_minC_to_sell_qck = S_min_to_sell[(size_t)BaseC_Axis*2];
502 vector< pair< NRMat<Int4>, FracMat > >& S_minC_to_sell_prd = S_min_to_sell[(size_t)BaseC_Axis*2+1];
503
504 vector< NRMat<Int4> > mat_tray;
505 NRMat<Int4> mat(3,3);
506 put_transform_matrix_from_sell_to_neighbor_base(mat_tray, false);
507
508 for(vector< NRMat<Int4> >::const_iterator it=mat_tray.begin(); it!=mat_tray.end(); it++)
509 {
510 mat = mprod(*it, tmat_prim_to_Acell1);
511 S_minA_to_sell_qck.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
512 mat = mprod(*it, tmat_prim_to_Bcell1);
513 S_minB_to_sell_qck.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
514 mat = mprod(*it, tmat_prim_to_Ccell1);
515 S_minC_to_sell_qck.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
516 }
517
518 put_transform_matrix_from_sell_to_neighbor_base(mat_tray, true);
519
520 for(vector< NRMat<Int4> >::const_iterator it=mat_tray.begin(); it!=mat_tray.end(); it++)
521 {
522 mat = mprod(*it, tmat_prim_to_Acell1);
523 S_minA_to_sell_prd.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
524 mat = mprod(*it, tmat_prim_to_Bcell1);
525 S_minB_to_sell_prd.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
526 mat = mprod(*it, tmat_prim_to_Ccell1);
527 S_minC_to_sell_prd.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
528 }
529
530 return S_min_to_sell;
531 }
532
533
534 // The second variable is the inverse matrix of the first variable.
535 static vector< pair< NRMat<Int4>, FracMat > > put_Transform_Matrix_face()
536 {
537 static const NRMat<Int4> tmat_prim_to_face = transpose( BravaisType::putTransformMatrixFromPrimitiveToFace() );
538
539 vector< pair< NRMat<Int4>, FracMat > > S_min_to_sell;
540
541 NRMat<Int4> mat = mprod(put_matrix_XYZ(), tmat_prim_to_face);
542 S_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
543
544 mat = mprod(put_matrix_ZXY(), tmat_prim_to_face);
545 S_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
546
547 mat = mprod(put_matrix_YZX(), tmat_prim_to_face);
548 S_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
549
550 return S_min_to_sell;
551 }
552
553
554 // The second variable is the inverse matrix of the first variable.
555 static vector< pair< NRMat<Int4>, FracMat > > put_Transform_Matrix_body()
556 {
557 static const NRMat<Int4> tmat_prim_to_body = BravaisType::putTransformMatrixFromBodyToPrimitive();
558
559 vector< pair< NRMat<Int4>, FracMat > > InvS_min_to_sell;
560
561 NRMat<Int4> mat = mprod(put_matrix_XYZ(), tmat_prim_to_body);
562 InvS_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
563
564 mat = mprod(put_matrix_ZXY(), tmat_prim_to_body);
565 InvS_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
566
567 mat = mprod(put_matrix_YZX(), tmat_prim_to_body);
568 InvS_min_to_sell.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
569
570 return InvS_min_to_sell;
571 }
572
573
574 // The second variable is the inverse matrix of the first variable.
575 static vector< vector< pair< NRMat<Int4>, FracMat > > > put_Transform_Matrix_rhom()
576 {
577 static const NRMat<Int4> tmat_prim_to_rhomhex = transpose( BravaisType::putTransformMatrixFromPrimitiveToRhomHex() );
578
579 vector< vector< pair< NRMat<Int4>, FracMat > > > S_min_to_sell(4);
580 vector< pair< NRMat<Int4>, FracMat > >& S_min_rho_to_sell_qck = S_min_to_sell[(size_t)Rho_Axis*2];
581 vector< pair< NRMat<Int4>, FracMat > >& S_min_rho_to_sell_prd = S_min_to_sell[(size_t)Rho_Axis*2+1];
582 vector< pair< NRMat<Int4>, FracMat > >& S_min_hex_to_sell_qck = S_min_to_sell[(size_t)Hex_Axis*2];
583 vector< pair< NRMat<Int4>, FracMat > >& S_min_hex_to_sell_prd = S_min_to_sell[(size_t)Hex_Axis*2+1];
584
585 vector< NRMat<Int4> > mat_tray;
586 NRMat<Int4> mat(3,3);
587 put_transform_matrix_from_sell_to_neighbor_rhom(mat_tray, false);
588
589 for(vector< NRMat<Int4> >::const_iterator it=mat_tray.begin(); it!=mat_tray.end(); it++)
590 {
591 S_min_rho_to_sell_qck.push_back( pair< NRMat<Int4>, FracMat >( *it, FInverse3( *it ) ) );
592
593 mat = mprod(*it, tmat_prim_to_rhomhex);
594 S_min_hex_to_sell_qck.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
595 }
596
597 put_transform_matrix_from_sell_to_neighbor_rhom(mat_tray, true);
598
599 for(vector< NRMat<Int4> >::const_iterator it=mat_tray.begin(); it!=mat_tray.end(); it++)
600 {
601 S_min_rho_to_sell_prd.push_back( pair< NRMat<Int4>, FracMat >( *it, FInverse3( *it ) ) );
602
603 mat = mprod(*it, tmat_prim_to_rhomhex);
604 S_min_hex_to_sell_prd.push_back( pair< NRMat<Int4>, FracMat >( mat, FInverse3( mat ) ) );
605 }
606
607 return S_min_to_sell;
608 }
609
610
611 const vector< pair< NRMat<Int4>, FracMat > > ReducedLatticeToCheckBravais::m_trans_mat_red_F = put_Transform_Matrix_face();
612 const vector< pair< NRMat<Int4>, FracMat > > ReducedLatticeToCheckBravais::m_trans_mat_red_I = put_Transform_Matrix_body();
613 const vector< vector< pair< NRMat<Int4>, FracMat > > > ReducedLatticeToCheckBravais::m_trans_mat_red_rhom = put_Transform_Matrix_rhom();
614 const vector< vector< pair< NRMat<Int4>, FracMat > > > ReducedLatticeToCheckBravais::m_trans_mat_red_base = put_Transform_Matrix_base();
615
616
617 static bool operator<(const SymMat<Double>& lhs, const SymMat<Double>& rhs)
618 {
619 static const Double EPS_1 = 1.0+sqrt( numeric_limits<double>::epsilon() );
620 assert( lhs.size() == 3 );
621 assert( rhs.size() == 3 );
622
623 static const Int4 ISIZE = 3;
624 for(Int4 i=0; i<ISIZE; i++)
625 {
626 if( lhs(i,i)*EPS_1 < rhs(i,i) ) return true;
627 if( rhs(i,i)*EPS_1 < lhs(i,i) ) return false;
628
629 for(Int4 j=0; j<i; j++)
630 {
631 const Double lhs_ij = lhs(i,i)+lhs(j,j)+lhs(i,j)*2.0;
632 const Double rhs_ij = rhs(i,i)+rhs(j,j)+rhs(i,j)*2.0;
633
634 if( lhs_ij*EPS_1 < rhs_ij ) return true;
635 if( rhs_ij*EPS_1 < lhs_ij ) return false;
636 }
637 }
638
639 return false;
640 }
641
642
643
644 ReducedLatticeToCheckBravais::ReducedLatticeToCheckBravais(
645 const eABCaxis& axis1,
646 const eRHaxis& axis2,
647 const bool& does_prudent_sym_search,
648 const Double& resol, const SymMat<Double>& S_super)
649 : m_monoclinic_b_type(put_monoclinic_b_type(axis1)),
650 m_rhombohedral_type(put_rhombohedral_type(axis2)),
651 m_S_super_obtuse( S_super )
652 {
653 put_S_Buerger_reduced_IF(resol, m_S_super_obtuse, m_S_red_body, false);
654 put_S_Buerger_reduced_base(m_monoclinic_b_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_base);
655 put_S_Buerger_reduced_rhom(m_rhombohedral_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_rhom);
656
657 const SymMat<Double> S_super_obtuse3( put_sym_matrix_sizeNplus1toN(m_S_super_obtuse) );
658 const SymMat<Double> inv_S( Inverse3( S_super_obtuse3 ) );
659
660 // Calculate the inverse of m_S_red.
661 SymMat<Double> inv_S_super_obtuse(4);
662 NRMat<Int4> tmat_inv_S_super_obtuse(4,3);
663
664 // inv_S_super_obtuse = transpose( tmat_inv_S_super_obtuse) * inverse(S_super_obtuse3) * tmat_inv_S_super_obtuse.
665 put_Selling_reduced_dim_less_than_4(inv_S, inv_S_super_obtuse, tmat_inv_S_super_obtuse);
666 moveSmallerDiagonalLeftUpper(inv_S_super_obtuse, tmat_inv_S_super_obtuse);
667 tmat_inv_S_super_obtuse = put_transform_matrix_row4to3(tmat_inv_S_super_obtuse);
668 transpose_square_matrix(tmat_inv_S_super_obtuse);
669
670 const SymMat<Double> S_inv_super_obtuse
671 = put_sym_matrix_sizeNtoNplus1( transform_sym_matrix( Inverse3(tmat_inv_S_super_obtuse), S_super_obtuse3 ) );
672
673 put_S_Buerger_reduced_IF(resol, S_inv_super_obtuse, m_S_red_face, true);
674
675 for(map< SymMat<Double>, NRMat<Int4> >::iterator it=m_S_red_face.begin(); it!=m_S_red_face.end(); it++)
676 {
677 it->second = put_transform_matrix_row3to4( mprod(tmat_inv_S_super_obtuse, put_transform_matrix_row4to3(it->second) ) );
678 }
679 }
680
681
682 ReducedLatticeToCheckBravais::~ReducedLatticeToCheckBravais()
683 {
684 }
685
686
687 // On input, inv_flag = false indicates that S_super_obtuse_equiv is Selling-reduced,
688 // and inv_flag = true indicates that Inverse(S_super_obtuse_equiv) is Selling-reduced.
689 // In the former case, on output, S_red_body are symmetric matrices having a body-centered and Buerger-reduced inverse.
690 // In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Buerger-reduced inverse.
691 void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_IF(
692 const Double& resol, const SymMat<Double>& S_super_obtuse,
693 map< SymMat<Double>, NRMat<Int4> >& S_red_IF,
694 const bool& inv_flag)
695 {
696 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_IF = (inv_flag?m_trans_mat_red_F:m_trans_mat_red_I);
697 S_red_IF.clear();
698
699 NRMat<Int4> tmat;
700 SymMat<Double> S2_red0(3), S2_red(3);
701
702 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_IF.begin(); it!=tmat_red_IF.end(); it++)
703 {
704 const FracMat& inv_mat = it->second;
705 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_sizeNplus1toN(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
706 S2_red = S2_red0;
707
708 cal_average_crystal_system(D2h, S2_red);
709 if( !check_equiv_m(S2_red0, S2_red, resol) ) continue;
710
711 tmat = identity_matrix<Int4>(3);
712 moveLargerDiagonalLeftUpper(S2_red, tmat);
713 tmat = mprod( put_transform_matrix_row3to4(it->first), transpose(tmat) ); // inverse(tmat) = transpose(tmat).
714
715 S_red_IF.insert( SymMat43_Double(S2_red, tmat) );
716 }
717 }
718
719 void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_rhom(
720 const BravaisType& rhombohedral_type,
721 const bool& does_prudent_sym_search,
722 const Double& resol, const SymMat<Double>& S_super_obtuse,
723 map< SymMat<Double>, NRMat<Int4> >& S_red_rhomhex)
724 {
725 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_rhom = m_trans_mat_red_rhom[(size_t)rhombohedral_type.enumRHaxis()*2+(does_prudent_sym_search?1:0)];
726 S_red_rhomhex.clear();
727
728 NRMat<Int4> tmat;
729 SymMat<Double> S2_red0(3), S2_red(3);
730
731 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_rhom.begin(); it!=tmat_red_rhom.end(); it++)
732 {
733 const FracMat& inv_mat = it->second;
734 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_sizeNplus1toN(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
735 S2_red = S2_red0;
736
737 cal_average_crystal_system(rhombohedral_type.enumLaueGroup(), S2_red);
738 if( !check_equiv_m(S2_red0, S2_red, resol) ) continue;
739
740 tmat = put_transform_matrix_row3to4(it->first);
741
742 S_red_rhomhex.insert( SymMat43_Double(S2_red, tmat) );
743 }
744 }
745
746
747 // On input, S_red is Buerger-reduced and S_super_obtuse_equiv is Selling-reduced.
748 // On output, S_red_base are symmetric matrices having a base-centered and Buerger-reduced inverse.
749 void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_base(
750 const BravaisType& monoclinic_b_type,
751 const bool& does_prudent_sym_search,
752 const Double& resol, const SymMat<Double>& S_super_obtuse,
753 map< SymMat<Double>, NRMat<Int4> >& S_red_base)
754 {
755 const eBASEaxis ibase_axis = monoclinic_b_type.enumBASEaxis();
756 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_base = m_trans_mat_red_base[(size_t)ibase_axis*2+(does_prudent_sym_search?1:0)];
757
758 S_red_base.clear();
759
760 NRMat<Int4> tmat;
761 SymMat<Double> S2_red0(3), S2_red(3);
762
763 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_base.begin(); it!=tmat_red_base.end(); it++)
764 {
765 const FracMat& inv_mat = it->second;
766 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_sizeNplus1toN(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
767 S2_red = S2_red0;
768
769 cal_average_crystal_system(monoclinic_b_type.enumLaueGroup(), S2_red);
770
771 if( !check_equiv_m(S2_red0, S2_red, resol) ) continue;
772
773 tmat = put_transform_matrix_row3to4(it->first);
774 putBuergerReducedMonoclinicB<Double>(monoclinic_b_type, S2_red, tmat);
775
776 S_red_base.insert( SymMat43_Double(S2_red, tmat) );
777 }
778 }
779
780
781 const map< SymMat<Double>, NRMat<Int4> >& ReducedLatticeToCheckBravais::checkCentringType(const BravaisType& brat) const
782 {
783 if( brat == m_monoclinic_b_type )
784 {
785 return m_S_red_base;
786 }
787 else if( brat.enumCentringType() == Face )
788 {
789 return m_S_red_face;
790 }
791 else if( brat.enumCentringType() == Inner )
792 {
793 return m_S_red_body;
794 }
795 else if( brat == m_rhombohedral_type )
796 {
797 return m_S_red_rhom;
798 }
799 else
800 {
801 assert(false);
802 return m_S_red_body;
803 }
804 }
805

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26