1 |
#define EXTERN extern |
2 |
#include "pcwin.h" |
3 |
#include "pcmod.h" |
4 |
#include "utility.h" |
5 |
#include "angles.h" |
6 |
#include "bonds_ff.h" |
7 |
|
8 |
int find_bond(int, int); |
9 |
void numeral(int, char *, int); |
10 |
int get_field(void); |
11 |
void kstrbnd(void); |
12 |
|
13 |
EXTERN struct t_crossterm_k { |
14 |
int nangang, nstrbnd, nstrtor; |
15 |
int ang_ang[MAXAA], stbnindex[MAXSTBN] ; |
16 |
char str_tor[MAXSTRTOR][7], stbn[MAXSTBN][10]; |
17 |
float aacon[MAXAA][3], stbncon[MAXSTBN][3], str_torcon[MAXSTRTOR]; |
18 |
} crossterm_k; |
19 |
|
20 |
struct t_strbnd { |
21 |
int nstrbnd, **isb; |
22 |
float *ksb1, *ksb2; |
23 |
} strbnd; |
24 |
struct stbndat { |
25 |
int irow, krow, lrow; |
26 |
float con1, con2; |
27 |
} stbn[] = |
28 |
{ |
29 |
{ 0, 1, 0, 0.15, 0.15 }, |
30 |
{ 0, 1, 1, 0.10, 0.30 }, |
31 |
{ 0, 1, 2, 0.05, 0.35 }, |
32 |
{ 0, 1, 3, 0.05, 0.35 }, |
33 |
{ 0, 1, 4, 0.05, 0.35 }, |
34 |
{ 0, 2, 0, 0.00, 0.00 }, |
35 |
{ 0, 2, 1, 0.00, 0.15 }, |
36 |
{ 0, 2, 2, 0.00, 0.15 }, |
37 |
{ 0, 2, 3, 0.00, 0.15 }, |
38 |
{ 0, 2, 4, 0.00, 0.15 }, |
39 |
{ 1, 1, 1, 0.30, 0.30 }, |
40 |
{ 1, 1, 2, 0.30, 0.50 }, |
41 |
{ 1, 1, 3, 0.30, 0.50 }, |
42 |
{ 1, 1, 4, 0.30, 0.50 }, |
43 |
{ 2, 1, 2, 0.50, 0.50 }, |
44 |
{ 2, 1, 3, 0.50, 0.50 }, |
45 |
{ 2, 1, 4, 0.50, 0.50 }, |
46 |
{ 3, 1, 3, 0.50, 0.50 }, |
47 |
{ 3, 1, 4, 0.50, 0.50 }, |
48 |
{ 4, 1, 4, 0.50, 0.50 }, |
49 |
{ 1, 2, 1, 0.30, 0.30 }, |
50 |
{ 1, 2, 2, 0.25, 0.25 }, |
51 |
{ 1, 2, 3, 0.25, 0.25 }, |
52 |
{ 1, 2, 4, 0.25, 0.25 }, |
53 |
{ 2, 2, 2, 0.25, 0.25 }, |
54 |
{ 2, 2, 3, 0.25, 0.25 }, |
55 |
{ 2, 2, 4, 0.25, 0.25 }, |
56 |
{ 3, 2, 3, 0.25, 0.25 }, |
57 |
{ 3, 2, 4, 0.25, 0.25 }, |
58 |
{ 4, 2, 4, 0.25, 0.25 }}; |
59 |
|
60 |
EXTERN int Missing_constants; |
61 |
//EXTERN FILE *errfile; |
62 |
|
63 |
void kstrbnd() |
64 |
{ |
65 |
int i, j, iz, nb1, nb2, irow, krow, lrow,field; |
66 |
int ia, ib, ic, itb, ita, itc, ierr; |
67 |
int k, nstbn, index; |
68 |
char pa[4],pb[4],pc[4],pt[10],pt1[10]; |
69 |
|
70 |
index = lrow = krow = irow = 0; |
71 |
strbnd.nstrbnd = 0; |
72 |
strbnd.isb = imatrix(0,MAXANG, 0,3); |
73 |
strbnd.ksb1 = vector(0,MAXANG); |
74 |
strbnd.ksb2 = vector(0,MAXANG); |
75 |
nb1 = -1; |
76 |
nb2 = -1; |
77 |
field = get_field(); |
78 |
for (i=0; i < angles.nang; i++) |
79 |
{ |
80 |
ierr = FALSE; |
81 |
ia = angles.i13[i][0]; |
82 |
ib = angles.i13[i][1]; |
83 |
ic = angles.i13[i][2]; |
84 |
ita = atom.type[ia]; |
85 |
itb = atom.type[ib]; |
86 |
itc = atom.type[ic]; |
87 |
if (field == MMX && (atom.type[ia] >= 300 || atom.type[ib] >= 300 || atom.type[ic] >= 300)) |
88 |
goto L_10; |
89 |
if (field == MMX && (atom.type[ia] >= 20 || atom.type[ic] >= 20)) |
90 |
goto L_10; |
91 |
nstbn = -1; |
92 |
numeral(ita,pa,3); |
93 |
numeral(itb,pb,3); |
94 |
numeral(itc,pc,3); |
95 |
if (ita <= itc) |
96 |
{ |
97 |
strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc); |
98 |
}else |
99 |
{ |
100 |
strcpy(pt,pc); strcat(pt,pb); strcat(pt,pa); |
101 |
} |
102 |
itb = atom.tclass[ib]; |
103 |
numeral(itb,pb,3); |
104 |
strcpy(pt1," 0"); strcat(pt1,pb); strcat(pt1," 0"); |
105 |
for (j=0; j < crossterm_k.nstrbnd; j++) |
106 |
{ |
107 |
if (strcmp(crossterm_k.stbn[j],pt) == 0 || strcmp(crossterm_k.stbn[j],pt1) == 0 ) |
108 |
{ |
109 |
nstbn = j; |
110 |
ierr = TRUE; |
111 |
break; |
112 |
} |
113 |
} |
114 |
for (j=0; j < bonds_ff.nbnd; j++) |
115 |
{ |
116 |
iz = find_bond(ia, ib); |
117 |
if (iz != -1) |
118 |
{ |
119 |
nb1 = iz; |
120 |
break; |
121 |
} |
122 |
} |
123 |
for (j=0; j < bonds_ff.nbnd; j++) |
124 |
{ |
125 |
iz = find_bond(ib, ic); |
126 |
if (iz != -1) |
127 |
{ |
128 |
nb2 = iz; |
129 |
break; |
130 |
} |
131 |
} |
132 |
if (angles.index[i] == 0) |
133 |
index = 0; |
134 |
else if (angles.index[i] == 1) |
135 |
{ |
136 |
if (bonds_ff.index[nb1] == 1) |
137 |
index = 1; |
138 |
else |
139 |
index = 2; |
140 |
} else if (angles.index[i] == 2) |
141 |
index = 3; |
142 |
else if (angles.index[i] == 3) |
143 |
index = 5; |
144 |
else if (angles.index[i] == 4) |
145 |
index = 4; |
146 |
else if (angles.index[i] == 5) |
147 |
{ |
148 |
if (bonds_ff.index[nb1] == 1) |
149 |
index = 6; |
150 |
else |
151 |
index = 7; |
152 |
} else if (angles.index[i] == 6) |
153 |
index = 8; |
154 |
else if (angles.index[i] == 7) |
155 |
{ |
156 |
if (bonds_ff.index[nb1] == 1) |
157 |
index = 9; |
158 |
else |
159 |
index = 10; |
160 |
} else if (angles.index[i] == 8) |
161 |
index = 11; |
162 |
if (crossterm_k.stbnindex[nstbn] != index) |
163 |
nstbn = -1; |
164 |
|
165 |
if (field == MMFF94) |
166 |
{ |
167 |
ierr = TRUE; |
168 |
if (angles.anat[i] < 175.0) |
169 |
{ |
170 |
if (nstbn == -1) // constant not found assign constants base on periodic table |
171 |
{ |
172 |
if (atom.atomnum[ia] <= 1) |
173 |
irow = 0; |
174 |
else if (atom.atomnum[ia] <= 10) |
175 |
irow = 1; |
176 |
else if (atom.atomnum[ia] <= 18) |
177 |
irow = 2; |
178 |
else if (atom.atomnum[ia] <= 36) |
179 |
irow = 3; |
180 |
else if (atom.atomnum[ia] <= 54) |
181 |
irow = 4; |
182 |
|
183 |
if (atom.atomnum[ib] <= 1) |
184 |
krow = 0; |
185 |
else if (atom.atomnum[ib] <= 10) |
186 |
krow = 1; |
187 |
else if (atom.atomnum[ib] <= 18) |
188 |
krow = 2; |
189 |
else if (atom.atomnum[ib] <= 36) |
190 |
krow = 3; |
191 |
else if (atom.atomnum[ib] <= 54) |
192 |
krow = 4; |
193 |
|
194 |
if (atom.atomnum[ic] <= 1) |
195 |
lrow = 0; |
196 |
else if (atom.atomnum[ic] <= 10) |
197 |
lrow = 1; |
198 |
else if (atom.atomnum[ic] <= 18) |
199 |
lrow = 2; |
200 |
else if (atom.atomnum[ic] <= 36) |
201 |
lrow = 3; |
202 |
else if (atom.atomnum[ic] <= 54) |
203 |
lrow = 4; |
204 |
|
205 |
for (j=0; j < 30; j++) |
206 |
{ |
207 |
if ( irow == stbn[j].irow && krow == stbn[j].krow && lrow == stbn[j].lrow ) |
208 |
{ |
209 |
strbnd.isb[strbnd.nstrbnd][0] = i; |
210 |
strbnd.isb[strbnd.nstrbnd][1] = nb1; |
211 |
strbnd.isb[strbnd.nstrbnd][2] = nb2; |
212 |
strbnd.ksb1[strbnd.nstrbnd] = stbn[j].con1; |
213 |
strbnd.ksb2[strbnd.nstrbnd] = stbn[j].con2; |
214 |
strbnd.nstrbnd++; |
215 |
break; |
216 |
} else if (lrow == stbn[j].irow && krow == stbn[j].krow && irow == stbn[j].lrow) |
217 |
{ |
218 |
strbnd.isb[strbnd.nstrbnd][0] = i; |
219 |
strbnd.isb[strbnd.nstrbnd][1] = nb1; |
220 |
strbnd.isb[strbnd.nstrbnd][2] = nb2; |
221 |
strbnd.ksb1[strbnd.nstrbnd] = stbn[j].con2; |
222 |
strbnd.ksb2[strbnd.nstrbnd] = stbn[j].con1; |
223 |
strbnd.nstrbnd++; |
224 |
break; |
225 |
} |
226 |
} |
227 |
}else |
228 |
{ |
229 |
strbnd.isb[strbnd.nstrbnd][0] = i; |
230 |
strbnd.isb[strbnd.nstrbnd][1] = nb1; |
231 |
strbnd.isb[strbnd.nstrbnd][2] = nb2; |
232 |
if (angles.anat[i] > 175.0) |
233 |
{ |
234 |
strbnd.ksb1[strbnd.nstrbnd] = 0.0; |
235 |
strbnd.ksb2[strbnd.nstrbnd] = 0.0; |
236 |
} else |
237 |
{ |
238 |
if (ita < itc) |
239 |
{ |
240 |
strbnd.ksb1[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][0]; |
241 |
strbnd.ksb2[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][1]; |
242 |
} else |
243 |
{ |
244 |
strbnd.ksb1[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][1]; |
245 |
strbnd.ksb2[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][0]; |
246 |
} |
247 |
} |
248 |
strbnd.nstrbnd++; |
249 |
} |
250 |
} |
251 |
} else |
252 |
{ |
253 |
k = 0; |
254 |
if ( atom.atomnum[ia] <= 1) |
255 |
{ |
256 |
k++; |
257 |
if (crossterm_k.stbncon[nstbn][2] == 0.0) |
258 |
nb1 = -1; |
259 |
} |
260 |
if (atom.atomnum[ic] <= 1) |
261 |
{ |
262 |
k++; |
263 |
if (crossterm_k.stbncon[nstbn][2] == 0.0) |
264 |
nb2 = -1; |
265 |
} |
266 |
if (crossterm_k.stbncon[nstbn][k] != 0.0) |
267 |
{ |
268 |
strbnd.isb[strbnd.nstrbnd][0] = i; |
269 |
strbnd.isb[strbnd.nstrbnd][1] = nb1; |
270 |
strbnd.isb[strbnd.nstrbnd][2] = nb2; |
271 |
strbnd.ksb1[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][k]; |
272 |
strbnd.ksb2[strbnd.nstrbnd] = crossterm_k.stbncon[nstbn][k]; |
273 |
strbnd.nstrbnd++; |
274 |
} |
275 |
} |
276 |
// if (ierr == FALSE) |
277 |
// { |
278 |
// Missing_constants = TRUE; |
279 |
// fprintf(errfile,"Missing strbnd constants for %d %d %d \n",ia,ib,ic); |
280 |
// } |
281 |
L_10: |
282 |
continue; |
283 |
} |
284 |
} |
285 |
|
286 |
|