ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/branches/sync4pymol12/src/mengine/src/attach.c
Revision: 93
Committed: Sat Jan 17 23:24:55 2009 UTC (13 years, 4 months ago) by wdelano
File size: 2585 byte(s)
Log Message:
branch created
Line File contents
1 #define EXTERN extern
2
3 #include "pcwin.h"
4 #include "pcmod.h"
5 #include "attached.h"
6
7 void attach()
8 {
9 int i,j,k,m,p;
10 int jj,kk,mm, jji;
11
12 for (i=1; i <= natom; i++)
13 {
14 attached.n13[i] = 0;
15 for (j=0; j < MAXIAT; j++)
16 {
17 jj = atom[i].iat[j];
18 jji = 0;
19 for (mm = 0; mm < MAXIAT; mm++)
20 {
21 if (atom[jj].iat[mm] != 0 && atom[jj].bo[mm] != 9)
22 jji++;
23 }
24
25 if ( atom[jj].type < 300 && jji < 7 )
26 {
27 if (jj != 0 && atom[i].bo[j] != 9)
28 {
29 for(k=0; k < MAXIAT; k++)
30 {
31 kk = atom[jj].iat[k];
32 if (kk != i && kk != 0 && atom[jj].bo[k] != 9)
33 {
34 for (m=0; m < MAXIAT; m++)
35 {
36 if (kk == atom[i].iat[m])
37 break;
38 }
39 attached.i13[attached.n13[i]][i] = kk;
40 attached.n13[i]++;
41 }
42 }
43 }
44 }
45 }
46 }
47 // find 14 relations
48 for (i=1; i <= natom; i++)
49 {
50 attached.n14[i] = 0;
51 for (j=0; j < MAXIAT; j++)
52 {
53 jj = atom[i].iat[j];
54 if (jj != 0 && atom[i].bo[j] != 9 && atom[jj].type < 300)
55 {
56 for(k=0; k < MAXIAT; k++)
57 {
58 kk = atom[jj].iat[k];
59 if (kk != 0 && atom[jj].bo[k] != 9 && atom[kk].type < 300)
60 {
61 for (m = 0; m < MAXIAT; m++)
62 {
63 mm = atom[kk].iat[m];
64 if (mm != i && mm != 0 && atom[kk].bo[m] != 9)
65 {
66 for (p=0; p < MAXIAT; p++)
67 {
68 if (mm == atom[i].iat[p])
69 goto L_20;
70 }
71 for (p=0; p < attached.n13[i]; p++)
72 {
73 if (mm == attached.i13[p][i])
74 goto L_20;
75 }
76 attached.i14[attached.n14[i]][i] = mm;
77 attached.n14[i]++;
78 }
79 L_20:
80 continue;
81 }
82 }
83 }
84 }
85 }
86 }
87 }