1 |
#define EXTERN extern |
2 |
|
3 |
#include "pcwin.h" |
4 |
#include "pcmod.h" |
5 |
|
6 |
int get_hybrid(int); |
7 |
void message_alert(char *,char *); |
8 |
int check_ring1(int); |
9 |
|
10 |
void xlogp(float *result) |
11 |
{ |
12 |
int i,j,k,ia; |
13 |
int iz,nh,nx,npi,nc,itype,dbond,nox,ndouble,nf; |
14 |
int npi_c,npi_x; |
15 |
int nhydrophobic, namino_acid, nhbond, n13FX, n13XX; |
16 |
int atype[100]; |
17 |
long int pi_mask; |
18 |
float total; |
19 |
// char astring[60]; |
20 |
float datype[] = { |
21 |
0.000, 0.484, 0.168,-0.181, 0.358, 0.009,-0.344,-0.439, 0.051,-0.138, |
22 |
-0.417,-0.454,-0.378, 0.223,-0.598,-0.396,-0.699,-0.362, 0.395, 0.236, |
23 |
-0.166, 1.726, 0.098,-0.108, 1.637, 1.774, 0.281, 0.142, 0.715, 0.302, |
24 |
-0.064, 0.079, 0.200, 0.869, 0.316, 0.054, 0.347, 0.046,-0.399,-0.029, |
25 |
-0.330, 0.397, 0.068, 0.327,-2.057, 0.218,-0.582,-0.449,-0.774, 0.040, |
26 |
-0.381, 0.443,-0.117,-2.052,-1.716, 0.321,-0.921,-0.704, 0.119, 1.192, |
27 |
0.434, 0.587, 0.668,-0.791,-0.212, 0.016, 0.752, 1.071, 0.964,-1.817, |
28 |
-1.214,-0.778, 0.493, 1.010, 1.187, 1.489,-0.802,-0.256, 1.626, 0.077, |
29 |
0.264, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, |
30 |
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 }; |
31 |
|
32 |
pi_mask = (1L << PI_MASK); |
33 |
for (i=0;i < 100; i++) |
34 |
atype[i] = 0; |
35 |
// |
36 |
// loop through atoms and classify |
37 |
for (i=1; i <= natom; i++) |
38 |
{ |
39 |
if (atom[i].atomnum == 6) // carbon |
40 |
{ |
41 |
iz = get_hybrid(i); |
42 |
nh = nx = npi = nc = 0; |
43 |
for (j=0; j < MAXIAT; j++) |
44 |
{ |
45 |
if (atom[i].iat[j] != 0) |
46 |
{ |
47 |
if (atom[atom[i].iat[j]].atomnum == 1) nh++; |
48 |
if (atom[atom[i].iat[j]].flags & pi_mask) npi++; |
49 |
itype = atom[atom[i].iat[j]].atomnum; |
50 |
if (itype == 6) nc++; |
51 |
if (itype == 7 || itype == 8 || itype == 15 || itype == 16) nx++; |
52 |
itype = atom[atom[i].iat[j]].mmx_type; |
53 |
if (itype == 11 || itype == 12 || itype == 13 || itype == 14) nx++; |
54 |
} |
55 |
} |
56 |
if (iz == 1) // sp3 |
57 |
{ |
58 |
if (nh == 3 && nc == 1 && npi == 0) |
59 |
atype[1]++; |
60 |
else if (nh == 3 && nc == 1 && npi > 0) |
61 |
atype[2]++; |
62 |
else if (nh == 3 && nx == 1) |
63 |
atype[3]++; |
64 |
else if (nh == 2 && nc == 2 && npi == 0) |
65 |
atype[4]++; |
66 |
else if (nh == 2 && nc == 2 && npi > 0) |
67 |
atype[5]++; |
68 |
else if (nh == 2 && nc == 1 && nx == 1) |
69 |
atype[6]++; |
70 |
else if (nh == 2 && nx == 2) |
71 |
atype[7]++; |
72 |
else if (nh == 1 && nc == 3 && npi == 0) |
73 |
atype[8]++; |
74 |
else if (nh == 1 && nc == 3 && npi > 0) |
75 |
atype[9]++; |
76 |
else if (nh == 1 && nc == 2 && nx == 1) |
77 |
atype[10]++; |
78 |
else if (nh == 1 && nc == 1 && nx == 2) |
79 |
atype[11]++; |
80 |
else if (nh == 1 && nx == 3) |
81 |
atype[11]++; |
82 |
else if (nh == 0 && nc == 4 && npi == 0) |
83 |
atype[12]++; |
84 |
else if (nh == 0 && nc == 4 && npi > 0) |
85 |
atype[13]++; |
86 |
else if (nh == 0 && nc == 3 && nx == 1) |
87 |
atype[14]++; |
88 |
else if (nh == 0 && nc == 2 && nx == 2) |
89 |
atype[15]++; |
90 |
else if (nh == 0 && nc == 1 && nx == 3) |
91 |
atype[16]++; |
92 |
else if (nh == 0 && nc == 0 && nx == 4) |
93 |
atype[17]++; |
94 |
} else if (iz == 2) // sp2 |
95 |
{ |
96 |
dbond = 0; |
97 |
// find double bond atom |
98 |
for (j=0; j < 4; j++) |
99 |
{ |
100 |
if (atom[i].iat[j] != 0 && atom[i].bo[j] == 2) |
101 |
{ |
102 |
dbond = atom[i].iat[j]; |
103 |
break; |
104 |
} |
105 |
} |
106 |
if (dbond == 0) goto L_10; // bad atoms |
107 |
if (nh == 2 && nc == 1) |
108 |
{ |
109 |
atype[18]++; |
110 |
goto L_10; |
111 |
} |
112 |
// if not a pi atom |
113 |
if (!(atom[i].flags & pi_mask)) // non pi atoms |
114 |
{ |
115 |
if (atom[dbond].atomnum == 6) // c=c |
116 |
{ |
117 |
if (nh == 1 & nc == 2) |
118 |
{ |
119 |
atype[19]++; |
120 |
goto L_10; |
121 |
} else if (nh == 1 && nx == 1) |
122 |
{ |
123 |
atype[20]++; |
124 |
goto L_10; |
125 |
} else if (nh == 0 && nc == 3) |
126 |
{ |
127 |
atype[22]++; |
128 |
goto L_10; |
129 |
} else if (nh == 0 && nx >= 1) |
130 |
{ |
131 |
atype[23]++; |
132 |
goto L_10; |
133 |
} |
134 |
}else // c=x |
135 |
{ |
136 |
if (nh == 1) |
137 |
{ |
138 |
atype[21]++; |
139 |
goto L_10; |
140 |
} else if (nc >= 1) |
141 |
{ |
142 |
atype[24]++; |
143 |
goto L_10; |
144 |
} else if (nx == 3) |
145 |
{ |
146 |
atype[25]++; |
147 |
goto L_10; |
148 |
} |
149 |
} |
150 |
} else // pi conjugated systems |
151 |
{ |
152 |
nh = nc = nx = npi = 0; |
153 |
npi_c = 0; |
154 |
npi_x = 0; |
155 |
for (j = 0; j < 3; j++) |
156 |
{ |
157 |
if (atom[atom[i].iat[j]].atomnum == 1) |
158 |
nh++; |
159 |
if (atom[atom[i].iat[j]].atomnum == 6) |
160 |
{ |
161 |
nc++; |
162 |
if (atom[atom[i].iat[j]].flags & pi_mask) |
163 |
{ |
164 |
npi++; |
165 |
npi_c++; |
166 |
} |
167 |
} |
168 |
if (atom[atom[i].iat[j]].atomnum >= 6) |
169 |
{ |
170 |
nx++; |
171 |
if (atom[atom[i].iat[j]].flags & pi_mask) |
172 |
{ |
173 |
npi++; |
174 |
npi_x++; |
175 |
} |
176 |
} |
177 |
} |
178 |
if (nh == 1 && nc == 2) |
179 |
atype[26]++; |
180 |
else if (nh == 1 && nc ==1 && nx == 1) |
181 |
atype[27]++; |
182 |
else if (nh == 1 && nx == 2) |
183 |
atype[28]++; |
184 |
else if (nc == 3 && npi == 2) |
185 |
atype[29]++; |
186 |
else if (nc == 2 && npi_x == 2 && nx == 1) |
187 |
atype[30]++; |
188 |
else if (nc == 2 && npi_x == 1 && nx == 1 && npi_x == 1) |
189 |
atype[31]++; |
190 |
else if (nc == 1 && nx == 2 && npi_x == 1 && npi_c == 1) |
191 |
atype[32]++; |
192 |
else if (nc == 1 && nx == 2 && npi_x == 2) |
193 |
atype[33]++; |
194 |
else if (npi == 3) |
195 |
atype[34]++; |
196 |
} |
197 |
} else if (iz == 3) |
198 |
{ |
199 |
for (j=0; j < 4; j++) |
200 |
{ |
201 |
if (atom[i].iat[j] != 0 && atom[i].bo[j] == 3) |
202 |
{ |
203 |
if (atom[atom[i].iat[j]].atomnum == 7) |
204 |
{ |
205 |
atype[77]++; |
206 |
goto L_10; |
207 |
} |
208 |
} |
209 |
} |
210 |
if (nh == 1) |
211 |
atype[35]++; |
212 |
else if (nc == 1) |
213 |
atype[36]++; |
214 |
} |
215 |
} else if (atom[i].atomnum == 1) // hydrogen |
216 |
{ |
217 |
atype[37]++; |
218 |
} else if (atom[i].atomnum == 8) // oxygen |
219 |
{ |
220 |
nh = npi = nx = nc = 0; |
221 |
for (j=0; j < 4; j++) |
222 |
{ |
223 |
if (atom[atom[i].iat[j]].atomnum == 1) |
224 |
nh++; |
225 |
if (atom[atom[i].iat[j]].atomnum == 6) |
226 |
{ |
227 |
nc++; |
228 |
if (atom[atom[i].iat[j]].flags & pi_mask) npi++; |
229 |
} |
230 |
if (atom[atom[i].iat[j]].atomnum > 6) |
231 |
{ |
232 |
nx++; |
233 |
if (atom[atom[i].iat[j]].flags & pi_mask) npi++; |
234 |
} |
235 |
} |
236 |
if (atom[i].mmx_type == 6) |
237 |
{ |
238 |
if (nh == 1 && nc == 1 && npi == 0) |
239 |
atype[38]++; |
240 |
else if (nh == 1 && nc == 1 && npi == 1) |
241 |
atype[39]++; |
242 |
else if (nh == 1 && nx == 1) |
243 |
atype[40]++; |
244 |
else if (nc == 2 && npi < 2) |
245 |
atype[41]++; |
246 |
else if ( (nc == 1 && nx == 1) || nx == 2) |
247 |
atype[42]++; |
248 |
else if (nc == 2 && npi == 2) |
249 |
atype[43]++; |
250 |
} else if (atom[i].mmx_type == 7) |
251 |
{ |
252 |
if (nc == 1) |
253 |
atype[44]++; |
254 |
else if (nx == 1) |
255 |
atype[45]++; |
256 |
} |
257 |
} else if (atom[i].atomnum == 7) // nitrogen |
258 |
{ |
259 |
nh = nx = nc = npi = 0; |
260 |
for (j=0; j < MAXIAT; j++) |
261 |
{ |
262 |
if (atom[i].iat[j] != 0) |
263 |
{ |
264 |
if (atom[atom[i].iat[j]].atomnum == 1) nh++; |
265 |
if (atom[atom[i].iat[j]].atomnum == 6) nc++; |
266 |
if (atom[atom[i].iat[j]].atomnum > 6) nx++; |
267 |
if (atom[atom[i].iat[j]].flags & pi_mask) npi++; |
268 |
} |
269 |
} |
270 |
if (atom[i].mmx_type == 8) |
271 |
{ |
272 |
if (nh == 2 && nc == 1 && npi == 0) atype[46]++; |
273 |
else if (nh == 2 && nc == 1 && npi > 1) atype[47]++; |
274 |
else if (nh == 2 && nx == 1) atype[48]++; |
275 |
else if (nh == 1 && nc == 2) atype[49]++; |
276 |
else if (nh == 1 && nc == 1 && nx == 1) atype[50]++; |
277 |
else if (nh == 1 && nx == 2) atype[50]++; |
278 |
else if (nh == 0 && nc == 3) atype[51]++; |
279 |
else if (nh == 0 && nx >= 1) atype[52]++; |
280 |
} else if (atom[i].mmx_type == 9) |
281 |
{ |
282 |
for (j=0; j < 4; j++) |
283 |
{ |
284 |
if (atom[i].iat[j] != 0 ) |
285 |
{ |
286 |
if (atom[i].bo[j] == 2) // imine type |
287 |
{ |
288 |
if (atom[atom[i].iat[j]].atomnum == 6) |
289 |
{ |
290 |
if (nx == 0) |
291 |
atype[53]++; |
292 |
else |
293 |
atype[54]++; |
294 |
goto L_10; |
295 |
} else if (atom[atom[i].iat[j]].atomnum > 6) |
296 |
{ |
297 |
if (nc == 1) |
298 |
atype[55]++; |
299 |
else |
300 |
atype[56]++; |
301 |
goto L_10; |
302 |
} |
303 |
} |
304 |
} |
305 |
} |
306 |
for (j=0; j < 4; j++) // amides |
307 |
{ |
308 |
if (atom[i].iat[j] != 0 && atom[atom[i].iat[j]].atomnum == 6) |
309 |
{ |
310 |
ia = atom[i].iat[j]; |
311 |
for (k=0; k < 4; k++) |
312 |
{ |
313 |
if (atom[ia].iat[k] != 0 && atom[ia].bo[k] == 2) |
314 |
{ |
315 |
if (atom[atom[ia].iat[k]].atomnum == 8) // amide |
316 |
{ |
317 |
if (nh == 2 && nc == 1) atype[63]++; |
318 |
else if (nh == 1) atype[64]++; |
319 |
else atype[65]++; |
320 |
goto L_10; |
321 |
} |
322 |
} |
323 |
} |
324 |
} |
325 |
} |
326 |
// picked up amides and imines - everything else must be aromatic |
327 |
if (nh == 1 && nc == 2) atype[58]++; |
328 |
else if (nh == 1 && nx >= 1) atype[59]++; |
329 |
else if (nc == 3) atype[61]++; |
330 |
goto L_10; |
331 |
} |
332 |
} else if (atom[i].atomnum == 16) // sulfur |
333 |
{ |
334 |
nh = 0; |
335 |
nox = 0; |
336 |
ndouble = 0; |
337 |
for (j=0; j < MAXIAT; j++) |
338 |
{ |
339 |
if (atom[i].iat[j] != 0) |
340 |
{ |
341 |
if (atom[atom[i].iat[j]].atomnum == 1) nh++; |
342 |
if (atom[atom[i].iat[j]].atomnum == 8) nox++; |
343 |
if (atom[i].bo[j] == 2) ndouble++; |
344 |
} |
345 |
} |
346 |
if (nox == 2) |
347 |
{ |
348 |
atype[71]++; |
349 |
goto L_10; |
350 |
} else if (nox == 1) |
351 |
{ |
352 |
atype[70]++; |
353 |
goto L_10; |
354 |
} |
355 |
if (nox == 0 && ndouble == 1) |
356 |
{ |
357 |
atype[69]++; |
358 |
goto L_10; |
359 |
} |
360 |
if (nh == 1) |
361 |
{ |
362 |
atype[66]++; |
363 |
goto L_10; |
364 |
} else |
365 |
{ |
366 |
if (check_ring1(i)) |
367 |
{ |
368 |
if ((atom[atom[i].iat[0]].flags & pi_mask) && (atom[atom[i].iat[1]].flags & pi_mask)) |
369 |
{ |
370 |
atype[68]++; |
371 |
goto L_10; |
372 |
} |
373 |
} else |
374 |
{ |
375 |
atype[67]++; |
376 |
goto L_10; |
377 |
} |
378 |
} |
379 |
} else if (atom[i].atomnum == 15) // phosphorus |
380 |
{ |
381 |
atype[76]++; |
382 |
} else if (atom[i].atomnum == 11) // fluorine |
383 |
{ |
384 |
atype[72]++; |
385 |
} else if (atom[i].atomnum == 17) // chlorine |
386 |
{ |
387 |
atype[73]++; |
388 |
} else if (atom[i].atomnum == 35) // bromine |
389 |
{ |
390 |
atype[74]++; |
391 |
} else if (atom[i].atomnum == 53) // iodine |
392 |
{ |
393 |
atype[75]++; |
394 |
} else if (atom[i].mmx_type == 20) |
395 |
{ |
396 |
atype[0]++; |
397 |
} else |
398 |
{ |
399 |
// sprintf(astring,"Atom %d type %d not supported\0",i,atom[i].type); |
400 |
// message_alert(astring,"Error in LogP"); |
401 |
} |
402 |
L_10: |
403 |
continue; |
404 |
} |
405 |
// done assigning types = compute logP |
406 |
total = 0.0; |
407 |
for (i=0; i < 100; i++) |
408 |
total += atype[i]*datype[i]; |
409 |
|
410 |
// now do correction factors |
411 |
nhydrophobic = namino_acid = nhbond = n13FX = n13XX = 0; |
412 |
|
413 |
nhydrophobic = atype[1] + atype[2] + atype[4] + atype[5] + atype[8] + atype[9] + atype[12] + atype[13] + atype[18] + |
414 |
atype[19] + atype[22]; |
415 |
|
416 |
// 1,3 halogens |
417 |
for (i=1; i <= natom; i++) |
418 |
{ |
419 |
nf = 0; |
420 |
nx = 0; |
421 |
if (atom[i].atomnum == 6) |
422 |
{ |
423 |
for (j=0; j < MAXIAT; j++) |
424 |
{ |
425 |
if (atom[atom[i].iat[j]].atomnum == 9) |
426 |
nf++; |
427 |
if (atom[atom[i].iat[j]].atomnum == 17) |
428 |
nx++; |
429 |
if (atom[atom[i].iat[j]].atomnum == 35) |
430 |
nx++; |
431 |
if (atom[atom[i].iat[j]].atomnum == 53) |
432 |
nx++; |
433 |
} |
434 |
if ((nf >= 1 && nx >= 1) || nf >= 2) |
435 |
n13FX++; |
436 |
if (nx >=2 && nf == 0) |
437 |
n13XX++; |
438 |
} |
439 |
} |
440 |
// amino acids |
441 |
// hydrogen bonds |
442 |
|
443 |
|
444 |
*result = total + nhydrophobic*0.19F + n13FX*0.08 + n13XX*(-0.26F); |
445 |
} |