Debian Codegraph @

src/Mol.cpp

raw symbols ◀ ▶ SCIP
3 Debian patches touch this file
1 #cxx . . $ `<file>/src/Mol.cpp`/include <GL/glew.h>
2
3 typedef unsigned char Bytecxx . . $ Byte#;
4
•5 #include <string.h>
•6 #include <stdio.h>
7 #include <vector>
8 #include <string>
9 #include <algorithm>
10
11 #include <vcg/space/point3.h>cxx . . $ `<file>/vcg/vcg/space/point3.h`/
12 #include <vcg/space/color4.h>cxx . . $ `<file>/vcg/vcg/space/color4.h`/
13
14 using namespace vcg;
15 using namespace std;
16 #include "CubeMapSamp.h"cxx . . $ `<file>/src/CubeMapSamp.h`/
17 #include "OctaMapSamp.h"cxx . . $ `<file>/src/OctaMapSamp.h`/
18 #include "Mol.h"cxx . . $ `<file>/src/Mol.h`/
19 #include "HardSettings.h"cxx . . $ `<file>/src/HardSettings.h`/
20
•21 #include "progress.h"cxx . . $ `<file>/src/progress.h`/
22 #include "AtomColor.h"cxx . . $ `<file>/src/AtomColor.h`/
23
24 #include "MyCanvas.h"cxx . . $ `<file>/src/MyCanvas.h`/
25
26 #include "CgUtil.h"cxx . . $ `<file>/src/CgUtil.h`/
27
28 float stick_radiuscxx . . $ stick_radius.;
29
30 static int lxcxx . . $ lx.=0,lycxx . . $ ly.=0;
31 extern int BSIZEcxx . . $ BSIZE.;
32 extern int CSIZEcxx . . $ CSIZE.; // number of texels for a patch of an aotm
33
34 int BSIZExcxx . . $ BSIZEx., BSIZEycxx . . $ BSIZEy.; // number of texels for a pach of a bond
35 int SubPatchXcxx . . $ SubPatchX., SubPatchYcxx . . $ SubPatchY.;
36 // an atom size is subdivided in this many subpatches for bonds
37
38
39
40 #define TOO_BIGcxx . . $ `src/Mol.cpp:40:9`! 0
41 #define TOO_SMALLcxx . . $ `src/Mol.cpp:41:9`! 1
42 #define SIZE_OKcxx . . $ `src/Mol.cpp:42:9`! 2
43
44
45 Molcxx . . $ Mol#::Molcxx . . $ Mol#Mol(49f6e7a06ebc5aa8).()
46 {
47 vboNormcxx . . $ Mol#vboNorm.=vboShadowcxx . . $ Mol#vboShadow.=vboAOcxx . . $ Mol#vboAO.=666; // not ready
48 vboNormStcxx . . $ Mol#vboNormSt.=vboShadowStcxx . . $ Mol#vboShadowSt.=vboAOStcxx . . $ Mol#vboAOSt.=666; // not ready
49 filenamecxx . . $ Mol#filename.[0]=0;
50 AOdoneLvlcxx . . $ Mol#AOdoneLvl.=0;
51 readycxx . . $ Mol#ready.=false;
52 natmcxx . . $ Mol#natm. = nhetatmcxx . . $ Mol#nhetatm. = 0;
53 //DL_bonds = DL_atoms = 666;
54 colModecxx . . $ Mol#colMode.=1.0;
55 }
56
57 // how many texels per patch?
58 int SetCsizecxx . . $ SetCsize(9b79fb6aee4c0440).(int textsize, int natoms){
59
60 // initial guess:
61 int i=(int)ceilcxx . . $ ceil(fee4f1d22bc8e617).(sqrtcxx . . $ sqrt(fee4f1d22bc8e617).((double)natoms));
62 BSIZEcxx . . $ BSIZE.=CSIZEcxx . . $ CSIZE.= textsize / i;
63
64 if (CSIZEcxx . . $ CSIZE.>250) {
65 BSIZEcxx . . $ BSIZE.=CSIZEcxx . . $ CSIZE.=250;
66 return TOO_BIGcxx . . $ `src/Mol.cpp:40:9`!;
67 }
68
69 if (CSIZEcxx . . $ CSIZE.<6) {
70 return TOO_SMALLcxx . . $ `src/Mol.cpp:41:9`!;
71 }
72
73 return SIZE_OKcxx . . $ `src/Mol.cpp:42:9`!;
74 }
75
76 bool QAtomcxx . . $ QAtom#::AssignNextTextPoscxx . . $ QAtom#AssignNextTextPos(83c267b20bac841a).(int texsize){
77
78
79 if (texsize<0) { lxcxx . . $ lx.=lycxx . . $ ly.=0; return true;};
80
81 txcxx . . $ QAtom#tx.=lxcxx . . $ lx.;
82 tycxx . . $ QAtom#ty.=lycxx . . $ ly.;
83
84 if ((lxcxx . . $ lx.+scxx . . $ QAtom#s..TotTexSizeXcxx . . $ OctaMapSamp#TotTexSizeX(b126dc7c1de90089).()>texsize) || (lycxx . . $ ly.+scxx . . $ QAtom#s..TotTexSizeYcxx . . $ OctaMapSamp#TotTexSizeY(b126dc7c1de90089).()>texsize)) return false;
85
86 lxcxx . . $ lx.+=scxx . . $ QAtom#s..TotTexSizeXcxx . . $ OctaMapSamp#TotTexSizeX(b126dc7c1de90089).();
87 if (lxcxx . . $ lx.+scxx . . $ QAtom#s..TotTexSizeXcxx . . $ OctaMapSamp#TotTexSizeX(b126dc7c1de90089).()>texsize) {
88 lycxx . . $ ly.+=scxx . . $ QAtom#s..TotTexSizeYcxx . . $ OctaMapSamp#TotTexSizeY(b126dc7c1de90089).();
89 lxcxx . . $ lx.=0;
90 }
91
92 return true;
93 }
94
95 bool Bondcxx . . $ Bond#::AssignNextTextPoscxx . . $ Bond#AssignNextTextPos(83c267b20bac841a).(int texsize){
96 if (texsize<0) { lxcxx . . $ lx.=lycxx . . $ ly.=0; return true;};
97
98 txcxx . . $ Bond#tx.=lxcxx . . $ lx.;
99 tycxx . . $ Bond#ty.=lycxx . . $ ly.;
100
101 if ((lxcxx . . $ lx.+BSIZEcxx . . $ BSIZE.>texsize) || (lycxx . . $ ly.+CSIZEcxx . . $ CSIZE.>texsize)) return false;
102
103 lxcxx . . $ lx.+=BSIZEcxx . . $ BSIZE.;
104 if (lxcxx . . $ lx.+BSIZEcxx . . $ BSIZE.>texsize) {
105 lycxx . . $ ly.+=CSIZEcxx . . $ CSIZE.;
106 lxcxx . . $ lx.=0;
107 }
108 return true;
109 }
110
111 bool Molcxx . . $ Mol#::ReassignTexturecxx . . $ Mol#ReassignTexture(83c267b20bac841a).(int textsize) {
112 // reset texture
113 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].AssignNextTextPoscxx . . $ QAtom#AssignNextTextPos(83c267b20bac841a).( -1 );
114
115
116 // assign texture positions
•117 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
118 if (!atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].AssignNextTextPoscxx . . $ QAtom#AssignNextTextPos(83c267b20bac841a).( textsize )) return false;
119 }
120
121 if (stickscxx . . $ Mol#sticks.)
•122 for (int i=0; i < (int)bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
123 if (!bondcxx . . $ Mol#bond.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].AssignNextTextPoscxx . . $ Bond#AssignNextTextPos(83c267b20bac841a).( textsize )) return false;
124 }
125
126 return true;
127 /*for (int i=0; i<atom.size(); i++)
128 atom[i].FillTexture(texture, textsize);*/
129 //printf("Texture Filled!\n");
130 }
131
132 extern CgUtilcxx . . $ CgUtil# cgSettingscxx . . $ cgSettings.;
133
134 void Molcxx . . $ Mol#::ReassignTextureAutosizecxx . . $ Mol#ReassignTextureAutosize(49f6e7a06ebc5aa8).() {
135 if (textureAssignedcxx . . $ Mol#textureAssigned.) return;
136
137 /*
138 // JUST A TEST:
139 if (sticks) {
140 BSIZE=CSIZE=5;
141 }
142 else {
143 BSIZE=CSIZE=10;
144 }
145 CubeMapSamp::SetSize(CSIZE);
146 OctaMapSamp::SetSize(CSIZE);
147 moltextureCanvas.SetRes(1024);
148 ReassignTexture(1024);
149
150 textureAssigned=true;
151 return;
152 */
153
154 int nEl = atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
155 if (stickscxx . . $ Mol#sticks.) nEl+= bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
156
157 int guess = hardSettingscxx . . $ hardSettings..TSIZEcxx . . $ HardSettings#TSIZE.;
158
159 int lastThatWorked = guess;
160
161 bool enlarge=false, shrink=false, forced=false;
162
163 do {
164
165 if (enlarge && shrink) forced=true;
166
167 moltextureCanvascxx . . $ moltextureCanvas..SetRescxx . . $ MyCanvas#SetRes(d4f767463ce0a6b3).(guess);
168
169 /*
170 if (guess != hardSettings.TSIZE)
171 if (!forced)
172 if (!moltextureCanvas.Test()) {
173 // use this res!
174 guess = lastThatWorked ;
175 forced=true;
176 continue;
177 }
178 */
179
180 lastThatWorked=guess;
181
182 int res= SetCsizecxx . . $ SetCsize(9b79fb6aee4c0440).(guess, nEl);
183
184 if (!forced) {
185
186 if ((res==TOO_BIGcxx . . $ `src/Mol.cpp:40:9`!) && (guess/2>=16)) {
187 shrink=true;
188 guess/=2;
189 continue;
190 }
191
192 if ((res==TOO_SMALLcxx . . $ `src/Mol.cpp:41:9`!)&& (guess*2<=hardSettingscxx . . $ hardSettings..MAX_TSIZEcxx . . $ HardSettings#MAX_TSIZE.)) {
193 enlarge=true;
194 guess*=2;
195 continue;
196 }
197 }
198
199 CubeMapSampcxx . . $ CubeMapSamp#::SetSizecxx . . $ CubeMapSamp#SetSize(d4f767463ce0a6b3).(CSIZEcxx . . $ CSIZE.);
200 OctaMapSampcxx . . $ OctaMapSamp#::SetSizecxx . . $ OctaMapSamp#SetSize(d4f767463ce0a6b3).(CSIZEcxx . . $ CSIZE.);
201
202 if (!ReassignTexturecxx . . $ Mol#ReassignTexture(83c267b20bac841a).(guess)) {
203 // should never happen
204 }
205
206 break;
207 } while (1);
208
209
210 }
211
212 Bondcxx . . $ Bond#::Bondcxx . . $ Bond#Bond(af2aa09e7c59b5b6).(const QAtomcxx . . $ QAtom# &_a,const QAtomcxx . . $ QAtom# &_b):
213 atmAcxx . . $ Bond#atmA.(&_a), atmBcxx . . $ Bond#atmB.(&_b)
214 {
215
216
217 acxx . . $ Bond#a.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e)._a.Pcxx . . $ QAtom#P(1599a330e41e2ee3).();
218 bcxx . . $ Bond#b.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e)._b.Pcxx . . $ QAtom#P(1599a330e41e2ee3).();
219
220 dircxx . . $ Bond#dir.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).(acxx . . $ Bond#a.-cxx . . $ vcg/Point3#operator-(df3b8fd47e21bd0c).bcxx . . $ Bond#b.).Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).();
221
•222 //float rada= _a.covalentr;
223 //float radb= _b.covalentr;
224
225 /*a-=dir*(rada*0.60);
226 b+=dir*(radb*0.60);*/
227 lenghtcxx . . $ Bond#lenght.=(acxx . . $ Bond#a.-cxx . . $ vcg/Point3#operator-(df3b8fd47e21bd0c).bcxx . . $ Bond#b.).Normcxx . . $ vcg/Point3#Norm(8f5363d873dd4781).();
228 startpcxx . . $ Bond#startp.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).dircxx . . $ Bond#dir.^cxx . . $ vcg/Point3#`operator^`(df3b8fd47e21bd0c).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(0,0,1);
229 if (startpcxx . . $ Bond#startp..SquaredNormcxx . . $ vcg/Point3#SquaredNorm(8f5363d873dd4781).()<0.1) startpcxx . . $ Bond#startp.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).dircxx . . $ Bond#dir.^cxx . . $ vcg/Point3#`operator^`(df3b8fd47e21bd0c).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(0,1,0);
230 startpcxx . . $ Bond#startp..Normalizecxx . . $ vcg/Point3#Normalize(f55c2490dff4ff58).();
231
232 hetatomFlagcxx . . $ Bond#hetatomFlag.=_a.hetatomFlagcxx . . $ QAtom#hetatomFlag. || _b.hetatomFlagcxx . . $ QAtom#hetatomFlag.;
233
234 UpdateColorscxx . . $ Bond#UpdateColors(49f6e7a06ebc5aa8).();
235
236 }
237
238
239 void Molcxx . . $ Mol#::AddBondcxx . . $ Mol#AddBond(3e454b8ccf442868).(int i, int j)
240 {
241 bondcxx . . $ Mol#bond..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).( Bondcxx . . $ Bond#Bond(af2aa09e7c59b5b6).( atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i], atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j] ) );
242 }
243
244 void Molcxx . . $ Mol#::FindBondscxx . . $ Mol#FindBonds(49f6e7a06ebc5aa8).(){
245 /*
246 // (DRAMATICALLY) QUADRATIC VERSION
247 for (int i=0; i<atom.size(); i++)
248 for (int j=0; j<i; j++) {
249
250 const float mind=0.4;
251 float maxd=atom[i].covalentr+atom[j].covalentr+0.56;
252 float dist=(atom[i].P()-atom[j].P()).SquaredNorm();
253 if ( (dist>=mind*mind) && (dist<=maxd*maxd) ) {
254 bond.push_back( Bond( atom[i].P(), atom[j].P(),
255 atom[i].covalentr, atom[j].covalentr,
256 Point3f(atom[i].cr,atom[i].cg,atom[i].cb),
257 Point3f(atom[j].cr,atom[j].cg,atom[j].cb)
258 ) );
259 }
260 }
261 */
262
263 // (HOPEFULLY) PSEUDO-LINEAR VERSION
264
265 // sort, then find bonds
266 const float MIND=0.4;
267 const float MAXD=MAX_COVALENT_RADIUScxx . . $ `src/AtomColor.h:9:9`!*2+0.56;
268
269 bool showprogress=atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()>2000;
270
•271 if (showprogress) StartProgresscxx . . $ StartProgress(34d26762b42c433a).((char *)"Locating Bonds",atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() );
272
273 // Sort atoms per x coordinate
274 std::sortcxx . . $ std/sort(249673c20e2b8d5).( atomcxx . . $ Mol#atom..begincxx . . $ std/vector#begin(55a6de06420d4903).(), atomcxx . . $ Mol#atom..endcxx . . $ std/vector#end(55a6de06420d4903).() );
275
276
277 int st=0; // start interval
•278 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
279 if (showprogress) if (i%100) if (!UpdateProgresscxx . . $ UpdateProgress(83c267b20bac841a).(i)) {
280 bondcxx . . $ Mol#bond..clearcxx . . $ std/vector#clear(ced63f7c635d850d).();
281 //SetSpaceFill();
282 return;
283 };
284 float px=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pxcxx . . $ QAtom#px.;
•285 for (int j=st; j < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); j++) {
286 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j].pxcxx . . $ QAtom#px. < px-MAXD) st=j; // move interval forward
287 else if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j].pxcxx . . $ QAtom#px. > px ) break; // no more atoms
288 else {
289 float maxd=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].covalentrcxx . . $ QAtom#covalentr.+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j].covalentrcxx . . $ QAtom#covalentr.+0.56;
290 float dist=(atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].Pcxx . . $ QAtom#P(1599a330e41e2ee3).()-cxx . . $ vcg/Point3#operator-(df3b8fd47e21bd0c).atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j].Pcxx . . $ QAtom#P(1599a330e41e2ee3).()).SquaredNormcxx . . $ vcg/Point3#SquaredNorm(8f5363d873dd4781).();
291 if ( (dist>=MIND*MIND) && (dist<=maxd*maxd) )
292 if ( // one way check
293 /*(atom[j].px != px ) ||
294 (atom[j].py < atom[i].py ) ||
295 ( (atom[j].py == atom[i].py ) && (atom[j].pz < atom[i].pz ) ) */
296 i>j
297 )
298 AddBondcxx . . $ Mol#AddBond(3e454b8ccf442868).(i,j);
299 }
300 }
301 }
302
303
304 if (showprogress) EndProgresscxx . . $ EndProgress(49f6e7a06ebc5aa8).();
•305 printf("%d bonds detected!\n", (int)bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() );
306 }
307
308 void Molcxx . . $ Mol#::SetSpaceFillcxx . . $ Mol#SetSpaceFill(49f6e7a06ebc5aa8).(){
309 if (stickscxx . . $ Mol#sticks.) textureAssignedcxx . . $ Mol#textureAssigned.=false;
310 stickscxx . . $ Mol#sticks.=false;
311
312 ReassignTextureAutosizecxx . . $ Mol#ReassignTextureAutosize(49f6e7a06ebc5aa8).();
313
•314 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].spacefillrcxx . . $ QAtom#spacefillr.;
315 }
316
317 void Molcxx . . $ Mol#::SetBallAndStickscxx . . $ Mol#SetBallAndSticks(9364e6e7bff7660).(float radius){
318 if (bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()==0) FindBondscxx . . $ Mol#FindBonds(49f6e7a06ebc5aa8).();
319
320 if (!stickscxx . . $ Mol#sticks.) {
321 stickscxx . . $ Mol#sticks.=true;
322 textureAssignedcxx . . $ Mol#textureAssigned.=false;
323 UpdateColorscxx . . $ Mol#UpdateColors(49f6e7a06ebc5aa8).(); // updata colori sticks
324 }
325
326 ReassignTextureAutosizecxx . . $ Mol#ReassignTextureAutosize(49f6e7a06ebc5aa8).();
327
•328 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
329 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].covalentrcxx . . $ QAtom#covalentr.;
330 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.<radius) atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.=radius;
331 }
332 stick_radiuscxx . . $ stick_radius.=radius;
333 }
334
335 void Molcxx . . $ Mol#::SetLicoricecxx . . $ Mol#SetLicorice(9364e6e7bff7660).(float radius){
336 if (bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()==0) FindBondscxx . . $ Mol#FindBonds(49f6e7a06ebc5aa8).();
337
338 if (!stickscxx . . $ Mol#sticks.) {
339 stickscxx . . $ Mol#sticks.=true;
340 textureAssignedcxx . . $ Mol#textureAssigned.=false;
341 UpdateColorscxx . . $ Mol#UpdateColors(49f6e7a06ebc5aa8).(); // updata colori sticks
342 }
343
344 ReassignTextureAutosizecxx . . $ Mol#ReassignTextureAutosize(49f6e7a06ebc5aa8).();
345
•346 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.=radius;
347 stick_radiuscxx . . $ stick_radius.=radius;
348 }
349
350
351 void Molcxx . . $ Mol#::Transformcxx . . $ Mol#Transform(5d15d4e2ac4f9dae).(const Point3fcxx . . $ vcg/Point3f# &ax,const Point3fcxx . . $ vcg/Point3f# &ay,const Point3fcxx . . $ vcg/Point3f# &az){
352 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].Transformcxx . . $ QAtom#Transform(5d15d4e2ac4f9dae).(ax,ay,az);
353 tx0cxx . . $ Mol#tx0.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].rcxx . . $ QAtom#r.;
354 tx1cxx . . $ Mol#tx1.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].rcxx . . $ QAtom#r.;
355 ty0cxx . . $ Mol#ty0.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].rcxx . . $ QAtom#r.;
356 ty1cxx . . $ Mol#ty1.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].rcxx . . $ QAtom#r.;
•357 for (int i=1; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
358 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].Transformcxx . . $ QAtom#Transform(5d15d4e2ac4f9dae).(ax,ay,az);
359 // update bounding box
360 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.<tx0cxx . . $ Mol#tx0.) tx0cxx . . $ Mol#tx0.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.;
361 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.<ty0cxx . . $ Mol#ty0.) ty0cxx . . $ Mol#ty0.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]-atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.;
362 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.>tx1cxx . . $ Mol#tx1.) tx1cxx . . $ Mol#tx1.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).0]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.;
363 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.>ty1cxx . . $ Mol#ty1.) ty1cxx . . $ Mol#ty1.=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].trpcxx . . $ QAtom#trp.[cxx . . $ vcg/Point3#`operator[]`(7a0ef1c7079e8533).1]+atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].rcxx . . $ QAtom#r.;
364 }
365 sortcxx . . $ std/sort(249673c20e2b8d5).(atomcxx . . $ Mol#atom..begincxx . . $ std/vector#begin(55a6de06420d4903).(), atomcxx . . $ Mol#atom..endcxx . . $ std/vector#end(55a6de06420d4903).() );
366 }
367
368 void Molcxx . . $ Mol#::DuplicateTexelscxx . . $ Mol#DuplicateTexels(1b8c9224ae40325d).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &t, int texsize){
•369 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
370 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].scxx . . $ QAtom#s..DuplicateTexelscxx . . $ OctaMapSamp#DuplicateTexels(54e11277e2b28f45).(t, texsize, atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].txcxx . . $ QAtom#tx., atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].tycxx . . $ QAtom#ty.);
371 }
372 }
373
374
375 // color from atom name
376 void QAtomcxx . . $ QAtom#::getColcxx . . $ QAtom#getCol(85c52e162fed56f9).(const char* st){
377 atomColorcxx . . $ QAtom#atomColor.=getAtomColorcxx . . $ getAtomColor(5c4306d8553b3696).(st);
378 }
379
380 /*
381 void QAtom::getCol(const char* st){
382 int tmp=st[0]*4123+st[1]*1242+st[2]*4561+3141*st[3];
383 tmp%=155;
384 double hue=tmp/155.0;
385 if (hue<0.5) {cg=hue*2; cr=1.0-cg; cb=0;}
386 else { cr=0; cb=(hue-0.5)*2; cg=1.0-cb; }
387 const float W=0.70;
388 cr=cr*(1-W)+W;
389 cg=cg*(1-W)+W;
390 cb=cb*(1-W)+W;
391 }
392 */
393
394 // Helper function:
395 // Parse a line of the PDB file with the CONECT info
396 // Obviously atom id are 1 based indexes.
397 static void AddTmpBondscxx . . $ AddTmpBonds(e4e21baf91b14ac8).(stringcxx . . $ std/string# st, vectorcxx . . $ std/vector#<int> &v)
398 {
399 int startAtom=atoi( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(6,5).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
400 // assert(startAtom >0 && (startAtom-1)<atom.size()); // this assert cannot be used anymore from a static method
401 int i=1;
•402 while((int)st.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).() > 6+i*5+4 && isdigit(st[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).6+i*5+4]))
403 {
404 // printf("'%s' -> '%s' (%c)\n",st.substr(6,5).c_str(),st.substr(6+i*5,5).c_str(),st[6+i*5+4]);
405 int secondAtom=atoi( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(6+i*5,5).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
406 //printf("(%i) CONECT %i -> %i\n",i,startAtom-1,secondAtom-1);
407 ++i;
408 v.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(startAtom-1);
409 v.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(secondAtom-1);
410 //AddBond(startAtom-1,secondAtom-1);
411 }
412 // printf("Found %i conect\n",i);
413 }
414
415 bool Molcxx . . $ Mol#::ReadPdbcxx . . $ Mol#ReadPdb(c5f7da30cbc0f4e9).(const char *_filename){
416
417 readycxx . . $ Mol#ready.=false;
418
419 sprintf(filenamecxx . . $ Mol#filename.,"%s",_filename);
420
421 FILE *f=fopen(filenamecxx . . $ Mol#filename.,"r");
422
423 if (!f) {
424 sprintf(QAtomcxx . . $ QAtom#::lastReadErrorcxx . . $ QAtom#lastReadError.,"Error reding %s:\ncould not open file\n",filenamecxx . . $ Mol#filename.);
425 return false;
426 }
427
428 long size=0;
429 if (fseek(f, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!)==0) size=ftell (f);
430 fseek (f, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
431 bool showprogress=(size==0) || (size>1000000);
•432 if (showprogress) StartProgresscxx . . $ StartProgress(34d26762b42c433a).((char *)"Reading file", size);
433
434 char buf[82];
435 buf[81]=0;
436
437 atomcxx . . $ Mol#atom..clearcxx . . $ std/vector#clear(ced63f7c635d850d).();
438 bondcxx . . $ Mol#bond..clearcxx . . $ std/vector#clear(ced63f7c635d850d).();
439 textureAssignedcxx . . $ Mol#textureAssigned.=false;
440
441 QAtomcxx . . $ QAtom#::readErrorcxx . . $ QAtom#readError.=false;
442 int lineN=0;
443
444 vectorcxx . . $ std/vector#<int> tmpBondVeccxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
445
446 while (1){
447 if(! fgets(buf,81,f)) break;
448 lineN++;
449 if ((lineN % 1000) == 0) if (size!=0) if (showprogress) {
450 if (!UpdateProgresscxx . . $ UpdateProgress(83c267b20bac841a).((int)ftell(f))) return false;
451 }
452 stringcxx . . $ std/string# stcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(buf);
453 if ( (strcmp( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,6).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "ATOM ") == 0 ) ||
454 (strcmp( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,6).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "HETATM") == 0 ) ){
455 atomcxx . . $ Mol#atom..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(QAtomcxx . . $ QAtom#(stcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).));
456 if (QAtomcxx . . $ QAtom#::readErrorcxx . . $ QAtom#readError.) {
457 sprintf(QAtomcxx . . $ QAtom#::lastReadErrorcxx . . $ QAtom#lastReadError.,"Error reading %s!\nLine %d: %s",filenamecxx . . $ Mol#filename.,lineN,&(st[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0]));
458 if (showprogress) EndProgresscxx . . $ EndProgress(49f6e7a06ebc5aa8).();
459 return false;
460 }
461 }
462 if(strcmp( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,6).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "CONECT") == 0 )
463 AddTmpBondscxx . . $ AddTmpBonds(e4e21baf91b14ac8).(stcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., tmpBondVec);
464
465 }
466 //printf("Found %d atoms!\n", atom.size() );
467
468 nhetatmcxx . . $ Mol#nhetatm.=0; natmcxx . . $ Mol#natm.=0;
•469 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++){
470 if (atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].hetatomFlagcxx . . $ QAtom#hetatomFlag.) nhetatmcxx . . $ Mol#nhetatm.++; else natmcxx . . $ Mol#natm.++;
471 }
472
473 ComputeSizecxx . . $ Mol#ComputeSize(49f6e7a06ebc5aa8).();
474
475 UpdateColorscxx . . $ Mol#UpdateColors(49f6e7a06ebc5aa8).();
476
•477 for (int i=0; i < (int)tmpBondVec.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i+=2) {
478 AddBondcxx . . $ Mol#AddBond(3e454b8ccf442868).(tmpBondVec[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i],tmpBondVec[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i+1]);
479 }
480
481
482
483 if (showprogress) EndProgresscxx . . $ EndProgress(49f6e7a06ebc5aa8).();
484 //if (sticks) FindBonds();
485
486 //ReassignTextureAutosize();
487
488 //SetCsize(hardSettings.TSIZE, atom.size() *21 / 10 ); // approx 2.1 bonds per atom
489
490 readycxx . . $ Mol#ready.=true;
491 ResetAOcxx . . $ Mol#ResetAO(49f6e7a06ebc5aa8).();
492 return true;
493 }
494
495 char* Molcxx . . $ Mol#::GetFilenameTexcxx . . $ Mol#GetFilenameTex(41208ce6ca65dd58).(){
496 static char res[1024];
497 sprintf(res,"%s.ppm",filenamecxx . . $ Mol#filename.);
498 return res;
499 }
500
501 char* Molcxx . . $ Mol#::GetFilenameSnapcxx . . $ Mol#GetFilenameSnap(41208ce6ca65dd58).(){
502 static char res[2048];
503 sprintf(res,"%s",filenamecxx . . $ Mol#filename.);
504 // REMOVE PATH: quick and dirty: find last '/'
505 int i=0, pos=-1;
506 while (res[i]) {
507 if ((res[i]=='\\') || (res[i]=='/')) pos=i;
508 i++;
509 }
510 return res+pos+1;
511 return filenamecxx . . $ Mol#filename.;
512 }
513
514 char* Molcxx . . $ Mol#::GetMolNamecxx . . $ Mol#GetMolName(41208ce6ca65dd58).(){
515 static char res[2048];
516 sprintf(res,"%s",filenamecxx . . $ Mol#filename.);
517 // REMOVE PATH: quick and dirty: find last '/'
518 int i=0, pos=-1;
519 while (res[i]) {
520 if ((res[i]=='\\') || (res[i]=='/')) pos=i;
521 i++;
522 }
523 return res+pos+1;
524 return filenamecxx . . $ Mol#filename.;
525 }
526
527 void Molcxx . . $ Mol#::ComputeSizecxx . . $ Mol#ComputeSize(49f6e7a06ebc5aa8).(){
528 // bounding box!
529 float x0,y0,z0,x1,y1,z1;
•530 if (atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() < 1)
531 return;
532 x0=x1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].pxcxx . . $ QAtom#px.;
533 y0=y1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].pycxx . . $ QAtom#py.;
534 z0=z1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].pzcxx . . $ QAtom#pz.;
•535 for (int i=1; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
536 if (x1>atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pxcxx . . $ QAtom#px.) x1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pxcxx . . $ QAtom#px.;
537 if (y1>atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pycxx . . $ QAtom#py.) y1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pycxx . . $ QAtom#py.;
538 if (z1>atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pzcxx . . $ QAtom#pz.) z1=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pzcxx . . $ QAtom#pz.;
539 if (x0<atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pxcxx . . $ QAtom#px.) x0=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pxcxx . . $ QAtom#px.;
540 if (y0<atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pycxx . . $ QAtom#py.) y0=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pycxx . . $ QAtom#py.;
541 if (z0<atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pzcxx . . $ QAtom#pz.) z0=atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].pzcxx . . $ QAtom#pz.;
542 }
543 pxcxx . . $ Mol#px.=(x0+x1)/2;
544 pycxx . . $ Mol#py.=(y0+y1)/2;
545 pzcxx . . $ Mol#pz.=(z0+z1)/2;
546 int k=-4;
547 rcxx . . $ Mol#r.=sqrtcxx . . $ sqrt(fbcf3211dfe1bfd1).( (x1-x0+k)*(x1-x0+k) + (y1-y0+k)*(y1-y0+k) + (z1-z0+k)*(z1-z0+k) );
548 rcxx . . $ Mol#r.*=0.5;
549
550 //printf("pos=(%f %f %f) size=%f\n",px,py,pz,r);
551
552
553 }
554
555 void mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(const char* st, const char* format, float *f){
556 if (!sscanf( st, "%f", f)) {
557 if (sscanf( st, " - %f", f))
558 *f=-*f;
559 else *f=1.0;
560 }
561 }
562
563 void Molcxx . . $ Mol#::FillTexturecxx . . $ Mol#FillTexture(682aa932c3458127).(vectorcxx . . $ std/vector#<Bytecxx . . $ Byte#> &texture, const vectorcxx . . $ std/vector#<int> &sumtable,
564 int texsize, float div )
565 {
566 /*
567 for (int i=0; i<atom.size(); i++)
568 atom[i].s.FillTexture(
569 texture, sumtable,
570 texsize, div , atom[i].tx, atom[i].ty );
571 */
572 }
573
574
575
576
577 void Bondcxx . . $ Bond#::UpdateColorscxx . . $ Bond#UpdateColors(49f6e7a06ebc5aa8).(){
578 col1cxx . . $ Bond#col1.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(atmAcxx . . $ Bond#atmA.->crcxx . . $ QAtom#cr.,atmAcxx . . $ Bond#atmA.->cgcxx . . $ QAtom#cg.,atmAcxx . . $ Bond#atmA.->cbcxx . . $ QAtom#cb.);
579 col2cxx . . $ Bond#col2.=cxx . . $ vcg/Point3#`operator=`(4233705dd3c5533e).Point3fcxx . . $ vcg/Point3#Point3(ca6b6cb9f73ddfb2).(atmBcxx . . $ Bond#atmB.->crcxx . . $ QAtom#cr.,atmBcxx . . $ Bond#atmB.->cgcxx . . $ QAtom#cg.,atmBcxx . . $ Bond#atmB.->cbcxx . . $ QAtom#cb.);
580 }
581
582 void QAtomcxx . . $ QAtom#::UpdateColorscxx . . $ QAtom#UpdateColors(9364e6e7bff7660).(float mode){
583 Color4bcxx . . $ vcg/Color4b# cacxx . . $ vcg/Color4#Color4(49f6e7a06ebc5aa8).,cccxx . . $ vcg/Color4#Color4(49f6e7a06ebc5aa8).;
584
585 *((int *)&ca )= atomColorcxx . . $ QAtom#atomColor.;
586
587 *((int *)&cc )= getChainColorcxx . . $ getChainColor(7864480464b09eea).( chainIndexcxx . . $ QAtom#chainIndex. );
588
589
590 cbcxx . . $ QAtom#cb.=(float(ca[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).0])/255.0f)*mode+ (float(cc[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).0])/255.0f) * (1.0f-mode);
591 cgcxx . . $ QAtom#cg.=(float(ca[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).1])/255.0f)*mode+ (float(cc[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).1])/255.0f) * (1.0f-mode);
592 crcxx . . $ QAtom#cr.=(float(ca[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).2])/255.0f)*mode+ (float(cc[cxx . . $ vcg/Point4#`operator[]`(7a0ef1c7079e8533).2])/255.0f) * (1.0f-mode);
593
594 }
595
596 void Molcxx . . $ Mol#::UpdateColorscxx . . $ Mol#UpdateColors(49f6e7a06ebc5aa8).(){
•597 for (int i=0; i < (int)atomcxx . . $ Mol#atom..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++){
598 atomcxx . . $ Mol#atom.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].UpdateColorscxx . . $ QAtom#UpdateColors(9364e6e7bff7660).(colModecxx . . $ Mol#colMode.);
599 }
600
601 if (stickscxx . . $ Mol#sticks.)
•602 for (int i=0; i < (int)bondcxx . . $ Mol#bond..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
603 bondcxx . . $ Mol#bond.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].UpdateColorscxx . . $ Bond#UpdateColors(49f6e7a06ebc5aa8).();
604 }
605 }
606
607 void Molcxx . . $ Mol#::SetColModecxx . . $ Mol#SetColMode(9364e6e7bff7660).(float newColMode){
608 if (colModecxx . . $ Mol#colMode.!=newColMode) {
609 colModecxx . . $ Mol#colMode.=newColMode;
610 UpdateColorscxx . . $ Mol#UpdateColors(49f6e7a06ebc5aa8).();
611 }
612 else colModecxx . . $ Mol#colMode.=newColMode;
613 }
614
615 bool QAtomcxx . . $ QAtom#::readErrorcxx . . $ QAtom#readError.=false;
616 char QAtomcxx . . $ QAtom#::lastReadErrorcxx . . $ QAtom#lastReadError.[1024];
617
618
619
620 QAtomcxx . . $ QAtom#::QAtomcxx . . $ QAtom#QAtom(8d4ab0a187bf9331).(stringcxx . . $ std/string# st){
621 stringcxx . . $ std/string# elem = st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 12, 2);
622 if (elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0]>='a' && elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0]<='z') elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0]=elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).0]-'a'+'A';
623 if (elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).1]>='a' && elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).1]<='z') elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).1]=elem[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).1]-'a'+'A';
624 if (strcmp( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,6).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "ATOM ") == 0 )
625 {
626 hetatomFlagcxx . . $ QAtom#hetatomFlag.=false;
627
628 getColcxx . . $ QAtom#getCol(85c52e162fed56f9).( elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() );
629 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 30, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pxcxx . . $ QAtom#px.);
630 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 38, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pycxx . . $ QAtom#py.);
631 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 46, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pzcxx . . $ QAtom#pz.);
632
633 chainIndexcxx . . $ QAtom#chainIndex. = (int) st[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).21];
634
635 rcxx . . $ QAtom#r.=spacefillrcxx . . $ QAtom#spacefillr.=getAtomRadiuscxx . . $ getAtomRadius(795d03e4fcc0e9d0).(elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // Van der Waals radii
636
637 covalentrcxx . . $ QAtom#covalentr.=getAtomCovalentRadiuscxx . . $ getAtomCovalentRadius(795d03e4fcc0e9d0).(elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
638 }
639 else if (strcmp( st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0,6).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "HETATM") == 0 )
640 {
641 hetatomFlagcxx . . $ QAtom#hetatomFlag.=true;
642
643 getColcxx . . $ QAtom#getCol(85c52e162fed56f9).( elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() );
644 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 30, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pxcxx . . $ QAtom#px.);
645 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 38, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pycxx . . $ QAtom#py.);
646 mysscanfcxx . . $ mysscanf(cf456aa7c34e365).(st.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).( 46, 8).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(),"%f", &pzcxx . . $ QAtom#pz.);
647
648 chainIndexcxx . . $ QAtom#chainIndex. = (int) st[cxx . . $ std/__cxx11/basic_string#`operator[]`(7b73c3179b3cb3ad).22];
649
650 rcxx . . $ QAtom#r.=spacefillrcxx . . $ QAtom#spacefillr.=getAtomRadiuscxx . . $ getAtomRadius(795d03e4fcc0e9d0).(elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); // Van der Waals radii
651
652 covalentrcxx . . $ QAtom#covalentr.=getAtomCovalentRadiuscxx . . $ getAtomCovalentRadius(795d03e4fcc0e9d0).(elem.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
653 }
654 covalentrcxx . . $ QAtom#covalentr.*=0.85; // mystical value!!!
655
656 }
657