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 3 - (show annotations) (download) (as text)
Fri Feb 22 04:51:31 2013 UTC (11 years, 1 month ago) by rtomiyasu
File MIME type: text/x-c++src
File size: 24279 byte(s)


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 "lattice_symmetry.hh"
32 #include "ReducedLatticeToCheckBravais.hh"
33 #include "../utility_lattice_reduction/put_Minkowski_reduced_lattice.hh"
34 #include "../utility_lattice_reduction/super_basis3.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[(ArrayIndex)BaseA_Axis*2];
536 vector< pair< NRMat<Int4>, FracMat > >& S_minA_to_sell_prd = S_min_to_sell[(ArrayIndex)BaseA_Axis*2+1];
537 vector< pair< NRMat<Int4>, FracMat > >& S_minB_to_sell_qck = S_min_to_sell[(ArrayIndex)BaseB_Axis*2];
538 vector< pair< NRMat<Int4>, FracMat > >& S_minB_to_sell_prd = S_min_to_sell[(ArrayIndex)BaseB_Axis*2+1];
539 vector< pair< NRMat<Int4>, FracMat > >& S_minC_to_sell_qck = S_min_to_sell[(ArrayIndex)BaseC_Axis*2];
540 vector< pair< NRMat<Int4>, FracMat > >& S_minC_to_sell_prd = S_min_to_sell[(ArrayIndex)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_XZY(), 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_XZY(), 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[(ArrayIndex)Rho_Axis*2];
619 vector< pair< NRMat<Int4>, FracMat > >& S_min_rho_to_sell_prd = S_min_to_sell[(ArrayIndex)Rho_Axis*2+1];
620 vector< pair< NRMat<Int4>, FracMat > >& S_min_hex_to_sell_qck = S_min_to_sell[(ArrayIndex)Hex_Axis*2];
621 vector< pair< NRMat<Int4>, FracMat > >& S_min_hex_to_sell_prd = S_min_to_sell[(ArrayIndex)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 > > ReducedLatticeToCheckBravais::m_trans_mat_red_F = put_Transform_Matrix_face();
650 const vector< pair< NRMat<Int4>, FracMat > > ReducedLatticeToCheckBravais::m_trans_mat_red_I = put_Transform_Matrix_body();
651 const vector< vector< pair< NRMat<Int4>, FracMat > > > ReducedLatticeToCheckBravais::m_trans_mat_red_rhom = put_Transform_Matrix_rhom();
652 const vector< vector< pair< NRMat<Int4>, FracMat > > > ReducedLatticeToCheckBravais::m_trans_mat_red_base = put_Transform_Matrix_base();
653
654 ReducedLatticeToCheckBravais::ReducedLatticeToCheckBravais(
655 const eABCaxis& axis1,
656 const eRHaxis& axis2,
657 const bool& does_prudent_sym_search,
658 const Double& resol2, const SymMat43_VCData & S_red)
659 : m_monoclinic_b_type(put_monoclinic_b_type(axis1)),
660 m_rhombohedral_type(put_rhombohedral_type(axis2)),
661 m_S_red( S_red ),
662 m_S_super_obtuse( transform_sym_matrix(m_S_red.second, m_S_red.first) )
663 {
664 put_S_Minkowski_reduced_IF(resol2, m_S_super_obtuse, m_S_red_body, false);
665 put_S_Minkowski_reduced_base(m_monoclinic_b_type, does_prudent_sym_search, resol2, m_S_super_obtuse, m_S_red_base);
666 put_S_Minkowski_reduced_rhom(m_rhombohedral_type, does_prudent_sym_search, resol2, m_S_super_obtuse, m_S_red_rhom);
667
668 const SymMat<VCData> S_super_obtuse3( put_sym_matrix_size4to3(m_S_super_obtuse) );
669 const SymMat<Double> inv_S( Inverse3( chToDouble( S_super_obtuse3 ) ) );
670
671 // Calculate the inverse of m_S_red.
672 SymMat<Double> inv_S_super_obtuse(4);
673 NRMat<Int4> tmat_inv_S_super_obtuse(4,3);
674
675 // inv_S_super_obtuse = transpose( tmat_inv_S_super_obtuse) * inverse(S_super_obtuse3) * tmat_inv_S_super_obtuse.
676 put_super_Gram_matrix_obtuse_angle<Double, SymMat<Double> >(inv_S, inv_S_super_obtuse, tmat_inv_S_super_obtuse);
677 moveSmallerDiagonalLeftUpper<Double, SymMat<Double> >(inv_S_super_obtuse, tmat_inv_S_super_obtuse);
678 tmat_inv_S_super_obtuse = put_transform_matrix_row4to3(tmat_inv_S_super_obtuse);
679 transpose_square_matrix(tmat_inv_S_super_obtuse);
680
681 const SymMat<VCData> S_inv_super_obtuse
682 = put_sym_matrix_size3to4( transform_sym_matrix( Inverse3(tmat_inv_S_super_obtuse), S_super_obtuse3 ) );
683
684 put_S_Minkowski_reduced_IF(resol2, S_inv_super_obtuse, m_S_red_face, true);
685
686 for(map< SymMat<VCData>, NRMat<Int4> >::iterator it=m_S_red_face.begin(); it!=m_S_red_face.end(); it++)
687 {
688 it->second = put_transform_matrix_row3to4( mprod(tmat_inv_S_super_obtuse, put_transform_matrix_row4to3(it->second) ) );
689 }
690 }
691
692
693 ReducedLatticeToCheckBravais::~ReducedLatticeToCheckBravais()
694 {
695 }
696
697
698 // On input, inv_flag = false indicates that S_super_obtuse_equiv is Selling-reduced,
699 // and inv_flag = true indicates that Inverse(S_super_obtuse_equiv) is Selling-reduced.
700 // In the former case, on output, S_red_body are symmetric matrices having a body-centered and Minkowski-reduced inverse.
701 // In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Minkowski-reduced inverse.
702 void ReducedLatticeToCheckBravais::put_S_Minkowski_reduced_IF(
703 const Double& cv2, const SymMat<VCData>& S_super_obtuse,
704 map< SymMat<VCData>, NRMat<Int4> >& S_red_IF,
705 const bool& inv_flag)
706 {
707 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_IF = (inv_flag?m_trans_mat_red_F:m_trans_mat_red_I);
708 S_red_IF.clear();
709
710 NRMat<Int4> tmat;
711 SymMat<VCData> S2_red0(3), S2_red(3);
712
713 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_IF.begin(); it!=tmat_red_IF.end(); it++)
714 {
715 const FracMat& inv_mat = it->second;
716 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_size4to3(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
717 S2_red = S2_red0;
718
719 cal_average_crystal_system(D2h, S2_red);
720 if( !check_equiv_m(S2_red0, S2_red, cv2) ) continue;
721
722 tmat = identity_matrix<Int4>(3);
723 moveLargerDiagonalLeftUpper< VCData, SymMat<VCData> >(S2_red, tmat);
724 tmat = mprod( put_transform_matrix_row3to4(it->first), transpose(tmat) ); // inverse(tmat) = transpose(tmat).
725
726 S_red_IF.insert( SymMat43_VCData(S2_red, tmat) );
727 }
728 }
729
730 void ReducedLatticeToCheckBravais::put_S_Minkowski_reduced_rhom(
731 const BravaisType& rhombohedral_type,
732 const bool& does_prudent_sym_search,
733 const Double& cv2, const SymMat<VCData>& S_super_obtuse,
734 map< SymMat<VCData>, NRMat<Int4> >& S_red_rhomhex)
735 {
736 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_rhom = m_trans_mat_red_rhom[(ArrayIndex)rhombohedral_type.enumRHaxis()*2+(does_prudent_sym_search?1:0)];
737 S_red_rhomhex.clear();
738
739 NRMat<Int4> tmat;
740 SymMat<VCData> S2_red0(3), S2_red(3);
741
742 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_rhom.begin(); it!=tmat_red_rhom.end(); it++)
743 {
744 const FracMat& inv_mat = it->second;
745 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_size4to3(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
746 S2_red = S2_red0;
747
748 cal_average_crystal_system(rhombohedral_type.enumPointGroup(), S2_red);
749 if( !check_equiv_m(S2_red0, S2_red, cv2) ) continue;
750
751 tmat = put_transform_matrix_row3to4(it->first);
752
753 S_red_rhomhex.insert( SymMat43_VCData(S2_red, tmat) );
754 }
755 }
756
757
758 // On input, S_red is Minkowski-reduced and S_super_obtuse_equiv is Selling-reduced.
759 // On output, S_red_base are symmetric matrices having a base-centered and Minkowski-reduced inverse.
760 void ReducedLatticeToCheckBravais::put_S_Minkowski_reduced_base(
761 const BravaisType& monoclinic_b_type,
762 const bool& does_prudent_sym_search,
763 const Double& cv2, const SymMat<VCData>& S_super_obtuse,
764 map< SymMat<VCData>, NRMat<Int4> >& S_red_base)
765 {
766 const ArrayIndex ibase_axis = monoclinic_b_type.enumBASEaxis();
767 const vector< pair< NRMat<Int4>, FracMat > >& tmat_red_base = m_trans_mat_red_base[(ArrayIndex)ibase_axis*2+(does_prudent_sym_search?1:0)];
768
769 S_red_base.clear();
770
771 NRMat<Int4> tmat;
772 SymMat<VCData> S2_red0(3), S2_red(3);
773
774 for(vector< pair< NRMat<Int4>, FracMat > >::const_iterator it=tmat_red_base.begin(); it!=tmat_red_base.end(); it++)
775 {
776 const FracMat& inv_mat = it->second;
777 S2_red0 = transform_sym_matrix(inv_mat.mat, put_sym_matrix_size4to3(S_super_obtuse) ) / (inv_mat.denom*inv_mat.denom);
778 S2_red = S2_red0;
779
780 cal_average_crystal_system(monoclinic_b_type.enumPointGroup(), S2_red);
781
782 if( !check_equiv_m(S2_red0, S2_red, cv2) ) continue;
783
784 tmat = put_transform_matrix_row3to4(it->first);
785 putMinkowskiReducedMonoclinicB(monoclinic_b_type, S2_red, tmat);
786
787 S_red_base.insert( SymMat43_VCData(S2_red, tmat) );
788 }
789 }
790
791
792 const map< SymMat<VCData>, NRMat<Int4> >& ReducedLatticeToCheckBravais::checkBravaisLatticeType(const BravaisType& brat) const
793 {
794 if( brat == m_monoclinic_b_type )
795 {
796 return m_S_red_base;
797 }
798 else if( brat.enumBravaisLattice() == Face )
799 {
800 return m_S_red_face;
801 }
802 else if( brat.enumBravaisLattice() == Inner )
803 {
804 return m_S_red_body;
805 }
806 else if( brat == m_rhombohedral_type )
807 {
808 return m_S_red_rhom;
809 }
810 else
811 {
812 assert(false);
813 return m_S_red_body;
814 }
815 }
816

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