Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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