1
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick
5 ** All rights reserved.
6 ** Contact: chuebsch@moliso.de
7 **
8 ** This file is part of the ShelXle
9 **
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file COPYING included in the
13 ** packaging of this file. Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 **
18 ****************************************************************************/
19 #include <molecule.h>
20 #include <QtOpenGL>
21 #include <QGLWidget>
22 #include "partcolor.h"
23 const double g2r=180.0/M_PI;
24 #include "itsme.h"
Molecule()25 Molecule::Molecule(){
26 proba=50;
27 program_in_use=false;
28 useShaders=true;
29 mist=false;
30 g_program=0;
31 g_Program=nullptr;
32 shaders_work=false;
33 qPeakRad=0.05;
34 growQPeak=false;
35 tubes=0;
36 planeTransparence=0.25;
37 qboMin=0.97;
38 qboMax=1.67;
39 HAWink=135;
40 HAMax=2.5;
41 dratom=0;
42 LOD=4;
43 highlightEquivalents = true;
44 mQolor=QColor(128,76,76);
45 monoQrom=false;
46 nopm1=false;
47 bondColorStyle=0;
48 bondStrength=0.05;
49 beloRad=0.04;
50 noQPeaksPlease=false;
51 HFixSuitableAtomsOnly=false;
52 for (int i=0,j=0; i<18; i++){
53 if ((i>5)&&(j%5==0)) j++;
54 int colori=27+j;
55 symmColors.append(QColor::colorNames().at(colori));
56 j++;
57 }
58 theseAreAcceptors.append(6);//NOF
59 theseAreAcceptors.append(7);
60 theseAreAcceptors.append(8);
61
62 theseAreDonors.append(5);//CNOF
63 theseAreDonors.append(6);
64 theseAreDonors.append(7);
65 theseAreDonors.append(8);
66 //QList<int> theseAreDonors;
67 beloColor= QColor("teal");
68 beloColorByDefden=true;
69 beloLabels=true;
70 //nonPositiveDefinite=0;
71 Kovalenz_Radien[0 ]=32 ;Kovalenz_Radien[1 ]=1 ;Kovalenz_Radien[2 ]=123 ;Kovalenz_Radien[3 ]=90 ;
72 Kovalenz_Radien[4 ]=80 ;Kovalenz_Radien[5 ]=77 ;Kovalenz_Radien[6 ]=74 ;Kovalenz_Radien[7 ]=66 ;
73 Kovalenz_Radien[8 ]=72 ;Kovalenz_Radien[9 ]=1 ;Kovalenz_Radien[10 ]=154 ;Kovalenz_Radien[11 ]=149 ;
74 Kovalenz_Radien[12 ]=118 ;Kovalenz_Radien[13 ]=111 ;Kovalenz_Radien[14 ]=106 ;Kovalenz_Radien[15 ]=102 ;
75 Kovalenz_Radien[16 ]=99 ;Kovalenz_Radien[17 ]=1 ;Kovalenz_Radien[18 ]=203 ;Kovalenz_Radien[19 ]=174 ;
76 Kovalenz_Radien[20 ]=144 ;Kovalenz_Radien[21 ]=132 ;Kovalenz_Radien[22 ]=122 ;Kovalenz_Radien[23 ]=118 ;
77 Kovalenz_Radien[24 ]=117 ;Kovalenz_Radien[25 ]=117 ;Kovalenz_Radien[26 ]=116 ;Kovalenz_Radien[27 ]=124 ;
78 Kovalenz_Radien[28 ]=117 ;Kovalenz_Radien[29 ]=125 ;Kovalenz_Radien[30 ]=126 ;Kovalenz_Radien[31 ]=122 ;
79 Kovalenz_Radien[32 ]=120 ;Kovalenz_Radien[33 ]=116 ;Kovalenz_Radien[34 ]=114 ;Kovalenz_Radien[35 ]=1 ;
80 Kovalenz_Radien[36 ]=218 ;Kovalenz_Radien[37 ]=191 ;Kovalenz_Radien[38 ]=162 ;Kovalenz_Radien[39 ]=145 ;
81 Kovalenz_Radien[40 ]=134 ;Kovalenz_Radien[41 ]=130 ;Kovalenz_Radien[42 ]=127 ;Kovalenz_Radien[43 ]=125 ;
82 Kovalenz_Radien[44 ]=125 ;Kovalenz_Radien[45 ]=128 ;Kovalenz_Radien[46 ]=134 ;Kovalenz_Radien[47 ]=148 ;
83 Kovalenz_Radien[48 ]=144 ;Kovalenz_Radien[49 ]=141 ;Kovalenz_Radien[50 ]=140 ;Kovalenz_Radien[51 ]=136 ;
84 Kovalenz_Radien[52 ]=133 ;Kovalenz_Radien[53 ]=1 ;Kovalenz_Radien[54 ]=235 ;Kovalenz_Radien[55 ]=198 ;
85 Kovalenz_Radien[56 ]=169 ;Kovalenz_Radien[57 ]=165 ;Kovalenz_Radien[58 ]=165 ;Kovalenz_Radien[59 ]=164 ;
86 Kovalenz_Radien[60 ]=164 ;Kovalenz_Radien[61 ]=162 ;Kovalenz_Radien[62 ]=185 ;Kovalenz_Radien[63 ]=161 ;
87 Kovalenz_Radien[64 ]=159 ;Kovalenz_Radien[65 ]=159 ;Kovalenz_Radien[66 ]=157 ;Kovalenz_Radien[67 ]=157 ;
88 Kovalenz_Radien[68 ]=156 ;Kovalenz_Radien[69 ]=170 ;Kovalenz_Radien[70 ]=156 ;Kovalenz_Radien[71 ]=144 ;
89 Kovalenz_Radien[72 ]=134 ;Kovalenz_Radien[73 ]=130 ;Kovalenz_Radien[74 ]=128 ;Kovalenz_Radien[75 ]=126 ;
90 Kovalenz_Radien[76 ]=127 ;Kovalenz_Radien[77 ]=130 ;Kovalenz_Radien[78 ]=134 ;Kovalenz_Radien[79 ]=149 ;
91 Kovalenz_Radien[80 ]=148 ;Kovalenz_Radien[81 ]=147 ;Kovalenz_Radien[82 ]=146 ;Kovalenz_Radien[83 ]=146 ;
92 Kovalenz_Radien[84 ]=145 ;Kovalenz_Radien[85 ]=1 ;Kovalenz_Radien[86 ]=0 ;Kovalenz_Radien[87 ]=1 ;
93 Kovalenz_Radien[88 ]=188 ;Kovalenz_Radien[89 ]=165 ;Kovalenz_Radien[90 ]=161 ;Kovalenz_Radien[91 ]=142 ;
94 Kovalenz_Radien[92 ]=130 ;Kovalenz_Radien[93 ]=151 ;Kovalenz_Radien[94 ]=182 ;
95 //printf("Kovalenz_Radien H hat :%d \n",Kovalenz_Radien[0]);
96 /* //EN{
97 ElNeg[0]=220; ElNeg[1]=550; ElNeg[2]= 97; ElNeg[3]=147;
98 ElNeg[4]=201; ElNeg[5]=250; ElNeg[6]=307; ElNeg[7]=350;
99 ElNeg[8]=410; ElNeg[9]=480; ElNeg[10]=101;ElNeg[11]=123;
100 ElNeg[12]=147;ElNeg[13]=174;ElNeg[14]=206;ElNeg[15]=244;
101 ElNeg[16]=283;ElNeg[17]=320;ElNeg[18]= 91;ElNeg[19]=104;
102 ElNeg[20]=120;ElNeg[21]=132;ElNeg[22]=145;ElNeg[23]=156;
103 ElNeg[24]=160;ElNeg[25]=164;ElNeg[26]=170;ElNeg[27]=175;
104 ElNeg[28]=175;ElNeg[29]=166;ElNeg[30]=182;ElNeg[31]=202;
105 ElNeg[32]=220;ElNeg[33]=248;ElNeg[34]=274;ElNeg[35]=290;
106 ElNeg[36]= 89;ElNeg[37]= 99;ElNeg[38]=111;ElNeg[39]=122;
107 ElNeg[40]=123;ElNeg[41]=130;ElNeg[42]=136;ElNeg[43]=142;
108 ElNeg[44]=145;ElNeg[45]=130;ElNeg[46]=142;ElNeg[47]=146;
109 ElNeg[48]=149;ElNeg[49]=172;ElNeg[50]=182;ElNeg[51]=201;
110 ElNeg[52]=221;ElNeg[53]=240;ElNeg[54]= 86;ElNeg[55]= 97;
111 ElNeg[56]=108;ElNeg[57]=108;ElNeg[58]=107;ElNeg[59]=107;
112 ElNeg[60]=107;ElNeg[61]=107;ElNeg[62]=110;ElNeg[63]=111;
113 ElNeg[64]=110;ElNeg[65]=110;ElNeg[66]=110;ElNeg[67]=111;
114 ElNeg[68]=111;ElNeg[69]=106;ElNeg[70]=114;ElNeg[71]=123;
115 ElNeg[72]=133;ElNeg[73]=140;ElNeg[74]=146;ElNeg[75]=152;
116 ElNeg[76]=155;ElNeg[77]=142;ElNeg[78]=142;ElNeg[79]=144;
117 ElNeg[80]=144;ElNeg[81]=155;ElNeg[82]=167;
118 */
119 for (int i=0; i<103; i++){
120 if (i<95) arad[i]=(i)?Kovalenz_Radien[i]/(250.0):Kovalenz_Radien[i]/(500.0);
121 else arad[i]=0.5;
122 AtomStyle[i]=ATOM_STYLE_WALLS|ATOM_STYLE_RINGS|ATOM_STYLE_SPHERE;
123
124 switch (i){
125 case 0://H
126 AtomColor[i]=QColor(Qt::white).darker(20);
127 break;
128 case 2://Li
129 AtomColor[i]=QColor(Qt::darkRed);
130 AtomStyle[i]|=ATOM_STYLE_METAL;
131 break;
132 case 3://Be
133 AtomColor[i]=QColor("silver");
134 AtomStyle[i]|=ATOM_STYLE_METAL;
135 break;
136 case 4://B
137 AtomColor[i]=QColor(Qt::darkBlue);
138 break;
139 case 5://C
140 AtomColor[i]=QColor("#242424");
141 AtomStyle[i]|=ATOM_STYLE_WHITERING;
142 break;
143 case 6://N
144 AtomColor[i]=QColor(Qt::blue);
145 AtomStyle[i]|=ATOM_STYLE_WHITERING;
146 break;
147 case 7://O
148 AtomColor[i]=QColor(Qt::red);
149 AtomStyle[i]|=ATOM_STYLE_WHITERING;
150 break;
151 case 8://F
152 AtomColor[i]=QColor("chartreuse");
153 break;
154 case 9://ne
155 AtomColor[i]=QColor(192,192,192,128);
156 AtomStyle[i]|=ATOM_STYLE_METAL;
157 break;
158 case 10://na
159 AtomColor[i]=QColor(239,154,251,128);
160 AtomStyle[i]|=ATOM_STYLE_METAL;
161 break;
162 case 11://mg
163 AtomColor[i]=QColor(51,153,255,128);
164 AtomStyle[i]|=ATOM_STYLE_METAL;
165 break;
166 case 12://al
167 AtomColor[i]=QColor(102,179,255,128);
168 break;
169 case 13://si
170 AtomColor[i]=QColor(128,128,128,128);
171 break;
172 case 14://p
173 AtomColor[i]=QColor(183,41,244,128);
174 break;
175 case 15://s
176 AtomColor[i]=QColor(190,190,0,128);
177 break;
178 case 16://cl
179 AtomColor[i]=QColor( 65,111, 65,128);
180 AtomStyle[i]|=ATOM_STYLE_METAL;
181 break;
182
183 case 18://k
184 AtomColor[i]=QColor(192,46,180,128);
185 AtomStyle[i]|=ATOM_STYLE_METAL;
186 break;
187 case 19://ca
188 AtomColor[i]=QColor(170,170,128,128);
189 AtomStyle[i]|=ATOM_STYLE_METAL;
190 break;
191 case 20:
192 AtomColor[i]=QColor(236,136,171,128);
193 AtomStyle[i]|=ATOM_STYLE_METAL;
194 break;
195 case 21:
196 AtomColor[i]=QColor(242,59,3,128);
197 AtomStyle[i]|=ATOM_STYLE_METAL;
198 break;
199 case 22:
200 AtomColor[i]=QColor(100,128,0,128);
201 AtomStyle[i]|=ATOM_STYLE_METAL;
202 break;
203 case 23:
204 AtomColor[i]=QColor(255,255,0,128);
205 AtomStyle[i]|=ATOM_STYLE_METAL;
206 break;
207 case 24:
208 AtomColor[i]=QColor(204,153,153,128);
209 AtomStyle[i]|=ATOM_STYLE_METAL;
210 break;
211 case 25:
212 AtomColor[i]=QColor(0,162,0,128);
213 AtomStyle[i]|=ATOM_STYLE_METAL;
214 break;
215 case 26:
216 AtomColor[i]=QColor(109,0,109,128);
217 AtomStyle[i]|=ATOM_STYLE_METAL;
218 break;
219 case 27:
220 AtomColor[i]=QColor(170,82,64,128);
221 AtomStyle[i]|=ATOM_STYLE_METAL;
222 break;
223 case 28://Cu
224 AtomColor[i]=QColor("salmon");
225 AtomStyle[i]|=ATOM_STYLE_METAL;
226
227 break;
228 case 29:
229 AtomColor[i]=QColor(63,123,111,128);
230 AtomStyle[i]|=ATOM_STYLE_METAL;
231 break;
232 case 30:
233 AtomColor[i]=QColor(78,254,208,128);
234 AtomStyle[i]|=ATOM_STYLE_METAL;
235 break;
236 case 31:
237 AtomColor[i]=QColor(136,136,136,128);
238 AtomStyle[i]|=ATOM_STYLE_METAL;
239 break;
240 case 32:
241 AtomColor[i]=QColor(191,218,255,128);
242 break;
243 case 33:
244 AtomColor[i]=QColor(90,23,23,128);
245 break;
246 case 34:
247 AtomColor[i]=QColor(222,188,133,128);
248 break;
249 case 35:
250 AtomColor[i]=QColor(240,120,0,128);
251 break;
252 case 36:
253 AtomColor[i]=QColor(50,15,0,128);
254 AtomStyle[i]|=ATOM_STYLE_METAL;
255 break;
256 case 37:
257 AtomColor[i]=QColor(192,192,192,128);
258 AtomStyle[i]|=ATOM_STYLE_METAL;
259 break;
260 case 38:
261 AtomColor[i]=QColor(204,113,32,128);
262 AtomStyle[i]|=ATOM_STYLE_METAL;
263 break;
264 case 39:
265 AtomColor[i]=QColor(236,97,59,128);
266 AtomStyle[i]|=ATOM_STYLE_METAL;
267 break;
268 case 40:
269 AtomColor[i]=QColor("silver");
270 AtomStyle[i]|=ATOM_STYLE_METAL;
271 break;
272 case 41:
273 AtomColor[i]=QColor("silver");
274 AtomStyle[i]|=ATOM_STYLE_METAL;
275 break;
276 case 42:
277 AtomColor[i]=QColor("silver");
278 AtomStyle[i]|=ATOM_STYLE_METAL;
279 break;
280 case 43:
281 AtomColor[i]=QColor("silver");
282 AtomStyle[i]|=ATOM_STYLE_METAL;
283 break;
284 case 44:
285 AtomColor[i]=QColor("silver");
286 AtomStyle[i]|=ATOM_STYLE_METAL;
287 break;
288 case 45:
289 AtomColor[i]=QColor("silver");
290 AtomStyle[i]|=ATOM_STYLE_METAL;
291 break;
292 case 46:
293 AtomColor[i]=QColor("silver");
294 AtomStyle[i]|=ATOM_STYLE_METAL;
295 break;
296 case 47:
297 AtomColor[i]=QColor("silver");
298 AtomStyle[i]|=ATOM_STYLE_METAL;
299 break;
300 case 48:
301 AtomColor[i]=QColor("silver");
302 AtomStyle[i]|=ATOM_STYLE_METAL;
303 break;
304 case 49:
305 AtomColor[i]=QColor("silver");
306 AtomStyle[i]|=ATOM_STYLE_METAL;
307 break;
308 case 54:
309 AtomColor[i]=QColor("silver");
310 AtomStyle[i]|=ATOM_STYLE_METAL;
311 break;
312 case 55:
313 AtomColor[i]=QColor("silver");
314 AtomStyle[i]|=ATOM_STYLE_METAL;
315 break;
316 case 56:
317 AtomColor[i]=QColor("silver");
318 AtomStyle[i]|=ATOM_STYLE_METAL;
319 break;
320 case 57:
321 AtomColor[i]=QColor("silver");
322 AtomStyle[i]|=ATOM_STYLE_METAL;
323 break;
324 case 58:
325 AtomColor[i]=QColor("silver");
326 AtomStyle[i]|=ATOM_STYLE_METAL;
327 break;
328 case 59:
329 AtomColor[i]=QColor("silver");
330 AtomStyle[i]|=ATOM_STYLE_METAL;
331 break;
332 case 61:
333 AtomColor[i]=QColor("silver");
334 AtomStyle[i]|=ATOM_STYLE_METAL;
335 break;
336 case 62:
337 AtomColor[i]=QColor("silver");
338 AtomStyle[i]|=ATOM_STYLE_METAL;
339 break;
340 case 63:
341 AtomColor[i]=QColor("silver");
342 AtomStyle[i]|=ATOM_STYLE_METAL;
343 break;
344 case 67:
345 AtomColor[i]=QColor("silver");
346 AtomStyle[i]|=ATOM_STYLE_METAL;
347 break;
348 case 68:
349 AtomColor[i]=QColor("silver");
350 AtomStyle[i]|=ATOM_STYLE_METAL;
351 break;
352 case 69:
353 AtomColor[i]=QColor("silver");
354 AtomStyle[i]|=ATOM_STYLE_METAL;
355 break;
356 case 70:
357 AtomColor[i]=QColor("silver");
358 AtomStyle[i]|=ATOM_STYLE_METAL;
359 break;
360 case 71:
361 AtomColor[i]=QColor("silver");
362 AtomStyle[i]|=ATOM_STYLE_METAL;
363 break;
364 case 72:
365 AtomColor[i]=QColor("silver");
366 AtomStyle[i]|=ATOM_STYLE_METAL;
367 break;
368 case 73:
369 AtomColor[i]=QColor("silver");
370 AtomStyle[i]|=ATOM_STYLE_METAL;
371 break;
372 case 74:
373 AtomColor[i]=QColor("silver");
374 AtomStyle[i]|=ATOM_STYLE_METAL;
375 break;
376 case 75:
377 AtomColor[i]=QColor("silver");
378 AtomStyle[i]|=ATOM_STYLE_METAL;
379 break;
380 case 76:
381 AtomColor[i]=QColor("silver");
382 AtomStyle[i]|=ATOM_STYLE_METAL;
383 break;
384 case 77:
385 AtomColor[i]=QColor("silver");
386 AtomStyle[i]|=ATOM_STYLE_METAL;
387 break;
388 case 79:
389 AtomStyle[i]|=ATOM_STYLE_METAL;
390 AtomColor[i]=QColor("silver");
391 break;
392 case 80:
393 AtomStyle[i]|=ATOM_STYLE_METAL;
394 AtomColor[i]=QColor("silver");
395 break;
396 case 81:
397 AtomStyle[i]|=ATOM_STYLE_METAL;
398 AtomColor[i]=QColor("silver");
399 break;
400 case 82:
401 AtomColor[i]=QColor("silver");
402 AtomStyle[i]|=ATOM_STYLE_METAL;
403 break;
404 case 83:
405 AtomColor[i]=QColor("silver");
406 AtomStyle[i]|=ATOM_STYLE_METAL;
407 break;
408 case 86:
409 AtomStyle[i]|=ATOM_STYLE_METAL;
410 AtomColor[i]=QColor("silver");
411 break;
412 case 87:
413 AtomColor[i]=QColor("silver");
414 AtomStyle[i]|=ATOM_STYLE_METAL;
415 break;
416 case 88:
417 AtomColor[i]=QColor("silver");
418 AtomStyle[i]|=ATOM_STYLE_METAL;
419 break;
420 case 89:
421 AtomColor[i]=QColor("silver");
422 AtomStyle[i]|=ATOM_STYLE_METAL;
423 break;
424 case 91:
425 AtomColor[i]=QColor("silver");
426 AtomStyle[i]|=ATOM_STYLE_METAL;
427 break;
428 case 92:
429 AtomColor[i]=QColor("silver");
430 AtomStyle[i]|=ATOM_STYLE_METAL;
431 break;
432 case 93:
433 AtomColor[i]=QColor("silver");
434 AtomStyle[i]|=ATOM_STYLE_METAL;
435 break;
436 case 97:
437 AtomColor[i]=QColor("silver");
438 AtomStyle[i]|=ATOM_STYLE_METAL;
439 break;
440
441 case 78://Au
442 AtomColor[i]=QColor("goldenrod");
443 AtomStyle[i]|=ATOM_STYLE_METAL;
444
445 break;
446 default:
447 AtomColor[i]=QColor("silver");
448 break;
449 }
450 AtomColor[i].setAlpha(127);
451 }
452 AtomStyle[0]=ATOM_STYLE_SPHERE|ATOM_STYLE_NOLABEL|ATOM_STYLE_NOADP;
453 PSE<<"H"<<"He"<<"Li"<<"Be"<<"B"<<"C"<<"N"<<"O"<<"F"<<"Ne"<<"Na"<<"Mg"<<"Al"<<"Si"<<"P"<<"S"<<"Cl"<<"Ar"<<
454 "K"<<"Ca"<<"Sc"<<"Ti"<<"V"<<"Cr"<<"Mn"<<"Fe"<<"Co"<<"Ni"<<"Cu"<<"Zn"<<"Ga"<<"Ge"<<"As"<<"Se"<<"Br"<<"Kr"<<
455 "Rb"<<"Sr"<<"Y"<<"Zr"<<"Nb"<<"Mo"<<"Tc"<<"Ru"<<"Rh"<<"Pd"<<"Ag"<<"Cd"<<"In"<<"Sn"<<"Sb"<<"Te"<<"I"<<"Xe"<<
456 "Cs"<<"Ba"<< "La"<<"Ce"<<"Pr"<<"Nd"<<"Pm"<<"Sm"<<"Eu"<<"Gd"<<"Tb"<<"Dy"<<"Ho"<<"Er"<<"Tm"<<"Yb"<<"Lu"<<
457 "Hf"<<"Ta"<<"W"<<"Re"<<"Os"<<"Ir"<<"Pt"<<"Au"<<"Hg"<<"Tl"<<"Pb"<<"Bi"<<"Po"<<"At"<<"Rn"<<"Fr"<<"Ra"<<
458 "Ac"<<"Th"<<"Pa"<<"U"<<"Np"<<"Pu"<<"Am"<<"Cm"<<"Bk"<<"Cf"<<"Es"<<"Fm"<<"Md"<<"No"<<"Lr";//no need of these I guess--> <<"Ku"<<"Ha"<<"Rf"<<"Ns"<<"Hs"<<"Mt";
459 }
460
afix5(int idx)461 int Molecule::afix5(int idx){
462 int f5 = 0,m,cnt = 0,aafx=-1;
463 if (showatoms.at(idx).afix==0) return 0;
464 // printf("AFIXm5 %d (%s)\n",showatoms.at(idx).afix,showatoms.at(idx).Label.toStdString().c_str());
465 for (int i = 0; (i <= idx) && (i < showatoms.size()); i++){
466 if (showatoms.at(i).an > 0){
467 if (aafx != showatoms.at(i).afix) cnt = 0;// afix is different than before => reset the counter
468 aafx = showatoms.at(i).afix;
469 m = showatoms.at(i).afix / 10;
470 switch (m) {
471 case 0://afix 6 afix 9
472 //printf("ehm m is zero?\n");
473 f5=5;
474 break;
475 case 6://66 for phenyl rings
476 cnt++;
477 f5 = (cnt % 6)? m * 10 + 5: 0;
478 // printf("cnt%d %s\n",cnt,showatoms.at(i).Label.toStdString().c_str());
479 break;
480 case 5://56 planar regular 5 membered ring (cp)
481 cnt++;
482 f5 = (cnt % 5)? m * 10 + 5: 0;
483 break;
484 case 10://cp*
485 cnt++;
486 f5 = (cnt % 10)? m * 10 + 5: 0;
487 break;
488 case 11://naphtyl
489 cnt++;
490 f5 = (cnt % 10)? m * 10 + 5: 0;
491 break;
492 }
493 }
494 }
495 // printf("==> %d aafx%d m%d cnt%d idx%d %s\n",f5,aafx,m,cnt,idx,showatoms.at(idx).Label.toStdString().c_str());
496 return f5;
497 }
498
nameSymmOp(Matrix m,int & fld,V3 & axis)499 QString Molecule::nameSymmOp(Matrix m,int &fld,V3 &axis){
500 QList<Matrix> so;
501 so<<
502 Matrix( 1, 0, 0, 0, 1, 0, 0, 0, 1)<<Matrix(-1, 0, 0, 0,-1, 0, 0, 0,-1)<<Matrix( 1, 0, 0, 0,-1, 0, 0, 0,-1)<<Matrix( 1,-1, 0, 0,-1, 0, 0, 0,-1)<<
503 Matrix(-1, 0, 0, 0, 1, 0, 0, 0,-1)<<Matrix(-1, 0, 0,-1, 1, 0, 0, 0,-1)<<Matrix(-1, 0, 0, 0,-1, 0, 0, 0, 1)<<Matrix( 0, 1, 0, 1, 0, 0, 0, 0,-1)<<
504 Matrix( 0,-1, 0,-1, 0, 0, 0, 0,-1)<<Matrix( 0, 0, 1, 0,-1, 0, 1, 0, 0)<<Matrix( 0, 0,-1, 0,-1, 0,-1, 0, 0)<<Matrix(-1, 0, 0, 0, 0, 1, 0, 1, 0)<<
505 Matrix(-1, 0, 0, 0, 0,-1, 0,-1, 0)<<Matrix( 1, 0, 0, 1,-1, 0, 0, 0,-1)<<Matrix(-1, 1, 0, 0, 1, 0, 0, 0,-1)<<Matrix(-1, 0, 0, 0, 1, 0, 0, 0, 1)<<
506 Matrix(-1, 1, 0, 0, 1, 0, 0, 0, 1)<<Matrix( 1, 0, 0, 0,-1, 0, 0, 0, 1)<<Matrix( 1, 0, 0, 1,-1, 0, 0, 0, 1)<<Matrix( 1, 0, 0, 0, 1, 0, 0, 0,-1)<<
507 Matrix( 0,-1, 0,-1, 0, 0, 0, 0, 1)<<Matrix( 0, 1, 0, 1, 0, 0, 0, 0, 1)<<Matrix( 0, 0,-1, 0, 1, 0,-1, 0, 0)<<Matrix( 0, 0, 1, 0, 1, 0, 1, 0, 0)<<
508 Matrix( 1, 0, 0, 0, 0,-1, 0,-1, 0)<<Matrix( 1, 0, 0, 0, 0, 1, 0, 1, 0)<<Matrix(-1, 0, 0,-1, 1, 0, 0, 0, 1)<<Matrix( 1,-1, 0, 0,-1, 0, 0, 0, 1)<<
509 Matrix( 0,-1, 0, 1,-1, 0, 0, 0, 1)<<Matrix(-1, 1, 0,-1, 0, 0, 0, 0, 1)<<Matrix( 0, 0, 1, 1, 0, 0, 0, 1, 0)<<Matrix( 0, 1, 0, 0, 0, 1, 1, 0, 0)<<
510 Matrix( 0, 0,-1,-1, 0, 0, 0, 1, 0)<<Matrix( 0,-1, 0, 0, 0, 1,-1, 0, 0)<<Matrix( 0, 0, 1,-1, 0, 0, 0,-1, 0)<<Matrix( 0,-1, 0, 0, 0,-1, 1, 0, 0)<<
511 Matrix( 0, 0,-1, 1, 0, 0, 0,-1, 0)<<Matrix( 0, 1, 0, 0, 0,-1,-1, 0, 0)<<Matrix( 0, 1, 0,-1, 1, 0, 0, 0,-1)<<Matrix( 1,-1, 0, 1, 0, 0, 0, 0,-1)<<
512 Matrix( 0, 0,-1,-1, 0, 0, 0,-1, 0)<<Matrix( 0,-1, 0, 0, 0,-1,-1, 0, 0)<<Matrix( 0, 0, 1, 1, 0, 0, 0,-1, 0)<<Matrix( 0, 1, 0, 0, 0,-1, 1, 0, 0)<<
513 Matrix( 0, 0,-1, 1, 0, 0, 0, 1, 0)<<Matrix( 0, 1, 0, 0, 0, 1,-1, 0, 0)<<Matrix( 0, 0, 1,-1, 0, 0, 0, 1, 0)<<Matrix( 0,-1, 0, 0, 0, 1, 1, 0, 0)<<
514 Matrix( 0,-1, 0, 1, 0, 0, 0, 0, 1)<<Matrix( 0, 1, 0,-1, 0, 0, 0, 0, 1)<<Matrix( 1, 0, 0, 0, 0,-1, 0, 1, 0)<<Matrix( 1, 0, 0, 0, 0, 1, 0,-1, 0)<<
515 Matrix( 0, 0, 1, 0, 1, 0,-1, 0, 0)<<Matrix( 0, 0,-1, 0, 1, 0, 1, 0, 0)<<Matrix( 0, 1, 0,-1, 0, 0, 0, 0,-1)<<Matrix( 0,-1, 0, 1, 0, 0, 0, 0,-1)<<
516 Matrix(-1, 0, 0, 0, 0, 1, 0,-1, 0)<<Matrix(-1, 0, 0, 0, 0,-1, 0, 1, 0)<<Matrix( 0, 0,-1, 0,-1, 0, 1, 0, 0)<<Matrix( 0, 0, 1, 0,-1, 0,-1, 0, 0)<<
517 Matrix( 1,-1, 0, 1, 0, 0, 0, 0, 1)<<Matrix( 0, 1, 0,-1, 1, 0, 0, 0, 1)<<Matrix(-1, 1, 0,-1, 0, 0, 0, 0,-1)<<Matrix( 0,-1, 0, 1,-1, 0, 0, 0,-1);
518 QList<V3>axn;
519 axn<<
520
521 V3( 0, 0, 0)<<//1 "1"));
522 V3( 0, 0, 0)<<//2 "-1"));
523 V3( 1, 0, 0)<<//3 "2 x,0,0"));
524 V3( 1, 0, 0)<<//4 "2 x,0,0"));
525 V3( 0, 1, 0)<<//5 "2 0,y,0"));
526 V3( 0, 1, 0)<<//6 "2 0,y,0"));
527 V3( 0, 0, 1)<<//7 "2 0,0,z"));
528 V3( 1, 1, 0)<<//8 "2 x,x,0"));
529 V3( 1,-1, 0)<<//9 "2 x,-x,0"));
530 V3( 1, 0, 1)<<//10 "2 x,0,x"));
531 V3(-1, 0, 1)<<//11 "2 -x,0,x"));
532 V3( 0, 1, 1)<<//12 "2 0,x,x"));
533 V3( 0, 1,-1)<<//13 "2 0,x,-x"));
534 V3( 2, 1, 0)<<//14 "2 2x,x,0"));
535 V3( 1, 2, 0)<<//15 "2 x,2x,0"));
536 V3( 1, 0, 0)<<//16 "m 0,y,z"));
537 V3( 2,-1, 0)<<//17 "m x,2x,z"));
538 V3( 0, 1, 0)<<//18 "m x,0,z"));
539 V3(-1, 2, 0)<<//19 "m 2x,x,z"));
540 V3( 0, 0, 1)<<//20 "m x,y,0"));
541 V3( 1, 1, 0)<<//21 "m x,-x,z"));
542 V3( 1,-1, 0)<<//22 "m x,x,z"));
543 V3( 1, 0, 1)<<//23 "m -x,y,x"));
544 V3(-1, 0, 1)<<//24 "m x,y,x"));
545 V3( 0, 1, 1)<<//25 "m x,y,-y"));
546 V3( 0, 1,-1)<<//26 "m x,y,y"));
547 V3( 1, 0, 0)<<//27 "m 0,y,z"));
548 V3( 0, 1, 0)<<//28 "m x,0,z"));
549 V3( 0, 0, 1)<<//29 "3+ 0,0,z"));
550 V3( 0, 0, 1)<<//30 "3- 0,0,z"));
551 V3( 1, 1, 1)<<//31 "3+ x,x,x"));
552 V3( 1, 1, 1)<<//32 "3- x,x,x"));
553 V3( 1,-1,-1)<<//33 "3+ x,-x,-x"));
554 V3( 1,-1,-1)<<//34 "3- x,-x,-x"));
555 V3(-1, 1,-1)<<//35 "3+ -x,x,-x"));
556 V3(-1, 1,-1)<<//36 "3- -x,x,-x"));
557 V3(-1,-1, 1)<<//37 "3+ -x,-x,x"));
558 V3(-1,-1, 1)<<//38 "3- -x,-x,x"));
559 V3( 0, 0, 1)<<//39 "-3+ 0,0,z"));
560 V3( 0, 0, 1)<<//40 "-3- 0,0,z"));
561 V3( 1, 1, 1)<<//41 "-3+ x,x,x"));
562 V3( 1, 1, 1)<<//42 "-3- x,x,x"));
563 V3( 1,-1,-1)<<//43 "-3+ x,-x,-x"));
564 V3( 1,-1,-1)<<//44 "-3- x,-x,-x"));
565 V3(-1, 1,-1)<<//45 "-3+ -x,x,-x"));
566 V3(-1, 1,-1)<<//46 "-3- -x,x,-x"));
567 V3(-1,-1, 1)<<//47 "-3+ -x,-x,x"));
568 V3(-1,-1, 1)<<//48 "-3- -x,-x,x"));
569 V3( 0, 0, 1)<<//49 "4+ 0,0,z"));
570 V3( 0, 0, 1)<<//50 "4- 0,0,z"));
571 V3( 1, 0, 0)<<//51 "4+ x,0,0"));
572 V3( 1, 0, 0)<<//52 "4- x,0,0"));
573 V3( 0, 1, 0)<<//53 "4+ 0,y,0"));
574 V3( 0, 1, 0)<<//54 "4- 0,y,0"));
575 V3( 0, 0, 1)<<//55 "-4+ 0,0,z"));
576 V3( 0, 0, 1)<<//56 "-4- 0,0,z"));
577 V3( 1, 0, 0)<<//57 "-4+ x,0,0"));
578 V3( 1, 0, 0)<<//58 "-4- x,0,0"));
579 V3( 0, 1, 0)<<//59 "-4+ 0,y,0"));
580 V3( 0, 1, 0)<<//60 "-4- 0,y,0"));
581 V3( 0, 0, 1)<<//61 "6+ 0,0,z"));
582 V3( 0, 0, 1)<<//62 "6- 0,0,z"));
583 V3( 0, 0, 1)<<//63 "-6+ 0,0,z"));
584 V3( 0, 0, 1);//64 "-6- 0,0,z"));
585
586 QStringList n;
587 n.append(QString("1"));
588 n.append(QString("-1"));
589 n.append(QString("2 x,0,0"));
590 n.append(QString("2 x,0,0"));
591 n.append(QString("2 0,y,0"));
592 n.append(QString("2 0,y,0"));
593 n.append(QString("2 0,0,z"));
594 n.append(QString("2 x,x,0"));
595 n.append(QString("2 x,-x,0"));
596 n.append(QString("2 x,0,x"));
597 n.append(QString("2 -x,0,x"));
598 n.append(QString("2 0,x,x"));
599 n.append(QString("2 0,x,-x"));
600 n.append(QString("2 2x,x,0"));
601 n.append(QString("2 x,2x,0"));
602 n.append(QString("m 0,y,z"));
603 n.append(QString("m x,2x,z"));
604 n.append(QString("m x,0,z"));
605 n.append(QString("m 2x,x,z"));
606 n.append(QString("m x,y,0"));
607 n.append(QString("m x,-x,z"));
608 n.append(QString("m x,x,z"));
609 n.append(QString("m -x,y,x"));
610 n.append(QString("m x,y,x"));
611 n.append(QString("m x,y,-y"));
612 n.append(QString("m x,y,y"));
613 n.append(QString("m 0,y,z"));
614 n.append(QString("m x,0,z"));
615 n.append(QString("3+ 0,0,z"));
616 n.append(QString("3- 0,0,z"));
617 n.append(QString("3+ x,x,x"));
618 n.append(QString("3- x,x,x"));
619 n.append(QString("3+ x,-x,-x"));
620 n.append(QString("3- x,-x,-x"));
621 n.append(QString("3+ -x,x,-x"));
622 n.append(QString("3- -x,x,-x"));
623 n.append(QString("3+ -x,-x,x"));
624 n.append(QString("3- -x,-x,x"));
625 n.append(QString("-3+ 0,0,z"));
626 n.append(QString("-3- 0,0,z"));
627 n.append(QString("-3+ x,x,x"));
628 n.append(QString("-3- x,x,x"));
629 n.append(QString("-3+ x,-x,-x"));
630 n.append(QString("-3- x,-x,-x"));
631 n.append(QString("-3+ -x,x,-x"));
632 n.append(QString("-3- -x,x,-x"));
633 n.append(QString("-3+ -x,-x,x"));
634 n.append(QString("-3- -x,-x,x"));
635 n.append(QString("4+ 0,0,z"));
636 n.append(QString("4- 0,0,z"));
637 n.append(QString("4+ x,0,0"));
638 n.append(QString("4- x,0,0"));
639 n.append(QString("4+ 0,y,0"));
640 n.append(QString("4- 0,y,0"));
641 n.append(QString("-4+ 0,0,z"));
642 n.append(QString("-4- 0,0,z"));
643 n.append(QString("-4+ x,0,0"));
644 n.append(QString("-4- x,0,0"));
645 n.append(QString("-4+ 0,y,0"));
646 n.append(QString("-4- 0,y,0"));
647 n.append(QString("6+ 0,0,z"));
648 n.append(QString("6- 0,0,z"));
649 n.append(QString("-6+ 0,0,z"));
650 n.append(QString("-6- 0,0,z"));
651 int i=so.indexOf(m);
652 int fold[64]={1, -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -3, -3,
653 -3, -3, -3, -3, -3, -3, -3, -3, 4, 4, 4, 4, 4, 4, -4, -4, -4, -4, -4, -4, 6, 6, -6, -6};
654
655 //printf("!!## %d %s\n",i,n.at(i).toStdString().c_str());
656 if (i>-1) {
657 fld=fold[i];
658 axis=axn[i];
659 return n.at(i);
660 }
661 fld=0;
662 axis=V3(0,0,0);
663 return QString("none");
664 }
afix5(const CEnvironment & atm,int idx)665 int Molecule::afix5(const CEnvironment &atm, int idx){
666 int f5 = 0,m,cnt = 0,aafx=-1;
667 if (atm.at(idx).afix==0) return 0;
668 // printf("AFIXm5 %d (%s)\n",showatoms.at(idx).afix,showatoms.at(idx).Label.toStdString().c_str());
669 for (int i = 0; (i <= idx) && (i < atm.size()); i++){
670 if (atm.at(i).an > 0){
671 if (aafx != atm.at(i).afix) cnt = 0;// afix is different than before => reset the counter
672 aafx = atm.at(i).afix;
673 m = atm.at(i).afix / 10;
674 switch (m) {
675 case 0://afix 6 afix 9
676 //printf("ehm m is zero?\n");
677 f5=5;
678 break;
679 case 6://66 for phenyl rings
680 cnt++;
681 f5 = (cnt % 6)? m * 10 + 5: 0;
682 // printf("cnt%d %s\n",cnt,showatoms.at(i).Label.toStdString().c_str());
683 break;
684 case 5://56 planar regular 5 membered ring (cp)
685 cnt++;
686 f5 = (cnt % 5)? m * 10 + 5: 0;
687 break;
688 case 10://cp*
689 cnt++;
690 f5 = (cnt % 10)? m * 10 + 5: 0;
691 break;
692 case 11://naphtyl
693 cnt++;
694 f5 = (cnt % 10)? m * 10 + 5: 0;
695 break;
696 }
697 }
698 }
699 // printf("==> %d aafx%d m%d cnt%d idx%d %s\n",f5,aafx,m,cnt,idx,showatoms.at(idx).Label.toStdString().c_str());
700 return f5;
701 }
rotarb(double * arr)702 Matrix Molecule::rotarb(double *arr){
703 double phi=arr[0]/180*M_PI;
704 double c=cos(phi);
705 double s=sin(phi);
706 double omc=1-c;
707 Matrix m(c+arr[1]*arr[1]*omc,arr[1]*arr[2]*omc-s*arr[3],arr[1]*arr[3]*omc+s*arr[2],
708 arr[1]*arr[2]*omc+s*arr[3],c+arr[2]*arr[2]*omc,arr[2]*arr[3]*omc-s*arr[1],
709 arr[1]*arr[3]*omc-s*arr[2],arr[2]*arr[3]*omc+s*arr[1],c+arr[3]*arr[3]*omc);
710 return m;
711 }
712
exportOBJ(QString fileName,const CEnvironment & _atoms,const Connection & _bonds)713 void Molecule::exportOBJ(QString fileName,const CEnvironment &_atoms, const Connection &_bonds){
714 const GLuint idx2[960] = {
715 1, 42, 44,// 0 0.275904 0.321244 0.275904
716 42, 12, 43,// 1 0.275904 0.312869 0.285473
717 43, 14, 44,// 2 0.312869 0.275904 0.285473
718 42, 43, 44,// 3 0.285473 0.285473 0.321244
719 12, 45, 47,// 4 0.275904 0.285473 0.312869
720 45, 0, 46,// 5 0.275904 0.275904 0.321244
721 46, 13, 47,// 6 0.275904 0.312869 0.285473
722 45, 46, 47,// 7 0.321244 0.285473 0.285473
723 13, 48, 50,// 8 0.275904 0.285473 0.312869
724 48, 5, 49,// 9 0.275904 0.275904 0.321244
725 49, 14, 50,// 10 0.275904 0.312869 0.285473
726 48, 49, 50,// 11 0.321244 0.285473 0.285473
727 12, 47, 43,// 12 0.312869 0.324920 0.312869
728 47, 13, 50,// 13 0.312869 0.312869 0.324920
729 50, 14, 43,// 14 0.312869 0.312869 0.324920
730 47, 50, 43,// 15 0.324920 0.324920 0.324920
731 0, 45, 52,// 16 0.275904 0.321244 0.275904
732 45, 12, 51,// 17 0.275904 0.312869 0.285473
733 51, 16, 52,// 18 0.312869 0.275904 0.285473
734 45, 51, 52,// 19 0.285473 0.285473 0.321244
735 12, 42, 54,// 20 0.275904 0.285473 0.312869
736 42, 1, 53,// 21 0.275904 0.275904 0.321244
737 53, 15, 54,// 22 0.275904 0.312869 0.285473
738 42, 53, 54,// 23 0.321244 0.285473 0.285473
739 15, 55, 57,// 24 0.275904 0.285473 0.312869
740 55, 7, 56,// 25 0.275904 0.275904 0.321244
741 56, 16, 57,// 26 0.275904 0.312869 0.285473
742 55, 56, 57,// 27 0.321244 0.285473 0.285473
743 12, 54, 51,// 28 0.312869 0.324920 0.312869
744 54, 15, 57,// 29 0.312869 0.312869 0.324920
745 57, 16, 51,// 30 0.312869 0.312869 0.324920
746 54, 57, 51,// 31 0.324920 0.324920 0.324920
747 10, 58, 60,// 32 0.275904 0.321244 0.275904
748 58, 17, 59,// 33 0.275904 0.312869 0.285473
749 59, 18, 60,// 34 0.312869 0.275904 0.285473
750 58, 59, 60,// 35 0.285473 0.285473 0.321244
751 17, 61, 62,// 36 0.275904 0.285473 0.312869
752 61, 0, 52,// 37 0.275904 0.275904 0.321244
753 52, 16, 62,// 38 0.275904 0.312869 0.285473
754 61, 52, 62,// 39 0.321244 0.285473 0.285473
755 16, 56, 64,// 40 0.275904 0.285473 0.312869
756 56, 7, 63,// 41 0.275904 0.275904 0.321244
757 63, 18, 64,// 42 0.275904 0.312869 0.285473
758 56, 63, 64,// 43 0.321244 0.285473 0.285473
759 17, 62, 59,// 44 0.312869 0.324920 0.312869
760 62, 16, 64,// 45 0.312869 0.312869 0.324920
761 64, 18, 59,// 46 0.312869 0.312869 0.324920
762 62, 64, 59,// 47 0.324920 0.324920 0.324920
763 0, 61, 66,// 48 0.275904 0.321244 0.275904
764 61, 17, 65,// 49 0.275904 0.312869 0.285473
765 65, 20, 66,// 50 0.312869 0.275904 0.285473
766 61, 65, 66,// 51 0.285473 0.285473 0.321244
767 17, 58, 68,// 52 0.275904 0.285473 0.312869
768 58, 10, 67,// 53 0.275904 0.275904 0.321244
769 67, 19, 68,// 54 0.275904 0.312869 0.285473
770 58, 67, 68,// 55 0.321244 0.285473 0.285473
771 19, 69, 71,// 56 0.275904 0.285473 0.312869
772 69, 11, 70,// 57 0.275904 0.275904 0.321244
773 70, 20, 71,// 58 0.275904 0.312869 0.285473
774 69, 70, 71,// 59 0.321244 0.285473 0.285473
775 17, 68, 65,// 60 0.312869 0.324920 0.312869
776 68, 19, 71,// 61 0.312869 0.312869 0.324920
777 71, 20, 65,// 62 0.312869 0.312869 0.324920
778 68, 71, 65,// 63 0.324920 0.324920 0.324920
779 11, 72, 70,// 64 0.275904 0.321244 0.275904
780 72, 21, 73,// 65 0.275904 0.312869 0.285473
781 73, 20, 70,// 66 0.312869 0.275904 0.285473
782 72, 73, 70,// 67 0.285473 0.285473 0.321244
783 21, 74, 75,// 68 0.275904 0.285473 0.312869
784 74, 5, 48,// 69 0.275904 0.275904 0.321244
785 48, 13, 75,// 70 0.275904 0.312869 0.285473
786 74, 48, 75,// 71 0.321244 0.285473 0.285473
787 13, 46, 76,// 72 0.275904 0.285473 0.312869
788 46, 0, 66,// 73 0.275904 0.275904 0.321244
789 66, 20, 76,// 74 0.275904 0.312869 0.285473
790 46, 66, 76,// 75 0.321244 0.285473 0.285473
791 21, 75, 73,// 76 0.312869 0.324920 0.312869
792 75, 13, 76,// 77 0.312869 0.312869 0.324920
793 76, 20, 73,// 78 0.312869 0.312869 0.324920
794 75, 76, 73,// 79 0.324920 0.324920 0.324920
795 5, 74, 78,// 80 0.275904 0.321244 0.275904
796 74, 21, 77,// 81 0.275904 0.312869 0.285473
797 77, 23, 78,// 82 0.312869 0.275904 0.285473
798 74, 77, 78,// 83 0.285473 0.285473 0.321244
799 21, 72, 80,// 84 0.275904 0.285473 0.312869
800 72, 11, 79,// 85 0.275904 0.275904 0.321244
801 79, 22, 80,// 86 0.275904 0.312869 0.285473
802 72, 79, 80,// 87 0.321244 0.285473 0.285473
803 22, 81, 83,// 88 0.275904 0.285473 0.312869
804 81, 4, 82,// 89 0.275904 0.275904 0.321244
805 82, 23, 83,// 90 0.275904 0.312869 0.285473
806 81, 82, 83,// 91 0.321244 0.285473 0.285473
807 21, 80, 77,// 92 0.312869 0.324920 0.312869
808 80, 22, 83,// 93 0.312869 0.312869 0.324920
809 83, 23, 77,// 94 0.312869 0.312869 0.324920
810 80, 83, 77,// 95 0.324920 0.324920 0.324920
811 2, 84, 86,// 96 0.275904 0.321244 0.275904
812 84, 24, 85,// 97 0.275904 0.312869 0.285473
813 85, 25, 86,// 98 0.312869 0.275904 0.285473
814 84, 85, 86,// 99 0.285473 0.285473 0.321244
815 24, 87, 88,//100 0.275904 0.285473 0.312869
816 87, 11, 69,//101 0.275904 0.275904 0.321244
817 69, 19, 88,//102 0.275904 0.312869 0.285473
818 87, 69, 88,//103 0.321244 0.285473 0.285473
819 19, 67, 90,//104 0.275904 0.285473 0.312869
820 67, 10, 89,//105 0.275904 0.275904 0.321244
821 89, 25, 90,//106 0.275904 0.312869 0.285473
822 67, 89, 90,//107 0.321244 0.285473 0.285473
823 24, 88, 85,//108 0.312869 0.324920 0.312869
824 88, 19, 90,//109 0.312869 0.312869 0.324920
825 90, 25, 85,//110 0.312869 0.312869 0.324920
826 88, 90, 85,//111 0.324920 0.324920 0.324920
827 11, 87, 79,//112 0.275904 0.321244 0.275904
828 87, 24, 91,//113 0.275904 0.312869 0.285473
829 91, 22, 79,//114 0.312869 0.275904 0.285473
830 87, 91, 79,//115 0.285473 0.285473 0.321244
831 24, 84, 93,//116 0.275904 0.285473 0.312869
832 84, 2, 92,//117 0.275904 0.275904 0.321244
833 92, 26, 93,//118 0.275904 0.312869 0.285473
834 84, 92, 93,//119 0.321244 0.285473 0.285473
835 26, 94, 95,//120 0.275904 0.285473 0.312869
836 94, 4, 81,//121 0.275904 0.275904 0.321244
837 81, 22, 95,//122 0.275904 0.312869 0.285473
838 94, 81, 95,//123 0.321244 0.285473 0.285473
839 24, 93, 91,//124 0.312869 0.324920 0.312869
840 93, 26, 95,//125 0.312869 0.312869 0.324920
841 95, 22, 91,//126 0.312869 0.312869 0.324920
842 93, 95, 91,//127 0.324920 0.324920 0.324920
843 10, 96, 89,//128 0.275904 0.321244 0.275904
844 96, 27, 97,//129 0.275904 0.312869 0.285473
845 97, 25, 89,//130 0.312869 0.275904 0.285473
846 96, 97, 89,//131 0.285473 0.285473 0.321244
847 27, 98, 100,//132 0.275904 0.285473 0.312869
848 98, 6, 99,//133 0.275904 0.275904 0.321244
849 99, 28, 100,//134 0.275904 0.312869 0.285473
850 98, 99, 100,//135 0.321244 0.285473 0.285473
851 28, 101, 102,//136 0.275904 0.285473 0.312869
852 101, 2, 86,//137 0.275904 0.275904 0.321244
853 86, 25, 102,//138 0.275904 0.312869 0.285473
854 101, 86, 102,//139 0.321244 0.285473 0.285473
855 27, 100, 97,//140 0.312869 0.324920 0.312869
856 100, 28, 102,//141 0.312869 0.312869 0.324920
857 102, 25, 97,//142 0.312869 0.312869 0.324920
858 100, 102, 97,//143 0.324920 0.324920 0.324920
859 6, 98, 104,//144 0.275904 0.321244 0.275904
860 98, 27, 103,//145 0.275904 0.312869 0.285473
861 103, 29, 104,//146 0.312869 0.275904 0.285473
862 98, 103, 104,//147 0.285473 0.285473 0.321244
863 27, 96, 105,//148 0.275904 0.285473 0.312869
864 96, 10, 60,//149 0.275904 0.275904 0.321244
865 60, 18, 105,//150 0.275904 0.312869 0.285473
866 96, 60, 105,//151 0.321244 0.285473 0.285473
867 18, 63, 107,//152 0.275904 0.285473 0.312869
868 63, 7, 106,//153 0.275904 0.275904 0.321244
869 106, 29, 107,//154 0.275904 0.312869 0.285473
870 63, 106, 107,//155 0.321244 0.285473 0.285473
871 27, 105, 103,//156 0.312869 0.324920 0.312869
872 105, 18, 107,//157 0.312869 0.312869 0.324920
873 107, 29, 103,//158 0.312869 0.312869 0.324920
874 105, 107, 103,//159 0.324920 0.324920 0.324920
875 7, 108, 106,//160 0.275904 0.321244 0.275904
876 108, 30, 109,//161 0.275904 0.312869 0.285473
877 109, 29, 106,//162 0.312869 0.275904 0.285473
878 108, 109, 106,//163 0.285473 0.285473 0.321244
879 30, 110, 112,//164 0.275904 0.285473 0.312869
880 110, 8, 111,//165 0.275904 0.275904 0.321244
881 111, 31, 112,//166 0.275904 0.312869 0.285473
882 110, 111, 112,//167 0.321244 0.285473 0.285473
883 31, 113, 114,//168 0.275904 0.285473 0.312869
884 113, 6, 104,//169 0.275904 0.275904 0.321244
885 104, 29, 114,//170 0.275904 0.312869 0.285473
886 113, 104, 114,//171 0.321244 0.285473 0.285473
887 30, 112, 109,//172 0.312869 0.324920 0.312869
888 112, 31, 114,//173 0.312869 0.312869 0.324920
889 114, 29, 109,//174 0.312869 0.312869 0.324920
890 112, 114, 109,//175 0.324920 0.324920 0.324920
891 8, 110, 116,//176 0.275904 0.321244 0.275904
892 110, 30, 115,//177 0.275904 0.312869 0.285473
893 115, 32, 116,//178 0.312869 0.275904 0.285473
894 110, 115, 116,//179 0.285473 0.285473 0.321244
895 30, 108, 117,//180 0.275904 0.285473 0.312869
896 108, 7, 55,//181 0.275904 0.275904 0.321244
897 55, 15, 117,//182 0.275904 0.312869 0.285473
898 108, 55, 117,//183 0.321244 0.285473 0.285473
899 15, 53, 119,//184 0.275904 0.285473 0.312869
900 53, 1, 118,//185 0.275904 0.275904 0.321244
901 118, 32, 119,//186 0.275904 0.312869 0.285473
902 53, 118, 119,//187 0.321244 0.285473 0.285473
903 30, 117, 115,//188 0.312869 0.324920 0.312869
904 117, 15, 119,//189 0.312869 0.312869 0.324920
905 119, 32, 115,//190 0.312869 0.312869 0.324920
906 117, 119, 115,//191 0.324920 0.324920 0.324920
907 9, 120, 122,//192 0.275904 0.321244 0.275904
908 120, 33, 121,//193 0.275904 0.312869 0.285473
909 121, 34, 122,//194 0.312869 0.275904 0.285473
910 120, 121, 122,//195 0.285473 0.285473 0.321244
911 33, 123, 124,//196 0.275904 0.285473 0.312869
912 123, 1, 44,//197 0.275904 0.275904 0.321244
913 44, 14, 124,//198 0.275904 0.312869 0.285473
914 123, 44, 124,//199 0.321244 0.285473 0.285473
915 14, 49, 126,//200 0.275904 0.285473 0.312869
916 49, 5, 125,//201 0.275904 0.275904 0.321244
917 125, 34, 126,//202 0.275904 0.312869 0.285473
918 49, 125, 126,//203 0.321244 0.285473 0.285473
919 33, 124, 121,//204 0.312869 0.324920 0.312869
920 124, 14, 126,//205 0.312869 0.312869 0.324920
921 126, 34, 121,//206 0.312869 0.312869 0.324920
922 124, 126, 121,//207 0.324920 0.324920 0.324920
923 1, 123, 118,//208 0.275904 0.321244 0.275904
924 123, 33, 127,//209 0.275904 0.312869 0.285473
925 127, 32, 118,//210 0.312869 0.275904 0.285473
926 123, 127, 118,//211 0.285473 0.285473 0.321244
927 33, 120, 129,//212 0.275904 0.285473 0.312869
928 120, 9, 128,//213 0.275904 0.275904 0.321244
929 128, 35, 129,//214 0.275904 0.312869 0.285473
930 120, 128, 129,//215 0.321244 0.285473 0.285473
931 35, 130, 131,//216 0.275904 0.285473 0.312869
932 130, 8, 116,//217 0.275904 0.275904 0.321244
933 116, 32, 131,//218 0.275904 0.312869 0.285473
934 130, 116, 131,//219 0.321244 0.285473 0.285473
935 33, 129, 127,//220 0.312869 0.324920 0.312869
936 129, 35, 131,//221 0.312869 0.312869 0.324920
937 131, 32, 127,//222 0.312869 0.312869 0.324920
938 129, 131, 127,//223 0.324920 0.324920 0.324920
939 4, 132, 82,//224 0.275904 0.321244 0.275904
940 132, 36, 133,//225 0.275904 0.312869 0.285473
941 133, 23, 82,//226 0.312869 0.275904 0.285473
942 132, 133, 82,//227 0.285473 0.285473 0.321244
943 36, 134, 135,//228 0.275904 0.285473 0.312869
944 134, 9, 122,//229 0.275904 0.275904 0.321244
945 122, 34, 135,//230 0.275904 0.312869 0.285473
946 134, 122, 135,//231 0.321244 0.285473 0.285473
947 34, 125, 136,//232 0.275904 0.285473 0.312869
948 125, 5, 78,//233 0.275904 0.275904 0.321244
949 78, 23, 136,//234 0.275904 0.312869 0.285473
950 125, 78, 136,//235 0.321244 0.285473 0.285473
951 36, 135, 133,//236 0.312869 0.324920 0.312869
952 135, 34, 136,//237 0.312869 0.312869 0.324920
953 136, 23, 133,//238 0.312869 0.312869 0.324920
954 135, 136, 133,//239 0.324920 0.324920 0.324920
955 9, 134, 138,//240 0.275904 0.321244 0.275904
956 134, 36, 137,//241 0.275904 0.312869 0.285473
957 137, 38, 138,//242 0.312869 0.275904 0.285473
958 134, 137, 138,//243 0.285473 0.285473 0.321244
959 36, 132, 140,//244 0.275904 0.285473 0.312869
960 132, 4, 139,//245 0.275904 0.275904 0.321244
961 139, 37, 140,//246 0.275904 0.312869 0.285473
962 132, 139, 140,//247 0.321244 0.285473 0.285473
963 37, 141, 143,//248 0.275904 0.285473 0.312869
964 141, 3, 142,//249 0.275904 0.275904 0.321244
965 142, 38, 143,//250 0.275904 0.312869 0.285473
966 141, 142, 143,//251 0.321244 0.285473 0.285473
967 36, 140, 137,//252 0.312869 0.324920 0.312869
968 140, 37, 143,//253 0.312869 0.312869 0.324920
969 143, 38, 137,//254 0.312869 0.312869 0.324920
970 140, 143, 137,//255 0.324920 0.324920 0.324920
971 3, 144, 142,//256 0.275904 0.321244 0.275904
972 144, 39, 145,//257 0.275904 0.312869 0.285473
973 145, 38, 142,//258 0.312869 0.275904 0.285473
974 144, 145, 142,//259 0.285473 0.285473 0.321244
975 39, 146, 147,//260 0.275904 0.285473 0.312869
976 146, 8, 130,//261 0.275904 0.275904 0.321244
977 130, 35, 147,//262 0.275904 0.312869 0.285473
978 146, 130, 147,//263 0.321244 0.285473 0.285473
979 35, 128, 148,//264 0.275904 0.285473 0.312869
980 128, 9, 138,//265 0.275904 0.275904 0.321244
981 138, 38, 148,//266 0.275904 0.312869 0.285473
982 128, 138, 148,//267 0.321244 0.285473 0.285473
983 39, 147, 145,//268 0.312869 0.324920 0.312869
984 147, 35, 148,//269 0.312869 0.312869 0.324920
985 148, 38, 145,//270 0.312869 0.312869 0.324920
986 147, 148, 145,//271 0.324920 0.324920 0.324920
987 8, 146, 111,//272 0.275904 0.321244 0.275904
988 146, 39, 149,//273 0.275904 0.312869 0.285473
989 149, 31, 111,//274 0.312869 0.275904 0.285473
990 146, 149, 111,//275 0.285473 0.285473 0.321244
991 39, 144, 151,//276 0.275904 0.285473 0.312869
992 144, 3, 150,//277 0.275904 0.275904 0.321244
993 150, 40, 151,//278 0.275904 0.312869 0.285473
994 144, 150, 151,//279 0.321244 0.285473 0.285473
995 40, 152, 153,//280 0.275904 0.285473 0.312869
996 152, 6, 113,//281 0.275904 0.275904 0.321244
997 113, 31, 153,//282 0.275904 0.312869 0.285473
998 152, 113, 153,//283 0.321244 0.285473 0.285473
999 39, 151, 149,//284 0.312869 0.324920 0.312869
1000 151, 40, 153,//285 0.312869 0.312869 0.324920
1001 153, 31, 149,//286 0.312869 0.312869 0.324920
1002 151, 153, 149,//287 0.324920 0.324920 0.324920
1003 3, 154, 150,//288 0.275904 0.321244 0.275904
1004 154, 41, 155,//289 0.275904 0.312869 0.285473
1005 155, 40, 150,//290 0.312869 0.275904 0.285473
1006 154, 155, 150,//291 0.285473 0.285473 0.321244
1007 41, 156, 157,//292 0.275904 0.285473 0.312869
1008 156, 2, 101,//293 0.275904 0.275904 0.321244
1009 101, 28, 157,//294 0.275904 0.312869 0.285473
1010 156, 101, 157,//295 0.321244 0.285473 0.285473
1011 28, 99, 158,//296 0.275904 0.285473 0.312869
1012 99, 6, 152,//297 0.275904 0.275904 0.321244
1013 152, 40, 158,//298 0.275904 0.312869 0.285473
1014 99, 152, 158,//299 0.321244 0.285473 0.285473
1015 41, 157, 155,//300 0.312869 0.324920 0.312869
1016 157, 28, 158,//301 0.312869 0.312869 0.324920
1017 158, 40, 155,//302 0.312869 0.312869 0.324920
1018 157, 158, 155,//303 0.324920 0.324920 0.324920
1019 2, 156, 92,//304 0.275904 0.321244 0.275904
1020 156, 41, 159,//305 0.275904 0.312869 0.285473
1021 159, 26, 92,//306 0.312869 0.275904 0.285473
1022 156, 159, 92,//307 0.285473 0.285473 0.321244
1023 41, 154, 160,//308 0.275904 0.285473 0.312869
1024 154, 3, 141,//309 0.275904 0.275904 0.321244
1025 141, 37, 160,//310 0.275904 0.312869 0.285473
1026 154, 141, 160,//311 0.321244 0.285473 0.285473
1027 37, 139, 161,//312 0.275904 0.285473 0.312869
1028 139, 4, 94,//313 0.275904 0.275904 0.321244
1029 94, 26, 161,//314 0.275904 0.312869 0.285473
1030 139, 94, 161,//315 0.321244 0.285473 0.285473
1031 41, 160, 159,//316 0.312869 0.324920 0.312869
1032 160, 37, 161,//317 0.312869 0.312869 0.324920
1033 161, 26, 159,//318 0.312869 0.312869 0.324920
1034 160, 161, 159 //319 0.324920 0.324920 0.324920
1035 };
1036 const GLuint idxc[60] = {
1037 0, 20, 2, 2, 20, 22,
1038 2, 22, 4, 4, 22, 24,
1039 4, 24, 6, 6, 24, 26,
1040 6, 26, 8, 8, 26, 28,
1041 8, 28, 10, 10, 28, 30,
1042 10, 30, 12, 12, 30, 32,
1043 12, 32, 14, 14, 32, 34,
1044 14, 34, 16, 16, 34, 36,
1045 16, 36, 18, 18, 36, 38,
1046 18, 38, 0, 0, 38, 20,
1047 };
1048
1049 const GLfloat vc[120] = {
1050 1.000000000f, 0.000000000f, 0.000000000f,//0
1051 0.951056516f, 0.309016994f, 0.000000000f,//18
1052 0.809016994f, 0.587785252f, 0.000000000f,//36
1053 0.587785252f, 0.809016994f, 0.000000000f,//54
1054 0.309016994f, 0.951056516f, 0.000000000f,//72
1055 0.000000000f, 1.000000000f, 0.000000000f,//90
1056 -0.309016994f, 0.951056516f, 0.000000000f,//108
1057 -0.587785252f, 0.809016994f, 0.000000000f,//126
1058 -0.809016994f, 0.587785252f, 0.000000000f,//144
1059 -0.951056516f, 0.309016994f, 0.000000000f,//162
1060 -1.000000000f, 0.000000000f, 0.000000000f,//180
1061 -0.951056516f,-0.309016994f, 0.000000000f,//198
1062 -0.809016994f,-0.587785252f, 0.000000000f,//216
1063 -0.587785252f,-0.809016994f, 0.000000000f,//234
1064 -0.309016994f,-0.951056516f, 0.000000000f,//252
1065 -0.000000000f,-1.000000000f, 0.000000000f,//270
1066 0.309016994f,-0.951056516f, 0.000000000f,//288
1067 0.587785252f,-0.809016994f, 0.000000000f,//306
1068 0.809016994f,-0.587785252f, 0.000000000f,//324
1069 0.951056516f,-0.309016994f, 0.000000000f,//342
1070 1.000000000f, 0.000000000f, 1.000000000f,//0
1071 0.951056516f, 0.309016994f, 1.000000000f,//18
1072 0.809016994f, 0.587785252f, 1.000000000f,//36
1073 0.587785252f, 0.809016994f, 1.000000000f,//54
1074 0.309016994f, 0.951056516f, 1.000000000f,//72
1075 0.000000000f, 1.000000000f, 1.000000000f,//90
1076 -0.309016994f, 0.951056516f, 1.000000000f,//108
1077 -0.587785252f, 0.809016994f, 1.000000000f,//126
1078 -0.809016994f, 0.587785252f, 1.000000000f,//144
1079 -0.951056516f, 0.309016994f, 1.000000000f,//162
1080 -1.000000000f, 0.000000000f, 1.000000000f,//180
1081 -0.951056516f,-0.309016994f, 1.000000000f,//198
1082 -0.809016994f,-0.587785252f, 1.000000000f,//216
1083 -0.587785252f,-0.809016994f, 1.000000000f,//234
1084 -0.309016994f,-0.951056516f, 1.000000000f,//252
1085 -0.000000000f,-1.000000000f, 1.000000000f,//270
1086 0.309016994f,-0.951056516f, 1.000000000f,//288
1087 0.587785252f,-0.809016994f, 1.000000000f,//306
1088 0.809016994f,-0.587785252f, 1.000000000f,//324
1089 0.951056516f,-0.309016994f, 1.000000000f//342
1090 };
1091 /*
1092 const GLfloat nc[120] = {
1093 -1.000000000f,-0.000000000f, 0.000000000f,//0
1094 -0.951056516f,-0.309016994f, 0.000000000f,//18
1095 -0.809016994f,-0.587785252f, 0.000000000f,//36
1096 -0.587785252f,-0.809016994f, 0.000000000f,//54
1097 -0.309016994f,-0.951056516f, 0.000000000f,//72
1098 0.000000000f,-1.000000000f, 0.000000000f,//90
1099 0.309016994f,-0.951056516f, 0.000000000f,//108
1100 0.587785252f,-0.809016994f, 0.000000000f,//126
1101 0.809016994f,-0.587785252f, 0.000000000f,//144
1102 0.951056516f,-0.309016994f, 0.000000000f,//162
1103 1.000000000f, 0.000000000f, 0.000000000f,//180
1104 0.951056516f, 0.309016994f, 0.000000000f,//198
1105 0.809016994f, 0.587785252f, 0.000000000f,//216
1106 0.587785252f, 0.809016994f, 0.000000000f,//234
1107 0.309016994f, 0.951056516f, 0.000000000f,//252
1108 0.000000000f, 1.000000000f, 0.000000000f,//270
1109 -0.309016994f, 0.951056516f, 0.000000000f,//288
1110 -0.587785252f, 0.809016994f, 0.000000000f,//306
1111 -0.809016994f, 0.587785252f, 0.000000000f,//324
1112 -0.951056516f, 0.309016994f, 0.000000000f,//342
1113 -1.000000000f, 0.000000000f, 0.000000000f,//0
1114 -0.951056516f,-0.309016994f, 0.000000000f,//18
1115 -0.809016994f,-0.587785252f, 0.000000000f,//36
1116 -0.587785252f,-0.809016994f, 0.000000000f,//54
1117 -0.309016994f,-0.951056516f, 0.000000000f,//72
1118 0.000000000f,-1.000000000f, 0.000000000f,//90
1119 0.309016994f,-0.951056516f, 0.000000000f,//108
1120 0.587785252f,-0.809016994f, 0.000000000f,//126
1121 0.809016994f,-0.587785252f, 0.000000000f,//144
1122 0.951056516f,-0.309016994f, 0.000000000f,//162
1123 1.000000000f, 0.000000000f, 0.000000000f,//180
1124 0.951056516f, 0.309016994f, 0.000000000f,//198
1125 0.809016994f, 0.587785252f, 0.000000000f,//216
1126 0.587785252f, 0.809016994f, 0.000000000f,//234
1127 0.309016994f, 0.951056516f, 0.000000000f,//252
1128 0.000000000f, 1.000000000f, 0.000000000f,//270
1129 -0.309016994f, 0.951056516f, 0.000000000f,//288
1130 -0.587785252f, 0.809016994f, 0.000000000f,//306
1131 -0.809016994f, 0.587785252f, 0.000000000f,//324
1132 -0.951056516f, 0.309016994f, 0.000000000f//342
1133 };
1134 */
1135 const GLfloat vs[486] ={ //v[1926] = {
1136 -0.525731f, 0.850651f, 0.000000f,//0
1137 0.525731f, 0.850651f, 0.000000f,//1
1138 -0.525731f, -0.850651f, 0.000000f,//2
1139 0.525731f, -0.850651f, 0.000000f,//3
1140 0.000000f, -0.525731f, 0.850651f,//4
1141 0.000000f, 0.525731f, 0.850651f,//5
1142 0.000000f, -0.525731f, -0.850651f,//6
1143 0.000000f, 0.525731f, -0.850651f,//7
1144 0.850651f, 0.000000f, -0.525731f,//8
1145 0.850651f, 0.000000f, 0.525731f,//9
1146 -0.850651f, 0.000000f, -0.525731f,//10
1147 -0.850651f, 0.000000f, 0.525731f,//11
1148 0.000000f, 1.000000f, 0.000000f,//12
1149 -0.309017f, 0.809017f, 0.500000f,//13
1150 0.309017f, 0.809017f, 0.500000f,//14
1151 0.309017f, 0.809017f, -0.500000f,//15
1152 -0.309017f, 0.809017f, -0.500000f,//16
1153 -0.809017f, 0.500000f, -0.309017f,//17
1154 -0.500000f, 0.309017f, -0.809017f,//18
1155 -1.000000f, 0.000000f, 0.000000f,//19
1156 -0.809017f, 0.500000f, 0.309017f,//20
1157 -0.500000f, 0.309017f, 0.809017f,//21
1158 -0.500000f, -0.309017f, 0.809017f,//22
1159 0.000000f, 0.000000f, 1.000000f,//23
1160 -0.809017f, -0.500000f, 0.309017f,//24
1161 -0.809017f, -0.500000f, -0.309017f,//25
1162 -0.309017f, -0.809017f, 0.500000f,//26
1163 -0.500000f, -0.309017f, -0.809017f,//27
1164 -0.309017f, -0.809017f, -0.500000f,//28
1165 0.000000f, 0.000000f, -1.000000f,//29
1166 0.500000f, 0.309017f, -0.809017f,//30
1167 0.500000f, -0.309017f, -0.809017f,//31
1168 0.809017f, 0.500000f, -0.309017f,//32
1169 0.809017f, 0.500000f, 0.309017f,//33
1170 0.500000f, 0.309017f, 0.809017f,//34
1171 1.000000f, 0.000000f, 0.000000f,//35
1172 0.500000f, -0.309017f, 0.809017f,//36
1173 0.309017f, -0.809017f, 0.500000f,//37
1174 0.809017f, -0.500000f, 0.309017f,//38
1175 0.809017f, -0.500000f, -0.309017f,//39
1176 0.309017f, -0.809017f, -0.500000f,//40
1177 0.000000f, -1.000000f, 0.000000f,//41
1178 0.273267f, 0.961938f, 0.000000f,//42
1179 0.162460f, 0.951057f, 0.262866f,//43
1180 0.433889f, 0.862668f, 0.259892f,//44
1181 -0.273267f, 0.961938f, 0.000000f,//45
1182 -0.433889f, 0.862668f, 0.259892f,//46
1183 -0.162460f, 0.951057f, 0.262866f,//47
1184 -0.160622f, 0.693780f, 0.702046f,//48
1185 0.160622f, 0.693780f, 0.702046f,//49
1186 0.000000f, 0.850651f, 0.525731f,//50
1187 -0.162460f, 0.951057f, -0.262866f,//51
1188 -0.433889f, 0.862668f, -0.259892f,//52
1189 0.433889f, 0.862668f, -0.259892f,//53
1190 0.162460f, 0.951057f, -0.262866f,//54
1191 0.160622f, 0.693780f, -0.702046f,//55
1192 -0.160622f, 0.693780f, -0.702046f,//56
1193 0.000000f, 0.850651f, -0.525731f,//57
1194 -0.862668f, 0.259892f, -0.433889f,//58
1195 -0.688191f, 0.425325f, -0.587785f,//59
1196 -0.702046f, 0.160622f, -0.693780f,//60
1197 -0.693780f, 0.702046f, -0.160622f,//61
1198 -0.587785f, 0.688191f, -0.425325f,//62
1199 -0.259892f, 0.433889f, -0.862668f,//63
1200 -0.425325f, 0.587785f, -0.688191f,//64
1201 -0.850651f, 0.525731f, 0.000000f,//65
1202 -0.693780f, 0.702046f, 0.160622f,//66
1203 -0.961938f, 0.000000f, -0.273267f,//67
1204 -0.951057f, 0.262866f, -0.162460f,//68
1205 -0.961938f, 0.000000f, 0.273267f,//69
1206 -0.862668f, 0.259892f, 0.433889f,//70
1207 -0.951057f, 0.262866f, 0.162460f,//71
1208 -0.702046f, 0.160622f, 0.693780f,//72
1209 -0.688191f, 0.425325f, 0.587785f,//73
1210 -0.259892f, 0.433889f, 0.862668f,//74
1211 -0.425325f, 0.587785f, 0.688191f,//75
1212 -0.587785f, 0.688191f, 0.425325f,//76
1213 -0.262866f, 0.162460f, 0.951057f,//77
1214 0.000000f, 0.273267f, 0.961938f,//78
1215 -0.702046f, -0.160622f, 0.693780f,//79
1216 -0.525731f, 0.000000f, 0.850651f,//80
1217 -0.259892f, -0.433889f, 0.862668f,//81
1218 0.000000f, -0.273267f, 0.961938f,//82
1219 -0.262866f, -0.162460f, 0.951057f,//83
1220 -0.693780f, -0.702046f, 0.160622f,//84
1221 -0.850651f, -0.525731f, 0.000000f,//85
1222 -0.693780f, -0.702046f, -0.160622f,//86
1223 -0.862668f, -0.259892f, 0.433889f,//87
1224 -0.951057f, -0.262866f, 0.162460f,//88
1225 -0.862668f, -0.259892f, -0.433889f,//89
1226 -0.951057f, -0.262866f, -0.162460f,//90
1227 -0.688191f, -0.425325f, 0.587785f,//91
1228 -0.433889f, -0.862668f, 0.259892f,//92
1229 -0.587785f, -0.688191f, 0.425325f,//93
1230 -0.160622f, -0.693780f, 0.702046f,//94
1231 -0.425325f, -0.587785f, 0.688191f,//95
1232 -0.702046f, -0.160622f, -0.693780f,//96
1233 -0.688191f, -0.425325f, -0.587785f,//97
1234 -0.259892f, -0.433889f, -0.862668f,//98
1235 -0.160622f, -0.693780f, -0.702046f,//99
1236 -0.425325f, -0.587785f, -0.688191f,//100
1237 -0.433889f, -0.862668f, -0.259892f,//101
1238 -0.587785f, -0.688191f, -0.425325f,//102
1239 -0.262866f, -0.162460f, -0.951057f,//103
1240 0.000000f, -0.273267f, -0.961938f,//104
1241 -0.525731f, 0.000000f, -0.850651f,//105
1242 0.000000f, 0.273267f, -0.961938f,//106
1243 -0.262866f, 0.162460f, -0.951057f,//107
1244 0.259892f, 0.433889f, -0.862668f,//108
1245 0.262866f, 0.162460f, -0.951057f,//109
1246 0.702046f, 0.160622f, -0.693780f,//110
1247 0.702046f, -0.160622f, -0.693780f,//111
1248 0.525731f, 0.000000f, -0.850651f,//112
1249 0.259892f, -0.433889f, -0.862668f,//113
1250 0.262866f, -0.162460f, -0.951057f,//114
1251 0.688191f, 0.425325f, -0.587785f,//115
1252 0.862668f, 0.259892f, -0.433889f,//116
1253 0.425325f, 0.587785f, -0.688191f,//117
1254 0.693780f, 0.702046f, -0.160622f,//118
1255 0.587785f, 0.688191f, -0.425325f,//119
1256 0.862668f, 0.259892f, 0.433889f,//120
1257 0.688191f, 0.425325f, 0.587785f,//121
1258 0.702046f, 0.160622f, 0.693780f,//122
1259 0.693780f, 0.702046f, 0.160622f,//123
1260 0.587785f, 0.688191f, 0.425325f,//124
1261 0.259892f, 0.433889f, 0.862668f,//125
1262 0.425325f, 0.587785f, 0.688191f,//126
1263 0.850651f, 0.525731f, 0.000000f,//127
1264 0.961938f, 0.000000f, 0.273267f,//128
1265 0.951057f, 0.262866f, 0.162460f,//129
1266 0.961938f, 0.000000f, -0.273267f,//130
1267 0.951057f, 0.262866f, -0.162460f,//131
1268 0.259892f, -0.433889f, 0.862668f,//132
1269 0.262866f, -0.162460f, 0.951057f,//133
1270 0.702046f, -0.160622f, 0.693780f,//134
1271 0.525731f, 0.000000f, 0.850651f,//135
1272 0.262866f, 0.162460f, 0.951057f,//136
1273 0.688191f, -0.425325f, 0.587785f,//137
1274 0.862668f, -0.259892f, 0.433889f,//138
1275 0.160622f, -0.693780f, 0.702046f,//139
1276 0.425325f, -0.587785f, 0.688191f,//140
1277 0.433889f, -0.862668f, 0.259892f,//141
1278 0.693780f, -0.702046f, 0.160622f,//142
1279 0.587785f, -0.688191f, 0.425325f,//143
1280 0.693780f, -0.702046f, -0.160622f,//144
1281 0.850651f, -0.525731f, 0.000000f,//145
1282 0.862668f, -0.259892f, -0.433889f,//146
1283 0.951057f, -0.262866f, -0.162460f,//147
1284 0.951057f, -0.262866f, 0.162460f,//148
1285 0.688191f, -0.425325f, -0.587785f,//149
1286 0.433889f, -0.862668f, -0.259892f,//150
1287 0.587785f, -0.688191f, -0.425325f,//151
1288 0.160622f, -0.693780f, -0.702046f,//152
1289 0.425325f, -0.587785f, -0.688191f,//153
1290 0.273267f, -0.961938f, 0.000000f,//154
1291 0.162460f, -0.951057f, -0.262866f,//155
1292 -0.273267f, -0.961938f, 0.000000f,//156
1293 -0.162460f, -0.951057f, -0.262866f,//157
1294 0.000000f, -0.850651f, -0.525731f,//158
1295 -0.162460f, -0.951057f, 0.262866f,//159
1296 0.162460f, -0.951057f, 0.262866f,//160
1297 0.000000f, -0.850651f, 0.525731f//,//161
1298 };
1299 QString selFilter;
1300 QString name=fileName;
1301 name=name.replace(QRegExp("ins$|res$"),"obj");
1302 QString wfobj = QFileDialog::getSaveFileName ( 0,
1303 "Export Isosurfaces to WaveFront .obj file",
1304 name, "Wavefront (*.obj)",&selFilter,0);
1305 if (wfobj.isEmpty()) return;
1306 if (!wfobj.contains (QRegExp(".obj$"))) wfobj.append(".obj");
1307 QString wfmtl=wfobj;
1308
1309 wfmtl=wfmtl.replace(QRegExp("obj$"),"mtl");
1310 QString wfmtlbase=wfmtl.section('/', -1);
1311 QString base= wfmtlbase;
1312 base=base.remove(QRegExp("mtl$"));
1313 QString path=wfmtl.section('/',0, -2);
1314 //qDebug()<<wfmtlbase<<path;
1315 V3 centr=V3(0,0,0);
1316 {
1317 int na=0;
1318 for (int j=0; j<_atoms.size(); j++){
1319 if ((_atoms.at(j).hidden)) continue;
1320 if ((nopm1)&&(_atoms.at(j).symmGroup)&&(_atoms.at(j).part<0))continue;
1321 centr+=_atoms.at(j).pos;
1322 na++;
1323 }
1324 centr*=1.0/na;
1325 }
1326 QFile of(wfobj);
1327 of.open(QIODevice::WriteOnly|QIODevice::Text);
1328 of.write(QString("#Created by MoleCoolQt\nmtllib %1\n")
1329 .arg(wfmtlbase)
1330 .toLatin1());
1331 uint kk=0,kk0=0;
1332 for (int j=0; j<_atoms.size();j++){
1333 if (_atoms.at(j).an<0)continue;
1334 if ((_atoms.at(j).hidden)) continue;
1335 if ((nopm1)&&(_atoms.at(j).symmGroup)&&(_atoms.at(j).part<0))continue;
1336 int myStyle = AtomStyle[_atoms.at(j).an];
1337 V3 ev;
1338 Matrix madp,madp1,madp2,madp3,m2;
1339 if ((myStyle& ATOM_STYLE_NOADP)==0){
1340 double *arr = jacobi(_atoms.at(j).uc,ev);
1341 double fiftypct=1.54;
1342 switch (proba ) {
1343 case 10 :fiftypct=0.76;break; //Hauptachsen der Eliipsoide 10% Wahrscheinlichkeit
1344 case 30 :fiftypct=1.19;break; //Hauptachsen der Eliipsoide 30% Wahrscheinlichkeit
1345 case 50 :fiftypct=1.54;break; //Hauptachsen der Eliipsoide 50% Wahrscheinlichkeit
1346 case 70 :fiftypct=1.91;break; //Hauptachsen der Eliipsoide 70% Wahrscheinlichkeit
1347 case 90 :fiftypct=2.50;break; //Hauptachsen der Eliipsoide 90% Wahrscheinlichkeit
1348 default: ;
1349 }
1350 madp=Matrix(fiftypct*sqrt(ev.x),0,0
1351 ,0,fiftypct*sqrt(ev.y),0,
1352 0,0,fiftypct*sqrt(ev.z));
1353 madp1=Matrix(fiftypct*sqrt(ev.x)*0.15,0,0
1354 ,0,fiftypct*sqrt(ev.y)*1.05,0,
1355 0,0,fiftypct*sqrt(ev.z)*1.05);
1356 madp2=Matrix(fiftypct*sqrt(ev.x)*1.050,0,0
1357 ,0,fiftypct*sqrt(ev.y)*0.15,0,
1358 0,0,fiftypct*sqrt(ev.z)*1.05);
1359 madp3=Matrix(fiftypct*sqrt(ev.x)*1.05,0,0
1360 ,0,fiftypct*sqrt(ev.y)*1.05,0,
1361 0,0,fiftypct*sqrt(ev.z)*0.15);
1362 m2=rotarb(arr);
1363 }
1364 of.write(QString("\no %1\n").arg(_atoms.at(j).Label).toLatin1());
1365 of.write(QString("\nusemtl %1\n").arg((_atoms.at(j).an<0)?_atoms.at(j).Label:PSE.at(_atoms.at(j).an)).toLatin1());
1366 for (int i=0; i<162; i++){
1367 V3 vec(vs[3*i],vs[3*i+1],vs[3*i+2]);
1368 if ((myStyle& ATOM_STYLE_NOADP)==0) vec=(m2*madp)*vec;
1369 else vec*=arad[_atoms.at(j).an];
1370 //vec=m2*vec;
1371 of.write(QString("v %1 %2 %3\n")
1372 .arg(_atoms.at(j).pos.x + vec.x - centr.x,12,'f',6)
1373 .arg(_atoms.at(j).pos.y + vec.y - centr.y,12,'f',6)
1374 .arg(_atoms.at(j).pos.z + vec.z - centr.z,12,'f',6)
1375 .toLatin1()
1376 );
1377 kk++;
1378 }
1379 if (kk0==0)for (int i=0; i<162; i++){
1380 of.write(QString("vn %1 %2 %3\n")
1381 .arg(vs[3*i],12,'f',6)
1382 .arg(vs[3*i+1],12,'f',6)
1383 .arg(vs[3*i+2],12,'f',6)
1384 .toLatin1()
1385 );
1386 }
1387 //of.write(QString("\nusemtl %1\n").arg((_atoms.at(j).an<0)?_atoms.at(j).Label:PSE.at(_atoms.at(j).an)).toLatin1());
1388 for (int i=0; i<960/3;i++){
1389 uint n= idx2[3*i]+1+kk0;
1390 uint m= idx2[3*i+1]+1+kk0;
1391 uint o= idx2[3*i+2]+1+kk0;
1392 of.write(QString("f %1//%4 %2//%5 %3//%6\n")
1393 .arg(n).arg(m).arg(o)
1394 .arg(n-kk0).arg(m-kk0).arg(o-kk0).toLatin1());
1395
1396 }
1397 kk0=kk;
1398 if ((myStyle& ATOM_STYLE_RINGS)&&(myStyle& ATOM_STYLE_NOADP)==0){
1399 of.write(QString("\no %1\n").arg(_atoms.at(j).Label).toLatin1());
1400 of.write(QString("\nusemtl %1\n").arg((myStyle&ATOM_STYLE_WHITERING)?"white":"black").toLatin1());
1401 for (int i=0; i<162; i++){
1402 V3 vec(vs[3*i],vs[3*i+1],vs[3*i+2]);
1403 if ((myStyle& ATOM_STYLE_NOADP)==0) vec=(m2*madp1)*vec;
1404 else vec*=arad[_atoms.at(j).an];
1405 //vec=m2*vec;
1406 of.write(QString("v %1 %2 %3\n")
1407 .arg(_atoms.at(j).pos.x + vec.x - centr.x,12,'f',6)
1408 .arg(_atoms.at(j).pos.y + vec.y - centr.y,12,'f',6)
1409 .arg(_atoms.at(j).pos.z + vec.z - centr.z,12,'f',6)
1410 .toLatin1()
1411 );
1412 kk++;
1413 }
1414 //of.write(QString("\nusemtl %1\n").arg((_atoms.at(j).an<0)?_atoms.at(j).Label:PSE.at(_atoms.at(j).an)).toLatin1());
1415
1416 for (int i=0; i<960/3;i++){
1417 uint n= idx2[3*i]+1+kk0;
1418 uint m= idx2[3*i+1]+1+kk0;
1419 uint o= idx2[3*i+2]+1+kk0;
1420 of.write(QString("f %1 %2 %3\n")
1421 .arg(n).arg(m).arg(o)
1422 .toLatin1());
1423 }
1424 kk0=kk;
1425 for (int i=0; i<162; i++){
1426 V3 vec(vs[3*i],vs[3*i+1],vs[3*i+2]);
1427 if ((myStyle& ATOM_STYLE_NOADP)==0) vec=(m2*madp2)*vec;
1428 else vec*=arad[_atoms.at(j).an];
1429 //vec=m2*vec;
1430 of.write(QString("v %1 %2 %3\n")
1431 .arg(_atoms.at(j).pos.x + vec.x - centr.x,12,'f',6)
1432 .arg(_atoms.at(j).pos.y + vec.y - centr.y,12,'f',6)
1433 .arg(_atoms.at(j).pos.z + vec.z - centr.z,12,'f',6)
1434 .toLatin1()
1435 );
1436 kk++;
1437 }
1438 //of.write(QString("\nusemtl %1\n").arg((_atoms.at(j).an<0)?_atoms.at(j).Label:PSE.at(_atoms.at(j).an)).toLatin1());
1439
1440 for (int i=0; i<960/3;i++){
1441 uint n= idx2[3*i]+1+kk0;
1442 uint m= idx2[3*i+1]+1+kk0;
1443 uint o= idx2[3*i+2]+1+kk0;
1444 of.write(QString("f %1 %2 %3\n")
1445 .arg(n).arg(m).arg(o)
1446 .toLatin1());
1447 }
1448 kk0=kk;
1449 for (int i=0; i<162; i++){
1450 V3 vec(vs[3*i],vs[3*i+1],vs[3*i+2]);
1451 if ((myStyle& ATOM_STYLE_NOADP)==0) vec=(m2*madp3)*vec;
1452 else vec*=arad[_atoms.at(j).an];
1453 //vec=m2*vec;
1454 of.write(QString("v %1 %2 %3\n")
1455 .arg(_atoms.at(j).pos.x + vec.x - centr.x,12,'f',6)
1456 .arg(_atoms.at(j).pos.y + vec.y - centr.y,12,'f',6)
1457 .arg(_atoms.at(j).pos.z + vec.z - centr.z,12,'f',6)
1458 .toLatin1()
1459 );
1460 kk++;
1461 }
1462 //of.write(QString("\nusemtl %1\n").arg((_atoms.at(j).an<0)?_atoms.at(j).Label:PSE.at(_atoms.at(j).an)).toLatin1());
1463
1464 for (int i=0; i<960/3;i++){
1465 uint n= idx2[3*i]+1+kk0;
1466 uint m= idx2[3*i+1]+1+kk0;
1467 uint o= idx2[3*i+2]+1+kk0;
1468 of.write(QString("f %1 %2 %3\n")
1469 .arg(n).arg(m).arg(o)
1470 .toLatin1());
1471 }
1472 kk0=kk;
1473 }
1474 }//atoms
1475 for (int j=0; j<_bonds.size(); j++){
1476
1477 if (_bonds.at(j).ato1->hidden) continue;
1478 if (_bonds.at(j).ato2->hidden) continue;
1479 if ((nopm1)&&(_bonds.at(j).ato1->symmGroup)&&(_bonds.at(j).ato1->part<0))continue;
1480 if ((nopm1)&&(_bonds.at(j).ato2->symmGroup)&&(_bonds.at(j).ato2->part<0))continue;
1481 V3 bondir= Normalize(_bonds.at(j).ato1->pos-_bonds.at(j).ato2->pos);
1482 bondir*=_bonds.at(j).length/2;
1483 V3 vec1;
1484 vec1.x=(_bonds.at(j).ato2->pos.y-_bonds.at(j).ato1->pos.y);
1485 vec1.y=(_bonds.at(j).ato1->pos.x-_bonds.at(j).ato2->pos.x);
1486 vec1.z=0;
1487 if (Norm(vec1)>0.00000001) vec1=Normalize(vec1);
1488 else vec1=V3(0,1,0);
1489 V3 anf=_bonds.at(j).ato1->pos - centr -bondir;
1490 V3 anf2=_bonds.at(j).ato2->pos - centr +bondir;
1491 double arr[4];
1492 arr[0]=acos(((_bonds.at(j).ato1->pos.z-_bonds.at(j).ato2->pos.z)/
1493 (sqrt((_bonds.at(j).ato1->pos.x-_bonds.at(j).ato2->pos.x)*(_bonds.at(j).ato1->pos.x-_bonds.at(j).ato2->pos.x)+
1494 (_bonds.at(j).ato1->pos.y-_bonds.at(j).ato2->pos.y)*(_bonds.at(j).ato1->pos.y-_bonds.at(j).ato2->pos.y)+
1495 (_bonds.at(j).ato1->pos.z-_bonds.at(j).ato2->pos.z)*(_bonds.at(j).ato1->pos.z-_bonds.at(j).ato2->pos.z)))))/M_PI*180.0;
1496 arr[1]=vec1.x;
1497 arr[2]=vec1.y;
1498 arr[3]=vec1.z;
1499 Matrix m2=rotarb(arr);
1500 of.write(QString("\no %1=%2\n").arg(_bonds.at(j).ato1->Label).arg(_bonds.at(j).ato2->Label).toLatin1());
1501 of.write(QString("\nusemtl %1\n").arg((bondColorStyle)?"bond": PSE.at(_bonds.at(j).ato1->an)).toLatin1());
1502 Matrix m1(bondStrength,0,0,
1503 0,bondStrength,0,
1504 0,0,_bonds.at(j).length/2);
1505 for (int i=0; i<40; i++){
1506 V3 vec(vc[3*i],vc[3*i+1],vc[3*i+2]);
1507 vec=(m2*m1)*vec;
1508 of.write(QString("v %1 %2 %3\n")
1509 .arg(anf.x + vec.x ,12,'f',6)
1510 .arg(anf.y + vec.y ,12,'f',6)
1511 .arg(anf.z + vec.z ,12,'f',6)
1512 .toLatin1()
1513 );
1514
1515 kk++;
1516 }
1517 for (int i=0; i<20;i++){
1518 uint n= idxc[3*i]+1+kk0;
1519 uint m= idxc[3*i+1]+1+kk0;
1520 uint o= idxc[3*i+2]+1+kk0;
1521 of.write(QString("f %1 %2 %3\n") .arg(n).arg(m).arg(o) .toLatin1());
1522 //of.write(QString("f %1//%4 %2//%5 %3//%6\n")
1523 //.arg(n-kk0).arg(m-kk0).arg(o-kk0)
1524
1525 }
1526 kk0=kk;
1527 //*
1528 vec1.x=(_bonds.at(j).ato1->pos.y-_bonds.at(j).ato2->pos.y);
1529 vec1.y=(_bonds.at(j).ato2->pos.x-_bonds.at(j).ato1->pos.x);
1530 vec1.z=0;
1531 if (Norm(vec1)>0.00000001) vec1=Normalize(vec1);
1532 else vec1=V3(0,1,0);
1533 arr[0]=acos(((_bonds.at(j).ato2->pos.z-_bonds.at(j).ato1->pos.z)/
1534 (sqrt((_bonds.at(j).ato2->pos.x-_bonds.at(j).ato1->pos.x)*(_bonds.at(j).ato2->pos.x-_bonds.at(j).ato1->pos.x)+
1535 (_bonds.at(j).ato2->pos.y-_bonds.at(j).ato1->pos.y)*(_bonds.at(j).ato2->pos.y-_bonds.at(j).ato1->pos.y)+
1536 (_bonds.at(j).ato2->pos.z-_bonds.at(j).ato1->pos.z)*(_bonds.at(j).ato2->pos.z-_bonds.at(j).ato1->pos.z)))))/M_PI*180.0;
1537 arr[1]=vec1.x;
1538 arr[2]=vec1.y;
1539 arr[3]=vec1.z;
1540 Matrix m3=rotarb(arr);
1541 of.write(QString("\no %1=%2\n").arg(_bonds.at(j).ato2->Label).arg(_bonds.at(j).ato1->Label).toLatin1());
1542 of.write(QString("\nusemtl %1\n").arg((bondColorStyle)?"bond": PSE.at(_bonds.at(j).ato2->an)).toLatin1());
1543 for (int i=0; i<40; i++){
1544 V3 vec(vc[3*i],vc[3*i+1],vc[3*i+2]);
1545 vec=(m3*m1)*vec;
1546 of.write(QString("v %1 %2 %3\n")
1547 .arg(anf2.x + vec.x ,12,'f',6)
1548 .arg(anf2.y + vec.y ,12,'f',6)
1549 .arg(anf2.z + vec.z ,12,'f',6)
1550 .toLatin1()
1551 );
1552
1553 kk++;
1554 }
1555 for (int i=0; i<20;i++){
1556 uint n= idxc[3*i]+1+kk0;
1557 uint m= idxc[3*i+1]+1+kk0;
1558 uint o= idxc[3*i+2]+1+kk0;
1559 of.write(QString("f %1 %2 %3\n") .arg(n).arg(m).arg(o) .toLatin1());
1560 //of.write(QString("f %1//%4 %2//%5 %3//%6\n")
1561 //.arg(n-kk0).arg(m-kk0).arg(o-kk0)
1562
1563 }
1564 kk0=kk;
1565 // */
1566 }
1567 of.close();
1568 QFile mf(wfmtl);
1569 mf.open(QIODevice::WriteOnly|QIODevice::Text);
1570 for (int i=0; i<PSE.size(); i++){
1571 mf.write(QString("newmtl %1\n").arg(PSE.at(i)).toLatin1());
1572 //mf.write(QString("Kd %1 %2 %3\nKs %1 %2 %3\nNs 1000.0\n\n").arg(AtomColor[i].redF()).arg(AtomColor[i].greenF()).arg(AtomColor[i].blueF()).toLatin1());
1573 mf.write(QString("Kd %1 %2 %3\nKs 0.2 0.2 0.2\nNs 1000.0\n\n").arg(AtomColor[i].redF()).arg(AtomColor[i].greenF()).arg(AtomColor[i].blueF()).toLatin1());
1574 }
1575 mf.write(QString("newmtl bond\nKd %1 %2 %3\nKs 0 0 0\n\n").arg(bondColor.redF()).arg(bondColor.greenF()).arg(bondColor.blueF()).toLatin1());
1576 mf.write(QString("newmtl black\nKd 0 0 0\nKs 0 0 0\n\n").toLatin1());
1577 mf.write(QString("newmtl white\nKd 1 1 1\nKs 0 0 0\n\n").toLatin1());
1578 mf.close();
1579
1580 }
1581
myCylinder(int rod)1582 void Molecule::myCylinder(int rod){
1583 static const GLuint idx3[120] = {
1584 0, 20, 1, 1, 20, 21,
1585 1, 21, 2, 2, 21, 22,
1586 2, 22, 3, 3, 22, 23,
1587 3, 23, 4, 4, 23, 24,
1588 4, 24, 5, 5, 24, 25,
1589 5, 25, 6, 6, 25, 26,
1590 6, 26, 7, 7, 26, 27,
1591 7, 27, 8, 8, 27, 28,
1592 8, 28, 9, 9, 28, 29,
1593 9, 29, 10, 10, 29, 30,
1594 10, 30, 11, 11, 30, 31,
1595 11, 31, 12, 12, 31, 32,
1596 12, 32, 13, 13, 32, 33,
1597 13, 33, 14, 14, 33, 34,
1598 14, 34, 15, 15, 34, 35,
1599 15, 35, 16, 16, 35, 36,
1600 16, 36, 17, 17, 36, 37,
1601 17, 37, 18, 18, 37, 38,
1602 18, 38, 19, 19, 38, 39,
1603 19, 39, 0, 0, 39, 20
1604 };
1605 static const GLuint idx2[60] = {
1606 0, 20, 2, 2, 20, 22,
1607 2, 22, 4, 4, 22, 24,
1608 4, 24, 6, 6, 24, 26,
1609 6, 26, 8, 8, 26, 28,
1610 8, 28, 10, 10, 28, 30,
1611 10, 30, 12, 12, 30, 32,
1612 12, 32, 14, 14, 32, 34,
1613 14, 34, 16, 16, 34, 36,
1614 16, 36, 18, 18, 36, 38,
1615 18, 38, 0, 0, 38, 20,
1616 };
1617 static const GLuint idx1[30] = {
1618 0, 20, 4, 4, 20, 24,
1619 4, 24, 8, 8, 24, 28,
1620 8, 28, 12, 12, 28, 32,
1621 12, 32, 16, 16, 32, 36,
1622 16, 36, 0, 0, 36, 20,
1623 };
1624 static const GLfloat v[120] = {
1625 1.000000000f, 0.000000000f, 0.000000000f,//0
1626 0.951056516f, 0.309016994f, 0.000000000f,//18
1627 0.809016994f, 0.587785252f, 0.000000000f,//36
1628 0.587785252f, 0.809016994f, 0.000000000f,//54
1629 0.309016994f, 0.951056516f, 0.000000000f,//72
1630 0.000000000f, 1.000000000f, 0.000000000f,//90
1631 -0.309016994f, 0.951056516f, 0.000000000f,//108
1632 -0.587785252f, 0.809016994f, 0.000000000f,//126
1633 -0.809016994f, 0.587785252f, 0.000000000f,//144
1634 -0.951056516f, 0.309016994f, 0.000000000f,//162
1635 -1.000000000f, 0.000000000f, 0.000000000f,//180
1636 -0.951056516f,-0.309016994f, 0.000000000f,//198
1637 -0.809016994f,-0.587785252f, 0.000000000f,//216
1638 -0.587785252f,-0.809016994f, 0.000000000f,//234
1639 -0.309016994f,-0.951056516f, 0.000000000f,//252
1640 -0.000000000f,-1.000000000f, 0.000000000f,//270
1641 0.309016994f,-0.951056516f, 0.000000000f,//288
1642 0.587785252f,-0.809016994f, 0.000000000f,//306
1643 0.809016994f,-0.587785252f, 0.000000000f,//324
1644 0.951056516f,-0.309016994f, 0.000000000f,//342
1645 1.000000000f, 0.000000000f, 1.000000000f,//0
1646 0.951056516f, 0.309016994f, 1.000000000f,//18
1647 0.809016994f, 0.587785252f, 1.000000000f,//36
1648 0.587785252f, 0.809016994f, 1.000000000f,//54
1649 0.309016994f, 0.951056516f, 1.000000000f,//72
1650 0.000000000f, 1.000000000f, 1.000000000f,//90
1651 -0.309016994f, 0.951056516f, 1.000000000f,//108
1652 -0.587785252f, 0.809016994f, 1.000000000f,//126
1653 -0.809016994f, 0.587785252f, 1.000000000f,//144
1654 -0.951056516f, 0.309016994f, 1.000000000f,//162
1655 -1.000000000f, 0.000000000f, 1.000000000f,//180
1656 -0.951056516f,-0.309016994f, 1.000000000f,//198
1657 -0.809016994f,-0.587785252f, 1.000000000f,//216
1658 -0.587785252f,-0.809016994f, 1.000000000f,//234
1659 -0.309016994f,-0.951056516f, 1.000000000f,//252
1660 -0.000000000f,-1.000000000f, 1.000000000f,//270
1661 0.309016994f,-0.951056516f, 1.000000000f,//288
1662 0.587785252f,-0.809016994f, 1.000000000f,//306
1663 0.809016994f,-0.587785252f, 1.000000000f,//324
1664 0.951056516f,-0.309016994f, 1.000000000f//342
1665 };
1666 /* static const GLfloat n[120] = {
1667 1.000000000, 0.000000000, 0.000000000,//0
1668 0.951056516, 0.309016994, 0.000000000,//18
1669 0.809016994, 0.587785252, 0.000000000,//36
1670 0.587785252, 0.809016994, 0.000000000,//54
1671 0.309016994, 0.951056516, 0.000000000,//72
1672 0.000000000, 1.000000000, 0.000000000,//90
1673 -0.309016994, 0.951056516, 0.000000000,//108
1674 -0.587785252, 0.809016994, 0.000000000,//126
1675 -0.809016994, 0.587785252, 0.000000000,//144
1676 -0.951056516, 0.309016994, 0.000000000,//162
1677 -1.000000000, 0.000000000, 0.000000000,//180
1678 -0.951056516,-0.309016994, 0.000000000,//198
1679 -0.809016994,-0.587785252, 0.000000000,//216
1680 -0.587785252,-0.809016994, 0.000000000,//234
1681 -0.309016994,-0.951056516, 0.000000000,//252
1682 -0.000000000,-1.000000000, 0.000000000,//270
1683 0.309016994,-0.951056516, 0.000000000,//288
1684 0.587785252,-0.809016994, 0.000000000,//306
1685 0.809016994,-0.587785252, 0.000000000,//324
1686 0.951056516,-0.309016994, 0.000000000,//342
1687 1.000000000, 0.000000000, 0.000000000,//0
1688 0.951056516, 0.309016994, 0.000000000,//18
1689 0.809016994, 0.587785252, 0.000000000,//36
1690 0.587785252, 0.809016994, 0.000000000,//54
1691 0.309016994, 0.951056516, 0.000000000,//72
1692 0.000000000, 1.000000000, 0.000000000,//90
1693 -0.309016994, 0.951056516, 0.000000000,//108
1694 -0.587785252, 0.809016994, 0.000000000,//126
1695 -0.809016994, 0.587785252, 0.000000000,//144
1696 -0.951056516, 0.309016994, 0.000000000,//162
1697 -1.000000000, 0.000000000, 0.000000000,//180
1698 -0.951056516,-0.309016994, 0.000000000,//198
1699 -0.809016994,-0.587785252, 0.000000000,//216
1700 -0.587785252,-0.809016994, 0.000000000,//234
1701 -0.309016994,-0.951056516, 0.000000000,//252
1702 -0.000000000,-1.000000000, 0.000000000,//270
1703 0.309016994,-0.951056516, 0.000000000,//288
1704 0.587785252,-0.809016994, 0.000000000,//306
1705 0.809016994,-0.587785252, 0.000000000,//324
1706 0.951056516,-0.309016994, 0.000000000//342
1707 };*/
1708 static const GLfloat n[120] = {
1709 -1.000000000f,-0.000000000f, 0.000000000f,//0
1710 -0.951056516f,-0.309016994f, 0.000000000f,//18
1711 -0.809016994f,-0.587785252f, 0.000000000f,//36
1712 -0.587785252f,-0.809016994f, 0.000000000f,//54
1713 -0.309016994f,-0.951056516f, 0.000000000f,//72
1714 0.000000000f,-1.000000000f, 0.000000000f,//90
1715 0.309016994f,-0.951056516f, 0.000000000f,//108
1716 0.587785252f,-0.809016994f, 0.000000000f,//126
1717 0.809016994f,-0.587785252f, 0.000000000f,//144
1718 0.951056516f,-0.309016994f, 0.000000000f,//162
1719 1.000000000f, 0.000000000f, 0.000000000f,//180
1720 0.951056516f, 0.309016994f, 0.000000000f,//198
1721 0.809016994f, 0.587785252f, 0.000000000f,//216
1722 0.587785252f, 0.809016994f, 0.000000000f,//234
1723 0.309016994f, 0.951056516f, 0.000000000f,//252
1724 0.000000000f, 1.000000000f, 0.000000000f,//270
1725 -0.309016994f, 0.951056516f, 0.000000000f,//288
1726 -0.587785252f, 0.809016994f, 0.000000000f,//306
1727 -0.809016994f, 0.587785252f, 0.000000000f,//324
1728 -0.951056516f, 0.309016994f, 0.000000000f,//342
1729 -1.000000000f, 0.000000000f, 0.000000000f,//0
1730 -0.951056516f,-0.309016994f, 0.000000000f,//18
1731 -0.809016994f,-0.587785252f, 0.000000000f,//36
1732 -0.587785252f,-0.809016994f, 0.000000000f,//54
1733 -0.309016994f,-0.951056516f, 0.000000000f,//72
1734 0.000000000f,-1.000000000f, 0.000000000f,//90
1735 0.309016994f,-0.951056516f, 0.000000000f,//108
1736 0.587785252f,-0.809016994f, 0.000000000f,//126
1737 0.809016994f,-0.587785252f, 0.000000000f,//144
1738 0.951056516f,-0.309016994f, 0.000000000f,//162
1739 1.000000000f, 0.000000000f, 0.000000000f,//180
1740 0.951056516f, 0.309016994f, 0.000000000f,//198
1741 0.809016994f, 0.587785252f, 0.000000000f,//216
1742 0.587785252f, 0.809016994f, 0.000000000f,//234
1743 0.309016994f, 0.951056516f, 0.000000000f,//252
1744 0.000000000f, 1.000000000f, 0.000000000f,//270
1745 -0.309016994f, 0.951056516f, 0.000000000f,//288
1746 -0.587785252f, 0.809016994f, 0.000000000f,//306
1747 -0.809016994f, 0.587785252f, 0.000000000f,//324
1748 -0.951056516f, 0.309016994f, 0.000000000f//342
1749 };
1750 static const GLshort t[80] = {
1751 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1752 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1753 };
1754 glEnableClientState(GL_VERTEX_ARRAY);
1755 glVertexPointer(3, GL_FLOAT, 0, v);
1756 glEnableClientState(GL_NORMAL_ARRAY);
1757 glNormalPointer(GL_FLOAT, 0, n);
1758 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
1759 glTexCoordPointer(2, GL_SHORT, 0, t);
1760 switch (rod){
1761 case 1:glDrawElements(GL_TRIANGLES, 30, GL_UNSIGNED_INT,idx1);break;
1762 case 2:glDrawElements(GL_TRIANGLES, 60, GL_UNSIGNED_INT,idx2);break;
1763 case 3:glDrawElements(GL_TRIANGLES, 120, GL_UNSIGNED_INT,idx3);break;
1764 }
1765 glDisableClientState(GL_VERTEX_ARRAY);
1766 glDisableClientState(GL_NORMAL_ARRAY);
1767 }
1768
cylinder(double strength,double length)1769 void Molecule::cylinder(double strength, double length){
1770 glPushMatrix();
1771 glScaled(strength,strength,length);
1772 myCylinder(qMin(LOD-1,3));
1773 glPopMatrix();
1774 }
1775
mySphere(int bal)1776 void Molecule::mySphere(int bal){
1777 static const GLuint idx1[240] = {
1778 1, 12, 14,// 0 0.546533 0.618034 0.546533
1779 12, 0, 13,// 1 0.546533 0.546533 0.618034
1780 13, 5, 14,// 2 0.546533 0.546533 0.618034
1781 12, 13, 14,// 3 0.618034 0.618034 0.618034
1782 0, 12, 16,// 4 0.546533 0.618034 0.546533
1783 12, 1, 15,// 5 0.546533 0.546533 0.618034
1784 15, 7, 16,// 6 0.546533 0.546533 0.618034
1785 12, 15, 16,// 7 0.618034 0.618034 0.618034
1786 10, 17, 18,// 8 0.546533 0.618034 0.546533
1787 17, 0, 16,// 9 0.546533 0.546533 0.618034
1788 16, 7, 18,// 10 0.546533 0.546533 0.618034
1789 17, 16, 18,// 11 0.618034 0.618034 0.618034
1790 0, 17, 20,// 12 0.546533 0.618034 0.546533
1791 17, 10, 19,// 13 0.546533 0.546533 0.618034
1792 19, 11, 20,// 14 0.546533 0.546533 0.618034
1793 17, 19, 20,// 15 0.618034 0.618034 0.618034
1794 11, 21, 20,// 16 0.546533 0.618034 0.546533
1795 21, 5, 13,// 17 0.546533 0.546533 0.618034
1796 13, 0, 20,// 18 0.546533 0.546533 0.618034
1797 21, 13, 20,// 19 0.618034 0.618034 0.618034
1798 5, 21, 23,// 20 0.546533 0.618034 0.546533
1799 21, 11, 22,// 21 0.546533 0.546533 0.618034
1800 22, 4, 23,// 22 0.546533 0.546533 0.618034
1801 21, 22, 23,// 23 0.618034 0.618034 0.618034
1802 2, 24, 25,// 24 0.546533 0.618034 0.546533
1803 24, 11, 19,// 25 0.546533 0.546533 0.618034
1804 19, 10, 25,// 26 0.546533 0.546533 0.618034
1805 24, 19, 25,// 27 0.618034 0.618034 0.618034
1806 11, 24, 22,// 28 0.546533 0.618034 0.546533
1807 24, 2, 26,// 29 0.546533 0.546533 0.618034
1808 26, 4, 22,// 30 0.546533 0.546533 0.618034
1809 24, 26, 22,// 31 0.618034 0.618034 0.618034
1810 10, 27, 25,// 32 0.546533 0.618034 0.546533
1811 27, 6, 28,// 33 0.546533 0.546533 0.618034
1812 28, 2, 25,// 34 0.546533 0.546533 0.618034
1813 27, 28, 25,// 35 0.618034 0.618034 0.618034
1814 6, 27, 29,// 36 0.546533 0.618034 0.546533
1815 27, 10, 18,// 37 0.546533 0.546533 0.618034
1816 18, 7, 29,// 38 0.546533 0.546533 0.618034
1817 27, 18, 29,// 39 0.618034 0.618034 0.618034
1818 7, 30, 29,// 40 0.546533 0.618034 0.546533
1819 30, 8, 31,// 41 0.546533 0.546533 0.618034
1820 31, 6, 29,// 42 0.546533 0.546533 0.618034
1821 30, 31, 29,// 43 0.618034 0.618034 0.618034
1822 8, 30, 32,// 44 0.546533 0.618034 0.546533
1823 30, 7, 15,// 45 0.546533 0.546533 0.618034
1824 15, 1, 32,// 46 0.546533 0.546533 0.618034
1825 30, 15, 32,// 47 0.618034 0.618034 0.618034
1826 9, 33, 34,// 48 0.546533 0.618034 0.546533
1827 33, 1, 14,// 49 0.546533 0.546533 0.618034
1828 14, 5, 34,// 50 0.546533 0.546533 0.618034
1829 33, 14, 34,// 51 0.618034 0.618034 0.618034
1830 1, 33, 32,// 52 0.546533 0.618034 0.546533
1831 33, 9, 35,// 53 0.546533 0.546533 0.618034
1832 35, 8, 32,// 54 0.546533 0.546533 0.618034
1833 33, 35, 32,// 55 0.618034 0.618034 0.618034
1834 4, 36, 23,// 56 0.546533 0.618034 0.546533
1835 36, 9, 34,// 57 0.546533 0.546533 0.618034
1836 34, 5, 23,// 58 0.546533 0.546533 0.618034
1837 36, 34, 23,// 59 0.618034 0.618034 0.618034
1838 9, 36, 38,// 60 0.546533 0.618034 0.546533
1839 36, 4, 37,// 61 0.546533 0.546533 0.618034
1840 37, 3, 38,// 62 0.546533 0.546533 0.618034
1841 36, 37, 38,// 63 0.618034 0.618034 0.618034
1842 3, 39, 38,// 64 0.546533 0.618034 0.546533
1843 39, 8, 35,// 65 0.546533 0.546533 0.618034
1844 35, 9, 38,// 66 0.546533 0.546533 0.618034
1845 39, 35, 38,// 67 0.618034 0.618034 0.618034
1846 8, 39, 31,// 68 0.546533 0.618034 0.546533
1847 39, 3, 40,// 69 0.546533 0.546533 0.618034
1848 40, 6, 31,// 70 0.546533 0.546533 0.618034
1849 39, 40, 31,// 71 0.618034 0.618034 0.618034
1850 3, 41, 40,// 72 0.546533 0.618034 0.546533
1851 41, 2, 28,// 73 0.546533 0.546533 0.618034
1852 28, 6, 40,// 74 0.546533 0.546533 0.618034
1853 41, 28, 40,// 75 0.618034 0.618034 0.618034
1854 2, 41, 26,// 76 0.546533 0.618034 0.546533
1855 41, 3, 37,// 77 0.546533 0.546533 0.618034
1856 37, 4, 26,// 78 0.546533 0.546533 0.618034
1857 41, 37, 26 // 79 0.618034 0.618034 0.618034
1858 };
1859 static const GLuint idx2[960] = {
1860 1, 42, 44,// 0 0.275904 0.321244 0.275904
1861 42, 12, 43,// 1 0.275904 0.312869 0.285473
1862 43, 14, 44,// 2 0.312869 0.275904 0.285473
1863 42, 43, 44,// 3 0.285473 0.285473 0.321244
1864 12, 45, 47,// 4 0.275904 0.285473 0.312869
1865 45, 0, 46,// 5 0.275904 0.275904 0.321244
1866 46, 13, 47,// 6 0.275904 0.312869 0.285473
1867 45, 46, 47,// 7 0.321244 0.285473 0.285473
1868 13, 48, 50,// 8 0.275904 0.285473 0.312869
1869 48, 5, 49,// 9 0.275904 0.275904 0.321244
1870 49, 14, 50,// 10 0.275904 0.312869 0.285473
1871 48, 49, 50,// 11 0.321244 0.285473 0.285473
1872 12, 47, 43,// 12 0.312869 0.324920 0.312869
1873 47, 13, 50,// 13 0.312869 0.312869 0.324920
1874 50, 14, 43,// 14 0.312869 0.312869 0.324920
1875 47, 50, 43,// 15 0.324920 0.324920 0.324920
1876 0, 45, 52,// 16 0.275904 0.321244 0.275904
1877 45, 12, 51,// 17 0.275904 0.312869 0.285473
1878 51, 16, 52,// 18 0.312869 0.275904 0.285473
1879 45, 51, 52,// 19 0.285473 0.285473 0.321244
1880 12, 42, 54,// 20 0.275904 0.285473 0.312869
1881 42, 1, 53,// 21 0.275904 0.275904 0.321244
1882 53, 15, 54,// 22 0.275904 0.312869 0.285473
1883 42, 53, 54,// 23 0.321244 0.285473 0.285473
1884 15, 55, 57,// 24 0.275904 0.285473 0.312869
1885 55, 7, 56,// 25 0.275904 0.275904 0.321244
1886 56, 16, 57,// 26 0.275904 0.312869 0.285473
1887 55, 56, 57,// 27 0.321244 0.285473 0.285473
1888 12, 54, 51,// 28 0.312869 0.324920 0.312869
1889 54, 15, 57,// 29 0.312869 0.312869 0.324920
1890 57, 16, 51,// 30 0.312869 0.312869 0.324920
1891 54, 57, 51,// 31 0.324920 0.324920 0.324920
1892 10, 58, 60,// 32 0.275904 0.321244 0.275904
1893 58, 17, 59,// 33 0.275904 0.312869 0.285473
1894 59, 18, 60,// 34 0.312869 0.275904 0.285473
1895 58, 59, 60,// 35 0.285473 0.285473 0.321244
1896 17, 61, 62,// 36 0.275904 0.285473 0.312869
1897 61, 0, 52,// 37 0.275904 0.275904 0.321244
1898 52, 16, 62,// 38 0.275904 0.312869 0.285473
1899 61, 52, 62,// 39 0.321244 0.285473 0.285473
1900 16, 56, 64,// 40 0.275904 0.285473 0.312869
1901 56, 7, 63,// 41 0.275904 0.275904 0.321244
1902 63, 18, 64,// 42 0.275904 0.312869 0.285473
1903 56, 63, 64,// 43 0.321244 0.285473 0.285473
1904 17, 62, 59,// 44 0.312869 0.324920 0.312869
1905 62, 16, 64,// 45 0.312869 0.312869 0.324920
1906 64, 18, 59,// 46 0.312869 0.312869 0.324920
1907 62, 64, 59,// 47 0.324920 0.324920 0.324920
1908 0, 61, 66,// 48 0.275904 0.321244 0.275904
1909 61, 17, 65,// 49 0.275904 0.312869 0.285473
1910 65, 20, 66,// 50 0.312869 0.275904 0.285473
1911 61, 65, 66,// 51 0.285473 0.285473 0.321244
1912 17, 58, 68,// 52 0.275904 0.285473 0.312869
1913 58, 10, 67,// 53 0.275904 0.275904 0.321244
1914 67, 19, 68,// 54 0.275904 0.312869 0.285473
1915 58, 67, 68,// 55 0.321244 0.285473 0.285473
1916 19, 69, 71,// 56 0.275904 0.285473 0.312869
1917 69, 11, 70,// 57 0.275904 0.275904 0.321244
1918 70, 20, 71,// 58 0.275904 0.312869 0.285473
1919 69, 70, 71,// 59 0.321244 0.285473 0.285473
1920 17, 68, 65,// 60 0.312869 0.324920 0.312869
1921 68, 19, 71,// 61 0.312869 0.312869 0.324920
1922 71, 20, 65,// 62 0.312869 0.312869 0.324920
1923 68, 71, 65,// 63 0.324920 0.324920 0.324920
1924 11, 72, 70,// 64 0.275904 0.321244 0.275904
1925 72, 21, 73,// 65 0.275904 0.312869 0.285473
1926 73, 20, 70,// 66 0.312869 0.275904 0.285473
1927 72, 73, 70,// 67 0.285473 0.285473 0.321244
1928 21, 74, 75,// 68 0.275904 0.285473 0.312869
1929 74, 5, 48,// 69 0.275904 0.275904 0.321244
1930 48, 13, 75,// 70 0.275904 0.312869 0.285473
1931 74, 48, 75,// 71 0.321244 0.285473 0.285473
1932 13, 46, 76,// 72 0.275904 0.285473 0.312869
1933 46, 0, 66,// 73 0.275904 0.275904 0.321244
1934 66, 20, 76,// 74 0.275904 0.312869 0.285473
1935 46, 66, 76,// 75 0.321244 0.285473 0.285473
1936 21, 75, 73,// 76 0.312869 0.324920 0.312869
1937 75, 13, 76,// 77 0.312869 0.312869 0.324920
1938 76, 20, 73,// 78 0.312869 0.312869 0.324920
1939 75, 76, 73,// 79 0.324920 0.324920 0.324920
1940 5, 74, 78,// 80 0.275904 0.321244 0.275904
1941 74, 21, 77,// 81 0.275904 0.312869 0.285473
1942 77, 23, 78,// 82 0.312869 0.275904 0.285473
1943 74, 77, 78,// 83 0.285473 0.285473 0.321244
1944 21, 72, 80,// 84 0.275904 0.285473 0.312869
1945 72, 11, 79,// 85 0.275904 0.275904 0.321244
1946 79, 22, 80,// 86 0.275904 0.312869 0.285473
1947 72, 79, 80,// 87 0.321244 0.285473 0.285473
1948 22, 81, 83,// 88 0.275904 0.285473 0.312869
1949 81, 4, 82,// 89 0.275904 0.275904 0.321244
1950 82, 23, 83,// 90 0.275904 0.312869 0.285473
1951 81, 82, 83,// 91 0.321244 0.285473 0.285473
1952 21, 80, 77,// 92 0.312869 0.324920 0.312869
1953 80, 22, 83,// 93 0.312869 0.312869 0.324920
1954 83, 23, 77,// 94 0.312869 0.312869 0.324920
1955 80, 83, 77,// 95 0.324920 0.324920 0.324920
1956 2, 84, 86,// 96 0.275904 0.321244 0.275904
1957 84, 24, 85,// 97 0.275904 0.312869 0.285473
1958 85, 25, 86,// 98 0.312869 0.275904 0.285473
1959 84, 85, 86,// 99 0.285473 0.285473 0.321244
1960 24, 87, 88,//100 0.275904 0.285473 0.312869
1961 87, 11, 69,//101 0.275904 0.275904 0.321244
1962 69, 19, 88,//102 0.275904 0.312869 0.285473
1963 87, 69, 88,//103 0.321244 0.285473 0.285473
1964 19, 67, 90,//104 0.275904 0.285473 0.312869
1965 67, 10, 89,//105 0.275904 0.275904 0.321244
1966 89, 25, 90,//106 0.275904 0.312869 0.285473
1967 67, 89, 90,//107 0.321244 0.285473 0.285473
1968 24, 88, 85,//108 0.312869 0.324920 0.312869
1969 88, 19, 90,//109 0.312869 0.312869 0.324920
1970 90, 25, 85,//110 0.312869 0.312869 0.324920
1971 88, 90, 85,//111 0.324920 0.324920 0.324920
1972 11, 87, 79,//112 0.275904 0.321244 0.275904
1973 87, 24, 91,//113 0.275904 0.312869 0.285473
1974 91, 22, 79,//114 0.312869 0.275904 0.285473
1975 87, 91, 79,//115 0.285473 0.285473 0.321244
1976 24, 84, 93,//116 0.275904 0.285473 0.312869
1977 84, 2, 92,//117 0.275904 0.275904 0.321244
1978 92, 26, 93,//118 0.275904 0.312869 0.285473
1979 84, 92, 93,//119 0.321244 0.285473 0.285473
1980 26, 94, 95,//120 0.275904 0.285473 0.312869
1981 94, 4, 81,//121 0.275904 0.275904 0.321244
1982 81, 22, 95,//122 0.275904 0.312869 0.285473
1983 94, 81, 95,//123 0.321244 0.285473 0.285473
1984 24, 93, 91,//124 0.312869 0.324920 0.312869
1985 93, 26, 95,//125 0.312869 0.312869 0.324920
1986 95, 22, 91,//126 0.312869 0.312869 0.324920
1987 93, 95, 91,//127 0.324920 0.324920 0.324920
1988 10, 96, 89,//128 0.275904 0.321244 0.275904
1989 96, 27, 97,//129 0.275904 0.312869 0.285473
1990 97, 25, 89,//130 0.312869 0.275904 0.285473
1991 96, 97, 89,//131 0.285473 0.285473 0.321244
1992 27, 98, 100,//132 0.275904 0.285473 0.312869
1993 98, 6, 99,//133 0.275904 0.275904 0.321244
1994 99, 28, 100,//134 0.275904 0.312869 0.285473
1995 98, 99, 100,//135 0.321244 0.285473 0.285473
1996 28, 101, 102,//136 0.275904 0.285473 0.312869
1997 101, 2, 86,//137 0.275904 0.275904 0.321244
1998 86, 25, 102,//138 0.275904 0.312869 0.285473
1999 101, 86, 102,//139 0.321244 0.285473 0.285473
2000 27, 100, 97,//140 0.312869 0.324920 0.312869
2001 100, 28, 102,//141 0.312869 0.312869 0.324920
2002 102, 25, 97,//142 0.312869 0.312869 0.324920
2003 100, 102, 97,//143 0.324920 0.324920 0.324920
2004 6, 98, 104,//144 0.275904 0.321244 0.275904
2005 98, 27, 103,//145 0.275904 0.312869 0.285473
2006 103, 29, 104,//146 0.312869 0.275904 0.285473
2007 98, 103, 104,//147 0.285473 0.285473 0.321244
2008 27, 96, 105,//148 0.275904 0.285473 0.312869
2009 96, 10, 60,//149 0.275904 0.275904 0.321244
2010 60, 18, 105,//150 0.275904 0.312869 0.285473
2011 96, 60, 105,//151 0.321244 0.285473 0.285473
2012 18, 63, 107,//152 0.275904 0.285473 0.312869
2013 63, 7, 106,//153 0.275904 0.275904 0.321244
2014 106, 29, 107,//154 0.275904 0.312869 0.285473
2015 63, 106, 107,//155 0.321244 0.285473 0.285473
2016 27, 105, 103,//156 0.312869 0.324920 0.312869
2017 105, 18, 107,//157 0.312869 0.312869 0.324920
2018 107, 29, 103,//158 0.312869 0.312869 0.324920
2019 105, 107, 103,//159 0.324920 0.324920 0.324920
2020 7, 108, 106,//160 0.275904 0.321244 0.275904
2021 108, 30, 109,//161 0.275904 0.312869 0.285473
2022 109, 29, 106,//162 0.312869 0.275904 0.285473
2023 108, 109, 106,//163 0.285473 0.285473 0.321244
2024 30, 110, 112,//164 0.275904 0.285473 0.312869
2025 110, 8, 111,//165 0.275904 0.275904 0.321244
2026 111, 31, 112,//166 0.275904 0.312869 0.285473
2027 110, 111, 112,//167 0.321244 0.285473 0.285473
2028 31, 113, 114,//168 0.275904 0.285473 0.312869
2029 113, 6, 104,//169 0.275904 0.275904 0.321244
2030 104, 29, 114,//170 0.275904 0.312869 0.285473
2031 113, 104, 114,//171 0.321244 0.285473 0.285473
2032 30, 112, 109,//172 0.312869 0.324920 0.312869
2033 112, 31, 114,//173 0.312869 0.312869 0.324920
2034 114, 29, 109,//174 0.312869 0.312869 0.324920
2035 112, 114, 109,//175 0.324920 0.324920 0.324920
2036 8, 110, 116,//176 0.275904 0.321244 0.275904
2037 110, 30, 115,//177 0.275904 0.312869 0.285473
2038 115, 32, 116,//178 0.312869 0.275904 0.285473
2039 110, 115, 116,//179 0.285473 0.285473 0.321244
2040 30, 108, 117,//180 0.275904 0.285473 0.312869
2041 108, 7, 55,//181 0.275904 0.275904 0.321244
2042 55, 15, 117,//182 0.275904 0.312869 0.285473
2043 108, 55, 117,//183 0.321244 0.285473 0.285473
2044 15, 53, 119,//184 0.275904 0.285473 0.312869
2045 53, 1, 118,//185 0.275904 0.275904 0.321244
2046 118, 32, 119,//186 0.275904 0.312869 0.285473
2047 53, 118, 119,//187 0.321244 0.285473 0.285473
2048 30, 117, 115,//188 0.312869 0.324920 0.312869
2049 117, 15, 119,//189 0.312869 0.312869 0.324920
2050 119, 32, 115,//190 0.312869 0.312869 0.324920
2051 117, 119, 115,//191 0.324920 0.324920 0.324920
2052 9, 120, 122,//192 0.275904 0.321244 0.275904
2053 120, 33, 121,//193 0.275904 0.312869 0.285473
2054 121, 34, 122,//194 0.312869 0.275904 0.285473
2055 120, 121, 122,//195 0.285473 0.285473 0.321244
2056 33, 123, 124,//196 0.275904 0.285473 0.312869
2057 123, 1, 44,//197 0.275904 0.275904 0.321244
2058 44, 14, 124,//198 0.275904 0.312869 0.285473
2059 123, 44, 124,//199 0.321244 0.285473 0.285473
2060 14, 49, 126,//200 0.275904 0.285473 0.312869
2061 49, 5, 125,//201 0.275904 0.275904 0.321244
2062 125, 34, 126,//202 0.275904 0.312869 0.285473
2063 49, 125, 126,//203 0.321244 0.285473 0.285473
2064 33, 124, 121,//204 0.312869 0.324920 0.312869
2065 124, 14, 126,//205 0.312869 0.312869 0.324920
2066 126, 34, 121,//206 0.312869 0.312869 0.324920
2067 124, 126, 121,//207 0.324920 0.324920 0.324920
2068 1, 123, 118,//208 0.275904 0.321244 0.275904
2069 123, 33, 127,//209 0.275904 0.312869 0.285473
2070 127, 32, 118,//210 0.312869 0.275904 0.285473
2071 123, 127, 118,//211 0.285473 0.285473 0.321244
2072 33, 120, 129,//212 0.275904 0.285473 0.312869
2073 120, 9, 128,//213 0.275904 0.275904 0.321244
2074 128, 35, 129,//214 0.275904 0.312869 0.285473
2075 120, 128, 129,//215 0.321244 0.285473 0.285473
2076 35, 130, 131,//216 0.275904 0.285473 0.312869
2077 130, 8, 116,//217 0.275904 0.275904 0.321244
2078 116, 32, 131,//218 0.275904 0.312869 0.285473
2079 130, 116, 131,//219 0.321244 0.285473 0.285473
2080 33, 129, 127,//220 0.312869 0.324920 0.312869
2081 129, 35, 131,//221 0.312869 0.312869 0.324920
2082 131, 32, 127,//222 0.312869 0.312869 0.324920
2083 129, 131, 127,//223 0.324920 0.324920 0.324920
2084 4, 132, 82,//224 0.275904 0.321244 0.275904
2085 132, 36, 133,//225 0.275904 0.312869 0.285473
2086 133, 23, 82,//226 0.312869 0.275904 0.285473
2087 132, 133, 82,//227 0.285473 0.285473 0.321244
2088 36, 134, 135,//228 0.275904 0.285473 0.312869
2089 134, 9, 122,//229 0.275904 0.275904 0.321244
2090 122, 34, 135,//230 0.275904 0.312869 0.285473
2091 134, 122, 135,//231 0.321244 0.285473 0.285473
2092 34, 125, 136,//232 0.275904 0.285473 0.312869
2093 125, 5, 78,//233 0.275904 0.275904 0.321244
2094 78, 23, 136,//234 0.275904 0.312869 0.285473
2095 125, 78, 136,//235 0.321244 0.285473 0.285473
2096 36, 135, 133,//236 0.312869 0.324920 0.312869
2097 135, 34, 136,//237 0.312869 0.312869 0.324920
2098 136, 23, 133,//238 0.312869 0.312869 0.324920
2099 135, 136, 133,//239 0.324920 0.324920 0.324920
2100 9, 134, 138,//240 0.275904 0.321244 0.275904
2101 134, 36, 137,//241 0.275904 0.312869 0.285473
2102 137, 38, 138,//242 0.312869 0.275904 0.285473
2103 134, 137, 138,//243 0.285473 0.285473 0.321244
2104 36, 132, 140,//244 0.275904 0.285473 0.312869
2105 132, 4, 139,//245 0.275904 0.275904 0.321244
2106 139, 37, 140,//246 0.275904 0.312869 0.285473
2107 132, 139, 140,//247 0.321244 0.285473 0.285473
2108 37, 141, 143,//248 0.275904 0.285473 0.312869
2109 141, 3, 142,//249 0.275904 0.275904 0.321244
2110 142, 38, 143,//250 0.275904 0.312869 0.285473
2111 141, 142, 143,//251 0.321244 0.285473 0.285473
2112 36, 140, 137,//252 0.312869 0.324920 0.312869
2113 140, 37, 143,//253 0.312869 0.312869 0.324920
2114 143, 38, 137,//254 0.312869 0.312869 0.324920
2115 140, 143, 137,//255 0.324920 0.324920 0.324920
2116 3, 144, 142,//256 0.275904 0.321244 0.275904
2117 144, 39, 145,//257 0.275904 0.312869 0.285473
2118 145, 38, 142,//258 0.312869 0.275904 0.285473
2119 144, 145, 142,//259 0.285473 0.285473 0.321244
2120 39, 146, 147,//260 0.275904 0.285473 0.312869
2121 146, 8, 130,//261 0.275904 0.275904 0.321244
2122 130, 35, 147,//262 0.275904 0.312869 0.285473
2123 146, 130, 147,//263 0.321244 0.285473 0.285473
2124 35, 128, 148,//264 0.275904 0.285473 0.312869
2125 128, 9, 138,//265 0.275904 0.275904 0.321244
2126 138, 38, 148,//266 0.275904 0.312869 0.285473
2127 128, 138, 148,//267 0.321244 0.285473 0.285473
2128 39, 147, 145,//268 0.312869 0.324920 0.312869
2129 147, 35, 148,//269 0.312869 0.312869 0.324920
2130 148, 38, 145,//270 0.312869 0.312869 0.324920
2131 147, 148, 145,//271 0.324920 0.324920 0.324920
2132 8, 146, 111,//272 0.275904 0.321244 0.275904
2133 146, 39, 149,//273 0.275904 0.312869 0.285473
2134 149, 31, 111,//274 0.312869 0.275904 0.285473
2135 146, 149, 111,//275 0.285473 0.285473 0.321244
2136 39, 144, 151,//276 0.275904 0.285473 0.312869
2137 144, 3, 150,//277 0.275904 0.275904 0.321244
2138 150, 40, 151,//278 0.275904 0.312869 0.285473
2139 144, 150, 151,//279 0.321244 0.285473 0.285473
2140 40, 152, 153,//280 0.275904 0.285473 0.312869
2141 152, 6, 113,//281 0.275904 0.275904 0.321244
2142 113, 31, 153,//282 0.275904 0.312869 0.285473
2143 152, 113, 153,//283 0.321244 0.285473 0.285473
2144 39, 151, 149,//284 0.312869 0.324920 0.312869
2145 151, 40, 153,//285 0.312869 0.312869 0.324920
2146 153, 31, 149,//286 0.312869 0.312869 0.324920
2147 151, 153, 149,//287 0.324920 0.324920 0.324920
2148 3, 154, 150,//288 0.275904 0.321244 0.275904
2149 154, 41, 155,//289 0.275904 0.312869 0.285473
2150 155, 40, 150,//290 0.312869 0.275904 0.285473
2151 154, 155, 150,//291 0.285473 0.285473 0.321244
2152 41, 156, 157,//292 0.275904 0.285473 0.312869
2153 156, 2, 101,//293 0.275904 0.275904 0.321244
2154 101, 28, 157,//294 0.275904 0.312869 0.285473
2155 156, 101, 157,//295 0.321244 0.285473 0.285473
2156 28, 99, 158,//296 0.275904 0.285473 0.312869
2157 99, 6, 152,//297 0.275904 0.275904 0.321244
2158 152, 40, 158,//298 0.275904 0.312869 0.285473
2159 99, 152, 158,//299 0.321244 0.285473 0.285473
2160 41, 157, 155,//300 0.312869 0.324920 0.312869
2161 157, 28, 158,//301 0.312869 0.312869 0.324920
2162 158, 40, 155,//302 0.312869 0.312869 0.324920
2163 157, 158, 155,//303 0.324920 0.324920 0.324920
2164 2, 156, 92,//304 0.275904 0.321244 0.275904
2165 156, 41, 159,//305 0.275904 0.312869 0.285473
2166 159, 26, 92,//306 0.312869 0.275904 0.285473
2167 156, 159, 92,//307 0.285473 0.285473 0.321244
2168 41, 154, 160,//308 0.275904 0.285473 0.312869
2169 154, 3, 141,//309 0.275904 0.275904 0.321244
2170 141, 37, 160,//310 0.275904 0.312869 0.285473
2171 154, 141, 160,//311 0.321244 0.285473 0.285473
2172 37, 139, 161,//312 0.275904 0.285473 0.312869
2173 139, 4, 94,//313 0.275904 0.275904 0.321244
2174 94, 26, 161,//314 0.275904 0.312869 0.285473
2175 139, 94, 161,//315 0.321244 0.285473 0.285473
2176 41, 160, 159,//316 0.312869 0.324920 0.312869
2177 160, 37, 161,//317 0.312869 0.312869 0.324920
2178 161, 26, 159,//318 0.312869 0.312869 0.324920
2179 160, 161, 159 //319 0.324920 0.324920 0.324920
2180 };
2181 static const GLuint idx3[3840] = {
2182 1, 162, 164,// 0 0.138283 0.162173 0.138283
2183 162, 42, 163,// 1 0.138283 0.161146 0.139482
2184 163, 44, 164,// 2 0.161146 0.138283 0.139482
2185 162, 163, 164,// 3 0.139482 0.139482 0.162173
2186 42, 165, 167,// 4 0.138283 0.157997 0.143103
2187 165, 12, 166,// 5 0.138283 0.156918 0.144288
2188 166, 43, 167,// 6 0.156918 0.143103 0.139510
2189 165, 166, 167,// 7 0.144288 0.139510 0.157997
2190 43, 168, 170,// 8 0.156918 0.139510 0.143103
2191 168, 14, 169,// 9 0.156918 0.138283 0.144288
2192 169, 44, 170,// 10 0.138283 0.143103 0.157997
2193 168, 169, 170,// 11 0.144288 0.157997 0.139510
2194 42, 167, 163,// 12 0.143103 0.144387 0.161146
2195 167, 43, 170,// 13 0.143103 0.143103 0.162284
2196 170, 44, 163,// 14 0.143103 0.161146 0.144387
2197 167, 170, 163,// 15 0.162284 0.144387 0.144387
2198 12, 171, 173,// 16 0.138283 0.144288 0.156918
2199 171, 45, 172,// 17 0.138283 0.143103 0.157997
2200 172, 47, 173,// 18 0.143103 0.156918 0.139510
2201 171, 172, 173,// 19 0.157997 0.139510 0.144288
2202 45, 174, 176,// 20 0.138283 0.139482 0.161146
2203 174, 0, 175,// 21 0.138283 0.138283 0.162173
2204 175, 46, 176,// 22 0.138283 0.161146 0.139482
2205 174, 175, 176,// 23 0.162173 0.139482 0.139482
2206 46, 177, 179,// 24 0.138283 0.157997 0.143103
2207 177, 13, 178,// 25 0.138283 0.156918 0.144288
2208 178, 47, 179,// 26 0.156918 0.143103 0.139510
2209 177, 178, 179,// 27 0.144288 0.139510 0.157997
2210 45, 176, 172,// 28 0.161146 0.144387 0.143103
2211 176, 46, 179,// 29 0.161146 0.143103 0.144387
2212 179, 47, 172,// 30 0.143103 0.143103 0.162284
2213 176, 179, 172,// 31 0.144387 0.162284 0.144387
2214 13, 180, 182,// 32 0.138283 0.144288 0.156918
2215 180, 48, 181,// 33 0.138283 0.143103 0.157997
2216 181, 50, 182,// 34 0.143103 0.156918 0.139510
2217 180, 181, 182,// 35 0.157997 0.139510 0.144288
2218 48, 183, 185,// 36 0.138283 0.139482 0.161146
2219 183, 5, 184,// 37 0.138283 0.138283 0.162173
2220 184, 49, 185,// 38 0.138283 0.161146 0.139482
2221 183, 184, 185,// 39 0.162173 0.139482 0.139482
2222 49, 186, 188,// 40 0.138283 0.157997 0.143103
2223 186, 14, 187,// 41 0.138283 0.156918 0.144288
2224 187, 50, 188,// 42 0.156918 0.143103 0.139510
2225 186, 187, 188,// 43 0.144288 0.139510 0.157997
2226 48, 185, 181,// 44 0.161146 0.144387 0.143103
2227 185, 49, 188,// 45 0.161146 0.143103 0.144387
2228 188, 50, 181,// 46 0.143103 0.143103 0.162284
2229 185, 188, 181,// 47 0.144387 0.162284 0.144387
2230 12, 173, 166,// 48 0.156918 0.164485 0.156918
2231 173, 47, 189,// 49 0.156918 0.163002 0.158459
2232 189, 43, 166,// 50 0.163002 0.156918 0.158459
2233 173, 189, 166,// 51 0.158459 0.158459 0.164485
2234 47, 178, 190,// 52 0.156918 0.158459 0.163002
2235 178, 13, 182,// 53 0.156918 0.156918 0.164485
2236 182, 50, 190,// 54 0.156918 0.163002 0.158459
2237 178, 182, 190,// 55 0.164485 0.158459 0.158459
2238 50, 187, 191,// 56 0.156918 0.158459 0.163002
2239 187, 14, 168,// 57 0.156918 0.156918 0.164485
2240 168, 43, 191,// 58 0.156918 0.163002 0.158459
2241 187, 168, 191,// 59 0.164485 0.158459 0.158459
2242 47, 190, 189,// 60 0.163002 0.164647 0.163002
2243 190, 50, 191,// 61 0.163002 0.163002 0.164647
2244 191, 43, 189,// 62 0.163002 0.163002 0.164647
2245 190, 191, 189,// 63 0.164647 0.164647 0.164647
2246 0, 174, 193,// 64 0.138283 0.162173 0.138283
2247 174, 45, 192,// 65 0.138283 0.161146 0.139482
2248 192, 52, 193,// 66 0.161146 0.138283 0.139482
2249 174, 192, 193,// 67 0.139482 0.139482 0.162173
2250 45, 171, 195,// 68 0.138283 0.157997 0.143103
2251 171, 12, 194,// 69 0.138283 0.156918 0.144288
2252 194, 51, 195,// 70 0.156918 0.143103 0.139510
2253 171, 194, 195,// 71 0.144288 0.139510 0.157997
2254 51, 196, 198,// 72 0.156918 0.139510 0.143103
2255 196, 16, 197,// 73 0.156918 0.138283 0.144288
2256 197, 52, 198,// 74 0.138283 0.143103 0.157997
2257 196, 197, 198,// 75 0.144288 0.157997 0.139510
2258 45, 195, 192,// 76 0.143103 0.144387 0.161146
2259 195, 51, 198,// 77 0.143103 0.143103 0.162284
2260 198, 52, 192,// 78 0.143103 0.161146 0.144387
2261 195, 198, 192,// 79 0.162284 0.144387 0.144387
2262 12, 165, 200,// 80 0.138283 0.144288 0.156918
2263 165, 42, 199,// 81 0.138283 0.143103 0.157997
2264 199, 54, 200,// 82 0.143103 0.156918 0.139510
2265 165, 199, 200,// 83 0.157997 0.139510 0.144288
2266 42, 162, 202,// 84 0.138283 0.139482 0.161146
2267 162, 1, 201,// 85 0.138283 0.138283 0.162173
2268 201, 53, 202,// 86 0.138283 0.161146 0.139482
2269 162, 201, 202,// 87 0.162173 0.139482 0.139482
2270 53, 203, 205,// 88 0.138283 0.157997 0.143103
2271 203, 15, 204,// 89 0.138283 0.156918 0.144288
2272 204, 54, 205,// 90 0.156918 0.143103 0.139510
2273 203, 204, 205,// 91 0.144288 0.139510 0.157997
2274 42, 202, 199,// 92 0.161146 0.144387 0.143103
2275 202, 53, 205,// 93 0.161146 0.143103 0.144387
2276 205, 54, 199,// 94 0.143103 0.143103 0.162284
2277 202, 205, 199,// 95 0.144387 0.162284 0.144387
2278 15, 206, 208,// 96 0.138283 0.144288 0.156918
2279 206, 55, 207,// 97 0.138283 0.143103 0.157997
2280 207, 57, 208,// 98 0.143103 0.156918 0.139510
2281 206, 207, 208,// 99 0.157997 0.139510 0.144288
2282 55, 209, 211,//100 0.138283 0.139482 0.161146
2283 209, 7, 210,//101 0.138283 0.138283 0.162173
2284 210, 56, 211,//102 0.138283 0.161146 0.139482
2285 209, 210, 211,//103 0.162173 0.139482 0.139482
2286 56, 212, 214,//104 0.138283 0.157997 0.143103
2287 212, 16, 213,//105 0.138283 0.156918 0.144288
2288 213, 57, 214,//106 0.156918 0.143103 0.139510
2289 212, 213, 214,//107 0.144288 0.139510 0.157997
2290 55, 211, 207,//108 0.161146 0.144387 0.143103
2291 211, 56, 214,//109 0.161146 0.143103 0.144387
2292 214, 57, 207,//110 0.143103 0.143103 0.162284
2293 211, 214, 207,//111 0.144387 0.162284 0.144387
2294 12, 200, 194,//112 0.156918 0.164485 0.156918
2295 200, 54, 215,//113 0.156918 0.163002 0.158459
2296 215, 51, 194,//114 0.163002 0.156918 0.158459
2297 200, 215, 194,//115 0.158459 0.158459 0.164485
2298 54, 204, 216,//116 0.156918 0.158459 0.163002
2299 204, 15, 208,//117 0.156918 0.156918 0.164485
2300 208, 57, 216,//118 0.156918 0.163002 0.158459
2301 204, 208, 216,//119 0.164485 0.158459 0.158459
2302 57, 213, 217,//120 0.156918 0.158459 0.163002
2303 213, 16, 196,//121 0.156918 0.156918 0.164485
2304 196, 51, 217,//122 0.156918 0.163002 0.158459
2305 213, 196, 217,//123 0.164485 0.158459 0.158459
2306 54, 216, 215,//124 0.163002 0.164647 0.163002
2307 216, 57, 217,//125 0.163002 0.163002 0.164647
2308 217, 51, 215,//126 0.163002 0.163002 0.164647
2309 216, 217, 215,//127 0.164647 0.164647 0.164647
2310 10, 218, 220,//128 0.138283 0.162173 0.138283
2311 218, 58, 219,//129 0.138283 0.161146 0.139482
2312 219, 60, 220,//130 0.161146 0.138283 0.139482
2313 218, 219, 220,//131 0.139482 0.139482 0.162173
2314 58, 221, 223,//132 0.138283 0.157997 0.143103
2315 221, 17, 222,//133 0.138283 0.156918 0.144288
2316 222, 59, 223,//134 0.156918 0.143103 0.139510
2317 221, 222, 223,//135 0.144288 0.139510 0.157997
2318 59, 224, 226,//136 0.156918 0.139510 0.143103
2319 224, 18, 225,//137 0.156918 0.138283 0.144288
2320 225, 60, 226,//138 0.138283 0.143103 0.157997
2321 224, 225, 226,//139 0.144288 0.157997 0.139510
2322 58, 223, 219,//140 0.143103 0.144387 0.161146
2323 223, 59, 226,//141 0.143103 0.143103 0.162284
2324 226, 60, 219,//142 0.143103 0.161146 0.144387
2325 223, 226, 219,//143 0.162284 0.144387 0.144387
2326 17, 227, 229,//144 0.138283 0.144288 0.156918
2327 227, 61, 228,//145 0.138283 0.143103 0.157997
2328 228, 62, 229,//146 0.143103 0.156918 0.139510
2329 227, 228, 229,//147 0.157997 0.139510 0.144288
2330 61, 230, 231,//148 0.138283 0.139482 0.161146
2331 230, 0, 193,//149 0.138283 0.138283 0.162173
2332 193, 52, 231,//150 0.138283 0.161146 0.139482
2333 230, 193, 231,//151 0.162173 0.139482 0.139482
2334 52, 197, 233,//152 0.138283 0.157997 0.143103
2335 197, 16, 232,//153 0.138283 0.156918 0.144288
2336 232, 62, 233,//154 0.156918 0.143103 0.139510
2337 197, 232, 233,//155 0.144288 0.139510 0.157997
2338 61, 231, 228,//156 0.161146 0.144387 0.143103
2339 231, 52, 233,//157 0.161146 0.143103 0.144387
2340 233, 62, 228,//158 0.143103 0.143103 0.162284
2341 231, 233, 228,//159 0.144387 0.162284 0.144387
2342 16, 212, 235,//160 0.138283 0.144288 0.156918
2343 212, 56, 234,//161 0.138283 0.143103 0.157997
2344 234, 64, 235,//162 0.143103 0.156918 0.139510
2345 212, 234, 235,//163 0.157997 0.139510 0.144288
2346 56, 210, 237,//164 0.138283 0.139482 0.161146
2347 210, 7, 236,//165 0.138283 0.138283 0.162173
2348 236, 63, 237,//166 0.138283 0.161146 0.139482
2349 210, 236, 237,//167 0.162173 0.139482 0.139482
2350 63, 238, 240,//168 0.138283 0.157997 0.143103
2351 238, 18, 239,//169 0.138283 0.156918 0.144288
2352 239, 64, 240,//170 0.156918 0.143103 0.139510
2353 238, 239, 240,//171 0.144288 0.139510 0.157997
2354 56, 237, 234,//172 0.161146 0.144387 0.143103
2355 237, 63, 240,//173 0.161146 0.143103 0.144387
2356 240, 64, 234,//174 0.143103 0.143103 0.162284
2357 237, 240, 234,//175 0.144387 0.162284 0.144387
2358 17, 229, 222,//176 0.156918 0.164485 0.156918
2359 229, 62, 241,//177 0.156918 0.163002 0.158459
2360 241, 59, 222,//178 0.163002 0.156918 0.158459
2361 229, 241, 222,//179 0.158459 0.158459 0.164485
2362 62, 232, 242,//180 0.156918 0.158459 0.163002
2363 232, 16, 235,//181 0.156918 0.156918 0.164485
2364 235, 64, 242,//182 0.156918 0.163002 0.158459
2365 232, 235, 242,//183 0.164485 0.158459 0.158459
2366 64, 239, 243,//184 0.156918 0.158459 0.163002
2367 239, 18, 224,//185 0.156918 0.156918 0.164485
2368 224, 59, 243,//186 0.156918 0.163002 0.158459
2369 239, 224, 243,//187 0.164485 0.158459 0.158459
2370 62, 242, 241,//188 0.163002 0.164647 0.163002
2371 242, 64, 243,//189 0.163002 0.163002 0.164647
2372 243, 59, 241,//190 0.163002 0.163002 0.164647
2373 242, 243, 241,//191 0.164647 0.164647 0.164647
2374 0, 230, 245,//192 0.138283 0.162173 0.138283
2375 230, 61, 244,//193 0.138283 0.161146 0.139482
2376 244, 66, 245,//194 0.161146 0.138283 0.139482
2377 230, 244, 245,//195 0.139482 0.139482 0.162173
2378 61, 227, 247,//196 0.138283 0.157997 0.143103
2379 227, 17, 246,//197 0.138283 0.156918 0.144288
2380 246, 65, 247,//198 0.156918 0.143103 0.139510
2381 227, 246, 247,//199 0.144288 0.139510 0.157997
2382 65, 248, 250,//200 0.156918 0.139510 0.143103
2383 248, 20, 249,//201 0.156918 0.138283 0.144288
2384 249, 66, 250,//202 0.138283 0.143103 0.157997
2385 248, 249, 250,//203 0.144288 0.157997 0.139510
2386 61, 247, 244,//204 0.143103 0.144387 0.161146
2387 247, 65, 250,//205 0.143103 0.143103 0.162284
2388 250, 66, 244,//206 0.143103 0.161146 0.144387
2389 247, 250, 244,//207 0.162284 0.144387 0.144387
2390 17, 221, 252,//208 0.138283 0.144288 0.156918
2391 221, 58, 251,//209 0.138283 0.143103 0.157997
2392 251, 68, 252,//210 0.143103 0.156918 0.139510
2393 221, 251, 252,//211 0.157997 0.139510 0.144288
2394 58, 218, 254,//212 0.138283 0.139482 0.161146
2395 218, 10, 253,//213 0.138283 0.138283 0.162173
2396 253, 67, 254,//214 0.138283 0.161146 0.139482
2397 218, 253, 254,//215 0.162173 0.139482 0.139482
2398 67, 255, 257,//216 0.138283 0.157997 0.143103
2399 255, 19, 256,//217 0.138283 0.156918 0.144288
2400 256, 68, 257,//218 0.156918 0.143103 0.139510
2401 255, 256, 257,//219 0.144288 0.139510 0.157997
2402 58, 254, 251,//220 0.161146 0.144387 0.143103
2403 254, 67, 257,//221 0.161146 0.143103 0.144387
2404 257, 68, 251,//222 0.143103 0.143103 0.162284
2405 254, 257, 251,//223 0.144387 0.162284 0.144387
2406 19, 258, 260,//224 0.138283 0.144288 0.156918
2407 258, 69, 259,//225 0.138283 0.143103 0.157997
2408 259, 71, 260,//226 0.143103 0.156918 0.139510
2409 258, 259, 260,//227 0.157997 0.139510 0.144288
2410 69, 261, 263,//228 0.138283 0.139482 0.161146
2411 261, 11, 262,//229 0.138283 0.138283 0.162173
2412 262, 70, 263,//230 0.138283 0.161146 0.139482
2413 261, 262, 263,//231 0.162173 0.139482 0.139482
2414 70, 264, 266,//232 0.138283 0.157997 0.143103
2415 264, 20, 265,//233 0.138283 0.156918 0.144288
2416 265, 71, 266,//234 0.156918 0.143103 0.139510
2417 264, 265, 266,//235 0.144288 0.139510 0.157997
2418 69, 263, 259,//236 0.161146 0.144387 0.143103
2419 263, 70, 266,//237 0.161146 0.143103 0.144387
2420 266, 71, 259,//238 0.143103 0.143103 0.162284
2421 263, 266, 259,//239 0.144387 0.162284 0.144387
2422 17, 252, 246,//240 0.156918 0.164485 0.156918
2423 252, 68, 267,//241 0.156918 0.163002 0.158459
2424 267, 65, 246,//242 0.163002 0.156918 0.158459
2425 252, 267, 246,//243 0.158459 0.158459 0.164485
2426 68, 256, 268,//244 0.156918 0.158459 0.163002
2427 256, 19, 260,//245 0.156918 0.156918 0.164485
2428 260, 71, 268,//246 0.156918 0.163002 0.158459
2429 256, 260, 268,//247 0.164485 0.158459 0.158459
2430 71, 265, 269,//248 0.156918 0.158459 0.163002
2431 265, 20, 248,//249 0.156918 0.156918 0.164485
2432 248, 65, 269,//250 0.156918 0.163002 0.158459
2433 265, 248, 269,//251 0.164485 0.158459 0.158459
2434 68, 268, 267,//252 0.163002 0.164647 0.163002
2435 268, 71, 269,//253 0.163002 0.163002 0.164647
2436 269, 65, 267,//254 0.163002 0.163002 0.164647
2437 268, 269, 267,//255 0.164647 0.164647 0.164647
2438 11, 270, 262,//256 0.138283 0.162173 0.138283
2439 270, 72, 271,//257 0.138283 0.161146 0.139482
2440 271, 70, 262,//258 0.161146 0.138283 0.139482
2441 270, 271, 262,//259 0.139482 0.139482 0.162173
2442 72, 272, 274,//260 0.138283 0.157997 0.143103
2443 272, 21, 273,//261 0.138283 0.156918 0.144288
2444 273, 73, 274,//262 0.156918 0.143103 0.139510
2445 272, 273, 274,//263 0.144288 0.139510 0.157997
2446 73, 275, 276,//264 0.156918 0.139510 0.143103
2447 275, 20, 264,//265 0.156918 0.138283 0.144288
2448 264, 70, 276,//266 0.138283 0.143103 0.157997
2449 275, 264, 276,//267 0.144288 0.157997 0.139510
2450 72, 274, 271,//268 0.143103 0.144387 0.161146
2451 274, 73, 276,//269 0.143103 0.143103 0.162284
2452 276, 70, 271,//270 0.143103 0.161146 0.144387
2453 274, 276, 271,//271 0.162284 0.144387 0.144387
2454 21, 277, 279,//272 0.138283 0.144288 0.156918
2455 277, 74, 278,//273 0.138283 0.143103 0.157997
2456 278, 75, 279,//274 0.143103 0.156918 0.139510
2457 277, 278, 279,//275 0.157997 0.139510 0.144288
2458 74, 280, 281,//276 0.138283 0.139482 0.161146
2459 280, 5, 183,//277 0.138283 0.138283 0.162173
2460 183, 48, 281,//278 0.138283 0.161146 0.139482
2461 280, 183, 281,//279 0.162173 0.139482 0.139482
2462 48, 180, 283,//280 0.138283 0.157997 0.143103
2463 180, 13, 282,//281 0.138283 0.156918 0.144288
2464 282, 75, 283,//282 0.156918 0.143103 0.139510
2465 180, 282, 283,//283 0.144288 0.139510 0.157997
2466 74, 281, 278,//284 0.161146 0.144387 0.143103
2467 281, 48, 283,//285 0.161146 0.143103 0.144387
2468 283, 75, 278,//286 0.143103 0.143103 0.162284
2469 281, 283, 278,//287 0.144387 0.162284 0.144387
2470 13, 177, 285,//288 0.138283 0.144288 0.156918
2471 177, 46, 284,//289 0.138283 0.143103 0.157997
2472 284, 76, 285,//290 0.143103 0.156918 0.139510
2473 177, 284, 285,//291 0.157997 0.139510 0.144288
2474 46, 175, 286,//292 0.138283 0.139482 0.161146
2475 175, 0, 245,//293 0.138283 0.138283 0.162173
2476 245, 66, 286,//294 0.138283 0.161146 0.139482
2477 175, 245, 286,//295 0.162173 0.139482 0.139482
2478 66, 249, 288,//296 0.138283 0.157997 0.143103
2479 249, 20, 287,//297 0.138283 0.156918 0.144288
2480 287, 76, 288,//298 0.156918 0.143103 0.139510
2481 249, 287, 288,//299 0.144288 0.139510 0.157997
2482 46, 286, 284,//300 0.161146 0.144387 0.143103
2483 286, 66, 288,//301 0.161146 0.143103 0.144387
2484 288, 76, 284,//302 0.143103 0.143103 0.162284
2485 286, 288, 284,//303 0.144387 0.162284 0.144387
2486 21, 279, 273,//304 0.156918 0.164485 0.156918
2487 279, 75, 289,//305 0.156918 0.163002 0.158459
2488 289, 73, 273,//306 0.163002 0.156918 0.158459
2489 279, 289, 273,//307 0.158459 0.158459 0.164485
2490 75, 282, 290,//308 0.156918 0.158459 0.163002
2491 282, 13, 285,//309 0.156918 0.156918 0.164485
2492 285, 76, 290,//310 0.156918 0.163002 0.158459
2493 282, 285, 290,//311 0.164485 0.158459 0.158459
2494 76, 287, 291,//312 0.156918 0.158459 0.163002
2495 287, 20, 275,//313 0.156918 0.156918 0.164485
2496 275, 73, 291,//314 0.156918 0.163002 0.158459
2497 287, 275, 291,//315 0.164485 0.158459 0.158459
2498 75, 290, 289,//316 0.163002 0.164647 0.163002
2499 290, 76, 291,//317 0.163002 0.163002 0.164647
2500 291, 73, 289,//318 0.163002 0.163002 0.164647
2501 290, 291, 289,//319 0.164647 0.164647 0.164647
2502 5, 280, 293,//320 0.138283 0.162173 0.138283
2503 280, 74, 292,//321 0.138283 0.161146 0.139482
2504 292, 78, 293,//322 0.161146 0.138283 0.139482
2505 280, 292, 293,//323 0.139482 0.139482 0.162173
2506 74, 277, 295,//324 0.138283 0.157997 0.143103
2507 277, 21, 294,//325 0.138283 0.156918 0.144288
2508 294, 77, 295,//326 0.156918 0.143103 0.139510
2509 277, 294, 295,//327 0.144288 0.139510 0.157997
2510 77, 296, 298,//328 0.156918 0.139510 0.143103
2511 296, 23, 297,//329 0.156918 0.138283 0.144288
2512 297, 78, 298,//330 0.138283 0.143103 0.157997
2513 296, 297, 298,//331 0.144288 0.157997 0.139510
2514 74, 295, 292,//332 0.143103 0.144387 0.161146
2515 295, 77, 298,//333 0.143103 0.143103 0.162284
2516 298, 78, 292,//334 0.143103 0.161146 0.144387
2517 295, 298, 292,//335 0.162284 0.144387 0.144387
2518 21, 272, 300,//336 0.138283 0.144288 0.156918
2519 272, 72, 299,//337 0.138283 0.143103 0.157997
2520 299, 80, 300,//338 0.143103 0.156918 0.139510
2521 272, 299, 300,//339 0.157997 0.139510 0.144288
2522 72, 270, 302,//340 0.138283 0.139482 0.161146
2523 270, 11, 301,//341 0.138283 0.138283 0.162173
2524 301, 79, 302,//342 0.138283 0.161146 0.139482
2525 270, 301, 302,//343 0.162173 0.139482 0.139482
2526 79, 303, 305,//344 0.138283 0.157997 0.143103
2527 303, 22, 304,//345 0.138283 0.156918 0.144288
2528 304, 80, 305,//346 0.156918 0.143103 0.139510
2529 303, 304, 305,//347 0.144288 0.139510 0.157997
2530 72, 302, 299,//348 0.161146 0.144387 0.143103
2531 302, 79, 305,//349 0.161146 0.143103 0.144387
2532 305, 80, 299,//350 0.143103 0.143103 0.162284
2533 302, 305, 299,//351 0.144387 0.162284 0.144387
2534 22, 306, 308,//352 0.138283 0.144288 0.156918
2535 306, 81, 307,//353 0.138283 0.143103 0.157997
2536 307, 83, 308,//354 0.143103 0.156918 0.139510
2537 306, 307, 308,//355 0.157997 0.139510 0.144288
2538 81, 309, 311,//356 0.138283 0.139482 0.161146
2539 309, 4, 310,//357 0.138283 0.138283 0.162173
2540 310, 82, 311,//358 0.138283 0.161146 0.139482
2541 309, 310, 311,//359 0.162173 0.139482 0.139482
2542 82, 312, 314,//360 0.138283 0.157997 0.143103
2543 312, 23, 313,//361 0.138283 0.156918 0.144288
2544 313, 83, 314,//362 0.156918 0.143103 0.139510
2545 312, 313, 314,//363 0.144288 0.139510 0.157997
2546 81, 311, 307,//364 0.161146 0.144387 0.143103
2547 311, 82, 314,//365 0.161146 0.143103 0.144387
2548 314, 83, 307,//366 0.143103 0.143103 0.162284
2549 311, 314, 307,//367 0.144387 0.162284 0.144387
2550 21, 300, 294,//368 0.156918 0.164485 0.156918
2551 300, 80, 315,//369 0.156918 0.163002 0.158459
2552 315, 77, 294,//370 0.163002 0.156918 0.158459
2553 300, 315, 294,//371 0.158459 0.158459 0.164485
2554 80, 304, 316,//372 0.156918 0.158459 0.163002
2555 304, 22, 308,//373 0.156918 0.156918 0.164485
2556 308, 83, 316,//374 0.156918 0.163002 0.158459
2557 304, 308, 316,//375 0.164485 0.158459 0.158459
2558 83, 313, 317,//376 0.156918 0.158459 0.163002
2559 313, 23, 296,//377 0.156918 0.156918 0.164485
2560 296, 77, 317,//378 0.156918 0.163002 0.158459
2561 313, 296, 317,//379 0.164485 0.158459 0.158459
2562 80, 316, 315,//380 0.163002 0.164647 0.163002
2563 316, 83, 317,//381 0.163002 0.163002 0.164647
2564 317, 77, 315,//382 0.163002 0.163002 0.164647
2565 316, 317, 315,//383 0.164647 0.164647 0.164647
2566 2, 318, 320,//384 0.138283 0.162173 0.138283
2567 318, 84, 319,//385 0.138283 0.161146 0.139482
2568 319, 86, 320,//386 0.161146 0.138283 0.139482
2569 318, 319, 320,//387 0.139482 0.139482 0.162173
2570 84, 321, 323,//388 0.138283 0.157997 0.143103
2571 321, 24, 322,//389 0.138283 0.156918 0.144288
2572 322, 85, 323,//390 0.156918 0.143103 0.139510
2573 321, 322, 323,//391 0.144288 0.139510 0.157997
2574 85, 324, 326,//392 0.156918 0.139510 0.143103
2575 324, 25, 325,//393 0.156918 0.138283 0.144288
2576 325, 86, 326,//394 0.138283 0.143103 0.157997
2577 324, 325, 326,//395 0.144288 0.157997 0.139510
2578 84, 323, 319,//396 0.143103 0.144387 0.161146
2579 323, 85, 326,//397 0.143103 0.143103 0.162284
2580 326, 86, 319,//398 0.143103 0.161146 0.144387
2581 323, 326, 319,//399 0.162284 0.144387 0.144387
2582 24, 327, 329,//400 0.138283 0.144288 0.156918
2583 327, 87, 328,//401 0.138283 0.143103 0.157997
2584 328, 88, 329,//402 0.143103 0.156918 0.139510
2585 327, 328, 329,//403 0.157997 0.139510 0.144288
2586 87, 330, 331,//404 0.138283 0.139482 0.161146
2587 330, 11, 261,//405 0.138283 0.138283 0.162173
2588 261, 69, 331,//406 0.138283 0.161146 0.139482
2589 330, 261, 331,//407 0.162173 0.139482 0.139482
2590 69, 258, 333,//408 0.138283 0.157997 0.143103
2591 258, 19, 332,//409 0.138283 0.156918 0.144288
2592 332, 88, 333,//410 0.156918 0.143103 0.139510
2593 258, 332, 333,//411 0.144288 0.139510 0.157997
2594 87, 331, 328,//412 0.161146 0.144387 0.143103
2595 331, 69, 333,//413 0.161146 0.143103 0.144387
2596 333, 88, 328,//414 0.143103 0.143103 0.162284
2597 331, 333, 328,//415 0.144387 0.162284 0.144387
2598 19, 255, 335,//416 0.138283 0.144288 0.156918
2599 255, 67, 334,//417 0.138283 0.143103 0.157997
2600 334, 90, 335,//418 0.143103 0.156918 0.139510
2601 255, 334, 335,//419 0.157997 0.139510 0.144288
2602 67, 253, 337,//420 0.138283 0.139482 0.161146
2603 253, 10, 336,//421 0.138283 0.138283 0.162173
2604 336, 89, 337,//422 0.138283 0.161146 0.139482
2605 253, 336, 337,//423 0.162173 0.139482 0.139482
2606 89, 338, 340,//424 0.138283 0.157997 0.143103
2607 338, 25, 339,//425 0.138283 0.156918 0.144288
2608 339, 90, 340,//426 0.156918 0.143103 0.139510
2609 338, 339, 340,//427 0.144288 0.139510 0.157997
2610 67, 337, 334,//428 0.161146 0.144387 0.143103
2611 337, 89, 340,//429 0.161146 0.143103 0.144387
2612 340, 90, 334,//430 0.143103 0.143103 0.162284
2613 337, 340, 334,//431 0.144387 0.162284 0.144387
2614 24, 329, 322,//432 0.156918 0.164485 0.156918
2615 329, 88, 341,//433 0.156918 0.163002 0.158459
2616 341, 85, 322,//434 0.163002 0.156918 0.158459
2617 329, 341, 322,//435 0.158459 0.158459 0.164485
2618 88, 332, 342,//436 0.156918 0.158459 0.163002
2619 332, 19, 335,//437 0.156918 0.156918 0.164485
2620 335, 90, 342,//438 0.156918 0.163002 0.158459
2621 332, 335, 342,//439 0.164485 0.158459 0.158459
2622 90, 339, 343,//440 0.156918 0.158459 0.163002
2623 339, 25, 324,//441 0.156918 0.156918 0.164485
2624 324, 85, 343,//442 0.156918 0.163002 0.158459
2625 339, 324, 343,//443 0.164485 0.158459 0.158459
2626 88, 342, 341,//444 0.163002 0.164647 0.163002
2627 342, 90, 343,//445 0.163002 0.163002 0.164647
2628 343, 85, 341,//446 0.163002 0.163002 0.164647
2629 342, 343, 341,//447 0.164647 0.164647 0.164647
2630 11, 330, 301,//448 0.138283 0.162173 0.138283
2631 330, 87, 344,//449 0.138283 0.161146 0.139482
2632 344, 79, 301,//450 0.161146 0.138283 0.139482
2633 330, 344, 301,//451 0.139482 0.139482 0.162173
2634 87, 327, 346,//452 0.138283 0.157997 0.143103
2635 327, 24, 345,//453 0.138283 0.156918 0.144288
2636 345, 91, 346,//454 0.156918 0.143103 0.139510
2637 327, 345, 346,//455 0.144288 0.139510 0.157997
2638 91, 347, 348,//456 0.156918 0.139510 0.143103
2639 347, 22, 303,//457 0.156918 0.138283 0.144288
2640 303, 79, 348,//458 0.138283 0.143103 0.157997
2641 347, 303, 348,//459 0.144288 0.157997 0.139510
2642 87, 346, 344,//460 0.143103 0.144387 0.161146
2643 346, 91, 348,//461 0.143103 0.143103 0.162284
2644 348, 79, 344,//462 0.143103 0.161146 0.144387
2645 346, 348, 344,//463 0.162284 0.144387 0.144387
2646 24, 321, 350,//464 0.138283 0.144288 0.156918
2647 321, 84, 349,//465 0.138283 0.143103 0.157997
2648 349, 93, 350,//466 0.143103 0.156918 0.139510
2649 321, 349, 350,//467 0.157997 0.139510 0.144288
2650 84, 318, 352,//468 0.138283 0.139482 0.161146
2651 318, 2, 351,//469 0.138283 0.138283 0.162173
2652 351, 92, 352,//470 0.138283 0.161146 0.139482
2653 318, 351, 352,//471 0.162173 0.139482 0.139482
2654 92, 353, 355,//472 0.138283 0.157997 0.143103
2655 353, 26, 354,//473 0.138283 0.156918 0.144288
2656 354, 93, 355,//474 0.156918 0.143103 0.139510
2657 353, 354, 355,//475 0.144288 0.139510 0.157997
2658 84, 352, 349,//476 0.161146 0.144387 0.143103
2659 352, 92, 355,//477 0.161146 0.143103 0.144387
2660 355, 93, 349,//478 0.143103 0.143103 0.162284
2661 352, 355, 349,//479 0.144387 0.162284 0.144387
2662 26, 356, 358,//480 0.138283 0.144288 0.156918
2663 356, 94, 357,//481 0.138283 0.143103 0.157997
2664 357, 95, 358,//482 0.143103 0.156918 0.139510
2665 356, 357, 358,//483 0.157997 0.139510 0.144288
2666 94, 359, 360,//484 0.138283 0.139482 0.161146
2667 359, 4, 309,//485 0.138283 0.138283 0.162173
2668 309, 81, 360,//486 0.138283 0.161146 0.139482
2669 359, 309, 360,//487 0.162173 0.139482 0.139482
2670 81, 306, 362,//488 0.138283 0.157997 0.143103
2671 306, 22, 361,//489 0.138283 0.156918 0.144288
2672 361, 95, 362,//490 0.156918 0.143103 0.139510
2673 306, 361, 362,//491 0.144288 0.139510 0.157997
2674 94, 360, 357,//492 0.161146 0.144387 0.143103
2675 360, 81, 362,//493 0.161146 0.143103 0.144387
2676 362, 95, 357,//494 0.143103 0.143103 0.162284
2677 360, 362, 357,//495 0.144387 0.162284 0.144387
2678 24, 350, 345,//496 0.156918 0.164485 0.156918
2679 350, 93, 363,//497 0.156918 0.163002 0.158459
2680 363, 91, 345,//498 0.163002 0.156918 0.158459
2681 350, 363, 345,//499 0.158459 0.158459 0.164485
2682 93, 354, 364,//500 0.156918 0.158459 0.163002
2683 354, 26, 358,//501 0.156918 0.156918 0.164485
2684 358, 95, 364,//502 0.156918 0.163002 0.158459
2685 354, 358, 364,//503 0.164485 0.158459 0.158459
2686 95, 361, 365,//504 0.156918 0.158459 0.163002
2687 361, 22, 347,//505 0.156918 0.156918 0.164485
2688 347, 91, 365,//506 0.156918 0.163002 0.158459
2689 361, 347, 365,//507 0.164485 0.158459 0.158459
2690 93, 364, 363,//508 0.163002 0.164647 0.163002
2691 364, 95, 365,//509 0.163002 0.163002 0.164647
2692 365, 91, 363,//510 0.163002 0.163002 0.164647
2693 364, 365, 363,//511 0.164647 0.164647 0.164647
2694 10, 366, 336,//512 0.138283 0.162173 0.138283
2695 366, 96, 367,//513 0.138283 0.161146 0.139482
2696 367, 89, 336,//514 0.161146 0.138283 0.139482
2697 366, 367, 336,//515 0.139482 0.139482 0.162173
2698 96, 368, 370,//516 0.138283 0.157997 0.143103
2699 368, 27, 369,//517 0.138283 0.156918 0.144288
2700 369, 97, 370,//518 0.156918 0.143103 0.139510
2701 368, 369, 370,//519 0.144288 0.139510 0.157997
2702 97, 371, 372,//520 0.156918 0.139510 0.143103
2703 371, 25, 338,//521 0.156918 0.138283 0.144288
2704 338, 89, 372,//522 0.138283 0.143103 0.157997
2705 371, 338, 372,//523 0.144288 0.157997 0.139510
2706 96, 370, 367,//524 0.143103 0.144387 0.161146
2707 370, 97, 372,//525 0.143103 0.143103 0.162284
2708 372, 89, 367,//526 0.143103 0.161146 0.144387
2709 370, 372, 367,//527 0.162284 0.144387 0.144387
2710 27, 373, 375,//528 0.138283 0.144288 0.156918
2711 373, 98, 374,//529 0.138283 0.143103 0.157997
2712 374, 100, 375,//530 0.143103 0.156918 0.139510
2713 373, 374, 375,//531 0.157997 0.139510 0.144288
2714 98, 376, 378,//532 0.138283 0.139482 0.161146
2715 376, 6, 377,//533 0.138283 0.138283 0.162173
2716 377, 99, 378,//534 0.138283 0.161146 0.139482
2717 376, 377, 378,//535 0.162173 0.139482 0.139482
2718 99, 379, 381,//536 0.138283 0.157997 0.143103
2719 379, 28, 380,//537 0.138283 0.156918 0.144288
2720 380, 100, 381,//538 0.156918 0.143103 0.139510
2721 379, 380, 381,//539 0.144288 0.139510 0.157997
2722 98, 378, 374,//540 0.161146 0.144387 0.143103
2723 378, 99, 381,//541 0.161146 0.143103 0.144387
2724 381, 100, 374,//542 0.143103 0.143103 0.162284
2725 378, 381, 374,//543 0.144387 0.162284 0.144387
2726 28, 382, 384,//544 0.138283 0.144288 0.156918
2727 382, 101, 383,//545 0.138283 0.143103 0.157997
2728 383, 102, 384,//546 0.143103 0.156918 0.139510
2729 382, 383, 384,//547 0.157997 0.139510 0.144288
2730 101, 385, 386,//548 0.138283 0.139482 0.161146
2731 385, 2, 320,//549 0.138283 0.138283 0.162173
2732 320, 86, 386,//550 0.138283 0.161146 0.139482
2733 385, 320, 386,//551 0.162173 0.139482 0.139482
2734 86, 325, 388,//552 0.138283 0.157997 0.143103
2735 325, 25, 387,//553 0.138283 0.156918 0.144288
2736 387, 102, 388,//554 0.156918 0.143103 0.139510
2737 325, 387, 388,//555 0.144288 0.139510 0.157997
2738 101, 386, 383,//556 0.161146 0.144387 0.143103
2739 386, 86, 388,//557 0.161146 0.143103 0.144387
2740 388, 102, 383,//558 0.143103 0.143103 0.162284
2741 386, 388, 383,//559 0.144387 0.162284 0.144387
2742 27, 375, 369,//560 0.156918 0.164485 0.156918
2743 375, 100, 389,//561 0.156918 0.163002 0.158459
2744 389, 97, 369,//562 0.163002 0.156918 0.158459
2745 375, 389, 369,//563 0.158459 0.158459 0.164485
2746 100, 380, 390,//564 0.156918 0.158459 0.163002
2747 380, 28, 384,//565 0.156918 0.156918 0.164485
2748 384, 102, 390,//566 0.156918 0.163002 0.158459
2749 380, 384, 390,//567 0.164485 0.158459 0.158459
2750 102, 387, 391,//568 0.156918 0.158459 0.163002
2751 387, 25, 371,//569 0.156918 0.156918 0.164485
2752 371, 97, 391,//570 0.156918 0.163002 0.158459
2753 387, 371, 391,//571 0.164485 0.158459 0.158459
2754 100, 390, 389,//572 0.163002 0.164647 0.163002
2755 390, 102, 391,//573 0.163002 0.163002 0.164647
2756 391, 97, 389,//574 0.163002 0.163002 0.164647
2757 390, 391, 389,//575 0.164647 0.164647 0.164647
2758 6, 376, 393,//576 0.138283 0.162173 0.138283
2759 376, 98, 392,//577 0.138283 0.161146 0.139482
2760 392, 104, 393,//578 0.161146 0.138283 0.139482
2761 376, 392, 393,//579 0.139482 0.139482 0.162173
2762 98, 373, 395,//580 0.138283 0.157997 0.143103
2763 373, 27, 394,//581 0.138283 0.156918 0.144288
2764 394, 103, 395,//582 0.156918 0.143103 0.139510
2765 373, 394, 395,//583 0.144288 0.139510 0.157997
2766 103, 396, 398,//584 0.156918 0.139510 0.143103
2767 396, 29, 397,//585 0.156918 0.138283 0.144288
2768 397, 104, 398,//586 0.138283 0.143103 0.157997
2769 396, 397, 398,//587 0.144288 0.157997 0.139510
2770 98, 395, 392,//588 0.143103 0.144387 0.161146
2771 395, 103, 398,//589 0.143103 0.143103 0.162284
2772 398, 104, 392,//590 0.143103 0.161146 0.144387
2773 395, 398, 392,//591 0.162284 0.144387 0.144387
2774 27, 368, 400,//592 0.138283 0.144288 0.156918
2775 368, 96, 399,//593 0.138283 0.143103 0.157997
2776 399, 105, 400,//594 0.143103 0.156918 0.139510
2777 368, 399, 400,//595 0.157997 0.139510 0.144288
2778 96, 366, 401,//596 0.138283 0.139482 0.161146
2779 366, 10, 220,//597 0.138283 0.138283 0.162173
2780 220, 60, 401,//598 0.138283 0.161146 0.139482
2781 366, 220, 401,//599 0.162173 0.139482 0.139482
2782 60, 225, 403,//600 0.138283 0.157997 0.143103
2783 225, 18, 402,//601 0.138283 0.156918 0.144288
2784 402, 105, 403,//602 0.156918 0.143103 0.139510
2785 225, 402, 403,//603 0.144288 0.139510 0.157997
2786 96, 401, 399,//604 0.161146 0.144387 0.143103
2787 401, 60, 403,//605 0.161146 0.143103 0.144387
2788 403, 105, 399,//606 0.143103 0.143103 0.162284
2789 401, 403, 399,//607 0.144387 0.162284 0.144387
2790 18, 238, 405,//608 0.138283 0.144288 0.156918
2791 238, 63, 404,//609 0.138283 0.143103 0.157997
2792 404, 107, 405,//610 0.143103 0.156918 0.139510
2793 238, 404, 405,//611 0.157997 0.139510 0.144288
2794 63, 236, 407,//612 0.138283 0.139482 0.161146
2795 236, 7, 406,//613 0.138283 0.138283 0.162173
2796 406, 106, 407,//614 0.138283 0.161146 0.139482
2797 236, 406, 407,//615 0.162173 0.139482 0.139482
2798 106, 408, 410,//616 0.138283 0.157997 0.143103
2799 408, 29, 409,//617 0.138283 0.156918 0.144288
2800 409, 107, 410,//618 0.156918 0.143103 0.139510
2801 408, 409, 410,//619 0.144288 0.139510 0.157997
2802 63, 407, 404,//620 0.161146 0.144387 0.143103
2803 407, 106, 410,//621 0.161146 0.143103 0.144387
2804 410, 107, 404,//622 0.143103 0.143103 0.162284
2805 407, 410, 404,//623 0.144387 0.162284 0.144387
2806 27, 400, 394,//624 0.156918 0.164485 0.156918
2807 400, 105, 411,//625 0.156918 0.163002 0.158459
2808 411, 103, 394,//626 0.163002 0.156918 0.158459
2809 400, 411, 394,//627 0.158459 0.158459 0.164485
2810 105, 402, 412,//628 0.156918 0.158459 0.163002
2811 402, 18, 405,//629 0.156918 0.156918 0.164485
2812 405, 107, 412,//630 0.156918 0.163002 0.158459
2813 402, 405, 412,//631 0.164485 0.158459 0.158459
2814 107, 409, 413,//632 0.156918 0.158459 0.163002
2815 409, 29, 396,//633 0.156918 0.156918 0.164485
2816 396, 103, 413,//634 0.156918 0.163002 0.158459
2817 409, 396, 413,//635 0.164485 0.158459 0.158459
2818 105, 412, 411,//636 0.163002 0.164647 0.163002
2819 412, 107, 413,//637 0.163002 0.163002 0.164647
2820 413, 103, 411,//638 0.163002 0.163002 0.164647
2821 412, 413, 411,//639 0.164647 0.164647 0.164647
2822 7, 414, 406,//640 0.138283 0.162173 0.138283
2823 414, 108, 415,//641 0.138283 0.161146 0.139482
2824 415, 106, 406,//642 0.161146 0.138283 0.139482
2825 414, 415, 406,//643 0.139482 0.139482 0.162173
2826 108, 416, 418,//644 0.138283 0.157997 0.143103
2827 416, 30, 417,//645 0.138283 0.156918 0.144288
2828 417, 109, 418,//646 0.156918 0.143103 0.139510
2829 416, 417, 418,//647 0.144288 0.139510 0.157997
2830 109, 419, 420,//648 0.156918 0.139510 0.143103
2831 419, 29, 408,//649 0.156918 0.138283 0.144288
2832 408, 106, 420,//650 0.138283 0.143103 0.157997
2833 419, 408, 420,//651 0.144288 0.157997 0.139510
2834 108, 418, 415,//652 0.143103 0.144387 0.161146
2835 418, 109, 420,//653 0.143103 0.143103 0.162284
2836 420, 106, 415,//654 0.143103 0.161146 0.144387
2837 418, 420, 415,//655 0.162284 0.144387 0.144387
2838 30, 421, 423,//656 0.138283 0.144288 0.156918
2839 421, 110, 422,//657 0.138283 0.143103 0.157997
2840 422, 112, 423,//658 0.143103 0.156918 0.139510
2841 421, 422, 423,//659 0.157997 0.139510 0.144288
2842 110, 424, 426,//660 0.138283 0.139482 0.161146
2843 424, 8, 425,//661 0.138283 0.138283 0.162173
2844 425, 111, 426,//662 0.138283 0.161146 0.139482
2845 424, 425, 426,//663 0.162173 0.139482 0.139482
2846 111, 427, 429,//664 0.138283 0.157997 0.143103
2847 427, 31, 428,//665 0.138283 0.156918 0.144288
2848 428, 112, 429,//666 0.156918 0.143103 0.139510
2849 427, 428, 429,//667 0.144288 0.139510 0.157997
2850 110, 426, 422,//668 0.161146 0.144387 0.143103
2851 426, 111, 429,//669 0.161146 0.143103 0.144387
2852 429, 112, 422,//670 0.143103 0.143103 0.162284
2853 426, 429, 422,//671 0.144387 0.162284 0.144387
2854 31, 430, 432,//672 0.138283 0.144288 0.156918
2855 430, 113, 431,//673 0.138283 0.143103 0.157997
2856 431, 114, 432,//674 0.143103 0.156918 0.139510
2857 430, 431, 432,//675 0.157997 0.139510 0.144288
2858 113, 433, 434,//676 0.138283 0.139482 0.161146
2859 433, 6, 393,//677 0.138283 0.138283 0.162173
2860 393, 104, 434,//678 0.138283 0.161146 0.139482
2861 433, 393, 434,//679 0.162173 0.139482 0.139482
2862 104, 397, 436,//680 0.138283 0.157997 0.143103
2863 397, 29, 435,//681 0.138283 0.156918 0.144288
2864 435, 114, 436,//682 0.156918 0.143103 0.139510
2865 397, 435, 436,//683 0.144288 0.139510 0.157997
2866 113, 434, 431,//684 0.161146 0.144387 0.143103
2867 434, 104, 436,//685 0.161146 0.143103 0.144387
2868 436, 114, 431,//686 0.143103 0.143103 0.162284
2869 434, 436, 431,//687 0.144387 0.162284 0.144387
2870 30, 423, 417,//688 0.156918 0.164485 0.156918
2871 423, 112, 437,//689 0.156918 0.163002 0.158459
2872 437, 109, 417,//690 0.163002 0.156918 0.158459
2873 423, 437, 417,//691 0.158459 0.158459 0.164485
2874 112, 428, 438,//692 0.156918 0.158459 0.163002
2875 428, 31, 432,//693 0.156918 0.156918 0.164485
2876 432, 114, 438,//694 0.156918 0.163002 0.158459
2877 428, 432, 438,//695 0.164485 0.158459 0.158459
2878 114, 435, 439,//696 0.156918 0.158459 0.163002
2879 435, 29, 419,//697 0.156918 0.156918 0.164485
2880 419, 109, 439,//698 0.156918 0.163002 0.158459
2881 435, 419, 439,//699 0.164485 0.158459 0.158459
2882 112, 438, 437,//700 0.163002 0.164647 0.163002
2883 438, 114, 439,//701 0.163002 0.163002 0.164647
2884 439, 109, 437,//702 0.163002 0.163002 0.164647
2885 438, 439, 437,//703 0.164647 0.164647 0.164647
2886 8, 424, 441,//704 0.138283 0.162173 0.138283
2887 424, 110, 440,//705 0.138283 0.161146 0.139482
2888 440, 116, 441,//706 0.161146 0.138283 0.139482
2889 424, 440, 441,//707 0.139482 0.139482 0.162173
2890 110, 421, 443,//708 0.138283 0.157997 0.143103
2891 421, 30, 442,//709 0.138283 0.156918 0.144288
2892 442, 115, 443,//710 0.156918 0.143103 0.139510
2893 421, 442, 443,//711 0.144288 0.139510 0.157997
2894 115, 444, 446,//712 0.156918 0.139510 0.143103
2895 444, 32, 445,//713 0.156918 0.138283 0.144288
2896 445, 116, 446,//714 0.138283 0.143103 0.157997
2897 444, 445, 446,//715 0.144288 0.157997 0.139510
2898 110, 443, 440,//716 0.143103 0.144387 0.161146
2899 443, 115, 446,//717 0.143103 0.143103 0.162284
2900 446, 116, 440,//718 0.143103 0.161146 0.144387
2901 443, 446, 440,//719 0.162284 0.144387 0.144387
2902 30, 416, 448,//720 0.138283 0.144288 0.156918
2903 416, 108, 447,//721 0.138283 0.143103 0.157997
2904 447, 117, 448,//722 0.143103 0.156918 0.139510
2905 416, 447, 448,//723 0.157997 0.139510 0.144288
2906 108, 414, 449,//724 0.138283 0.139482 0.161146
2907 414, 7, 209,//725 0.138283 0.138283 0.162173
2908 209, 55, 449,//726 0.138283 0.161146 0.139482
2909 414, 209, 449,//727 0.162173 0.139482 0.139482
2910 55, 206, 451,//728 0.138283 0.157997 0.143103
2911 206, 15, 450,//729 0.138283 0.156918 0.144288
2912 450, 117, 451,//730 0.156918 0.143103 0.139510
2913 206, 450, 451,//731 0.144288 0.139510 0.157997
2914 108, 449, 447,//732 0.161146 0.144387 0.143103
2915 449, 55, 451,//733 0.161146 0.143103 0.144387
2916 451, 117, 447,//734 0.143103 0.143103 0.162284
2917 449, 451, 447,//735 0.144387 0.162284 0.144387
2918 15, 203, 453,//736 0.138283 0.144288 0.156918
2919 203, 53, 452,//737 0.138283 0.143103 0.157997
2920 452, 119, 453,//738 0.143103 0.156918 0.139510
2921 203, 452, 453,//739 0.157997 0.139510 0.144288
2922 53, 201, 455,//740 0.138283 0.139482 0.161146
2923 201, 1, 454,//741 0.138283 0.138283 0.162173
2924 454, 118, 455,//742 0.138283 0.161146 0.139482
2925 201, 454, 455,//743 0.162173 0.139482 0.139482
2926 118, 456, 458,//744 0.138283 0.157997 0.143103
2927 456, 32, 457,//745 0.138283 0.156918 0.144288
2928 457, 119, 458,//746 0.156918 0.143103 0.139510
2929 456, 457, 458,//747 0.144288 0.139510 0.157997
2930 53, 455, 452,//748 0.161146 0.144387 0.143103
2931 455, 118, 458,//749 0.161146 0.143103 0.144387
2932 458, 119, 452,//750 0.143103 0.143103 0.162284
2933 455, 458, 452,//751 0.144387 0.162284 0.144387
2934 30, 448, 442,//752 0.156918 0.164485 0.156918
2935 448, 117, 459,//753 0.156918 0.163002 0.158459
2936 459, 115, 442,//754 0.163002 0.156918 0.158459
2937 448, 459, 442,//755 0.158459 0.158459 0.164485
2938 117, 450, 460,//756 0.156918 0.158459 0.163002
2939 450, 15, 453,//757 0.156918 0.156918 0.164485
2940 453, 119, 460,//758 0.156918 0.163002 0.158459
2941 450, 453, 460,//759 0.164485 0.158459 0.158459
2942 119, 457, 461,//760 0.156918 0.158459 0.163002
2943 457, 32, 444,//761 0.156918 0.156918 0.164485
2944 444, 115, 461,//762 0.156918 0.163002 0.158459
2945 457, 444, 461,//763 0.164485 0.158459 0.158459
2946 117, 460, 459,//764 0.163002 0.164647 0.163002
2947 460, 119, 461,//765 0.163002 0.163002 0.164647
2948 461, 115, 459,//766 0.163002 0.163002 0.164647
2949 460, 461, 459,//767 0.164647 0.164647 0.164647
2950 9, 462, 464,//768 0.138283 0.162173 0.138283
2951 462, 120, 463,//769 0.138283 0.161146 0.139482
2952 463, 122, 464,//770 0.161146 0.138283 0.139482
2953 462, 463, 464,//771 0.139482 0.139482 0.162173
2954 120, 465, 467,//772 0.138283 0.157997 0.143103
2955 465, 33, 466,//773 0.138283 0.156918 0.144288
2956 466, 121, 467,//774 0.156918 0.143103 0.139510
2957 465, 466, 467,//775 0.144288 0.139510 0.157997
2958 121, 468, 470,//776 0.156918 0.139510 0.143103
2959 468, 34, 469,//777 0.156918 0.138283 0.144288
2960 469, 122, 470,//778 0.138283 0.143103 0.157997
2961 468, 469, 470,//779 0.144288 0.157997 0.139510
2962 120, 467, 463,//780 0.143103 0.144387 0.161146
2963 467, 121, 470,//781 0.143103 0.143103 0.162284
2964 470, 122, 463,//782 0.143103 0.161146 0.144387
2965 467, 470, 463,//783 0.162284 0.144387 0.144387
2966 33, 471, 473,//784 0.138283 0.144288 0.156918
2967 471, 123, 472,//785 0.138283 0.143103 0.157997
2968 472, 124, 473,//786 0.143103 0.156918 0.139510
2969 471, 472, 473,//787 0.157997 0.139510 0.144288
2970 123, 474, 475,//788 0.138283 0.139482 0.161146
2971 474, 1, 164,//789 0.138283 0.138283 0.162173
2972 164, 44, 475,//790 0.138283 0.161146 0.139482
2973 474, 164, 475,//791 0.162173 0.139482 0.139482
2974 44, 169, 477,//792 0.138283 0.157997 0.143103
2975 169, 14, 476,//793 0.138283 0.156918 0.144288
2976 476, 124, 477,//794 0.156918 0.143103 0.139510
2977 169, 476, 477,//795 0.144288 0.139510 0.157997
2978 123, 475, 472,//796 0.161146 0.144387 0.143103
2979 475, 44, 477,//797 0.161146 0.143103 0.144387
2980 477, 124, 472,//798 0.143103 0.143103 0.162284
2981 475, 477, 472,//799 0.144387 0.162284 0.144387
2982 14, 186, 479,//800 0.138283 0.144288 0.156918
2983 186, 49, 478,//801 0.138283 0.143103 0.157997
2984 478, 126, 479,//802 0.143103 0.156918 0.139510
2985 186, 478, 479,//803 0.157997 0.139510 0.144288
2986 49, 184, 481,//804 0.138283 0.139482 0.161146
2987 184, 5, 480,//805 0.138283 0.138283 0.162173
2988 480, 125, 481,//806 0.138283 0.161146 0.139482
2989 184, 480, 481,//807 0.162173 0.139482 0.139482
2990 125, 482, 484,//808 0.138283 0.157997 0.143103
2991 482, 34, 483,//809 0.138283 0.156918 0.144288
2992 483, 126, 484,//810 0.156918 0.143103 0.139510
2993 482, 483, 484,//811 0.144288 0.139510 0.157997
2994 49, 481, 478,//812 0.161146 0.144387 0.143103
2995 481, 125, 484,//813 0.161146 0.143103 0.144387
2996 484, 126, 478,//814 0.143103 0.143103 0.162284
2997 481, 484, 478,//815 0.144387 0.162284 0.144387
2998 33, 473, 466,//816 0.156918 0.164485 0.156918
2999 473, 124, 485,//817 0.156918 0.163002 0.158459
3000 485, 121, 466,//818 0.163002 0.156918 0.158459
3001 473, 485, 466,//819 0.158459 0.158459 0.164485
3002 124, 476, 486,//820 0.156918 0.158459 0.163002
3003 476, 14, 479,//821 0.156918 0.156918 0.164485
3004 479, 126, 486,//822 0.156918 0.163002 0.158459
3005 476, 479, 486,//823 0.164485 0.158459 0.158459
3006 126, 483, 487,//824 0.156918 0.158459 0.163002
3007 483, 34, 468,//825 0.156918 0.156918 0.164485
3008 468, 121, 487,//826 0.156918 0.163002 0.158459
3009 483, 468, 487,//827 0.164485 0.158459 0.158459
3010 124, 486, 485,//828 0.163002 0.164647 0.163002
3011 486, 126, 487,//829 0.163002 0.163002 0.164647
3012 487, 121, 485,//830 0.163002 0.163002 0.164647
3013 486, 487, 485,//831 0.164647 0.164647 0.164647
3014 1, 474, 454,//832 0.138283 0.162173 0.138283
3015 474, 123, 488,//833 0.138283 0.161146 0.139482
3016 488, 118, 454,//834 0.161146 0.138283 0.139482
3017 474, 488, 454,//835 0.139482 0.139482 0.162173
3018 123, 471, 490,//836 0.138283 0.157997 0.143103
3019 471, 33, 489,//837 0.138283 0.156918 0.144288
3020 489, 127, 490,//838 0.156918 0.143103 0.139510
3021 471, 489, 490,//839 0.144288 0.139510 0.157997
3022 127, 491, 492,//840 0.156918 0.139510 0.143103
3023 491, 32, 456,//841 0.156918 0.138283 0.144288
3024 456, 118, 492,//842 0.138283 0.143103 0.157997
3025 491, 456, 492,//843 0.144288 0.157997 0.139510
3026 123, 490, 488,//844 0.143103 0.144387 0.161146
3027 490, 127, 492,//845 0.143103 0.143103 0.162284
3028 492, 118, 488,//846 0.143103 0.161146 0.144387
3029 490, 492, 488,//847 0.162284 0.144387 0.144387
3030 33, 465, 494,//848 0.138283 0.144288 0.156918
3031 465, 120, 493,//849 0.138283 0.143103 0.157997
3032 493, 129, 494,//850 0.143103 0.156918 0.139510
3033 465, 493, 494,//851 0.157997 0.139510 0.144288
3034 120, 462, 496,//852 0.138283 0.139482 0.161146
3035 462, 9, 495,//853 0.138283 0.138283 0.162173
3036 495, 128, 496,//854 0.138283 0.161146 0.139482
3037 462, 495, 496,//855 0.162173 0.139482 0.139482
3038 128, 497, 499,//856 0.138283 0.157997 0.143103
3039 497, 35, 498,//857 0.138283 0.156918 0.144288
3040 498, 129, 499,//858 0.156918 0.143103 0.139510
3041 497, 498, 499,//859 0.144288 0.139510 0.157997
3042 120, 496, 493,//860 0.161146 0.144387 0.143103
3043 496, 128, 499,//861 0.161146 0.143103 0.144387
3044 499, 129, 493,//862 0.143103 0.143103 0.162284
3045 496, 499, 493,//863 0.144387 0.162284 0.144387
3046 35, 500, 502,//864 0.138283 0.144288 0.156918
3047 500, 130, 501,//865 0.138283 0.143103 0.157997
3048 501, 131, 502,//866 0.143103 0.156918 0.139510
3049 500, 501, 502,//867 0.157997 0.139510 0.144288
3050 130, 503, 504,//868 0.138283 0.139482 0.161146
3051 503, 8, 441,//869 0.138283 0.138283 0.162173
3052 441, 116, 504,//870 0.138283 0.161146 0.139482
3053 503, 441, 504,//871 0.162173 0.139482 0.139482
3054 116, 445, 506,//872 0.138283 0.157997 0.143103
3055 445, 32, 505,//873 0.138283 0.156918 0.144288
3056 505, 131, 506,//874 0.156918 0.143103 0.139510
3057 445, 505, 506,//875 0.144288 0.139510 0.157997
3058 130, 504, 501,//876 0.161146 0.144387 0.143103
3059 504, 116, 506,//877 0.161146 0.143103 0.144387
3060 506, 131, 501,//878 0.143103 0.143103 0.162284
3061 504, 506, 501,//879 0.144387 0.162284 0.144387
3062 33, 494, 489,//880 0.156918 0.164485 0.156918
3063 494, 129, 507,//881 0.156918 0.163002 0.158459
3064 507, 127, 489,//882 0.163002 0.156918 0.158459
3065 494, 507, 489,//883 0.158459 0.158459 0.164485
3066 129, 498, 508,//884 0.156918 0.158459 0.163002
3067 498, 35, 502,//885 0.156918 0.156918 0.164485
3068 502, 131, 508,//886 0.156918 0.163002 0.158459
3069 498, 502, 508,//887 0.164485 0.158459 0.158459
3070 131, 505, 509,//888 0.156918 0.158459 0.163002
3071 505, 32, 491,//889 0.156918 0.156918 0.164485
3072 491, 127, 509,//890 0.156918 0.163002 0.158459
3073 505, 491, 509,//891 0.164485 0.158459 0.158459
3074 129, 508, 507,//892 0.163002 0.164647 0.163002
3075 508, 131, 509,//893 0.163002 0.163002 0.164647
3076 509, 127, 507,//894 0.163002 0.163002 0.164647
3077 508, 509, 507,//895 0.164647 0.164647 0.164647
3078 4, 510, 310,//896 0.138283 0.162173 0.138283
3079 510, 132, 511,//897 0.138283 0.161146 0.139482
3080 511, 82, 310,//898 0.161146 0.138283 0.139482
3081 510, 511, 310,//899 0.139482 0.139482 0.162173
3082 132, 512, 514,//900 0.138283 0.157997 0.143103
3083 512, 36, 513,//901 0.138283 0.156918 0.144288
3084 513, 133, 514,//902 0.156918 0.143103 0.139510
3085 512, 513, 514,//903 0.144288 0.139510 0.157997
3086 133, 515, 516,//904 0.156918 0.139510 0.143103
3087 515, 23, 312,//905 0.156918 0.138283 0.144288
3088 312, 82, 516,//906 0.138283 0.143103 0.157997
3089 515, 312, 516,//907 0.144288 0.157997 0.139510
3090 132, 514, 511,//908 0.143103 0.144387 0.161146
3091 514, 133, 516,//909 0.143103 0.143103 0.162284
3092 516, 82, 511,//910 0.143103 0.161146 0.144387
3093 514, 516, 511,//911 0.162284 0.144387 0.144387
3094 36, 517, 519,//912 0.138283 0.144288 0.156918
3095 517, 134, 518,//913 0.138283 0.143103 0.157997
3096 518, 135, 519,//914 0.143103 0.156918 0.139510
3097 517, 518, 519,//915 0.157997 0.139510 0.144288
3098 134, 520, 521,//916 0.138283 0.139482 0.161146
3099 520, 9, 464,//917 0.138283 0.138283 0.162173
3100 464, 122, 521,//918 0.138283 0.161146 0.139482
3101 520, 464, 521,//919 0.162173 0.139482 0.139482
3102 122, 469, 523,//920 0.138283 0.157997 0.143103
3103 469, 34, 522,//921 0.138283 0.156918 0.144288
3104 522, 135, 523,//922 0.156918 0.143103 0.139510
3105 469, 522, 523,//923 0.144288 0.139510 0.157997
3106 134, 521, 518,//924 0.161146 0.144387 0.143103
3107 521, 122, 523,//925 0.161146 0.143103 0.144387
3108 523, 135, 518,//926 0.143103 0.143103 0.162284
3109 521, 523, 518,//927 0.144387 0.162284 0.144387
3110 34, 482, 525,//928 0.138283 0.144288 0.156918
3111 482, 125, 524,//929 0.138283 0.143103 0.157997
3112 524, 136, 525,//930 0.143103 0.156918 0.139510
3113 482, 524, 525,//931 0.157997 0.139510 0.144288
3114 125, 480, 526,//932 0.138283 0.139482 0.161146
3115 480, 5, 293,//933 0.138283 0.138283 0.162173
3116 293, 78, 526,//934 0.138283 0.161146 0.139482
3117 480, 293, 526,//935 0.162173 0.139482 0.139482
3118 78, 297, 528,//936 0.138283 0.157997 0.143103
3119 297, 23, 527,//937 0.138283 0.156918 0.144288
3120 527, 136, 528,//938 0.156918 0.143103 0.139510
3121 297, 527, 528,//939 0.144288 0.139510 0.157997
3122 125, 526, 524,//940 0.161146 0.144387 0.143103
3123 526, 78, 528,//941 0.161146 0.143103 0.144387
3124 528, 136, 524,//942 0.143103 0.143103 0.162284
3125 526, 528, 524,//943 0.144387 0.162284 0.144387
3126 36, 519, 513,//944 0.156918 0.164485 0.156918
3127 519, 135, 529,//945 0.156918 0.163002 0.158459
3128 529, 133, 513,//946 0.163002 0.156918 0.158459
3129 519, 529, 513,//947 0.158459 0.158459 0.164485
3130 135, 522, 530,//948 0.156918 0.158459 0.163002
3131 522, 34, 525,//949 0.156918 0.156918 0.164485
3132 525, 136, 530,//950 0.156918 0.163002 0.158459
3133 522, 525, 530,//951 0.164485 0.158459 0.158459
3134 136, 527, 531,//952 0.156918 0.158459 0.163002
3135 527, 23, 515,//953 0.156918 0.156918 0.164485
3136 515, 133, 531,//954 0.156918 0.163002 0.158459
3137 527, 515, 531,//955 0.164485 0.158459 0.158459
3138 135, 530, 529,//956 0.163002 0.164647 0.163002
3139 530, 136, 531,//957 0.163002 0.163002 0.164647
3140 531, 133, 529,//958 0.163002 0.163002 0.164647
3141 530, 531, 529,//959 0.164647 0.164647 0.164647
3142 9, 520, 533,//960 0.138283 0.162173 0.138283
3143 520, 134, 532,//961 0.138283 0.161146 0.139482
3144 532, 138, 533,//962 0.161146 0.138283 0.139482
3145 520, 532, 533,//963 0.139482 0.139482 0.162173
3146 134, 517, 535,//964 0.138283 0.157997 0.143103
3147 517, 36, 534,//965 0.138283 0.156918 0.144288
3148 534, 137, 535,//966 0.156918 0.143103 0.139510
3149 517, 534, 535,//967 0.144288 0.139510 0.157997
3150 137, 536, 538,//968 0.156918 0.139510 0.143103
3151 536, 38, 537,//969 0.156918 0.138283 0.144288
3152 537, 138, 538,//970 0.138283 0.143103 0.157997
3153 536, 537, 538,//971 0.144288 0.157997 0.139510
3154 134, 535, 532,//972 0.143103 0.144387 0.161146
3155 535, 137, 538,//973 0.143103 0.143103 0.162284
3156 538, 138, 532,//974 0.143103 0.161146 0.144387
3157 535, 538, 532,//975 0.162284 0.144387 0.144387
3158 36, 512, 540,//976 0.138283 0.144288 0.156918
3159 512, 132, 539,//977 0.138283 0.143103 0.157997
3160 539, 140, 540,//978 0.143103 0.156918 0.139510
3161 512, 539, 540,//979 0.157997 0.139510 0.144288
3162 132, 510, 542,//980 0.138283 0.139482 0.161146
3163 510, 4, 541,//981 0.138283 0.138283 0.162173
3164 541, 139, 542,//982 0.138283 0.161146 0.139482
3165 510, 541, 542,//983 0.162173 0.139482 0.139482
3166 139, 543, 545,//984 0.138283 0.157997 0.143103
3167 543, 37, 544,//985 0.138283 0.156918 0.144288
3168 544, 140, 545,//986 0.156918 0.143103 0.139510
3169 543, 544, 545,//987 0.144288 0.139510 0.157997
3170 132, 542, 539,//988 0.161146 0.144387 0.143103
3171 542, 139, 545,//989 0.161146 0.143103 0.144387
3172 545, 140, 539,//990 0.143103 0.143103 0.162284
3173 542, 545, 539,//991 0.144387 0.162284 0.144387
3174 37, 546, 548,//992 0.138283 0.144288 0.156918
3175 546, 141, 547,//993 0.138283 0.143103 0.157997
3176 547, 143, 548,//994 0.143103 0.156918 0.139510
3177 546, 547, 548,//995 0.157997 0.139510 0.144288
3178 141, 549, 551,//996 0.138283 0.139482 0.161146
3179 549, 3, 550,//997 0.138283 0.138283 0.162173
3180 550, 142, 551,//998 0.138283 0.161146 0.139482
3181 549, 550, 551,//999 0.162173 0.139482 0.139482
3182 142, 552, 554,//1000 0.138283 0.157997 0.143103
3183 552, 38, 553,//1001 0.138283 0.156918 0.144288
3184 553, 143, 554,//1002 0.156918 0.143103 0.139510
3185 552, 553, 554,//1003 0.144288 0.139510 0.157997
3186 141, 551, 547,//1004 0.161146 0.144387 0.143103
3187 551, 142, 554,//1005 0.161146 0.143103 0.144387
3188 554, 143, 547,//1006 0.143103 0.143103 0.162284
3189 551, 554, 547,//1007 0.144387 0.162284 0.144387
3190 36, 540, 534,//1008 0.156918 0.164485 0.156918
3191 540, 140, 555,//1009 0.156918 0.163002 0.158459
3192 555, 137, 534,//1010 0.163002 0.156918 0.158459
3193 540, 555, 534,//1011 0.158459 0.158459 0.164485
3194 140, 544, 556,//1012 0.156918 0.158459 0.163002
3195 544, 37, 548,//1013 0.156918 0.156918 0.164485
3196 548, 143, 556,//1014 0.156918 0.163002 0.158459
3197 544, 548, 556,//1015 0.164485 0.158459 0.158459
3198 143, 553, 557,//1016 0.156918 0.158459 0.163002
3199 553, 38, 536,//1017 0.156918 0.156918 0.164485
3200 536, 137, 557,//1018 0.156918 0.163002 0.158459
3201 553, 536, 557,//1019 0.164485 0.158459 0.158459
3202 140, 556, 555,//1020 0.163002 0.164647 0.163002
3203 556, 143, 557,//1021 0.163002 0.163002 0.164647
3204 557, 137, 555,//1022 0.163002 0.163002 0.164647
3205 556, 557, 555,//1023 0.164647 0.164647 0.164647
3206 3, 558, 550,//1024 0.138283 0.162173 0.138283
3207 558, 144, 559,//1025 0.138283 0.161146 0.139482
3208 559, 142, 550,//1026 0.161146 0.138283 0.139482
3209 558, 559, 550,//1027 0.139482 0.139482 0.162173
3210 144, 560, 562,//1028 0.138283 0.157997 0.143103
3211 560, 39, 561,//1029 0.138283 0.156918 0.144288
3212 561, 145, 562,//1030 0.156918 0.143103 0.139510
3213 560, 561, 562,//1031 0.144288 0.139510 0.157997
3214 145, 563, 564,//1032 0.156918 0.139510 0.143103
3215 563, 38, 552,//1033 0.156918 0.138283 0.144288
3216 552, 142, 564,//1034 0.138283 0.143103 0.157997
3217 563, 552, 564,//1035 0.144288 0.157997 0.139510
3218 144, 562, 559,//1036 0.143103 0.144387 0.161146
3219 562, 145, 564,//1037 0.143103 0.143103 0.162284
3220 564, 142, 559,//1038 0.143103 0.161146 0.144387
3221 562, 564, 559,//1039 0.162284 0.144387 0.144387
3222 39, 565, 567,//1040 0.138283 0.144288 0.156918
3223 565, 146, 566,//1041 0.138283 0.143103 0.157997
3224 566, 147, 567,//1042 0.143103 0.156918 0.139510
3225 565, 566, 567,//1043 0.157997 0.139510 0.144288
3226 146, 568, 569,//1044 0.138283 0.139482 0.161146
3227 568, 8, 503,//1045 0.138283 0.138283 0.162173
3228 503, 130, 569,//1046 0.138283 0.161146 0.139482
3229 568, 503, 569,//1047 0.162173 0.139482 0.139482
3230 130, 500, 571,//1048 0.138283 0.157997 0.143103
3231 500, 35, 570,//1049 0.138283 0.156918 0.144288
3232 570, 147, 571,//1050 0.156918 0.143103 0.139510
3233 500, 570, 571,//1051 0.144288 0.139510 0.157997
3234 146, 569, 566,//1052 0.161146 0.144387 0.143103
3235 569, 130, 571,//1053 0.161146 0.143103 0.144387
3236 571, 147, 566,//1054 0.143103 0.143103 0.162284
3237 569, 571, 566,//1055 0.144387 0.162284 0.144387
3238 35, 497, 573,//1056 0.138283 0.144288 0.156918
3239 497, 128, 572,//1057 0.138283 0.143103 0.157997
3240 572, 148, 573,//1058 0.143103 0.156918 0.139510
3241 497, 572, 573,//1059 0.157997 0.139510 0.144288
3242 128, 495, 574,//1060 0.138283 0.139482 0.161146
3243 495, 9, 533,//1061 0.138283 0.138283 0.162173
3244 533, 138, 574,//1062 0.138283 0.161146 0.139482
3245 495, 533, 574,//1063 0.162173 0.139482 0.139482
3246 138, 537, 576,//1064 0.138283 0.157997 0.143103
3247 537, 38, 575,//1065 0.138283 0.156918 0.144288
3248 575, 148, 576,//1066 0.156918 0.143103 0.139510
3249 537, 575, 576,//1067 0.144288 0.139510 0.157997
3250 128, 574, 572,//1068 0.161146 0.144387 0.143103
3251 574, 138, 576,//1069 0.161146 0.143103 0.144387
3252 576, 148, 572,//1070 0.143103 0.143103 0.162284
3253 574, 576, 572,//1071 0.144387 0.162284 0.144387
3254 39, 567, 561,//1072 0.156918 0.164485 0.156918
3255 567, 147, 577,//1073 0.156918 0.163002 0.158459
3256 577, 145, 561,//1074 0.163002 0.156918 0.158459
3257 567, 577, 561,//1075 0.158459 0.158459 0.164485
3258 147, 570, 578,//1076 0.156918 0.158459 0.163002
3259 570, 35, 573,//1077 0.156918 0.156918 0.164485
3260 573, 148, 578,//1078 0.156918 0.163002 0.158459
3261 570, 573, 578,//1079 0.164485 0.158459 0.158459
3262 148, 575, 579,//1080 0.156918 0.158459 0.163002
3263 575, 38, 563,//1081 0.156918 0.156918 0.164485
3264 563, 145, 579,//1082 0.156918 0.163002 0.158459
3265 575, 563, 579,//1083 0.164485 0.158459 0.158459
3266 147, 578, 577,//1084 0.163002 0.164647 0.163002
3267 578, 148, 579,//1085 0.163002 0.163002 0.164647
3268 579, 145, 577,//1086 0.163002 0.163002 0.164647
3269 578, 579, 577,//1087 0.164647 0.164647 0.164647
3270 8, 568, 425,//1088 0.138283 0.162173 0.138283
3271 568, 146, 580,//1089 0.138283 0.161146 0.139482
3272 580, 111, 425,//1090 0.161146 0.138283 0.139482
3273 568, 580, 425,//1091 0.139482 0.139482 0.162173
3274 146, 565, 582,//1092 0.138283 0.157997 0.143103
3275 565, 39, 581,//1093 0.138283 0.156918 0.144288
3276 581, 149, 582,//1094 0.156918 0.143103 0.139510
3277 565, 581, 582,//1095 0.144288 0.139510 0.157997
3278 149, 583, 584,//1096 0.156918 0.139510 0.143103
3279 583, 31, 427,//1097 0.156918 0.138283 0.144288
3280 427, 111, 584,//1098 0.138283 0.143103 0.157997
3281 583, 427, 584,//1099 0.144288 0.157997 0.139510
3282 146, 582, 580,//1100 0.143103 0.144387 0.161146
3283 582, 149, 584,//1101 0.143103 0.143103 0.162284
3284 584, 111, 580,//1102 0.143103 0.161146 0.144387
3285 582, 584, 580,//1103 0.162284 0.144387 0.144387
3286 39, 560, 586,//1104 0.138283 0.144288 0.156918
3287 560, 144, 585,//1105 0.138283 0.143103 0.157997
3288 585, 151, 586,//1106 0.143103 0.156918 0.139510
3289 560, 585, 586,//1107 0.157997 0.139510 0.144288
3290 144, 558, 588,//1108 0.138283 0.139482 0.161146
3291 558, 3, 587,//1109 0.138283 0.138283 0.162173
3292 587, 150, 588,//1110 0.138283 0.161146 0.139482
3293 558, 587, 588,//1111 0.162173 0.139482 0.139482
3294 150, 589, 591,//1112 0.138283 0.157997 0.143103
3295 589, 40, 590,//1113 0.138283 0.156918 0.144288
3296 590, 151, 591,//1114 0.156918 0.143103 0.139510
3297 589, 590, 591,//1115 0.144288 0.139510 0.157997
3298 144, 588, 585,//1116 0.161146 0.144387 0.143103
3299 588, 150, 591,//1117 0.161146 0.143103 0.144387
3300 591, 151, 585,//1118 0.143103 0.143103 0.162284
3301 588, 591, 585,//1119 0.144387 0.162284 0.144387
3302 40, 592, 594,//1120 0.138283 0.144288 0.156918
3303 592, 152, 593,//1121 0.138283 0.143103 0.157997
3304 593, 153, 594,//1122 0.143103 0.156918 0.139510
3305 592, 593, 594,//1123 0.157997 0.139510 0.144288
3306 152, 595, 596,//1124 0.138283 0.139482 0.161146
3307 595, 6, 433,//1125 0.138283 0.138283 0.162173
3308 433, 113, 596,//1126 0.138283 0.161146 0.139482
3309 595, 433, 596,//1127 0.162173 0.139482 0.139482
3310 113, 430, 598,//1128 0.138283 0.157997 0.143103
3311 430, 31, 597,//1129 0.138283 0.156918 0.144288
3312 597, 153, 598,//1130 0.156918 0.143103 0.139510
3313 430, 597, 598,//1131 0.144288 0.139510 0.157997
3314 152, 596, 593,//1132 0.161146 0.144387 0.143103
3315 596, 113, 598,//1133 0.161146 0.143103 0.144387
3316 598, 153, 593,//1134 0.143103 0.143103 0.162284
3317 596, 598, 593,//1135 0.144387 0.162284 0.144387
3318 39, 586, 581,//1136 0.156918 0.164485 0.156918
3319 586, 151, 599,//1137 0.156918 0.163002 0.158459
3320 599, 149, 581,//1138 0.163002 0.156918 0.158459
3321 586, 599, 581,//1139 0.158459 0.158459 0.164485
3322 151, 590, 600,//1140 0.156918 0.158459 0.163002
3323 590, 40, 594,//1141 0.156918 0.156918 0.164485
3324 594, 153, 600,//1142 0.156918 0.163002 0.158459
3325 590, 594, 600,//1143 0.164485 0.158459 0.158459
3326 153, 597, 601,//1144 0.156918 0.158459 0.163002
3327 597, 31, 583,//1145 0.156918 0.156918 0.164485
3328 583, 149, 601,//1146 0.156918 0.163002 0.158459
3329 597, 583, 601,//1147 0.164485 0.158459 0.158459
3330 151, 600, 599,//1148 0.163002 0.164647 0.163002
3331 600, 153, 601,//1149 0.163002 0.163002 0.164647
3332 601, 149, 599,//1150 0.163002 0.163002 0.164647
3333 600, 601, 599,//1151 0.164647 0.164647 0.164647
3334 3, 602, 587,//1152 0.138283 0.162173 0.138283
3335 602, 154, 603,//1153 0.138283 0.161146 0.139482
3336 603, 150, 587,//1154 0.161146 0.138283 0.139482
3337 602, 603, 587,//1155 0.139482 0.139482 0.162173
3338 154, 604, 606,//1156 0.138283 0.157997 0.143103
3339 604, 41, 605,//1157 0.138283 0.156918 0.144288
3340 605, 155, 606,//1158 0.156918 0.143103 0.139510
3341 604, 605, 606,//1159 0.144288 0.139510 0.157997
3342 155, 607, 608,//1160 0.156918 0.139510 0.143103
3343 607, 40, 589,//1161 0.156918 0.138283 0.144288
3344 589, 150, 608,//1162 0.138283 0.143103 0.157997
3345 607, 589, 608,//1163 0.144288 0.157997 0.139510
3346 154, 606, 603,//1164 0.143103 0.144387 0.161146
3347 606, 155, 608,//1165 0.143103 0.143103 0.162284
3348 608, 150, 603,//1166 0.143103 0.161146 0.144387
3349 606, 608, 603,//1167 0.162284 0.144387 0.144387
3350 41, 609, 611,//1168 0.138283 0.144288 0.156918
3351 609, 156, 610,//1169 0.138283 0.143103 0.157997
3352 610, 157, 611,//1170 0.143103 0.156918 0.139510
3353 609, 610, 611,//1171 0.157997 0.139510 0.144288
3354 156, 612, 613,//1172 0.138283 0.139482 0.161146
3355 612, 2, 385,//1173 0.138283 0.138283 0.162173
3356 385, 101, 613,//1174 0.138283 0.161146 0.139482
3357 612, 385, 613,//1175 0.162173 0.139482 0.139482
3358 101, 382, 615,//1176 0.138283 0.157997 0.143103
3359 382, 28, 614,//1177 0.138283 0.156918 0.144288
3360 614, 157, 615,//1178 0.156918 0.143103 0.139510
3361 382, 614, 615,//1179 0.144288 0.139510 0.157997
3362 156, 613, 610,//1180 0.161146 0.144387 0.143103
3363 613, 101, 615,//1181 0.161146 0.143103 0.144387
3364 615, 157, 610,//1182 0.143103 0.143103 0.162284
3365 613, 615, 610,//1183 0.144387 0.162284 0.144387
3366 28, 379, 617,//1184 0.138283 0.144288 0.156918
3367 379, 99, 616,//1185 0.138283 0.143103 0.157997
3368 616, 158, 617,//1186 0.143103 0.156918 0.139510
3369 379, 616, 617,//1187 0.157997 0.139510 0.144288
3370 99, 377, 618,//1188 0.138283 0.139482 0.161146
3371 377, 6, 595,//1189 0.138283 0.138283 0.162173
3372 595, 152, 618,//1190 0.138283 0.161146 0.139482
3373 377, 595, 618,//1191 0.162173 0.139482 0.139482
3374 152, 592, 620,//1192 0.138283 0.157997 0.143103
3375 592, 40, 619,//1193 0.138283 0.156918 0.144288
3376 619, 158, 620,//1194 0.156918 0.143103 0.139510
3377 592, 619, 620,//1195 0.144288 0.139510 0.157997
3378 99, 618, 616,//1196 0.161146 0.144387 0.143103
3379 618, 152, 620,//1197 0.161146 0.143103 0.144387
3380 620, 158, 616,//1198 0.143103 0.143103 0.162284
3381 618, 620, 616,//1199 0.144387 0.162284 0.144387
3382 41, 611, 605,//1200 0.156918 0.164485 0.156918
3383 611, 157, 621,//1201 0.156918 0.163002 0.158459
3384 621, 155, 605,//1202 0.163002 0.156918 0.158459
3385 611, 621, 605,//1203 0.158459 0.158459 0.164485
3386 157, 614, 622,//1204 0.156918 0.158459 0.163002
3387 614, 28, 617,//1205 0.156918 0.156918 0.164485
3388 617, 158, 622,//1206 0.156918 0.163002 0.158459
3389 614, 617, 622,//1207 0.164485 0.158459 0.158459
3390 158, 619, 623,//1208 0.156918 0.158459 0.163002
3391 619, 40, 607,//1209 0.156918 0.156918 0.164485
3392 607, 155, 623,//1210 0.156918 0.163002 0.158459
3393 619, 607, 623,//1211 0.164485 0.158459 0.158459
3394 157, 622, 621,//1212 0.163002 0.164647 0.163002
3395 622, 158, 623,//1213 0.163002 0.163002 0.164647
3396 623, 155, 621,//1214 0.163002 0.163002 0.164647
3397 622, 623, 621,//1215 0.164647 0.164647 0.164647
3398 2, 612, 351,//1216 0.138283 0.162173 0.138283
3399 612, 156, 624,//1217 0.138283 0.161146 0.139482
3400 624, 92, 351,//1218 0.161146 0.138283 0.139482
3401 612, 624, 351,//1219 0.139482 0.139482 0.162173
3402 156, 609, 626,//1220 0.138283 0.157997 0.143103
3403 609, 41, 625,//1221 0.138283 0.156918 0.144288
3404 625, 159, 626,//1222 0.156918 0.143103 0.139510
3405 609, 625, 626,//1223 0.144288 0.139510 0.157997
3406 159, 627, 628,//1224 0.156918 0.139510 0.143103
3407 627, 26, 353,//1225 0.156918 0.138283 0.144288
3408 353, 92, 628,//1226 0.138283 0.143103 0.157997
3409 627, 353, 628,//1227 0.144288 0.157997 0.139510
3410 156, 626, 624,//1228 0.143103 0.144387 0.161146
3411 626, 159, 628,//1229 0.143103 0.143103 0.162284
3412 628, 92, 624,//1230 0.143103 0.161146 0.144387
3413 626, 628, 624,//1231 0.162284 0.144387 0.144387
3414 41, 604, 630,//1232 0.138283 0.144288 0.156918
3415 604, 154, 629,//1233 0.138283 0.143103 0.157997
3416 629, 160, 630,//1234 0.143103 0.156918 0.139510
3417 604, 629, 630,//1235 0.157997 0.139510 0.144288
3418 154, 602, 631,//1236 0.138283 0.139482 0.161146
3419 602, 3, 549,//1237 0.138283 0.138283 0.162173
3420 549, 141, 631,//1238 0.138283 0.161146 0.139482
3421 602, 549, 631,//1239 0.162173 0.139482 0.139482
3422 141, 546, 633,//1240 0.138283 0.157997 0.143103
3423 546, 37, 632,//1241 0.138283 0.156918 0.144288
3424 632, 160, 633,//1242 0.156918 0.143103 0.139510
3425 546, 632, 633,//1243 0.144288 0.139510 0.157997
3426 154, 631, 629,//1244 0.161146 0.144387 0.143103
3427 631, 141, 633,//1245 0.161146 0.143103 0.144387
3428 633, 160, 629,//1246 0.143103 0.143103 0.162284
3429 631, 633, 629,//1247 0.144387 0.162284 0.144387
3430 37, 543, 635,//1248 0.138283 0.144288 0.156918
3431 543, 139, 634,//1249 0.138283 0.143103 0.157997
3432 634, 161, 635,//1250 0.143103 0.156918 0.139510
3433 543, 634, 635,//1251 0.157997 0.139510 0.144288
3434 139, 541, 636,//1252 0.138283 0.139482 0.161146
3435 541, 4, 359,//1253 0.138283 0.138283 0.162173
3436 359, 94, 636,//1254 0.138283 0.161146 0.139482
3437 541, 359, 636,//1255 0.162173 0.139482 0.139482
3438 94, 356, 638,//1256 0.138283 0.157997 0.143103
3439 356, 26, 637,//1257 0.138283 0.156918 0.144288
3440 637, 161, 638,//1258 0.156918 0.143103 0.139510
3441 356, 637, 638,//1259 0.144288 0.139510 0.157997
3442 139, 636, 634,//1260 0.161146 0.144387 0.143103
3443 636, 94, 638,//1261 0.161146 0.143103 0.144387
3444 638, 161, 634,//1262 0.143103 0.143103 0.162284
3445 636, 638, 634,//1263 0.144387 0.162284 0.144387
3446 41, 630, 625,//1264 0.156918 0.164485 0.156918
3447 630, 160, 639,//1265 0.156918 0.163002 0.158459
3448 639, 159, 625,//1266 0.163002 0.156918 0.158459
3449 630, 639, 625,//1267 0.158459 0.158459 0.164485
3450 160, 632, 640,//1268 0.156918 0.158459 0.163002
3451 632, 37, 635,//1269 0.156918 0.156918 0.164485
3452 635, 161, 640,//1270 0.156918 0.163002 0.158459
3453 632, 635, 640,//1271 0.164485 0.158459 0.158459
3454 161, 637, 641,//1272 0.156918 0.158459 0.163002
3455 637, 26, 627,//1273 0.156918 0.156918 0.164485
3456 627, 159, 641,//1274 0.156918 0.163002 0.158459
3457 637, 627, 641,//1275 0.164485 0.158459 0.158459
3458 160, 640, 639,//1276 0.163002 0.164647 0.163002
3459 640, 161, 641,//1277 0.163002 0.163002 0.164647
3460 641, 159, 639,//1278 0.163002 0.163002 0.164647
3461 640, 641, 639 //1279 0.164647 0.164647 0.164647
3462 };
3463 static const GLfloat v[1926] = {
3464 -0.525731f, 0.850651f, 0.000000f,//0
3465 0.525731f, 0.850651f, 0.000000f,//1
3466 -0.525731f, -0.850651f, 0.000000f,//2
3467 0.525731f, -0.850651f, 0.000000f,//3
3468 0.000000f, -0.525731f, 0.850651f,//4
3469 0.000000f, 0.525731f, 0.850651f,//5
3470 0.000000f, -0.525731f, -0.850651f,//6
3471 0.000000f, 0.525731f, -0.850651f,//7
3472 0.850651f, 0.000000f, -0.525731f,//8
3473 0.850651f, 0.000000f, 0.525731f,//9
3474 -0.850651f, 0.000000f, -0.525731f,//10
3475 -0.850651f, 0.000000f, 0.525731f,//11
3476 0.000000f, 1.000000f, 0.000000f,//12
3477 -0.309017f, 0.809017f, 0.500000f,//13
3478 0.309017f, 0.809017f, 0.500000f,//14
3479 0.309017f, 0.809017f, -0.500000f,//15
3480 -0.309017f, 0.809017f, -0.500000f,//16
3481 -0.809017f, 0.500000f, -0.309017f,//17
3482 -0.500000f, 0.309017f, -0.809017f,//18
3483 -1.000000f, 0.000000f, 0.000000f,//19
3484 -0.809017f, 0.500000f, 0.309017f,//20
3485 -0.500000f, 0.309017f, 0.809017f,//21
3486 -0.500000f, -0.309017f, 0.809017f,//22
3487 0.000000f, 0.000000f, 1.000000f,//23
3488 -0.809017f, -0.500000f, 0.309017f,//24
3489 -0.809017f, -0.500000f, -0.309017f,//25
3490 -0.309017f, -0.809017f, 0.500000f,//26
3491 -0.500000f, -0.309017f, -0.809017f,//27
3492 -0.309017f, -0.809017f, -0.500000f,//28
3493 0.000000f, 0.000000f, -1.000000f,//29
3494 0.500000f, 0.309017f, -0.809017f,//30
3495 0.500000f, -0.309017f, -0.809017f,//31
3496 0.809017f, 0.500000f, -0.309017f,//32
3497 0.809017f, 0.500000f, 0.309017f,//33
3498 0.500000f, 0.309017f, 0.809017f,//34
3499 1.000000f, 0.000000f, 0.000000f,//35
3500 0.500000f, -0.309017f, 0.809017f,//36
3501 0.309017f, -0.809017f, 0.500000f,//37
3502 0.809017f, -0.500000f, 0.309017f,//38
3503 0.809017f, -0.500000f, -0.309017f,//39
3504 0.309017f, -0.809017f, -0.500000f,//40
3505 0.000000f, -1.000000f, 0.000000f,//41
3506 0.273267f, 0.961938f, 0.000000f,//42
3507 0.162460f, 0.951057f, 0.262866f,//43
3508 0.433889f, 0.862668f, 0.259892f,//44
3509 -0.273267f, 0.961938f, 0.000000f,//45
3510 -0.433889f, 0.862668f, 0.259892f,//46
3511 -0.162460f, 0.951057f, 0.262866f,//47
3512 -0.160622f, 0.693780f, 0.702046f,//48
3513 0.160622f, 0.693780f, 0.702046f,//49
3514 0.000000f, 0.850651f, 0.525731f,//50
3515 -0.162460f, 0.951057f, -0.262866f,//51
3516 -0.433889f, 0.862668f, -0.259892f,//52
3517 0.433889f, 0.862668f, -0.259892f,//53
3518 0.162460f, 0.951057f, -0.262866f,//54
3519 0.160622f, 0.693780f, -0.702046f,//55
3520 -0.160622f, 0.693780f, -0.702046f,//56
3521 0.000000f, 0.850651f, -0.525731f,//57
3522 -0.862668f, 0.259892f, -0.433889f,//58
3523 -0.688191f, 0.425325f, -0.587785f,//59
3524 -0.702046f, 0.160622f, -0.693780f,//60
3525 -0.693780f, 0.702046f, -0.160622f,//61
3526 -0.587785f, 0.688191f, -0.425325f,//62
3527 -0.259892f, 0.433889f, -0.862668f,//63
3528 -0.425325f, 0.587785f, -0.688191f,//64
3529 -0.850651f, 0.525731f, 0.000000f,//65
3530 -0.693780f, 0.702046f, 0.160622f,//66
3531 -0.961938f, 0.000000f, -0.273267f,//67
3532 -0.951057f, 0.262866f, -0.162460f,//68
3533 -0.961938f, 0.000000f, 0.273267f,//69
3534 -0.862668f, 0.259892f, 0.433889f,//70
3535 -0.951057f, 0.262866f, 0.162460f,//71
3536 -0.702046f, 0.160622f, 0.693780f,//72
3537 -0.688191f, 0.425325f, 0.587785f,//73
3538 -0.259892f, 0.433889f, 0.862668f,//74
3539 -0.425325f, 0.587785f, 0.688191f,//75
3540 -0.587785f, 0.688191f, 0.425325f,//76
3541 -0.262866f, 0.162460f, 0.951057f,//77
3542 0.000000f, 0.273267f, 0.961938f,//78
3543 -0.702046f, -0.160622f, 0.693780f,//79
3544 -0.525731f, 0.000000f, 0.850651f,//80
3545 -0.259892f, -0.433889f, 0.862668f,//81
3546 0.000000f, -0.273267f, 0.961938f,//82
3547 -0.262866f, -0.162460f, 0.951057f,//83
3548 -0.693780f, -0.702046f, 0.160622f,//84
3549 -0.850651f, -0.525731f, 0.000000f,//85
3550 -0.693780f, -0.702046f, -0.160622f,//86
3551 -0.862668f, -0.259892f, 0.433889f,//87
3552 -0.951057f, -0.262866f, 0.162460f,//88
3553 -0.862668f, -0.259892f, -0.433889f,//89
3554 -0.951057f, -0.262866f, -0.162460f,//90
3555 -0.688191f, -0.425325f, 0.587785f,//91
3556 -0.433889f, -0.862668f, 0.259892f,//92
3557 -0.587785f, -0.688191f, 0.425325f,//93
3558 -0.160622f, -0.693780f, 0.702046f,//94
3559 -0.425325f, -0.587785f, 0.688191f,//95
3560 -0.702046f, -0.160622f, -0.693780f,//96
3561 -0.688191f, -0.425325f, -0.587785f,//97
3562 -0.259892f, -0.433889f, -0.862668f,//98
3563 -0.160622f, -0.693780f, -0.702046f,//99
3564 -0.425325f, -0.587785f, -0.688191f,//100
3565 -0.433889f, -0.862668f, -0.259892f,//101
3566 -0.587785f, -0.688191f, -0.425325f,//102
3567 -0.262866f, -0.162460f, -0.951057f,//103
3568 0.000000f, -0.273267f, -0.961938f,//104
3569 -0.525731f, 0.000000f, -0.850651f,//105
3570 0.000000f, 0.273267f, -0.961938f,//106
3571 -0.262866f, 0.162460f, -0.951057f,//107
3572 0.259892f, 0.433889f, -0.862668f,//108
3573 0.262866f, 0.162460f, -0.951057f,//109
3574 0.702046f, 0.160622f, -0.693780f,//110
3575 0.702046f, -0.160622f, -0.693780f,//111
3576 0.525731f, 0.000000f, -0.850651f,//112
3577 0.259892f, -0.433889f, -0.862668f,//113
3578 0.262866f, -0.162460f, -0.951057f,//114
3579 0.688191f, 0.425325f, -0.587785f,//115
3580 0.862668f, 0.259892f, -0.433889f,//116
3581 0.425325f, 0.587785f, -0.688191f,//117
3582 0.693780f, 0.702046f, -0.160622f,//118
3583 0.587785f, 0.688191f, -0.425325f,//119
3584 0.862668f, 0.259892f, 0.433889f,//120
3585 0.688191f, 0.425325f, 0.587785f,//121
3586 0.702046f, 0.160622f, 0.693780f,//122
3587 0.693780f, 0.702046f, 0.160622f,//123
3588 0.587785f, 0.688191f, 0.425325f,//124
3589 0.259892f, 0.433889f, 0.862668f,//125
3590 0.425325f, 0.587785f, 0.688191f,//126
3591 0.850651f, 0.525731f, 0.000000f,//127
3592 0.961938f, 0.000000f, 0.273267f,//128
3593 0.951057f, 0.262866f, 0.162460f,//129
3594 0.961938f, 0.000000f, -0.273267f,//130
3595 0.951057f, 0.262866f, -0.162460f,//131
3596 0.259892f, -0.433889f, 0.862668f,//132
3597 0.262866f, -0.162460f, 0.951057f,//133
3598 0.702046f, -0.160622f, 0.693780f,//134
3599 0.525731f, 0.000000f, 0.850651f,//135
3600 0.262866f, 0.162460f, 0.951057f,//136
3601 0.688191f, -0.425325f, 0.587785f,//137
3602 0.862668f, -0.259892f, 0.433889f,//138
3603 0.160622f, -0.693780f, 0.702046f,//139
3604 0.425325f, -0.587785f, 0.688191f,//140
3605 0.433889f, -0.862668f, 0.259892f,//141
3606 0.693780f, -0.702046f, 0.160622f,//142
3607 0.587785f, -0.688191f, 0.425325f,//143
3608 0.693780f, -0.702046f, -0.160622f,//144
3609 0.850651f, -0.525731f, 0.000000f,//145
3610 0.862668f, -0.259892f, -0.433889f,//146
3611 0.951057f, -0.262866f, -0.162460f,//147
3612 0.951057f, -0.262866f, 0.162460f,//148
3613 0.688191f, -0.425325f, -0.587785f,//149
3614 0.433889f, -0.862668f, -0.259892f,//150
3615 0.587785f, -0.688191f, -0.425325f,//151
3616 0.160622f, -0.693780f, -0.702046f,//152
3617 0.425325f, -0.587785f, -0.688191f,//153
3618 0.273267f, -0.961938f, 0.000000f,//154
3619 0.162460f, -0.951057f, -0.262866f,//155
3620 -0.273267f, -0.961938f, 0.000000f,//156
3621 -0.162460f, -0.951057f, -0.262866f,//157
3622 0.000000f, -0.850651f, -0.525731f,//158
3623 -0.162460f, -0.951057f, 0.262866f,//159
3624 0.162460f, -0.951057f, 0.262866f,//160
3625 0.000000f, -0.850651f, 0.525731f,//161
3626 0.403355f, 0.915043f, 0.000000f,//162
3627 0.358229f, 0.924305f, 0.131655f,//163
3628 0.484442f, 0.864929f, 0.131200f,//164
3629 0.137952f, 0.990439f, 0.000000f,//165
3630 0.082242f, 0.987688f, 0.133071f,//166
3631 0.220117f, 0.966393f, 0.132792f,//167
3632 0.238677f, 0.891007f, 0.386187f,//168
3633 0.375039f, 0.843911f, 0.383614f,//169
3634 0.301259f, 0.916244f, 0.264083f,//170
3635 -0.137952f, 0.990439f, 0.000000f,//171
3636 -0.220117f, 0.966393f, 0.132792f,//172
3637 -0.082242f, 0.987688f, 0.133071f,//173
3638 -0.403355f, 0.915043f, 0.000000f,//174
3639 -0.484442f, 0.864929f, 0.131200f,//175
3640 -0.358229f, 0.924305f, 0.131655f,//176
3641 -0.375039f, 0.843911f, 0.383614f,//177
3642 -0.238677f, 0.891007f, 0.386187f,//178
3643 -0.301259f, 0.916244f, 0.264083f,//179
3644 -0.237086f, 0.758652f, 0.606825f,//180
3645 -0.081142f, 0.780204f, 0.620240f,//181
3646 -0.156434f, 0.840178f, 0.519258f,//182
3647 -0.081086f, 0.615642f, 0.783843f,//183
3648 0.081086f, 0.615642f, 0.783843f,//184
3649 0.000000f, 0.702907f, 0.711282f,//185
3650 0.237086f, 0.758652f, 0.606825f,//186
3651 0.156434f, 0.840178f, 0.519258f,//187
3652 0.081142f, 0.780204f, 0.620240f,//188
3653 0.000000f, 0.963861f, 0.266405f,//189
3654 -0.082324f, 0.912983f, 0.399607f,//190
3655 0.082324f, 0.912983f, 0.399607f,//191
3656 -0.358229f, 0.924305f, -0.131655f,//192
3657 -0.484442f, 0.864929f, -0.131200f,//193
3658 -0.082242f, 0.987688f, -0.133071f,//194
3659 -0.220117f, 0.966393f, -0.132792f,//195
3660 -0.238677f, 0.891007f, -0.386187f,//196
3661 -0.375039f, 0.843911f, -0.383614f,//197
3662 -0.301259f, 0.916244f, -0.264083f,//198
3663 0.220117f, 0.966393f, -0.132792f,//199
3664 0.082242f, 0.987688f, -0.133071f,//200
3665 0.484442f, 0.864929f, -0.131200f,//201
3666 0.358229f, 0.924305f, -0.131655f,//202
3667 0.375039f, 0.843911f, -0.383614f,//203
3668 0.238677f, 0.891007f, -0.386187f,//204
3669 0.301259f, 0.916244f, -0.264083f,//205
3670 0.237086f, 0.758652f, -0.606825f,//206
3671 0.081142f, 0.780204f, -0.620240f,//207
3672 0.156434f, 0.840178f, -0.519258f,//208
3673 0.081086f, 0.615642f, -0.783843f,//209
3674 -0.081086f, 0.615642f, -0.783843f,//210
3675 0.000000f, 0.702907f, -0.711282f,//211
3676 -0.237086f, 0.758652f, -0.606825f,//212
3677 -0.156434f, 0.840178f, -0.519258f,//213
3678 -0.081142f, 0.780204f, -0.620240f,//214
3679 0.000000f, 0.963861f, -0.266405f,//215
3680 0.082324f, 0.912983f, -0.399607f,//216
3681 -0.082324f, 0.912983f, -0.399607f,//217
3682 -0.864929f, 0.131200f, -0.484442f,//218
3683 -0.792649f, 0.213023f, -0.571252f,//219
3684 -0.783843f, 0.081086f, -0.615642f,//220
3685 -0.843911f, 0.383614f, -0.375039f,//221
3686 -0.757935f, 0.468430f, -0.453991f,//222
3687 -0.783452f, 0.346153f, -0.516122f,//223
3688 -0.601501f, 0.371748f, -0.707107f,//224
3689 -0.606825f, 0.237086f, -0.758652f,//225
3690 -0.702310f, 0.296005f, -0.647412f,//226
3691 -0.758652f, 0.606825f, -0.237086f,//227
3692 -0.647412f, 0.702310f, -0.296005f,//228
3693 -0.707107f, 0.601501f, -0.371748f,//229
3694 -0.615642f, 0.783843f, -0.081086f,//230
3695 -0.571252f, 0.792649f, -0.213023f,//231
3696 -0.453991f, 0.757935f, -0.468430f,//232
3697 -0.516122f, 0.783452f, -0.346153f,//233
3698 -0.296005f, 0.647412f, -0.702310f,//234
3699 -0.371748f, 0.707107f, -0.601501f,//235
3700 -0.131200f, 0.484442f, -0.864929f,//236
3701 -0.213023f, 0.571252f, -0.792649f,//237
3702 -0.383614f, 0.375039f, -0.843911f,//238
3703 -0.468430f, 0.453991f, -0.757935f,//239
3704 -0.346153f, 0.516122f, -0.783452f,//240
3705 -0.646578f, 0.564254f, -0.513375f,//241
3706 -0.513375f, 0.646578f, -0.564254f,//242
3707 -0.564254f, 0.513375f, -0.646578f,//243
3708 -0.702907f, 0.711282f, 0.000000f,//244
3709 -0.615642f, 0.783843f, 0.081086f,//245
3710 -0.840178f, 0.519258f, -0.156434f,//246
3711 -0.780204f, 0.620240f, -0.081142f,//247
3712 -0.840178f, 0.519258f, 0.156434f,//248
3713 -0.758652f, 0.606825f, 0.237086f,//249
3714 -0.780204f, 0.620240f, 0.081142f,//250
3715 -0.916244f, 0.264083f, -0.301259f,//251
3716 -0.891007f, 0.386187f, -0.238677f,//252
3717 -0.915043f, 0.000000f, -0.403355f,//253
3718 -0.924305f, 0.131655f, -0.358229f,//254
3719 -0.990439f, 0.000000f, -0.137952f,//255
3720 -0.987688f, 0.133071f, -0.082242f,//256
3721 -0.966393f, 0.132792f, -0.220117f,//257
3722 -0.990439f, 0.000000f, 0.137952f,//258
3723 -0.966393f, 0.132792f, 0.220117f,//259
3724 -0.987688f, 0.133071f, 0.082242f,//260
3725 -0.915043f, 0.000000f, 0.403355f,//261
3726 -0.864929f, 0.131200f, 0.484442f,//262
3727 -0.924305f, 0.131655f, 0.358229f,//263
3728 -0.843911f, 0.383614f, 0.375039f,//264
3729 -0.891007f, 0.386187f, 0.238677f,//265
3730 -0.916244f, 0.264083f, 0.301259f,//266
3731 -0.912983f, 0.399607f, -0.082324f,//267
3732 -0.963861f, 0.266405f, 0.000000f,//268
3733 -0.912983f, 0.399607f, 0.082324f,//269
3734 -0.783843f, 0.081086f, 0.615642f,//270
3735 -0.792649f, 0.213023f, 0.571252f,//271
3736 -0.606825f, 0.237086f, 0.758652f,//272
3737 -0.601501f, 0.371748f, 0.707107f,//273
3738 -0.702310f, 0.296005f, 0.647412f,//274
3739 -0.757935f, 0.468430f, 0.453991f,//275
3740 -0.783452f, 0.346153f, 0.516122f,//276
3741 -0.383614f, 0.375039f, 0.843911f,//277
3742 -0.346153f, 0.516122f, 0.783452f,//278
3743 -0.468430f, 0.453991f, 0.757935f,//279
3744 -0.131200f, 0.484442f, 0.864929f,//280
3745 -0.213023f, 0.571252f, 0.792649f,//281
3746 -0.371748f, 0.707107f, 0.601501f,//282
3747 -0.296005f, 0.647412f, 0.702310f,//283
3748 -0.516122f, 0.783452f, 0.346153f,//284
3749 -0.453991f, 0.757935f, 0.468430f,//285
3750 -0.571252f, 0.792649f, 0.213023f,//286
3751 -0.707107f, 0.601501f, 0.371748f,//287
3752 -0.647412f, 0.702310f, 0.296005f,//288
3753 -0.564254f, 0.513375f, 0.646578f,//289
3754 -0.513375f, 0.646578f, 0.564254f,//290
3755 -0.646578f, 0.564254f, 0.513375f,//291
3756 -0.131655f, 0.358229f, 0.924305f,//292
3757 0.000000f, 0.403355f, 0.915043f,//293
3758 -0.386187f, 0.238677f, 0.891007f,//294
3759 -0.264083f, 0.301259f, 0.916244f,//295
3760 -0.133071f, 0.082242f, 0.987688f,//296
3761 0.000000f, 0.137952f, 0.990439f,//297
3762 -0.132792f, 0.220117f, 0.966393f,//298
3763 -0.620240f, 0.081142f, 0.780204f,//299
3764 -0.519258f, 0.156434f, 0.840178f,//300
3765 -0.783843f, -0.081086f, 0.615642f,//301
3766 -0.711282f, 0.000000f, 0.702907f,//302
3767 -0.606825f, -0.237086f, 0.758652f,//303
3768 -0.519258f, -0.156434f, 0.840178f,//304
3769 -0.620240f, -0.081142f, 0.780204f,//305
3770 -0.383614f, -0.375039f, 0.843911f,//306
3771 -0.264083f, -0.301259f, 0.916244f,//307
3772 -0.386187f, -0.238677f, 0.891007f,//308
3773 -0.131200f, -0.484442f, 0.864929f,//309
3774 0.000000f, -0.403355f, 0.915043f,//310
3775 -0.131655f, -0.358229f, 0.924305f,//311
3776 0.000000f, -0.137952f, 0.990439f,//312
3777 -0.133071f, -0.082242f, 0.987688f,//313
3778 -0.132792f, -0.220117f, 0.966393f,//314
3779 -0.399607f, 0.082324f, 0.912983f,//315
3780 -0.399607f, -0.082324f, 0.912983f,//316
3781 -0.266405f, 0.000000f, 0.963861f,//317
3782 -0.615642f, -0.783843f, 0.081086f,//318
3783 -0.702907f, -0.711282f, 0.000000f,//319
3784 -0.615642f, -0.783843f, -0.081086f,//320
3785 -0.758652f, -0.606825f, 0.237086f,//321
3786 -0.840178f, -0.519258f, 0.156434f,//322
3787 -0.780204f, -0.620240f, 0.081142f,//323
3788 -0.840178f, -0.519258f, -0.156434f,//324
3789 -0.758652f, -0.606825f, -0.237086f,//325
3790 -0.780204f, -0.620240f, -0.081142f,//326
3791 -0.843911f, -0.383614f, 0.375039f,//327
3792 -0.916244f, -0.264083f, 0.301259f,//328
3793 -0.891007f, -0.386187f, 0.238677f,//329
3794 -0.864929f, -0.131200f, 0.484442f,//330
3795 -0.924305f, -0.131655f, 0.358229f,//331
3796 -0.987688f, -0.133071f, 0.082242f,//332
3797 -0.966393f, -0.132792f, 0.220117f,//333
3798 -0.966393f, -0.132792f, -0.220117f,//334
3799 -0.987688f, -0.133071f, -0.082242f,//335
3800 -0.864929f, -0.131200f, -0.484442f,//336
3801 -0.924305f, -0.131655f, -0.358229f,//337
3802 -0.843911f, -0.383614f, -0.375039f,//338
3803 -0.891007f, -0.386187f, -0.238677f,//339
3804 -0.916244f, -0.264083f, -0.301259f,//340
3805 -0.912983f, -0.399607f, 0.082324f,//341
3806 -0.963861f, -0.266405f, 0.000000f,//342
3807 -0.912983f, -0.399607f, -0.082324f,//343
3808 -0.792649f, -0.213023f, 0.571252f,//344
3809 -0.757935f, -0.468430f, 0.453991f,//345
3810 -0.783452f, -0.346153f, 0.516122f,//346
3811 -0.601501f, -0.371748f, 0.707107f,//347
3812 -0.702310f, -0.296005f, 0.647412f,//348
3813 -0.647412f, -0.702310f, 0.296005f,//349
3814 -0.707107f, -0.601501f, 0.371748f,//350
3815 -0.484442f, -0.864929f, 0.131200f,//351
3816 -0.571252f, -0.792649f, 0.213023f,//352
3817 -0.375039f, -0.843911f, 0.383614f,//353
3818 -0.453991f, -0.757935f, 0.468430f,//354
3819 -0.516122f, -0.783452f, 0.346153f,//355
3820 -0.237086f, -0.758652f, 0.606825f,//356
3821 -0.296005f, -0.647412f, 0.702310f,//357
3822 -0.371748f, -0.707107f, 0.601501f,//358
3823 -0.081086f, -0.615642f, 0.783843f,//359
3824 -0.213023f, -0.571252f, 0.792649f,//360
3825 -0.468430f, -0.453991f, 0.757935f,//361
3826 -0.346153f, -0.516122f, 0.783452f,//362
3827 -0.646578f, -0.564254f, 0.513375f,//363
3828 -0.513375f, -0.646578f, 0.564254f,//364
3829 -0.564254f, -0.513375f, 0.646578f,//365
3830 -0.783843f, -0.081086f, -0.615642f,//366
3831 -0.792649f, -0.213023f, -0.571252f,//367
3832 -0.606825f, -0.237086f, -0.758652f,//368
3833 -0.601501f, -0.371748f, -0.707107f,//369
3834 -0.702310f, -0.296005f, -0.647412f,//370
3835 -0.757935f, -0.468430f, -0.453991f,//371
3836 -0.783452f, -0.346153f, -0.516122f,//372
3837 -0.383614f, -0.375039f, -0.843911f,//373
3838 -0.346153f, -0.516122f, -0.783452f,//374
3839 -0.468430f, -0.453991f, -0.757935f,//375
3840 -0.131200f, -0.484442f, -0.864929f,//376
3841 -0.081086f, -0.615642f, -0.783843f,//377
3842 -0.213023f, -0.571252f, -0.792649f,//378
3843 -0.237086f, -0.758652f, -0.606825f,//379
3844 -0.371748f, -0.707107f, -0.601501f,//380
3845 -0.296005f, -0.647412f, -0.702310f,//381
3846 -0.375039f, -0.843911f, -0.383614f,//382
3847 -0.516122f, -0.783452f, -0.346153f,//383
3848 -0.453991f, -0.757935f, -0.468430f,//384
3849 -0.484442f, -0.864929f, -0.131200f,//385
3850 -0.571252f, -0.792649f, -0.213023f,//386
3851 -0.707107f, -0.601501f, -0.371748f,//387
3852 -0.647412f, -0.702310f, -0.296005f,//388
3853 -0.564254f, -0.513375f, -0.646578f,//389
3854 -0.513375f, -0.646578f, -0.564254f,//390
3855 -0.646578f, -0.564254f, -0.513375f,//391
3856 -0.131655f, -0.358229f, -0.924305f,//392
3857 0.000000f, -0.403355f, -0.915043f,//393
3858 -0.386187f, -0.238677f, -0.891007f,//394
3859 -0.264083f, -0.301259f, -0.916244f,//395
3860 -0.133071f, -0.082242f, -0.987688f,//396
3861 0.000000f, -0.137952f, -0.990439f,//397
3862 -0.132792f, -0.220117f, -0.966393f,//398
3863 -0.620240f, -0.081142f, -0.780204f,//399
3864 -0.519258f, -0.156434f, -0.840178f,//400
3865 -0.711282f, 0.000000f, -0.702907f,//401
3866 -0.519258f, 0.156434f, -0.840178f,//402
3867 -0.620240f, 0.081142f, -0.780204f,//403
3868 -0.264083f, 0.301259f, -0.916244f,//404
3869 -0.386187f, 0.238677f, -0.891007f,//405
3870 0.000000f, 0.403355f, -0.915043f,//406
3871 -0.131655f, 0.358229f, -0.924305f,//407
3872 0.000000f, 0.137952f, -0.990439f,//408
3873 -0.133071f, 0.082242f, -0.987688f,//409
3874 -0.132792f, 0.220117f, -0.966393f,//410
3875 -0.399607f, -0.082324f, -0.912983f,//411
3876 -0.399607f, 0.082324f, -0.912983f,//412
3877 -0.266405f, 0.000000f, -0.963861f,//413
3878 0.131200f, 0.484442f, -0.864929f,//414
3879 0.131655f, 0.358229f, -0.924305f,//415
3880 0.383614f, 0.375039f, -0.843911f,//416
3881 0.386187f, 0.238677f, -0.891007f,//417
3882 0.264083f, 0.301259f, -0.916244f,//418
3883 0.133071f, 0.082242f, -0.987688f,//419
3884 0.132792f, 0.220117f, -0.966393f,//420
3885 0.606825f, 0.237086f, -0.758652f,//421
3886 0.620240f, 0.081142f, -0.780204f,//422
3887 0.519258f, 0.156434f, -0.840178f,//423
3888 0.783843f, 0.081086f, -0.615642f,//424
3889 0.783843f, -0.081086f, -0.615642f,//425
3890 0.711282f, 0.000000f, -0.702907f,//426
3891 0.606825f, -0.237086f, -0.758652f,//427
3892 0.519258f, -0.156434f, -0.840178f,//428
3893 0.620240f, -0.081142f, -0.780204f,//429
3894 0.383614f, -0.375039f, -0.843911f,//430
3895 0.264083f, -0.301259f, -0.916244f,//431
3896 0.386187f, -0.238677f, -0.891007f,//432
3897 0.131200f, -0.484442f, -0.864929f,//433
3898 0.131655f, -0.358229f, -0.924305f,//434
3899 0.133071f, -0.082242f, -0.987688f,//435
3900 0.132792f, -0.220117f, -0.966393f,//436
3901 0.399607f, 0.082324f, -0.912983f,//437
3902 0.399607f, -0.082324f, -0.912983f,//438
3903 0.266405f, 0.000000f, -0.963861f,//439
3904 0.792649f, 0.213023f, -0.571252f,//440
3905 0.864929f, 0.131200f, -0.484442f,//441
3906 0.601501f, 0.371748f, -0.707107f,//442
3907 0.702310f, 0.296005f, -0.647412f,//443
3908 0.757935f, 0.468430f, -0.453991f,//444
3909 0.843911f, 0.383614f, -0.375039f,//445
3910 0.783452f, 0.346153f, -0.516122f,//446
3911 0.346153f, 0.516122f, -0.783452f,//447
3912 0.468430f, 0.453991f, -0.757935f,//448
3913 0.213023f, 0.571252f, -0.792649f,//449
3914 0.371748f, 0.707107f, -0.601501f,//450
3915 0.296005f, 0.647412f, -0.702310f,//451
3916 0.516122f, 0.783452f, -0.346153f,//452
3917 0.453991f, 0.757935f, -0.468430f,//453
3918 0.615642f, 0.783843f, -0.081086f,//454
3919 0.571252f, 0.792649f, -0.213023f,//455
3920 0.758652f, 0.606825f, -0.237086f,//456
3921 0.707107f, 0.601501f, -0.371748f,//457
3922 0.647412f, 0.702310f, -0.296005f,//458
3923 0.564254f, 0.513375f, -0.646578f,//459
3924 0.513375f, 0.646578f, -0.564254f,//460
3925 0.646578f, 0.564254f, -0.513375f,//461
3926 0.864929f, 0.131200f, 0.484442f,//462
3927 0.792649f, 0.213023f, 0.571252f,//463
3928 0.783843f, 0.081086f, 0.615642f,//464
3929 0.843911f, 0.383614f, 0.375039f,//465
3930 0.757935f, 0.468430f, 0.453991f,//466
3931 0.783452f, 0.346153f, 0.516122f,//467
3932 0.601501f, 0.371748f, 0.707107f,//468
3933 0.606825f, 0.237086f, 0.758652f,//469
3934 0.702310f, 0.296005f, 0.647412f,//470
3935 0.758652f, 0.606825f, 0.237086f,//471
3936 0.647412f, 0.702310f, 0.296005f,//472
3937 0.707107f, 0.601501f, 0.371748f,//473
3938 0.615642f, 0.783843f, 0.081086f,//474
3939 0.571252f, 0.792649f, 0.213023f,//475
3940 0.453991f, 0.757935f, 0.468430f,//476
3941 0.516122f, 0.783452f, 0.346153f,//477
3942 0.296005f, 0.647412f, 0.702310f,//478
3943 0.371748f, 0.707107f, 0.601501f,//479
3944 0.131200f, 0.484442f, 0.864929f,//480
3945 0.213023f, 0.571252f, 0.792649f,//481
3946 0.383614f, 0.375039f, 0.843911f,//482
3947 0.468430f, 0.453991f, 0.757935f,//483
3948 0.346153f, 0.516122f, 0.783452f,//484
3949 0.646578f, 0.564254f, 0.513375f,//485
3950 0.513375f, 0.646578f, 0.564254f,//486
3951 0.564254f, 0.513375f, 0.646578f,//487
3952 0.702907f, 0.711282f, 0.000000f,//488
3953 0.840178f, 0.519258f, 0.156434f,//489
3954 0.780204f, 0.620240f, 0.081142f,//490
3955 0.840178f, 0.519258f, -0.156434f,//491
3956 0.780204f, 0.620240f, -0.081142f,//492
3957 0.916244f, 0.264083f, 0.301259f,//493
3958 0.891007f, 0.386187f, 0.238677f,//494
3959 0.915043f, 0.000000f, 0.403355f,//495
3960 0.924305f, 0.131655f, 0.358229f,//496
3961 0.990439f, 0.000000f, 0.137952f,//497
3962 0.987688f, 0.133071f, 0.082242f,//498
3963 0.966393f, 0.132792f, 0.220117f,//499
3964 0.990439f, 0.000000f, -0.137952f,//500
3965 0.966393f, 0.132792f, -0.220117f,//501
3966 0.987688f, 0.133071f, -0.082242f,//502
3967 0.915043f, 0.000000f, -0.403355f,//503
3968 0.924305f, 0.131655f, -0.358229f,//504
3969 0.891007f, 0.386187f, -0.238677f,//505
3970 0.916244f, 0.264083f, -0.301259f,//506
3971 0.912983f, 0.399607f, 0.082324f,//507
3972 0.963861f, 0.266405f, 0.000000f,//508
3973 0.912983f, 0.399607f, -0.082324f,//509
3974 0.131200f, -0.484442f, 0.864929f,//510
3975 0.131655f, -0.358229f, 0.924305f,//511
3976 0.383614f, -0.375039f, 0.843911f,//512
3977 0.386187f, -0.238677f, 0.891007f,//513
3978 0.264083f, -0.301259f, 0.916244f,//514
3979 0.133071f, -0.082242f, 0.987688f,//515
3980 0.132792f, -0.220117f, 0.966393f,//516
3981 0.606825f, -0.237086f, 0.758652f,//517
3982 0.620240f, -0.081142f, 0.780204f,//518
3983 0.519258f, -0.156434f, 0.840178f,//519
3984 0.783843f, -0.081086f, 0.615642f,//520
3985 0.711282f, 0.000000f, 0.702907f,//521
3986 0.519258f, 0.156434f, 0.840178f,//522
3987 0.620240f, 0.081142f, 0.780204f,//523
3988 0.264083f, 0.301259f, 0.916244f,//524
3989 0.386187f, 0.238677f, 0.891007f,//525
3990 0.131655f, 0.358229f, 0.924305f,//526
3991 0.133071f, 0.082242f, 0.987688f,//527
3992 0.132792f, 0.220117f, 0.966393f,//528
3993 0.399607f, -0.082324f, 0.912983f,//529
3994 0.399607f, 0.082324f, 0.912983f,//530
3995 0.266405f, 0.000000f, 0.963861f,//531
3996 0.792649f, -0.213023f, 0.571252f,//532
3997 0.864929f, -0.131200f, 0.484442f,//533
3998 0.601501f, -0.371748f, 0.707107f,//534
3999 0.702310f, -0.296005f, 0.647412f,//535
4000 0.757935f, -0.468430f, 0.453991f,//536
4001 0.843911f, -0.383614f, 0.375039f,//537
4002 0.783452f, -0.346153f, 0.516122f,//538
4003 0.346153f, -0.516122f, 0.783452f,//539
4004 0.468430f, -0.453991f, 0.757935f,//540
4005 0.081086f, -0.615642f, 0.783843f,//541
4006 0.213023f, -0.571252f, 0.792649f,//542
4007 0.237086f, -0.758652f, 0.606825f,//543
4008 0.371748f, -0.707107f, 0.601501f,//544
4009 0.296005f, -0.647412f, 0.702310f,//545
4010 0.375039f, -0.843911f, 0.383614f,//546
4011 0.516122f, -0.783452f, 0.346153f,//547
4012 0.453991f, -0.757935f, 0.468430f,//548
4013 0.484442f, -0.864929f, 0.131200f,//549
4014 0.615642f, -0.783843f, 0.081086f,//550
4015 0.571252f, -0.792649f, 0.213023f,//551
4016 0.758652f, -0.606825f, 0.237086f,//552
4017 0.707107f, -0.601501f, 0.371748f,//553
4018 0.647412f, -0.702310f, 0.296005f,//554
4019 0.564254f, -0.513375f, 0.646578f,//555
4020 0.513375f, -0.646578f, 0.564254f,//556
4021 0.646578f, -0.564254f, 0.513375f,//557
4022 0.615642f, -0.783843f, -0.081086f,//558
4023 0.702907f, -0.711282f, 0.000000f,//559
4024 0.758652f, -0.606825f, -0.237086f,//560
4025 0.840178f, -0.519258f, -0.156434f,//561
4026 0.780204f, -0.620240f, -0.081142f,//562
4027 0.840178f, -0.519258f, 0.156434f,//563
4028 0.780204f, -0.620240f, 0.081142f,//564
4029 0.843911f, -0.383614f, -0.375039f,//565
4030 0.916244f, -0.264083f, -0.301259f,//566
4031 0.891007f, -0.386187f, -0.238677f,//567
4032 0.864929f, -0.131200f, -0.484442f,//568
4033 0.924305f, -0.131655f, -0.358229f,//569
4034 0.987688f, -0.133071f, -0.082242f,//570
4035 0.966393f, -0.132792f, -0.220117f,//571
4036 0.966393f, -0.132792f, 0.220117f,//572
4037 0.987688f, -0.133071f, 0.082242f,//573
4038 0.924305f, -0.131655f, 0.358229f,//574
4039 0.891007f, -0.386187f, 0.238677f,//575
4040 0.916244f, -0.264083f, 0.301259f,//576
4041 0.912983f, -0.399607f, -0.082324f,//577
4042 0.963861f, -0.266405f, 0.000000f,//578
4043 0.912983f, -0.399607f, 0.082324f,//579
4044 0.792649f, -0.213023f, -0.571252f,//580
4045 0.757935f, -0.468430f, -0.453991f,//581
4046 0.783452f, -0.346153f, -0.516122f,//582
4047 0.601501f, -0.371748f, -0.707107f,//583
4048 0.702310f, -0.296005f, -0.647412f,//584
4049 0.647412f, -0.702310f, -0.296005f,//585
4050 0.707107f, -0.601501f, -0.371748f,//586
4051 0.484442f, -0.864929f, -0.131200f,//587
4052 0.571252f, -0.792649f, -0.213023f,//588
4053 0.375039f, -0.843911f, -0.383614f,//589
4054 0.453991f, -0.757935f, -0.468430f,//590
4055 0.516122f, -0.783452f, -0.346153f,//591
4056 0.237086f, -0.758652f, -0.606825f,//592
4057 0.296005f, -0.647412f, -0.702310f,//593
4058 0.371748f, -0.707107f, -0.601501f,//594
4059 0.081086f, -0.615642f, -0.783843f,//595
4060 0.213023f, -0.571252f, -0.792649f,//596
4061 0.468430f, -0.453991f, -0.757935f,//597
4062 0.346153f, -0.516122f, -0.783452f,//598
4063 0.646578f, -0.564254f, -0.513375f,//599
4064 0.513375f, -0.646578f, -0.564254f,//600
4065 0.564254f, -0.513375f, -0.646578f,//601
4066 0.403355f, -0.915043f, 0.000000f,//602
4067 0.358229f, -0.924305f, -0.131655f,//603
4068 0.137952f, -0.990439f, 0.000000f,//604
4069 0.082242f, -0.987688f, -0.133071f,//605
4070 0.220117f, -0.966393f, -0.132792f,//606
4071 0.238677f, -0.891007f, -0.386187f,//607
4072 0.301259f, -0.916244f, -0.264083f,//608
4073 -0.137952f, -0.990439f, 0.000000f,//609
4074 -0.220117f, -0.966393f, -0.132792f,//610
4075 -0.082242f, -0.987688f, -0.133071f,//611
4076 -0.403355f, -0.915043f, 0.000000f,//612
4077 -0.358229f, -0.924305f, -0.131655f,//613
4078 -0.238677f, -0.891007f, -0.386187f,//614
4079 -0.301259f, -0.916244f, -0.264083f,//615
4080 -0.081142f, -0.780204f, -0.620240f,//616
4081 -0.156434f, -0.840178f, -0.519258f,//617
4082 0.000000f, -0.702907f, -0.711282f,//618
4083 0.156434f, -0.840178f, -0.519258f,//619
4084 0.081142f, -0.780204f, -0.620240f,//620
4085 0.000000f, -0.963861f, -0.266405f,//621
4086 -0.082324f, -0.912983f, -0.399607f,//622
4087 0.082324f, -0.912983f, -0.399607f,//623
4088 -0.358229f, -0.924305f, 0.131655f,//624
4089 -0.082242f, -0.987688f, 0.133071f,//625
4090 -0.220117f, -0.966393f, 0.132792f,//626
4091 -0.238677f, -0.891007f, 0.386187f,//627
4092 -0.301259f, -0.916244f, 0.264083f,//628
4093 0.220117f, -0.966393f, 0.132792f,//629
4094 0.082242f, -0.987688f, 0.133071f,//630
4095 0.358229f, -0.924305f, 0.131655f,//631
4096 0.238677f, -0.891007f, 0.386187f,//632
4097 0.301259f, -0.916244f, 0.264083f,//633
4098 0.081142f, -0.780204f, 0.620240f,//634
4099 0.156434f, -0.840178f, 0.519258f,//635
4100 0.000000f, -0.702907f, 0.711282f,//636
4101 -0.156434f, -0.840178f, 0.519258f,//637
4102 -0.081142f, -0.780204f, 0.620240f,//638
4103 0.000000f, -0.963861f, 0.266405f,//639
4104 0.082324f, -0.912983f, 0.399607f,//640
4105 -0.082324f, -0.912983f, 0.399607f //641
4106 };
4107 glEnableClientState(GL_VERTEX_ARRAY);
4108 glVertexPointer(3, GL_FLOAT, 0, v);
4109 glEnableClientState(GL_NORMAL_ARRAY);
4110 glNormalPointer(GL_FLOAT, 0, v);
4111 switch (bal){
4112 case 1:glDrawElements(GL_TRIANGLES, 240, GL_UNSIGNED_INT,idx1);break;
4113 case 2:glDrawElements(GL_TRIANGLES, 960, GL_UNSIGNED_INT,idx2);break;
4114 case 3:glDrawElements(GL_TRIANGLES, 3840, GL_UNSIGNED_INT,idx3);break;
4115 }
4116 glDisableClientState(GL_VERTEX_ARRAY);
4117 glDisableClientState(GL_NORMAL_ARRAY);
4118 }
4119
sphere(int adp,int style)4120 void Molecule::sphere(int adp,int style){
4121 if (useShaders&&program_in_use&&(g_Program!=nullptr)){
4122 //printf("%d style %d adp %d %d %d %d %d %d\n",style,adp,lichtH,wallH,ballH,ringH,adpsH,lodH);
4123 g_Program->setUniformValue(lichtH, 1);
4124 g_Program->setUniformValue(wallH, 0);
4125 g_Program->setUniformValue(ballH, ((ATOM_STYLE_SPHERE&style))?1:0);
4126 g_Program->setUniformValue(ringH, ((ATOM_STYLE_RINGS&style))?1:0);
4127 g_Program->setUniformValue(openH, ((ATOM_STYLE_SOLID&style))?0:1);
4128 g_Program->setUniformValue(adpsH, ((ATOM_STYLE_NOADP&style))?0:1);
4129 g_Program->setUniformValue(whiteringH, (ATOM_STYLE_WHITERING&style)?1:0);
4130 g_Program->setUniformValue(fogH, mist?1:0);
4131 g_Program->setUniformValue(fograngeH, fogrange);
4132 g_Program->setUniformValue(lodH, qMin(LOD-1,3));
4133 /* int total = -1,program_id=g_program;
4134 glGetProgramiv( program_id, GL_ACTIVE_UNIFORMS, &total );
4135 for(int i=0; i<total; ++i) {
4136 int name_len=-1, num=-1;
4137 GLenum type = GL_ZERO;
4138 char name[100];
4139 glGetActiveUniform( program_id, GLuint(i), sizeof(name)-1,
4140 &name_len, &num, &type, name );
4141 const char *ts;
4142 switch (type){
4143 case GL_FLOAT: ts="float";break;
4144 case GL_FLOAT_VEC2: ts="vec2";break;
4145 case GL_FLOAT_VEC3: ts="vec3";break;
4146 case GL_FLOAT_VEC4: ts="vec4";break;
4147 case GL_DOUBLE: ts="double";break;
4148 case GL_INT: ts="int";break;
4149 case GL_INT_VEC2: ts="ivec2";break;
4150 case GL_INT_VEC3: ts="ivec3";break;
4151 case GL_INT_VEC4: ts="ivec4";break;
4152 case GL_UNSIGNED_INT: ts="unsigned int";break;
4153 case GL_BOOL: ts="bool";break;
4154 case GL_BOOL_VEC2: ts="bvec2";break;
4155 case GL_BOOL_VEC3: ts="bvec3";break;
4156 case GL_BOOL_VEC4: ts="bvec4";break;
4157 case GL_FLOAT_MAT2: ts="mat2";break;
4158 case GL_FLOAT_MAT3: ts="mat3";break;
4159 case GL_FLOAT_MAT4: ts="mat4";break;
4160 }
4161 name[name_len] = 0;
4162 int location = glGetUniformLocation( program_id, name );
4163 int val=-1;
4164 if ((location>=0)&&((type==GL_INT)||(type==GL_BOOL))){glGetUniformiv(program_id,location,&val); }
4165 if (location>=0)printf("%2d/%2d %-42s=%d size%d %s loc%d\n",i,total,name,val,num,ts,location);
4166 if ((0==strcmp(name,"lighting"))&&val==0) return;
4167 }*/
4168 }
4169 if (adp) glEnable(GL_BLEND);
4170 if (dratom){
4171 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
4172 glEnable(GL_BLEND);
4173 glDisable(GL_DEPTH_TEST);
4174 if (dratom==3)glColor3d(0.4,0.8,1.0);
4175 if (dratom<3) glColor3d(1.0,1.0,0.0);
4176 if (dratom==3)triacontaeder(0.106f);//gluSphere(q,0.33,7,7);
4177 else if (dratom==5) {
4178 triacontaeder(0.618f);//gluSphere(q,1.00,7,7);
4179 //gluSphere(q,1.0,4*LOD,9*LOD);
4180 }else if (dratom==76){
4181 triacontaeder(1.0f);
4182 }
4183 else triacontaeder(0.09f);//gluSphere(q,0.3,5,5);
4184 glEnable(GL_DEPTH_TEST);
4185 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
4186 }
4187 else{
4188 //gluSphere(q,1.0,4*LOD,9*LOD);
4189 mySphere(qMin(LOD-1,3));
4190 glDisable(GL_BLEND);
4191 }
4192 }
4193
ellipse(int style)4194 void Molecule::ellipse(int style){
4195 glDisable(GL_BLEND);
4196 if (style&ATOM_STYLE_WALLS){
4197 glEnable(GL_ALPHA_TEST);
4198 glDisable(GL_CULL_FACE);
4199 if (style&ATOM_STYLE_PLAID) glBindTexture(GL_TEXTURE_2D, adpwall_plaid);
4200 else glBindTexture(GL_TEXTURE_2D, adpwall);
4201 glEnable(GL_TEXTURE_2D);
4202 glBegin(GL_QUADS);
4203 glNormal3f(-1.0,0,0);
4204
4205 glTexCoord2d(0,0);
4206 glVertex3f(0.0,-1.0,-1.0);
4207 glTexCoord2d(0,1);
4208 glVertex3f(0.0,-1.0, 1.0);
4209 glTexCoord2d(1,1);
4210 glVertex3f(0.0, 1.0, 1.0);
4211 glTexCoord2d(1,0);
4212 glVertex3f(0.0, 1.0,-1.0);
4213
4214 glNormal3f(0.0,-1,0);
4215 glTexCoord2d(0,0);
4216 glVertex3f(-1.0,0.0,-1.0);
4217 glTexCoord2d(0,1);
4218 glVertex3f(-1.0,0.0, 1.0);
4219 glTexCoord2d(1,1);
4220 glVertex3f( 1.0,0.0, 1.0);
4221 glTexCoord2d(1,0);
4222 glVertex3f( 1.0,0.0,-1.0);
4223
4224 glNormal3f(0.0,0,-1);
4225 glTexCoord2d(0,0);
4226 glVertex3f(-1.0,-1.0,0.0);
4227 glTexCoord2d(0,1);
4228 glVertex3f(-1.0, 1.0,0.0);
4229 glTexCoord2d(1,1);
4230 glVertex3f( 1.0, 1.0,0.0);
4231 glTexCoord2d(1,0);
4232 glVertex3f( 1.0,-1.0,0.0);
4233 glEnd();
4234 glDisable(GL_TEXTURE_2D);
4235 }
4236 // glEnable(GL_CULL_FACE);
4237 if ((style&ATOM_STYLE_SOLID)&& ( style&ATOM_STYLE_SPHERE)){
4238 //gluSphere(q,0.96,4*LOD,9*LOD);
4239 mySphere(qMin(LOD-1,3));
4240 }
4241 if (style&ATOM_STYLE_RINGS){
4242 glPushMatrix();
4243 if (style&ATOM_STYLE_WHITERING) glColor3f(1,1,1);
4244 else glColor3f(0,0,0);
4245 glDisable(GL_LIGHTING);
4246 glDisable(GL_CULL_FACE);
4247 glPushMatrix();
4248 cylinder( 1.1, 0.15 );
4249 glPopMatrix();
4250
4251 glPushMatrix();
4252 glRotated(90.0,1.0,0.0,0.0);
4253 cylinder( 1.1, 0.15 );
4254 glPopMatrix();
4255
4256 glPushMatrix();
4257 glRotated(90.0,0.0,1.0,0.0);
4258 cylinder( 1.1, 0.15 );
4259 glPopMatrix();
4260
4261 glPopMatrix();
4262 glEnable(GL_LIGHTING);
4263 }
4264 }
4265
dodecaeder(GLfloat r)4266 void Molecule::dodecaeder(GLfloat r){
4267 if (program_in_use&&(g_Program!=nullptr)){
4268 g_Program->setUniformValue(lichtH, 1);
4269 g_Program->setUniformValue(wallH, 0);
4270 g_Program->setUniformValue(ringH, 0);
4271 g_Program->setUniformValue(openH, 0);
4272 g_Program->setUniformValue(adpsH, 0);
4273 }
4274 static const GLfloat dodev[324]={
4275 0.000000f, -0.618034f, 1.618034f, 1.000000f, -1.000000f, 1.000000f, 1.618034f, 0.000000f, 0.618034f,
4276 0.000000f, -0.618034f, 1.618034f, 1.618034f, 0.000000f, 0.618034f, 1.000000f, 1.000000f, 1.000000f,
4277 0.000000f, -0.618034f, 1.618034f, 1.000000f, 1.000000f, 1.000000f, 0.000000f, 0.618034f, 1.618034f,
4278 0.000000f, 0.618034f, 1.618034f, -1.000000f, 1.000000f, 1.000000f, -1.618034f, 0.000000f, 0.618034f,
4279 0.000000f, 0.618034f, 1.618034f, -1.618034f, 0.000000f, 0.618034f, -1.000000f, -1.000000f, 1.000000f,
4280 0.000000f, 0.618034f, 1.618034f, -1.000000f, -1.000000f, 1.000000f, 0.000000f, -0.618034f, 1.618034f,
4281 0.000000f, 0.618034f, 1.618034f, 1.000000f, 1.000000f, 1.000000f, 0.618034f, 1.618034f, 0.000000f,
4282 0.000000f, 0.618034f, 1.618034f, 0.618034f, 1.618034f, 0.000000f, -0.618034f, 1.618034f, 0.000000f,
4283 0.000000f, 0.618034f, 1.618034f, -0.618034f, 1.618034f, 0.000000f, -1.000000f, 1.000000f, 1.000000f,
4284 1.000000f, 1.000000f, 1.000000f, 1.618034f, 0.000000f, 0.618034f, 1.618034f, 0.000000f, -0.618034f,
4285 1.000000f, 1.000000f, 1.000000f, 1.618034f, 0.000000f, -0.618034f, 1.000000f, 1.000000f, -1.000000f,
4286 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, -1.000000f, 0.618034f, 1.618034f, 0.000000f,
4287 0.000000f, -0.618034f, 1.618034f, -1.000000f, -1.000000f, 1.000000f, -0.618034f, -1.618034f, 0.000000f,
4288 0.000000f, -0.618034f, 1.618034f, -0.618034f, -1.618034f, 0.000000f, 0.618034f, -1.618034f, 0.000000f,
4289 0.000000f, -0.618034f, 1.618034f, 0.618034f, -1.618034f, 0.000000f, 1.000000f, -1.000000f, 1.000000f,
4290 -1.000000f, 1.000000f, 1.000000f, -0.618034f, 1.618034f, 0.000000f, -1.000000f, 1.000000f, -1.000000f,
4291 -1.000000f, 1.000000f, 1.000000f, -1.000000f, 1.000000f, -1.000000f, -1.618034f, 0.000000f, -0.618034f,
4292 -1.000000f, 1.000000f, 1.000000f, -1.618034f, 0.000000f, -0.618034f, -1.618034f, 0.000000f, 0.618034f,
4293 -1.000000f, -1.000000f, 1.000000f, -1.618034f, 0.000000f, 0.618034f, -1.618034f, 0.000000f, -0.618034f,
4294 -1.000000f, -1.000000f, 1.000000f, -1.618034f, 0.000000f, -0.618034f, -1.000000f, -1.000000f, -1.000000f,
4295 -1.000000f, -1.000000f, 1.000000f, -1.000000f, -1.000000f, -1.000000f, -0.618034f, -1.618034f, 0.000000f,
4296 1.618034f, 0.000000f, 0.618034f, 1.000000f, -1.000000f, 1.000000f, 0.618034f, -1.618034f, 0.000000f,
4297 1.618034f, 0.000000f, 0.618034f, 0.618034f, -1.618034f, 0.000000f, 1.000000f, -1.000000f, -1.000000f,
4298 1.618034f, 0.000000f, 0.618034f, 1.000000f, -1.000000f, -1.000000f, 1.618034f, 0.000000f, -0.618034f,
4299 -0.618034f, 1.618034f, 0.000000f, 0.618034f, 1.618034f, 0.000000f, 1.000000f, 1.000000f, -1.000000f,
4300 -0.618034f, 1.618034f, 0.000000f, 1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.618034f, -1.618034f,
4301 -0.618034f, 1.618034f, 0.000000f, 0.000000f, 0.618034f, -1.618034f, -1.000000f, 1.000000f, -1.000000f,
4302 0.000000f, 0.618034f, -1.618034f, 1.000000f, 1.000000f, -1.000000f, 1.618034f, 0.000000f, -0.618034f,
4303 0.000000f, 0.618034f, -1.618034f, 1.618034f, 0.000000f, -0.618034f, 1.000000f, -1.000000f, -1.000000f,
4304 0.000000f, 0.618034f, -1.618034f, 1.000000f, -1.000000f, -1.000000f, 0.000000f, -0.618034f, -1.618034f,
4305 -1.618034f, 0.000000f, -0.618034f, -1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.618034f, -1.618034f,
4306 -1.618034f, 0.000000f, -0.618034f, 0.000000f, 0.618034f, -1.618034f, 0.000000f, -0.618034f, -1.618034f,
4307 -1.618034f, 0.000000f, -0.618034f, 0.000000f, -0.618034f, -1.618034f, -1.000000f, -1.000000f, -1.000000f,
4308 0.000000f, -0.618034f, -1.618034f, 1.000000f, -1.000000f, -1.000000f, 0.618034f, -1.618034f, 0.000000f,
4309 0.000000f, -0.618034f, -1.618034f, 0.618034f, -1.618034f, 0.000000f, -0.618034f, -1.618034f, 0.000000f,
4310 0.000000f, -0.618034f, -1.618034f, -0.618034f, -1.618034f, 0.000000f, -1.000000f, -1.000000f, -1.000000f};
4311 static const GLfloat doden[324]={
4312 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f,
4313 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f,
4314 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f,
4315 -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f,
4316 -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f,
4317 -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f,
4318 0.000000f, 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f,
4319 0.000000f, 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f,
4320 -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f,
4321 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f, 0.000000f, 0.850651f, 0.525731f, 0.000000f,
4322 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f,
4323 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f, 0.850651f, 0.525731f, -0.000000f,
4324 -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f,
4325 -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f,
4326 -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f,
4327 -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f,
4328 -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f,
4329 -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f,
4330 -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f,
4331 -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f,
4332 -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, 0.000000f, -0.850651f, -0.525731f, 0.000000f,
4333 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, 0.000000f, 0.850651f, -0.525731f, 0.000000f,
4334 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f,
4335 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f,
4336 -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f,
4337 0.000000f, 0.850651f, -0.525731f, 0.000000f, 0.850651f, -0.525731f, 0.000000f, 0.850651f, -0.525731f,
4338 -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f, -0.000000f, 0.850651f, -0.525731f,
4339 0.525731f, 0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, 0.000000f, -0.850651f,
4340 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f,
4341 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f, 0.525731f, -0.000000f, -0.850651f,
4342 -0.525731f, 0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, 0.000000f, -0.850651f,
4343 -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f,
4344 -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f,
4345 0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, 0.000000f, -0.850651f, -0.525731f,
4346 -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f,
4347 -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f, -0.000000f, -0.850651f, -0.525731f};
4348 glPushMatrix();
4349 glScalef(r,r,r);
4350 glEnableClientState(GL_VERTEX_ARRAY);
4351 glVertexPointer(3, GL_FLOAT, 0, dodev);
4352 glEnableClientState(GL_NORMAL_ARRAY);
4353 glNormalPointer(GL_FLOAT, 0, doden);
4354 glDrawArrays(GL_TRIANGLES, 0, 108);
4355 glDisableClientState(GL_VERTEX_ARRAY);
4356 glDisableClientState(GL_NORMAL_ARRAY);
4357 glPopMatrix();
4358 }
4359
icosaeder(GLfloat r)4360 void Molecule::icosaeder(GLfloat r){
4361 if (program_in_use&&(g_Program!=nullptr)){
4362 g_Program->setUniformValue(lichtH, 1);
4363 g_Program->setUniformValue(wallH, 0);
4364 g_Program->setUniformValue(ringH, 0);
4365 g_Program->setUniformValue(openH, 0);
4366 g_Program->setUniformValue(adpsH, 0);
4367 }
4368 static const GLfloat icov[180]={
4369 1.000000f, 0.000000f, 1.618034f, 0.000000f, 1.618034f, 1.000000f, -1.000000f, 0.000000f, 1.618034f,
4370 0.000000f, -1.618034f, 1.000000f, 1.000000f, 0.000000f, 1.618034f, -1.000000f, 0.000000f, 1.618034f,
4371 1.000000f, 0.000000f, 1.618034f, 1.618034f, 1.000000f, 0.000000f, 0.000000f, 1.618034f, 1.000000f,
4372 1.000000f, 0.000000f, 1.618034f, 0.000000f, -1.618034f, 1.000000f, 1.618034f, -1.000000f, 0.000000f,
4373 1.000000f, 0.000000f, 1.618034f, 1.618034f, -1.000000f, 0.000000f, 1.618034f, 1.000000f, 0.000000f,
4374 -1.000000f, 0.000000f, 1.618034f, 0.000000f, 1.618034f, 1.000000f, -1.618034f, 1.000000f, 0.000000f,
4375 -1.000000f, 0.000000f, 1.618034f, -1.618034f, -1.000000f, 0.000000f, 0.000000f, -1.618034f, 1.000000f,
4376 -1.000000f, 0.000000f, 1.618034f, -1.618034f, 1.000000f, 0.000000f, -1.618034f, -1.000000f, 0.000000f,
4377 0.000000f, 1.618034f, 1.000000f, 1.618034f, 1.000000f, 0.000000f, 0.000000f, 1.618034f, -1.000000f,
4378 0.000000f, 1.618034f, 1.000000f, 0.000000f, 1.618034f, -1.000000f, -1.618034f, 1.000000f, 0.000000f,
4379 0.000000f, -1.618034f, 1.000000f, -1.618034f, -1.000000f, 0.000000f, 0.000000f, -1.618034f, -1.000000f,
4380 0.000000f, -1.618034f, 1.000000f, 0.000000f, -1.618034f, -1.000000f, 1.618034f, -1.000000f, 0.000000f,
4381 1.618034f, 1.000000f, 0.000000f, 1.618034f, -1.000000f, 0.000000f, 1.000000f, 0.000000f, -1.618034f,
4382 1.618034f, 1.000000f, 0.000000f, 1.000000f, 0.000000f, -1.618034f, 0.000000f, 1.618034f, -1.000000f,
4383 -1.618034f, 1.000000f, 0.000000f, -1.000000f, 0.000000f, -1.618034f, -1.618034f, -1.000000f, 0.000000f,
4384 -1.618034f, 1.000000f, 0.000000f, 0.000000f, 1.618034f, -1.000000f, -1.000000f, 0.000000f, -1.618034f,
4385 -1.618034f, -1.000000f, 0.000000f, -1.000000f, 0.000000f, -1.618034f, 0.000000f, -1.618034f, -1.000000f,
4386 1.618034f, -1.000000f, 0.000000f, 0.000000f, -1.618034f, -1.000000f, 1.000000f, 0.000000f, -1.618034f,
4387 0.000000f, 1.618034f, -1.000000f, 1.000000f, 0.000000f, -1.618034f, -1.000000f, 0.000000f, -1.618034f,
4388 0.000000f, -1.618034f, -1.000000f, -1.000000f, 0.000000f, -1.618034f, 1.000000f, 0.000000f, -1.618034f};
4389 static const GLfloat icon[180]={
4390 -0.000000f, 0.356822f, 0.934172f, -0.000000f, 0.356822f, 0.934172f, -0.000000f, 0.356822f, 0.934172f,
4391 0.000000f, -0.356822f, 0.934172f, -0.000000f, -0.356822f, 0.934172f, -0.000000f, -0.356822f, 0.934172f,
4392 0.577350f, 0.577350f, 0.577350f, 0.577350f, 0.577350f, 0.577350f, 0.577350f, 0.577350f, 0.577350f,
4393 0.577350f, -0.577350f, 0.577350f, 0.577350f, -0.577350f, 0.577350f, 0.577350f, -0.577350f, 0.577350f,
4394 0.934172f, -0.000000f, 0.356822f, 0.934172f, -0.000000f, 0.356822f, 0.934172f, -0.000000f, 0.356822f,
4395 -0.577350f, 0.577350f, 0.577350f, -0.577350f, 0.577350f, 0.577350f, -0.577350f, 0.577350f, 0.577350f,
4396 -0.577350f, -0.577350f, 0.577350f, -0.577350f, -0.577350f, 0.577350f, -0.577350f, -0.577350f, 0.577350f,
4397 -0.934172f, -0.000000f, 0.356822f, -0.934172f, -0.000000f, 0.356822f, -0.934172f, -0.000000f, 0.356822f,
4398 0.356822f, 0.934172f, -0.000000f, 0.356822f, 0.934172f, -0.000000f, 0.356822f, 0.934172f, -0.000000f,
4399 -0.356822f, 0.934172f, -0.000000f, -0.356822f, 0.934172f, -0.000000f, -0.356822f, 0.934172f, -0.000000f,
4400 -0.356822f, -0.934172f, -0.000000f, -0.356822f, -0.934172f, -0.000000f, -0.356822f, -0.934172f, -0.000000f,
4401 0.356822f, -0.934172f, -0.000000f, 0.356822f, -0.934172f, -0.000000f, 0.356822f, -0.934172f, -0.000000f,
4402 0.934172f, -0.000000f, -0.356822f, 0.934172f, -0.000000f, -0.356822f, 0.934172f, -0.000000f, -0.356822f,
4403 0.577350f, 0.577350f, -0.577350f, 0.577350f, 0.577350f, -0.577350f, 0.577350f, 0.577350f, -0.577350f,
4404 -0.934172f, -0.000000f, -0.356822f, -0.934172f, -0.000000f, -0.356822f, -0.934172f, -0.000000f, -0.356822f,
4405 -0.577350f, 0.577350f, -0.577350f, -0.577350f, 0.577350f, -0.577350f, -0.577350f, 0.577350f, -0.577350f,
4406 -0.577350f, -0.577350f, -0.577350f, -0.577350f, -0.577350f, -0.577350f, -0.577350f, -0.577350f, -0.577350f,
4407 0.577350f, -0.577350f, -0.577350f, 0.577350f, -0.577350f, -0.577350f, 0.577350f, -0.577350f, -0.577350f,
4408 -0.000000f, 0.356822f, -0.934172f, -0.000000f, 0.356822f, -0.934172f, -0.000000f, 0.356822f, -0.934172f,
4409 0.000000f, -0.356822f, -0.934172f, 0.000000f, -0.356822f, -0.934172f, 0.000000f, -0.356822f, -0.934172f};
4410 glPushMatrix();
4411 glScalef(r,r,r);
4412 glEnableClientState(GL_VERTEX_ARRAY);
4413 glVertexPointer(3, GL_FLOAT, 0, icov);
4414 glEnableClientState(GL_NORMAL_ARRAY);
4415 glNormalPointer(GL_FLOAT, 0, icon);
4416 glDrawArrays(GL_TRIANGLES, 0, 60);
4417 glDisableClientState(GL_VERTEX_ARRAY);
4418 glDisableClientState(GL_NORMAL_ARRAY);
4419 glPopMatrix();
4420 icocnt++;
4421 }
4422
triacontaeder(GLfloat r)4423 void Molecule::triacontaeder(GLfloat r){
4424 if (program_in_use&&(g_Program!=nullptr)){
4425 g_Program->setUniformValue(lichtH, 1);
4426 g_Program->setUniformValue(wallH, 0);
4427 g_Program->setUniformValue(ringH, 0);
4428 g_Program->setUniformValue(openH, 0);
4429 g_Program->setUniformValue(adpsH, 0);
4430 }
4431 static const GLfloat triv[540]={
4432 1.000000f, 0.000000f, 1.618034f, 0.000000f, 0.618034f, 1.618034f, 0.000000f, -0.618034f, 1.618034f,
4433 1.000000f, 0.000000f, 1.618034f, 1.000000f, 1.000000f, 1.000000f, 0.000000f, 0.618034f, 1.618034f,
4434 1.000000f, 0.000000f, 1.618034f, 0.000000f, -0.618034f, 1.618034f, 1.000000f, -1.000000f, 1.000000f,
4435 1.000000f, 0.000000f, 1.618034f, 1.618034f, 0.000000f, 0.618034f, 1.000000f, 1.000000f, 1.000000f,
4436 1.000000f, 0.000000f, 1.618034f, 1.000000f, -1.000000f, 1.000000f, 1.618034f, 0.000000f, 0.618034f,
4437 1.618034f, 0.000000f, 0.618034f, 1.618034f, 0.000000f, -0.618034f, 1.618034f, 1.000000f, 0.000000f,
4438 1.618034f, 0.000000f, 0.618034f, 1.618034f, -1.000000f, 0.000000f, 1.618034f, 0.000000f, -0.618034f,
4439 -1.618034f, 0.000000f, 0.618034f, -1.618034f, 1.000000f, 0.000000f, -1.618034f, 0.000000f, -0.618034f,
4440 -1.618034f, 0.000000f, 0.618034f, -1.618034f, 0.000000f, -0.618034f, -1.618034f, -1.000000f, 0.000000f,
4441 1.618034f, 1.000000f, 0.000000f, 1.000000f, 1.000000f, -1.000000f, 0.618034f, 1.618034f, 0.000000f,
4442 1.618034f, 1.000000f, 0.000000f, 1.618034f, 0.000000f, -0.618034f, 1.000000f, 1.000000f, -1.000000f,
4443 0.000000f, 0.618034f, 1.618034f, -1.000000f, 0.000000f, 1.618034f, 0.000000f, -0.618034f, 1.618034f,
4444 0.000000f, 0.618034f, 1.618034f, -1.000000f, 1.000000f, 1.000000f, -1.000000f, 0.000000f, 1.618034f,
4445 -0.618034f, 1.618034f, 0.000000f, -1.000000f, 1.000000f, -1.000000f, -1.618034f, 1.000000f, 0.000000f,
4446 -0.618034f, 1.618034f, 0.000000f, 0.000000f, 1.618034f, -1.000000f, -1.000000f, 1.000000f, -1.000000f,
4447 -1.618034f, 1.000000f, 0.000000f, -1.000000f, 1.000000f, -1.000000f, -1.618034f, 0.000000f, -0.618034f,
4448 0.000000f, 0.618034f, 1.618034f, 0.000000f, 1.618034f, 1.000000f, -1.000000f, 1.000000f, 1.000000f,
4449 -1.618034f, -1.000000f, 0.000000f, -1.000000f, -1.000000f, -1.000000f, -0.618034f, -1.618034f, 0.000000f,
4450 -1.618034f, -1.000000f, 0.000000f, -1.618034f, 0.000000f, -0.618034f, -1.000000f, -1.000000f, -1.000000f,
4451 0.618034f, -1.618034f, 0.000000f, 1.000000f, -1.000000f, -1.000000f, 1.618034f, -1.000000f, 0.000000f,
4452 0.618034f, -1.618034f, 0.000000f, 0.000000f, -1.618034f, -1.000000f, 1.000000f, -1.000000f, -1.000000f,
4453 1.618034f, -1.000000f, 0.000000f, 1.000000f, -1.000000f, -1.000000f, 1.618034f, 0.000000f, -0.618034f,
4454 1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.618034f, -1.618034f, 0.000000f, 1.618034f, -1.000000f,
4455 1.000000f, 1.000000f, -1.000000f, 1.000000f, 0.000000f, -1.618034f, 0.000000f, 0.618034f, -1.618034f,
4456 0.000000f, 1.618034f, -1.000000f, 0.000000f, 0.618034f, -1.618034f, -1.000000f, 1.000000f, -1.000000f,
4457 -1.000000f, 0.000000f, 1.618034f, -1.000000f, -1.000000f, 1.000000f, 0.000000f, -0.618034f, 1.618034f,
4458 -1.000000f, -1.000000f, -1.000000f, 0.000000f, -0.618034f, -1.618034f, 0.000000f, -1.618034f, -1.000000f,
4459 -1.000000f, -1.000000f, -1.000000f, -1.000000f, 0.000000f, -1.618034f, 0.000000f, -0.618034f, -1.618034f,
4460 -1.000000f, 0.000000f, 1.618034f, -1.000000f, 1.000000f, 1.000000f, -1.618034f, 0.000000f, 0.618034f,
4461 0.000000f, -1.618034f, -1.000000f, 0.000000f, -0.618034f, -1.618034f, 1.000000f, -1.000000f, -1.000000f,
4462 -1.000000f, 0.000000f, 1.618034f, -1.618034f, 0.000000f, 0.618034f, -1.000000f, -1.000000f, 1.000000f,
4463 1.000000f, -1.000000f, -1.000000f, 0.000000f, -0.618034f, -1.618034f, 1.000000f, 0.000000f, -1.618034f,
4464 1.000000f, 0.000000f, -1.618034f, 0.000000f, -0.618034f, -1.618034f, 0.000000f, 0.618034f, -1.618034f,
4465 0.000000f, 0.618034f, -1.618034f, 0.000000f, -0.618034f, -1.618034f, -1.000000f, 0.000000f, -1.618034f,
4466 0.000000f, -0.618034f, 1.618034f, 0.000000f, -1.618034f, 1.000000f, 1.000000f, -1.000000f, 1.000000f,
4467 1.000000f, 1.000000f, 1.000000f, 1.618034f, 1.000000f, 0.000000f, 0.618034f, 1.618034f, 0.000000f,
4468 1.000000f, 1.000000f, 1.000000f, 0.618034f, 1.618034f, 0.000000f, 0.000000f, 1.618034f, 1.000000f,
4469 0.000000f, 1.618034f, 1.000000f, 0.618034f, 1.618034f, 0.000000f, -0.618034f, 1.618034f, 0.000000f,
4470 0.000000f, 1.618034f, 1.000000f, -0.618034f, 1.618034f, 0.000000f, -1.000000f, 1.000000f, 1.000000f,
4471 -1.000000f, -1.000000f, 1.000000f, -1.618034f, -1.000000f, 0.000000f, -0.618034f, -1.618034f, 0.000000f,
4472 -1.000000f, -1.000000f, 1.000000f, -0.618034f, -1.618034f, 0.000000f, 0.000000f, -1.618034f, 1.000000f,
4473 0.000000f, -1.618034f, 1.000000f, -0.618034f, -1.618034f, 0.000000f, 0.618034f, -1.618034f, 0.000000f,
4474 0.000000f, -1.618034f, 1.000000f, 0.618034f, -1.618034f, 0.000000f, 1.000000f, -1.000000f, 1.000000f,
4475 0.618034f, 1.618034f, 0.000000f, 0.000000f, 1.618034f, -1.000000f, -0.618034f, 1.618034f, 0.000000f,
4476 -0.618034f, -1.618034f, 0.000000f, 0.000000f, -1.618034f, -1.000000f, 0.618034f, -1.618034f, 0.000000f,
4477 0.618034f, 1.618034f, 0.000000f, 1.000000f, 1.000000f, -1.000000f, 0.000000f, 1.618034f, -1.000000f,
4478 0.000000f, 0.618034f, 1.618034f, 1.000000f, 1.000000f, 1.000000f, 0.000000f, 1.618034f, 1.000000f,
4479 -0.618034f, -1.618034f, 0.000000f, -1.000000f, -1.000000f, -1.000000f, 0.000000f, -1.618034f, -1.000000f,
4480 1.618034f, 0.000000f, -0.618034f, 1.000000f, 0.000000f, -1.618034f, 1.000000f, 1.000000f, -1.000000f,
4481 1.618034f, 0.000000f, -0.618034f, 1.000000f, -1.000000f, -1.000000f, 1.000000f, 0.000000f, -1.618034f,
4482 -1.618034f, 0.000000f, -0.618034f, -1.000000f, 1.000000f, -1.000000f, -1.000000f, 0.000000f, -1.618034f,
4483 -1.618034f, 0.000000f, -0.618034f, -1.000000f, 0.000000f, -1.618034f, -1.000000f, -1.000000f, -1.000000f,
4484 -1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.618034f, -1.618034f, -1.000000f, 0.000000f, -1.618034f,
4485 0.000000f, -0.618034f, 1.618034f, -1.000000f, -1.000000f, 1.000000f, 0.000000f, -1.618034f, 1.000000f,
4486 1.000000f, 1.000000f, 1.000000f, 1.618034f, 0.000000f, 0.618034f, 1.618034f, 1.000000f, 0.000000f,
4487 -1.000000f, 1.000000f, 1.000000f, -1.618034f, 1.000000f, 0.000000f, -1.618034f, 0.000000f, 0.618034f,
4488 -1.000000f, 1.000000f, 1.000000f, -0.618034f, 1.618034f, 0.000000f, -1.618034f, 1.000000f, 0.000000f,
4489 -1.000000f, -1.000000f, 1.000000f, -1.618034f, 0.000000f, 0.618034f, -1.618034f, -1.000000f, 0.000000f,
4490 1.000000f, -1.000000f, 1.000000f, 1.618034f, -1.000000f, 0.000000f, 1.618034f, 0.000000f, 0.618034f,
4491 1.000000f, -1.000000f, 1.000000f, 0.618034f, -1.618034f, 0.000000f, 1.618034f, -1.000000f, 0.000000f};
4492 static const GLfloat trin[540]={
4493 -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f,
4494 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f,
4495 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f,
4496 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f,
4497 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f,
4498 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f,
4499 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f,
4500 -1.000000f, -0.000000f, -0.000000f, -1.000000f, -0.000000f, -0.000000f, -1.000000f, -0.000000f, -0.000000f,
4501 -1.000000f, -0.000000f, 0.000000f, -1.000000f, -0.000000f, 0.000000f, -1.000000f, -0.000000f, 0.000000f,
4502 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f,
4503 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f,
4504 -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f,
4505 -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f,
4506 -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f,
4507 -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f,
4508 -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f,
4509 -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f,
4510 -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f,
4511 -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f,
4512 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f,
4513 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f,
4514 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f,
4515 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f,
4516 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f,
4517 -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f,
4518 -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f,
4519 -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f,
4520 -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f,
4521 -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f,
4522 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f,
4523 -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f,
4524 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f,
4525 -0.000000f, -0.000000f, -1.000000f, -0.000000f, -0.000000f, -1.000000f, -0.000000f, -0.000000f, -1.000000f,
4526 -0.000000f, 0.000000f, -1.000000f, -0.000000f, 0.000000f, -1.000000f, -0.000000f, 0.000000f, -1.000000f,
4527 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f,
4528 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f,
4529 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f,
4530 -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f,
4531 -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f,
4532 -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f,
4533 -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f,
4534 -0.000000f, -1.000000f, -0.000000f, -0.000000f, -1.000000f, -0.000000f, -0.000000f, -1.000000f, -0.000000f,
4535 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f,
4536 -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f, -0.000000f, 1.000000f, -0.000000f,
4537 -0.000000f, -1.000000f, 0.000000f, -0.000000f, -1.000000f, 0.000000f, -0.000000f, -1.000000f, 0.000000f,
4538 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f,
4539 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f,
4540 -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f,
4541 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f,
4542 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f,
4543 -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f, -0.809017f, 0.309017f, -0.500000f,
4544 -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f,
4545 -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f,
4546 -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f,
4547 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f,
4548 -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f,
4549 -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f,
4550 -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f,
4551 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f, 0.809017f, -0.309017f, 0.500000f,
4552 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f};
4553 glPushMatrix();
4554 glEnable(GL_CULL_FACE);
4555 glScalef(r,r,r);
4556 glEnableClientState(GL_VERTEX_ARRAY);
4557 glVertexPointer(3, GL_FLOAT, 0, triv);
4558 glEnableClientState(GL_NORMAL_ARRAY);
4559 glNormalPointer(GL_FLOAT, 0, trin);
4560 glDrawArrays(GL_TRIANGLES, 0, 180);
4561 glDisableClientState(GL_VERTEX_ARRAY);
4562 glDisableClientState(GL_NORMAL_ARRAY);
4563 glDisable(GL_CULL_FACE);
4564 glPopMatrix();
4565
4566
4567 }
4568
cube(GLfloat r)4569 void Molecule::cube(GLfloat r){
4570 if (program_in_use&&(g_Program!=nullptr)){
4571 g_Program->setUniformValue(lichtH, 1);
4572 g_Program->setUniformValue(wallH, 0);
4573 g_Program->setUniformValue(ringH, 0);
4574 g_Program->setUniformValue(openH, 0);
4575 g_Program->setUniformValue(adpsH, 0);
4576 }
4577 static const GLfloat cubv[108]={
4578 -0.618034f, -1.618034f, 0.000000f, -1.618034f, 0.000000f, -0.618034f, 0.000000f, 0.618034f, -1.618034f,
4579 -0.618034f, -1.618034f, 0.000000f, 0.000000f, 0.618034f, -1.618034f, 1.000000f, -1.000000f, -1.000000f,
4580 -1.000000f, 1.000000f, 1.000000f, 0.618034f, 1.618034f, 0.000000f, 0.000000f, 0.618034f, -1.618034f,
4581 -1.000000f, 1.000000f, 1.000000f, 0.000000f, 0.618034f, -1.618034f, -1.618034f, 0.000000f, -0.618034f,
4582 -1.000000f, 1.000000f, 1.000000f, -0.618034f, -1.618034f, 0.000000f, 0.000000f, -0.618034f, 1.618034f,
4583 -1.000000f, 1.000000f, 1.000000f, -1.618034f, 0.000000f, -0.618034f, -0.618034f, -1.618034f, 0.000000f,
4584 -1.000000f, 1.000000f, 1.000000f, 1.618034f, 0.000000f, 0.618034f, 0.618034f, 1.618034f, 0.000000f,
4585 -1.000000f, 1.000000f, 1.000000f, 0.000000f, -0.618034f, 1.618034f, 1.618034f, 0.000000f, 0.618034f,
4586 0.000000f, -0.618034f, 1.618034f, 1.000000f, -1.000000f, -1.000000f, 1.618034f, 0.000000f, 0.618034f,
4587 0.000000f, -0.618034f, 1.618034f, -0.618034f, -1.618034f, 0.000000f, 1.000000f, -1.000000f, -1.000000f,
4588 1.618034f, 0.000000f, 0.618034f, 0.000000f, 0.618034f, -1.618034f, 0.618034f, 1.618034f, 0.000000f,
4589 1.618034f, 0.000000f, 0.618034f, 1.000000f, -1.000000f, -1.000000f, 0.000000f, 0.618034f, -1.618034f};
4590 static const GLfloat cubn[108]={
4591 -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f,
4592 -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f, -0.309017f, -0.500000f, -0.809017f,
4593 -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f,
4594 -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f, -0.500000f, 0.809017f, -0.309017f,
4595 -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f,
4596 -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f, -0.809017f, -0.309017f, 0.500000f,
4597 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f,
4598 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f, 0.309017f, 0.500000f, 0.809017f,
4599 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f,
4600 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f, 0.500000f, -0.809017f, 0.309017f,
4601 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f,
4602 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f, 0.809017f, 0.309017f, -0.500000f};
4603 glPushMatrix();
4604 glScalef(r,r,r);
4605 glEnableClientState(GL_VERTEX_ARRAY);
4606 glVertexPointer(3, GL_FLOAT, 0, cubv);
4607 glEnableClientState(GL_NORMAL_ARRAY);
4608 glNormalPointer(GL_FLOAT, 0, cubn);
4609 glDrawArrays(GL_TRIANGLES, 0, 36);
4610 glDisableClientState(GL_VERTEX_ARRAY);
4611 glDisableClientState(GL_NORMAL_ARRAY);
4612 glPopMatrix();
4613 }
4614
dieder(V3 a,V3 b,V3 c)4615 double Molecule::dieder(V3 a,V3 b, V3 c){
4616
4617 static double erg;
4618 double A[3],B[3],sig;
4619 sig=a.x*b.y*c.z - a.z*b.y*c.x +
4620 a.z*b.x*c.y - a.x*b.z*c.y +
4621 a.y*b.z*c.x - a.y*b.x*c.z;
4622
4623 A[0]= a.y*b.z - a.z*b.y;
4624 A[1]=-a.x*b.z + a.z*b.x;
4625 A[2]= a.x*b.y - a.y*b.x;
4626
4627 B[0]=-b.y*c.z + b.z*c.y;
4628 B[1]= b.x*c.z - b.z*c.x;
4629 B[2]=-b.x*c.y + b.y*c.x;
4630 // printf("A%f B%f\n",sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]),sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]));
4631 erg=(A[0]*B[0]+A[1]*B[1]+A[2]*B[2])/(sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2])*sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]));
4632 erg=acos(erg)/M_PI*180.0f;
4633 return (sig>0)?(erg):(-erg);
4634 }
4635
winkel(V3 a,V3 b)4636 double Molecule::winkel(V3 a,V3 b){
4637
4638 static double erg;
4639 if ((Norm(a)<0.001)||(Norm(b)<0.001)) return 0;
4640 erg= a*b /(sqrt(Norm(a))*sqrt(Norm(b)));
4641 // erg=(a.x*b.x+a.y*b.y+a.z*b.z)/(sqrt(a.x*a.x+a.y*a.y+a.z*a.z)*sqrt(b.x*b.x+b.y*b.y+b.z*b.z));
4642 erg=acos(erg)/M_PI*180.0;
4643 return(erg);
4644 }
4645
kreuzX(double x1,double y1,double z1,double x2,double y2,double z2)4646 V3 Molecule::kreuzX(double x1,double y1,double z1,double x2,double y2,double z2) {
4647
4648 static V3 erg;
4649 erg.x=-y1*z2+z1*y2;
4650 erg.y=-z1*x2+x1*z2;
4651 erg.z=-x1*y2+y1*x2;
4652 return(erg);
4653 }
4654
decodeSymmCard(QString symmCard)4655 bool Molecule::decodeSymmCard(QString symmCard){
4656 /*! decodes a symmetry card like 'SYMM -X, 1/2+Y, -Z' and feeds cell.symmops and cell.trans lists.
4657 * @param symmCard like 'SYMM -X, 1/2+Y, -Z'.
4658 * \returns true on sucess.
4659 * */
4660 QString sc=symmCard.toUpper().remove("SYMM").trimmed();
4661 sc=sc.remove("'");
4662 sc=sc.remove(" ");
4663 QStringList axe=sc.split(",");
4664 QStringList bruch;
4665 if (axe.size()!=3) return false;
4666 double sx[3],sy[3],sz[3],t[3];
4667 for (int i=0; i<3; i++){
4668 sx[i]=0;sy[i]=0;sz[i]=0;t[i]=0;
4669 if (axe.at(i).contains("-X")) {sx[i]=-1.0;axe[i].remove("-X");}
4670 else if (axe.at(i).contains("X")) {sx[i]=1.0;axe[i].remove("X");}
4671 if (axe.at(i).contains("-Y")) {sy[i]=-1.0;axe[i].remove("-Y");}
4672 else if (axe.at(i).contains("Y")) {sy[i]=1.0;axe[i].remove("Y");}
4673 if (axe.at(i).contains("-Z")) {sz[i]=-1.0;axe[i].remove("-Z");}
4674 else if (axe.at(i).contains("Z")) {sz[i]=1.0;axe[i].remove("Z");}
4675 if (axe.at(i).endsWith("+")) axe[i].remove("+");
4676 if (axe.at(i).contains("/")) {
4677 bruch=axe.at(i).split("/");
4678 if (bruch.size()==2) t[i]=bruch.at(0).toDouble() / bruch.at(1).toDouble();
4679 }
4680 else if (!axe.at(i).isEmpty()) t[i]=axe.at(i).toDouble();
4681 }
4682 Matrix sm = Matrix(sx[0],sy[0],sz[0], sx[1],sy[1],sz[1], sx[2],sy[2],sz[2]);
4683
4684 cell.symmops.append(sm);
4685 cell.trans.append(V3(t[0],t[1],t[2]));
4686 return true;
4687 }
4688
decodeSymmCardEQIV(QString symmCard)4689 bool Molecule::decodeSymmCardEQIV(QString symmCard){
4690 /*! decodes a symmetry card like 'SYMM -X, 1/2+Y, -Z' and feeds Molecule.symmopsEQIV, Molecule.transEQIV and Molecule.labelEQIV.
4691 * \returns true on success.
4692 * @param symmCard like 'SYMM -X, 1/2+Y, -Z'.
4693 */
4694 QString sc=symmCard.toUpper().remove("EQIV").trimmed();
4695 labelEQIV.append(sc.section(' ',0,0));
4696 sc.remove(labelEQIV.last());
4697 sc=sc.remove("'");
4698 sc=sc.remove(" ");
4699 QStringList axe=sc.split(",");
4700 QStringList bruch;
4701 if (axe.size()!=3) return false;
4702 double sx[3],sy[3],sz[3],t[3];
4703 for (int i=0; i<3; i++){
4704 sx[i]=0;sy[i]=0;sz[i]=0;t[i]=0;
4705 if (axe.at(i).contains("-X")) {sx[i]=-1.0;axe[i].remove("-X");}
4706 else if (axe.at(i).contains("X")) {sx[i]=1.0;axe[i].remove("X");}
4707 if (axe.at(i).contains("-Y")) {sy[i]=-1.0;axe[i].remove("-Y");}
4708 else if (axe.at(i).contains("Y")) {sy[i]=1.0;axe[i].remove("Y");}
4709 if (axe.at(i).contains("-Z")) {sz[i]=-1.0;axe[i].remove("-Z");}
4710 else if (axe.at(i).contains("Z")) {sz[i]=1.0;axe[i].remove("Z");}
4711 if (axe.at(i).endsWith("+")) axe[i].remove("+");
4712 if (axe.at(i).contains("/")) {
4713 bruch=axe.at(i).split("/");
4714 if (bruch.size()==2) t[i]=bruch.at(0).toDouble() / bruch.at(1).toDouble();
4715 }
4716 else if (!axe.at(i).isEmpty()) t[i]=axe.at(i).toDouble();
4717 }
4718 Matrix sm = Matrix(sx[0],sy[0],sz[0], sx[1],sy[1],sz[1], sx[2],sy[2],sz[2]);
4719 symmopsEQIV.append(sm);
4720 transEQIV.append(V3(t[0],t[1],t[2]));
4721 // qDebug()<<sx[0]<<sy[0]<<sz[0]<< sx[1]<<sy[1]<<sz[1]<< sx[2]<<sy[2]<<sz[2]<<t[0]<<t[1]<<t[2];
4722 return true;
4723 }
4724
symmCard2Code(QString symmCard)4725 QString Molecule::symmCard2Code(QString symmCard){
4726 /*! Creates a internal symmetry code from a human readable symmetry card.
4727 * @param symmCard human readable symmetry card like "-X, 1/2+Y, -Z"
4728 * \returns internal symmetry code like 'n_555:1'
4729 */
4730 QString sc=symmCard.toUpper().trimmed();
4731 sc=sc.remove("'");
4732 sc=sc.remove(" ");
4733 QStringList axe=sc.split(",");
4734 QStringList bruch;
4735 if (axe.size()!=3) return "";
4736 double sx[3],sy[3],sz[3],t[3];
4737 for (int i=0; i<3; i++){
4738 sx[i]=0;sy[i]=0;sz[i]=0;t[i]=0;
4739 if (axe.at(i).contains("-X")) {sx[i]=-1.0;axe[i].remove("-X");}
4740 else if (axe.at(i).contains("X")) {sx[i]=1.0;axe[i].remove("X");}
4741 if (axe.at(i).contains("-Y")) {sy[i]=-1.0;axe[i].remove("-Y");}
4742 else if (axe.at(i).contains("Y")) {sy[i]=1.0;axe[i].remove("Y");}
4743 if (axe.at(i).contains("-Z")) {sz[i]=-1.0;axe[i].remove("-Z");}
4744 else if (axe.at(i).contains("Z")) {sz[i]=1.0;axe[i].remove("Z");}
4745 if (axe.at(i).endsWith("+")) axe[i].remove("+");
4746 if (axe.at(i).contains("/")) {
4747 bruch=axe.at(i).split("/");
4748 if (bruch.size()==2) t[i]=bruch.at(0).toDouble() / bruch.at(1).toDouble();
4749 }
4750 else if (!axe.at(i).isEmpty()) t[i]=axe.at(i).toDouble();
4751 }
4752 Matrix sm = Matrix(sx[0],sy[0],sz[0], sx[1],sy[1],sz[1], sx[2],sy[2],sz[2]);
4753 if (!cell.symmops.contains(sm)) return "";
4754 V3 r;
4755 r.x=fmod(t[0]+10,1.0);
4756 r.y=fmod(t[1]+10,1.0);
4757 r.z=fmod(t[2]+10,1.0);
4758 for (int i=0; i<cell.symmops.size();i++){
4759 if ((cell.symmops.at(i)==sm)&&(cell.trans.at(i)==r)){
4760 QString ss=QString("%1_%2%3%4:1,")
4761 .arg(i+1)
4762 .arg((int)(t[0]-r.x) +5)
4763 .arg((int)(t[1]-r.y) +5)
4764 .arg((int)(t[2]-r.z) +5);
4765 return ss;
4766 }
4767 }
4768 return "";
4769 }
4770
shortestDistance(QString sc)4771 double Molecule::shortestDistance(QString sc){
4772 /*! computes the shortest distance for the given internal symmetry code.
4773 */
4774 double erg=100000;
4775 V3 frac;
4776 int s,h,k,l,symmgroup;
4777 sscanf(sc.toLatin1(),"%d_%1d%1d%1d:%d",&s,&h,&k,&l,&symmgroup);
4778 //printf("BS:!%s! %d h%d k%d l%d sg%d\n",brauchSymm.at(j).toStdString().c_str(),s,h,k,l,symmgroup);
4779 h-=5;
4780 k-=5;
4781 l-=5;
4782 s--;
4783 for (int i=0;i<asymm.size();i++){
4784 if ((asymm[i].molindex==symmgroup)&&(asymm[i].an>-1)){
4785 frac=cell.symmops.at(s)*asymm[i].frac+cell.trans.at(s)+V3(h,k,l);
4786 for (int j=0;j<asymm.size();j++){
4787 if (asymm.at(j).an<0)continue;
4788 erg=qMin(erg,fl(frac.x-asymm.at(j).frac.x,frac.y-asymm.at(j).frac.y,frac.z-asymm.at(j).frac.z));
4789 }
4790 }
4791 }
4792 return erg;
4793 }
4794
commonFaces(Vert a,Vert b,int f[2])4795 int commonFaces(Vert a,Vert b, int f[2]){
4796 int matches=0;
4797 for (int i=0; i<3; i++)
4798 for (int j=0; j<3; j++)
4799 if (a.faces[i]==b.faces[j])f[matches++]=a.faces[i];
4800 return matches;
4801 }
4802
voronoij(CEnvironment au,int intat)4803 void Molecule::voronoij(CEnvironment au, int intat){
4804 double dk,range=5.0;
4805 voroMsg.clear();
4806 voroMsg.append("<b>Voronoi:</b><br>");
4807 QTime speedTest;
4808 speedTest.start();
4809 vtriangles.clear();
4810 VPoly triangle;
4811 vorobas=1;
4812 V3 prime,dp,D,floorD;
4813 QList<SdmItem> sdm;
4814 SdmItem sdmItem;
4815 sdmItem.a1=0;
4816 sdmItem.a2=1;
4817 sdmItem.sn=0;
4818 //sdmItem.p1=sdmItem.p2=V3(0,0,0);
4819 for (int i=0; i<au.size(); i++){
4820 for (int j=0; j<au.size(); j++ ){
4821 if ((au.at(i).sg)||(au.at(j).sg)) continue;
4822 // bool hma=false;
4823 for (int n=0;n<cell.symmops.size(); n++){
4824 prime=cell.symmops.at(n) * au.at(i).frac + cell.trans.at(n);
4825 D=prime - au.at(j).frac+ V3(0.5,0.5,0.5) ;
4826 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
4827 for (int h=-1; h<2; h++){
4828 for (int k=-1; k<2; k++){
4829 for (int l=-1; l<2; l++){
4830 V3 fD=floorD+V3(h,k,l);
4831 dp=D - fD - V3(0.5,0.5,0.5);
4832 dk=fl(dp.x,dp.y,dp.z);
4833 if ((dk>0.01)&&((range)>=dk)){
4834 sdmItem.d=dk;
4835 sdmItem.floorD=fD;
4836 sdmItem.a1=i;
4837 sdmItem.a2=j;
4838 sdmItem.sn=n;
4839 sdm.append(sdmItem);
4840 }
4841 }
4842 }
4843 }
4844 }
4845 }
4846 }
4847 qSort(sdm.begin(),sdm.end());
4848 //SDMprint(sdm,au);
4849 QList<V3> n,m,doneLine;
4850 QList<int> intra, altcol;
4851 QList<Vert> v;
4852 Vert vert;
4853 V3 pf,pc,mx,nx,of,oc;
4854 Matrix mat;
4855 double vol=0.0,avol,tvol;
4856 for (int i=(intat>-1)?intat:0; i<au.size(); i++){
4857 if (au.at(i).an<0) continue;
4858 //find faces
4859 n.clear();
4860 m.clear();
4861 v.clear();
4862 doneLine.clear();
4863 intra.clear();
4864 avol=0.0;
4865 int faci=0;
4866 //int vcnt=0;
4867 frac2kart(au.at(i).frac,oc);
4868 int tris=0;
4869 for (int j=0; j<sdm.size();j++){
4870 if(sdm.at(j).d<0.1) continue;
4871 if ((sdm.at(j).a2==i)&&(au[sdm.at(j).a1].an>-1)) {
4872 pf = cell.symmops.at(sdm.at(j).sn) * au[sdm.at(j).a1].frac + cell.trans.at(sdm.at(j).sn) - sdm.at(j).floorD;
4873 frac2kart(pf,pc);
4874 /*
4875 printf("%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\n"
4876 ,oc.x
4877 ,oc.y
4878 ,oc.z
4879 ,pc.x
4880 ,pc.y
4881 ,pc.z
4882 );// */
4883 mx =0.5*(oc+pc);
4884 nx = Normalize(pc-oc);
4885 bool exists = false;
4886 double dpl;
4887 for (int tp=0; tp<m.size(); tp++){
4888 dpl=n.at(tp)*(mx-m.at(tp));
4889 if (fabs(dpl)<0.001){exists=true;break;}
4890 }
4891 if (!exists){
4892 m.append(mx);
4893 n.append(nx);
4894 intra.append((sdm.at(j).sn==0)&&(Norm(sdm.at(j).floorD)==0.0));
4895 if (intat>-1)altcol.append(au[sdm.at(j).a1].an);
4896 }
4897 }//is neighbour of i
4898 }// j sdm
4899 for (int h=0; h<n.size()-2; h++)
4900 for (int k=h+1; k<n.size()-1; k++)
4901 for (int l=k+1; l<n.size(); l++){
4902 mat=Matrix(n.at(h),n.at(k),n.at(l));
4903 double d=determinant(mat),dpl;
4904 //printf("%d,%d,%d %9.5f\n",h,k,l,d);
4905 if (fabs(d)<0.0002) continue;
4906
4907 //p = (dot(p1,n1)*cross(n2,n3)-dot(p2,n2)*cross(n1,n3)+dot(p3,n3)*cross(n1,n2))/d
4908 bool out=false;
4909 vert.pos=(
4910 (m.at(h)*n.at(h))*(n.at(k)%n.at(l))+
4911 (m.at(k)*n.at(k))*(n.at(l)%n.at(h))+
4912 (m.at(l)*n.at(l))*(n.at(h)%n.at(k)))*(1.0/d);
4913 vert.faces[0]=h;
4914 vert.faces[1]=k;
4915 vert.faces[2]=l;
4916 for (int pli=0; pli<n.size(); pli++){//teste lage zu allen ebenen
4917 dpl=n.at(pli)*(vert.pos-m.at(pli));
4918 if (dpl>0.00001) {
4919 out=true;
4920 break;
4921 }
4922 }
4923 if (!out) {
4924 v.append(vert);
4925 // printf("[%d,%d,%d] %9.5f%9.5f%9.5f \n",h,k,l,vert.pos.x,vert.pos.y,vert.pos.z);
4926 }
4927 }
4928 for (int mi=0; mi<m.size();mi++){// this is to get the midpoint of a face in its actual center
4929 V3 mnew=V3(0,0,0);
4930 int poli=0;
4931 for (int vi=0; vi<v.size(); vi++){
4932 if ((v.at(vi).faces[0]==mi)||(v.at(vi).faces[1]==mi)||(v.at(vi).faces[2]==mi)){
4933 mnew+=v.at(vi).pos;
4934 poli++;
4935 }
4936 }
4937 mnew*=1.0/poli;
4938 // printf("%dsoll 0=%f\n",poli,n.at(mi)*(mnew-m.at(mi)));
4939 if (poli) {m[mi]=mnew;faci++;}
4940 }
4941 /* glBegin(GL_LINES);
4942 for(int vi=0; vi<v.size()-1; vi++)
4943 for(int vj=vi+1; vj<v.size(); vj++){
4944 int fc[2];
4945 if (commonFaces(v.at(vi),v.at(vj),fc)==2){
4946 glColor4fv(Acol[au[i].an]);
4947 glVertex3d(v.at(vi).pos.x,v.at(vi).pos.y,v.at(vi).pos.z);
4948 glVertex3d(v.at(vj).pos.x,v.at(vj).pos.y,v.at(vj).pos.z);
4949 }
4950 }
4951 glEnd();*/
4952 // glBegin(GL_TRIANGLES);
4953 //glBegin(GL_LINES);
4954
4955 for(int vi=0; vi<v.size()-1; vi++)
4956 for(int vj=vi+1; vj<v.size(); vj++){
4957 int fc[2];
4958 if (commonFaces(v.at(vi),v.at(vj),fc)==2){
4959 V3 lin=v.at(vi).pos+v.at(vj).pos;
4960 double dis;
4961 bool done=false;
4962 for (int di=0; di<doneLine.size(); di++){
4963 dis=Distance(lin,doneLine.at(di));
4964 if (dis<0.000001) {done=true; break;}
4965 }
4966 if (done) continue;
4967 doneLine.append(lin);
4968 tvol=determinant(Matrix(m.at(fc[0])-oc, v.at(vi).pos-oc,v.at(vj).pos-oc));
4969 int v1=(tvol<0)?vj:vi,
4970 v2=(tvol<0)?vi:vj;
4971 triangle.mid=m.at(fc[0]);
4972 triangle.nor=n.at(fc[0]);
4973 triangle.acol=(intat>-1)?altcol.at(fc[0]):au[i].an;
4974 triangle.intra=(intat>-1)?0:intra.at(fc[0]);
4975 triangle.verts0=v[v1].pos;
4976 triangle.verts1=v[v2].pos;
4977
4978 vtriangles.append(triangle);
4979 /*
4980 GLfloat colo[4]={ Acol[au[i].an][0], Acol[au[i].an][1], Acol[au[i].an][2], 0.4};
4981 //GLfloat colo[4]={ Acol[tris%100][0], Acol[tris%100][1], Acol[tris%100][2], 0.4};
4982 colo[3]=intra.at(fc[0])?1.0:0.4;
4983 glColor4fv(colo);
4984 glNormal3d(n.at(fc[0]).x,n.at(fc[0]).y,n.at(fc[0]).z);
4985 glVertex3d(m.at(fc[0]).x,m.at(fc[0]).y,m.at(fc[0]).z);
4986 glVertex3d(v.at(v1).pos.x,v.at(v1).pos.y,v.at(v1).pos.z);
4987 glVertex3d(v.at(v2).pos.x,v.at(v2).pos.y,v.at(v2).pos.z);
4988 */
4989 tris++;
4990 double tv=fabs(tvol)/6.0;
4991 avol+=tv;
4992 vol+=tv*au[i].sof;
4993 tvol=determinant(Matrix(m.at(fc[1])-oc, v.at(vi).pos-oc,v.at(vj).pos-oc));
4994 v1=(tvol<0)?vj:vi;
4995 v2=(tvol<0)?vi:vj;
4996 triangle.mid=m.at(fc[1]);
4997 triangle.nor=n.at(fc[1]);
4998
4999 triangle.acol=(intat>-1)?altcol.at(fc[1]):au[i].an;
5000 triangle.intra=(intat>-1)?0:intra.at(fc[1]);
5001 // triangle.col[3]=((intat>-1)&&(intra.at(fc[1])))?0.8:0.4;
5002 triangle.verts0=v[v1].pos;
5003 triangle.verts1=v[v2].pos;
5004 vtriangles.append(triangle);
5005 /*
5006 colo[3]=intra.at(fc[1])?1.0:0.4;
5007 glColor4fv(colo);
5008
5009 glNormal3d(n.at(fc[1]).x,n.at(fc[1]).y,n.at(fc[1]).z);
5010 glVertex3d(m.at(fc[1]).x,m.at(fc[1]).y,m.at(fc[1]).z);
5011 glVertex3d(v.at(v1).pos.x,v.at(v1).pos.y,v.at(v1).pos.z);
5012 glVertex3d(v.at(v2).pos.x,v.at(v2).pos.y,v.at(v2).pos.z);
5013 */
5014 tris++;
5015 tv=fabs(tvol)/6.0;
5016 avol+=tv;
5017 vol+=tv*au[i].sof;
5018 }
5019 }
5020 // glEnd();
5021 // printf("%d neighbours found for %s. Voronoij polyeder has %d verices, %d edges and %d faces. Triangles %d Volume %f Total Volume= %f cell volume %f\n",
5022 // m.size(),au.at(i).Label,v.size(),v.size()+m.size()-2,m.size(),
5023 printf("%-12s: Triangles %6d Volume %18.5f %d\n",au.at(i).Label.toStdString().c_str(),tris,avol,-tris/2+faci+v.size());
5024 voroMsg.append(QString("%1 : EulerTest: %2 Volume %3 Å<sup>3</sup>.<br>").arg(au.at(i).Label).arg(-tris/2+faci+v.size()).arg(avol));
5025
5026 if (intat>-1) break;
5027 }//i atoms au
5028 if (intat==-1) {
5029 printf("Total Volume= %18.5f Total Volume * z = %18.5f cell volume %18.5f delta =%f%%\n",vol,vol*cell.symmops.size(),cell.V,(vol*cell.symmops.size()-cell.V)/cell.V*100.0);
5030 voroMsg.append(QString("Total Volume= %1 Å<sup>3</sup> cell volume %2 Å<sup>3</sup> ΔV %3%<br>").arg(vol*cell.symmops.size()).arg(cell.V).arg((vol*cell.symmops.size()-cell.V)/cell.V*100.0));
5031 }
5032 // printf("drawing %dms\n",speedTest.restart());
5033 }
5034 V3 eye;
vbyeye(VPoly a,VPoly b)5035 bool vbyeye(VPoly a,VPoly b){
5036 //return (Distance((a.mid+a.verts0+a.verts1)*0.33333,eye)>Distance((b.mid+b.verts0+b.verts1)*0.33333,eye));
5037 return (Distance(a.mid,eye)>Distance(b.mid,eye));
5038 }
5039
drawAxses()5040 void Molecule::drawAxses(){
5041 glLineWidth(2.5);
5042 glDisable(GL_CULL_FACE);
5043 glEnable(GL_BLEND);
5044 glDisable(GL_LIGHTING);
5045 glBegin(GL_LINES);
5046 QColor c;
5047 //glColor3d(0,0,0);
5048 for (int i=0; i<axvecs.size()/2; i++){
5049 if (dontshowSel.contains(axcols.at(i*2))) continue;
5050 if (dontshowSop.contains(axoprs.at(i*2))) continue;
5051 c=symmColors.at(axcols.at(i*2));
5052 glColor3d(c.redF(),c.greenF(),c.blueF());
5053 glVertex3d(axvecs.at(i*2).x,axvecs.at(i*2).y,axvecs.at(i*2).z);
5054 glVertex3d(axvecs.at(i*2+1).x,axvecs.at(i*2+1).y,axvecs.at(i*2+1).z);
5055 }
5056 glEnd();
5057 glEnable(GL_LIGHTING);
5058 }
5059
drawInversionCenters()5060 void Molecule::drawInversionCenters(){
5061 //printf("drawInversionCenters() %d %d\n",(dontshowSel.contains(5)),invvecs.size());
5062 if (dontshowSel.contains(5)) return;
5063 QColor c;
5064 c=symmColors.at(5);
5065 glColor3d(c.redF(),c.greenF(),c.blueF());
5066 for (int i=0; i<invvecs.size(); i++){
5067 if (dontshowSop.contains(invoprs.at(i))) continue;
5068 glPushMatrix();
5069 glTranslated(invvecs.at(i).x,invvecs.at(i).y,invvecs.at(i).z);
5070 triacontaeder(beloRad);
5071 //printf("%d %f %f %f\n",i,invvecs.at(i).x,invvecs.at(i).y,invvecs.at(i).z);
5072 glPopMatrix();
5073 }
5074 }
5075
drawVoronoi(V3 auge)5076 void Molecule::drawVoronoi(V3 auge){
5077 eye=auge;
5078 qSort(vtriangles.begin(),vtriangles.end(),vbyeye);
5079 glLineWidth(2.5);
5080 glDisable(GL_CULL_FACE);
5081 glEnable(GL_BLEND);
5082 glDisable(GL_LIGHTING);
5083 glBegin(GL_LINES);
5084
5085 for (int ti=0; ti<vtriangles.size(); ti++){
5086 glColor4d(
5087 AtomColor[vtriangles.at(ti).acol].redF(),
5088 AtomColor[vtriangles.at(ti).acol].greenF(),
5089 AtomColor[vtriangles.at(ti).acol].blueF(),
5090 0.5);
5091 glVertex3d(vtriangles.at(ti).verts0.x,vtriangles.at(ti).verts0.y,vtriangles.at(ti).verts0.z);
5092 glVertex3d(vtriangles.at(ti).verts1.x,vtriangles.at(ti).verts1.y,vtriangles.at(ti).verts1.z);
5093 }
5094 glEnd();
5095 glEnable(GL_LIGHTING);
5096 glBegin(GL_TRIANGLES);
5097 for (int ti=0; ti<vtriangles.size(); ti++){
5098 glColor4d(AtomColor[vtriangles.at(ti).acol].redF(),
5099 AtomColor[vtriangles.at(ti).acol].greenF(),
5100 AtomColor[vtriangles.at(ti).acol].blueF(),
5101 (vtriangles.at(ti).intra>0)?0.03:(vtriangles.at(ti).intra<0)?0.2:0.6);
5102 // Farbverlauf(ti,0,vtriangles.size(),0.2);
5103 glNormal3d(vtriangles.at(ti).nor.x,vtriangles.at(ti).nor.y,vtriangles.at(ti).nor.z);
5104 glVertex3d(vtriangles.at(ti).mid.x,vtriangles.at(ti).mid.y,vtriangles.at(ti).mid.z);
5105 glVertex3d(vtriangles.at(ti).verts0.x,vtriangles.at(ti).verts0.y,vtriangles.at(ti).verts0.z);
5106 glVertex3d(vtriangles.at(ti).verts1.x,vtriangles.at(ti).verts1.y,vtriangles.at(ti).verts1.z);
5107 }
5108 glEnd();
5109 // glEndList();
5110 }
5111
drawPlanes()5112 void Molecule::drawPlanes(){
5113 glLineWidth(2.5);
5114 glDisable(GL_CULL_FACE);
5115 glEnable(GL_BLEND);
5116 glDisable(GL_LIGHTING);
5117 glBegin(GL_LINES);
5118 QColor c;
5119 for (int ti=0; ti<ptriangles.size(); ti++){
5120 if (dontshowSop.contains(ptriangles.at(ti).n)) continue;
5121 if (dontshowSel.contains(ptriangles.at(ti).colr)) continue;
5122 if (Norm(ptriangles.at(ti).glide)>0.01){
5123 c=symmColors.at(ptriangles.at(ti).colr);
5124 glColor4d(c.redF(),c.greenF(),c.blueF(),1.0);
5125 glVertex3d(ptriangles.at(ti).mid.x,ptriangles.at(ti).mid.y,ptriangles.at(ti).mid.z);
5126 //glVertex3d(0,0,0);
5127 glVertex3d(ptriangles.at(ti).mid.x+ptriangles.at(ti).glide.x,
5128 ptriangles.at(ti).mid.y+ptriangles.at(ti).glide.y,
5129 ptriangles.at(ti).mid.z+ptriangles.at(ti).glide.z);
5130 }
5131 c=symmColors.at(ptriangles.at(ti).colr);
5132 glColor4d(c.redF(),c.greenF(),c.blueF(),0.5);
5133 //glColor4d(ptriangles.at(ti).colr.redF(), ptriangles.at(ti).colr.greenF(), ptriangles.at(ti).colr.blueF(), 0.5);
5134 glVertex3d(ptriangles.at(ti).verts0.x,ptriangles.at(ti).verts0.y,ptriangles.at(ti).verts0.z);
5135 glVertex3d(ptriangles.at(ti).verts1.x,ptriangles.at(ti).verts1.y,ptriangles.at(ti).verts1.z);
5136 }
5137 glEnd();
5138 glBegin(GL_TRIANGLES);
5139 for (int ti=0; ti<ptriangles.size(); ti++){
5140 if (dontshowSop.contains(ptriangles.at(ti).n)) continue;
5141 if (dontshowSel.contains(ptriangles.at(ti).colr)) continue;
5142 c=symmColors.at(ptriangles.at(ti).colr);
5143 glColor4d(c.redF(),c.greenF(),c.blueF(),planeTransparence);
5144 glNormal3d(ptriangles.at(ti).nor.x, ptriangles.at(ti).nor.y, ptriangles.at(ti).nor.z);
5145 glVertex3d(ptriangles.at(ti).mid.x, ptriangles.at(ti).mid.y, ptriangles.at(ti).mid.z);
5146 glVertex3d(ptriangles.at(ti).verts0.x, ptriangles.at(ti).verts0.y, ptriangles.at(ti).verts0.z);
5147 glVertex3d(ptriangles.at(ti).verts1.x, ptriangles.at(ti).verts1.y, ptriangles.at(ti).verts1.z);
5148 }
5149 glEnd();
5150 glEnable(GL_LIGHTING);
5151 // glEndList();
5152 }
5153
loadSettings()5154 void Molecule::loadSettings(){
5155 /*! Loads molecular parameters stored in shelxle.ini
5156 */
5157 QSettings einstellung( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME,mynewnameis );
5158 //einstellung.sync();
5159 einstellung.beginGroup("PSE");
5160 pseFontSize=einstellung.value("FontSize",10).toInt();
5161 einstellung.endGroup();
5162 einstellung.beginGroup("HFIX");
5163 HFixSuitableAtomsOnly=einstellung.value("HFixSuitableAtomsOnly0",false).toBool();
5164 einstellung.endGroup();
5165 einstellung.beginGroup("Atoms");
5166 int acsize;
5167 acsize = einstellung.beginReadArray("CovaleceRadii");
5168 // printf("H hat %d actsize %d\n", Kovalenz_Radien[0], acsize);
5169 for (int i = 0; i < acsize; ++i) {
5170 einstellung.setArrayIndex(i);
5171 Kovalenz_Radien[i] = einstellung.value("Radius").toInt();
5172 // printf ("%d = %d\n",i,Kovalenz_Radien[i]);
5173 }
5174 einstellung.endArray();
5175 acsize = einstellung.beginReadArray("BallRadii");
5176 for (int i = 0; i < acsize; ++i) {
5177 einstellung.setArrayIndex(i);
5178 arad[i]=einstellung.value("Radius").toDouble();
5179 }
5180 einstellung.endArray();
5181 acsize = einstellung.beginReadArray("AtomColors");
5182 // printf("H hat %d Col actsize %d\n", Kovalenz_Radien[0], acsize);
5183 for (int i = 0; i < acsize; ++i) {
5184 einstellung.setArrayIndex(i);
5185 AtomColor[i] = einstellung.value("Color").value<QColor>();
5186 AtomColor[i].setAlphaF(0.5);
5187 }
5188 einstellung.endArray();
5189 acsize = einstellung.beginReadArray("AtomStyles");
5190
5191 for (int i = 0; i < acsize; ++i) {
5192 einstellung.setArrayIndex(i);
5193 AtomStyle[i] = einstellung.value("Style").toInt();
5194 }
5195 einstellung.endArray();
5196 einstellung.endGroup();
5197 einstellung.beginGroup("SymmetryElements");
5198 einstellung.beginWriteArray("SymmetryElementColors",107);
5199 for (int i = 0, j = 0; i < 18; ++i) {
5200 if ((i>5)&&(j%5==0)) j++;
5201 int colori=27+j++;
5202 //printf("%d %s\n",i,QColor::colorNames().at(colori).toStdString().c_str());
5203 einstellung.setArrayIndex(i);
5204 symmColors[i] = einstellung.value("Color",QColor::colorNames().at(colori)).value<QColor>();
5205 symmColors[i].setAlphaF(0.5);
5206 }
5207 einstellung.endArray();
5208 einstellung.endGroup();
5209 einstellung.beginGroup("Bonds");
5210 bondColor=einstellung.value("BondColor",QColor(Qt::darkGray)).value<QColor>();
5211 bondColorStyle=einstellung.value("BondStyle",0).toInt();
5212 bondStrength=einstellung.value("BondStrength",0.05).toDouble();
5213 HAMax=einstellung.value("HBondMaxDist",2.5).toDouble();
5214 HAWink=einstellung.value("HBondMaxAng",135.0).toDouble();
5215 acsize = einstellung.beginReadArray("HBondDonors");
5216 if (acsize>0) theseAreDonors.clear();
5217 for (int i = 0; i < acsize; ++i) {
5218 einstellung.setArrayIndex(i);
5219 theseAreDonors.append(getOZ(einstellung.value("Element").toString()));
5220 }
5221 einstellung.endArray();
5222
5223 acsize = einstellung.beginReadArray("HBondAcceptors");
5224 if (acsize>0) theseAreAcceptors.clear();
5225 for (int i = 0; i < acsize; ++i) {
5226 einstellung.setArrayIndex(i);
5227 theseAreAcceptors.append(getOZ(einstellung.value("Element").toString()));
5228 }
5229 einstellung.endArray();
5230 //qDebug()<<theseAreAcceptors<<theseAreDonors;
5231
5232 enviBondColor=einstellung.value("enviBondColor",QColor(Qt::darkGreen)).value<QColor>();
5233 enviHBColor=einstellung.value("enviHBColor",QColor(Qt::darkYellow)).value<QColor>();
5234 enviDefaultColor=einstellung.value("enviDefaultColor",QColor(Qt::black)).value<QColor>();
5235 einstellung.endGroup();
5236 einstellung.beginGroup("QPeaks");
5237 qPeakRad = einstellung.value("QPeaksRadius",0.05).toDouble();
5238 einstellung.endGroup();
5239 einstellung.beginGroup("Window");
5240 ffmpegexe=einstellung.value("FFMPEG.EXE",ffmpegexe).toString();
5241 LOD=einstellung.value("LevelOfDetail",4).toInt();
5242 if (einstellung.contains("Use_GLSL_Shaders")) useShaders=einstellung.value("Use_GLSL_Shaders").toBool();
5243 einstellung.endGroup();
5244 einstellung.beginGroup("IDEAL");
5245 beloRad = einstellung.value("beloRad",0.04).toDouble();
5246 beloColor = einstellung.value("beloColor",QColor("teal")).value<QColor>();
5247 beloColorByDefden= einstellung.value("beloColorByDefden",true).toBool();
5248 beloLabels = einstellung.value("beloLabels",true).toBool();
5249 einstellung.endGroup();
5250 }
5251
setHBondMaxDist(double d)5252 void Molecule::setHBondMaxDist(double d){if ((d>0.0)&&(d<4.0)) HAMax=d;}
setHBondMaxAngl(double w)5253 void Molecule::setHBondMaxAngl(double w){if ((w>0.0)&&(w<180.0)) HAWink=w;}
5254
canbeDonor(int an)5255 bool Molecule::canbeDonor(int an){
5256 return theseAreDonors.contains(an);
5257 }
5258
canbeAcceptor(int an)5259 bool Molecule::canbeAcceptor(int an){
5260 return theseAreAcceptors.contains(an);
5261 }
5262 //QList<int> theseAreAcceptors;//
5263 //QList<int> theseAreDonors;
hbdist()5264 double Molecule::hbdist(){return HAMax;}
hbangl()5265 double Molecule::hbangl(){return HAWink;}
5266 #include <stdio.h>
symmcode2human(int s)5267 QString Molecule::symmcode2human(int s){
5268 /*! @param s the Nth symmetry operation of the space group.
5269 * \returns human readable string.
5270 */
5271 QString erg;
5272 Matrix m;
5273 V3 t;
5274 int h=0,k=0,l=0;
5275 m=cell.symmops.at(s);
5276 QString symstrX,symstrY,symstrZ;
5277 if (m.m11==1) symstrX.append("+x");
5278 if (m.m11==-1) symstrX.append("-x");
5279 if (m.m21==1) symstrX.append("+y");
5280 if (m.m21==-1) symstrX.append("-y");
5281 if (m.m31==1) symstrX.append("+z");
5282 if (m.m31==-1) symstrX.append("-z");
5283
5284 if (m.m12==1) symstrY.append("+x");
5285 if (m.m12==-1) symstrY.append("-x");
5286 if (m.m22==1) symstrY.append("+y");
5287 if (m.m22==-1) symstrY.append("-y");
5288 if (m.m32==1) symstrY.append("+z");
5289 if (m.m32==-1) symstrY.append("-z");
5290
5291 if (m.m13==1) symstrZ.append("+x");
5292 if (m.m13==-1) symstrZ.append("-x");
5293 if (m.m23==1) symstrZ.append("+y");
5294 if (m.m23==-1) symstrZ.append("-y");
5295 if (m.m33==1) symstrZ.append("+z");
5296 if (m.m33==-1) symstrZ.append("-z");
5297 t=cell.trans.at(s);
5298 V3 zaehler,nenner;
5299 double egal;
5300 for (int g=1;g<7; g++){
5301 //nenner.x=(t.x<0)?-g:g;
5302 nenner.x=g;
5303 zaehler.x=(int)round((t.x+h)*g);
5304 if (fabs(modf(t.x*g,&egal))<0.05) break;
5305 }
5306 for (int g=1;g<7; g++){
5307 //nenner.y=(t.y<0)?-g:g;
5308 nenner.y=g;
5309 zaehler.y=(int)round((t.y+k)*g);
5310 if (fabs(modf(t.y*g,&egal))<0.05) break;
5311 }
5312 for (int g=1;g<7; g++){
5313 //nenner.z=(t.z<0)?-g:g;
5314 nenner.z=g;
5315 zaehler.z=(int)round((t.z+l)*g);
5316 if (fabs(modf(t.z*g,&egal))<0.05) break;
5317 }
5318 erg=(QString(" %1/%2%3, %4/%5%6, %7/%8%9")
5319 .arg(zaehler.x)
5320 .arg(nenner.x)
5321 .arg(symstrX)
5322 .arg(zaehler.y)
5323 .arg(nenner.y)
5324 .arg(symstrY)
5325 .arg(zaehler.z)
5326 .arg(nenner.z)
5327 .arg(symstrZ));
5328 erg.remove(QRegExp("0/\\d"));
5329 erg.replace("1/1","1");
5330 erg.replace("2/1","2");
5331 erg.replace("3/1","3");
5332 erg.replace("4/1","4");
5333 erg.replace("5/1","5");
5334 erg.replace("6/1","6");
5335 return erg;
5336 }
5337
symmcode2human(QString brauchSymm)5338 QString Molecule::symmcode2human(QString brauchSymm){
5339 /*! @param brauchSymm internal symmetry code n_555
5340 * \returns human readable string
5341 */
5342 QString erg;
5343 Matrix m;
5344 V3 t;
5345 int h,k,l,s;
5346 sscanf(brauchSymm.toLatin1(),"%d_%1d%1d%1d",&s,&h,&k,&l);
5347 h-=5;
5348 k-=5;
5349 l-=5;
5350 s--;
5351 m=cell.symmops.at(s);
5352 QString symstrX,symstrY,symstrZ;
5353 if (m.m11==1) symstrX.append("+x");
5354 if (m.m11==-1) symstrX.append("-x");
5355 if (m.m21==1) symstrX.append("+y");
5356 if (m.m21==-1) symstrX.append("-y");
5357 if (m.m31==1) symstrX.append("+z");
5358 if (m.m31==-1) symstrX.append("-z");
5359
5360 if (m.m12==1) symstrY.append("+x");
5361 if (m.m12==-1) symstrY.append("-x");
5362 if (m.m22==1) symstrY.append("+y");
5363 if (m.m22==-1) symstrY.append("-y");
5364 if (m.m32==1) symstrY.append("+z");
5365 if (m.m32==-1) symstrY.append("-z");
5366
5367 if (m.m13==1) symstrZ.append("+x");
5368 if (m.m13==-1) symstrZ.append("-x");
5369 if (m.m23==1) symstrZ.append("+y");
5370 if (m.m23==-1) symstrZ.append("-y");
5371 if (m.m33==1) symstrZ.append("+z");
5372 if (m.m33==-1) symstrZ.append("-z");
5373 t=cell.trans.at(s);
5374 V3 zaehler,nenner;
5375 double egal;
5376 for (int g=1;g<7; g++){
5377 nenner.x=(t.x<0)?-g:g;;
5378 zaehler.x=(int)round((t.x+h)*g);
5379 if (fabs(modf(t.x*g,&egal))<0.05) break;
5380 }
5381 for (int g=1;g<7; g++){
5382 nenner.y=(t.y<0)?-g:g;
5383 zaehler.y=(int)round((t.y+k)*g);
5384 if (fabs(modf(t.y*g,&egal))<0.05) break;
5385 }
5386 for (int g=1;g<7; g++){
5387 nenner.z=(t.z<0)?-g:g;
5388 zaehler.z=(int)round((t.z+l)*g);
5389 if (fabs(modf(t.z*g,&egal))<0.05) break;
5390 }
5391 erg=(QString("%1/%2%3, %4/%5%6, %7/%8%9")
5392 .arg(zaehler.x)
5393 .arg(nenner.x)
5394 .arg(symstrX)
5395 .arg(zaehler.y)
5396 .arg(nenner.y)
5397 .arg(symstrY)
5398 .arg(zaehler.z)
5399 .arg(nenner.z)
5400 .arg(symstrZ));
5401
5402
5403 erg.remove(QRegExp("0/\\d"));
5404 erg.replace("1/1","1");
5405 erg.replace("2/1","2");
5406 erg.replace("3/1","3");
5407 erg.replace("4/1","4");
5408 erg.replace("5/1","5");
5409 erg.replace("6/1","6");
5410 return erg;
5411 }
5412
symmcode2human(QString brauchSymm,int j)5413 QString Molecule::symmcode2human(QString brauchSymm, int j){
5414 /*! @param brauchSymm internal symmetry code n_555
5415 * @param j symmetry number to prepend the human readable string returned.
5416 * \returns human readable string
5417 */
5418 QString erg;
5419 Matrix m;
5420 V3 t;
5421 int h,k,l,s;
5422 sscanf(brauchSymm.toLatin1(),"%d_%1d%1d%1d",&s,&h,&k,&l);
5423 h-=5;
5424 k-=5;
5425 l-=5;
5426 s--;
5427 m=cell.symmops.at(s);
5428 QString symstrX,symstrY,symstrZ;
5429 if (m.m11==1) symstrX.append("+x");
5430 if (m.m11==-1) symstrX.append("-x");
5431 if (m.m21==1) symstrX.append("+y");
5432 if (m.m21==-1) symstrX.append("-y");
5433 if (m.m31==1) symstrX.append("+z");
5434 if (m.m31==-1) symstrX.append("-z");
5435
5436 if (m.m12==1) symstrY.append("+x");
5437 if (m.m12==-1) symstrY.append("-x");
5438 if (m.m22==1) symstrY.append("+y");
5439 if (m.m22==-1) symstrY.append("-y");
5440 if (m.m32==1) symstrY.append("+z");
5441 if (m.m32==-1) symstrY.append("-z");
5442
5443 if (m.m13==1) symstrZ.append("+x");
5444 if (m.m13==-1) symstrZ.append("-x");
5445 if (m.m23==1) symstrZ.append("+y");
5446 if (m.m23==-1) symstrZ.append("-y");
5447 if (m.m33==1) symstrZ.append("+z");
5448 if (m.m33==-1) symstrZ.append("-z");
5449 t=cell.trans.at(s);
5450 V3 zaehler,nenner;
5451 double egal;
5452 for (int g=1;g<7; g++){
5453 nenner.x=(t.x<0)?-g:g;;
5454 zaehler.x=(int)round(((t.x+h)*g));//+0.0001
5455 if (fabs(modf(t.x*g,&egal))<0.05) break;
5456 }
5457 for (int g=1;g<7; g++){
5458 nenner.y=(t.y<0)?-g:g;
5459 zaehler.y=(int)round(((t.y+k)*g));//+0.001
5460 if (fabs(modf(t.y*g,&egal))<0.05) break;
5461 }
5462 for (int g=1;g<7; g++){
5463 nenner.z=(t.z<0)?-g:g;
5464 zaehler.z=(int)round(((t.z+l)*g));//+0.001
5465 if (fabs(modf(t.z*g,&egal))<0.05) break;
5466 }
5467
5468 erg=(QString("»%1 :<b> %2/%3%4, %5/%6%7, %8/%9%10</b><br>")
5469 .arg(j)
5470 .arg(zaehler.x)
5471 .arg(nenner.x)
5472 .arg(symstrX)
5473 .arg(zaehler.y)
5474 .arg(nenner.y)
5475 .arg(symstrY)
5476 .arg(zaehler.z)
5477 .arg(nenner.z)
5478 .arg(symstrZ));
5479
5480 erg.remove(QRegExp("0/\\d"));
5481 erg.replace("1/1","1");
5482 erg.replace("2/1","2");
5483 erg.replace("3/1","3");
5484 erg.replace("4/1","4");
5485 erg.replace("5/1","5");
5486 erg.replace("6/1","6");
5487 return erg;
5488 }
5489
symmcode2human(QStringList brauchSymm)5490 QString Molecule::symmcode2human(QStringList brauchSymm){
5491 /*! @param brauchSymm list of internal symmetry codes
5492 * \returns human readable string sepearated by <br>
5493 */
5494 QString erg;
5495 Matrix m;
5496 V3 t;
5497 int h,k,l,s;
5498 for (int j=0; j<brauchSymm.size();j++){
5499 sscanf(brauchSymm[j].toLatin1(),"%d_%1d%1d%1d",&s,&h,&k,&l);
5500 h-=5;
5501 k-=5;
5502 l-=5;
5503 s--;
5504 m=cell.symmops.at(s);
5505 QString symstrX,symstrY,symstrZ;
5506 if (m.m11==1) symstrX.append("+x");
5507 if (m.m11==-1) symstrX.append("-x");
5508 if (m.m21==1) symstrX.append("+y");
5509 if (m.m21==-1) symstrX.append("-y");
5510 if (m.m31==1) symstrX.append("+z");
5511 if (m.m31==-1) symstrX.append("-z");
5512
5513 if (m.m12==1) symstrY.append("+x");
5514 if (m.m12==-1) symstrY.append("-x");
5515 if (m.m22==1) symstrY.append("+y");
5516 if (m.m22==-1) symstrY.append("-y");
5517 if (m.m32==1) symstrY.append("+z");
5518 if (m.m32==-1) symstrY.append("-z");
5519
5520 if (m.m13==1) symstrZ.append("+x");
5521 if (m.m13==-1) symstrZ.append("-x");
5522 if (m.m23==1) symstrZ.append("+y");
5523 if (m.m23==-1) symstrZ.append("-y");
5524 if (m.m33==1) symstrZ.append("+z");
5525 if (m.m33==-1) symstrZ.append("-z");
5526 t=cell.trans.at(s);
5527 V3 zaehler,nenner;
5528 double egal;
5529 for (int g=1;g<7; g++){
5530 nenner.x=(t.x<0)?-g:g;;
5531 zaehler.x=(int)round((t.x+h)*g);
5532 if (fabs(modf(t.x*g,&egal))<0.05) break;
5533 }
5534 for (int g=1;g<7; g++){
5535 nenner.y=(t.y<0)?-g:g;
5536 zaehler.y=(int)round((t.y+k)*g);
5537 if (fabs(modf(t.y*g,&egal))<0.05) break;
5538 }
5539 for (int g=1;g<7; g++){
5540 nenner.z=(t.z<0)?-g:g;
5541 zaehler.z=(int)round((t.z+l)*g);
5542 if (fabs(modf(t.z*g,&egal))<0.05) break;
5543 }
5544 erg.append(QString("»%1 :<b> %2/%3%4, %5/%6%7, %8/%9%10</b><br>")
5545 .arg(j+1)
5546 .arg(zaehler.x)
5547 .arg(nenner.x)
5548 .arg(symstrX)
5549 .arg(zaehler.y)
5550 .arg(nenner.y)
5551 .arg(symstrY)
5552 .arg(zaehler.z)
5553 .arg(nenner.z)
5554 .arg(symstrZ));
5555
5556 }
5557 erg.remove(QRegExp("0/\\d"));
5558 erg.replace("1/1","1");
5559 erg.replace("2/1","2");
5560 erg.replace("3/1","3");
5561 erg.replace("4/1","4");
5562 erg.replace("5/1","5");
5563 erg.replace("6/1","6");
5564 return erg;
5565 }
5566
frac2kart(V3 x,V3 & y)5567 void Molecule::frac2kart(V3 x, V3 &y){
5568 /*!
5569 * converts a fractional coordinate into a cartesian using cell information.
5570 * @param[in] x fractional coordinate.
5571 * @param[out] y cartesian coordinate.
5572 */
5573 Matrix u;
5574 u.m11 = cell.a;
5575 u.m21 = 0.0;
5576 u.m31 = 0.0;
5577 u.m12 = cell.b * cell.cosga;
5578 u.m22 = cell.b * cell.singa;
5579 u.m32 = 0.0;
5580 u.m13 = cell.c * cell.cosbe;
5581 u.m23 = cell.tau;
5582 u.m33 = cell.c * cell.phi / cell.singa;
5583
5584 y.x = x.x * u.m11 + x.y * u.m12 + x.z * u.m13;
5585 y.y = x.x * u.m21 + x.y * u.m22 + x.z * u.m23;
5586 y.z = x.x * u.m31 + x.y * u.m32 + x.z * u.m33;
5587
5588 }
5589
kart2frac(V3 x,V3 & y)5590 void Molecule::kart2frac(V3 x, V3 &y){
5591 /*!
5592 * converts a cartesian coordinate into a fractional using cell information.
5593 * @param[in] x cartesian coordinate.
5594 * @param[out] y fractional coordinate.
5595 */
5596 Matrix u;
5597 y.x =0.0 ;
5598 y.y =0.0 ;
5599 y.z =0.0;
5600 u.m11 = 1.0/cell.a;
5601 u.m21 = 0.0;
5602 u.m31 = 0.0;
5603 u.m12 = -1.0/(cell.a * cell.tanga);
5604 u.m22 = 1.0/(cell.b * cell.singa);
5605 u.m32 = 0.0;
5606 u.m13 = (cell.cosal*cell.cosga-cell.cosbe)/(cell.a*cell.phi*cell.singa);
5607 u.m23 = (cell.cosbe*cell.cosga-cell.cosal)/(cell.b*cell.phi*cell.singa);
5608 u.m33 = cell.singa/(cell.c*cell.phi);
5609 // Wird jetzt hier genauso wie in int Tab B S.345 gerechnet (M^-1^).
5610 y.x = x.x * u.m11 + x.y * u.m12 + x.z * u.m13;
5611 y.y = x.x * u.m21 + x.y * u.m22 + x.z * u.m23;
5612 y.z = x.x * u.m31 + x.y * u.m32 + x.z * u.m33;
5613 }
5614
pse(int oz)5615 QString Molecule::pse(int oz){
5616
5617
5618 if ((oz>-1)&&(oz<PSE.size())) return PSE.at(oz);
5619 switch (oz){
5620 case -1: return "Q";
5621 case -42: return "BELO";
5622 case -66: return "Cnt";
5623 default: return "";
5624 }
5625 }
5626
getOZ(QString S1)5627 int Molecule::getOZ(QString S1){
5628 QString s=S1;
5629 s=s.remove('$');
5630 s=s.section(QRegExp("[^A-Za-z]"),0,0);
5631 s=s.toUpper();
5632 if (s=="CNT") return -66;
5633 if (s=="D") return 0;
5634 QRegExp r = QRegExp(s,Qt::CaseInsensitive);
5635 return PSE.indexOf(r);
5636 }
5637
uniqueInCell()5638 void Molecule::uniqueInCell(){
5639 /*! Moves centers of gravity of each fragment into the unit cell box and close to the origin.
5640 * */
5641 QList<int> flags;
5642 int toflipp=0;
5643 for (int i=0; i<asymm.size(); i++) if (asymm.at(i).an>-1){
5644 flags.append(-1);
5645 toflipp++;
5646 }else flags.append(0);
5647 flags[0]=1;
5648 // printf("MaxMol = %d\n",maxmol);
5649 double dk;
5650 V3 prime,dp,D,floorD;
5651 // V3 D,floorD;
5652 QList<V3> minMol;
5653 for (int i=0; i<maxmol; i++) minMol.append(V3(0,0,0));
5654 SdmItem sdmItem;
5655 sdmItem.a1=0;
5656 sdmItem.a2=1;
5657 sdmItem.sn=0;
5658 sdmItem.covalent=true;
5659 QList<SdmItem> starter;
5660 QList<int> mii;
5661 for (int j=0; j<maxmol; j++){
5662 int mi=0;
5663 for (int i=0; i<asymm.size(); i++){
5664 if (asymm.at(i).an<0) continue;
5665 if ((asymm.at(i).molindex-1)!=j) continue;
5666 minMol[j]+=asymm.at(i).frac;
5667 mi++;
5668 }
5669 mii.append(mi);
5670 minMol[j]*=1.0/mi;
5671 // printf("mole#%-2d has %3d atoms. Center of mass is at %9.4f %9.4f %9.4f \n",j,mi, minMol[j].x, minMol[j].y, minMol[j].z);
5672 }
5673 for (int j=0; j<maxmol; j++){
5674 if (mii.at(j)==0){
5675 sdmItem.sn=0;
5676 sdmItem.floorD=V3(floor(minMol.at(j).x),floor(minMol.at(j).y),floor(minMol.at(j).z));
5677 sdmItem.a2=sdmItem.a1=j;
5678 starter.append(sdmItem);
5679 }else{
5680 double min=99999.0;
5681 for (int n=0;n<cell.symmops.size(); n++){
5682 prime=cell.symmops.at(n) * minMol.at(j) + cell.trans.at(n);
5683 D=prime ;//+ V3(0.5,0.5,0.5) ;
5684 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
5685 dp=D - floorD - V3(0.5,0.5,0.5);
5686 dk=fl(dp.x,dp.y,dp.z);
5687 if (dk<min){
5688 sdmItem.d=dk;
5689 min=dk;
5690 sdmItem.floorD=floorD;
5691 sdmItem.a1=j;
5692 sdmItem.a2=j;
5693 sdmItem.sn=n;
5694 }
5695 }
5696 // printf("Mole#%-2d floorD %3.0f %3.0f %3.0f %d\n",j,sdmItem.floorD.x,sdmItem.floorD.y,sdmItem.floorD.z,sdmItem.sn);
5697 starter.append(sdmItem);
5698 }
5699 }
5700 for (int i=0; i<asymm.size(); i++){
5701 if (asymm.at(i).an<0) continue;
5702 if (asymm.at(i).molindex<1) continue;
5703 int n = starter.at(asymm.at(i).molindex-1).sn;
5704 V3 f = starter.at(asymm.at(i).molindex-1).floorD;
5705 asymm[i].frac= cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n) - f;
5706 frac2kart(asymm[i].frac,asymm[i].pos);
5707
5708 }
5709 for (int j=0; j<maxmol; j++){
5710 int mi=0;
5711 minMol[j]=V3(0,0,0);
5712 for (int i=0; i<asymm.size(); i++){
5713 if ((asymm.at(i).molindex-1)!=j) continue;
5714 minMol[j]+=asymm.at(i).frac;
5715 mi++;
5716 }
5717 minMol[j]*=1.0/mi;
5718 // printf("mole#%-2d has %2d atoms. Center of mass is at %9.4f %9.4f %9.4f \n",j,mi, minMol[j].x, minMol[j].y, minMol[j].z);
5719 }
5720 packer(sdmcompleter());
5721 showatoms.clear();
5722 for (int i=0; i<asymm.size();i++){
5723 showatoms.append(asymm[i]);
5724 showatoms[i].molindex=asymm[i].molindex;
5725 }
5726 showbonds.clear();
5727 showbonds=connecting(showatoms);
5728 }
5729
enviSDM(double range)5730 void Molecule::enviSDM(double range){
5731 /*! Calculates the shortes distance matrix for the ENVIronment functionality in the given range.
5732 * @param range maximal distances around each atom to generate a matrix entry.
5733 */
5734
5735 // George Sheldrick Seminar ideas
5736 double dk,dddd;
5737 V3 prime,dp,D,floorD;
5738 envi_sdm.clear();
5739 SdmItem sdmItem;
5740 sdmItem.a1=0;
5741 sdmItem.a2=1;
5742 sdmItem.sn=0;
5743 //sdmItem.p1=sdmItem.p2=V3(0,0,0);
5744 for (int i=0; i<asymm.size(); i++){
5745 for (int j=0; j<asymm.size(); j++ ){
5746 // bool hma=false;
5747 for (int n=0;n<cell.symmops.size(); n++){
5748 prime=cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n);
5749 D=prime - asymm.at(j).frac+ V3(0.5,0.5,0.5) ;
5750 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
5751 for (int h=-1; h<2; h++){
5752 for (int k=-1; k<2; k++){
5753 for (int l=-1; l<2; l++){
5754 V3 fD=floorD+V3(h,k,l);
5755 dp=D - fD - V3(0.5,0.5,0.5);
5756 dk=fl(dp.x,dp.y,dp.z);
5757 if ((dk>0.01)&&((range)>=dk)){
5758 sdmItem.d=dk;
5759 sdmItem.floorD=fD;
5760 sdmItem.a1=i;
5761 sdmItem.a2=j;
5762 sdmItem.sn=n;
5763 if ((asymm[i].an>-1)&&(asymm[j].an>-1)&&
5764 ((asymm[i].part*asymm[j].part==0)||
5765 (asymm[i].part==asymm[j].part)))
5766 dddd=(Kovalenz_Radien[asymm[i].an]+ Kovalenz_Radien[asymm[j].an])*0.012;
5767 else dddd=0;
5768 if (sdmItem.d<dddd){
5769 sdmItem.covalent=true;
5770 }else sdmItem.covalent=false;
5771 envi_sdm.append(sdmItem);
5772 }
5773 }
5774 }
5775 }
5776 }
5777 }
5778 }
5779 #if (QT_VERSION >= 0x050000)
5780 std::sort(envi_sdm.begin(),envi_sdm.end());
5781 #else
5782 qSort(envi_sdm.begin(),envi_sdm.end());
5783 #endif
5784 //histogram
5785 /*
5786 double hmi,hma;
5787 hmi=envi_sdm.first().d;
5788 hma=envi_sdm.last().d;
5789 double hstep=(hma-hmi)/20.0;
5790 printf("%g %g %g %d\n",hma,hmi,hstep,envi_sdm.size());
5791 if (hstep<0.01) return;
5792 int hbox[20]={
5793 0,0,0,0,0,
5794 0,0,0,0,0,
5795 0,0,0,0,0,
5796 0,0,0,0,0};
5797 for (int i=0; i<envi_sdm.size();i++){
5798 int hind=(int) (envi_sdm.at(i).d/hstep);
5799 hbox[hind]++;
5800 }
5801 for (int i=0;i<20;i++){
5802 printf("%g-%g %d (%g)\n",hmi+hstep*i,hmi+i*hstep+hstep,hbox[i],hma);
5803 }
5804 // */
5805 }
5806
neighborSort(Knopf & kn)5807 void Molecule::neighborSort(Knopf &kn){//sort neighbors by atomic number
5808 // I think bublle sort is fine for such a sort list
5809 for (int i = 0; i < kn.neighbors.size(); i++){
5810 for (int j = i+1; j < kn.neighbors.size(); j++){
5811 if ((kn.neighbors.at(i)>=asymm.size())||(kn.neighbors.at(j)>=asymm.size())) continue;
5812 if (asymm.at(kn.neighbors.at(i)).an < asymm.at(kn.neighbors.at(j)).an){
5813 int swap=kn.neighbors.at(i);
5814 kn.neighbors[i]=kn.neighbors.at(j);
5815 kn.neighbors[j]=swap;
5816 }
5817 }
5818 }
5819 }
5820
computeSDM(CEnvironment au)5821 QList<SdmItem> Molecule::computeSDM(CEnvironment au){
5822 double dk,dddd;
5823 V3 prime,dp,D,floorD;
5824 SdmItem sdmItem;
5825 sdmItem.a1=0;
5826 sdmItem.a2=0;
5827 sdmItem.sn=0;
5828 QList<SdmItem> _sdm;
5829 for (int i=0; i<au.size(); i++){
5830 for (int j=i+1; j<au.size(); j++ ){
5831 double min=1000000;
5832 bool hma=false;
5833 for (int n=0;n<cell.symmops.size(); n++){
5834 //for (int n=0;n<1; n++){
5835 prime=cell.symmops.at(n) * au.at(i).frac + cell.trans.at(n);
5836 D=prime - au.at(j).frac+ V3(0.5,0.5,0.5) ;
5837 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
5838 dp=D - floorD - V3(0.5,0.5,0.5);
5839 dk=fl(dp.x,dp.y,dp.z);
5840 if (n) dk+=0.0001;
5841 if ((dk>0.01)&&((min+0.00)>=dk)){
5842 min=fmin(dk,min);
5843 sdmItem.d=min;
5844 sdmItem.floorD=floorD;
5845 sdmItem.a1=i;
5846 sdmItem.a2=j;
5847 sdmItem.sn=n;
5848 hma=true;
5849 }
5850 }
5851 if ((au[sdmItem.a1].an>-1)&&
5852 (au[sdmItem.a2].an>-1)&&
5853 ((au[sdmItem.a1].part*au[sdmItem.a2].part==0)||(au[sdmItem.a1].part==au[sdmItem.a2].part))){
5854 dddd=(Kovalenz_Radien[au[sdmItem.a1].an]+ Kovalenz_Radien[au[sdmItem.a2].an])*0.012;
5855 } else {
5856 dddd=0;
5857 }
5858 sdmItem.covalent=(sdmItem.d<dddd);
5859 if (hma) _sdm.append(sdmItem);
5860 }
5861
5862 }
5863 return _sdm;
5864 }
5865
sdmcompleter()5866 QStringList Molecule::sdmcompleter(){
5867 /*! Calculates the shortest distance matrix.
5868 * Counts the number of fragmets in the asymmetric unit.
5869 * Finds possible hydrogen bond contacts.
5870 * \returns internal symmtry code list for grown structures.
5871 */
5872 // George Sheldrick Seminar ideas
5873 // printf("sdm1 %d\n",__LINE__);
5874 // QTime zeit; zeit.start();
5875 //printf("sdmcompleter\n");
5876 double dk,dddd;
5877 V3 prime,dp,D,floorD;
5878 contact.clear();
5879 sdm.clear();
5880 SdmItem sdmItem;
5881 sdmItem.a1=0;
5882 sdmItem.a2=0;
5883 sdmItem.sn=0;
5884 SdmItem sdmItem2;
5885 sdmItem2.a1=0;
5886 sdmItem2.a2=0;
5887 sdmItem2.sn=0;
5888
5889 knoepfe.clear();
5890 Knopf kn;
5891 kn.neighbors.clear();
5892 for (int i=0; i<asymm.size(); i++){
5893 kn.neighbors.clear();
5894 for (int j=0; j<asymm.size(); j++ ){
5895 double min=1000000;
5896 bool hma=false;
5897 for (int n=0;n<cell.symmops.size(); n++){
5898 prime=cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n);
5899 D=prime - asymm.at(j).frac+ V3(0.5,0.5,0.5) ;
5900 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
5901 dp=D - floorD - V3(0.5,0.5,0.5);
5902 dk=fl(dp.x,dp.y,dp.z);
5903 if (n) dk+=0.0001;
5904 if ((dk>0.01)&&((min+0.00)>=dk)){
5905 min=fmin(dk,min);
5906 sdmItem.d=min;
5907 sdmItem.floorD=floorD;
5908 sdmItem.a1=i;
5909 sdmItem.a2=j;
5910 sdmItem.sn=n;
5911 hma=true;
5912 }
5913 }
5914 if ((asymm[sdmItem.a1].an>-1)&&(asymm[sdmItem.a2].an>-1)&&
5915 ((asymm[sdmItem.a1].part*asymm[sdmItem.a2].part==0)|| (asymm[sdmItem.a1].part==asymm[sdmItem.a2].part)))
5916 dddd=(Kovalenz_Radien[asymm[sdmItem.a1].an]+ Kovalenz_Radien[asymm[sdmItem.a2].an])*0.0115;
5917 else dddd=0;
5918 if (sdmItem.d<dddd){
5919 if (hma) kn.neighbors.append(j);
5920 sdmItem.covalent=true;
5921 } else {
5922 sdmItem.covalent=false;
5923 }
5924 //if ((sdmItem.sn!=0)&&((asymm[sdmItem.a1].part<0)||(asymm[sdmItem.a2].part<0))) sdmItem.covalent=false;
5925 if (hma) sdm.append(sdmItem);
5926 }
5927 neighborSort(kn);
5928 knoepfe.append(kn);
5929 }
5930
5931 for (int i=0; i<asymm.size(); i++){ //wasserstoffbrueckensuche
5932 for (int j=0; j<asymm.size(); j++ ){
5933 for (int nn=0;nn<cell.symmops.size(); nn++){
5934 prime=cell.symmops.at(nn) * asymm.at(i).frac + cell.trans.at(nn);
5935 D=prime - asymm.at(j).frac+ V3(0.5,0.5,0.5) ;
5936 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
5937 dp=D - floorD - V3(0.5,0.5,0.5);
5938 dk=fl(dp.x,dp.y,dp.z);
5939 if((1)&&(abs(asymm[i].an-7)<2)&&(abs(asymm[j].an-7)<2)&&(fabs(dk-2.775)<0.325)){//N O F mit abstanden zwischen 2.45 bis 3.1 A koennten H=Bruecken sein
5940 sdmItem2.d=dk;
5941 sdmItem2.floorD=floorD;
5942 sdmItem2.a1=i;
5943 sdmItem2.a2=j;
5944 sdmItem2.sn=nn;
5945 sdmItem2.covalent=true;
5946 double ang1=361,ang2=361,an;
5947 for (int oo=0; oo<knoepfe.at(i).neighbors.size(); oo++){
5948 an=wl(asymm.at(j).frac,
5949 cell.symmops.at(nn) * asymm.at(i).frac + cell.trans.at(nn)-floorD,
5950 cell.symmops.at(nn) * asymm.at(knoepfe.at(i).neighbors.at(oo)).frac + cell.trans.at(nn)-floorD);
5951 ang1=(an<ang1)?an:ang1;
5952 }
5953 for (int oo=0; oo<knoepfe.at(j).neighbors.size(); oo++){
5954 an=wl(
5955 cell.symmops.at(nn) * asymm.at(i).frac + cell.trans.at(nn)-floorD,
5956 asymm.at(j).frac,
5957 asymm.at(knoepfe.at(j).neighbors.at(oo)).frac);
5958 ang2=(an<ang2)?an:ang2;
5959 }
5960 /*printf("Paarschippen: %s %s %f %f %f %d\n",
5961 asymm.at(i).Label.toStdString().c_str(),
5962 asymm.at(j).Label.toStdString().c_str(),
5963 dk, ang1, ang2,((qMax(ang1,ang2)!=361)&&((qMin(ang1,ang2)<85)||(qMax(ang1,ang2)>180))));// */
5964 if ((qMax(ang1,ang2)!=361)&&((qMin(ang1,ang2)<85)||(qMax(ang1,ang2)>180))) sdmItem2.covalent=false;
5965 else {
5966 //printf("contact ok\n");
5967 contact.append(sdmItem2);
5968 }
5969 }
5970 }
5971 }
5972 }
5973 // printf("sdm3 %d\n",zeit.elapsed());//\n"); zeit.restart();
5974 QString bs;
5975 QStringList brauchSymm;
5976 int someleft=0,nextmol=0;
5977 maxmol=1;
5978 for (int i=0; i<asymm.size();i++) asymm[i].molindex=-1;
5979 asymm[0].molindex=1;//starter;
5980 do {
5981 nextmol=0;
5982 do {
5983 someleft=0;
5984 for (int i=0; i<sdm.size();i++){
5985 if ((sdm.at(i).covalent)&&(asymm[sdm.at(i).a1].molindex*asymm[sdm.at(i).a2].molindex<0)) {
5986 asymm[sdm.at(i).a1].molindex=maxmol;
5987 asymm[sdm.at(i).a2].molindex=maxmol;
5988 someleft++;
5989 }
5990 }
5991 }while (someleft);
5992 for ( int i=0; i<asymm.size();i++) {
5993 if ((asymm[i].an>-1)&&(asymm[i].molindex<0)) {nextmol=i;break;}
5994 }
5995 if (nextmol) {
5996 asymm[nextmol].molindex=(++maxmol);
5997 }
5998 }while (nextmol);
5999 Fragments=QString("<b>The asymmetric unit contains %1 fragments.</b><br>").arg(maxmol);
6000 for (int k =0; k<sdm.size();k++){
6001 if (sdm.at(k).covalent){
6002 if (asymm[sdm.at(k).a1].molindex<1) continue;
6003 if (asymm[sdm.at(k).a1].molindex>6) continue;
6004 for (int n=0;n<cell.symmops.size(); n++){
6005 if (((asymm[sdm.at(k).a1].part!=0)&&(asymm[sdm.at(k).a2].part!=0)&&(asymm[sdm.at(k).a1].part!=asymm[sdm.at(k).a2].part)))continue;
6006 if ((asymm[sdm.at(k).a1].an==asymm[sdm.at(k).a2].an)&&(asymm[sdm.at(k).a1].an==0)) continue;
6007 prime=cell.symmops.at(n) * asymm[sdm.at(k).a1].frac + cell.trans.at(n);
6008 D=prime - asymm[sdm.at(k).a2].frac+ V3(0.5,0.5,0.5) ;
6009 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
6010 dp=D - floorD - V3(0.5,0.5,0.5);
6011 if ((n==0)&&(V3(0,0,0)==floorD)) continue;
6012 dk=fl(dp.x,dp.y,dp.z);
6013 dddd=(sdm.at(k).d+0.2);
6014 if ((dk>0.001)&&(dddd>=dk)) {
6015 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm[sdm.at(k).a1].molindex);
6016 if ((!brauchSymm.contains(bs))) {
6017 brauchSymm.append(bs);
6018 // printf("%d %d %d %d [%d]\n",n+1,(int)floorD.x,(int)floorD.y,(int)floorD.z ,brauchSymm.size());
6019 }
6020 }
6021 }
6022 }
6023 }
6024 // printf("sdm4 %d\n",zeit.elapsed()); zeit.restart();
6025 #if (QT_VERSION >= 0x050000)
6026 std::sort(sdm.begin(),sdm.end());
6027 #else
6028 qSort(sdm.begin(),sdm.end());
6029 #endif
6030 // printf("sdm5 %d\n",zeit.elapsed());//\n"); zeit.restart();
6031 enviSDM(2.5);
6032 // printf("sdm5 %d\n",zeit.elapsed());//\n"); zeit.restart();
6033
6034 QList<int> flags;
6035 for (int i=0; i<asymm.size(); i++) flags.append((asymm.at(i).an<0)?-1:1);
6036 for (int i=0; i<envi_sdm.size(); i++){
6037 if ((flags.at(envi_sdm.at(i).a1)*flags.at(envi_sdm.at(i).a2))==-1) {
6038 //if ((qbeforehkl)||((flags.at(sdm.at(i).a1)==-1)&&((asymm.at(sdm.at(i).a2).an>-1)))){
6039 // if (((asymm[envi_sdm.at(i).a1].Label=="Q11")||(asymm[envi_sdm.at(i).a2].Label=="Q11"))&&(envi_sdm.at(i).d<2.6))
6040 // qDebug()<<asymm[envi_sdm.at(i).a1].Label<<asymm[envi_sdm.at(i).a2].Label<<envi_sdm.at(i).d<<flags[envi_sdm.at(i).a1]<<flags[envi_sdm.at(i).a2];
6041 if (asymm[envi_sdm.at(i).a1].an>-1) continue;
6042 if (asymm[envi_sdm.at(i).a1].an==-66) continue;
6043 if ((envi_sdm.at(i).sn==0)&&(envi_sdm.at(i).floorD==V3(0,0,0))) {flags[envi_sdm.at(i).a1]=1;continue;}
6044 if (envi_sdm.at(i).d>2.4) continue;
6045 asymm[envi_sdm.at(i).a1].frac = cell.symmops.at(envi_sdm.at(i).sn) * asymm[envi_sdm.at(i).a1].frac + cell.trans.at(envi_sdm.at(i).sn) - envi_sdm.at(i).floorD;
6046 flags[envi_sdm.at(i).a1]=1;
6047 frac2kart(asymm[envi_sdm.at(i).a1].frac,asymm[envi_sdm.at(i).a1].pos);
6048 //}
6049 }
6050 }
6051 // printf("sdm6 %d\n",zeit.elapsed()); zeit.restart();
6052 return brauchSymm;
6053 }
6054
connecting(const CEnvironment & atom,bool eac)6055 Connection Molecule::connecting(const CEnvironment &atom,bool eac){
6056 /*! Creates bonds and lbonds depending on covalent radii.
6057 * If edit atom style flag (eac) is not set FREE and BIND instructions are considered.
6058 * Feeds also Molecule.knoepfe list.
6059 * \returns the Connection bond list.
6060 * */
6061 Connection bonds;
6062 bonds.clear();
6063 lbonds.clear();
6064 MyBond bond;
6065 double soll=0;
6066 for (int i=0; i<atom.size(); i++){
6067 for (int j=0; j<=i; j++ ){
6068 double d = sqrt(Distance(atom.at(i).pos,atom.at(j).pos));
6069 if ((atom.at(i).an>-1)&&(atom.at(j).an>-1)&&(atom.at(i).part!=0)&&(atom.at(j).part!=0)&&((bindPart.key(atom.at(i).part)==atom.at(j).part)||(bindPart.value(atom.at(i).part)==atom.at(j).part)))
6070 soll=(Kovalenz_Radien[atom.at(i).an]+ Kovalenz_Radien[atom.at(j).an])*0.012;
6071 else {
6072 if ((atom.at(i).part<0)&&(atom.at(j).part!=0)&&(atom.at(i).symmGroup!=atom.at(j).symmGroup)) continue;
6073 if ((atom.at(j).part<0)&&(atom.at(i).part!=0)&&(atom.at(i).symmGroup!=atom.at(j).symmGroup)) continue;
6074 if ((atom.at(i).an==0)&&(atom.at(j).an==0)) continue;
6075 if ((atom.at(i).an>-1)&&(atom.at(j).an>-1)&&
6076 ((!atom.at(i).part)||(!atom.at(j).part)||(atom.at(i).part==atom.at(j).part)))
6077 soll=(Kovalenz_Radien[atom.at(i).an]+ Kovalenz_Radien[atom.at(j).an])*0.012;
6078 else
6079 soll=-1;
6080 }
6081 if ((d>0.1)&&(d<soll)) {
6082 bond.ato1=&atom[i];
6083 bond.ato2=&atom[j];
6084 bond.a1=i;
6085 bond.a2=j;
6086 bond.length=d;
6087 bonds.append(bond);
6088 }
6089 else if ((d<qboMax)&&(d>qboMin)){
6090 if ((atom.at(i).an==-42)||(atom.at(j).an==-42)) continue;//belo: wuff!
6091 if ((atom.at(i).an==0)||(atom.at(j).an==0)) continue;
6092 if ((!atom.at(i).part)||(!atom.at(j).part)||(atom.at(i).part==atom.at(j).part)){
6093 bond.ato1=&atom[i];
6094 bond.ato2=&atom[j];
6095 bond.a1=i;
6096 bond.a2=j;
6097 bond.length=d;
6098 lbonds.append(bond);
6099 }
6100 }
6101 }
6102 }
6103 //centroid metal bonds ... just normal bonds but bonds between metal and nonmetal that are close to the centroid will be removed.
6104 if (!eac) {
6105 bool weHaveCentroids=false;
6106 bool weHaveMetals=false;
6107 for (int i=0; i<atom.size(); i++){
6108 if (AtomStyle[atom.at(i).an]&ATOM_STYLE_METAL){weHaveMetals=true;break;}
6109 }
6110 for (int i=0; i<atom.size(); i++){
6111 if (atom.at(i).an==-66){weHaveCentroids=true;break;}
6112 }
6113 if (weHaveMetals && weHaveCentroids){
6114 // printf("(weHaveMetals && weHaveCentroids)\n");
6115 for (int i=0; i<atom.size(); i++){
6116 if (atom.at(i).an==-66){
6117 for (int j=0;j<atom.size();j++){
6118 if (atom.at(j).an<1) continue;
6119 //printf("%d %d i=%d j=%d size=%d\n",atom.at(i).an,atom.at(j).an,i,j,atom.size());
6120 if ((AtomStyle[atom.at(j).an]&ATOM_STYLE_METAL)==0)continue;
6121 soll=(70+Kovalenz_Radien[atom.at(j).an])*0.012;
6122 double d = sqrt(Distance(atom.at(i).pos,atom.at(j).pos));
6123 if (d<soll){//add the centroid metal bond
6124 bond.ato1=&atom[i];
6125 bond.ato2=&atom[j];
6126 bond.a1=i;
6127 bond.a2=j;
6128 bond.length=d;
6129 for (int k=0;k<bonds.size();k++){
6130 if ((bonds.at(k).a1==j)&&(atom.at(bonds.at(k).a2).an>0)&&((AtomStyle[atom.at(bonds.at(k).a2).an]&ATOM_STYLE_METAL)==0)){
6131 d = sqrt(Distance(atom.at(i).pos,atom.at(bonds.at(k).a2).pos));//re-use d distance cnt -- non metal
6132 if ((d<qboMax)&&(d>qboMin)){
6133 bonds.removeAt(k);
6134 // printf("1Removed metal non metal bond %s == %s\n",bonds.at(k).ato1->Label.toStdString().c_str(),bonds.at(k).ato2->Label.toStdString().c_str());
6135 k=(k>0)?k-1:0;
6136 }
6137 }//a1 is a metal
6138 if ((bonds.at(k).a2==j)&&(atom.at(bonds.at(k).a1).an>0)&&((AtomStyle[atom.at(bonds.at(k).a1).an]&ATOM_STYLE_METAL)==0)){
6139 d = sqrt(Distance(atom.at(i).pos,atom.at(bonds.at(k).a1).pos));//re-use d distance cnt -- non metal
6140 if ((d<qboMax)&&(d>qboMin)){
6141 bonds.removeAt(k);
6142 //printf("2Removed metal non metal bond %s == %s\n",bonds.at(k).ato1->Label.toStdString().c_str(),bonds.at(k).ato2->Label.toStdString().c_str());
6143 k=(k>0)?k-1:0;
6144 }
6145 }//a1 is a metal
6146 }//k
6147 bonds.append(bond);
6148 }//cnt metal contact
6149 }//j
6150 }//centroid
6151 }//i
6152 }//metals and centroids present
6153 }//!eac
6154 if (!eac) for (int i=0; i<freeatoms.size(); i++){
6155 MyAtom a1, a2;
6156 bool bo=false;
6157 if (freeatoms.at(i).Lab1.contains('_')) a1.resiNr=freeatoms.at(i).Lab1.section('_',1,1).toInt(&bo);
6158 if (!bo) a1.resiNr=-1;
6159 if (freeatoms.at(i).Lab2.contains('_'))a2.resiNr=freeatoms.at(i).Lab2.section('_',1,1).toInt(&bo);
6160 if (!bo)a2.resiNr=-1;
6161 a1.Label = freeatoms.at(i).Lab1.section('_',0,0);
6162 a2.Label = freeatoms.at(i).Lab2.section('_',0,0);
6163 //printf("#%d %d\n",a2.resiNr,a1.resiNr);
6164
6165 for (int j=0;j<bonds.size();j++){
6166 if (((a1.resiNr>-1)&& (bonds.at(j).ato1->resiNr!=a1.resiNr))||
6167 ((a2.resiNr>-1)&& (bonds.at(j).ato2->resiNr!=a2.resiNr))) continue;
6168 if (((a1.resiNr>-1)&& (bonds.at(j).ato2->resiNr!=a1.resiNr))||
6169 ((a2.resiNr>-1)&& (bonds.at(j).ato1->resiNr!=a2.resiNr))) continue;
6170 if (((bonds.at(j).ato1->Label.section('_',0,0).toUpper()== a1.Label)&&
6171 (bonds.at(j).ato2->Label.section('_',0,0).toUpper()== a2.Label))||
6172 ((bonds.at(j).ato2->Label.section('_',0,0).toUpper()== a1.Label)&&
6173 (bonds.at(j).ato1->Label.section('_',0,0).toUpper()== a2.Label))){
6174 bonds.removeAt(j);
6175 j=qMax(j-1,0);
6176 }
6177 }
6178 }
6179 if (!eac) for (int i=0; i<bindatoms.size(); i++){
6180 MyAtom a1, a2;
6181 bool bo=false;
6182 int sy1=-1,sy2=-1;
6183 if (bindatoms.at(i).Lab1.contains("_$"))sy1=bindatoms.at(i).Lab1.section("_$",1,1).toInt(&bo);
6184 if (bindatoms.at(i).Lab2.contains("_$"))sy2=bindatoms.at(i).Lab2.section("_$",1,1).toInt(&bo);
6185 bo=false;
6186 if (bindatoms.at(i).Lab1.contains('_'))a1.resiNr=bindatoms.at(i).Lab1.section('_',1,1).toInt(&bo);
6187 if (!bo) a1.resiNr=-1;
6188 if (bindatoms.at(i).Lab2.contains('_'))a2.resiNr=bindatoms.at(i).Lab2.section('_',1,1).toInt(&bo);
6189 if (!bo)a2.resiNr=-1;
6190 a1.Label = bindatoms.at(i).Lab1.section('_',0,0);
6191 a2.Label = bindatoms.at(i).Lab2.section('_',0,0);
6192 //printf("#>%d %d %d %d [%d]\n",a2.resiNr,a1.resiNr,sy1,sy2,i);
6193 double mindd=50.0;
6194 //printf("-Q %d\n",eqivMap.size());
6195 if ((!eqivMap.isEmpty())&&(qMax(sy1,sy2)>0)) {
6196 // printf("sg %d\n",eqivMap.value(QString("$%1").arg(sy2)));
6197 // printf("%s %s\n",a1.Label.toUpper().toStdString().c_str(),a2.Label.toUpper().toStdString().c_str());
6198 for (int iii=0; iii<atom.size(); iii++){
6199 for (int jjj=0; jjj<atom.size(); jjj++){
6200 if ((a1.resiNr>-1)&& (atom.at(iii).resiNr!=a1.resiNr)) continue;
6201 if ((a2.resiNr>-1)&& (atom.at(jjj).resiNr!=a2.resiNr)) continue;
6202 if ((sy1>-0)&&(atom.at(iii).symmGroup==0)) continue;
6203 if ((sy2>-0)&&(atom.at(jjj).symmGroup==0)) continue;
6204 //printf("sg %d\n",eqivMap.value(QString("$%1").arg(sy1)));
6205 if ((sy1>-0)&&(eqivMap.value(QString("$%1").arg(sy1))!=atom.at(iii).symmGroup)) continue;
6206 if ((sy2>-0)&&(eqivMap.value(QString("$%1").arg(sy2))!=atom.at(jjj).symmGroup)) continue;
6207 if ((atom.at(iii).Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper() == a1.Label.toUpper())&&
6208 (atom.at(jjj).Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper() == a2.Label.toUpper())){
6209 bond.ato1=&atom[iii];
6210 bond.ato2=&atom[jjj];
6211 bond.a1=iii;
6212 bond.a2=jjj;
6213 bond.length=sqrt(Distance(atom[iii].pos,atom[jjj].pos));
6214 //printf("%g %f\n",bond.length,mindd);
6215 if ((mindd+0.01)>=bond.length) bonds.append(bond);
6216 if (bond.length>0.7) mindd=qMin(bond.length, mindd);
6217
6218 }
6219 }
6220 }
6221 }
6222 for (int j=0; j < bonds.size(); j++){
6223 if (((bonds.at(j).ato1->Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper()==a1.Label.toUpper())&&
6224 (bonds.at(j).ato2->Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper()==a2.Label.toUpper()))||
6225 ((bonds.at(j).ato1->Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper()==a2.Label.toUpper())&&
6226 (bonds.at(j).ato2->Label.section('_',0,0).section(QString::fromUtf8("»"),0,0).toUpper()==a1.Label.toUpper())))
6227 if (bonds.at(j).length>(mindd+0.1)) {
6228 double d=bonds.at(j).length;
6229 // printf("-- %f %f\n",d,mindd);
6230 bonds.removeAt(j);
6231 if (j) j--;
6232 }
6233 }
6234 }
6235 //-->Verknopfung !!!
6236 if (!eac){
6237 for (int i=0; i<knoepfe.size();i++) knoepfe[i].neighbors.clear();
6238 knoepfe.clear();
6239 Knopf kn;
6240 kn.neighbors.clear();
6241 for (int i=0; i<atom.size(); i++){
6242 kn.neighbors.clear();
6243 for (int j=0; j<bonds.size(); j++){
6244 if (bonds.at(j).a1==i){
6245 kn.neighbors.append(bonds.at(j).a2);
6246 }
6247 if (bonds.at(j).a2==i){
6248 kn.neighbors.append(bonds.at(j).a1);
6249 }
6250 }
6251 neighborSort(kn);
6252 knoepfe.append(kn);
6253 }
6254 }
6255 return bonds;
6256 }
6257
fl(double x,double y,double z)6258 double Molecule::fl(double x,double y,double z){
6259 double a,b,c;
6260 a = (cell.ga==90.0)?0.0:2.0*x*y*cell.a*cell.b*cell.cosga;
6261 b = (cell.be==90.0)?0.0:2.0*x*z*cell.a*cell.c*cell.cosbe;
6262 c = (cell.al==90.0)?0.0:2.0*y*z*cell.b*cell.c*cell.cosal;
6263 double erg=sqrt(x*x*cell.a*cell.a+
6264 y*y*cell.b*cell.b+
6265 z*z*cell.c*cell.c+
6266 a+b+c);
6267 return erg;
6268 }
6269
wl(V3 p2,V3 p1,V3 p3)6270 double Molecule::wl(V3 p2, V3 p1, V3 p3){
6271 V3 f1=p2-p1;//12
6272 V3 f2=p3-p1;//13
6273 V3 f3=p3-p2;//23
6274 double a=0,b=0,c=0;
6275 a = (cell.ga==90.0)?0.0:2.0*f1.x*f1.y*cell.a*cell.b*cell.cosga;
6276 a += (cell.be==90.0)?0.0:2.0*f1.x*f1.z*cell.a*cell.c*cell.cosbe;
6277 a += (cell.al==90.0)?0.0:2.0*f1.y*f1.z*cell.b*cell.c*cell.cosal;
6278
6279 b = (cell.ga==90.0)?0.0:2.0*f2.x*f2.y*cell.a*cell.b*cell.cosga;
6280 b += (cell.be==90.0)?0.0:2.0*f2.x*f2.z*cell.a*cell.c*cell.cosbe;
6281 b += (cell.al==90.0)?0.0:2.0*f2.y*f2.z*cell.b*cell.c*cell.cosal;
6282
6283 c = ( cell.ga==90.0)?0.0:2.0*f3.x*f3.y*cell.a*cell.b*cell.cosga;
6284 c += (cell.be==90.0)?0.0:2.0*f3.x*f3.z*cell.a*cell.c*cell.cosbe;
6285 c += (cell.al==90.0)?0.0:2.0*f3.y*f3.z*cell.b*cell.c*cell.cosal;
6286 double d12,d13,d23;
6287 d12 = f1.x*f1.x*cell.a*cell.a+
6288 f1.y*f1.y*cell.b*cell.b+
6289 f1.z*f1.z*cell.c*cell.c+a;
6290 d13 = f2.x*f2.x*cell.a*cell.a+
6291 f2.y*f2.y*cell.b*cell.b+
6292 f2.z*f2.z*cell.c*cell.c+b;
6293 d23 = f3.x*f3.x*cell.a*cell.a+
6294 f3.y*f3.y*cell.b*cell.b+
6295 f3.z*f3.z*cell.c*cell.c+c;
6296 double erg=acos((d12+d13-d23)/(2.0*sqrt(d12)*sqrt(d13)))*g2r;
6297 return erg;
6298 }
6299
cellSetup()6300 void Molecule::cellSetup(){
6301 cell.cosal=cos(cell.al/g2r);
6302 cell.cosbe=cos(cell.be/g2r);
6303 cell.cosga=cos(cell.ga/g2r);
6304 cell.sinal=sin(cell.al/g2r);
6305 cell.sinbe=sin(cell.be/g2r);
6306 cell.singa=sin(cell.ga/g2r);
6307 cell.tanga=tan(cell.ga/g2r);
6308 cell.phi= sqrt(1-(cell.cosal*cell.cosal)-
6309 (cell.cosbe*cell.cosbe)-(cell.cosga*cell.cosga)
6310 +2*cell.cosal*cell.cosbe*cell.cosga);
6311 cell.tau=cell.c *((cell.cosal- cell.cosbe* cell.cosga)/ cell.singa);
6312 cell.V = cell.a*cell.b*cell.c*cell.phi;
6313 cell.as=cell.c*cell.b*cell.sinal/cell.V;
6314 cell.bs=cell.c*cell.a*cell.sinbe/cell.V;
6315 cell.cs=cell.a*cell.b*cell.singa/cell.V;
6316 cell.cosra = (cell.cosbe*cell.cosga-cell.cosal)/(cell.sinbe*cell.singa);
6317 cell.cosrb = (cell.cosga*cell.cosal-cell.cosbe)/(cell.singa*cell.sinal);
6318 cell.cosrg = (cell.cosal*cell.cosbe-cell.cosga)/(cell.sinal*cell.sinbe);
6319 cell.G.m11=cell.a*cell.a;
6320 cell.G.m22=cell.b*cell.b;
6321 cell.G.m33=cell.c*cell.c;
6322 cell.G.m12=cell.G.m21=cell.a*cell.b*cell.cosga;
6323 cell.G.m13=cell.G.m31=cell.a*cell.c*cell.cosbe;
6324 cell.G.m23=cell.G.m32=cell.b*cell.c*cell.cosal;
6325 cell.Gi=inverse(cell.G);
6326 }
6327
applyLatticeCentro(int gitter)6328 void Molecule::applyLatticeCentro(int gitter){
6329 /*! Adds centrings and inversion symmetry to the symmops and trans list.
6330 * @param gitter the parameter of the shelx LATT instruction. ==> see Shelxl manual.
6331 */
6332 int z=cell.symmops.size();
6333 cell.ns0=z;
6334 Matrix inv(-1.0,0.0,0.0, 0.0,-1.0,0.0, 0.0,0.0,-1.0);
6335 cell.centeric=false;
6336 if (gitter>0){
6337 for (int i=0; i<z;i++){
6338 Matrix m=cell.symmops.at(i)*inv;
6339 cell.symmops.append(m);
6340 cell.trans.append(cell.trans.at(i));
6341 }
6342 cell.centeric=true;
6343 }
6344 latt=gitter;
6345 gitter=(gitter>0)?gitter:-gitter;
6346 z=cell.symmops.size();
6347 cell.centered=false;
6348 switch (gitter){
6349 case 5 :
6350 for (int i=0; i<z;i++){
6351 V3 tt = cell.trans.at(i)+V3(0.0, 0.5, 0.5);
6352 tt.x=(tt.x>1)?tt.x-1:tt.x;
6353 tt.y=(tt.y>1)?tt.y-1:tt.y;
6354 tt.z=(tt.z>1)?tt.z-1:tt.z;
6355 cell.symmops.append(cell.symmops.at(i));
6356 cell.trans.append(tt);
6357 cell.centered=true;
6358 }
6359 break;
6360 case 6 :
6361 for (int i=0; i<z;i++){
6362 V3 tt = cell.trans.at(i)+V3(0.5, 0.0, 0.5);
6363 tt.x=(tt.x>1)?tt.x-1:tt.x;
6364 tt.y=(tt.y>1)?tt.y-1:tt.y;
6365 tt.z=(tt.z>1)?tt.z-1:tt.z;
6366 cell.symmops.append(cell.symmops.at(i));
6367 cell.trans.append(tt);
6368 cell.centered=true;
6369 }
6370 break;
6371 case 7 :
6372 for (int i=0; i<z;i++){
6373 V3 tt = cell.trans.at(i)+V3(0.5, 0.5, 0.0);
6374 tt.x=(tt.x>1)?tt.x-1:tt.x;
6375 tt.y=(tt.y>1)?tt.y-1:tt.y;
6376 tt.z=(tt.z>1)?tt.z-1:tt.z;
6377 cell.symmops.append(cell.symmops.at(i));
6378 cell.trans.append(tt);
6379 cell.centered=true;
6380 }
6381 break;
6382 case 4 :
6383 for (int i=0; i<z;i++){
6384 V3 tt = cell.trans.at(i)+V3(0.0, 0.5, 0.5);
6385 tt.x=(tt.x>1)?tt.x-1:tt.x;
6386 tt.y=(tt.y>1)?tt.y-1:tt.y;
6387 tt.z=(tt.z>1)?tt.z-1:tt.z;
6388 cell.symmops.append(cell.symmops.at(i));
6389 cell.trans.append(tt);
6390 tt = cell.trans.at(i)+V3(0.5, 0.0, 0.5);
6391 tt.x=(tt.x>1)?tt.x-1:tt.x;
6392 tt.y=(tt.y>1)?tt.y-1:tt.y;
6393 tt.z=(tt.z>1)?tt.z-1:tt.z;
6394 cell.symmops.append(cell.symmops.at(i));
6395 cell.trans.append(tt);
6396 tt = cell.trans.at(i)+V3(0.5, 0.5, 0.0);
6397 tt.x=(tt.x>1)?tt.x-1:tt.x;
6398 tt.y=(tt.y>1)?tt.y-1:tt.y;
6399 tt.z=(tt.z>1)?tt.z-1:tt.z;
6400 cell.symmops.append(cell.symmops.at(i));
6401 cell.trans.append(tt);
6402 cell.centered=true;
6403 }
6404 break;
6405 case 2 :
6406 for (int i=0; i<z;i++){
6407 V3 tt = cell.trans.at(i)+V3(0.5, 0.5, 0.5);
6408 tt.x=(tt.x>1)?tt.x-1:tt.x;
6409 tt.y=(tt.y>1)?tt.y-1:tt.y;
6410 tt.z=(tt.z>1)?tt.z-1:tt.z;
6411 cell.symmops.append(cell.symmops.at(i));
6412 cell.trans.append(tt);
6413 cell.centered=true;
6414 }
6415 break;
6416 case 3 :
6417 for (int i=0; i<z;i++){
6418 V3 tt = cell.trans.at(i)+V3(2.0/3.0, 1.0/3.0, 1.0/3.0);
6419 tt.x=(tt.x>1)?tt.x-1:tt.x;
6420 tt.y=(tt.y>1)?tt.y-1:tt.y;
6421 tt.z=(tt.z>1)?tt.z-1:tt.z;
6422 cell.symmops.append(cell.symmops.at(i));
6423 cell.trans.append(tt);
6424 tt = cell.trans.at(i)+V3(1.0/3.0, 2.0/3.0, 2.0/3.0);
6425 tt.x=(tt.x>1)?tt.x-1:tt.x;
6426 tt.y=(tt.y>1)?tt.y-1:tt.y;
6427 tt.z=(tt.z>1)?tt.z-1:tt.z;
6428 cell.symmops.append(cell.symmops.at(i));
6429 cell.trans.append(tt);
6430 cell.centered=true;
6431
6432 }
6433 break;
6434 case 0 :break;
6435 }
6436 /*
6437 for (int i=0; i<cell.symmops.size();i++){
6438 int r=rankMySymmOp(cell.symmops.at(i),cell.trans.at(i));
6439 printf("#%d rank %d %s\n",i,r,symmcode2human(i).toStdString().c_str());
6440 }
6441 */
6442
6443 }
6444
dimension()6445 double Molecule::dimension(){
6446 /*! calculates the maximal interatomic distance (Ang) of showatoms environment if this is 0 then 10.0 is returned instead.
6447 */
6448 double max=0,gg=0;
6449 for (int i=0;i<showatoms.size();i++)
6450 for (int j=i+1;j<showatoms.size();j++){
6451 if ((showatoms[j].an>=0)&&(showatoms[j].an>=0))
6452 gg=sqrt( Distance(showatoms[i].pos,showatoms[j].pos));
6453 max=(max<gg)?gg:max;
6454 }
6455 if (max==0) return 10.0;
6456 return max;
6457 }
6458
dimension(CEnvironment ce)6459 double Molecule::dimension(CEnvironment ce){
6460 /*! calculates the maximal interatomic distance (Ang) of showatoms environment if this is 0 then 10.0 is returned instead.
6461 */
6462 double max=0,gg=0;
6463 for (int i=0;i<ce.size();i++)
6464 for (int j=i+1;j<ce.size();j++){
6465 if ((ce[j].an>=0)&&(ce[j].an>=0))
6466 gg=sqrt( Distance(ce[i].pos,ce[j].pos));
6467 max=(max<gg)?gg:max;
6468 }
6469 if (max==0) return 10.0;
6470 return max;
6471 }
6472
6473 #define Ato4d(arr) arr[0], arr[1], arr[2], arr[3]
6474 #include <QGLWidget>
6475
atoms(CEnvironment atom,int proba,double radScal)6476 void Molecule::atoms(CEnvironment atom,int proba, double radScal){
6477 /*! Draws atoms as spheres or as ellipses cubes or icosahedrons.
6478 * @params atoms list of atoms to be drawn .
6479 * @params proba ellipsoid probability (currently 10 30 50 70 90 %).
6480 *
6481 * Molecule.dratom controls the wireframe style of the resulting atom .
6482 *
6483 * Molecule.tubes atom balls is drawn in bondstrength.
6484 *
6485 * Molecule.adp atom is drawn as a ellipsoid.
6486 *
6487 * Molecule.monoQrom Q-Peaks are drawn in Color Molecule.mQolor .
6488 * */
6489 if (atom.isEmpty())return;
6490 if (shaders_work&&g_program&&useShaders&&(g_Program!=nullptr)) {
6491 Licht=1;
6492 g_Program->bind();
6493 g_Program->setUniformValue(lichtH,1);
6494 /*glGetUniformiv(g_program,lichtH,&Licht);
6495 if (!Licht) {
6496 int ect=0;
6497 GLenum err = GL_NO_ERROR;
6498 while((err = glGetError()) != GL_NO_ERROR)
6499 {
6500 printf("DAVOR %d %d [%d]\n",err==GL_INVALID_VALUE ,err == GL_INVALID_OPERATION,++ect);
6501 }
6502 }*/
6503 shaderAtoms(atom, proba, radScal);
6504 g_Program->release();
6505 return;
6506 }//else{printf("%d %d %d %p\n",shaders_work,g_program,useShaders,g_Program);}
6507 int myAdp=adp;
6508 int myStyle=7;
6509 int pminus=0;
6510 int wire=0;
6511 GLfloat white[4]={0.2f, 0.2f, 0.3f, 0.0f};
6512 GLfloat black[4]={0.0f, 0.0f, 0.0f, 1.0f};
6513 for (int i=0; i<atom.size();i++){
6514 if ((!dratom)&&(atom.at(i).hidden)) continue;
6515 if ((nopm1)&&(atom.at(i).symmGroup)&&(atom.at(i).part<0))continue;
6516 if ((dratom==2)&&(atom.at(i).part==0))continue;
6517 if ((dratom==2)&&(atom.at(i).symmGroup)&&(atom.at(i).part<0))continue;
6518 if ((dratom==2)&&(atom.at(i).hidden))continue;
6519 if ((dratom==5)&&(atom.at(i).hidden))continue;
6520 int nonPositiveDefinite=0;
6521 glPushMatrix();
6522 nonPositiveDefinite=0;
6523 glTranslated(atom.at(i).pos.x,atom.at(i).pos.y,atom.at(i).pos.z);
6524 double rad=(atom.at(i).an==-2)?0.5:qPeakRad;
6525 bool parthigh=false;
6526 if (dratom==5){
6527 wire=1;
6528 dratom=0;
6529 }
6530 if (dratom==2) {
6531 dratom=0;
6532 parthigh=true;
6533 }
6534 if (!dratom){
6535 // printf("ph %d alpha %g tubes %d,myAdp %d %d\n",parthigh,AtomColor[atom.at(i).an].alphaF(),tubes,myAdp,((!myAdp)||((myStyle&ATOM_STYLE_SPHERE)&&(!(myStyle&ATOM_STYLE_SOLID)))));
6536 if (atom.at(i).an>-1) {
6537 myStyle=AtomStyle[atom.at(i).an];
6538 //printf("style: %X\n",myStyle);
6539 if (atom.at(i).Label.contains("(noADP)")) myStyle|=ATOM_STYLE_NOADP;
6540 glColor4d(AtomColor[atom.at(i).an].redF(),
6541 AtomColor[atom.at(i).an].greenF(),
6542 AtomColor[atom.at(i).an].blueF(),
6543 AtomColor[atom.at(i).an].alphaF());
6544 rad=arad[atom.at(i).an];
6545 if (parthigh) {
6546 QColor pcolor=PartColor::color(atom.at(i).part);
6547 if (atom.at(i).part==666) pcolor.setAlpha(200);
6548 else pcolor.setAlpha(140);
6549 glColor4d(pcolor.redF(),
6550 pcolor.greenF(),
6551 pcolor.blueF(),
6552 pcolor.alphaF());
6553 }
6554
6555 if ((highlightEquivalents)&&(!parthigh)&&(atom.at(i).symmGroup)) {
6556 glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,white );
6557 glColor4d(qMin(1.0,(AtomColor[atom.at(i).an].redF()+0.1) * 1.2),
6558 qMin(1.0,(AtomColor[atom.at(i).an].greenF()+0.1) * 1.2),
6559 qMin(1.0,(AtomColor[atom.at(i).an].blueF()+0.1) * 1.2),
6560 1.0);
6561 }
6562 else glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,black );
6563 if ((atom.at(i).symmGroup)&&(atom.at(i).part<0)){
6564 glColor4d(AtomColor[atom.at(i).an].redF(),
6565 AtomColor[atom.at(i).an].greenF(),
6566 1.0,
6567 0.3);
6568 pminus=1;
6569 // myStyle|=ATOM_STYLE_NOADP;
6570 }
6571 myAdp=(myStyle&ATOM_STYLE_NOADP)?0:adp;
6572 }
6573 if (wire) {myStyle|=ATOM_STYLE_SPHERE;if (myStyle&ATOM_STYLE_SOLID)myStyle-=ATOM_STYLE_SOLID; }
6574 if (tubes){
6575 rad=bondStrength;
6576 if (atom.at(i).part==666) rad*=4.5;
6577 myAdp=0;
6578 nonPositiveDefinite=0;
6579 }
6580
6581 if ((atom.at(i).an<0)||(atom.at(i).Label.startsWith('Q',Qt::CaseInsensitive))){
6582 glColor4d(1.0 ,0.7, 0.8 ,0.4);
6583 if (atom.at(i).an==-66) {
6584 rad*=2;
6585 glColor4d(0.6,0.3,0.1,0.3);
6586 dodecaeder(rad);
6587 }else{
6588 if((atom.at(i).an==-1)&&(!monoQrom)) Farbverlauf(atom.at(i).peakHeight, pmin, pmax);
6589 if (monoQrom) glColor3d(mQolor.redF(),mQolor.greenF(),mQolor.blueF());
6590 // if (!wire)
6591 icosaeder(rad);
6592 }
6593 }
6594 else {
6595 if (myAdp){
6596 V3 ev=V3(0,0,0);
6597 double *arr=jacobi(atom.at(i).uc,ev);
6598 if ((ev.x>0)&&(ev.y>0)&&(ev.z>0)){
6599 nonPositiveDefinite=0;
6600 glRotated(Ato4d(arr));
6601 double psc=(parthigh)?1.32:1.0;
6602 if (atom.at(i).part==666) psc*=1.2;
6603 switch (proba ) {
6604 case 10 :{ glScaled(0.76*sqrt(ev.x)*psc,0.76*sqrt(ev.y)*psc,0.76*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 10% Wahrscheinlichkeit
6605 case 30 :{ glScaled(1.19*sqrt(ev.x)*psc,1.19*sqrt(ev.y)*psc,1.19*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 30% Wahrscheinlichkeit
6606 case 50 :{ glScaled(1.54*sqrt(ev.x)*psc,1.54*sqrt(ev.y)*psc,1.54*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 50% Wahrscheinlichkeit
6607 case 70 :{ glScaled(1.91*sqrt(ev.x)*psc,1.91*sqrt(ev.y)*psc,1.91*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 70% Wahrscheinlichkeit
6608 case 90 :{ glScaled(2.50*sqrt(ev.x)*psc,2.50*sqrt(ev.y)*psc,2.50*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 90% Wahrscheinlichkeit
6609 default: ;
6610 }
6611 }else {nonPositiveDefinite=1;}
6612 }
6613
6614 if (parthigh) {
6615 rad*=1.32;
6616 if (atom.at(i).part==666) rad*=1.2;
6617 glEnable(GL_BLEND);
6618 myStyle&=(ATOM_STYLE_SPHERE|ATOM_STYLE_NOADP);
6619 myStyle|=ATOM_STYLE_SPHERE;
6620 }
6621
6622 /*
6623 #define ATOM_STYLE_WALLS 1
6624 #define ATOM_STYLE_RINGS 2
6625 #define ATOM_STYLE_SPHERE 4
6626 #define ATOM_STYLE_SOLID 8
6627 #define ATOM_STYLE_WHITERING 16
6628 #define ATOM_STYLE_NOLABEL 32
6629 */
6630 if (atom.at(i).an>-1) {
6631 if (myAdp&&intern) {
6632 if (!nonPositiveDefinite) ellipse(myStyle);
6633 else {
6634 cube(rad);
6635 }
6636
6637 }
6638 else if ((!myAdp)||((myStyle&ATOM_STYLE_SPHERE)&&(!(myStyle&ATOM_STYLE_SOLID)))){
6639 rad*=radScal;
6640 if (!myAdp) glScaled(rad,rad,rad);
6641 if (!nonPositiveDefinite) {
6642 if (wire)dratom =5;
6643 sphere(myAdp|pminus);
6644 }
6645 else {
6646 cube(rad);
6647 }
6648 }
6649 }
6650 else
6651 icosaeder(rad);
6652 }
6653 }
6654 else{
6655 atom[i].hidden=0;
6656 sphere(0);
6657 }
6658 // glEnable(GL_COLOR_MATERIAL);
6659 glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,black );
6660 glPopMatrix();
6661 if (parthigh) dratom=2;
6662 }
6663 }
6664
billBoard()6665 void Molecule::billBoard(){
6666 const GLfloat v[]={
6667 0.f,0.f,0.f,
6668 1.f,0.f,0.f,
6669 1.f,1.f,0.f,
6670 0.f,1.f,0.f,
6671 0.f,0.f,0.f,
6672 1.f,1.f,0.f
6673 };
6674 glEnableClientState(GL_VERTEX_ARRAY);
6675 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
6676 glVertexPointer(3, GL_FLOAT, 0, v);
6677 glTexCoordPointer(3, GL_FLOAT, 0, v);
6678 glDrawArrays(GL_TRIANGLES, 0, 6);
6679 glDisableClientState(GL_VERTEX_ARRAY);
6680 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
6681 }
6682
pappe()6683 void Molecule::pappe(){
6684 glEnable(GL_ALPHA_TEST);
6685 g_Program->setUniformValue(wallH, 1);
6686 const GLfloat v[]={
6687 -1.f,-1.f, 0.f,
6688 1.f,-1.f, 0.f,
6689 -1.f, 1.f, 0.f,
6690
6691 -1.f, 1.f, 0.f,
6692 1.f,-1.f, 0.f,
6693 1.f, 1.f, 0.f,
6694
6695 -1.f, 0.f,-1.f,
6696 1.f, 0.f,-1.f,
6697 -1.f, 0.f, 1.f,
6698
6699 -1.f, 0.f, 1.f,
6700 1.f, 0.f,-1.f,
6701 1.f, 0.f, 1.f,
6702
6703 0.f,-1.f,-1.f,
6704 0.f, 1.f,-1.f,
6705 0.f,-1.f, 1.f,
6706
6707 0.f,-1.f, 1.f,
6708 0.f, 1.f,-1.f,
6709 0.f, 1.f, 1.f,
6710
6711 1.f,-1.f, 0.f,
6712 -1.f,-1.f, 0.f,
6713 -1.f, 1.f, 0.f,
6714
6715 1.f,-1.f, 0.f,
6716 -1.f, 1.f, 0.f,
6717 1.f, 1.f, 0.f,
6718
6719 1.f, 0.f,-1.f,
6720 -1.f, 0.f,-1.f,
6721 -1.f, 0.f, 1.f,
6722
6723 1.f, 0.f,-1.f,
6724 -1.f, 0.f, 1.f,
6725 1.f, 0.f, 1.f,
6726
6727 0.f, 1.f,-1.f,
6728 0.f,-1.f,-1.f,
6729 0.f,-1.f, 1.f,
6730
6731 0.f, 1.f,-1.f,
6732 0.f,-1.f, 1.f,
6733 0.f, 1.f, 1.f
6734 };
6735 const GLfloat n[]={
6736 0.f, 0.f, 1.f,
6737 0.f, 0.f, 1.f,
6738 0.f, 0.f, 1.f,
6739
6740 0.f, 0.f, 1.f,
6741 0.f, 0.f, 1.f,
6742 0.f, 0.f, 1.f,
6743
6744 0.f,-1.f, 0.f,
6745 0.f,-1.f, 0.f,
6746 0.f,-1.f, 0.f,
6747
6748 0.f,-1.f, 0.f,
6749 0.f,-1.f, 0.f,
6750 0.f,-1.f, 0.f,
6751
6752 1.f, 0.f, 0.f,
6753 1.f, 0.f, 0.f,
6754 1.f, 0.f, 0.f,
6755
6756 1.f, 0.f, 0.f,
6757 1.f, 0.f, 0.f,
6758 1.f, 0.f, 0.f,
6759
6760
6761 0.f, 0.f,-1.f,
6762 0.f, 0.f,-1.f,
6763 0.f, 0.f,-1.f,
6764
6765 0.f, 0.f,-1.f,
6766 0.f, 0.f,-1.f,
6767 0.f, 0.f,-1.f,
6768
6769 0.f, 1.f, 0.f,
6770 0.f, 1.f, 0.f,
6771 0.f, 1.f, 0.f,
6772
6773 0.f, 1.f, 0.f,
6774 0.f, 1.f, 0.f,
6775 0.f, 1.f, 0.f,
6776
6777 -1.f, 0.f, 0.f,
6778 -1.f, 0.f, 0.f,
6779 -1.f, 0.f, 0.f,
6780
6781 -1.f, 0.f, 0.f,
6782 -1.f, 0.f, 0.f,
6783 -1.f, 0.f, 0.f
6784 };
6785 glEnableClientState(GL_VERTEX_ARRAY);
6786 glVertexPointer(3, GL_FLOAT, 0, v);
6787 glEnableClientState(GL_NORMAL_ARRAY);
6788 glNormalPointer(GL_FLOAT, 0, n);
6789 glDrawArrays(GL_TRIANGLES, 0, 36);
6790 glDisableClientState(GL_VERTEX_ARRAY);
6791 glDisableClientState(GL_NORMAL_ARRAY);
6792 }
6793
shaderAtoms(CEnvironment atom,int proba,double radScal)6794 void Molecule::shaderAtoms(CEnvironment atom,int proba,double radScal){
6795 /*! Draws atoms as spheres or as ellipses cubes or icosahedrons.
6796 * @params atoms list of atoms to be drawn .
6797 * @params proba ellipsoid probability (currently 10 30 50 70 90 %).
6798 *
6799 * Molecule.dratom controls the wireframe style of the resulting atom .
6800 *
6801 * Molecule.tubes atom balls is drawn in bondstrength.
6802 *
6803 * Molecule.adp atom is drawn as a ellipsoid.
6804 *
6805 * Molecule.monoQrom Q-Peaks are drawn in Color Molecule.mQolor .
6806 * */
6807 if (atom.isEmpty())return;
6808 int myAdp=adp;
6809 int myStyle=7;
6810 int pminus=0;
6811 int wire=0;
6812 // if (!intern) return;
6813 Licht=1;
6814 g_Program->bind();
6815 g_Program->setUniformValue(lichtH, 1);
6816 g_Program->setUniformValue(bgH,fgc[0],fgc[1],fgc[2],fgc[3]);
6817
6818 //glGetUniformiv(g_program,lichtH,&Licht);
6819 //if (!Licht) {
6820 // glUseProgram(0);
6821 // return;//licht geht nicht an
6822 //}
6823 program_in_use=true;
6824 for (int i=0; i<atom.size();i++){
6825 if ((!dratom)&&(atom.at(i).hidden)) continue;
6826 if ((nopm1)&&(atom.at(i).symmGroup)&&(atom.at(i).part<0))continue;
6827 if ((dratom==2)&&(atom.at(i).part==0))continue;
6828 if ((dratom==2)&&(atom.at(i).symmGroup)&&(atom.at(i).part<0))continue;
6829 if ((dratom==2)&&(atom.at(i).hidden))continue;
6830 if ((dratom==5)&&(atom.at(i).hidden))continue;
6831 if ((noQPeaksPlease)&&(atom.at(i).an==-1)) continue;
6832 bool nonPositiveDefinite=false;
6833 glPushMatrix();
6834 glTranslated(atom.at(i).pos.x,atom.at(i).pos.y,atom.at(i).pos.z);
6835 double rad=(atom.at(i).an==-2)?0.5:qPeakRad;
6836 bool parthigh=false;
6837 if (dratom==5){
6838 wire=1;
6839 dratom=0;
6840 }
6841 if (dratom==2) {
6842 dratom=0;
6843 parthigh=true;
6844 }
6845 if (!dratom){
6846 if (atom.at(i).an>-1) {
6847
6848 myStyle=AtomStyle[atom.at(i).an];
6849 if (atom.at(i).Label.contains("(noADP)")) myStyle|=ATOM_STYLE_NOADP;
6850 glColor4d(AtomColor[atom.at(i).an].redF(),
6851 AtomColor[atom.at(i).an].greenF(),
6852 AtomColor[atom.at(i).an].blueF(),
6853 1.0);//AtomColor[atom.at(i).an].alphaF());
6854 rad=arad[atom.at(i).an];
6855 if (parthigh) {
6856 glEnable(GL_BLEND);
6857 QColor pcolor=PartColor::color(atom.at(i).part);
6858 if (atom.at(i).part==666) pcolor.setAlpha(70);
6859 else pcolor.setAlpha(90);
6860 glColor4d(pcolor.redF(), pcolor.greenF(), pcolor.blueF(), pcolor.alphaF());
6861
6862 }
6863
6864 if ((highlightEquivalents)&&(!parthigh)&&(atom.at(i).symmGroup)) {
6865 glColor4d(qMin(1.0,(AtomColor[atom.at(i).an].redF()+0.1) * 1.2),
6866 qMin(1.0,(AtomColor[atom.at(i).an].greenF()+0.1) * 1.2),
6867 qMin(1.0,(AtomColor[atom.at(i).an].blueF()+0.1) * 1.2),
6868 1.0);
6869 }
6870 if ((atom.at(i).symmGroup)&&(atom.at(i).part<0)){
6871 glColor4d(AtomColor[atom.at(i).an].redF(),
6872 AtomColor[atom.at(i).an].greenF(),
6873 1.0,
6874 0.3);
6875 pminus=1;
6876 //myStyle|=ATOM_STYLE_NOADP;
6877 }
6878 myAdp=(myStyle&ATOM_STYLE_NOADP)?0:adp;
6879 }
6880 if (wire) {myStyle|=ATOM_STYLE_SPHERE;if (myStyle&ATOM_STYLE_SOLID)myStyle-=ATOM_STYLE_SOLID; }
6881 if (tubes){
6882 rad=bondStrength;
6883 if (atom.at(i).part==666) rad*=4.5;
6884 myAdp=0;
6885 nonPositiveDefinite=false;
6886 }
6887 if ((atom.at(i).an<0)||(atom.at(i).Label.startsWith('Q',Qt::CaseInsensitive))){
6888 glColor4d(1.0 ,0.7, 0.8 ,0.4);
6889 if (atom.at(i).an==-42) {//belos sit!
6890 if (beloColorByDefden) Farbverlauf(atom.at(i).sof,lmin,lmax);
6891 else glColor3d(beloColor.redF(),beloColor.greenF(),beloColor.blueF());
6892 //dodecaeder(rad);
6893 triacontaeder(beloRad);
6894 }
6895 else if (atom.at(i).an==-66) {//centroids
6896 rad*=2;
6897 glColor4d(0.6,0.3,0.1,0.3);
6898 dodecaeder(rad);
6899 }else{
6900 if((atom.at(i).an==-1)&&(!monoQrom)) Farbverlauf(atom.at(i).peakHeight, pmin, pmax);
6901 if (monoQrom) glColor3d(mQolor.redF(),mQolor.greenF(),mQolor.blueF());
6902 // if (!wire)
6903 icosaeder(rad);
6904 }
6905 }
6906 else {
6907 if (myAdp){
6908 V3 ev=V3(0,0,0);
6909 double *arr=jacobi(atom.at(i).uc,ev);
6910 if ((ev.x>0)&&(ev.y>0)&&(ev.z>0)){
6911 nonPositiveDefinite=false;
6912 glRotated(Ato4d(arr));
6913 double psc=(parthigh)?1.1:1.0;
6914 if (atom.at(i).part==666) psc*=1.1;
6915 switch (proba ) {
6916 case 10 :{ glScaled(0.76*sqrt(ev.x)*psc,0.76*sqrt(ev.y)*psc,0.76*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 10% Wahrscheinlichkeit
6917 case 30 :{ glScaled(1.19*sqrt(ev.x)*psc,1.19*sqrt(ev.y)*psc,1.19*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 30% Wahrscheinlichkeit
6918 case 50 :{ glScaled(1.54*sqrt(ev.x)*psc,1.54*sqrt(ev.y)*psc,1.54*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 50% Wahrscheinlichkeit
6919 case 70 :{ glScaled(1.91*sqrt(ev.x)*psc,1.91*sqrt(ev.y)*psc,1.91*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 70% Wahrscheinlichkeit
6920 case 90 :{ glScaled(2.50*sqrt(ev.x)*psc,2.50*sqrt(ev.y)*psc,2.50*sqrt(ev.z)*psc);break;} //Hauptachsen der Eliipsoide 90% Wahrscheinlichkeit
6921 default: ;
6922 }
6923 }else {nonPositiveDefinite=true;}
6924 }else{
6925 myStyle&=(ATOM_STYLE_SPHERE|ATOM_STYLE_NOADP);
6926 myStyle|=ATOM_STYLE_NOADP;
6927 }
6928
6929 if (parthigh) {
6930 rad*=1.32;
6931 if (atom.at(i).part==666) rad*=1.2;
6932 glEnable(GL_BLEND);
6933 myStyle&=(ATOM_STYLE_SPHERE|ATOM_STYLE_NOADP);
6934 myStyle|=ATOM_STYLE_SPHERE;
6935 myStyle|=ATOM_STYLE_SOLID;
6936
6937 }
6938
6939 /*
6940 #define ATOM_STYLE_WALLS 1
6941 #define ATOM_STYLE_RINGS 2
6942 #define ATOM_STYLE_SPHERE 4
6943 #define ATOM_STYLE_SOLID 8
6944 #define ATOM_STYLE_WHITERING 16
6945 #define ATOM_STYLE_NOLABEL 32
6946 #define ATOM_STYLE_NOADP 64
6947 */
6948
6949
6950
6951
6952 int walls=((ATOM_STYLE_WALLS&myStyle))?1:0;
6953
6954 //printf("style: %X walls %d %d\n",myStyle,walls,wire);
6955 if ((!wire)&&(myAdp)&&(walls)&&(!nonPositiveDefinite)) pappe();
6956 if (atom.at(i).an>-1) {
6957 if (myAdp&&intern) {
6958 if (!nonPositiveDefinite) sphere(myAdp,myStyle);
6959 else {
6960 cube(rad);
6961 }
6962
6963 }
6964 else if ((!myAdp)||wire||parthigh){
6965 rad*=radScal;
6966 rad=fmax(rad,0.10);
6967 if (!myAdp) glScaled(rad,rad,rad);
6968 if (!nonPositiveDefinite) {
6969 if (wire)dratom =5;
6970 sphere(myAdp||pminus,myStyle);
6971 }
6972 else {
6973 cube(rad);
6974 }
6975 }
6976 }
6977 else
6978 icosaeder(rad);
6979 }
6980 }
6981 else{
6982 atom[i].hidden=0;
6983 if (dratom==76){
6984 glEnable(GL_BLEND);
6985 if (atom.at(i).an>=0) rad=arad[atom.at(i).an];
6986 glScaled(rad,rad,rad);
6987 if (atom.at(i).sg) glColor4d(0.7,0.5,0.2,0.7);
6988 else glColor4d(0.2,0.5,0.7,0.7);
6989 sphere(0,myStyle);
6990 dratom=0;
6991 glColor4d(qMin(1.0,(AtomColor[atom.at(i).an].redF()) + ((atom.at(i).sg)?0.3:-0.3)),
6992 qMin(1.0,(AtomColor[atom.at(i).an].greenF()) ),
6993 qMin(1.0,(AtomColor[atom.at(i).an].blueF()) + ((atom.at(i).sg)?-0.3:0.3)),
6994 0.7);
6995 myStyle&=ATOM_STYLE_NOADP;
6996 myStyle|=ATOM_STYLE_SPHERE;
6997 myStyle|=ATOM_STYLE_SOLID;
6998 if (atom.at(i).an==-42) {
6999 glColor4d(0.8,0.6,0.1,0.8);
7000 triacontaeder(2.0);
7001 }else sphere(0,myStyle);
7002 dratom=76;
7003 } else sphere(0,myStyle);
7004 }
7005 glPopMatrix();
7006 if (parthigh) dratom=2;
7007 }
7008 g_Program->release();
7009 program_in_use=false;
7010 }
7011
Farbverlauf(GLfloat wrt,GLfloat min,GLfloat max)7012 void Molecule::Farbverlauf (GLfloat wrt,GLfloat min,GLfloat max){
7013 if (min+0.001f>=max)max+=0.002f;
7014 GLclampd ff[4];
7015 int lauf=0;
7016 const GLclampd farbe[6][4]={{1.0,0.0,0.0,1.0},
7017 {1.0,1.0,0.0,1.0},
7018 {0.0,1.0,0.0,1.0},
7019 {0.0,1.0,1.0,1.0},
7020 {0.0,0.0,1.0,1.0},
7021 {1.0,0.0,1.0,1.0}};
7022 GLfloat nwrt = (wrt - min) / (max - min);
7023 nwrt=(nwrt >= 1.0f)?0.99999f:nwrt;
7024 nwrt=(nwrt <= 0.0f)?0.00001f:nwrt;
7025 lauf=(int (nwrt/0.2f));
7026 nwrt-=(0.2f*lauf);
7027 nwrt/=(0.2f);
7028
7029 ff[0]=(1.0-nwrt)*farbe[lauf][0]+farbe[lauf+1][0]*nwrt;
7030 ff[1]=(1.0-nwrt)*farbe[lauf][1]+farbe[lauf+1][1]*nwrt;
7031 ff[2]=(1.0-nwrt)*farbe[lauf][2]+farbe[lauf+1][2]*nwrt;
7032 ff[3]=1.0;
7033
7034 glColor4dv(ff);
7035 return;
7036 }
7037
bonds(Connection bond)7038 void Molecule::bonds(Connection bond){
7039 /*! @params bond list of bonds to be drawn
7040 * draws bonds as cylinders with radius Molecule.bondStrength .
7041 * Bonds start and stop at the atom surface.
7042 */
7043 if (bond.isEmpty())return;
7044 GLfloat white[4]={0.2f, 0.2f, 0.3f, 0.0f};
7045 GLfloat black[4]={0.0f, 0.0f, 0.0f, 1.0f};
7046 glDisable(GL_BLEND);
7047 glEnable(GL_ALPHA_TEST);
7048 glBindTexture(GL_TEXTURE_2D, hbtex);
7049 //printf("Doing Bonds adp=%d proba=%d tubes%d\n",adp,proba,tubes);
7050 V3 vec,bondir;
7051 double kurz=0,ara1,ara2;
7052 double wink;
7053 bool parthigh=false;
7054 double psc=1.0;
7055 if (dratom==2) {
7056 dratom=0;
7057 parthigh=true;
7058 psc=1.32;
7059 glEnable(GL_BLEND);
7060 glDisable(GL_ALPHA_TEST);
7061 // glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
7062 }else{glDisable(GL_BLEND);}
7063 for (int i=0; i<bond.size();i++){
7064 if (bond.at(i).ato1->hidden) continue;
7065 if (bond.at(i).ato2->hidden) continue;
7066 if ((parthigh)&&((bond.at(i).ato1->part==0)||(bond.at(i).ato2->part==0))) continue;
7067 if ((parthigh)&&(((bond.at(i).ato1->part<0)&&(bond.at(i).ato1->symmGroup))||((bond.at(i).ato2->part<0)&&(bond.at(i).ato2->symmGroup)))) continue;
7068 if ((nopm1)&&(bond.at(i).ato1->symmGroup)&&(bond.at(i).ato1->part<0))continue;
7069 if ((nopm1)&&(bond.at(i).ato2->symmGroup)&&(bond.at(i).ato2->part<0))continue;
7070 if ((ATOM_STYLE_METAL&AtomStyle[bond.at(i).ato1->an])!=(ATOM_STYLE_METAL&AtomStyle[bond.at(i).ato2->an])){
7071 glEnable(GL_TEXTURE_2D);
7072 } else glDisable(GL_TEXTURE_2D);
7073 glColor4d(0.5,0.3,0.3,1.0);
7074
7075 if (adp) {
7076 V3 hin=Normalize(bond.at(i).ato2->pos-bond.at(i).ato1->pos);
7077 double r=1;
7078 switch (proba){
7079 case 10:r=0.76;break;
7080 case 30:r=1.19;break;
7081 case 50:r=1.54;break;
7082 case 70:r=1.91;break;
7083 case 90:r=2.50;break;
7084 }
7085 ara1=sqrt((hin*bond.at(i).ato1->uc)*hin);
7086 ara1*=r;
7087 ara2=sqrt((hin*bond.at(i).ato2->uc)*hin);
7088 ara2*=r;
7089 // printf("%s-%s %f %f %d %f\n",bond.at(i).ato1->Label.toStdString().c_str(),bond.at(i).ato2->Label.toStdString().c_str(),ara1, ara2, proba,r);
7090 }
7091 else{
7092 ara1=arad[bond.at(i).ato1->an];
7093 ara2=arad[bond.at(i).ato2->an];
7094 }
7095 if (((bond.at(i).ato1->symmGroup)&&(bond.at(i).ato1->part<0))||
7096 (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato1->an])) ara1=arad[bond.at(i).ato1->an];
7097 if (((bond.at(i).ato2->symmGroup)&&(bond.at(i).ato2->part<0))||
7098 (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato2->an])) ara2=arad[bond.at(i).ato2->an];
7099 if (tubes) ara1=ara2=bondStrength;
7100 if (bond.at(i).ato2->an>-1) {
7101 glColor4d(AtomColor[bond.at(i).ato2->an].redF(),
7102 AtomColor[bond.at(i).ato2->an].greenF(),
7103 AtomColor[bond.at(i).ato2->an].blueF(),
7104 AtomColor[bond.at(i).ato2->an].alphaF());
7105 }else{
7106 if (bond.at(i).ato1->an>-1) {
7107 glColor4d(AtomColor[bond.at(i).ato1->an].redF(),
7108 AtomColor[bond.at(i).ato1->an].greenF(),
7109 AtomColor[bond.at(i).ato1->an].blueF(),
7110 AtomColor[bond.at(i).ato1->an].alphaF());
7111 }
7112 }
7113
7114 ara1=qMax(ara1,bondStrength);
7115 ara2=qMax(ara2,bondStrength);
7116
7117 if ((highlightEquivalents)&&(bond.at(i).ato2->symmGroup|bond.at(i).ato1->symmGroup))
7118 glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,white );
7119 else glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,black );
7120 if ((bond.at(i).ato2->symmGroup|bond.at(i).ato1->symmGroup)&&((bond.at(i).ato2->part<0)||(bond.at(i).ato1->part<0))){
7121 // glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,blue );
7122 glColor4d(AtomColor[bond.at(i).ato2->an].redF(),
7123 AtomColor[bond.at(i).ato2->an].greenF(),
7124 1.0,
7125 0.3);
7126 glEnable(GL_BLEND);
7127 }
7128 vec.x=(bond.at(i).ato2->pos.y-bond.at(i).ato1->pos.y);
7129 vec.y=(bond.at(i).ato1->pos.x-bond.at(i).ato2->pos.x);
7130 vec.z=0;
7131 if (Norm(vec)) vec=Normalize(vec);
7132 else vec=V3(0,1,0);
7133 bondir =V3(0,0,0);
7134 if (bondStrength<ara2)
7135 bondir= Normalize(bond.at(i).ato1->pos-bond.at(i).ato2->pos)*(0.9*sqrt((ara2*ara2)-bondStrength*bondStrength));
7136 kurz=sqrt(Norm(bondir));// */
7137 //printf("%s--%s kurz %f len %f ara2 %f\n",bond.at(i).ato1->Label.toStdString().c_str(),bond.at(i).ato2->Label.toStdString().c_str(),kurz,bond.at(i).length,ara2);
7138 glPushMatrix();
7139 // glTranslated (mitsav.x,mitsav.y,mitsav.z);
7140 glTranslated (
7141 bond.at(i).ato2->pos.x+bondir.x,
7142 bond.at(i).ato2->pos.y+bondir.y,
7143 bond.at(i).ato2->pos.z+bondir.z);//Anfangspunkt
7144 wink=acos(((bond.at(i).ato1->pos.z-bond.at(i).ato2->pos.z)/
7145 (sqrt((bond.at(i).ato1->pos.x-bond.at(i).ato2->pos.x)*(bond.at(i).ato1->pos.x-bond.at(i).ato2->pos.x)+
7146 (bond.at(i).ato1->pos.y-bond.at(i).ato2->pos.y)*(bond.at(i).ato1->pos.y-bond.at(i).ato2->pos.y)+
7147 (bond.at(i).ato1->pos.z-bond.at(i).ato2->pos.z)*(bond.at(i).ato1->pos.z-bond.at(i).ato2->pos.z)))))/M_PI*180.0;
7148
7149 glRotated(wink,vec.x,vec.y,vec.z); // drehen
7150 if (parthigh) {
7151 glEnable(GL_BLEND);
7152 QColor pcolor=PartColor::color(bond.at(i).ato1->part);
7153 pcolor.setAlpha(140);
7154 glColor4d(pcolor.redF(),
7155 pcolor.greenF(),
7156 pcolor.blueF(),
7157 pcolor.alphaF());
7158
7159 }
7160 //if (trans) {glEnable(GL_BLEND);glEnable(GL_CULL_FACE);}
7161 cylinder(bondStrength*psc, (float)(bond.at(i).length /2.0f -kurz));
7162 //if (trans) {glDisable(GL_BLEND);glDisable(GL_CULL_FACE);}
7163 glPopMatrix();
7164
7165 if (bond.at(i).ato1->an>-1){
7166 glColor4d(AtomColor[bond.at(i).ato1->an].redF(),
7167 AtomColor[bond.at(i).ato1->an].greenF(),
7168 AtomColor[bond.at(i).ato1->an].blueF(),
7169 AtomColor[bond.at(i).ato1->an].alphaF());
7170
7171 }else {
7172 if (bond.at(i).ato2->an>-1){
7173 glColor4d(AtomColor[bond.at(i).ato2->an].redF(),
7174 AtomColor[bond.at(i).ato2->an].greenF(),
7175 AtomColor[bond.at(i).ato2->an].blueF(),
7176 AtomColor[bond.at(i).ato2->an].alphaF());
7177 }
7178 }
7179 if ((bond.at(i).ato2->symmGroup|bond.at(i).ato1->symmGroup)&&((bond.at(i).ato2->part<0)||(bond.at(i).ato1->part<0))){
7180 // glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION,blue );
7181 if (bond.at(i).ato1->an>-1){
7182 glColor4d(AtomColor[bond.at(i).ato1->an].redF(),
7183 AtomColor[bond.at(i).ato1->an].greenF(),
7184 1.0,
7185 0.3);
7186 }
7187 glEnable(GL_BLEND);
7188 }
7189
7190 vec.x=(bond.at(i).ato1->pos.y-bond.at(i).ato2->pos.y);
7191 vec.y=(bond.at(i).ato2->pos.x-bond.at(i).ato1->pos.x);
7192 vec.z=0;
7193 if (Norm(vec)) vec=Normalize(vec);
7194 else vec=V3(0,1,0);
7195
7196 bondir =V3(0,0,0);
7197 if (bondStrength<ara1)
7198 bondir= Normalize(bond.at(i).ato2->pos-bond.at(i).ato1->pos)*(0.9*sqrt((ara1*ara1)-bondStrength*bondStrength));
7199 kurz=sqrt(Norm(bondir));// */
7200 glPushMatrix();
7201 // glTranslated (mitsav.x,mitsav.y,mitsav.z);
7202 glTranslated (
7203 bond.at(i).ato1->pos.x+bondir.x,
7204 bond.at(i).ato1->pos.y+bondir.y,
7205 bond.at(i).ato1->pos.z+bondir.z);//Anfangspunkt
7206 wink=acos(((bond.at(i).ato2->pos.z-bond.at(i).ato1->pos.z)/
7207 (sqrt((bond.at(i).ato2->pos.x-bond.at(i).ato1->pos.x)*(bond.at(i).ato2->pos.x-bond.at(i).ato1->pos.x)+
7208 (bond.at(i).ato2->pos.y-bond.at(i).ato1->pos.y)*(bond.at(i).ato2->pos.y-bond.at(i).ato1->pos.y)+
7209 (bond.at(i).ato2->pos.z-bond.at(i).ato1->pos.z)*(bond.at(i).ato2->pos.z-bond.at(i).ato1->pos.z)))))/M_PI*180.0;
7210 glRotated(wink,vec.x,vec.y,vec.z); // drehen
7211 //if (trans) {glEnable(GL_BLEND);glEnable(GL_CULL_FACE);}
7212 if (parthigh) {
7213 glEnable(GL_BLEND);
7214 QColor pcolor=PartColor::color(bond.at(i).ato2->part);
7215 pcolor.setAlpha(140);
7216 glColor4d(pcolor.redF(),
7217 pcolor.greenF(),
7218 pcolor.blueF(),
7219 pcolor.alphaF());
7220
7221 }
7222 cylinder(bondStrength*psc, (float)bond.at(i).length/2.0f-kurz);
7223
7224 glDisable(GL_BLEND);
7225 glDisable(GL_TEXTURE_2D);
7226 glPopMatrix();
7227 }
7228
7229 }
7230
h_bonds(Connection bond,CEnvironment atoms)7231 QString Molecule::h_bonds(Connection bond,CEnvironment atoms) {
7232 /*! calculates Hydrogen bonds and draws them as stippled cylinders
7233 * \returns a html table of the found H-bonds
7234 */
7235 if (atoms.isEmpty())return "";
7236 if (bond.isEmpty())return "";
7237 glDisable(GL_CULL_FACE);
7238 if (HAMax<0.01)return "";
7239 glEnable(GL_ALPHA_TEST);
7240 glBindTexture(GL_TEXTURE_2D, hbtex);
7241 glEnable(GL_TEXTURE_2D);
7242 QString hbonds;
7243 double gg=0,kk=0,ll=0;
7244 double kurz=0,ara1,ara2;
7245 float wink,hb_wink;
7246 V3 vec,bondir;
7247 const MyAtom *Hyd,*Acc,*Don;//Wasserstoff Akzeptor und Donor
7248 hbonds.append("<h2>Hydrogen Bonds</h2><table border=1><tr><th>Donor---Hydrogen...Acceptor</th><th>Don--Hyd [Å]</th><th> Hyd--Acc [Å]</th><th>Don--Acc [Å]</th><th>D--H-----A </th></tr>");
7249 for (int i=0;i<bond.size();i++) {
7250 if (((bond.at(i).ato1->an == 0)&&
7251 (bond.at(i).ato2->an > 5)&&
7252 (bond.at(i).ato2->an < 9))||
7253 ((bond.at(i).ato2->an == 0)&&
7254 (bond.at(i).ato1->an > 5)&&
7255 (bond.at(i).ato1->an < 9))) {
7256 Hyd=(bond.at(i).ato1->an==0)?bond.at(i).ato1:bond.at(i).ato2;
7257 Don=(bond.at(i).ato1->an==0)?bond.at(i).ato2:bond.at(i).ato1;
7258 for (int j=0; j<atoms.size();j++){
7259 if ((atoms.at(j).an<6)||(atoms.at(j).an>8)) continue;
7260 if ((Don->part!=0)&&(atoms.at(j).part!=0)&&(atoms.at(j).part!=Don->part)) continue;//acceptor may be in main part
7261 if ((Hyd->part!=0)&&(atoms.at(j).part!=0)&&(atoms.at(j).part!=Hyd->part)) continue;
7262
7263 //printf("%d %d %d\n",bond.at(i).ato1->an,bond.at(i).ato2->an,atoms.at(j).an);
7264 Acc=&atoms.at(j);
7265 if (Acc==Don) continue;
7266 gg=sqrt( Distance(Hyd->pos,atoms.at(j).pos));
7267
7268
7269 if (gg<=HAMax){
7270 hb_wink=winkel(Acc->pos-Hyd->pos, Don->pos-Hyd->pos);
7271 /* printf("%s %s %s %f %f\n",bond.at(i).ato1->Label.toStdString().c_str(),
7272 bond.at(i).ato2->Label.toStdString().c_str(),
7273 atoms.at(j).Label.toStdString().c_str(),gg,hb_wink);*/
7274 if ((gg>=1.3)&&(fabs(hb_wink)>HAWink)) {//wenn AbstandRichtig
7275 ll=sqrt(Distance(Acc->pos,Don->pos));
7276 kk=sqrt(Distance(Don->pos,Hyd->pos));
7277 hbonds.append(QString("<tr><td>%1---%2...%3</td><td>%4</td><td>%5</td><td>%6</td><td>%7°</td></tr>")
7278 .arg(Don->Label)
7279 .arg(Hyd->Label)
7280 .arg(Acc->Label)
7281 .arg(kk,6,'f',2)
7282 .arg(gg,6,'f',2)
7283 .arg(ll,6,'f',3)
7284 .arg(hb_wink,5,'f',1));
7285 glPushMatrix();
7286 ara1=arad[0];
7287 ara2=arad[Acc->an];
7288 if (adp) {
7289 V3 hin=Normalize(bond.at(i).ato2->pos-bond.at(i).ato1->pos);
7290 double r=1;
7291 switch (proba){
7292 case 10:r=0.76;break;
7293 case 30:r=1.19;break;
7294 case 50:r=1.54;break;
7295 case 70:r=1.91;break;
7296 case 90:r=2.50;break;
7297 }
7298 ara1=sqrt((hin*bond.at(i).ato1->uc)*hin);
7299 ara1*=r;
7300 ara2=sqrt((hin*bond.at(i).ato2->uc)*hin);
7301 ara2*=r;
7302 // printf("%s-%s %f %f %d %f\n",bond.at(i).ato1->Label.toStdString().c_str(),bond.at(i).ato2->Label.toStdString().c_str(),ara1, ara2, proba,r);
7303 }
7304 if (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato1->an])ara1=arad[0];
7305 if (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato2->an])ara2=arad[Acc->an];
7306 if (tubes) ara1=ara2=bondStrength;
7307 bondir =V3(0,0,0);
7308 if (bondStrength<ara2)
7309 bondir= Normalize(Hyd->pos-Acc->pos)*(1.2*sqrt((ara2*ara2)-bondStrength*bondStrength));
7310 if (bondStrength<ara1)
7311 kurz=(1.2*sqrt((ara1*ara1)-bondStrength*bondStrength)+1.2*sqrt(ara2*ara2)-bondStrength*bondStrength);// */
7312 else kurz=0;
7313 glTranslated(Acc->pos.x+bondir.x,Acc->pos.y+bondir.y,Acc->pos.z+bondir.z);//z
7314 vec=kreuzX(Hyd->pos.x-Acc->pos.x,
7315 Hyd->pos.y-Acc->pos.y,
7316 Hyd->pos.z-Acc->pos.z,
7317 0.0f,0.0f,1.0f);
7318 wink=acos(((Hyd->pos.z-Acc->pos.z)/
7319 (sqrt((Acc->pos.x-Hyd->pos.x)*(Acc->pos.x-Hyd->pos.x)+
7320 (Acc->pos.y-Hyd->pos.y)*(Acc->pos.y-Hyd->pos.y)+
7321 (Acc->pos.z-Hyd->pos.z)*(Acc->pos.z-Hyd->pos.z)))))/M_PI*180.0;
7322 //printf("%f %f %f %f\n",wink, vec.x, vec.y, vec.z);
7323 glRotatef(wink, vec.x, vec.y, vec.z); // drehen
7324 //if (!adp)
7325 if (gg>2.0) glColor4f(1.f,0.6f,0.f,1.f); else glColor4f(1.f,1.f,0.f,1.f);
7326 cylinder(bondStrength*0.85, (float)gg-kurz);
7327
7328 glPopMatrix();
7329 }
7330 }
7331 }
7332 }
7333 }
7334 //glDisable( GL_BLEND);
7335 glDisable(GL_ALPHA_TEST);
7336
7337 glDisable(GL_TEXTURE_2D);
7338 glEnable( GL_CULL_FACE);
7339 if (hbonds.contains("deg;")) hbonds.append("</table><br>");
7340 else hbonds.clear();
7341 return hbonds;
7342 }
7343
h_bonds2(Connection bond,CEnvironment atoms)7344 void Molecule::h_bonds2(Connection bond,CEnvironment atoms) {
7345 /*! calculates Hydrogen bonds and draws them as stippled cylinders
7346 */
7347 if (bond.isEmpty())return;
7348 glDisable(GL_CULL_FACE);
7349 if (HAMax<0.01)return ;
7350 glEnable(GL_ALPHA_TEST);
7351 glBindTexture(GL_TEXTURE_2D, hbtex);
7352 glEnable(GL_TEXTURE_2D);
7353 double gg=0;//,kk=0,ll=0;
7354 double kurz=0,ara1,ara2;
7355 float wink,hb_wink;
7356 V3 vec,bondir;
7357 MyBond hbond;
7358 theH_Bonds.clear();
7359 const MyAtom *Hyd,*Acc,*Don;//Wasserstoff Akzeptor und Donor
7360 for (int i=0;i<bond.size();i++) {
7361 if (((bond.at(i).ato1->an == 0)&&(canbeDonor(bond.at(i).ato2->an)))||
7362 ((bond.at(i).ato2->an == 0)&&(canbeDonor(bond.at(i).ato1->an)))) {
7363 Hyd=(bond.at(i).ato1->an==0)?bond.at(i).ato1:bond.at(i).ato2;
7364 int iHyd=(bond.at(i).ato1->an==0)?bond.at(i).a1:bond.at(i).a2;
7365 Don=(bond.at(i).ato1->an==0)?bond.at(i).ato2:bond.at(i).ato1;
7366 for (int j=0; j<atoms.size();j++){
7367 if (!canbeAcceptor(atoms.at(j).an)) continue;
7368 if ((Don->part!=0)&&(atoms.at(j).part!=0)&&((bindPart.key(Don->part)==atoms.at(j).part)||
7369 (bindPart.value(Don->part)==atoms.at(j).part)));
7370 else if ((Don->part!=0)&&(atoms.at(j).part!=0)&&(atoms.at(j).part!=Don->part)) continue;//acceptor may be in main part
7371 if ((Hyd->part!=0)&&(atoms.at(j).part!=0)&&((bindPart.key(Hyd->part)==atoms.at(j).part)||
7372 (bindPart.value(Hyd->part)==atoms.at(j).part)));
7373 else if ((Hyd->part!=0)&&(atoms.at(j).part!=0)&&(atoms.at(j).part!=Hyd->part)) continue;
7374
7375 //printf("%d %d %d\n",bond.at(i).ato1->an,bond.at(i).ato2->an,atoms.at(j).an);
7376 Acc=&atoms.at(j);
7377 if (Acc==Don) continue;
7378 gg=sqrt( Distance(Hyd->pos,atoms.at(j).pos));
7379
7380
7381 if (gg<=HAMax){
7382 hb_wink=winkel(Acc->pos-Hyd->pos, Don->pos-Hyd->pos);
7383 /* printf("%s %s %s %f %f\n",bond.at(i).ato1->Label.toStdString().c_str(),
7384 bond.at(i).ato2->Label.toStdString().c_str(),
7385 atoms.at(j).Label.toStdString().c_str(),gg,hb_wink);*/
7386 if ((gg>=1.3)&&(fabs(hb_wink)>HAWink)) {//wenn AbstandRichtig
7387 //ll=sqrt(Distance(Acc->pos,Don->pos));
7388 //kk=sqrt(Distance(Don->pos,Hyd->pos));
7389 glPushMatrix();
7390 ara1=arad[0];
7391 ara2=arad[Acc->an];
7392 if (adp) {
7393 V3 hin=Normalize(bond.at(i).ato2->pos-bond.at(i).ato1->pos);
7394 double r=1;
7395 switch (proba){
7396 case 10:r=0.76;break;
7397 case 30:r=1.19;break;
7398 case 50:r=1.54;break;
7399 case 70:r=1.91;break;
7400 case 90:r=2.50;break;
7401 }
7402 ara1=sqrt((hin*bond.at(i).ato1->uc)*hin);
7403 ara1*=r;
7404 ara2=sqrt((hin*bond.at(i).ato2->uc)*hin);
7405 ara2*=r;
7406 // printf("%s-%s %f %f %d %f\n",bond.at(i).ato1->Label.toStdString().c_str(),bond.at(i).ato2->Label.toStdString().c_str(),ara1, ara2, proba,r);
7407 }
7408 if (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato1->an])ara1=arad[0];
7409 if (ATOM_STYLE_NOADP&AtomStyle[bond.at(i).ato2->an])ara2=arad[Acc->an];
7410 if (tubes) ara1=ara2=bondStrength;
7411 bondir =V3(0,0,0);
7412 if (bondStrength<ara2)
7413 bondir= Normalize(Hyd->pos-Acc->pos)*(1.2*sqrt((ara2*ara2)-bondStrength*bondStrength));
7414 if (bondStrength<ara1)
7415 kurz=(1.2*sqrt((ara1*ara1)-bondStrength*bondStrength)+1.2*sqrt(ara2*ara2)-bondStrength*bondStrength);// */
7416 else kurz=0;
7417 glTranslated(Acc->pos.x+bondir.x,Acc->pos.y+bondir.y,Acc->pos.z+bondir.z);//z
7418 vec=kreuzX(Hyd->pos.x-Acc->pos.x,
7419 Hyd->pos.y-Acc->pos.y,
7420 Hyd->pos.z-Acc->pos.z,
7421 0.0f,0.0f,1.0f);
7422 wink=acos(((Hyd->pos.z-Acc->pos.z)/
7423 (sqrt((Acc->pos.x-Hyd->pos.x)*(Acc->pos.x-Hyd->pos.x)+
7424 (Acc->pos.y-Hyd->pos.y)*(Acc->pos.y-Hyd->pos.y)+
7425 (Acc->pos.z-Hyd->pos.z)*(Acc->pos.z-Hyd->pos.z)))))/M_PI*180.0;
7426 //printf("%f %f %f %f\n",wink, vec.x, vec.y, vec.z);
7427 glRotatef(wink, vec.x, vec.y, vec.z); // drehen
7428 //if (!adp)
7429 if (gg>2.0) glColor4f(1.f,0.6f,0.f,1.f); else glColor4f(1.f,1.f,0.f,1.f);
7430 cylinder(bondStrength*0.85, (float)gg-kurz);
7431
7432 glPopMatrix();
7433
7434 hbond.a1=iHyd;
7435 hbond.a2=j;
7436 hbond.ato1=Hyd;
7437 hbond.ato2=Acc;
7438 hbond.length=gg;
7439 if (!theH_Bonds.contains(hbond)) theH_Bonds.append(hbond);
7440 }
7441 }
7442 }
7443 }
7444 }
7445 //glDisable( GL_BLEND);
7446 glDisable(GL_ALPHA_TEST);
7447
7448 glDisable(GL_TEXTURE_2D);
7449 glEnable( GL_CULL_FACE);
7450 }
7451
hirsh(Connection bond)7452 void Molecule::hirsh(Connection bond){
7453 return;
7454 V3 hin;
7455 // double zab,zba;
7456 for (int i=0; i<bond.size();i++){
7457 hin=Normalize(bond.at(i).ato2->pos-bond.at(i).ato1->pos);
7458 // zab=(hin*bond.at(i).ato1->uc)*hin;
7459 // zba=(hin*bond.at(i).ato2->uc)*hin;
7460 /* printf("%-9s = %-9s zab %g zba %g %g\n",
7461 bond.at(i).ato1->Label.toStdString().c_str(),
7462 bond.at(i).ato2->Label.toStdString().c_str(),
7463 zab,zba,fabs(zab-zba)*1000);*/
7464 }
7465 }
7466
lbond()7467 void Molecule::lbond(){
7468 /*! draws line bonds from lbonds list.
7469 */
7470 if (lbonds.isEmpty())return;
7471 glPushMatrix();
7472 glEnable(GL_BLEND);
7473 glDisable(GL_LIGHTING);
7474 glBegin(GL_LINES);
7475 glColor3f(0.5f,0.3f,0.3f);
7476 for (int i=0; i<lbonds.size();i++)
7477 if (lbonds.at(i).ato1->hidden+lbonds.at(i).ato2->hidden==0){
7478 glVertex3d(lbonds.at(i).ato1->pos.x,lbonds.at(i).ato1->pos.y,lbonds.at(i).ato1->pos.z);
7479 glVertex3d(lbonds.at(i).ato2->pos.x,lbonds.at(i).ato2->pos.y,lbonds.at(i).ato2->pos.z);
7480 }
7481 glEnd();
7482 glEnable(GL_LIGHTING);
7483 glDisable(GL_BLEND);
7484 glPopMatrix();
7485
7486 }
7487
dbond(Connection bond,int ccod)7488 void Molecule::dbond(Connection bond,int ccod){
7489 /*! draws line bonds from bond list .
7490 */
7491 if (bond.isEmpty())return;
7492 glPushMatrix();
7493 glEnable(GL_BLEND);
7494 glDisable(GL_LIGHTING);
7495 glLineWidth((ccod==76)?6.f:3.f);
7496 glBegin(GL_LINES);
7497 glColor3f(0.0,0.0,0.0);
7498 for (int i=0; i<bond.size();i++)
7499 if ((bond.at(i).ato1!=nullptr)&&(bond.at(i).ato2!=nullptr)){
7500 if (ccod==76){
7501 if (bond.at(i).ato1->sg) glColor4d(0.7,0.5,0.2,0.7);
7502 else glColor4d(0.2,0.5,0.7,0.7);
7503 }
7504 if (bond.at(i).ato1->hidden+bond.at(i).ato2->hidden==0){
7505 glVertex3d(bond.at(i).ato1->pos.x,bond.at(i).ato1->pos.y,bond.at(i).ato1->pos.z);
7506 glVertex3d(bond.at(i).ato2->pos.x,bond.at(i).ato2->pos.y,bond.at(i).ato2->pos.z);
7507 }
7508 }
7509 glEnd();
7510 glEnable(GL_LIGHTING);
7511 glDisable(GL_BLEND);
7512 glLineWidth(1.0f);
7513 glPopMatrix();
7514
7515 }
7516
unitCell()7517 void Molecule::unitCell(){
7518 /*!draws a unit cell box
7519 *
7520 * */
7521 V3 uz0f,uz1f,uz2f,uz3f,uz4f,uz5f,uz6f,uz7f;
7522 V3 uz0k,uz1k,uz2k,uz3k,uz4k,uz5k,uz6k,uz7k;
7523 uz0f.x=0.0; uz0f.y=0.0; uz0f.z=0.0;
7524 uz1f.x=1.0; uz1f.y=0.0; uz1f.z=0.0;
7525 uz2f.x=0.0; uz2f.y=1.0; uz2f.z=0.0;
7526 uz3f.x=0.0; uz3f.y=0.0; uz3f.z=1.0;
7527 uz4f.x=1.0; uz4f.y=1.0; uz4f.z=0.0;
7528 uz5f.x=1.0; uz5f.y=0.0; uz5f.z=1.0;
7529 uz6f.x=0.0; uz6f.y=1.0; uz6f.z=1.0;
7530 uz7f.x=1.0; uz7f.y=1.0; uz7f.z=1.0;
7531 frac2kart(uz0f,uz0k);
7532 frac2kart(uz1f,uz1k);
7533 frac2kart(uz2f,uz2k);
7534 frac2kart(uz3f,uz3k);
7535 frac2kart(uz4f,uz4k);
7536 frac2kart(uz5f,uz5k);
7537 frac2kart(uz6f,uz6k);
7538 frac2kart(uz7f,uz7k);
7539 glEnable(GL_BLEND);
7540 glDisable(GL_LIGHTING);
7541 glLineWidth(2);
7542 glPushMatrix();
7543 glBegin(GL_LINES);
7544 glColor4f(1.0f,0.0f,0.0f,1.0);
7545 glVertex3d(uz0k.x,uz0k.y,uz0k.z);
7546 glVertex3d(uz1k.x,uz1k.y,uz1k.z);
7547
7548 glColor4f(0.0f,1.0f,0.0f,1.0);
7549 glVertex3d(uz0k.x,uz0k.y,uz0k.z);
7550 glVertex3d(uz2k.x,uz2k.y,uz2k.z);
7551
7552 glColor4f(0.0f,0.0f,1.0f,1.0);
7553 glVertex3d(uz0k.x,uz0k.y,uz0k.z);
7554 glVertex3d(uz3k.x,uz3k.y,uz3k.z);
7555
7556 glColor4f(0.6f,0.6f,0.8f,1.0);
7557 glVertex3d(uz1k.x,uz1k.y,uz1k.z);
7558 glVertex3d(uz4k.x,uz4k.y,uz4k.z);
7559
7560 glVertex3d(uz1k.x,uz1k.y,uz1k.z);
7561 glVertex3d(uz5k.x,uz5k.y,uz5k.z);
7562
7563 glVertex3d(uz2k.x,uz2k.y,uz2k.z);
7564 glVertex3d(uz4k.x,uz4k.y,uz4k.z);
7565
7566 glVertex3d(uz2k.x,uz2k.y,uz2k.z);
7567 glVertex3d(uz6k.x,uz6k.y,uz6k.z);
7568
7569 glVertex3d(uz3k.x,uz3k.y,uz3k.z);
7570 glVertex3d(uz5k.x,uz5k.y,uz5k.z);
7571
7572 glVertex3d(uz3k.x,uz3k.y,uz3k.z);
7573 glVertex3d(uz6k.x,uz6k.y,uz6k.z);
7574
7575 glVertex3d(uz7k.x,uz7k.y,uz7k.z);
7576 glVertex3d(uz5k.x,uz5k.y,uz5k.z);
7577
7578 glVertex3d(uz7k.x,uz7k.y,uz7k.z);
7579 glVertex3d(uz4k.x,uz4k.y,uz4k.z);
7580
7581 glVertex3d(uz7k.x,uz7k.y,uz7k.z);
7582 glVertex3d(uz6k.x,uz6k.y,uz6k.z);
7583
7584 glEnd();
7585 glPopMatrix();
7586 glLineWidth(1);
7587 glEnable(GL_LIGHTING);
7588 glDisable(GL_BLEND);
7589 }
7590
Uf2Uo(const Matrix x,Matrix & y)7591 void Molecule::Uf2Uo(const Matrix x, Matrix & y) {
7592 /*! Turns fractional Uij's into cartesinan based Uij's.
7593 * @param[in] x fractional Uij matrix.
7594 * @param[out] y cartesinan Uij matrix.
7595 */
7596 Matrix o,a,w; /*Cholesky decomposition of the real space Metric tensor
7597 Wird fuer die Umrechnung von fraktionellen in kartesischen Korrdinaten benoetigt.*/
7598 a.m11 =cell.as;
7599 a.m12 = 0;
7600 a.m13 = 0;
7601 a.m21 = 0;
7602 a.m22 = cell.bs;
7603 a.m23 = 0;
7604 a.m31 = 0;
7605 a.m32 = 0;
7606 a.m33 = cell.cs;
7607 w=(a*x)*a;
7608 o.m11 =cell.a;
7609 o.m12 = 0.0;
7610 o.m13 = 0.0;
7611 o.m21 = cell.b*cell.cosga;
7612 o.m22 = cell.b*cell.singa;
7613 o.m23 = 0.0;
7614 o.m31 = cell.c* cell.cosbe;
7615 o.m32 = cell.tau;
7616 o.m33 = cell.c* cell.phi / cell.singa ;
7617 // Matrix to=;
7618 y=(o*w)*transponse(o);
7619 /* printf("%f %f %f %f %f %f %f %f %f\n%f %f %f %f %f %f %f %f %f\n%f %f %f %f %f %f %f %f %f\n%f %f %f %f %f %f %f %f %f\n",
7620 o.m11,o.m12,o.m13,o.m21,o.m22,o.m23,o.m31,o.m32,o.m33,
7621 to.m11,to.m21,to.m31,to.m12,to.m22,to.m32,to.m13,to.m23,to.m33,
7622 x.m11,x.m12,x.m13,x.m21,x.m22,x.m23,x.m31,x.m32,x.m33,
7623 w.m11,w.m12,w.m13,w.m21,w.m22,w.m23,w.m31,w.m32,w.m33
7624 );*/
7625 // printf("%f %f %f %f %f %f\n",y.m11*10000,y.m22*10000,y.m33*10000,y.m12*10000,y.m13*10000,y.m23*10000);// */
7626 }
7627
Usym(Matrix x,Matrix sym,Matrix & y)7628 void Molecule::Usym (Matrix x,Matrix sym, Matrix & y){
7629 /*! Applies the symmetry matrix sym to Uij's
7630 * @param[in] x Uij matrix.
7631 * @param[in] sym symmtry matrix.
7632 * @param[out] y resulting Uij matrix.
7633 */
7634 //y=(transponse(sym)*x)*sym;
7635 y=(sym*x)*transponse(sym);
7636 }
7637
USymCode(Matrix x,int scod,Matrix & y)7638 void Molecule::USymCode(Matrix x,int scod, Matrix & y){
7639 int s = scod / 1000;
7640 y=(cell.symmops.at(s)*x)*transponse(cell.symmops.at(s));
7641 }
7642
7643 //void Molecule::
7644
7645 #define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau); a[k][l]=h+s*(g-h*tau);
7646 //NumericalRecepies....
jacobi(const Matrix & uij,V3 & ev)7647 double * Molecule::jacobi(const Matrix &uij, V3 &ev) {
7648 int j,iq,ip,i,n=3,nrot;
7649 double tresh=0,theta,tau,t,sm,s,h,g,c;
7650 double a[3][3],b[3],z[3],v[3][3],d[3];
7651 a[0][0]=uij.m11;
7652 a[0][1]=uij.m12;
7653 a[0][2]=uij.m13;
7654 a[1][0]=uij.m21;
7655 a[1][1]=uij.m22;
7656 a[1][2]=uij.m23;
7657 a[2][0]=uij.m31;
7658 a[2][1]=uij.m32;
7659 a[2][2]=uij.m33;
7660 /* printf("%12.6f %12.6f %12.6f\n%12.6f %12.6f %12.6f\n%12.6f %12.6f %12.6f\n"
7661 ,a[0][0],a[1][0],a[2][0]
7662 ,a[0][1],a[1][1],a[2][1]
7663 ,a[0][2],a[1][2],a[2][2]);*/
7664 static double erg[4]={0.0,1.0,0.0,0.0};
7665 for (ip=1;ip<=n;ip++) {
7666 for (iq=1;iq<=n;iq++) v[ip-1][iq-1]=0.0;
7667 v[ip-1][ip-1]=1.0;
7668 }
7669 for (ip=1;ip<=n;ip++) {
7670 b[ip-1]=d[ip-1]=a[ip-1][ip-1];
7671 z[ip-1]=0.0;
7672 }
7673 nrot=0;
7674 for (i=1;i<=150;i++) {
7675 sm=0.0;
7676 for (ip=1;ip<=n-1;ip++) {
7677 for (iq=ip+1;iq<=n;iq++)
7678 sm += fabs(a[ip-1][iq-1]);
7679 }
7680
7681 //printf("sm =%20.19f\n",sm);
7682
7683 if (float(sm) < tresh) {
7684 if ((v[0][0]+v[1][1]+v[2][2])!=3.0) {
7685 erg[0]=acos((v[0][0]+v[1][1]+v[2][2]-1.0)/2.0);
7686 erg[1]=(v[2][1]-v[1][2])/(2.0*sin(erg[0]));
7687 erg[2]=(v[0][2]-v[2][0])/(2.0*sin(erg[0]));
7688 erg[3]=(v[1][0]-v[0][1])/(2.0*sin(erg[0]));
7689 erg[0]*=180.0/M_PI;}
7690 else {erg[0]=0.0;erg[1]=1.0;erg[2]=0.0;erg[3]=0.0; }
7691 //printf("%d??ERG:%f %f %f %f\n",i,Ato4d(erg));
7692 /*
7693 printf("=%d======================================\n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f\n========================================\n",i,
7694 d[0],d[1],d[2],v[0][0],v[0][1],v[0][2]
7695 ,v[1][0],v[1][1],v[1][2]
7696 ,v[2][0],v[2][1],v[2][2]
7697 );*/
7698 ev=V3(d[0],d[1],d[2]);
7699 /* printf("\n%12.6f %12.6f %12.6f\n%12.6f %12.6f %12.6f\n%12.6f %12.6f %12.6f\n"
7700 ,v[0][0],v[1][0],v[2][0]
7701 ,v[0][1],v[1][1],v[2][1]
7702 ,v[0][2],v[1][2],v[2][2]);
7703 if ((ev.x>0)&&(ev.y>0)&&(ev.z>0)){;}else{
7704 printf("NPD: %g %g %g \n",d[0],d[1],d[2]);
7705 }*/
7706 return (double*) erg;
7707 }
7708 if (i < 4) tresh=0.00001;
7709 else tresh=0.0001;
7710 for (ip=1;ip<=n-1;ip++) {
7711 for (iq=ip+1;iq<=n;iq++) {
7712 //printf("\np:%i q:%i i:%i nrot:%i\n",ip,iq,i,nrot);
7713 g=100.0*fabs(a[ip-1][iq-1]);
7714 if ((i > 4) && ((fabs(d[ip-1])+g) == fabs(d[ip-1])) && ((fabs(d[iq-1])+g) == fabs(d[iq-1]))) {a[ip-1][iq-1]=0.0;}
7715 else if (fabs(a[ip-1][iq-1]) >= tresh) {
7716 h=d[iq-1]-d[ip-1];
7717 if ((fabs(h)+g) == fabs(h)) {t=(a[ip-1][iq-1])/h; }
7718 else { theta=0.5*h/(a[ip-1][iq-1]);
7719 t=1.0/(fabs(theta)+sqrt(1.0+theta*theta));
7720 if (theta < 0.0) {t = -1.0*t;}
7721 }
7722 c=1.0/sqrt(1+t*t);
7723 s=t*c;
7724 tau=s/(1.0+c);
7725 h=t*a[ip-1][iq-1];
7726 z[ip-1] -= h;
7727 z[iq-1] += h;
7728 d[ip-1] -= h;
7729 d[iq-1] += h;
7730 a[ip-1][iq-1]=0.0;
7731 for (j=1;j<=ip-1;j++) {
7732 ROTATE(a,j-1,ip-1,j-1,iq-1)
7733 //printf("%i %i %i %i",j,ip,j,iq);
7734 }
7735 for (j=ip+1;j<=iq-1;j++) {
7736 ROTATE(a,ip-1,j-1,j-1,iq-1)
7737 //printf("%i %i %i %i ",ip,j,j,iq);
7738 }
7739 for (j=iq+1;j<=n;j++) {
7740 ROTATE(a,ip-1,j-1,iq-1,j-1)
7741 //printf("%i %i %i %i",ip,j,iq,j);
7742 }
7743 for (j=1;j<=n;j++) {
7744 ROTATE(v,j-1,ip-1,j-1,iq-1)
7745 }
7746 ++(nrot);
7747 // printf("U|\n%f %f %f \n%f %f %f\n%f %f %f\nV|\n%f %f %f \n%f %f %f\n%f %f %f\n\n",a[0][0],a[1][0],a[2][0],a[0][1],a[1][1],a[2][1],a[0][2],a[1][2],a[2][2],v[0][0],v[1][0],v[2][0],v[0][1],v[1][1],v[2][1],v[0][2],v[1][2],v[2][2]);
7748 } //else ;//printf("nix:%f p%i q%i",fabs(a[ip-1][iq-1]),ip,iq);
7749 }
7750 }
7751 for (ip=1;ip<=n;ip++) {
7752 b[ip-1] += z[ip-1];
7753 d[ip-1] =b[ip-1];
7754 z[ip-1] =0.0;
7755 }
7756 }
7757 erg[0]=acos((v[0][0]+v[1][1]+v[2][2]-1.0)/2.0);
7758 if (erg[0]==0) {
7759 erg[1]=1.0;
7760 erg[2]=0.0;
7761 erg[3]=0.0;
7762 }else{
7763 erg[1]=(v[2][1]-v[1][2])/(2.0*sin(erg[0]));
7764 erg[2]=(v[0][2]-v[2][0])/(2.0*sin(erg[0]));
7765 erg[3]=(v[1][0]-v[0][1])/(2.0*sin(erg[0]));
7766 erg[0]*=180.0/M_PI;
7767 }
7768 /*printf("=%d=======================================\n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f \n%8.5f %8.5f %8.5f\n========================================\n",i,
7769 d[0],d[1],d[2],v[0][0],v[0][1],v[0][2]
7770 ,v[1][0],v[1][1],v[1][2]
7771 ,v[2][0],v[2][1],v[2][2]
7772
7773 );*/
7774 ev=V3(d[0],d[1],d[2]);
7775 /* if ((ev.x>0)&&(ev.y>0)&&(ev.z>0)){;}else{
7776 printf("NPD: %g %g %g \n",d[0],d[1],d[2]);
7777 }*/
7778 return (double*)erg;
7779 }
7780
fuse()7781 void Molecule::fuse(){
7782 /*! reduces the showatoms list to the asymmetric unit.
7783 * */
7784 HumanSymmetry=QString("Used Symmetry:<br>%1").arg(symmcode2human(QStringList()));
7785 usedSymmetry.clear();
7786 //printf("FUSE\n");
7787 showatoms.clear();
7788 for (int i=0; i<asymm.size();i++){
7789 showatoms.append(asymm[i]);
7790 showatoms[i].molindex=asymm[i].molindex;
7791 }
7792 showbonds.clear();
7793 showbonds=connecting(showatoms);
7794 }
7795
grow()7796 void Molecule::grow(){
7797 /*! completes covalent bound molecule fragments.
7798 *
7799 * */
7800 showatoms.clear();
7801 for (int i=0; i<asymm.size();i++){
7802 showatoms.append(asymm[i]);
7803 showatoms[i].molindex=asymm[i].molindex;
7804 }
7805 showbonds.clear();
7806 QStringList brauchSymm;
7807 QString bs;
7808 brauchSymm.clear();
7809 V3 prime,dp,D,floorD;
7810 double dk,dddd;
7811 for (int k =0; k<sdm.size();k++){
7812 if ((sdm.at(k).covalent)||(growQPeak)){
7813 if (!(growQPeak)&&(asymm[sdm.at(k).a1].molindex<1)) continue;
7814 for (int n=0;n<cell.symmops.size(); n++){
7815 if (((asymm[sdm.at(k).a1].part!=0)&&(asymm[sdm.at(k).a2].part!=0)&&(asymm[sdm.at(k).a1].part!=asymm[sdm.at(k).a2].part)))continue;
7816 if ((asymm[sdm.at(k).a1].an==asymm[sdm.at(k).a2].an)&&(asymm[sdm.at(k).a1].an==0)) continue;
7817 prime=cell.symmops.at(n) * asymm[sdm.at(k).a1].frac + cell.trans.at(n);
7818 D=prime - asymm[sdm.at(k).a2].frac+ V3(0.5,0.5,0.5) ;
7819 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
7820 dp=D - floorD - V3(0.5,0.5,0.5);
7821 if ((n==0)&&(V3(0,0,0)==floorD)) continue;
7822 dk=fl(dp.x,dp.y,dp.z);
7823 //printf ("%f n%d\n",dk,n);
7824 dddd=(sdm.at(k).covalent)?(sdm.at(k).d+0.2):0;
7825 // an<0 means hydrogen atom (this is a hydrogen contact):
7826 if ((asymm[sdm.at(k).a1].an<0)&&(asymm[sdm.at(k).a2].an<0)) dddd=1.8;//||
7827 if ( (dk>0.001)&&(dddd>=dk)) {
7828 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm[sdm.at(k).a1].molindex);
7829 // printf("%s %s %g %g\n",asymm[sdm.at(k).a1].Label.toStdString().c_str(),asymm[sdm.at(k).a2].Label.toStdString().c_str(),sdm.at(k).d,dddd);
7830 // printf("(grow)%s\n",bs.toStdString().c_str());
7831 if ((!brauchSymm.contains(bs))) {
7832 brauchSymm.append(bs);
7833 }
7834 }
7835 }
7836 }
7837 }
7838 for (int i=0; i<bindatoms.size(); i++){
7839 MyAtom a1, a2;
7840 bool bo=false;
7841 int sy1=-1,sy2=-1;
7842 if (bindatoms.at(i).Lab1.contains("_$"))sy1=bindatoms.at(i).Lab1.section("_$",1,1).toInt(&bo);
7843 if (bindatoms.at(i).Lab2.contains("_$"))sy2=bindatoms.at(i).Lab2.section("_$",1,1).toInt(&bo);
7844 bo=false;
7845 if (bindatoms.at(i).Lab1.contains('_'))a1.resiNr=bindatoms.at(i).Lab1.section('_',1,1).toInt(&bo);
7846 if (!bo) a1.resiNr=-1;
7847 if (bindatoms.at(i).Lab2.contains('_'))a2.resiNr=bindatoms.at(i).Lab2.section('_',1,1).toInt(&bo);
7848 if (!bo)a2.resiNr=-1;
7849 a1.Label = bindatoms.at(i).Lab1.section('_',0,0);
7850 a2.Label = bindatoms.at(i).Lab2.section('_',0,0);
7851 int frag1=0,frag2=0;
7852 for (int ii=0; ii<asymm.size();ii++){
7853 if ((a1.resiNr>-1)&& (asymm[ii].resiNr!=a1.resiNr)) continue;
7854 if ((a2.resiNr>-1)&& (asymm[ii].resiNr!=a2.resiNr)) continue;
7855 if (asymm[ii].Label.section('_',0,0).toUpper() == a1.Label.toUpper()){
7856 frag1=asymm[ii].molindex;
7857 }
7858 if (asymm[ii].Label.section('_',0,0).toUpper() == a2.Label.toUpper()){
7859 frag2=asymm[ii].molindex;
7860 }
7861 }
7862 QString ss;
7863 QList<Matrix> smm;
7864 QList<V3> tmm;
7865 int syy1=-1;
7866 if (sy1>-1) syy1=labelEQIV.indexOf(QString("$%1").arg(sy1));
7867 if (syy1>-1) {
7868 smm.append(symmopsEQIV.at(syy1));
7869 tmm.append(transEQIV.at(syy1));
7870 }
7871 int syy2=-1;
7872 if (sy2>-1) syy2=labelEQIV.indexOf(QString("$%1").arg(sy2));
7873 if (syy2>-1) {
7874 smm.append(symmopsEQIV.at(syy2));
7875 tmm.append(transEQIV.at(syy2));
7876 }
7877 for (int ui=0; ui<smm.size(); ui++){
7878 if (cell.symmops.contains(smm.at(ui))) {
7879 V3 r;
7880 r.x=fmod(tmm.at(ui).x+10,1.0);
7881 r.y=fmod(tmm.at(ui).y+10,1.0);
7882 r.z=fmod(tmm.at(ui).z+10,1.0);
7883
7884 for (int is=0; is<cell.symmops.size();is++){
7885 if ((cell.symmops.at(is)==smm.at(ui))&&(cell.trans.at(is)==r))
7886 for (int yi=1; yi<=5; yi++){
7887 ss=QString("%1_%2%3%4:%5,")
7888 .arg(is+1)
7889 .arg((int)(tmm.at(ui).x-r.x) +5)
7890 .arg((int)(tmm.at(ui).y-r.y) +5)
7891 .arg((int)(tmm.at(ui).z-r.z) +5)
7892 .arg(((sy1>-1)&&(!ui))?frag1:frag2);
7893 if (!brauchSymm.contains(ss)) {
7894 brauchSymm.append(ss);
7895 eqivMap[labelEQIV.at(((sy1>-1)&&(!ui))?sy1-1:sy2-1)]=brauchSymm.size();
7896 // printf("%d ==> %d %s\n",sy2-1, brauchSymm.size(),labelEQIV.at(((sy1>-1)&&(!ui))?sy1-1:sy2-1).toStdString().c_str());
7897 }
7898 }
7899 }
7900 }
7901 }
7902 }
7903
7904 /* for (int i=0; i<sdm.size();i++){
7905 if ((sdm.at(i).sn==0)&&(V3(0,0,0)==sdm.at(i).floorD)) continue;
7906 double dddd=((Kovalenz_Radien[asymm[sdm.at(i).a1].an]+ Kovalenz_Radien[asymm[sdm.at(i).a2].an])*0.01+0.5);
7907 if (dddd>sdm.at(i).d){
7908 bs=QString("%1_%2%3%4:%5,").arg(sdm.at(i).sn+1).arg(5-(int)sdm.at(i).floorD.x).arg(5-(int)sdm.at(i).floorD.y).arg(5-(int)sdm.at(i).floorD.z).arg(asymm[sdm.at(i).a1].molindex);
7909 / * printf("%s %f %s %s\n",bs.toStdString().c_str(),sdm.at(i).d,
7910 asymm[sdm.at(i).a1].Label.toStdString().c_str(),
7911 asymm[sdm.at(i).a2].Label.toStdString().c_str());
7912 * /
7913 if (!brauchSymm.contains(bs)) {
7914 brauchSymm.append(bs);
7915 }
7916 }
7917 } */
7918 //packer(brauchSymm);
7919 usedSymmetry+=brauchSymm;
7920 //complete();
7921 // printf("GROW\n");
7922 packer(brauchSymm);
7923 showbonds.clear();
7924 showbonds=connecting(showatoms);
7925 }
7926
grow_plus()7927 void Molecule::grow_plus(){
7928 /*! completes covalent bound molecule fragments.
7929 *
7930 * */
7931 showatoms.clear();
7932 for (int i=0; i<asymm.size();i++){
7933 showatoms.append(asymm[i]);
7934 showatoms[i].molindex=asymm[i].molindex;
7935 }
7936 showbonds.clear();
7937 QStringList brauchSymm;
7938 QString bs;
7939 brauchSymm.clear();
7940 V3 prime,dp,D,floorD;
7941 double dk,dddd;
7942 for (int k =0; k<sdm.size();k++){
7943 if ((sdm.at(k).covalent)||(growQPeak)){
7944 if (!(growQPeak)&&(asymm[sdm.at(k).a1].molindex<1)) continue;
7945 for (int n=0;n<cell.symmops.size(); n++){
7946 if (((asymm[sdm.at(k).a1].part!=0)&&(asymm[sdm.at(k).a2].part!=0)&&(asymm[sdm.at(k).a1].part!=asymm[sdm.at(k).a2].part)))continue;
7947 if ((asymm[sdm.at(k).a1].an==asymm[sdm.at(k).a2].an)&&(asymm[sdm.at(k).a1].an==0)) continue;
7948 prime=cell.symmops.at(n) * asymm[sdm.at(k).a1].frac + cell.trans.at(n);
7949 D=prime - asymm[sdm.at(k).a2].frac+ V3(0.5,0.5,0.5) ;
7950 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
7951 dp=D - floorD - V3(0.5,0.5,0.5);
7952 if ((n==0)&&(V3(0,0,0)==floorD)) continue;
7953 dk=fl(dp.x,dp.y,dp.z);
7954 //printf ("%f n%d\n",dk,n);
7955 dddd=(sdm.at(k).covalent)?(sdm.at(k).d+0.2):0;
7956 if ((asymm[sdm.at(k).a1].an<0)&&(asymm[sdm.at(k).a2].an<0)) dddd=1.8;//||
7957 if ( (dk>0.001)&&(dddd>=dk)) {
7958 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm[sdm.at(k).a1].molindex);
7959 // printf("%s %s %g %g\n",asymm[sdm.at(k).a1].Label.toStdString().c_str(),asymm[sdm.at(k).a2].Label.toStdString().c_str(),sdm.at(k).d,dddd);
7960 // printf("(grow)%s\n",bs.toStdString().c_str());
7961 if ((!brauchSymm.contains(bs))) {
7962 brauchSymm.append(bs);
7963 }
7964 }
7965 }
7966 }
7967 }
7968 for (int i=0; i<bindatoms.size(); i++){
7969 MyAtom a1, a2;
7970 bool bo=false;
7971 int sy1=-1,sy2=-1;
7972 if (bindatoms.at(i).Lab1.contains("_$"))sy1=bindatoms.at(i).Lab1.section("_$",1,1).toInt(&bo);
7973 if (bindatoms.at(i).Lab2.contains("_$"))sy2=bindatoms.at(i).Lab2.section("_$",1,1).toInt(&bo);
7974 bo=false;
7975 if (bindatoms.at(i).Lab1.contains('_'))a1.resiNr=bindatoms.at(i).Lab1.section('_',1,1).toInt(&bo);
7976 if (!bo) a1.resiNr=-1;
7977 if (bindatoms.at(i).Lab2.contains('_'))a2.resiNr=bindatoms.at(i).Lab2.section('_',1,1).toInt(&bo);
7978 if (!bo)a2.resiNr=-1;
7979 a1.Label = bindatoms.at(i).Lab1.section('_',0,0);
7980 a2.Label = bindatoms.at(i).Lab2.section('_',0,0);
7981 int frag1=0,frag2=0;
7982 for (int ii=0; ii<asymm.size();ii++){
7983 if ((a1.resiNr>-1)&& (asymm[ii].resiNr!=a1.resiNr)) continue;
7984 if ((a2.resiNr>-1)&& (asymm[ii].resiNr!=a2.resiNr)) continue;
7985 if (asymm[ii].Label.section('_',0,0).toUpper() == a1.Label.toUpper()){
7986 frag1=asymm[ii].molindex;
7987 }
7988 if (asymm[ii].Label.section('_',0,0).toUpper() == a2.Label.toUpper()){
7989 frag2=asymm[ii].molindex;
7990 }
7991 }
7992 QString ss;
7993 QList<Matrix> smm;
7994 QList<V3> tmm;
7995 int syy1=-1;
7996 if (sy1>-1) syy1=labelEQIV.indexOf(QString("$%1").arg(sy1));
7997 if (syy1>-1) {
7998 smm.append(symmopsEQIV.at(syy1));
7999 tmm.append(transEQIV.at(syy1));
8000 }
8001 int syy2=-1;
8002 if (sy2>-1) syy2=labelEQIV.indexOf(QString("$%1").arg(sy2));
8003 if (syy2>-1) {
8004 smm.append(symmopsEQIV.at(syy2));
8005 tmm.append(transEQIV.at(syy2));
8006 }
8007 for (int ui=0; ui<smm.size(); ui++)
8008 if (cell.symmops.contains(smm.at(ui))) {
8009 V3 r;
8010 r.x=fmod(tmm.at(ui).x+10,1.0);
8011 r.y=fmod(tmm.at(ui).y+10,1.0);
8012 r.z=fmod(tmm.at(ui).z+10,1.0);
8013
8014 for (int is=0; is<cell.symmops.size();is++){
8015 if ((cell.symmops.at(is)==smm.at(ui))&&(cell.trans.at(is)==r))
8016 for (int yi=1; yi<=5; yi++){
8017 ss=QString("%1_%2%3%4:%5,")
8018 .arg(is+1)
8019 .arg((int)(tmm.at(ui).x-r.x) +5)
8020 .arg((int)(tmm.at(ui).y-r.y) +5)
8021 .arg((int)(tmm.at(ui).z-r.z) +5)
8022 .arg(((sy1>-1)&&(!ui))?frag1:frag2);
8023 if (!brauchSymm.contains(ss)) {
8024 brauchSymm.append(ss);
8025 // printf("### %d = %d\n",((sy1>-1)&&(!ui))?sy1:sy2,brauchSymm.size());
8026 eqivMap[labelEQIV.at(((sy1>-1)&&(!ui))?sy1-1:sy2-1)]=brauchSymm.size();
8027 // qDebug()<<ss;
8028 }
8029 }
8030 }
8031 }
8032 }
8033
8034 /* for (int i=0; i<sdm.size();i++){
8035 if ((sdm.at(i).sn==0)&&(V3(0,0,0)==sdm.at(i).floorD)) continue;
8036 double dddd=((Kovalenz_Radien[asymm[sdm.at(i).a1].an]+ Kovalenz_Radien[asymm[sdm.at(i).a2].an])*0.01+0.5);
8037 if (dddd>sdm.at(i).d){
8038 bs=QString("%1_%2%3%4:%5,").arg(sdm.at(i).sn+1).arg(5-(int)sdm.at(i).floorD.x).arg(5-(int)sdm.at(i).floorD.y).arg(5-(int)sdm.at(i).floorD.z).arg(asymm[sdm.at(i).a1].molindex);
8039 / * printf("%s %f %s %s\n",bs.toStdString().c_str(),sdm.at(i).d,
8040 asymm[sdm.at(i).a1].Label.toStdString().c_str(),
8041 asymm[sdm.at(i).a2].Label.toStdString().c_str());
8042 * /
8043 if (!brauchSymm.contains(bs)) {
8044 brauchSymm.append(bs);
8045 }
8046 }
8047 } */
8048 //packer(brauchSymm);
8049 usedSymmetry+=brauchSymm;
8050 complete();
8051 showbonds.clear();
8052 showbonds=connecting(showatoms);
8053 }
8054
packPoint(const V3 & prime,QList<V3> & wearein)8055 void Molecule::packPoint(const V3 &prime, QList<V3> &wearein){//!< Pack inside cell
8056 //wearein.clear();
8057 V3 p;
8058 double dawars=1000.0,dl;
8059 const double ami = 0.0, ama = 1.0, bmi = 0.0, bma = 1.0, cmi = 0.0, cma = 1.0;
8060 dawars=1000.0;
8061 for (int g=0; g<wearein.size();g++){
8062 dl=fl(prime.x-wearein.at(g).x, prime.y-wearein.at(g).y, prime.z-wearein.at(g).z);
8063 dawars=(dl<dawars)?dl:dawars;
8064 }
8065 //int hh=0,kk=0,ll=0;
8066 if (dawars>0.01){
8067 for (int hh=-11; hh<12; hh++){
8068 for (int kk=-11; kk<12; kk++){
8069 for (int ll=-11; ll<12; ll++){
8070 if ((prime.x+hh)<ami) continue;
8071 if ((prime.y+kk)<bmi) continue;
8072 if ((prime.z+ll)<cmi) continue;
8073 if ((prime.x+hh)>ama) continue;
8074 if ((prime.y+kk)>bma) continue;
8075 if ((prime.z+ll)>cma) continue;
8076 p=prime+V3(static_cast<double>(hh),static_cast<double>(kk),static_cast<double>(ll));
8077 //printf("=>%g %g %g \n",p.x,p.y,p.z);
8078 wearein.append(p);
8079 }//ll
8080 }//kk
8081 }//hh
8082 }
8083 }
8084
packLine(const V3 & p1,const V3 & p2,V3 & vec,QList<V3> & wearein,int c,QList<int> & dc)8085 void Molecule::packLine(const V3 &p1,const V3 &p2, V3 &vec, QList<V3> &wearein, int c, QList<int> &dc){//!< Pack inside cell
8086 V3 prime,dprime,pA,pB;
8087 //wearein.clear();
8088 //double dawars=1000.0,dawars2=1000.0,dl;
8089 const double ami = -0.001, ama = 1.001, bmi = -0.001, bma = 1.001, cmi = -0.001, cma = 1.001;
8090 //for (int n=0; n<cell.symmops.size();n++){
8091 {int n=0;
8092 prime=cell.symmops.at(n) * p1 + cell.trans.at(n);
8093 dprime=cell.symmops.at(n) * p2 + cell.trans.at(n);
8094 //V3 donotrot=cell.symmops.at(n)*vec;
8095 //printf("donotrot %g\n",fabs(donotrot*vec));
8096 V3 r1=V3( prime.x*vec.x, prime.y*vec.y, prime.z*vec.z);
8097 V3 r2=V3(dprime.x*vec.x,dprime.y*vec.y,dprime.z*vec.z);
8098 //prime+=r1;
8099 //dprime+=r1;
8100 /*printf("?? %g %g %g ? %g %g %g\n",
8101 prime.x,prime.y,prime.z,
8102 dprime.x,dprime.y,dprime.z);*/
8103 //if (fabs(donotrot*vec) <0.9) continue;
8104 //printf("%d\n",__LINE__);
8105 //floorD=V3(floor(prime.x),floor(prime.y),floor(prime.z));
8106 //prime=prime -floorD;
8107 /*dawars2=dawars=1000.0;
8108 for (int g=0; g<wearein.size();g++){
8109 dl=fl(prime.x-wearein.at(g).x, prime.y-wearein.at(g).y, prime.z-wearein.at(g).z);
8110 dawars=(dl<dawars)?dl:dawars;
8111 g++;
8112 dl=fl(dprime.x-wearein.at(g).x, dprime.y-wearein.at(g).y, dprime.z-wearein.at(g).z);
8113 dawars2=(dl<dawars2)?dl:dawars2;
8114 } //*/
8115 //printf("!! %g %g %g %d %g %g %g %g %g\n", prime.x,prime.y,prime.z,n,dprime.x,dprime.y,dprime.z,dawars,dawars2);
8116 // if ((dawars<0.01)&&(dawars2<0.01)) continue;
8117 for (int hh=-11; hh<12; hh++){
8118 for (int kk=-11; kk<12; kk++){
8119 for (int ll=-11; ll<12; ll++){
8120 if ((prime.x+hh)<ami) continue;
8121 if ((prime.y+kk)<bmi) continue;
8122 if ((prime.z+ll)<cmi) continue;
8123 if ((prime.x+hh)>ama) continue;
8124 if ((prime.y+kk)>bma) continue;
8125 if ((prime.z+ll)>cma) continue;
8126
8127 if ((dprime.x+hh)<ami) continue;
8128 if ((dprime.y+kk)<bmi) continue;
8129 if ((dprime.z+ll)<cmi) continue;
8130 if ((dprime.x+hh)>ama) continue;
8131 if ((dprime.y+kk)>bma) continue;
8132 if ((dprime.z+ll)>cma) continue;
8133 pA=prime+V3(static_cast<double>(hh),static_cast<double>(kk),static_cast<double>(ll));
8134 pB=dprime+V3(static_cast<double>(hh),static_cast<double>(kk),static_cast<double>(ll));
8135 int bi=-1, ai = wearein.indexOf(pA);
8136 if (ai>-1) bi = wearein.indexOf(pB);
8137 if (fabs(0.0+ai-bi)!=1.0){
8138 //printf("we are in %d %d %g\n",wearein.indexOf(pA),wearein.indexOf(pB),fabs(0.0+ai-bi));
8139 //printf("a=>%g %g %g %d:%d%d%d\n",pA.x, pA.y, pA.z, n+1,5+hh,5+kk,5+ll);
8140 //printf("b=>%g %g %g %d:%d%d%d\n",pB.x, pB.y, pB.z, n+1,5+hh,5+kk,5+ll);
8141 wearein.append(pA);
8142 dc.append(c);
8143 wearein.append(pB);
8144 dc.append(c);
8145 }
8146 }//ll
8147 }//kk
8148 }//hh
8149 }//n++
8150 }
8151
packInLimits(double ami,double ama,double bmi,double bma,double cmi,double cma)8152 void Molecule::packInLimits(double ami, double ama, double bmi, double bma, double cmi, double cma){//!< Pack inside given limits (eg multiple unit cells)
8153
8154 MyAtom newAtom;
8155 newAtom.hidden=0;
8156 V3 prime,floorD;
8157 double dawars=1000.0,dl;
8158 for (int n=0; n<cell.symmops.size();n++){
8159 for (int i=0; i<asymm.size();i++){
8160 //if ((asymm.at(i).an>-1)&&(asymm.at(i).molindex>0))
8161 {
8162 prime=cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n);
8163 floorD=V3(floor(prime.x),floor(prime.y),floor(prime.z));
8164 //prime=prime -floorD;
8165 dawars=1000.0;
8166 for (int g=0; g<showatoms.size();g++){
8167 if ((asymm[i].an*showatoms[g].an<0)) continue;
8168 dl=fl(prime.x-showatoms[g].frac.x, prime.y-showatoms[g].frac.y, prime.z-showatoms[g].frac.z);
8169 dawars=(dl<dawars)?dl:dawars;
8170 }
8171 if (dawars<0.01) continue;
8172 for (int hh=-11; hh<12; hh++)
8173 for (int kk=-11; kk<12; kk++)
8174 for (int ll=-11; ll<12; ll++){
8175 if ((prime.x+hh)<ami) continue;
8176 if ((prime.y+kk)<bmi) continue;
8177 if ((prime.z+ll)<cmi) continue;
8178 if ((prime.x+hh)>ama) continue;
8179 if ((prime.y+kk)>bma) continue;
8180 if ((prime.z+ll)>cma) continue;
8181 newAtom.part=asymm[i].part;
8182 newAtom.frac=prime+V3((double)hh,(double)kk,(double)ll);
8183 frac2kart(newAtom.frac,newAtom.pos);
8184 newAtom.an=asymm[i].an;
8185 newAtom.molindex=asymm[i].molindex;
8186 newAtom.peakHeight=asymm[i].peakHeight;
8187 newAtom.resiNr=asymm[i].resiNr;
8188
8189 newAtom.sof=asymm[i].sof;
8190 newAtom.Label=asymm[i].Label;
8191 newAtom.isIso=asymm[i].isIso;
8192 newAtom.ufiso_org=asymm[i].ufiso_org;
8193
8194 newAtom.sof_org=asymm[i].sof_org;
8195 newAtom.symmGroup=1;
8196 newAtom.sg=n;
8197 // printf("A%d %d %d %d %g %g %g\n", n, hh, kk, ll, floorD.x, floorD.y, floorD.z);
8198 newAtom.scod = genSymCode(n,hh,kk,ll);//genSymCode(n,(int)(hh+floorD.x),(int)(kk+floorD.x),(int)(ll+floorD.x));//genSymCode(n,hh,kk,ll);
8199 newAtom.auidx = i;
8200 if ((asymm[i].uc.m12==0.0)&&(asymm[i].uc.m23==0.0)&&(asymm[i].uc.m13==0.0)){
8201 newAtom.uf.m11=newAtom.uc.m11=newAtom.uc.m22=newAtom.uc.m33=asymm[i].uf.m11;
8202 newAtom.uc.m12=newAtom.uc.m13=newAtom.uc.m23=newAtom.uc.m21=newAtom.uc.m31=newAtom.uc.m32=0.0;
8203 }
8204 else {
8205 Usym(asymm[i].uf,cell.symmops[n],newAtom.uf);
8206 Uf2Uo(newAtom.uf,newAtom.uc);
8207 }
8208 showatoms.append(newAtom);
8209 }//ll
8210 }//packable
8211 // else if ((asymm.at(i).an<0)&&(n==0)) showatoms.append(asymm[i]);//non atoms BCPs, Dummys, etc.
8212 }//i++
8213 }//n++
8214 showbonds.clear();
8215 showbonds=connecting(showatoms);
8216
8217 }
8218
packInLimits(CEnvironment & au,double ami,double ama,double bmi,double bma,double cmi,double cma)8219 CEnvironment Molecule::packInLimits(CEnvironment &au, double ami, double ama, double bmi, double bma, double cmi, double cma){//!< Pack inside given limits (eg multiple unit cells)
8220 MyAtom newAtom;
8221 CEnvironment sa;
8222 newAtom.hidden=0;
8223 V3 prime,floorD;
8224 //double dawars=1000.0,dl;
8225 for (int n=0; n<cell.symmops.size();n++){
8226 for (int i=0; i<au.size();i++){
8227 prime=cell.symmops.at(n) * au.at(i).frac + cell.trans.at(n);
8228 floorD=V3(floor(prime.x),floor(prime.y),floor(prime.z));
8229 prime=prime -floorD;
8230 /*dawars=1000.0;
8231 for (int g=0; g<sa.size();g++){
8232 dl=fl(prime.x-sa[g].frac.x, prime.y-sa[g].frac.y, prime.z-sa[g].frac.z);
8233 dawars=(dl<dawars)?dl:dawars;
8234 }
8235 if (dawars<0.01) continue;*/
8236 for (int hh=-11; hh<12; hh++)
8237 for (int kk=-11; kk<12; kk++)
8238 for (int ll=-11; ll<12; ll++){
8239 if ((prime.x+hh)<ami) continue;
8240 if ((prime.y+kk)<bmi) continue;
8241 if ((prime.z+ll)<cmi) continue;
8242 if ((prime.x+hh)>ama) continue;
8243 if ((prime.y+kk)>bma) continue;
8244 if ((prime.z+ll)>cma) continue;
8245 newAtom.frac=prime+V3((double)hh, (double)kk, (double)ll);
8246 frac2kart(newAtom.frac,newAtom.pos);
8247 newAtom.an=au[i].an;
8248 newAtom.peakHeight=au[i].peakHeight;
8249 newAtom.sof=au[i].sof;
8250 newAtom.Label=au[i].Label;
8251 newAtom.isIso=au[i].isIso;
8252 newAtom.ufiso_org=au[i].ufiso_org;
8253 newAtom.sof_org=au[i].sof_org;
8254 newAtom.symmGroup=1;
8255 newAtom.sg=n;
8256 newAtom.scod = genSymCode(n,hh,kk,ll);
8257 // printf("B%d %d %d %d %g %g %g\n", n, hh, kk, ll, floorD.x, floorD.y, floorD.z);
8258 //newAtom.scod = genSymCode(n,(int)(hh-floorD.x),(int)(kk-floorD.x),(int)(ll-floorD.x));
8259 newAtom.auidx = i;
8260 Usym(au[i].uf,cell.symmops[n],newAtom.uf);
8261 sa.append(newAtom);
8262 }//ll
8263 }//i++
8264 }//n++
8265 return sa;
8266 }
8267
fillCell()8268 void Molecule::fillCell(){
8269 /*! Fills the unit cell with molecules.
8270 *
8271 * */
8272 packInLimits(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
8273 return;
8274
8275 showatoms.clear();
8276 for (int i=0; i<asymm.size();i++){
8277 showatoms.append(asymm[i]);
8278 showatoms[i].molindex=asymm[i].molindex;
8279 }
8280 showbonds.clear();
8281 QStringList brauchSymm;
8282 QString bs;
8283 brauchSymm.clear();
8284 V3 prime,dp,D,floorD;
8285 for (int k =0; k<sdm.size();k++){
8286 if (sdm.at(k).covalent){
8287 if (asymm[sdm.at(k).a1].molindex<1) continue;
8288 for (int n=0;n<cell.symmops.size(); n++){
8289 D=prime=cell.symmops.at(n) * asymm[sdm.at(k).a1].frac + cell.trans.at(n);
8290 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
8291 if ((n==0)&&(V3(0,0,0)==floorD)) continue;
8292 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm[sdm.at(k).a1].molindex);
8293 if (!brauchSymm.contains(bs)) {
8294 brauchSymm.append(bs);
8295 }
8296 }
8297 }
8298 }
8299 packer(brauchSymm);
8300 showbonds.clear();
8301 showbonds=connecting(showatoms);
8302 }
8303
expandAll()8304 void Molecule::expandAll(){
8305 /*! like Molecule.expandAt but this searches vor neighboring molecules arround every atom of the asymmetric unit and adds them to the showatoms list.
8306 */
8307 //if (index>=showatoms.size()) return;
8308 // V3 expander= showatoms.at(index).frac;
8309 V3 prime,floorD,D;
8310 double SUCHRAD=3.2;
8311 for (int i=0; i<asymm.size();i++){//Rapunzel lass dein H herunter
8312 if (asymm.at(i).an==0) {
8313 SUCHRAD-=0.7;
8314 break;
8315 }
8316 }
8317 // printf(" Rapunzels H ist %f lang\n",SUCHRAD);
8318 QStringList brauchSymm;
8319 QString bs;
8320 brauchSymm.clear();
8321 // brauchSymm+=(usedSymmetry);
8322 double dk;
8323 for (int j=0; j<asymm.size();j++){
8324 if (asymm.at(j).an<0) continue;
8325 for (int n=0; n<cell.symmops.size();n++){
8326 for (int i=0; i<asymm.size();i++){
8327 if (asymm.at(i).an<0) continue;
8328 prime=cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n);
8329 D=prime - asymm.at(j).frac + V3(0.5,0.5,0.5) ;
8330 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
8331 if ((n==0)&&(floorD==V3(0,0,0))) {continue;}
8332 D=D - floorD - V3(0.5,0.5,0.5);
8333 dk=fl(D.x,D.y,D.z);
8334 if (dk<SUCHRAD){
8335 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm.at(i).molindex);
8336 if ((!brauchSymm.contains(bs))&&(asymm.at(i).molindex>0)) {
8337 brauchSymm.append(bs);
8338 }
8339 }
8340 }
8341 }
8342 }
8343 showatoms.clear();
8344 for (int i=0; i<asymm.size();i++){
8345 showatoms.append(asymm[i]);
8346 showatoms[i].molindex=asymm[i].molindex;
8347 }
8348 packer(brauchSymm);
8349 showbonds.clear();
8350 showbonds=connecting(showatoms);
8351 }
8352
complete()8353 void Molecule::complete(){
8354 /*! If the current visible atoms are covalently bound to symmetry equivalents the latter are added to the showatoms list.
8355 * */
8356 //if (index>=showatoms.size()) return;
8357 // V3 expander= showatoms.at(index).frac;
8358 V3 prime,floorD,D;
8359 QStringList brauchSymm;
8360 QString bs;
8361 // brauchSymm.clear();
8362 brauchSymm+=(usedSymmetry);
8363 double dk;
8364 int s,h,k,l,symmgroup;
8365 V3 pos0;
8366 for (int sy=0; sy<usedSymmetry.size(); sy++){
8367 sscanf(usedSymmetry.at(sy).toLatin1(),"%d_%1d%1d%1d:%d",&s,&h,&k,&l,&symmgroup);
8368 h-=5;
8369 k-=5;
8370 l-=5;
8371 s--;
8372 for (int j=0; j<asymm.size();j++){
8373 if (asymm.at(j).an<0) continue;
8374 for (int n=0; n<cell.symmops.size();n++){
8375 for (int i=0; i<asymm.size();i++){
8376 if (asymm.at(i).an<1) continue;
8377 if (asymm[i].molindex!=symmgroup) continue;
8378 pos0=cell.symmops.at(s)*asymm.at(i).frac+cell.trans.at(s)+V3(h,k,l);
8379 prime=cell.symmops.at(n) * asymm.at(j).frac + cell.trans.at(n);
8380 D=prime - pos0 + V3(0.5,0.5,0.5) ;
8381 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
8382 if ((n==0)&&(floorD==V3(0,0,0))) {continue;}
8383 D=D - floorD - V3(0.5,0.5,0.5);
8384 dk=fl(D.x,D.y,D.z);
8385 double dddd=qMin(1.7,(Kovalenz_Radien[asymm.at(i).an]+ Kovalenz_Radien[asymm.at(j).an])*0.012);
8386 if (dk<dddd){
8387 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm.at(i).molindex);
8388 if ((!brauchSymm.contains(bs))&&(asymm.at(i).molindex>0)) {
8389 brauchSymm.append(bs);
8390 }
8391 }
8392 }
8393 }
8394 }
8395 }
8396 showatoms.clear();
8397 for (int i=0; i<asymm.size();i++){
8398 showatoms.append(asymm[i]);
8399 showatoms[i].molindex=asymm[i].molindex;
8400 }
8401 packer(brauchSymm);
8402 showbonds.clear();
8403 showbonds=connecting(showatoms);
8404 }
8405
expandAt(int index)8406 void Molecule::expandAt(int index){
8407 /*! searches SUCHRAD=3.2 A around the given atom for symmetry equivalent molecules and adds them to the showatoms list.
8408 * if Hydrogens are inside the structure the SUCHRAD is reduced about 0.7 A.
8409 * @param index index of the specified atom from the current showatoms list.
8410 */
8411 if (index>=showatoms.size()) return;
8412 V3 expander= showatoms.at(index).frac;
8413 V3 prime,floorD,D;
8414 double SUCHRAD=3.2;
8415 for (int i=0; i<asymm.size();i++){//Rapunzel lass dein H herunter
8416 if (asymm.at(i).an==0) {//haha if there are H atoms th search radius is reduced by 0.7 A
8417 SUCHRAD-=0.7;
8418 break;
8419 }
8420 }
8421 //printf(" Rapunzels H ist %f lang\n",SUCHRAD);
8422 QStringList brauchSymm;
8423 QString bs;
8424 brauchSymm.clear();
8425 brauchSymm+=(usedSymmetry);
8426 double dk;
8427 for (int n=0; n<cell.symmops.size();n++){
8428 for (int i=0; i<asymm.size();i++){
8429 prime=cell.symmops.at(n) * asymm.at(i).frac + cell.trans.at(n);
8430 D=prime - expander + V3(0.5,0.5,0.5) ;
8431 floorD=V3(floor(D.x),floor(D.y),floor(D.z));
8432 if ((n==0)&&(floorD==V3(0,0,0))) {continue;}
8433 D=D - floorD - V3(0.5,0.5,0.5);
8434 dk=fl(D.x,D.y,D.z);
8435 if (dk<SUCHRAD){
8436 bs=QString("%1_%2%3%4:%5,").arg(n+1).arg(5-(int)floorD.x).arg(5-(int)floorD.y).arg(5-(int)floorD.z).arg(asymm.at(i).molindex);
8437 if ((!brauchSymm.contains(bs))&&(asymm.at(i).molindex>0)) {
8438 brauchSymm.append(bs);
8439 }
8440 }
8441 }
8442 }
8443 showatoms.clear();
8444 for (int i=0; i<asymm.size();i++){
8445 showatoms.append(asymm[i]);
8446 showatoms[i].molindex=asymm[i].molindex;
8447 }
8448 packer(brauchSymm);
8449 showbonds.clear();
8450 showbonds=connecting(showatoms);
8451 }
8452
packer(QStringList brauchSymm)8453 void Molecule::packer(QStringList brauchSymm){
8454 /*! Packs symmetry equivalent atoms according to the given list of internal symmetry codes and adds them to the showatoms list
8455 * HumanSymmetry is feeeded with a human readalble list of used symmetry.
8456 * @param brauchSymm list of internal symmetry codes.
8457 */
8458 // printf("MOEBEL? packer\n");
8459 usedSymmetry.clear();
8460 usedSymmetry+=(brauchSymm);
8461 MyAtom newAtom;
8462 newAtom.hidden=0;
8463 int s,h,k,l,gibscho=0,symmgroup;
8464 // balken->setMinimum(0);
8465 // balken->setMaximum(brauchSymm.size());
8466 // balken->show();
8467 HumanSymmetry=QString("Used Symmetry:<br>%1").arg(symmcode2human(brauchSymm));
8468 QString pre,suff;
8469 for (int j=0;j<brauchSymm.size();j++){
8470 // balken->setValue(j);
8471
8472 sscanf(brauchSymm.at(j).toLatin1(),"%d_%1d%1d%1d:%d",&s,&h,&k,&l,&symmgroup);
8473 //printf("BS:!%s! %d h%d k%d l%d sg%d\n",brauchSymm.at(j).toStdString().c_str(),s,h,k,l,symmgroup);
8474 h-=5;
8475 k-=5;
8476 l-=5;
8477 s--;
8478 for (int i=0;i<asymm.size();i++){
8479 // if (asymm[i].molindex) printf ("doch %d %d %s\n",asymm[i].an,asymm[i].molindex,asymm.at(i).Label.toStdString().c_str());
8480 if ((asymm[i].molindex==symmgroup)&&(asymm[i].an>-1)){
8481 newAtom.frac=cell.symmops.at(s)*asymm[i].frac+cell.trans.at(s)+V3(h,k,l);
8482 newAtom.part=asymm[i].part;
8483 frac2kart(newAtom.frac,newAtom.pos);
8484 newAtom.Label=QString("%1%2%3")
8485 .arg(asymm.at(i).Label)
8486 .arg(QString::fromUtf8("»"))
8487 .arg(j+1);// */
8488 newAtom.an=asymm[i].an;
8489 newAtom.symmGroup=j+1;
8490 newAtom.sg=s;
8491 newAtom.scod = genSymCode(s,h,k,l);
8492 newAtom.auidx = i;
8493 //printf("scod=%d %d %d %d %d\n",newAtom.scod, s,h+5,k+5,l+5);
8494 newAtom.sof_org=asymm[i].sof_org;
8495 newAtom.isIso=asymm[i].isIso;
8496 newAtom.ufiso_org=asymm[i].ufiso_org;
8497 newAtom.molindex=asymm[i].molindex;
8498 newAtom.ResiClass=asymm[i].ResiClass;
8499 newAtom.resiNr=asymm[i].resiNr;
8500 if ((asymm[i].uc.m12==0.0 )&&(asymm[i].uc.m23==0.0)&&(asymm[i].uc.m13==0.0)){
8501 newAtom.uc.m11=newAtom.uc.m22=newAtom.uc.m33=asymm[i].uf.m11;
8502 newAtom.uc.m12=newAtom.uc.m13=newAtom.uc.m23=newAtom.uc.m21=newAtom.uc.m31=newAtom.uc.m32=0.0;
8503 newAtom.uf=asymm[i].uf;
8504 }
8505 else {
8506 Usym(asymm[i].uf,cell.symmops[s],newAtom.uf);
8507 Uf2Uo(newAtom.uf,newAtom.uc);
8508 }
8509 gibscho=0;
8510 if (newAtom.part>=0){
8511 for(int gbt=0;gbt<showatoms.size();gbt++){
8512 if (showatoms.at(gbt).an<0) continue;
8513 if (showatoms.at(gbt).part!=newAtom.part)continue;
8514 if (fl(newAtom.frac.x-showatoms[gbt].frac.x,
8515 newAtom.frac.y-showatoms[gbt].frac.y,
8516 newAtom.frac.z-showatoms[gbt].frac.z)<0.2) gibscho=1;
8517 }
8518 }
8519 if (!gibscho) {
8520 showatoms.append(newAtom);
8521 }
8522 }// /*
8523 else if ((growQPeak)&&(asymm[i].an==-1)&&(asymm[i].molindex==symmgroup)){
8524 newAtom.frac=cell.symmops.at(s)*asymm[i].frac+cell.trans.at(s)+V3(h,k,l);
8525 newAtom.part=asymm[i].part;
8526 newAtom.isIso=asymm[i].isIso;
8527 frac2kart(newAtom.frac,newAtom.pos);
8528 newAtom.Label=asymm.at(i).Label;
8529 newAtom.an=asymm[i].an;
8530 newAtom.symmGroup=j+1;
8531 newAtom.sg=s;
8532 newAtom.scod = genSymCode(s,h,k,l);
8533 newAtom.auidx = i;
8534 newAtom.sof_org=asymm[i].sof_org;
8535 newAtom.sof=asymm[i].sof;
8536 newAtom.ufiso_org=asymm[i].ufiso_org;
8537 newAtom.molindex=asymm[i].molindex;
8538 newAtom.ResiClass=asymm[i].ResiClass;
8539 newAtom.resiNr=asymm[i].resiNr;
8540 newAtom.peakHeight=asymm[i].peakHeight;
8541 newAtom.orginalLine= asymm[i].orginalLine;
8542 gibscho=0;
8543 if (newAtom.part>=0){
8544 for(int gbt=0;gbt<showatoms.size();gbt++){
8545 if (fl(newAtom.frac.x-showatoms[gbt].frac.x,
8546 newAtom.frac.y-showatoms[gbt].frac.y,
8547 newAtom.frac.z-showatoms[gbt].frac.z)<0.1) gibscho=1;
8548 }
8549 }
8550 if (!gibscho) {
8551 showatoms.append(newAtom);
8552 }
8553 }// */
8554 }
8555 }
8556 //statusBar()->showMessage(tr("Neighbor search is finished"));
8557 }
8558
checkExtensions()8559 bool Molecule::checkExtensions(){
8560 bool gut=true;
8561 int glmajor=0,glminor=0;
8562 float vv=0.0;
8563
8564 const char *extensionString =(const char *) glGetString(GL_EXTENSIONS);
8565 //printf("%s \n",extensionString);
8566 const char *verstring=(char*)glGetString(GL_VERSION);
8567 if ((verstring==nullptr)||(sscanf(verstring,"%d.%d",&glmajor,&glminor)!=2)) glminor=glmajor=0;
8568 //printf("!!%s \n",verstring);
8569 if (glmajor<2) return false;
8570 verstring=(char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
8571 if ((verstring==nullptr)||(sscanf(verstring,"%f",&vv)!=1)) vv=0.0;
8572 //qDebug()<<vv<<glminor<<glmajor<<verstring;
8573 if (vv<1.2) return false;
8574
8575 QString pth=QDir::homePath()+"/GL-Extensions.txt";
8576 FILE *extf=fopen(pth.toStdString().c_str(),"wt");
8577 fwrite(extensionString,sizeof(char),strlen(extensionString)+1,extf);
8578 fclose(extf);
8579 if (nullptr==strstr(extensionString, "GL_ARB_vertex_shader"))gut=false;
8580 if (nullptr==strstr(extensionString, "GL_ARB_fragment_shader")) gut=false;
8581 return gut;
8582 }
8583
installShader()8584 int Molecule::installShader(){
8585 if (!checkExtensions()) {
8586 //printf("insallShader::missing Extensions!\n");
8587 return 0;
8588 }
8589 QFile logshad(QDir::homePath()+"/shaderlog.txt");
8590 logshad.open(QFile::Append|QFile::Text);
8591 logshad.write(QDateTime::currentDateTime().toString().toLatin1());
8592 logshad.write("\n\ntest\n");
8593 logshad.flush(); // */
8594 static const char* avs=
8595 "#version 120\n"
8596 "uniform bool lighting;\n"
8597 "varying vec3 nor, lightDirection, normal, uv, pos,eye;\n"
8598 "varying vec4 gcolor;\n"
8599 "varying float ep,np;\n"
8600 "void main(void){\n"
8601 "nor=gl_Normal;\n"
8602 "gcolor=gl_Color;\n"
8603 "uv = gl_Vertex.xyz;\n"
8604 "if (lighting){\n"
8605 "normal = gl_NormalMatrix * gl_Normal;\n"
8606 "vec4 eyePos = gl_ModelViewMatrixInverse * vec4(0., 0., 0., 1.);\n"
8607 "eye = eyePos.xyz - gl_Vertex.xyz;\n"
8608 "lightDirection=normalize(vec3(-1.0,1.0,1.0));\n"
8609 "pos = (gl_ModelViewMatrix * gl_Vertex).xyz;\n"
8610 "}\n"
8611 "gl_Position = ftransform();\n"
8612 "}\n";
8613 static const char* afs=
8614 "#version 120\n"
8615 "varying vec3 nor, lightDirection, normal, uv, pos,eye;\n"
8616 "varying vec4 gcolor;\n"
8617 "uniform vec4 fogColor;\n"
8618 "uniform int LOD;\n"
8619 "uniform int fogrange;\n"
8620 "uniform bool lighting, wall, ring, ball, open, whitering, eli, fog;\n"
8621 "void main(void) {\n"
8622 "vec4 specular, ambient, diffuse;\n"
8623 "specular = gl_LightSource[0].specular;\n"
8624 "ambient = gl_LightSource[0].ambient;\n"
8625 "diffuse = gl_LightSource[0].diffuse;\n"
8626 "vec4 color;\n"
8627 "gl_FragColor.a=1.0;\n"
8628 "float cut=0.07;\n"
8629 "if (lighting){\n"
8630 "vec3 N = normalize(normal);\n"
8631 "gl_MaterialParameters M = gl_FrontMaterial;\n"
8632 "float NdotL = dot(N, lightDirection);\n"
8633 "float RdotL = dot(reflect(normalize(pos), N), lightDirection);\n"
8634 "color = ((ambient + diffuse * max(NdotL, 0.0)) * gcolor +\n"
8635 "(M.specular * specular * pow(max(RdotL, 0.0), M.shininess)));\n"
8636 "}else{\n"
8637 "color=gcolor;\n"
8638 "}\n"
8639 "if (wall){\n"
8640 "float R=0.92;\n"
8641 "if (LOD==3) R=0.98;\n"
8642 "else if (LOD==2)R=0.97; \n"
8643 "gl_FragColor.a=(length(uv)<R)?1.0:0.0;\n"
8644 "gl_FragColor.xyz = color.xyz;\n"
8645 "}else{\n"
8646 "if (eli) {\n"
8647 "vec3 XYZ=abs(nor);\n"
8648 "if ((ring)&&(min(XYZ.x,min(XYZ.y,XYZ.z))<=cut)){ \n"
8649 "if (whitering) gl_FragColor.xyz = mix(color.xyz,vec3(1.0,1.0,1.0),0.6);\n"
8650 "else gl_FragColor.xyz = mix(color.xyz,vec3(0.0,0.0,0.0),0.6);\n"
8651 "}\n"
8652 "else if (open){\n"
8653 "int ep=0,np=0;\n"
8654 "ep+=(eye.x>=0.0)?1:0;\n"
8655 "ep+=(eye.y>=0.0)?2:0;\n"
8656 "ep+=(eye.z>=0.0)?4:0;\n"
8657 "np+=(nor.x>=0.0)?1:0;\n"
8658 "np+=(nor.y>=0.0)?2:0;\n"
8659 "np+=(nor.z>=0.0)?4:0;\n"
8660 "if (ep==np) gl_FragColor.a=0.0;\n else {if (ball) gl_FragColor = color; else gl_FragColor.a=0.0;}}\n"
8661 "else if (ball) gl_FragColor = color; else gl_FragColor.a=0.0;\n"
8662 "} else gl_FragColor = color; \n"
8663 "}\n"
8664 "if (fog){"
8665 "int ffar=205+fogrange, fnear=205-fogrange;"
8666 "float fogDistance = (gl_FragCoord.z / gl_FragCoord.w);\n"
8667 "float fogAmount = 1.0 - clamp((ffar - fogDistance) / (ffar - fnear), 0.0, 1.0);"
8668 "gl_FragColor.xyz = mix(gl_FragColor.xyz, fogColor.xyz, fogAmount);\n}\n"
8669 "}\n";
8670 //"const float LOG2 = -1.442695;\n"*0.0075
8671 //"float fogAmount = 1.0 - clamp(exp2(fogDistance * fogDistance * LOG2), 0.0, 1.0);\n"
8672 logshad.write("test 0\n");
8673 logshad.flush();
8674
8675 // /* create program object and attach shaders * /
8676
8677 logshad.write("test 1\n");
8678 g_Program->addShaderFromSourceCode(QGLShader::Vertex,avs);
8679 logshad.write(g_Program->log().toLatin1());
8680 logshad.write(g_Program->shaders().last()->log().toLatin1());
8681
8682 logshad.write("test 2\n");
8683 logshad.flush();
8684 g_Program->addShaderFromSourceCode(QGLShader::Fragment,afs);
8685 logshad.write(g_Program->log().toLatin1());
8686 logshad.write(g_Program->shaders().last()->log().toLatin1());
8687 //error
8688
8689 logshad.write(QString("test 3 %1\n").arg(g_Program->isLinked()).toLatin1());
8690 logshad.flush();
8691 g_Program->link();
8692 logshad.write(g_Program->log().toLatin1());
8693 logshad.flush();
8694 logshad.write("test (log below)\n");
8695 logshad.flush();
8696 logshad.write(g_Program->log().toLatin1());
8697 logshad.write("Test (log above)\n");
8698 logshad.close();
8699 g_Program->bind();
8700 wallH = g_Program->uniformLocation( "wall");
8701 ringH = g_Program->uniformLocation( "ring");
8702 ballH = g_Program->uniformLocation( "ball");
8703 openH = g_Program->uniformLocation( "open");
8704 adpsH = g_Program->uniformLocation( "eli");
8705 fogH = g_Program->uniformLocation( "fog");
8706 fograngeH = g_Program->uniformLocation( "fogrange");
8707 bgH = g_Program->uniformLocation("fogColor");
8708 whiteringH = g_Program->uniformLocation( "whitering");
8709 lichtH = g_Program->uniformLocation( "lighting");
8710 lodH = g_Program->uniformLocation( "LOD");
8711 shaders_work=true;
8712 /* WRITE SHADERS TO files use '-linux -i4 -brf afs.glsl'
8713 * to make them human readable.
8714 FILE *avsf=fopen("avs.glsl","wt");
8715 fprintf(avsf,"%s",avs);
8716 fclose(avsf);
8717 FILE *afsf=fopen("afs.glsl","wt");
8718 fprintf(afsf,"%s",afs);
8719 fclose(afsf);
8720 // */
8721 //printf("%s\n\n%s\n\n",avs,afs);
8722 // printf("%s",g_Program->log().toStdString().c_str());
8723 g_Program->release();
8724 return g_Program->programId();
8725 }
8726
b2u(const Matrix u)8727 Matrix Molecule::b2u(const Matrix u){
8728 const double twopi2=2.0*M_PI*M_PI;
8729 Matrix erg;
8730 /*
8731 * 99 Atoms(ii)%Bij(1)=2*Pisqr*Atoms(ii)%Uij(1)*(rcell(1)*rcell(1))
8732 * 100 Atoms(ii)%Bij(2)=2*Pisqr*Atoms(ii)%Uij(2)*(rcell(2)*rcell(2))
8733 * 101 Atoms(ii)%Bij(3)=2*Pisqr*Atoms(ii)%Uij(3)*(rcell(3)*rcell(3))
8734 * 102 Atoms(ii)%Bij(4)=2*Pisqr*Atoms(ii)%Uij(4)*(rcell(1)*rcell(2))
8735 * 103 Atoms(ii)%Bij(5)=2*Pisqr*Atoms(ii)%Uij(5)*(rcell(1)*rcell(3))
8736 * 104 Atoms(ii)%Bij(6)=2*Pisqr*Atoms(ii)%Uij(6)*(rcell(2)*rcell(3))
8737 * */
8738 erg.m11 = u.m11 /( twopi2 * cell.as*cell.as);
8739 erg.m22 = u.m22 /( twopi2 * cell.bs*cell.bs);
8740 erg.m33 = u.m33 /( twopi2 * cell.cs*cell.cs);
8741 erg.m12 = erg.m21 =u.m12 /( twopi2 * cell.as*cell.bs);
8742 erg.m13 = erg.m31 =u.m13 /( twopi2 * cell.as*cell.cs);
8743 erg.m23 = erg.m32 =u.m23 /( twopi2 * cell.bs*cell.cs);
8744
8745 // printf("Uij: %9.6f%9.6f%9.6f%9.6f%9.6f%9.6f\n",u.m11,u.m22,u.m33,u.m12,u.m13,u.m23);
8746 // printf("Bij: %9.6f%9.6f%9.6f%9.6f%9.6f%9.6f\n",erg.m11,erg.m22,erg.m33,erg.m12,erg.m13,erg.m23);
8747 //printf("erg:\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n",erg.m11,erg.m12,erg.m13,erg.m12,erg.m22,erg.m23,erg.m13,erg.m23,erg.m33);
8748 //printf("erg2:\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n",erg2.m11,erg2.m12,erg2.m13,erg2.m12,erg2.m22,erg2.m23,erg2.m13,erg2.m23,erg2.m33);
8749 return erg;
8750
8751 }
8752
u2b(const Matrix u)8753 Matrix Molecule::u2b(const Matrix u){
8754 const double twopi2=2.0*M_PI*M_PI;
8755 Matrix erg;
8756 /*
8757 * 99 Atoms(ii)%Bij(1)=2*Pisqr*Atoms(ii)%Uij(1)*(rcell(1)*rcell(1))
8758 * 100 Atoms(ii)%Bij(2)=2*Pisqr*Atoms(ii)%Uij(2)*(rcell(2)*rcell(2))
8759 * 101 Atoms(ii)%Bij(3)=2*Pisqr*Atoms(ii)%Uij(3)*(rcell(3)*rcell(3))
8760 * 102 Atoms(ii)%Bij(4)=2*Pisqr*Atoms(ii)%Uij(4)*(rcell(1)*rcell(2))
8761 * 103 Atoms(ii)%Bij(5)=2*Pisqr*Atoms(ii)%Uij(5)*(rcell(1)*rcell(3))
8762 * 104 Atoms(ii)%Bij(6)=2*Pisqr*Atoms(ii)%Uij(6)*(rcell(2)*rcell(3))
8763 * */
8764 erg.m11 = u.m11 * twopi2 * cell.as*cell.as;
8765 erg.m22 = u.m22 * twopi2 * cell.bs*cell.bs;
8766 erg.m33 = u.m33 * twopi2 * cell.cs*cell.cs;
8767 erg.m12 = erg.m21 =u.m12 * twopi2 * cell.as*cell.bs;
8768 erg.m13 = erg.m31 =u.m13 * twopi2 * cell.as*cell.cs;
8769 erg.m23 = erg.m32 =u.m23 * twopi2 * cell.bs*cell.cs;
8770
8771 // printf("Uij: %9.6f%9.6f%9.6f%9.6f%9.6f%9.6f\n",u.m11,u.m22,u.m33,u.m12,u.m13,u.m23);
8772 // printf("Bij: %9.6f%9.6f%9.6f%9.6f%9.6f%9.6f\n",erg.m11,erg.m22,erg.m33,erg.m12,erg.m13,erg.m23);
8773 //printf("erg:\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n",erg.m11,erg.m12,erg.m13,erg.m12,erg.m22,erg.m23,erg.m13,erg.m23,erg.m33);
8774 //printf("erg2:\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n%9.5f %9.5f %9.5f\n",erg2.m11,erg2.m12,erg2.m13,erg2.m12,erg2.m22,erg2.m23,erg2.m13,erg2.m23,erg2.m33);
8775 return erg;
8776
8777 }
8778
genSymCode(int s,int h,int k,int l)8779 int Molecule::genSymCode(int s, int h, int k, int l){//!< creates a platon style symmetry code as an integer (s555)
8780 return s*1000+(h+5)*100+(k+5)*10+(l+5);
8781 }
8782
applySymCode(const V3 & frac,int scode)8783 V3 Molecule::applySymCode(const V3 &frac, int scode){;//!< applies a platon style symmetry code as an integer (s555)
8784 int s, h, k, l;
8785 s = scode / 1000;
8786 if (s >= cell.symmops.size())return frac;// silent error handling
8787 l = (scode % 10) - 5 ;
8788 k = ((scode % 100) / 10) - 5;
8789 h = ((scode % 1000) / 100) - 5;
8790 return cell.symmops.at(s) * frac + cell.trans.at(s) + V3(h, k, l);
8791 }
8792
8793 int eccall=0;
8794
extendChain(QList<Ring> & rings,QList<int> & currentChain,QList<QList<int>> & neighbors,QSet<int> & nogo)8795 void Molecule::extendChain(QList<Ring> &rings,QList<int> ¤tChain, QList<QList<int> > &neighbors,QSet<int> &nogo){
8796 eccall++;
8797
8798 /*for (int k=0; k<currentChain.size(); k++){
8799 printf("%s-",asymm.at(currentChain.at(k)).Label.toStdString().c_str());
8800 }// */
8801 //printf("EC[%d]nogosize%d#current chain%d\n",eccall,nogo.size(),currentChain.size());
8802
8803 int last=currentChain.last();
8804 for (int ri=0; ri<rings.size();ri++){
8805 if (rings.at(ri).done) continue;
8806 if (rings[ri].members.contains(last)){
8807 int bbv=currentChain.size();
8808 int strt=rings[ri].members.indexOf(last);
8809 for (int rri=0,rrj=0; rri<rings[ri].members.size(); rri++){
8810 rrj=(strt>=0)?(strt+rri)%rings[ri].members.size():rri;
8811 if (!currentChain.contains(rings[ri].members.at(rrj))) currentChain.append(rings[ri].members.at(rrj));
8812 }
8813 bbv-=currentChain.size();
8814 if (bbv) {
8815 rings[ri].done=true;
8816 // printf("extRING%d %d %d %d\n",ri,bbv,currentChain.size(),rings[ri].members.size());
8817 }
8818 }
8819 }
8820
8821
8822 if (neighbors.at(last).size()==1) return;
8823 QList<int> c;
8824 int ic=-1;
8825 int manb=0;
8826 for (int i=0; i<neighbors.at(last).size(); i++){
8827 if (currentChain.contains(neighbors.at(last).at(i))) continue;
8828 if (nogo.contains(neighbors.at(last).at(i))) continue;
8829 int z=neighbors.at(neighbors.at(last).at(i)).size();
8830 if(z>manb){
8831 manb=z;
8832 ic=i;
8833 }
8834 }
8835 if (ic!=-1){
8836 c=currentChain;
8837 currentChain.append(neighbors.at(last).at(ic));
8838 extendChain(rings, currentChain, neighbors, nogo);
8839 }/*else{ // forking
8840 chains.append(c);
8841 int lc = chains.size() - 1;
8842 chains[lc].append(neighbors.at(last).at(i));
8843 extendChain(chains, chains[lc], neighbors, ng);
8844 ic++;
8845 ng.unite(chains[lc].toSet());
8846 }// */
8847 c.clear();
8848 }
8849
inventNewLabels(QList<int> & result)8850 void Molecule::inventNewLabels(QList<int> &result){
8851
8852 /*
8853 * Idea / draft:
8854 * for atoms in a molecule
8855 * find chain ends (E) neighbors 1
8856 * find chain atoms (C) neighbors 2
8857 * find nodes (N) neighbors >2
8858 * start at an E and append indexes to a QList chain
8859 * when a node N appears copy the list neighbors - 1 times (forking)
8860 * when no atoms left then compare number members in each chain
8861 * the longest chain wins
8862 * the longest part with carbons wins
8863 * the E with the greatest distance from center of mass wins
8864 * E-C-C-C-N-C-C-N-N-N-C-C-E
8865 * | | | |
8866 * C-C-C-C E E
8867 *
8868 * 1-2-3-4-5-g-h-a-b-c-d-e-f
8869 * | | | |
8870 * 6-7-8-9 i j
8871 */
8872 //return;
8873 QList<QList<int> > neighbors;
8874 QList<QList<int> > chains;
8875 QList<int> emptyChain;
8876 QSet<int> nogo;
8877 QList<int> molsizes;
8878 QList<bool> moleIsDone;
8879 QList<double> avan, di2com;// avarage atomic number, distance to center of mass
8880 QList<V3> centerOfMass;
8881 QList<int>cmax;//maximal chain length
8882 for (int i=0; i<asymm.size(); i++){
8883 if (asymm.at(i).an<0 )continue;
8884 neighbors.append(emptyChain);
8885 if (asymm.at(i).molindex> molsizes.size()) {
8886 molsizes.append(0);
8887 cmax.append(0);
8888 moleIsDone.append(false);
8889 centerOfMass.append(V3(0.0,0.0,0.0));
8890 avan.append(999990.0);
8891 di2com.append(0.0);
8892 }
8893 molsizes[asymm.at(i).molindex-1]++;
8894 centerOfMass[asymm.at(i).molindex-1]+=asymm.at(i).pos;
8895 }
8896 for (int i=0; i<molsizes.size(); i++){
8897 centerOfMass[i]*=1.0/molsizes.at(i);
8898 }
8899 for (int i=0; i<sdm.size(); i++){
8900 if ((sdm.at(i).a1>=neighbors.size())||(sdm.at(i).a2>=neighbors.size())) continue;
8901 if (sdm.at(i).covalent) neighbors[sdm.at(i).a1].append(sdm.at(i).a2);
8902 }
8903 // find rings first
8904 QList<QList<int> > rings;
8905 QList<Tripel> tripels;
8906 Tripel t;//midcenter
8907 QList<Ring> ringe;
8908 QSet<int>nonMetals;
8909 //B, C, N, O, F, Si, P, S, Cl, Ge, As, Se, Br, Sb, Te, I
8910 nonMetals<<4<<5<<6<<7<<8<<13<<14<<15<<16<<31<<32<<33<<34<<50<<51<<52;
8911 for (int i=0; i<neighbors.size();i++){
8912 if (!nonMetals.contains(asymm.at(i).an)) continue; //no rings with metals
8913 if (neighbors.at(i).size()>1)
8914 for (int j=0; j<neighbors.at(i).size();j++){
8915 for (int k=j+1; k<neighbors.at(i).size();k++){
8916 if (!nonMetals.contains(asymm.at(neighbors.at(i).at(j)).an)) continue; //no rings with metals
8917 if (!nonMetals.contains(asymm.at(neighbors.at(i).at(k)).an)) continue; //no rings with metals
8918 t.n[0]=i;
8919 t.n[1]=neighbors.at(i).at(j);
8920 t.n[2]=neighbors.at(i).at(k);
8921 double w = winkel(asymm.at(t.n[1]).pos - asymm.at(t.n[0]).pos, asymm.at(t.n[2]).pos - asymm.at(t.n[0]).pos) / 180.0 * M_PI;
8922 double scal = sin(w * 0.5) * sin(w * 0.5) / (sin(w) * sin(w));
8923 t.midcenter = asymm.at(t.n[0]).pos + scal * (asymm.at(t.n[1]).pos + asymm.at(t.n[2]).pos -(asymm.at(t.n[0]).pos * 2.0));
8924 tripels.append(t);
8925 //printf("tripel#%d %s %s %s\n",tripels.size(),asymm.at(t.n[1]).Label.toStdString().c_str(), asymm.at(t.n[0]).Label.toStdString().c_str(), asymm.at(t.n[2]).Label.toStdString().c_str());
8926 // if (neighbors.at(i).size()==2) break;
8927 }
8928 }
8929 }
8930 //printf("atoms%d tripel%d\n",neighbors.size(),tripels.size());
8931 const double RINGTEST=0.7;
8932 for (int i=0; i<tripels.size(); i++){
8933 /* print the midcenter as q peaks
8934 V3 f;
8935 kart2frac(tripels.at(i).midcenter,f);
8936 printf("Q%03d 1 %9.5f %9.5f %9.5f 11.0 0.05 %5.2f\n",i,f.x,f.y,f.z,i*0.01);
8937 */
8938 for (int j=0; j<i; j++){
8939 double dist=Distance(tripels.at(i).midcenter,tripels.at(j).midcenter);
8940 if (dist<RINGTEST){
8941 bool alreadyHaveIt=false;
8942 for (int k = 0; k < ringe.size(); k++){
8943 //printf("j%d i%d k%d\n",j,i,k);
8944 // if (ringe[k].isComplete()) continue;
8945 V3 r1=ringe[k].theCenter();
8946 double
8947 d1=Distance(tripels.at(i).midcenter,r1),
8948 d2=Distance(tripels.at(j).midcenter,r1);
8949 if ((d1<RINGTEST)||(d2<RINGTEST)){
8950 ringe[k].addTripel(tripels.at(i));
8951 ringe[k].addTripel(tripels.at(j));
8952 //printf(":: %d %f %f ::\n", k, d1, d2);
8953 alreadyHaveIt=true;
8954 // continue;
8955 }
8956 //else printf(":: %f %f ::\n",d1,d2);
8957 }
8958 if (!alreadyHaveIt){
8959 //printf("tic\n");
8960 ringe.append(Ring(tripels.at(i),tripels.at(j)));
8961 //ringe.last().printRing(this);
8962 }
8963 }//else {printf("DIST %g\n",dist);}
8964 //printf("j%d %d\n",j,i);
8965 }
8966 //printf("i%d \n",i);
8967 }
8968 //return;
8969 //printf("Rings %d\n",ringe.size());
8970 // int fix=0;
8971 for (int ri=0; ri<ringe.size(); ri++){
8972 bool fertig = ringe[ri].isComplete();
8973 if ((!fertig)&&(ringe[ri].members.size()<7)) {
8974 //ringe[ri].printRing(this);
8975 int u=ringe[ri].members.size();
8976 for (int w=0; w<u; w++) {
8977 for (int v=0; v<tripels.size();v++){
8978 if (
8979 (ringe[ri].members.contains(tripels.at(v).n[0]))&&
8980 (ringe[ri].members.contains(tripels.at(v).n[1]))&&
8981 (ringe[ri].members.contains(tripels.at(v).n[2]))) {
8982 ringe[ri].addTripel(tripels.at(v));
8983 continue;
8984 }
8985 }
8986 }
8987 }
8988 //ringe[ri].printRing(this);
8989 fertig = ringe[ri].isComplete();
8990 ringe[ri].isItARealRing();
8991 fertig = ringe[ri].isComplete();
8992 //printf("%d %d %d\n",ringe[ri].t.size(),ringe[ri].members.size(),fertig);
8993 if (!fertig) {ringe.removeAt(ri);ri--;}
8994 }
8995 /*
8996 for (int ri=0; ri<ringe.size(); ri++){
8997 for (int rj=1; rj<ri; rj++){
8998 if (rj==ri)continue;
8999 if (Distance(ringe[ri].theCenter(),ringe[rj].theCenter())<0.2){ringe.removeAt(ri);ri--;break;}
9000 }
9001 }
9002 */
9003 //printf("Rings %d are real and complete.\n",ringe.size());
9004 // return;
9005 for (int mi=0; mi<centerOfMass.size();mi++){
9006 //printf("Molecule#%d has %d atoms\n", mi, molsizes.at(mi));
9007 double away=-10.0;
9008 int itakethisring=0;
9009 for (int ri=0; ri<ringe.size(); ri++){
9010 if ((asymm.at(ringe.at(ri).members.at(0)).molindex-1)!=mi) continue;
9011 //bool fertig = ringe[ri].isComplete();
9012 // if (fertig) fix++;
9013 ringe[ri].printRing(this);
9014 //printf("Ring #%d size = %d/%d is complete %d\n",ri,ringe.at(ri).t.size(),ringe.at(ri).members.size(),fertig);
9015 if (ringe.at(ri).members.size()==7){
9016 ringe[ri].debugRing(this);
9017 ringe[ri].isItARealRing();
9018 }
9019 double d=Distance(centerOfMass[asymm.at(ringe.at(ri).members.at(0)).molindex-1],ringe[ri].theCenter());
9020 V3 dir = (asymm.at(ringe.at(ri).members.at(0)).pos - ringe[ri].theCenter())%(asymm.at(ringe.at(ri).members.at(1)).pos - ringe[ri].theCenter());
9021 V3 com2r = ringe[ri].theCenter()-centerOfMass[asymm.at(ringe.at(ri).members.at(0)).molindex-1];
9022 double test= dir*com2r;
9023 QList<int> rcpy=ringe[ri].members;
9024 if (test>0.0){//flip ring order
9025 ringe[ri].members.clear();
9026 for (int kk=rcpy.size()-1; kk>=0; kk--){
9027 ringe[ri].members.append(rcpy.at(kk));
9028 }
9029 dir = (asymm.at(ringe.at(ri).members.at(0)).pos - ringe[ri].theCenter())%(asymm.at(ringe.at(ri).members.at(1)).pos - ringe[ri].theCenter());
9030 test= dir*com2r;
9031 //printf("fliped ");
9032 }
9033 ringe[ri].printRing(this);
9034 if (away<d){
9035 away=d;
9036 itakethisring=ri;
9037 }
9038 //printf("AWAYOFCOM %f %d test%g \n",d,ri,test);
9039 }
9040 //printf("Complete Rings %d\n",fix);
9041 //printf("Rings %d\n",ringe.size());
9042 if ((!ringe.isEmpty())&&((asymm.at(ringe.at(itakethisring).members.at(0)).molindex-1)==mi)){
9043 ringe[itakethisring].printRing(this);
9044 //printf("most far AWAY from COM %f %d\n",away,itakethisring);
9045 int starthere=0,mn=0;
9046 double away2=1000;
9047 for (int i=0; i<ringe[itakethisring].members.size(); i++){
9048 if ((neighbors.at(ringe[itakethisring].members.at(i)).size()>=mn)&&
9049 (Distance(asymm.at(ringe[itakethisring].members.at(i)).pos,centerOfMass[asymm.at(ringe.at(itakethisring).members.at(i)).molindex-1])<away2)){
9050 mn=neighbors.at(ringe[itakethisring].members.at(i)).size();
9051 away2=Distance(asymm.at(ringe[itakethisring].members.at(i)).pos,centerOfMass[asymm.at(ringe.at(itakethisring).members.at(i)).molindex-1]);
9052 starthere=i;
9053 }
9054 }
9055 chains.append(emptyChain);
9056 for (int i=0; i<ringe[itakethisring].members.size(); i++){
9057 chains.last().append(ringe[itakethisring].members.at(starthere%ringe[itakethisring].members.size()));
9058 starthere++;
9059 }
9060 ringe[itakethisring].done=true;
9061 //aneal ring
9062 for (int ci=0; ci<chains.last().size(); ci++){
9063 for (int ri=0; ri<ringe.size();ri++){
9064 if (ringe.at(ri).done) continue;
9065 if ((ringe[ri].members.contains(chains.last().at(ci)))&&(ringe[ri].members.contains(chains.last().at((ci+1)%chains.last().size())))){
9066 int bbv=chains.last().size();
9067 int ll=chains.last().last();
9068 int strt=ringe[ri].members.indexOf(ll);
9069 if (strt<0)strt = ringe[ri].members.indexOf(chains.last().at(ci));
9070 for (int rri=0,rrj=0; rri<ringe[ri].members.size(); rri++){
9071 rrj=(strt>=0)?(strt+rri)%ringe[ri].members.size():rri;
9072 if (!chains.last().contains(ringe[ri].members.at(rrj))) chains.last().append(ringe[ri].members.at(rrj));
9073 }
9074 bbv-=chains.last().size();
9075 if (bbv) ringe[ri].done=true;
9076 //printf("RING%d %d %d %d %d\n",ri,bbv,ci,chains.last().size(),ringe[ri].members.size());
9077 }
9078 }
9079 }
9080 do{
9081 int ce=chains.last().size();
9082 for (int cc=0; cc<ce; cc++){
9083 for (int nn=0; nn<neighbors.at(chains.last().at(cc)).size();nn++){
9084 if (!chains.last().contains(neighbors.at(chains.last().at(cc)).at(nn))) {
9085 chains.last().append(neighbors.at(chains.last().at(cc)).at(nn));
9086 //printf("ext %s\n",asymm.at(neighbors.at(chains.last().at(cc)).at(nn)).Label.toStdString().c_str());
9087 extendChain(ringe,chains.last(), neighbors,nogo);
9088 }
9089 }
9090 }
9091 }while(chains.last().size()<molsizes.at(mi));
9092 if (chains.last().size()==molsizes.at(mi))moleIsDone[mi]=true;
9093 }
9094 if ((!chains.isEmpty())&&(!result.contains(chains.last().last()))) {
9095 result.append(chains.last());
9096 }
9097 }//mi
9098
9099 /*
9100 for (int cs=0; cs<chains.size(); cs++){
9101 chains[cs].clear();
9102 }
9103 chains.clear();
9104 */
9105 //for(int i=0; i<result.size(); i++){printf("%s[%d]=",asymm.at(result.at(i)).Label.toStdString().c_str(),i+1);if(!(i%10))printf("\n");}printf("\n");
9106 //return;
9107 //
9108 //printf("Molecules with rings are done\n");
9109 for (int mi=0; mi<molsizes.size(); mi++){
9110 if (moleIsDone.at(mi)) continue;
9111 //printf("mol%d %d %d %d resultsize%d chains%d\n",mi,molsizes.at(mi),molsizes.size(),centerOfMass.size(),
9112 // result.size(),chains.size());
9113 int starthere=-1;
9114 double away=-10;
9115 for (int i=0; i<neighbors.size(); i++){
9116 if (asymm.at(i).an<0)continue;
9117 if ((asymm.at(i).molindex-1 == mi)&&(neighbors.at(i).size()==0)){
9118 result.append(i);//isolated atoms
9119 continue;
9120 }
9121 if ((asymm.at(i).molindex-1 == mi)&&(neighbors.at(i).size()==1)){//chain end
9122 //printf("%d %d %d %d %d\n",__LINE__,i,asymm.size(),neighbors.size());
9123 double d=Distance(asymm.at(i).pos,centerOfMass.at(mi));
9124 //printf("%d\n",__LINE__);
9125 if (d>away){
9126 away=d;
9127 starthere=i;
9128 }
9129 }
9130 // printf("%d\n",__LINE__);
9131 }
9132 //printf("%d\n",__LINE__);
9133 if (starthere<0) continue;
9134 //printf("start at %d if not done%d\n",starthere,!result.contains(starthere));
9135
9136 if (!result.contains(starthere)){
9137 chains.append(emptyChain);
9138 chains.last().append(starthere);
9139 extendChain(ringe,chains.last(),neighbors,nogo);
9140 }
9141 do{
9142 int ce=chains.last().size();
9143 for (int cc=0; cc<ce; cc++){
9144 for (int nn=0; nn<neighbors.at(chains.last().at(cc)).size();nn++){
9145 if (!chains.last().contains(neighbors.at(chains.last().at(cc)).at(nn))) {
9146 chains.last().append(neighbors.at(chains.last().at(cc)).at(nn));
9147 //printf("ext %s\n",asymm.at(neighbors.at(chains.last().at(cc)).at(nn)).Label.toStdString().c_str());
9148 extendChain(ringe,chains.last(), neighbors,nogo);
9149 }
9150 }
9151 }
9152 }while(chains.last().size()<molsizes.at(mi));
9153 if ((!chains.isEmpty())&&(!result.contains(chains.last().last()))) {
9154 result.append(chains.last());
9155 }
9156
9157 }
9158 for (int cs=0; cs<chains.size(); cs++){
9159 chains[cs].clear();
9160 }
9161 chains.clear();
9162 }
9163
rankMySymmOp(Matrix m,V3 t)9164 int Molecule::rankMySymmOp(Matrix m, V3 t){
9165 V3 tv(0.27353,0.03537,0.15373);
9166 V3 a=V3(0,0,0),b=tv;
9167 int rank=0;
9168 while (!(a==tv)){
9169 a=m*b+t;
9170 //b=a;
9171 V3 flo=V3(floor(fabs(a.x)),floor(fabs(a.y)),floor(fabs(a.z)));//V3(floor(a.x+0.5), floor(a.y+0.5), floor(a.z+0.5));
9172 //b=b-flo;//+V3(0.5,0.5,0.5);
9173
9174 a.x=(a.x>1.0)?a.x-1:(a.x<0.0)?a.x+1:a.x;
9175 a.y=(a.y>1.0)?a.y-1:(a.y<0.0)?a.y+1:a.y;
9176 a.z=(a.z>1.0)?a.z-1:(a.z<0.0)?a.z+1:a.z;
9177 /*printf("%g %g %g | %g %g %g | %g %g %g {} %g %g\n",
9178 b.x,b.y,b.z,
9179 a.x,a.y,a.z,
9180 flo.x,flo.y,flo.z,Distance(a,tv),Distance(b,tv));// */
9181 b=a;
9182 rank++;
9183 if (rank>=16) break;
9184 }
9185 return rank;
9186 }
9187
intersectPoint(V3 rayVector,V3 rayPoint,V3 planeNormal,V3 planePoint,bool & ok)9188 V3 Molecule::intersectPoint(V3 rayVector, V3 rayPoint, V3 planeNormal, V3 planePoint,bool &ok) {
9189 V3 diff = rayPoint - planePoint;
9190 ok=true;
9191 double prod1 = diff * planeNormal;
9192 double prod2 = (rayVector * planeNormal)/(sqrt(Norm(rayVector))*sqrt(Norm(planeNormal)));//cosine
9193 //printf("diff %g %g %g A%g B%g\n",diff.x,diff.y,diff.z,prod1,prod2);
9194 if (fabs(prod2)<0.000001) {ok=false;return V3(0,0,0);}
9195 double p3 = prod1 / prod2;
9196 V3 erg =rayPoint - (Normalize(rayVector) * p3);
9197 ok= (erg.x>=-0.001)&&(erg.x<=1.001)&&(erg.y>=-0.001)&&(erg.y<=1.001)&&(erg.z>=-0.001)&&(erg.z<=1.001);
9198 erg.x=(erg.x<0.0)?0.0:erg.x;
9199 erg.y=(erg.y<0.0)?0.0:erg.y;
9200 erg.z=(erg.z<0.0)?0.0:erg.z;
9201 //if (!ok) printf("ich bin nicht ok (%g %g %g)\n",erg.x,erg.y,erg.z);
9202 //else printf("ich bin ok (%g %g %g)\n",erg.x,erg.y,erg.z);
9203 //printf("ich bin null = %g p1 %g p2 %g p3 %g (%g %g %g)\n",(erg-planePoint)* planeNormal,prod1,prod2,p3,erg.x,erg.y,erg.z);
9204 return erg;
9205 }
9206
specialPts(const Matrix & mat,const V3 & trans,QList<V3> & points)9207 void Molecule::specialPts(const Matrix &mat, const V3 &trans, QList<V3> &points){
9208 int nmax=9;
9209 double stp=1.0/(nmax-1.0);
9210 //double vstp=1.0/(3*nmax);
9211 int fold=3;
9212 V3 axis;
9213 QString sname=nameSymmOp(mat,fold,axis);
9214 axis=Normalize(axis);
9215 //Matrix mat_=mat;
9216 //if (fold<-2) mat_=mat*Matrix(-1,0,0,0,-1,0,0,0,-1);
9217 int end=0;
9218 V3 pts[1331];
9219 V3 pp[12],p;
9220 for (int h=0; h<nmax; h++){
9221 for (int k=0; k<nmax; k++){
9222 for (int l=0; l<nmax; l++){
9223 pts[end] = V3(stp*h, stp*k, stp*l);
9224 //val[i] = vstp*l;
9225 end++;
9226 }
9227 }
9228 }
9229 for (int i=0; i<end; i++){
9230 p=pts[i];
9231 pp[0] = mat * p + trans;
9232 pp[0].x = pp[0].x - floor(pp[0].x+0.00001);
9233 pp[0].y = pp[0].y - floor(pp[0].y+0.00001);
9234 pp[0].z = pp[0].z - floor(pp[0].z+0.00001);
9235 double screwy = (fold==-2)?0.0:fabs((pp[0]-p)*(axis));
9236 screwy = (fold==-1)?0.0:screwy;
9237 V3 screw = screwy*axis;
9238 //printf(" screw %g %g %g %g\n",screwy,screw.x,screw.y,screw.z);
9239 V3 glide= V3(0,0,0);
9240 if (fold==-2){
9241 glide = mat * trans;
9242 glide = (trans + glide) * 0.5;
9243 // printf(" glide %g %g %g %g %g %g %g\n",glide.x,glide.y,glide.z,trans.x,trans.y,trans.z,Norm(glide));
9244 }
9245 int afld=rankMySymmOp(mat,trans);
9246 for (int j=0; j<afld; j++){
9247 pp[j] = mat * p + trans - screw - glide;
9248 pp[j].x = pp[j].x - floor(pp[j].x+0.00001);
9249 pp[j].y = pp[j].y - floor(pp[j].y+0.00001);
9250 pp[j].z = pp[j].z - floor(pp[j].z+0.00001);
9251 p=pp[j];
9252 }
9253 p=V3(0,0,0);
9254 for (int j=0; j<afld; j++)p+=pp[j];
9255 p*=1.0/afld;
9256 p.x = p.x - floor(p.x+0.000001);
9257 p.y = p.y - floor(p.y+0.000001);
9258 p.z = p.z - floor(p.z+0.000001);
9259 V3 test = mat * p + trans - screw - glide;
9260 test.x = test.x - floor(test.x+0.000001);
9261 test.y = test.y - floor(test.y+0.000001);
9262 test.z = test.z - floor(test.z+0.000001);
9263 V3 test2 = mat * p + trans - screw + glide;
9264 test2.x = test2.x - floor(test2.x+0.000001);
9265 test2.y = test2.y - floor(test2.y+0.000001);
9266 test2.z = test2.z - floor(test2.z+0.000001);
9267 double d= Distance(test, p);
9268 double d2= Distance(test2, p);
9269 if ((d<0.01)||(fabs(d-1)<0.01)||(d2<0.01)||(fabs(d2-1)<0.01)){
9270 if (!points.contains(p)) points.append(p);
9271 if (p.x<0.0001) {p+=V3(1,0,0); if (!points.contains(p)) points.append(p);}
9272 if (p.y<0.0001) {p+=V3(0,1,0); if (!points.contains(p)) points.append(p);}
9273 if (p.z<0.0001) {p+=V3(0,0,1); if (!points.contains(p)) points.append(p);}
9274 //}else{
9275 /*
9276 printf("C%-3d 1 %8.6f %8.6f %8.6f 11.0000 0.05 !%f!%g %g\n"// \nREM %g %g %g =>%g\n %g %g %g\n %g %g %g\n %g %g %g\n %g %g %g\n"
9277 //REM %g %g %g %g %g %g %g %g %g %g %g %g %g\n"
9278 , i+1, p.x, p.y, p.z, (screwy>0.1)?1.0:0.0,d2,d
9279 ); // */
9280 }
9281 }
9282
9283 }
9284
findSymmElements()9285 void Molecule::findSymmElements(){
9286 //make1Plane(V3(0,1,0),V3(0,0,0));
9287 //make1Plane(V3(0,1,0),V3(0,1,0));
9288 axvecs.clear();
9289 ptriangles.clear();
9290 axcols.clear();
9291 axoprs.clear();
9292 dontshowSel.clear();
9293 dontshowSop.clear();
9294 invoprs.clear();
9295 invvecs.clear();
9296 QList<V3> points;
9297 for (int n=1; n<cell.symmops.size(); n++){
9298 int fold=0;
9299 V3 axis;
9300 QString sname=nameSymmOp(cell.symmops.at(n),fold,axis);
9301 axis=Normalize(axis);
9302 printf("This Symmop #%d is a %s. %d %g %g %g\n",n,sname.toStdString().c_str(),fold,axis.x,axis.y,axis.z);
9303 if (cell.symmops.at(n)==Matrix(1,0,0,0,1,0,0,0,1)) {
9304 //printf("das wars %s\n",symmcode2human(n).toStdString().c_str());
9305 continue;
9306 //break;
9307 }
9308 if (cell.symmops.at(n)==Matrix(-1,0,0,0,-1,0,0,0,-1)) {
9309 printf("inversion %s\n",symmcode2human(n).toStdString().c_str());
9310 //continue;
9311 }
9312 points.clear();
9313 specialPts(cell.symmops.at(n),cell.trans.at(n), points);
9314 printf("points size = %d\n",points.size());
9315 if (fold==-1){
9316 QList<V3> drin;
9317 for (int i=0; i< points.size(); i++){
9318 packPoint(points.at(i),drin);
9319 //printf("%d -- %d\n",i,drin.size());
9320 }
9321 for (int i=0; i< drin.size(); i++){
9322 V3 pos;
9323 frac2kart(drin.at(i),pos);
9324 invoprs.append(n);
9325 invvecs.append(pos);
9326 }
9327 //printf("INVERSION CENTERS %d %d\n",invoprs.size(),invvecs.size());
9328 }else
9329 if (fold==-2){
9330 for (int g=0; g<points.size(); g++){
9331 V3 T=cell.trans.at(n);
9332 V3 glide = cell.symmops.at(n) * cell.trans.at(n);
9333 glide = (cell.trans.at(n) + glide) * 0.5;//mirrored parts of the vector cancel out
9334 bool isglide=(Norm(glide)>0.01);
9335 int colori=abs(fold)-1;
9336 colori+=(fold<0)?5:0;
9337 colori+=fold==6?-1:0;
9338 colori+=(fold==-6)?-1:0;
9339 colori+=(isglide)?9:0;
9340 colori+=((isglide)&&(fold<0))?-1:0;
9341 frac2kart(V3(glide.x*T.x,glide.y*T.y,glide.z*T.z),glide);
9342 make1Plane(axis,points.at(g),glide,colori,n);
9343 }
9344 }else{
9345 // may be a axis
9346 QList<V3> drin;
9347 QList<int> dc;
9348 for (int g=0; g<points.size();g++){
9349 V3 tt2=points.at(g);
9350
9351 //printf("COLORI %d<%d\n",colori,symmColors.size());
9352 //printf("%g %g %g || %g %g %g \n",ax1.x,ax1.y,ax1.z,cell.trans.at(n).x,cell.trans.at(n).y,cell.trans.at(n).z);
9353 bool ok;
9354 V3 inp;
9355 QList<V3> sects;
9356 inp=intersectPoint(-1.0*axis,tt2,V3(0,0,1),V3(0,0,0),ok);
9357 if (ok){
9358 if (!sects.contains(inp)) sects.append(inp);
9359 }
9360 inp=intersectPoint(-1.0*axis,tt2,V3(0,0,1),V3(0,0,1),ok);
9361 if (ok){
9362 if (!sects.contains(inp)) sects.append(inp);
9363 }
9364 inp=intersectPoint(-1.0*axis,tt2,V3(0,1,0),V3(0,0,0),ok);
9365 if ((ok)){
9366 if (!sects.contains(inp)) sects.append(inp);
9367 }
9368 inp=intersectPoint(-1.0*axis,tt2,V3(0,1,0),V3(0,1,0),ok);
9369 if ((ok)){
9370 if (!sects.contains(inp)) sects.append(inp);
9371 }
9372 inp=intersectPoint(-1.0*axis,tt2,V3(1,0,0),V3(0,0,0),ok);
9373 if ((ok)){
9374 if (!sects.contains(inp)) sects.append(inp);
9375 }
9376 inp=intersectPoint(-1.0*axis,tt2,V3(1,0,0),V3(1,0,0),ok);
9377 if ((ok)){
9378 if (!sects.contains(inp)) sects.append(inp);
9379 }
9380 if (sects.size()>1){
9381 V3 pp0 = 0.5*(sects.at(0)+sects.at(1));
9382 V3 pp = cell.symmops.at(n) * pp0 + cell.trans.at(n);
9383 pp.x = pp.x - floor(pp.x+0.000001);
9384 pp.y = pp.y - floor(pp.y+0.000001);
9385 pp.z = pp.z - floor(pp.z+0.000001);
9386 double screwy = (fold==-2)?0.0:sqrt(Norm(pp-pp0));
9387 //printf("%g %g %g ||%g %g %g \n",pp.x,pp.y,pp.z,pp0.x,pp0.y,pp0.z);
9388 //V3 ta=(pp-pp0);
9389 V3 screw = screwy * axis;
9390 screw.x = screw.x - floor(screw.x+0.000001);
9391 screw.y = screw.y - floor(screw.y+0.000001);
9392 screw.z = screw.z - floor(screw.z+0.000001);
9393 /*printf("Screw: %g >> (%g %g %g) (%g %g %g) (%g %g %g) (%g %g %g)\n", Norm(screw), screw.x, screw.y, screw.z,tt2.x,tt2.y,tt2.z,
9394 axis.x,axis.y,axis.z,
9395 dif.x,dif.y,dif.z
9396 );*/
9397 bool isscrew=Norm(screw)>0.01;
9398 //frac2kart(screw,scc);
9399 int colori=abs(fold)-1;
9400 colori+=(fold<0)?5:0;
9401 colori+=(fold==6)?-1:0;
9402 colori+=(fold==-6)?-1:0;
9403 colori+=(isscrew)?9:0;
9404 colori+=((isscrew)&&(fold<0))?-1:0;
9405 //int ds=drin.size();
9406 packLine(sects.at(0),sects.at(1),axis,drin,colori,dc);
9407 /*if (ds!=drin.size())printf("drinsize %d colori %d screw(%g):( %g %g %g) (%g %g %g) (%g %g %g)\n",drin.size(),colori,screwy,screw.x,screw.y,screw.z
9408 ,ta.x,ta.y,ta.z,axis.x,axis.y,axis.z);// */
9409 }
9410 for (int g=0; g<drin.size(); g++){
9411 V3 ax;
9412 frac2kart(drin.at(g),ax);
9413 axvecs.append(ax);
9414 axcols.append(dc.at(g));
9415 axoprs.append(n);
9416 }
9417 }
9418 }
9419 if (n==-22) {// for debugging
9420 printf("XXXX\n");
9421 for (int i=0; i< points.size(); i++){
9422 MyAtom atm;
9423 atm.an=-1;
9424 atm.Label=QString("Sym%1").arg(i);
9425 atm.peakHeight=(i*1.0)/points.size();
9426 atm.frac=points.at(i);
9427 atm.an=-1;
9428 atm.part=0;
9429 atm.resiNr=0;
9430 atm.hidden=0;
9431 atm.resiNr=0;
9432 atm.part=0;
9433 atm.style=1;
9434 atm.symmGroup=0;
9435 atm.sg=0;
9436 atm.scod=555;//the identity
9437 atm.auidx=-1;
9438 atm.uc.m12=atm.uc.m23=atm.uc.m13=0.0;
9439 atm.uc.m21=atm.uc.m32=atm.uc.m31=0.0;
9440 atm.uf.m12=atm.uf.m23=atm.uf.m13=0.0;
9441 atm.uf.m21=atm.uf.m32=atm.uf.m31=0.0;
9442 atm.uf.m11=0.05;
9443 atm.isIso=true;
9444 atm.uc.m11=atm.uc.m22=atm.uc.m33=atm.uf.m11;
9445 frac2kart(atm.frac,atm.pos);
9446 printf("Sym%d %f %f %f <=> %f %f %f %d\n",i,atm.frac.x,atm.frac.y,atm.frac.z,atm.pos.x,atm.pos.y,atm.pos.z,showatoms.size());
9447 showatoms.append(atm);
9448 }
9449 }
9450 }
9451 }
9452
make1Plane(V3 planeNormal,V3 pointOnPlane,V3 glide,int ac,int n)9453 void Molecule::make1Plane(V3 planeNormal, V3 pointOnPlane,V3 glide, int ac, int n){
9454 //if (n==11) printf("normal %g %g %g\n",planeNormal.x,planeNormal.y,planeNormal.z);
9455 QList<V3> pop;//point on plane
9456 int np=0;
9457 bool already=false;
9458 for (int h=0; h<2; h++){
9459 for (int k=0; k<2; k++){
9460 for (int l=0; l<2; l++){
9461 bool ok;
9462 V3 inp=intersectPoint(V3(0,0,1),V3(h,k,l),planeNormal,pointOnPlane,ok);
9463 if (ok) {
9464 if (!pop.contains(inp)){
9465 np++;
9466 pop.append(inp);
9467 }
9468
9469 }
9470 inp=intersectPoint(V3(0,1,0),V3(h,k,l),planeNormal,pointOnPlane,ok);
9471 if (ok) {
9472 if (!pop.contains(inp)){
9473 np++;
9474 pop.append(inp);
9475 }
9476 }
9477 inp=intersectPoint(V3(1,0,0),V3(h,k,l),planeNormal,pointOnPlane,ok);
9478 if (ok) {
9479 if (!pop.contains(inp)){
9480 np++;
9481 pop.append(inp);
9482 }
9483 }
9484 }
9485 }
9486 }
9487 if (pop.size()>2){
9488 PPoly tri;
9489 tri.nor=planeNormal;
9490 tri.mid=V3(0,0,0);
9491 for(int i=0; i<pop.size();i++){
9492 tri.mid+=pop.at(i);
9493 }
9494 tri.mid*=1.0/pop.size();
9495 tri.verts0=pop.at(0);
9496 tri.verts1=pop.at(1);
9497 tri.colr=ac;
9498 tri.n=n;
9499 tri.glide=glide;
9500 QList<int> order;
9501 order.append(0);
9502 int j=0,jj=0,aj=0;
9503 for (int k=1; k<pop.size();k++){
9504 double mdi=10000.0;
9505 for (int i=1; i<pop.size();i++){
9506 if ((i==j)||(order.contains(i))) continue;
9507 double d=Distance(pop.at(j),pop.at(i));
9508 double dd=Distance(pop.at(aj),pop.at(i));
9509 if ((d<=dd)&&(d<mdi)){
9510 mdi=d;
9511 jj=i;
9512 }
9513 }
9514 aj=j;
9515 j=jj;
9516 order.append(j);
9517 }
9518 frac2kart(tri.mid,tri.mid);
9519 for(int i=0; i<ptriangles.size();i++){
9520 if ((n==ptriangles.at(i).n)&&(ptriangles.at(i).nor==planeNormal)&&(ptriangles.at(i).mid==tri.mid)){
9521 already=true;
9522 break;
9523 }
9524 }
9525 if (!already)for(int i=0; i<order.size();i++){
9526 frac2kart(pop.at(order.at(i)),tri.verts0);
9527 frac2kart(pop.at(order.at((i+1)%order.size())),tri.verts1);
9528 ptriangles.append(tri);
9529 }
9530 }
9531 }
9532
is2Dissordered4H(const MyAtom & atom)9533 bool Molecule::is2Dissordered4H(const MyAtom &atom){
9534 if (!HFixSuitableAtomsOnly) return false;
9535 double avu=averageUeq();
9536 V3 ev;
9537 double ue=ueq(atom.uf);
9538 if (ue<0.0) return true;//NPD is not good!
9539 jacobi(atom.uc,ev);
9540 double mi,ma,ratio;
9541 mi=(ev.x > ev.y)?(ev.y > ev.z)?ev.z:ev.y:(ev.x > ev.z)?ev.z:ev.x;
9542 ma=(ev.x < ev.y)?(ev.y < ev.z)?ev.z:ev.y:(ev.x < ev.z)?ev.z:ev.x;
9543 if (mi<0.01) return true;
9544 if (ue<avu*1.2) return false; //small enough to be a H-horse ;-)
9545 ratio=fabs(ma/mi);
9546 printf("%s is this a missshaped ADP min %f max %f ratio %f iso %f avg %f %f?\n",atom.Label.toStdString().c_str(),mi,ma,ratio,ue,avu,ue/avu);
9547 if (ratio>8) return true;
9548 if ((ue/avu) >2.0) return true;
9549 return false;
9550 }
9551
averageUeq()9552 double Molecule::averageUeq(){
9553 double uav=0.0;
9554 int iok=0;
9555 Matrix ucc;
9556 for (int i=0; i<asymm.size();i++){
9557 if (asymm.at(i).an<0) continue;
9558 double u=ueq(asymm.at(i).uf);
9559 if (u>0.0) {
9560 iok++;
9561 uav+=u;
9562 }
9563 }
9564 uav/=iok;
9565 return uav;
9566 }
9567
ueq(const Matrix m)9568 double Molecule::ueq(const Matrix m){
9569 double erg=0;
9570 Matrix ucc;
9571 Uf2Uo(m,ucc);
9572 erg=1/3.0*(ucc.m11+ucc.m22+ucc.m33);
9573 return erg;
9574 }
9575