Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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