The names of functions and variables were changed from Niggli to Buerger.
The function rint was replaced by lrint.
@@ -1,496 +0,0 @@ | ||
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 | -#ifndef PUT_NIGGLI_REDUCED_LATTICE_HH_ | |
28 | -#define PUT_NIGGLI_REDUCED_LATTICE_HH_ | |
29 | - | |
30 | -#include "../utility_data_structure/SymMat.hh" | |
31 | -#include "../utility_data_structure/VCData.hh" | |
32 | -#include "../utility_data_structure/nrutil_nr.hh" | |
33 | -#include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" | |
34 | -#include "../point_group/enumPointGroup.hh" | |
35 | -#include "../point_group/point_gp_data.hh" | |
36 | -#include "../centring_type/enumCentringType.hh" | |
37 | -#include "../bravais_type/BravaisType.hh" | |
38 | - | |
39 | - | |
40 | -template<class T> | |
41 | -static void arrangeNondiagonalSign(SymMat<T>& inv_S_red, NRMat<Int4>& trans_mat) | |
42 | -{ | |
43 | - static const T zerro = 0; | |
44 | - | |
45 | - NRMat<Int4> mat2(3,3,0); | |
46 | - mat2[0][0] = 1; | |
47 | - mat2[1][1] = 1; | |
48 | - mat2[2][2] = 1; | |
49 | - | |
50 | - if( zerro < inv_S_red(0,1) ) | |
51 | - { | |
52 | - if( zerro < inv_S_red(0,2) ) | |
53 | - { | |
54 | - if( zerro < inv_S_red(1,2) ) return; | |
55 | - else // if( inv_S_red(1,2) <= zerro ) | |
56 | - { | |
57 | - mat2[0][0] = -1; | |
58 | - inv_S_red(0,1) *= -1; | |
59 | - inv_S_red(0,2) *= -1; | |
60 | - } | |
61 | - } | |
62 | - else // if( inv_S_red(0,2) <= zerro ) | |
63 | - { | |
64 | - if( zerro <= inv_S_red(1,2) ) | |
65 | - { | |
66 | - mat2[1][1] = -1; | |
67 | - inv_S_red(0,1) *= -1; | |
68 | - inv_S_red(1,2) *= -1; | |
69 | - } | |
70 | - else // if( inv_S_red(1,2) < zerro ) | |
71 | - { | |
72 | - if( zerro <= inv_S_red(0,2) ) // zerro == inv_S_red(0,2) | |
73 | - { | |
74 | - mat2[0][0] = -1; | |
75 | - inv_S_red(0,1) *= -1; | |
76 | - } | |
77 | - else // inv_S_red(0,2) < zerro | |
78 | - { | |
79 | - mat2[2][2] = -1; | |
80 | - inv_S_red(0,2) *= -1; | |
81 | - inv_S_red(1,2) *= -1; | |
82 | - } | |
83 | - } | |
84 | - } | |
85 | - } | |
86 | - else //if( inv_S_red(0,1) <= zerro ) | |
87 | - { | |
88 | - if( zerro <= inv_S_red(0,2) ) | |
89 | - { | |
90 | - if( zerro <= inv_S_red(1,2) ) | |
91 | - { | |
92 | - mat2[2][2] = -1; | |
93 | - inv_S_red(0,2) *= -1; | |
94 | - inv_S_red(1,2) *= -1; | |
95 | - } | |
96 | - else // if( inv_S_red(1,2) < zerro ) | |
97 | - { | |
98 | - if( inv_S_red(0,2) <= zerro ) return; | |
99 | - else if( zerro <= inv_S_red(0,1) ) // zerro == inv_S_red(0,1). | |
100 | - { | |
101 | - mat2[0][0] = -1; | |
102 | - inv_S_red(0,2) *= -1; | |
103 | - } | |
104 | - else // inv_S_red(0,1) < zerro && inv_S_red(0,2) > zerro. | |
105 | - { | |
106 | - mat2[1][1] = -1; | |
107 | - inv_S_red(0,1) *= -1; | |
108 | - inv_S_red(1,2) *= -1; | |
109 | - } | |
110 | - } | |
111 | - } | |
112 | - else // if( inv_S_red(0,2) < zerro ) | |
113 | - { | |
114 | - if( zerro < inv_S_red(1,2) ) | |
115 | - { | |
116 | - if( zerro <= inv_S_red(0,1) ) // inv_S_red(0,1) = zerro. | |
117 | - { | |
118 | - mat2[1][1] = -1; | |
119 | - inv_S_red(1,2) *= -1; | |
120 | - } | |
121 | - else // inv_S_red(0,1) < zerro. | |
122 | - { | |
123 | - mat2[0][0] = -1; | |
124 | - inv_S_red(0,1) *= -1; | |
125 | - inv_S_red(0,2) *= -1; | |
126 | - } | |
127 | - } | |
128 | - else // if( inv_S_red(1,2) <= zerro ) | |
129 | - return; | |
130 | - } | |
131 | - } | |
132 | - trans_mat = mprod(mat2, trans_mat); | |
133 | -} | |
134 | - | |
135 | - | |
136 | -// inv_S_red = trans_mat2*put_transform_matrix_34() * inv_S_super * Transpose(trans_mat2*put_transform_matrix_34()). | |
137 | -template<class T> | |
138 | -void putNiggliReducedMatrix(const SymMat<T>& inv_S_super, const bool& inv_flag, SymMat<T>& inv_S_red, | |
139 | - NRMat<Int4>& trans_mat2) | |
140 | -{ | |
141 | - static const T zerro = 0; | |
142 | - | |
143 | - assert( inv_S_super.size() == 4 ); | |
144 | - assert( inv_S_red.size() == 3 ); | |
145 | - assert( inv_S_super(0,0) <= inv_S_super(1,1) ); | |
146 | - assert( inv_S_super(1,1) <= inv_S_super(2,2) ); | |
147 | - assert( inv_S_super(2,2) <= inv_S_super(3,3) ); | |
148 | - assert( inv_S_super(0,1) <= zerro | |
149 | - && inv_S_super(0,2) <= zerro | |
150 | - && inv_S_super(0,3) <= zerro | |
151 | - && inv_S_super(1,2) <= zerro | |
152 | - && inv_S_super(1,3) <= zerro | |
153 | - && inv_S_super(2,3) <= zerro ); | |
154 | - | |
155 | - trans_mat2 = NRMat<Int4>(3,3,0); | |
156 | - trans_mat2[0][0] = 1; | |
157 | - trans_mat2[1][1] = 1; | |
158 | - trans_mat2[2][2] = 1; | |
159 | - | |
160 | - if( inv_S_super(0,0) + inv_S_super(0,1)*2 < zerro ) | |
161 | - { | |
162 | - trans_mat2[1][0] = 1; | |
163 | - } | |
164 | - else if( inv_S_super(0,0) + inv_S_super(0,2)*2 < zerro ) | |
165 | - { | |
166 | - trans_mat2[2][0] = 1; | |
167 | - } | |
168 | - else if( inv_S_super(1,1) + inv_S_super(1,2)*2 < zerro ) | |
169 | - { | |
170 | - trans_mat2[2][1] = 1; | |
171 | - } | |
172 | - else if( inv_S_super(0,0) + inv_S_super(1,1) + (inv_S_super(0,1) + inv_S_super(0,2) + inv_S_super(1,2) )*2 < zerro ) | |
173 | - { | |
174 | - trans_mat2[2][0] = -1; | |
175 | - trans_mat2[2][1] = -1; | |
176 | - trans_mat2[2][2] = -1; | |
177 | - } | |
178 | - inv_S_red = transform_sym_matrix(trans_mat2, put_sym_matrix_sizeNplus1toN(inv_S_super)); | |
179 | - if( inv_flag ) moveSmallerDiagonalLeftUpper(inv_S_red, trans_mat2); | |
180 | - else moveLargerDiagonalLeftUpper(inv_S_red, trans_mat2); | |
181 | - arrangeNondiagonalSign(inv_S_red, trans_mat2); | |
182 | -} | |
183 | - | |
184 | - | |
185 | - | |
186 | -template <class T> | |
187 | -void cal_average_crystal_system(const ePointGroup& epg, SymMat<T>& ans) | |
188 | -{ | |
189 | - if(epg == Ci) return; | |
190 | - else if(epg == C2h_X) | |
191 | - { | |
192 | - ans(0,1) = 0; | |
193 | - ans(0,2) = 0; | |
194 | - } | |
195 | - else if(epg == C2h_Y) | |
196 | - { | |
197 | - ans(0,1) = 0; | |
198 | - ans(1,2) = 0; | |
199 | - } | |
200 | - else if(epg == C2h_Z) | |
201 | - { | |
202 | - ans(0,2) = 0; | |
203 | - ans(1,2) = 0; | |
204 | - } | |
205 | - else if(epg == D2h) | |
206 | - { | |
207 | - ans(0,1) = 0; | |
208 | - ans(0,2) = 0; | |
209 | - ans(1,2) = 0; | |
210 | - } | |
211 | - else if(epg == D4h_X) | |
212 | - { | |
213 | - ans(0,1) = 0; | |
214 | - ans(0,2) = 0; | |
215 | - ans(1,2) = 0; | |
216 | - ans(1,1) = (ans(1,1)+ans(2,2))/2; | |
217 | - ans(2,2) = ans(1,1); | |
218 | - } | |
219 | - else if(epg == D4h_Y) | |
220 | - { | |
221 | - ans(0,1) = 0; | |
222 | - ans(0,2) = 0; | |
223 | - ans(1,2) = 0; | |
224 | - ans(0,0) = (ans(0,0)+ans(2,2))/2; | |
225 | - ans(2,2) = ans(0,0); | |
226 | - } | |
227 | - else if(epg == D4h_Z) | |
228 | - { | |
229 | - ans(0,1) = 0; | |
230 | - ans(0,2) = 0; | |
231 | - ans(1,2) = 0; | |
232 | - ans(0,0) = (ans(0,0)+ans(1,1))/2; | |
233 | - ans(1,1) = ans(0,0); | |
234 | - } | |
235 | - else if(epg == D31d_rho) | |
236 | - { | |
237 | - ans(0,0) = (ans(0,0)+ans(1,1)+ans(2,2))/3; | |
238 | - ans(1,1) = ans(0,0); | |
239 | - ans(2,2) = ans(0,0); | |
240 | - ans(0,1) = (ans(0,1)+ans(0,2)+ans(1,2))/3; | |
241 | - ans(0,2) = ans(0,1); | |
242 | - ans(1,2) = ans(0,1); | |
243 | - } | |
244 | - else if(epg == D3d_1_hex || epg == D6h) | |
245 | - { | |
246 | - ans(0,0) = (ans(0,0)+ans(1,1))/2; | |
247 | - ans(1,1) = ans(0,0); | |
248 | - ans(0,1) = ans(0,0)/2; | |
249 | - ans(0,2) = 0; | |
250 | - ans(1,2) = 0; | |
251 | - } | |
252 | - else if(epg == Oh) | |
253 | - { | |
254 | - ans(0,0) = (ans(0,0)+ans(1,1)+ans(2,2))/3; | |
255 | - ans(1,1) = ans(0,0); | |
256 | - ans(2,2) = ans(0,0); | |
257 | - ans(0,1) = 0; | |
258 | - ans(0,2) = 0; | |
259 | - ans(1,2) = 0; | |
260 | - } | |
261 | - else | |
262 | - { | |
263 | - assert( false ); | |
264 | - } | |
265 | -}; | |
266 | - | |
267 | -inline void putNiggliReducedMatrix(const SymMat<Double>& inv_S_super, SymMat<Double>& inv_S_red, NRMat<Int4>& trans_mat2) | |
268 | -{ | |
269 | - putNiggliReducedMatrix(inv_S_super, true, inv_S_red, trans_mat2); | |
270 | - | |
271 | -#ifdef DEBUG | |
272 | - assert( ( inv_S_red(0,1) <= 0.0 && inv_S_red(0,2) <= 0.0 && inv_S_red(1,2) <= 0.0 ) | |
273 | - || ( 0.0 < inv_S_red(0,1) && 0.0 < inv_S_red(0,2) && 0.0 < inv_S_red(1,2) ) ); | |
274 | - assert( inv_S_red(1,1)*0.9999 < inv_S_red(2,2) ); | |
275 | - assert( inv_S_red(0,0)*0.9999 < inv_S_red(1,1) ); | |
276 | - assert( inv_S_red(0,1) * (-1.9999) < inv_S_red(0,0) | |
277 | - && inv_S_red(0,1) * 1.9999 < inv_S_red(0,0) | |
278 | - && inv_S_red(0,2) * (-1.9999) < inv_S_red(0,0) | |
279 | - && inv_S_red(0,2) * 1.9999 < inv_S_red(0,0) | |
280 | - && inv_S_red(1,2) * (-1.9999) < inv_S_red(1,1) | |
281 | - && inv_S_red(1,2) * 1.9999 < inv_S_red(1,1) ); | |
282 | - assert( 0.0 < inv_S_red(0,0) + inv_S_red(1,1) + ( inv_S_red(0,1) + inv_S_red(0,2) + inv_S_red(1,2) ) * 1.9999 | |
283 | - && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) + ( inv_S_red(0,1) - inv_S_red(0,2) - inv_S_red(1,2) ) * 1.9999 | |
284 | - && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) - ( inv_S_red(0,1) - inv_S_red(0,2) + inv_S_red(1,2) ) * 1.9999 | |
285 | - && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) - ( inv_S_red(0,1) + inv_S_red(0,2) - inv_S_red(1,2) ) * 1.9999 ); | |
286 | -#endif | |
287 | -} | |
288 | - | |
289 | - | |
290 | -inline void putNiggliReducedMatrix(const SymMat<VCData>& S_super, SymMat<VCData>& S_red, NRMat<Int4>& trans_mat2) | |
291 | -{ | |
292 | - putNiggliReducedMatrix(S_super, false, S_red, trans_mat2); | |
293 | - | |
294 | -#ifdef DEBUG | |
295 | - assert( ( S_red(0,1).Value() <= 0.0 && S_red(0,2).Value() <= 0.0 && S_red(1,2).Value() <= 0.0 ) | |
296 | - || ( 0.0 < S_red(0,1).Value() && 0.0 < S_red(0,2).Value() && 0.0 < S_red(1,2).Value() ) ); | |
297 | - assert( S_red(1,1).Value()*0.9999 < S_red(0,0).Value() ); | |
298 | - assert( S_red(2,2).Value()*0.9999 < S_red(1,1).Value() ); | |
299 | - assert( S_red(0,1).Value() * (-1.9999) < S_red(1,1).Value() | |
300 | - && S_red(0,1).Value() * 1.9999 < S_red(1,1).Value() | |
301 | - && S_red(0,2).Value() * (-1.9999) < S_red(2,2).Value() | |
302 | - && S_red(0,2).Value() * 1.9999 < S_red(2,2).Value() | |
303 | - && S_red(1,2).Value() * (-1.9999) < S_red(2,2).Value() | |
304 | - && S_red(1,2).Value() * 1.9999 < S_red(2,2).Value() ); | |
305 | - assert( 0.0 < S_red(1,1).Value() + S_red(2,2).Value() + ( S_red(0,1) + S_red(0,2) + S_red(1,2) ).Value() * 1.9999 | |
306 | - && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() + ( S_red(0,1) - S_red(0,2) - S_red(1,2) ).Value() * 1.9999 | |
307 | - && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() - ( S_red(0,1) - S_red(0,2) + S_red(1,2) ).Value() * 1.9999 | |
308 | - && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() - ( S_red(0,1) + S_red(0,2) - S_red(1,2) ).Value() * 1.9999 ); | |
309 | -#endif | |
310 | -} | |
311 | - | |
312 | - | |
313 | -template<class T> | |
314 | -void putNiggliReducedMonoclinicP(const Int4& i, const Int4& j, | |
315 | - SymMat<T>& S_red, NRMat<Int4>& trans_mat2) | |
316 | -{ | |
317 | - T zerro = 0; | |
318 | - | |
319 | - assert(S_red.size()==3); | |
320 | - assert(trans_mat2.ncols()==3); | |
321 | - assert(i < j); | |
322 | - const Int4 irow = trans_mat2.nrows(); | |
323 | - | |
324 | - if( S_red(i,j) < zerro ) | |
325 | - { | |
326 | - S_red(i,j) *= -1; | |
327 | - for(Int4 l=0; l<irow; l++) | |
328 | - { | |
329 | - trans_mat2[l][i] *= -1; | |
330 | - } | |
331 | - } | |
332 | - | |
333 | - do{ | |
334 | - if( S_red(j,j) < S_red(i,j) * 2 ) | |
335 | - { | |
336 | - // S_red(i,j).Value() <= S_red(j,j).Value() * m | |
337 | - // i : -1 m 0 | |
338 | - // j : 0 1 0 | |
339 | - // : 0 0 1 | |
340 | - const Int4 m = iceil( S_red(i,j) / S_red(j,j) ); | |
341 | - | |
342 | - S_red(i,i) += ( S_red(j,j) * m - S_red(i,j) * 2 ) * m; | |
343 | - assert( !(S_red(i,i) < zerro) ); | |
344 | - S_red(i,j) = S_red(j,j) * m - S_red(i,j); | |
345 | - | |
346 | - for(Int4 l=0; l<irow; l++) | |
347 | - { | |
348 | - trans_mat2[l][j] += trans_mat2[l][i]*m; | |
349 | - } | |
350 | - for(Int4 l=0; l<irow; l++) | |
351 | - { | |
352 | - trans_mat2[l][i] *= -1; | |
353 | - } | |
354 | - } | |
355 | - | |
356 | - if( S_red(i,i) < S_red(i,j) * 2 ) | |
357 | - { | |
358 | - // S_red(i,j).Value() <= S_red(i,i).Value() * n | |
359 | - // i : 1 0 0 | |
360 | - // j : n -1 0 | |
361 | - // : 0 0 1 | |
362 | - const Int4 n = iceil( S_red(i,j) / S_red(i,i) ); | |
363 | - | |
364 | - S_red(j,j) += ( S_red(i,i) * n - S_red(i,j) * 2 ) * n; | |
365 | - assert( !( S_red(j,j) < zerro ) ); | |
366 | - S_red(i,j) = S_red(i,i) * n - S_red(i,j); | |
367 | - | |
368 | - for(Int4 l=0; l<irow; l++) | |
369 | - { | |
370 | - trans_mat2[l][i] += trans_mat2[l][j]*n; | |
371 | - } | |
372 | - for(Int4 l=0; l<irow; l++) | |
373 | - { | |
374 | - trans_mat2[l][j] *= -1; | |
375 | - } | |
376 | - } | |
377 | - } | |
378 | - while( S_red(j,j) < S_red(i,j) * 2 || S_red(i,i) < S_red(i,j) * 2 ); | |
379 | - | |
380 | - if( S_red(i,i) < S_red(j,j) ) | |
381 | - { | |
382 | - const Int4 k = put_complement_set3(i, j); | |
383 | - swap(S_red(i,i), S_red(j,j)); | |
384 | - swap(S_red(i,k), S_red(j,k)); | |
385 | - for(Int4 l=0; l<irow; l++) | |
386 | - { | |
387 | - swap(trans_mat2[l][i], trans_mat2[l][j]); | |
388 | - } | |
389 | - } | |
390 | -} | |
391 | - | |
392 | - | |
393 | -inline Double operator/(const VCData& lhs, const VCData& rhs) | |
394 | -{ | |
395 | - assert(rhs.Value() != 0.0); | |
396 | - return lhs.Value() / rhs.Value(); | |
397 | -} | |
398 | - | |
399 | -template<class T> | |
400 | -void putNiggliReducedMonoclinicB( | |
401 | - const BravaisType& monoclinic_b_type, | |
402 | - SymMat<T>& S_red, NRMat<Int4>& trans_mat2) | |
403 | -{ | |
404 | - const Int4 ibase_axis = monoclinic_b_type.enumBASEaxis(); | |
405 | - const Int4 iabc_axis = monoclinic_b_type.enumABCaxis(); | |
406 | - const Int4 ir = put_complement_set3(iabc_axis, ibase_axis); | |
407 | - | |
408 | - T zerro = 0; | |
409 | - | |
410 | - assert(S_red.size()==3); | |
411 | - assert(trans_mat2.nrows()==0 || trans_mat2.ncols()==3); | |
412 | - const Int4 irow = trans_mat2.nrows(); | |
413 | - | |
414 | - if( S_red( ibase_axis, ir ) < zerro ) | |
415 | - { | |
416 | - S_red( ibase_axis, ir ) *= -1; | |
417 | - for(Int4 l=0; l<irow; l++) | |
418 | - { | |
419 | - trans_mat2[l][ir] *= -1; | |
420 | - } | |
421 | - } | |
422 | - | |
423 | - do{ | |
424 | - if( S_red( ir, ir ) < S_red( ibase_axis, ir ) ) | |
425 | - { | |
426 | - // S_red( ibase_axis, ir ).Value() <= S_red( ir, ir ).Value() * m2 | |
427 | - // ir : 1 0 0 | |
428 | - // ibase_axis : m2 -1 0 | |
429 | - // : 0 0 1 | |
430 | - const Int4 m1 = iceil( ( S_red( ibase_axis, ir ) / S_red( ir, ir ) ) * 0.5 ); | |
431 | - const Int4 m2 = m1*2; | |
432 | - | |
433 | - S_red( ibase_axis, ibase_axis ) += ( S_red( ir, ir ) * m2 - S_red( ibase_axis, ir ) * 2 ) * m2; | |
434 | - assert( !( S_red( ibase_axis, ibase_axis ) < zerro ) ); | |
435 | - S_red( ibase_axis, ir ) = S_red( ir, ir ) * m2 - S_red( ibase_axis, ir ); | |
436 | - | |
437 | - for(Int4 l=0; l<irow; l++) | |
438 | - { | |
439 | - trans_mat2[l][ir] += trans_mat2[l][ibase_axis]*m2; | |
440 | - } | |
441 | - for(Int4 l=0; l<irow; l++) | |
442 | - { | |
443 | - trans_mat2[l][ibase_axis] *= -1; | |
444 | - } | |
445 | - } | |
446 | - | |
447 | - if( S_red( ibase_axis, ibase_axis ) < S_red( ibase_axis, ir ) * 2 ) | |
448 | - { | |
449 | - // S_red( ibase_axis, ir ).Value() <= S_red( ibase_axis, ibase_axis ).Value() * n | |
450 | - // ir :-1 n 0 | |
451 | - // ibase_axis : 0 1 0 | |
452 | - // : 0 0 1 | |
453 | - const Int4 n = iceil( S_red( ibase_axis, ir ) / S_red( ibase_axis, ibase_axis ) ); | |
454 | - | |
455 | - S_red( ir, ir ) += ( S_red( ibase_axis, ibase_axis ) * n - S_red( ibase_axis, ir ) * 2 ) * n; | |
456 | - assert( !( S_red( ir, ir ) < zerro ) ); | |
457 | - S_red( ibase_axis, ir ) = S_red( ibase_axis, ibase_axis ) * n - S_red( ibase_axis, ir ); | |
458 | - | |
459 | - for(Int4 l=0; l<irow; l++) | |
460 | - { | |
461 | - trans_mat2[l][ibase_axis] += trans_mat2[l][ir]*n; | |
462 | - } | |
463 | - for(Int4 l=0; l<irow; l++) | |
464 | - { | |
465 | - trans_mat2[l][ir] *= -1; | |
466 | - } | |
467 | - } | |
468 | - } | |
469 | - while( S_red( ir, ir ) < S_red( ibase_axis, ir ) || S_red( ibase_axis, ibase_axis ) < S_red( ibase_axis, ir ) * 2 ); | |
470 | -} | |
471 | - | |
472 | - | |
473 | -template<class T> | |
474 | -void putNiggliReducedOrthorhombic(const eCentringType& brat, | |
475 | - SymMat<T>& S_red, NRMat<Int4>& trans_mat) | |
476 | -{ | |
477 | - assert( brat != BaseX ); | |
478 | - assert( brat != BaseY ); | |
479 | - | |
480 | - if( brat == BaseZ ) | |
481 | - { | |
482 | - if( S_red(0,0) < S_red(1,1) ) | |
483 | - { | |
484 | - S_red = transform_sym_matrix(put_matrix_YXZ(), S_red); | |
485 | - trans_mat = mprod( trans_mat, put_matrix_YXZ() ); | |
486 | - } | |
487 | - } | |
488 | - else | |
489 | - { | |
490 | - NRMat<Int4> trans_mat2 = identity_matrix<Int4>(3); | |
491 | - moveLargerDiagonalLeftUpper(S_red, trans_mat2); | |
492 | - trans_mat = mprod(trans_mat, transpose(trans_mat2)); // inverse(trans_mat2) = transpose(trans_mat2). | |
493 | - } | |
494 | -} | |
495 | - | |
496 | -#endif /*PUT_MINKOWSKI_REDUCED_LATTICE_HH_*/ |
@@ -0,0 +1,496 @@ | ||
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 | +#ifndef PUT_Buerger_REDUCED_LATTICE_HH_ | |
28 | +#define PUT_Buerger_REDUCED_LATTICE_HH_ | |
29 | + | |
30 | +#include "../utility_data_structure/SymMat.hh" | |
31 | +#include "../utility_data_structure/VCData.hh" | |
32 | +#include "../utility_data_structure/nrutil_nr.hh" | |
33 | +#include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" | |
34 | +#include "../point_group/enumPointGroup.hh" | |
35 | +#include "../point_group/point_gp_data.hh" | |
36 | +#include "../centring_type/enumCentringType.hh" | |
37 | +#include "../bravais_type/BravaisType.hh" | |
38 | + | |
39 | + | |
40 | +template<class T> | |
41 | +static void arrangeNondiagonalSign(SymMat<T>& inv_S_red, NRMat<Int4>& trans_mat) | |
42 | +{ | |
43 | + static const T zerro = 0; | |
44 | + | |
45 | + NRMat<Int4> mat2(3,3,0); | |
46 | + mat2[0][0] = 1; | |
47 | + mat2[1][1] = 1; | |
48 | + mat2[2][2] = 1; | |
49 | + | |
50 | + if( zerro < inv_S_red(0,1) ) | |
51 | + { | |
52 | + if( zerro < inv_S_red(0,2) ) | |
53 | + { | |
54 | + if( zerro < inv_S_red(1,2) ) return; | |
55 | + else // if( inv_S_red(1,2) <= zerro ) | |
56 | + { | |
57 | + mat2[0][0] = -1; | |
58 | + inv_S_red(0,1) *= -1; | |
59 | + inv_S_red(0,2) *= -1; | |
60 | + } | |
61 | + } | |
62 | + else // if( inv_S_red(0,2) <= zerro ) | |
63 | + { | |
64 | + if( zerro <= inv_S_red(1,2) ) | |
65 | + { | |
66 | + mat2[1][1] = -1; | |
67 | + inv_S_red(0,1) *= -1; | |
68 | + inv_S_red(1,2) *= -1; | |
69 | + } | |
70 | + else // if( inv_S_red(1,2) < zerro ) | |
71 | + { | |
72 | + if( zerro <= inv_S_red(0,2) ) // zerro == inv_S_red(0,2) | |
73 | + { | |
74 | + mat2[0][0] = -1; | |
75 | + inv_S_red(0,1) *= -1; | |
76 | + } | |
77 | + else // inv_S_red(0,2) < zerro | |
78 | + { | |
79 | + mat2[2][2] = -1; | |
80 | + inv_S_red(0,2) *= -1; | |
81 | + inv_S_red(1,2) *= -1; | |
82 | + } | |
83 | + } | |
84 | + } | |
85 | + } | |
86 | + else //if( inv_S_red(0,1) <= zerro ) | |
87 | + { | |
88 | + if( zerro <= inv_S_red(0,2) ) | |
89 | + { | |
90 | + if( zerro <= inv_S_red(1,2) ) | |
91 | + { | |
92 | + mat2[2][2] = -1; | |
93 | + inv_S_red(0,2) *= -1; | |
94 | + inv_S_red(1,2) *= -1; | |
95 | + } | |
96 | + else // if( inv_S_red(1,2) < zerro ) | |
97 | + { | |
98 | + if( inv_S_red(0,2) <= zerro ) return; | |
99 | + else if( zerro <= inv_S_red(0,1) ) // zerro == inv_S_red(0,1). | |
100 | + { | |
101 | + mat2[0][0] = -1; | |
102 | + inv_S_red(0,2) *= -1; | |
103 | + } | |
104 | + else // inv_S_red(0,1) < zerro && inv_S_red(0,2) > zerro. | |
105 | + { | |
106 | + mat2[1][1] = -1; | |
107 | + inv_S_red(0,1) *= -1; | |
108 | + inv_S_red(1,2) *= -1; | |
109 | + } | |
110 | + } | |
111 | + } | |
112 | + else // if( inv_S_red(0,2) < zerro ) | |
113 | + { | |
114 | + if( zerro < inv_S_red(1,2) ) | |
115 | + { | |
116 | + if( zerro <= inv_S_red(0,1) ) // inv_S_red(0,1) = zerro. | |
117 | + { | |
118 | + mat2[1][1] = -1; | |
119 | + inv_S_red(1,2) *= -1; | |
120 | + } | |
121 | + else // inv_S_red(0,1) < zerro. | |
122 | + { | |
123 | + mat2[0][0] = -1; | |
124 | + inv_S_red(0,1) *= -1; | |
125 | + inv_S_red(0,2) *= -1; | |
126 | + } | |
127 | + } | |
128 | + else // if( inv_S_red(1,2) <= zerro ) | |
129 | + return; | |
130 | + } | |
131 | + } | |
132 | + trans_mat = mprod(mat2, trans_mat); | |
133 | +} | |
134 | + | |
135 | + | |
136 | +// inv_S_red = trans_mat2*put_transform_matrix_34() * inv_S_super * Transpose(trans_mat2*put_transform_matrix_34()). | |
137 | +template<class T> | |
138 | +void putBuergerReducedMatrix(const SymMat<T>& inv_S_super, const bool& inv_flag, SymMat<T>& inv_S_red, | |
139 | + NRMat<Int4>& trans_mat2) | |
140 | +{ | |
141 | + static const T zerro = 0; | |
142 | + | |
143 | + assert( inv_S_super.size() == 4 ); | |
144 | + assert( inv_S_red.size() == 3 ); | |
145 | + assert( inv_S_super(0,0) <= inv_S_super(1,1) ); | |
146 | + assert( inv_S_super(1,1) <= inv_S_super(2,2) ); | |
147 | + assert( inv_S_super(2,2) <= inv_S_super(3,3) ); | |
148 | + assert( inv_S_super(0,1) <= zerro | |
149 | + && inv_S_super(0,2) <= zerro | |
150 | + && inv_S_super(0,3) <= zerro | |
151 | + && inv_S_super(1,2) <= zerro | |
152 | + && inv_S_super(1,3) <= zerro | |
153 | + && inv_S_super(2,3) <= zerro ); | |
154 | + | |
155 | + trans_mat2 = NRMat<Int4>(3,3,0); | |
156 | + trans_mat2[0][0] = 1; | |
157 | + trans_mat2[1][1] = 1; | |
158 | + trans_mat2[2][2] = 1; | |
159 | + | |
160 | + if( inv_S_super(0,0) + inv_S_super(0,1)*2 < zerro ) | |
161 | + { | |
162 | + trans_mat2[1][0] = 1; | |
163 | + } | |
164 | + else if( inv_S_super(0,0) + inv_S_super(0,2)*2 < zerro ) | |
165 | + { | |
166 | + trans_mat2[2][0] = 1; | |
167 | + } | |
168 | + else if( inv_S_super(1,1) + inv_S_super(1,2)*2 < zerro ) | |
169 | + { | |
170 | + trans_mat2[2][1] = 1; | |
171 | + } | |
172 | + else if( inv_S_super(0,0) + inv_S_super(1,1) + (inv_S_super(0,1) + inv_S_super(0,2) + inv_S_super(1,2) )*2 < zerro ) | |
173 | + { | |
174 | + trans_mat2[2][0] = -1; | |
175 | + trans_mat2[2][1] = -1; | |
176 | + trans_mat2[2][2] = -1; | |
177 | + } | |
178 | + inv_S_red = transform_sym_matrix(trans_mat2, put_sym_matrix_sizeNplus1toN(inv_S_super)); | |
179 | + if( inv_flag ) moveSmallerDiagonalLeftUpper(inv_S_red, trans_mat2); | |
180 | + else moveLargerDiagonalLeftUpper(inv_S_red, trans_mat2); | |
181 | + arrangeNondiagonalSign(inv_S_red, trans_mat2); | |
182 | +} | |
183 | + | |
184 | + | |
185 | + | |
186 | +template <class T> | |
187 | +void cal_average_crystal_system(const ePointGroup& epg, SymMat<T>& ans) | |
188 | +{ | |
189 | + if(epg == Ci) return; | |
190 | + else if(epg == C2h_X) | |
191 | + { | |
192 | + ans(0,1) = 0; | |
193 | + ans(0,2) = 0; | |
194 | + } | |
195 | + else if(epg == C2h_Y) | |
196 | + { | |
197 | + ans(0,1) = 0; | |
198 | + ans(1,2) = 0; | |
199 | + } | |
200 | + else if(epg == C2h_Z) | |
201 | + { | |
202 | + ans(0,2) = 0; | |
203 | + ans(1,2) = 0; | |
204 | + } | |
205 | + else if(epg == D2h) | |
206 | + { | |
207 | + ans(0,1) = 0; | |
208 | + ans(0,2) = 0; | |
209 | + ans(1,2) = 0; | |
210 | + } | |
211 | + else if(epg == D4h_X) | |
212 | + { | |
213 | + ans(0,1) = 0; | |
214 | + ans(0,2) = 0; | |
215 | + ans(1,2) = 0; | |
216 | + ans(1,1) = (ans(1,1)+ans(2,2))/2; | |
217 | + ans(2,2) = ans(1,1); | |
218 | + } | |
219 | + else if(epg == D4h_Y) | |
220 | + { | |
221 | + ans(0,1) = 0; | |
222 | + ans(0,2) = 0; | |
223 | + ans(1,2) = 0; | |
224 | + ans(0,0) = (ans(0,0)+ans(2,2))/2; | |
225 | + ans(2,2) = ans(0,0); | |
226 | + } | |
227 | + else if(epg == D4h_Z) | |
228 | + { | |
229 | + ans(0,1) = 0; | |
230 | + ans(0,2) = 0; | |
231 | + ans(1,2) = 0; | |
232 | + ans(0,0) = (ans(0,0)+ans(1,1))/2; | |
233 | + ans(1,1) = ans(0,0); | |
234 | + } | |
235 | + else if(epg == D31d_rho) | |
236 | + { | |
237 | + ans(0,0) = (ans(0,0)+ans(1,1)+ans(2,2))/3; | |
238 | + ans(1,1) = ans(0,0); | |
239 | + ans(2,2) = ans(0,0); | |
240 | + ans(0,1) = (ans(0,1)+ans(0,2)+ans(1,2))/3; | |
241 | + ans(0,2) = ans(0,1); | |
242 | + ans(1,2) = ans(0,1); | |
243 | + } | |
244 | + else if(epg == D3d_1_hex || epg == D6h) | |
245 | + { | |
246 | + ans(0,0) = (ans(0,0)+ans(1,1))/2; | |
247 | + ans(1,1) = ans(0,0); | |
248 | + ans(0,1) = ans(0,0)/2; | |
249 | + ans(0,2) = 0; | |
250 | + ans(1,2) = 0; | |
251 | + } | |
252 | + else if(epg == Oh) | |
253 | + { | |
254 | + ans(0,0) = (ans(0,0)+ans(1,1)+ans(2,2))/3; | |
255 | + ans(1,1) = ans(0,0); | |
256 | + ans(2,2) = ans(0,0); | |
257 | + ans(0,1) = 0; | |
258 | + ans(0,2) = 0; | |
259 | + ans(1,2) = 0; | |
260 | + } | |
261 | + else | |
262 | + { | |
263 | + assert( false ); | |
264 | + } | |
265 | +}; | |
266 | + | |
267 | +inline void putBuergerReducedMatrix(const SymMat<Double>& inv_S_super, SymMat<Double>& inv_S_red, NRMat<Int4>& trans_mat2) | |
268 | +{ | |
269 | + putBuergerReducedMatrix(inv_S_super, true, inv_S_red, trans_mat2); | |
270 | + | |
271 | +#ifdef DEBUG | |
272 | + assert( ( inv_S_red(0,1) <= 0.0 && inv_S_red(0,2) <= 0.0 && inv_S_red(1,2) <= 0.0 ) | |
273 | + || ( 0.0 < inv_S_red(0,1) && 0.0 < inv_S_red(0,2) && 0.0 < inv_S_red(1,2) ) ); | |
274 | + assert( inv_S_red(1,1)*0.9999 < inv_S_red(2,2) ); | |
275 | + assert( inv_S_red(0,0)*0.9999 < inv_S_red(1,1) ); | |
276 | + assert( inv_S_red(0,1) * (-1.9999) < inv_S_red(0,0) | |
277 | + && inv_S_red(0,1) * 1.9999 < inv_S_red(0,0) | |
278 | + && inv_S_red(0,2) * (-1.9999) < inv_S_red(0,0) | |
279 | + && inv_S_red(0,2) * 1.9999 < inv_S_red(0,0) | |
280 | + && inv_S_red(1,2) * (-1.9999) < inv_S_red(1,1) | |
281 | + && inv_S_red(1,2) * 1.9999 < inv_S_red(1,1) ); | |
282 | + assert( 0.0 < inv_S_red(0,0) + inv_S_red(1,1) + ( inv_S_red(0,1) + inv_S_red(0,2) + inv_S_red(1,2) ) * 1.9999 | |
283 | + && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) + ( inv_S_red(0,1) - inv_S_red(0,2) - inv_S_red(1,2) ) * 1.9999 | |
284 | + && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) - ( inv_S_red(0,1) - inv_S_red(0,2) + inv_S_red(1,2) ) * 1.9999 | |
285 | + && 0.0 < inv_S_red(0,0) + inv_S_red(1,1) - ( inv_S_red(0,1) + inv_S_red(0,2) - inv_S_red(1,2) ) * 1.9999 ); | |
286 | +#endif | |
287 | +} | |
288 | + | |
289 | + | |
290 | +inline void putBuergerReducedMatrix(const SymMat<VCData>& S_super, SymMat<VCData>& S_red, NRMat<Int4>& trans_mat2) | |
291 | +{ | |
292 | + putBuergerReducedMatrix(S_super, false, S_red, trans_mat2); | |
293 | + | |
294 | +#ifdef DEBUG | |
295 | + assert( ( S_red(0,1).Value() <= 0.0 && S_red(0,2).Value() <= 0.0 && S_red(1,2).Value() <= 0.0 ) | |
296 | + || ( 0.0 < S_red(0,1).Value() && 0.0 < S_red(0,2).Value() && 0.0 < S_red(1,2).Value() ) ); | |
297 | + assert( S_red(1,1).Value()*0.9999 < S_red(0,0).Value() ); | |
298 | + assert( S_red(2,2).Value()*0.9999 < S_red(1,1).Value() ); | |
299 | + assert( S_red(0,1).Value() * (-1.9999) < S_red(1,1).Value() | |
300 | + && S_red(0,1).Value() * 1.9999 < S_red(1,1).Value() | |
301 | + && S_red(0,2).Value() * (-1.9999) < S_red(2,2).Value() | |
302 | + && S_red(0,2).Value() * 1.9999 < S_red(2,2).Value() | |
303 | + && S_red(1,2).Value() * (-1.9999) < S_red(2,2).Value() | |
304 | + && S_red(1,2).Value() * 1.9999 < S_red(2,2).Value() ); | |
305 | + assert( 0.0 < S_red(1,1).Value() + S_red(2,2).Value() + ( S_red(0,1) + S_red(0,2) + S_red(1,2) ).Value() * 1.9999 | |
306 | + && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() + ( S_red(0,1) - S_red(0,2) - S_red(1,2) ).Value() * 1.9999 | |
307 | + && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() - ( S_red(0,1) - S_red(0,2) + S_red(1,2) ).Value() * 1.9999 | |
308 | + && 0.0 < S_red(1,1).Value() + S_red(2,2).Value() - ( S_red(0,1) + S_red(0,2) - S_red(1,2) ).Value() * 1.9999 ); | |
309 | +#endif | |
310 | +} | |
311 | + | |
312 | + | |
313 | +template<class T> | |
314 | +void putBuergerReducedMonoclinicP(const Int4& i, const Int4& j, | |
315 | + SymMat<T>& S_red, NRMat<Int4>& trans_mat2) | |
316 | +{ | |
317 | + T zerro = 0; | |
318 | + | |
319 | + assert(S_red.size()==3); | |
320 | + assert(trans_mat2.ncols()==3); | |
321 | + assert(i < j); | |
322 | + const Int4 irow = trans_mat2.nrows(); | |
323 | + | |
324 | + if( S_red(i,j) < zerro ) | |
325 | + { | |
326 | + S_red(i,j) *= -1; | |
327 | + for(Int4 l=0; l<irow; l++) | |
328 | + { | |
329 | + trans_mat2[l][i] *= -1; | |
330 | + } | |
331 | + } | |
332 | + | |
333 | + do{ | |
334 | + if( S_red(j,j) < S_red(i,j) * 2 ) | |
335 | + { | |
336 | + // S_red(i,j).Value() <= S_red(j,j).Value() * m | |
337 | + // i : -1 m 0 | |
338 | + // j : 0 1 0 | |
339 | + // : 0 0 1 | |
340 | + const Int8 m = iceil( S_red(i,j) / S_red(j,j) ); | |
341 | + | |
342 | + S_red(i,i) += ( S_red(j,j) * m - S_red(i,j) * 2 ) * m; | |
343 | + assert( !(S_red(i,i) < zerro) ); | |
344 | + S_red(i,j) = S_red(j,j) * m - S_red(i,j); | |
345 | + | |
346 | + for(Int4 l=0; l<irow; l++) | |
347 | + { | |
348 | + trans_mat2[l][j] += trans_mat2[l][i]*m; | |
349 | + } | |
350 | + for(Int4 l=0; l<irow; l++) | |
351 | + { | |
352 | + trans_mat2[l][i] *= -1; | |
353 | + } | |
354 | + } | |
355 | + | |
356 | + if( S_red(i,i) < S_red(i,j) * 2 ) | |
357 | + { | |
358 | + // S_red(i,j).Value() <= S_red(i,i).Value() * n | |
359 | + // i : 1 0 0 | |
360 | + // j : n -1 0 | |
361 | + // : 0 0 1 | |
362 | + const Int8 n = iceil( S_red(i,j) / S_red(i,i) ); | |
363 | + | |
364 | + S_red(j,j) += ( S_red(i,i) * n - S_red(i,j) * 2 ) * n; | |
365 | + assert( !( S_red(j,j) < zerro ) ); | |
366 | + S_red(i,j) = S_red(i,i) * n - S_red(i,j); | |
367 | + | |
368 | + for(Int4 l=0; l<irow; l++) | |
369 | + { | |
370 | + trans_mat2[l][i] += trans_mat2[l][j]*n; | |
371 | + } | |
372 | + for(Int4 l=0; l<irow; l++) | |
373 | + { | |
374 | + trans_mat2[l][j] *= -1; | |
375 | + } | |
376 | + } | |
377 | + } | |
378 | + while( S_red(j,j) < S_red(i,j) * 2 || S_red(i,i) < S_red(i,j) * 2 ); | |
379 | + | |
380 | + if( S_red(i,i) < S_red(j,j) ) | |
381 | + { | |
382 | + const Int4 k = put_complement_set3(i, j); | |
383 | + swap(S_red(i,i), S_red(j,j)); | |
384 | + swap(S_red(i,k), S_red(j,k)); | |
385 | + for(Int4 l=0; l<irow; l++) | |
386 | + { | |
387 | + swap(trans_mat2[l][i], trans_mat2[l][j]); | |
388 | + } | |
389 | + } | |
390 | +} | |
391 | + | |
392 | + | |
393 | +inline Double operator/(const VCData& lhs, const VCData& rhs) | |
394 | +{ | |
395 | + assert(rhs.Value() != 0.0); | |
396 | + return lhs.Value() / rhs.Value(); | |
397 | +} | |
398 | + | |
399 | +template<class T> | |
400 | +void putBuergerReducedMonoclinicB( | |
401 | + const BravaisType& monoclinic_b_type, | |
402 | + SymMat<T>& S_red, NRMat<Int4>& trans_mat2) | |
403 | +{ | |
404 | + const Int4 ibase_axis = monoclinic_b_type.enumBASEaxis(); | |
405 | + const Int4 iabc_axis = monoclinic_b_type.enumABCaxis(); | |
406 | + const Int4 ir = put_complement_set3(iabc_axis, ibase_axis); | |
407 | + | |
408 | + T zerro = 0; | |
409 | + | |
410 | + assert(S_red.size()==3); | |
411 | + assert(trans_mat2.nrows()==0 || trans_mat2.ncols()==3); | |
412 | + const Int4 irow = trans_mat2.nrows(); | |
413 | + | |
414 | + if( S_red( ibase_axis, ir ) < zerro ) | |
415 | + { | |
416 | + S_red( ibase_axis, ir ) *= -1; | |
417 | + for(Int4 l=0; l<irow; l++) | |
418 | + { | |
419 | + trans_mat2[l][ir] *= -1; | |
420 | + } | |
421 | + } | |
422 | + | |
423 | + do{ | |
424 | + if( S_red( ir, ir ) < S_red( ibase_axis, ir ) ) | |
425 | + { | |
426 | + // S_red( ibase_axis, ir ).Value() <= S_red( ir, ir ).Value() * m2 | |
427 | + // ir : 1 0 0 | |
428 | + // ibase_axis : m2 -1 0 | |
429 | + // : 0 0 1 | |
430 | + const Int8 m1 = iceil( ( S_red( ibase_axis, ir ) / S_red( ir, ir ) ) * 0.5 ); | |
431 | + const Int8 m2 = m1*2; | |
432 | + | |
433 | + S_red( ibase_axis, ibase_axis ) += ( S_red( ir, ir ) * m2 - S_red( ibase_axis, ir ) * 2 ) * m2; | |
434 | + assert( !( S_red( ibase_axis, ibase_axis ) < zerro ) ); | |
435 | + S_red( ibase_axis, ir ) = S_red( ir, ir ) * m2 - S_red( ibase_axis, ir ); | |
436 | + | |
437 | + for(Int4 l=0; l<irow; l++) | |
438 | + { | |
439 | + trans_mat2[l][ir] += trans_mat2[l][ibase_axis]*m2; | |
440 | + } | |
441 | + for(Int4 l=0; l<irow; l++) | |
442 | + { | |
443 | + trans_mat2[l][ibase_axis] *= -1; | |
444 | + } | |
445 | + } | |
446 | + | |
447 | + if( S_red( ibase_axis, ibase_axis ) < S_red( ibase_axis, ir ) * 2 ) | |
448 | + { | |
449 | + // S_red( ibase_axis, ir ).Value() <= S_red( ibase_axis, ibase_axis ).Value() * n | |
450 | + // ir :-1 n 0 | |
451 | + // ibase_axis : 0 1 0 | |
452 | + // : 0 0 1 | |
453 | + const Int8 n = iceil( S_red( ibase_axis, ir ) / S_red( ibase_axis, ibase_axis ) ); | |
454 | + | |
455 | + S_red( ir, ir ) += ( S_red( ibase_axis, ibase_axis ) * n - S_red( ibase_axis, ir ) * 2 ) * n; | |
456 | + assert( !( S_red( ir, ir ) < zerro ) ); | |
457 | + S_red( ibase_axis, ir ) = S_red( ibase_axis, ibase_axis ) * n - S_red( ibase_axis, ir ); | |
458 | + | |
459 | + for(Int4 l=0; l<irow; l++) | |
460 | + { | |
461 | + trans_mat2[l][ibase_axis] += trans_mat2[l][ir]*n; | |
462 | + } | |
463 | + for(Int4 l=0; l<irow; l++) | |
464 | + { | |
465 | + trans_mat2[l][ir] *= -1; | |
466 | + } | |
467 | + } | |
468 | + } | |
469 | + while( S_red( ir, ir ) < S_red( ibase_axis, ir ) || S_red( ibase_axis, ibase_axis ) < S_red( ibase_axis, ir ) * 2 ); | |
470 | +} | |
471 | + | |
472 | + | |
473 | +template<class T> | |
474 | +void putBuergerReducedOrthorhombic(const eCentringType& brat, | |
475 | + SymMat<T>& S_red, NRMat<Int4>& trans_mat) | |
476 | +{ | |
477 | + assert( brat != BaseX ); | |
478 | + assert( brat != BaseY ); | |
479 | + | |
480 | + if( brat == BaseZ ) | |
481 | + { | |
482 | + if( S_red(0,0) < S_red(1,1) ) | |
483 | + { | |
484 | + S_red = transform_sym_matrix(put_matrix_YXZ(), S_red); | |
485 | + trans_mat = mprod( trans_mat, put_matrix_YXZ() ); | |
486 | + } | |
487 | + } | |
488 | + else | |
489 | + { | |
490 | + NRMat<Int4> trans_mat2 = identity_matrix<Int4>(3); | |
491 | + moveLargerDiagonalLeftUpper(S_red, trans_mat2); | |
492 | + trans_mat = mprod(trans_mat, transpose(trans_mat2)); // inverse(trans_mat2) = transpose(trans_mat2). | |
493 | + } | |
494 | +} | |
495 | + | |
496 | +#endif /*PUT_MINKOWSKI_REDUCED_LATTICE_HH_*/ |
@@ -27,7 +27,7 @@ | ||
27 | 27 | #include "../utility_data_structure/index_set.hh" |
28 | 28 | #include "../utility_func/transform_sym_matrix.hh" |
29 | 29 | #include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" |
30 | -#include "../utility_lattice_reduction/put_Niggli_reduced_lattice.hh" | |
30 | +#include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh" | |
31 | 31 | #include "../lattice_symmetry/LatticeFigureOfMeritToCheckSymmetry.hh" |
32 | 32 | #include "../lattice_symmetry/ReducedLatticeToCheckBravais.hh" |
33 | 33 | #include "../zerror_type/error_out.hh" |
@@ -140,7 +140,7 @@ | ||
140 | 140 | |
141 | 141 | |
142 | 142 | |
143 | -static SymMat43_Double putTransformMatrixFromSellingReducedToNiggliReduced( | |
143 | +static SymMat43_Double putTransformMatrixFromSellingReducedToBuergerReduced( | |
144 | 144 | const SymMat<Double>& S_super_obtuse) |
145 | 145 | { |
146 | 146 | NRMat<Int4> trans_mat(4,3); |
@@ -147,7 +147,7 @@ | ||
147 | 147 | |
148 | 148 | // S_red = trans_mat * S_super_obtuse * transpose(trans_mat). |
149 | 149 | SymMat<Double> S_red(3); |
150 | - putNiggliReducedMatrix(S_super_obtuse, false, S_red, trans_mat); | |
150 | + putBuergerReducedMatrix(S_super_obtuse, false, S_red, trans_mat); | |
151 | 151 | |
152 | 152 | return SymMat43_Double( S_red, put_transform_matrix_row3to4( Inverse3( trans_mat ) ) ); |
153 | 153 | } |
@@ -180,7 +180,7 @@ | ||
180 | 180 | vector<LatticeFigureOfMeritToCheckSymmetry>& lattice_result_cubic_I = lattice_result[(size_t)Cubic_I]; |
181 | 181 | vector<LatticeFigureOfMeritToCheckSymmetry>& lattice_result_cubic_F = lattice_result[(size_t)Cubic_F]; |
182 | 182 | |
183 | - const SymMat43_Double S_red = putTransformMatrixFromSellingReducedToNiggliReduced(S_super); | |
183 | + const SymMat43_Double S_red = putTransformMatrixFromSellingReducedToBuergerReduced(S_super); | |
184 | 184 | LatticeFigureOfMeritToCheckSymmetry latFOM(BravaisType( pair<eCentringType, ePointGroup>(Prim, Ci) ), S_red); |
185 | 185 | |
186 | 186 | lattice_result_tri.push_back( latFOM ); |
@@ -26,7 +26,7 @@ | ||
26 | 26 | */ |
27 | 27 | #include "../utility_data_structure/FracMat.hh" |
28 | 28 | #include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" |
29 | -#include "../utility_lattice_reduction/put_Niggli_reduced_lattice.hh" | |
29 | +#include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh" | |
30 | 30 | #include "ReducedLatticeToCheckBravais.hh" |
31 | 31 | #include "LatticeFigureOfMerit.hh" |
32 | 32 |
@@ -114,7 +114,7 @@ | ||
114 | 114 | } |
115 | 115 | #endif |
116 | 116 | |
117 | -static void putTransformMatrixToNiggliReduced( | |
117 | +static void putTransformMatrixToBuergerReduced( | |
118 | 118 | const SymMat<Double>& S, NRMat<Int4>& trans_mat) |
119 | 119 | { |
120 | 120 | assert( S.size() == 3 ); |
@@ -126,18 +126,18 @@ | ||
126 | 126 | // S_red = trans_mat * S_super_obtuse * transpose(trans_mat). |
127 | 127 | SymMat<Double> S_red(3); |
128 | 128 | NRMat<Int4> trans_mat2; |
129 | - putNiggliReducedMatrix(S_super_obtuse, S_red, trans_mat2); | |
129 | + putBuergerReducedMatrix(S_super_obtuse, S_red, trans_mat2); | |
130 | 130 | trans_mat = mprod( trans_mat2, put_transform_matrix_row4to3(trans_mat) ); |
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | -void LatticeFigureOfMerit::setInverseOfNiggliReducedForm(NRMat<Int4>& trans_mat, const SymMat43_Double& S_optimized) | |
134 | +void LatticeFigureOfMerit::setInverseOfBuergerReducedForm(NRMat<Int4>& trans_mat, const SymMat43_Double& S_optimized) | |
135 | 135 | { |
136 | 136 | if( m_brat.enumBravaisType() == Triclinic ) |
137 | 137 | { |
138 | - // trans_mat * Inverse(S_optimized.first) * transpose(trans_mat) is Niggli-reduced | |
139 | - // <=> Inverse of transpose(Inverse(trans_mat)) * S_optimized.first * Inverse(trans_mat) is Niggli-reduced. | |
140 | - putTransformMatrixToNiggliReduced(Inverse3(S_optimized.first), trans_mat); | |
138 | + // trans_mat * Inverse(S_optimized.first) * transpose(trans_mat) is Buerger-reduced | |
139 | + // <=> Inverse of transpose(Inverse(trans_mat)) * S_optimized.first * Inverse(trans_mat) is Buerger-reduced. | |
140 | + putTransformMatrixToBuergerReduced(Inverse3(S_optimized.first), trans_mat); | |
141 | 141 | transpose_square_matrix(trans_mat); |
142 | 142 | m_S_red = transform_sym_matrix(Inverse3(trans_mat), S_optimized.first); |
143 | 143 | } |
@@ -149,26 +149,26 @@ | ||
149 | 149 | { |
150 | 150 | if( m_brat.enumPointGroup() == C2h_X ) |
151 | 151 | { |
152 | - putNiggliReducedMonoclinicP(1, 2, m_S_red, trans_mat); | |
152 | + putBuergerReducedMonoclinicP(1, 2, m_S_red, trans_mat); | |
153 | 153 | } |
154 | 154 | else if( m_brat.enumPointGroup() == C2h_Y ) |
155 | 155 | { |
156 | - putNiggliReducedMonoclinicP(0, 2, m_S_red, trans_mat); | |
156 | + putBuergerReducedMonoclinicP(0, 2, m_S_red, trans_mat); | |
157 | 157 | } |
158 | 158 | else //if( m_brat.enumPointGroup() == C2h_Z ) |
159 | 159 | { |
160 | - putNiggliReducedMonoclinicP(0, 1, m_S_red, trans_mat); | |
160 | + putBuergerReducedMonoclinicP(0, 1, m_S_red, trans_mat); | |
161 | 161 | } |
162 | 162 | } |
163 | 163 | else if( m_brat.enumBravaisType() == Monoclinic_B ) |
164 | 164 | { |
165 | 165 | m_S_red = S_optimized.first; |
166 | - putNiggliReducedMonoclinicB(m_brat, m_S_red, trans_mat); | |
166 | + putBuergerReducedMonoclinicB(m_brat, m_S_red, trans_mat); | |
167 | 167 | } |
168 | 168 | else if( m_brat.enumPointGroup() == D2h ) |
169 | 169 | { |
170 | 170 | m_S_red = S_optimized.first; |
171 | - putNiggliReducedOrthorhombic(m_brat.enumCentringType(), m_S_red, trans_mat); | |
171 | + putBuergerReducedOrthorhombic(m_brat.enumCentringType(), m_S_red, trans_mat); | |
172 | 172 | } |
173 | 173 | } |
174 | 174 |
@@ -181,7 +181,7 @@ | ||
181 | 181 | m_brat = brat; |
182 | 182 | |
183 | 183 | NRMat<Int4> trans_mat; |
184 | - setInverseOfNiggliReducedForm(trans_mat, S); // Set m_S_red from S. | |
184 | + setInverseOfBuergerReducedForm(trans_mat, S); // Set m_S_red from S. | |
185 | 185 | } |
186 | 186 | |
187 | 187 |
@@ -27,7 +27,7 @@ | ||
27 | 27 | #include <set> |
28 | 28 | #include "check_equiv.hh" |
29 | 29 | #include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" |
30 | -#include "../utility_lattice_reduction/put_Niggli_reduced_lattice.hh" | |
30 | +#include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh" | |
31 | 31 | #include "../bravais_type/BravaisType.hh" |
32 | 32 | #include "lattice_symmetry.hh" |
33 | 33 |
@@ -37,7 +37,7 @@ | ||
37 | 37 | private: |
38 | 38 | LatticeFigureOfMerit m_latfom; |
39 | 39 | |
40 | - // m_S_red.first is Niggli-reduced. | |
40 | + // m_S_red.first is Buerger-reduced. | |
41 | 41 | // m_S_red.second * m_S_red.first * Transpose(m_S_red.second) is Selling-reduced. |
42 | 42 | SymMat43_Double m_S_red; |
43 | 43 |
@@ -55,14 +55,14 @@ | ||
55 | 55 | |
56 | 56 | // On input, inv_flag = false indicates that S_super_obtuse_equiv is Selling-reduced, |
57 | 57 | // and inv_flag = true indicates that Inverse(S_super_obtuse_equiv) is Selling-reduced. |
58 | - // In the former case, on output, S_red_body are symmetric matrices having a body-centered and Niggli-reduced inverse. | |
59 | - // In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Niggli-reduced inverse. | |
60 | - static void put_S_Niggli_reduced_IF( | |
58 | + // In the former case, on output, S_red_body are symmetric matrices having a body-centered and Buerger-reduced inverse. | |
59 | + // In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Buerger-reduced inverse. | |
60 | + static void put_S_Buerger_reduced_IF( | |
61 | 61 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
62 | 62 | map< SymMat<Double>, NRMat<Int4> >& S_red_IF, |
63 | 63 | const bool& inv_flag); |
64 | 64 | |
65 | - static void put_S_Niggli_reduced_rhom( | |
65 | + static void put_S_Buerger_reduced_rhom( | |
66 | 66 | const BravaisType& rhombohedral_type, |
67 | 67 | const bool& does_prudent_sym_search, |
68 | 68 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
@@ -69,8 +69,8 @@ | ||
69 | 69 | map< SymMat<Double>, NRMat<Int4> >& S_red_rhomhex); |
70 | 70 | |
71 | 71 | // On input, S_super_obtuse_equiv is Selling-reduced. |
72 | - // On output, S_red_base are symmetric matrices having a base-centered and Niggli-reduced inverse. | |
73 | - static void put_S_Niggli_reduced_base( | |
72 | + // On output, S_red_base are symmetric matrices having a base-centered and Buerger-reduced inverse. | |
73 | + static void put_S_Buerger_reduced_base( | |
74 | 74 | const BravaisType& monoclinic_b_type, |
75 | 75 | const bool& does_prudent_sym_search, |
76 | 76 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
@@ -49,7 +49,7 @@ | ||
49 | 49 | |
50 | 50 | BravaisType m_brat; |
51 | 51 | |
52 | - // The inverse of m_S_red is Niggli-reduced. | |
52 | + // The inverse of m_S_red is Buerger-reduced. | |
53 | 53 | SymMat<Double> m_S_red; |
54 | 54 | |
55 | 55 | static void putLatticeConstantsDegree(const BravaisType& brat, |
@@ -59,7 +59,7 @@ | ||
59 | 59 | VecDat3<Double>& length, VecDat3<Double>& angle); |
60 | 60 | // Set m_S_red from S. |
61 | 61 | // On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) equals the original S. |
62 | - void setInverseOfNiggliReducedForm(NRMat<Int4>& trans_mat, const SymMat43_Double& S); | |
62 | + void setInverseOfBuergerReducedForm(NRMat<Int4>& trans_mat, const SymMat43_Double& S); | |
63 | 63 | |
64 | 64 | public: |
65 | 65 | LatticeFigureOfMerit(); |
@@ -98,8 +98,8 @@ | ||
98 | 98 | inline const eBravaisType& enumBravaisType() const { return m_brat.enumBravaisType(); }; |
99 | 99 | inline const BravaisType& putBravaisType() const { return m_brat; }; |
100 | 100 | |
101 | - // The returned matrix is Niggli-reduced matrix equivalent with m_S_red_optimized. | |
102 | - inline const SymMat<Double>& putInverseOfNiggliReducedForm() const { return m_S_red; }; | |
101 | + // The returned matrix is Buerger-reduced matrix equivalent with m_S_red_optimized. | |
102 | + inline const SymMat<Double>& putInverseOfBuergerReducedForm() const { return m_S_red; }; | |
103 | 103 | }; |
104 | 104 | |
105 | 105 |
@@ -107,7 +107,7 @@ | ||
107 | 107 | const eABCaxis& axis1, |
108 | 108 | const eRHaxis& axis2, VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
109 | 109 | { |
110 | - putLatticeConstantsDegree( m_brat, this->putInverseOfNiggliReducedForm(), | |
110 | + putLatticeConstantsDegree( m_brat, this->putInverseOfBuergerReducedForm(), | |
111 | 111 | axis1, axis2, length_axis, angle_axis ); |
112 | 112 | } |
113 | 113 |
@@ -25,7 +25,7 @@ | ||
25 | 25 | * |
26 | 26 | */ |
27 | 27 | #include <limits> |
28 | -#include "../utility_lattice_reduction/put_Niggli_reduced_lattice.hh" | |
28 | +#include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh" | |
29 | 29 | #include "check_equiv.hh" |
30 | 30 | #include "LatticeFigureOfMeritToCheckSymmetry.hh" |
31 | 31 |
@@ -160,19 +160,19 @@ | ||
160 | 160 | { |
161 | 161 | S_red = ans0; |
162 | 162 | trans_mat2 = m_S_red.second; |
163 | - putNiggliReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
163 | + putBuergerReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
164 | 164 | } |
165 | 165 | else if( epg_new == C2h_Y ) |
166 | 166 | { |
167 | 167 | S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
168 | 168 | trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
169 | - putNiggliReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
169 | + putBuergerReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
170 | 170 | } |
171 | 171 | else // if( epg_new == C2h_Z ) |
172 | 172 | { |
173 | 173 | S_red = transform_sym_matrix(put_matrix_YZX(), ans0); |
174 | 174 | trans_mat2 = mprod(m_S_red.second, put_matrix_ZXY()); |
175 | - putNiggliReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
175 | + putBuergerReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
176 | 176 | } |
177 | 177 | ans.insert( SymMat43_Double( S_red, trans_mat2) ); |
178 | 178 | } |
@@ -185,19 +185,19 @@ | ||
185 | 185 | { |
186 | 186 | S_red = transform_sym_matrix(put_matrix_YXZ(), ans0); |
187 | 187 | trans_mat2 = mprod(m_S_red.second, put_matrix_YXZ()); |
188 | - putNiggliReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
188 | + putBuergerReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
189 | 189 | } |
190 | 190 | else if( epg_new == C2h_Y ) |
191 | 191 | { |
192 | 192 | S_red = ans0; |
193 | 193 | trans_mat2 = m_S_red.second; |
194 | - putNiggliReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
194 | + putBuergerReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
195 | 195 | } |
196 | 196 | else // if( epg_new == C2h_Z ) |
197 | 197 | { |
198 | 198 | S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
199 | 199 | trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
200 | - putNiggliReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
200 | + putBuergerReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
201 | 201 | } |
202 | 202 | ans.insert( SymMat43_Double( S_red, trans_mat2) ); |
203 | 203 | } |
@@ -210,19 +210,19 @@ | ||
210 | 210 | { |
211 | 211 | S_red = transform_sym_matrix(put_matrix_ZXY(), ans0); |
212 | 212 | trans_mat2 = mprod(m_S_red.second, put_matrix_YZX()); |
213 | - putNiggliReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
213 | + putBuergerReducedMonoclinicP(1, 2, S_red, trans_mat2); | |
214 | 214 | } |
215 | 215 | else if( epg_new == C2h_Y ) |
216 | 216 | { |
217 | 217 | S_red = transform_sym_matrix(put_matrix_XZY(), ans0); |
218 | 218 | trans_mat2 = mprod(m_S_red.second, put_matrix_XZY()); |
219 | - putNiggliReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
219 | + putBuergerReducedMonoclinicP(0, 2, S_red, trans_mat2); | |
220 | 220 | } |
221 | 221 | else // if( epg_new == C2h_Z ) |
222 | 222 | { |
223 | 223 | S_red = ans0; |
224 | 224 | trans_mat2 = m_S_red.second; |
225 | - putNiggliReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
225 | + putBuergerReducedMonoclinicP(0, 1, S_red, trans_mat2); | |
226 | 226 | } |
227 | 227 | ans.insert( SymMat43_Double( S_red, trans_mat2) ); |
228 | 228 | } |
@@ -278,7 +278,7 @@ | ||
278 | 278 | else |
279 | 279 | { |
280 | 280 | NRMat<Int4> trans_mat = m_S_red.second; |
281 | - putNiggliReducedOrthorhombic(brat.enumCentringType(), ans0, trans_mat); | |
281 | + putBuergerReducedOrthorhombic(brat.enumCentringType(), ans0, trans_mat); | |
282 | 282 | ans.insert( SymMat43_Double(ans0, trans_mat ) ); |
283 | 283 | } |
284 | 284 | return true; |
@@ -26,7 +26,7 @@ | ||
26 | 26 | */ |
27 | 27 | #include "check_equiv.hh" |
28 | 28 | #include "ReducedLatticeToCheckBravais.hh" |
29 | -#include "../utility_lattice_reduction/put_Niggli_reduced_lattice.hh" | |
29 | +#include "../utility_lattice_reduction/put_Buerger_reduced_lattice.hh" | |
30 | 30 | #include "../utility_lattice_reduction/put_Selling_reduced_lattice.hh" |
31 | 31 | #include "../utility_func/zmath.hh" |
32 | 32 | #include "../utility_data_structure/FracMat.hh" |
@@ -637,9 +637,9 @@ | ||
637 | 637 | m_rhombohedral_type(put_rhombohedral_type(axis2)), |
638 | 638 | m_S_super_obtuse( transform_sym_matrix(S_red.second, S_red.first) ) |
639 | 639 | { |
640 | - put_S_Niggli_reduced_IF(resol, m_S_super_obtuse, m_S_red_body, false); | |
641 | - put_S_Niggli_reduced_base(m_monoclinic_b_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_base); | |
642 | - put_S_Niggli_reduced_rhom(m_rhombohedral_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_rhom); | |
640 | + put_S_Buerger_reduced_IF(resol, m_S_super_obtuse, m_S_red_body, false); | |
641 | + put_S_Buerger_reduced_base(m_monoclinic_b_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_base); | |
642 | + put_S_Buerger_reduced_rhom(m_rhombohedral_type, does_prudent_sym_search, resol, m_S_super_obtuse, m_S_red_rhom); | |
643 | 643 | |
644 | 644 | const SymMat<Double> S_super_obtuse3( put_sym_matrix_sizeNplus1toN(m_S_super_obtuse) ); |
645 | 645 | const SymMat<Double> inv_S( Inverse3( S_super_obtuse3 ) ); |
@@ -657,7 +657,7 @@ | ||
657 | 657 | const SymMat<Double> S_inv_super_obtuse |
658 | 658 | = put_sym_matrix_sizeNtoNplus1( transform_sym_matrix( Inverse3(tmat_inv_S_super_obtuse), S_super_obtuse3 ) ); |
659 | 659 | |
660 | - put_S_Niggli_reduced_IF(resol, S_inv_super_obtuse, m_S_red_face, true); | |
660 | + put_S_Buerger_reduced_IF(resol, S_inv_super_obtuse, m_S_red_face, true); | |
661 | 661 | |
662 | 662 | for(map< SymMat<Double>, NRMat<Int4> >::iterator it=m_S_red_face.begin(); it!=m_S_red_face.end(); it++) |
663 | 663 | { |
@@ -673,9 +673,9 @@ | ||
673 | 673 | |
674 | 674 | // On input, inv_flag = false indicates that S_super_obtuse_equiv is Selling-reduced, |
675 | 675 | // and inv_flag = true indicates that Inverse(S_super_obtuse_equiv) is Selling-reduced. |
676 | -// In the former case, on output, S_red_body are symmetric matrices having a body-centered and Niggli-reduced inverse. | |
677 | -// In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Niggli-reduced inverse. | |
678 | -void ReducedLatticeToCheckBravais::put_S_Niggli_reduced_IF( | |
676 | +// In the former case, on output, S_red_body are symmetric matrices having a body-centered and Buerger-reduced inverse. | |
677 | +// In the latter case, on output, S_red_IF are symmetric matrices having a face-centered and Buerger-reduced inverse. | |
678 | +void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_IF( | |
679 | 679 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
680 | 680 | map< SymMat<Double>, NRMat<Int4> >& S_red_IF, |
681 | 681 | const bool& inv_flag) |
@@ -703,7 +703,7 @@ | ||
703 | 703 | } |
704 | 704 | } |
705 | 705 | |
706 | -void ReducedLatticeToCheckBravais::put_S_Niggli_reduced_rhom( | |
706 | +void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_rhom( | |
707 | 707 | const BravaisType& rhombohedral_type, |
708 | 708 | const bool& does_prudent_sym_search, |
709 | 709 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
@@ -731,9 +731,9 @@ | ||
731 | 731 | } |
732 | 732 | |
733 | 733 | |
734 | -// On input, S_red is Niggli-reduced and S_super_obtuse_equiv is Selling-reduced. | |
735 | -// On output, S_red_base are symmetric matrices having a base-centered and Niggli-reduced inverse. | |
736 | -void ReducedLatticeToCheckBravais::put_S_Niggli_reduced_base( | |
734 | +// On input, S_red is Buerger-reduced and S_super_obtuse_equiv is Selling-reduced. | |
735 | +// On output, S_red_base are symmetric matrices having a base-centered and Buerger-reduced inverse. | |
736 | +void ReducedLatticeToCheckBravais::put_S_Buerger_reduced_base( | |
737 | 737 | const BravaisType& monoclinic_b_type, |
738 | 738 | const bool& does_prudent_sym_search, |
739 | 739 | const Double& resol, const SymMat<Double>& S_super_obtuse, |
@@ -758,7 +758,7 @@ | ||
758 | 758 | if( !check_equiv_m(S2_red0, S2_red, resol) ) continue; |
759 | 759 | |
760 | 760 | tmat = put_transform_matrix_row3to4(it->first); |
761 | - putNiggliReducedMonoclinicB(monoclinic_b_type, S2_red, tmat); | |
761 | + putBuergerReducedMonoclinicB(monoclinic_b_type, S2_red, tmat); | |
762 | 762 | |
763 | 763 | S_red_base.insert( SymMat43_Double(S2_red, tmat) ); |
764 | 764 | } |
@@ -94,14 +94,14 @@ | ||
94 | 94 | return value; |
95 | 95 | } |
96 | 96 | |
97 | -inline Int4 iceil(const Double& num) | |
97 | +inline Int8 iceil(const Double& num) | |
98 | 98 | { |
99 | - return rint( ceil(num) ); | |
99 | + return lrint( ceil(num) ); | |
100 | 100 | } |
101 | 101 | |
102 | -inline Int4 ifloor(const Double& num) | |
102 | +inline Int8 ifloor(const Double& num) | |
103 | 103 | { |
104 | - return rint( floor(num) ); | |
104 | + return lrint( floor(num) ); | |
105 | 105 | } |
106 | 106 | |
107 | 107 | #endif /*MATH_HH_*/ |