| 1 |
Fromscip-debian debian qutemol 0.4.1~cvs20081111-15 qutemol/patches/`12_mol.cpp.patch`#From.: Morten Kjeldgaard <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Subjectscip-debian debian qutemol 0.4.1~cvs20081111-15 qutemol/patches/`12_mol.cpp.patch`#Subject.: modification to source code |
| 3 |
|
| 4 |
|
| 5 |
--- a/src/Mol.cppscip-debian debian qutemol 0.4.1~cvs20081111-15 qutemol/upstream/`src/Mol.cpp`: |
| 6 |
+++ b/src/Mol.cppscip-debian debian qutemol 0.4.1~cvs20081111-15 qutemol/upstream/`src/Mol.cpp`: |
| 7 |
@@ -16,7 +16,7 @@ |
| 8 |
#include "Mol.h" |
| 9 |
#include "HardSettings.h" |
| 10 |
|
| 11 |
|
| 12 |
+#include "progress.h" |
| 13 |
#include "AtomColor.h" |
| 14 |
|
| 15 |
#include "MyCanvas.h" |
| 16 |
@@ -112,12 +112,12 @@ |
| 17 |
|
| 18 |
|
| 19 |
// assign texture positions |
| 20 |
|
| 21 |
+ for (int i=0; i < (int)atom.size(); i++) { |
| 22 |
if (!atom[i].AssignNextTextPos( textsize )) return false; |
| 23 |
} |
| 24 |
|
| 25 |
if (sticks) |
| 26 |
|
| 27 |
+ for (int i=0; i < (int)bond.size(); i++) { |
| 28 |
if (!bond[i].AssignNextTextPos( textsize )) return false; |
| 29 |
} |
| 30 |
|
| 31 |
@@ -217,8 +217,8 @@ |
| 32 |
|
| 33 |
dir=(a-b).Normalize(); |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
+ //float rada= _a.covalentr; |
| 38 |
+ //float radb= _b.covalentr; |
| 39 |
|
| 40 |
/*a-=dir*(rada*0.60); |
| 41 |
b+=dir*(radb*0.60);*/ |
| 42 |
@@ -266,21 +266,21 @@ |
| 43 |
|
| 44 |
bool showprogress=atom.size()>2000; |
| 45 |
|
| 46 |
|
| 47 |
+ if (showprogress) StartProgress((char *)"Locating Bonds",atom.size() ); |
| 48 |
|
| 49 |
// Sort atoms per x coordinate |
| 50 |
std::sort( atom.begin(), atom.end() ); |
| 51 |
|
| 52 |
|
| 53 |
int st=0; // start interval |
| 54 |
|
| 55 |
+ for (int i=0; i < (int)atom.size(); i++) { |
| 56 |
if (showprogress) if (i%100) if (!UpdateProgress(i)) { |
| 57 |
bond.clear(); |
| 58 |
//SetSpaceFill(); |
| 59 |
return; |
| 60 |
}; |
| 61 |
float px=atom[i].px; |
| 62 |
|
| 63 |
+ for (int j=st; j < (int)atom.size(); j++) { |
| 64 |
if (atom[j].px < px-MAXD) st=j; // move interval forward |
| 65 |
else if (atom[j].px > px ) break; // no more atoms |
| 66 |
else { |
| 67 |
@@ -300,7 +300,7 @@ |
| 68 |
|
| 69 |
|
| 70 |
if (showprogress) EndProgress(); |
| 71 |
|
| 72 |
+ printf("%d bonds detected!\n", (int)bond.size() ); |
| 73 |
} |
| 74 |
|
| 75 |
void Mol::SetSpaceFill(){ |
| 76 |
@@ -309,7 +309,7 @@ |
| 77 |
|
| 78 |
ReassignTextureAutosize(); |
| 79 |
|
| 80 |
|
| 81 |
+ for (int i=0; i < (int)atom.size(); i++) atom[i].r=atom[i].spacefillr; |
| 82 |
} |
| 83 |
|
| 84 |
void Mol::SetBallAndSticks(float radius){ |
| 85 |
@@ -323,7 +323,7 @@ |
| 86 |
|
| 87 |
ReassignTextureAutosize(); |
| 88 |
|
| 89 |
|
| 90 |
+ for (int i=0; i < (int)atom.size(); i++) { |
| 91 |
atom[i].r=atom[i].covalentr; |
| 92 |
if (atom[i].r<radius) atom[i].r=radius; |
| 93 |
} |
| 94 |
@@ -341,7 +341,7 @@ |
| 95 |
|
| 96 |
ReassignTextureAutosize(); |
| 97 |
|
| 98 |
|
| 99 |
+ for (int i=0; i < (int)atom.size(); i++) atom[i].r=radius; |
| 100 |
stick_radius=radius; |
| 101 |
} |
| 102 |
|
| 103 |
@@ -352,7 +352,7 @@ |
| 104 |
tx1=atom[0].trp[0]+atom[0].r; |
| 105 |
ty0=atom[0].trp[1]-atom[0].r; |
| 106 |
ty1=atom[0].trp[1]+atom[0].r; |
| 107 |
|
| 108 |
+ for (int i=1; i < (int)atom.size(); i++) { |
| 109 |
atom[i].Transform(ax,ay,az); |
| 110 |
// update bounding box |
| 111 |
if (atom[i].trp[0]-atom[i].r<tx0) tx0=atom[i].trp[0]-atom[i].r; |
| 112 |
@@ -364,7 +364,7 @@ |
| 113 |
} |
| 114 |
|
| 115 |
void Mol::DuplicateTexels(vector<Byte> &t, int texsize){ |
| 116 |
|
| 117 |
+ for (int i=0; i < (int)atom.size(); i++) { |
| 118 |
atom[i].s.DuplicateTexels(t, texsize, atom[i].tx, atom[i].ty); |
| 119 |
} |
| 120 |
} |
| 121 |
@@ -397,7 +397,7 @@ |
| 122 |
int startAtom=atoi( st.substr(6,5).c_str()); |
| 123 |
// assert(startAtom >0 && (startAtom-1)<atom.size()); // this assert cannot be used anymore from a static method |
| 124 |
int i=1; |
| 125 |
|
| 126 |
+ while((int)st.size() > 6+i*5+4 && isdigit(st[6+i*5+4])) |
| 127 |
{ |
| 128 |
// printf("'%s' -> '%s' (%c)\n",st.substr(6,5).c_str(),st.substr(6+i*5,5).c_str(),st[6+i*5+4]); |
| 129 |
int secondAtom=atoi( st.substr(6+i*5,5).c_str()); |
| 130 |
@@ -427,7 +427,7 @@ |
| 131 |
if (fseek(f, 0, SEEK_END)==0) size=ftell (f); |
| 132 |
fseek (f, 0, SEEK_SET); |
| 133 |
bool showprogress=(size==0) || (size>1000000); |
| 134 |
|
| 135 |
+ if (showprogress) StartProgress((char *)"Reading file", size); |
| 136 |
|
| 137 |
char buf[82]; |
| 138 |
buf[81]=0; |
| 139 |
@@ -464,7 +464,7 @@ |
| 140 |
//printf("Found %d atoms!\n", atom.size() ); |
| 141 |
|
| 142 |
nhetatm=0; natm=0; |
| 143 |
|
| 144 |
+ for (int i=0; i < (int)atom.size(); i++){ |
| 145 |
if (atom[i].hetatomFlag) nhetatm++; else natm++; |
| 146 |
} |
| 147 |
|
| 148 |
@@ -472,7 +472,7 @@ |
| 149 |
|
| 150 |
UpdateColors(); |
| 151 |
|
| 152 |
|
| 153 |
+ for (int i=0; i < (int)tmpBondVec.size(); i+=2) { |
| 154 |
AddBond(tmpBondVec[i],tmpBondVec[i+1]); |
| 155 |
} |
| 156 |
|
| 157 |
@@ -525,11 +525,12 @@ |
| 158 |
void Mol::ComputeSize(){ |
| 159 |
// bounding box! |
| 160 |
float x0,y0,z0,x1,y1,z1; |
| 161 |
|
| 162 |
+ if (atom.size() < 1) |
| 163 |
+ return; |
| 164 |
x0=x1=atom[0].px; |
| 165 |
y0=y1=atom[0].py; |
| 166 |
z0=z1=atom[0].pz; |
| 167 |
|
| 168 |
+ for (int i=1; i < (int)atom.size(); i++) { |
| 169 |
if (x1>atom[i].px) x1=atom[i].px; |
| 170 |
if (y1>atom[i].py) y1=atom[i].py; |
| 171 |
if (z1>atom[i].pz) z1=atom[i].pz; |
| 172 |
@@ -591,12 +592,12 @@ |
| 173 |
} |
| 174 |
|
| 175 |
void Mol::UpdateColors(){ |
| 176 |
|
| 177 |
+ for (int i=0; i < (int)atom.size(); i++){ |
| 178 |
atom[i].UpdateColors(colMode); |
| 179 |
} |
| 180 |
|
| 181 |
if (sticks) |
| 182 |
|
| 183 |
+ for (int i=0; i < (int)bond.size(); i++) { |
| 184 |
bond[i].UpdateColors(); |
| 185 |
} |
| 186 |
} |