1 |
|
#define EXTERN extern |
2 |
|
|
3 |
|
#include "pcwin.h" |
4 |
– |
#include "pcmod.h" |
4 |
|
#include "torsions.h" |
5 |
|
|
6 |
|
int isbond(int, int); |
8 |
– |
void get_torsions(void); |
7 |
|
void message_alert(char *, char *); |
8 |
< |
int is_linear(int); |
8 |
> |
int is_linear(int,int *); |
9 |
> |
int is_allene(int,int,int,int,int *); |
10 |
> |
void max_torsions(int natom,int *type,int **iat,int **bo); |
11 |
> |
void get_torsions(int natom,int *type,int **iat,int **bo); |
12 |
|
|
13 |
|
struct t_allene { |
14 |
|
int nallene, ntor[10]; |
15 |
|
} allene; |
15 |
– |
EXTERN struct t_minim_control { |
16 |
– |
int type, method, field, added_const; |
17 |
– |
char added_path[256],added_name[256]; |
18 |
– |
} minim_control; |
16 |
|
|
17 |
< |
int is_allene(int i, int j, int k, int l) |
17 |
> |
int is_allene(int i, int j, int k, int l,int *type) |
18 |
|
{ |
19 |
< |
if (atom.mmx_type[i] == 2 && atom.mmx_type[j] == 4 && atom.mmx_type[k] == 2) |
19 |
> |
if (type[i] == 2 && type[j] == 4 && type[k] == 2) |
20 |
|
return FALSE; |
21 |
< |
if (atom.mmx_type[j] == 2 && atom.mmx_type[k] == 4 && atom.mmx_type[l] == 2) |
21 |
> |
if (type[j] == 2 && type[k] == 4 && type[l] == 2) |
22 |
|
return FALSE; |
23 |
|
return TRUE; |
24 |
|
} |
25 |
|
// ================================================== |
26 |
< |
int is_linear(int ia) |
26 |
> |
int is_linear(int ia,int *type) |
27 |
|
{ |
28 |
< |
if (atom.mmx_type[ia] == 4 || atom.mmx_type[ia] == 10) |
28 |
> |
if (type[ia] == 4) |
29 |
|
return TRUE; |
30 |
< |
if (atom.mmff_type[ia] == 53) |
30 |
> |
if (type[ia] == 53) |
31 |
|
return TRUE; |
32 |
|
return FALSE; |
33 |
|
} |
34 |
|
// ================================== |
35 |
< |
void get_torsions() |
35 |
> |
void get_torsions(int natom,int *type,int **iat,int **bo) |
36 |
|
{ |
37 |
|
int i, j, k, l,m; |
38 |
|
int ia1, ia2, nRc; |
45 |
|
ia1 = i; |
46 |
|
for(j=0; j< MAXIAT; j++) |
47 |
|
{ |
48 |
< |
if (atom.iat[i][j] != 0 && isbond(i,atom.iat[i][j]) && atom.type[atom.iat[i][j]] < 300 ) |
48 |
> |
if (iat[i][j] != 0 && isbond(i,iat[i][j]) && type[iat[i][j]] < 300 ) |
49 |
|
{ |
50 |
< |
ia2 = atom.iat[i][j]; |
51 |
< |
if (is_linear(ia2) == FALSE) |
50 |
> |
ia2 = iat[i][j]; |
51 |
> |
if (is_linear(ia2,type) == FALSE) |
52 |
|
{ |
53 |
|
for(k=0; k<MAXIAT; k++) |
54 |
|
{ |
55 |
< |
if (atom.iat[ia2][k] != 0 && isbond(atom.iat[i][j],atom.iat[atom.iat[i][j]][k]) && atom.type[atom.iat[i][j]] < 300 ) |
55 |
> |
if (iat[ia2][k] != 0 && isbond(iat[i][j],iat[iat[i][j]][k]) && type[iat[i][j]] < 300 ) |
56 |
|
{ |
57 |
< |
katm = atom.iat[atom.iat[i][j]][k]; |
58 |
< |
if (isbond(ia2,katm) && atom.type[katm] < 300 ) |
57 |
> |
katm = iat[iat[i][j]][k]; |
58 |
> |
if (isbond(ia2,katm) && type[katm] < 300 ) |
59 |
|
{ |
60 |
|
if (i != katm) |
61 |
|
{ |
62 |
|
for(l=0; l<MAXIAT; l++) |
63 |
|
{ |
64 |
< |
if (isbond(katm,atom.iat[katm][l]) && !is_linear(katm) ) |
64 |
> |
if (isbond(katm,iat[katm][l]) && !is_linear(katm,type) ) |
65 |
|
{ |
66 |
< |
latm = atom.iat[katm][l]; |
67 |
< |
nRc = is_allene(i,atom.iat[i][j],katm,latm); |
68 |
< |
if ( (latm != atom.iat[i][j]) && (latm >i) && nRc) |
66 |
> |
latm = iat[katm][l]; |
67 |
> |
nRc = is_allene(i,iat[i][j],katm,latm,type); |
68 |
> |
if ( (latm != iat[i][j]) && (latm >i) && nRc) |
69 |
|
{ |
70 |
|
torsions.i14[torsions.ntor][0] = i; |
71 |
< |
torsions.i14[torsions.ntor][1] = atom.iat[i][j]; |
71 |
> |
torsions.i14[torsions.ntor][1] = iat[i][j]; |
72 |
|
torsions.i14[torsions.ntor][2] = katm; |
73 |
|
torsions.i14[torsions.ntor][3] = latm; |
74 |
|
torsions.ntor++; |
92 |
|
// look for allenes |
93 |
|
for (i=1; i <= natom; i++) |
94 |
|
{ |
95 |
< |
if (atom.mmx_type[i] == 4) |
95 |
> |
if (type[i] == 4) |
96 |
|
{ |
97 |
< |
if (atom.bo[i][0] == 2 && atom.bo[i][1] == 2) // got an cummulene |
97 |
> |
if (bo[i][0] == 2 && bo[i][1] == 2) // got an cummulene |
98 |
|
{ |
99 |
< |
if (atom.mmx_type[atom.iat[i][0]] == 2 && atom.mmx_type[atom.iat[i][1]] == 2) // got an allene |
99 |
> |
if (type[iat[i][0]] == 2 && type[iat[i][1]] == 2) // got an allene |
100 |
|
{ |
101 |
< |
katm = atom.iat[i][0]; |
102 |
< |
latm = atom.iat[i][1]; |
103 |
< |
if (atom.iat[katm][0] == i) |
104 |
< |
{ |
105 |
< |
j = atom.iat[katm][1]; |
106 |
< |
k = atom.iat[katm][2]; |
107 |
< |
}else if (atom.iat[katm][1] == i) |
108 |
< |
{ |
109 |
< |
j = atom.iat[katm][0]; |
110 |
< |
k = atom.iat[katm][2]; |
111 |
< |
}else if (atom.iat[katm][2] == i) |
101 |
> |
katm = iat[i][0]; |
102 |
> |
latm = iat[i][1]; |
103 |
> |
if (iat[katm][0] == i) |
104 |
> |
{ |
105 |
> |
j = iat[katm][1]; |
106 |
> |
k = iat[katm][2]; |
107 |
> |
}else if (iat[katm][1] == i) |
108 |
> |
{ |
109 |
> |
j = iat[katm][0]; |
110 |
> |
k = iat[katm][2]; |
111 |
> |
}else if (iat[katm][2] == i) |
112 |
|
{ |
113 |
< |
j = atom.iat[katm][1]; |
114 |
< |
k = atom.iat[katm][2]; |
113 |
> |
j = iat[katm][1]; |
114 |
> |
k = iat[katm][2]; |
115 |
|
} |
116 |
|
|
117 |
< |
if (atom.iat[latm][0] == i) |
117 |
> |
if (iat[latm][0] == i) |
118 |
|
{ |
119 |
< |
l = atom.iat[latm][1]; |
120 |
< |
m = atom.iat[latm][2]; |
121 |
< |
}else if (atom.iat[katm][1] == i) |
122 |
< |
{ |
123 |
< |
l = atom.iat[latm][0]; |
124 |
< |
m = atom.iat[latm][2]; |
125 |
< |
}else if (atom.iat[katm][2] == i) |
119 |
> |
l = iat[latm][1]; |
120 |
> |
m = iat[latm][2]; |
121 |
> |
}else if (iat[katm][1] == i) |
122 |
> |
{ |
123 |
> |
l = iat[latm][0]; |
124 |
> |
m = iat[latm][2]; |
125 |
> |
}else if (iat[katm][2] == i) |
126 |
|
{ |
127 |
< |
l = atom.iat[latm][1]; |
128 |
< |
m = atom.iat[latm][2]; |
127 |
> |
l = iat[latm][1]; |
128 |
> |
m = iat[latm][2]; |
129 |
|
} |
130 |
|
torsions.i14[torsions.ntor][0] = j; |
131 |
|
torsions.i14[torsions.ntor][1] = katm; |
174 |
|
} |
175 |
|
} |
176 |
|
// ====================================================================== |
177 |
< |
void max_torsions() |
177 |
> |
void max_torsions(int natom,int *type,int **iat,int **bo) |
178 |
|
{ |
179 |
|
int i, j, k, l; |
180 |
|
int ia1, ia2; |
186 |
|
ia1 = i; |
187 |
|
for(j=0; j< MAXIAT; j++) |
188 |
|
{ |
189 |
< |
if (isbond(i,atom.iat[i][j]) ) |
189 |
> |
if (isbond(i,iat[i][j]) ) |
190 |
|
{ |
191 |
< |
ia2 = atom.iat[i][j]; |
191 |
> |
ia2 = iat[i][j]; |
192 |
|
for(k=0; k<MAXIAT; k++) |
193 |
|
{ |
194 |
< |
if (isbond(atom.iat[i][j],atom.iat[atom.iat[i][j]][k]) ) |
194 |
> |
if (isbond(iat[i][j],iat[iat[i][j]][k]) ) |
195 |
|
{ |
196 |
< |
katm = atom.iat[atom.iat[i][j]][k]; |
196 |
> |
katm = iat[iat[i][j]][k]; |
197 |
|
if (i != katm) |
198 |
|
{ |
199 |
|
for(l=0; l<MAXIAT; l++) |
200 |
|
{ |
201 |
< |
if (isbond(katm,atom.iat[katm][l]) ) |
201 |
> |
if (isbond(katm,iat[katm][l]) ) |
202 |
|
{ |
203 |
< |
latm = atom.iat[katm][l]; |
204 |
< |
if ( (latm != atom.iat[i][j]) && (latm >i) ) |
203 |
> |
latm = iat[katm][l]; |
204 |
> |
if ( (latm != iat[i][j]) && (latm >i) ) |
205 |
|
{ |
206 |
|
torsions.ntor++; |
207 |
|
} |
216 |
|
// find allenes |
217 |
|
for (i=0; i <= natom; i++) |
218 |
|
{ |
219 |
< |
if (atom.mmx_type[i] == 4) |
219 |
> |
if (type[i] == 4) |
220 |
|
{ |
221 |
< |
if (atom.bo[i][0] == 2 && atom.bo[i][1] == 2) |
221 |
> |
if (bo[i][0] == 2 && bo[i][1] == 2) |
222 |
|
{ |
223 |
< |
if (atom.mmx_type[atom.iat[i][0]] == 2 && atom.mmx_type[atom.iat[i][1]] == 2) |
223 |
> |
if (type[iat[i][0]] == 2 && type[iat[i][1]] == 2) |
224 |
|
{ |
225 |
|
torsions.ntor += 4; |
226 |
|
} |