ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/readprm.c
Revision: 48
Committed: Thu Jul 31 16:34:52 2008 UTC (11 years, 8 months ago) by tjod
File size: 118535 byte(s)
Log Message:
Add modification notice to files modified for Freemol
per mengine/smi23d license requirements

Line File contents
1 /* NOTICE: this source code file has been modified for use with FreeMOL */
2 #define EXTERN extern
3
4 #include "pcwin.h"
5 #include "pcmod.h"
6 #include "pot.h"
7 #include "field.h"
8 #include "atom_k.h"
9 #include "pdb.h"
10
11 #define MAXOPLS 600
12
13 FILE * fopen_path ( char * , char * , char * ) ;
14 void zero_data(void);
15 void readpid(char *);
16 void read_datafiles(char *);
17 void readmmxdata(char *);
18 void torphase(int, float *, int *);
19 void read_parameterfile(char **);
20 void numeral(int, char *, int);
21 void message_alert(char *, char *);
22 int FetchRecord(FILE *, char *);
23 void read_added_const(void);
24 int check_dipoleconst(int,int,float);
25 int check_torsionconst(int,int,int,int,float,float,float,int,int,int);
26 int check_torsion4const(int,int,int,int,float,float,float,int,int,int);
27 int check_torsion5const(int,int,int,int,float,float,float,int,int,int);
28 int check_angleconst(int,int,int,float,float,float,float);
29 int check_angle5const(int,int,int,float,float,float,float);
30 int check_angle4const(int,int,int,float,float,float,float);
31 int check_angle3const(int,int,int,float,float,float,float);
32 int check_bondconst(int,int,float,float);
33 int check_bond5const(int,int,float,float);
34 int check_bond4const(int,int,float,float);
35 int check_bond3const(int,int,float,float);
36 int check_opbend(int,int,int,int,float);
37 int check_strbnd(int,int,int,float,float,float);
38 int check_vdwpr(int,int,float,float);
39
40 EXTERN struct t_minim_control {
41 int type, method, field, added_const;
42 char added_path[256],added_name[256];
43 } minim_control;
44 EXTERN struct t_minim_values {
45 int iprint, ndc, nconst;
46 float dielc;
47 } minim_values;
48
49 struct t_units {
50 double bndunit, cbnd, qbnd;
51 double angunit, cang, qang, pang, sang, aaunit;
52 double stbnunit, ureyunit, torsunit, storunit, v14scale;
53 double aterm, bterm, cterm, dielec, chgscale;
54 } units;
55
56 struct t_bondk1 {
57 int use_ring3, use_ring4, use_ring5;
58 int nbnd, nbnd3, nbnd4, nbnd5, ndeloc;
59 char kb[MAXBONDCONST][7], kb3[MAXBOND3CONST][7],kb4[MAXBOND4CONST][7],kb5[MAXBOND5CONST][7];
60 char kbdel[MAXBONDDELOC][7];
61 float s[MAXBONDCONST], t[MAXBONDCONST];
62 float s3[MAXBOND3CONST], t3[MAXBOND3CONST];
63 float s4[MAXBOND4CONST], t4[MAXBOND4CONST];
64 float s5[MAXBOND5CONST], t5[MAXBOND5CONST];
65 float sdel[MAXBONDDELOC], tdel[MAXBONDDELOC];
66 } bondk1;
67
68 struct t_electroneg {
69 int nelecti, nelectj;
70 int itype[200],ibond[200],iattach[200];
71 int jtype[200],jbond[200],jattach[200];
72 float icorr[200],jcorr[200];
73 } electroneg;
74
75 struct t_piatomk {
76 int npiatom;
77 int kat[MAXPIATOM], qp[MAXPIATOM];
78 float q[MAXPIATOM], ion[MAXPIATOM], emz[MAXPIATOM], zor[MAXPIATOM], zz[MAXPIATOM];
79 float w1[MAXPIATOM], w2[MAXPIATOM], w3[MAXPIATOM];
80 } piatomk;
81
82 struct t_bondpk {
83 int npibond,npibond44i,npibond45i,npibond46i,npibond55i,npibond56i,npibond66i;
84 int npibond44o,npibond45o,npibond46o,npibond55o,npibond56o,npibond66o;
85 int npibond40,npibond50,npibond60;
86 int use_pibond,use_pibond44i,use_pibond45i,use_pibond46i,use_pibond55i,use_pibond56i,use_pibond66i;
87 int use_pibond44o,use_pibond45o,use_pibond46o,use_pibond55o,use_pibond56o,use_pibond66o;
88 int use_pibond40,use_pibond50,use_pibond60;
89 char kb[MAXPIBONDCONST][7],kb44i[20][7],kb45i[20][7],kb46i[20][7],kb55i[20][7],kb56i[20][7],kb66i[20][7];
90 char kb44o[20][7],kb45o[20][7],kb46o[20][7],kb55o[20][7],kb56o[20][7],kb66o[20][7];
91 char kb40[20][7],kb50[20][7],kb60[20][7];
92 float bk[MAXPIBONDCONST], bl[MAXPIBONDCONST], bmom[MAXPIBONDCONST],sslop[MAXPIBONDCONST], tslop[MAXPIBONDCONST], tslop2[MAXPIBONDCONST];
93 float bk44i[20], bl44i[20], bmom44i[20],sslop44i[20], tslop44i[20], tslop244i[20];
94 float bk45i[20], bl45i[20], bmom45i[20],sslop45i[20], tslop45i[20], tslop245i[20];
95 float bk46i[20], bl46i[20], bmom46i[20],sslop46i[20], tslop46i[20], tslop246i[20];
96 float bk55i[20], bl55i[20], bmom55i[20],sslop55i[20], tslop55i[20], tslop255i[20];
97 float bk56i[20], bl56i[20], bmom56i[20],sslop56i[20], tslop56i[20], tslop256i[20];
98 float bk66i[20], bl66i[20], bmom66i[20],sslop66i[20], tslop66i[20], tslop266i[20];
99 float bk44o[20], bl44o[20], bmom44o[20],sslop44o[20], tslop44o[20], tslop244o[20];
100 float bk45o[20], bl45o[20], bmom45o[20],sslop45o[20], tslop45o[20], tslop245o[20];
101 float bk46o[20], bl46o[20], bmom46o[20],sslop46o[20], tslop46o[20], tslop246o[20];
102 float bk55o[20], bl55o[20], bmom55o[20],sslop55o[20], tslop55o[20], tslop255o[20];
103 float bk56o[20], bl56o[20], bmom56o[20],sslop56o[20], tslop56o[20], tslop256o[20];
104 float bk66o[20], bl66o[20], bmom66o[20],sslop66o[20], tslop66o[20], tslop266o[20];
105 float bk40[20], bl40[20], bmom40[20],sslop40[20], tslop40[20], tslop240[20];
106 float bk50[20], bl50[20], bmom50[20],sslop50[20], tslop50[20], tslop250[20];
107 float bk60[20], bl60[20], bmom60[20],sslop60[20], tslop60[20], tslop260[20];
108 } bondpk;
109
110 struct t_picorrect {
111 float fudge1, fudge2, fudge3, fudge4, beta_fudgef,beta_fudgeh;
112 } picorrect;
113
114 struct t_angk1 {
115 int use_ang3, use_ang4, use_ang5;
116 int nang, nang3, nang4, nang5;
117 int ndel, ndel3, ndel4;
118 char ktype[MAXANGCONST][10],ktype3[MAXANG3CONST][10],ktype4[MAXANG4CONST][10],ktype5[MAXANG5CONST][10];
119 char kdel[MAXANGDEL][10],kdel3[MAXANG3DEL][10],kdel4[MAXANG4DEL][10];
120 float con[MAXANGCONST], ang[MAXANGCONST][3];
121 float con3[MAXANG3CONST], ang3[MAXANG3CONST][3];
122 float con4[MAXANG4CONST], ang4[MAXANG4CONST][3];
123 float con5[MAXANG5CONST], ang5[MAXANG5CONST][3];
124 float condel[MAXANGDEL], angdel[MAXANGDEL][3];
125 float condel3[MAXANG3DEL], angdel3[MAXANG3DEL][3];
126 float condel4[MAXANG4DEL], angdel4[MAXANG4DEL][3];
127 } angk1;
128
129 struct t_angkp1 {
130 int npiang;
131 char kpa[MAXPIANGCONST][10];
132 float pacon[MAXPIANGCONST], panat[MAXPIANGCONST][3], piobp[MAXPIANGCONST];
133 } angkp1;
134
135 struct t_angf {
136 int use_angf, nfang;
137 char kftype[MAXANGCONST][10];
138 float fcon[MAXANGCONST],fc0[MAXANGCONST],fc1[MAXANGCONST],fc2[MAXANGCONST];
139 float fc3[MAXANGCONST],fc4[MAXANGCONST],fc5[MAXANGCONST],fc6[MAXANGCONST];
140 } angf;
141
142 struct t_ureybrad_k {
143 int nurey_brad;
144 char kubang[MAXUREY][10];
145 float ubconst[MAXUREY],ubdist[MAXUREY];
146 } ureybrad_k;
147
148 struct t_crossterm_k {
149 int nangang, nstrbnd, nstrtor;
150 int ang_ang[MAXAA], stbnindex[MAXSTBN] ;
151 char str_tor[MAXSTRTOR][7], stbn[MAXSTBN][10];
152 float aacon[MAXAA][3], stbncon[MAXSTBN][3], str_torcon[MAXSTRTOR];
153 } crossterm_k;
154
155 struct t_ooplane_k {
156 int nopbend;
157 char iopb[MAXOOP][13];
158 float copb[MAXOOP];
159 } ooplane_k;
160
161 struct t_improptor_k {
162 int nimptor, nimprop;
163 char kv[MAXIMP][13];
164 float cimptor[MAXIMP], tdi[MAXIMP];
165 float v1[MAXIMP], v2[MAXIMP], v3[MAXIMP];
166 int ph1[MAXIMP], ph2[MAXIMP], ph3[MAXIMP];
167 } improptor_k;
168
169 struct t_torkn1 {
170 int use_tor4, use_tor5;
171 int ntor, ntor4, ntor5, ntordel, torindex[MAXTORDEL];
172 char kv[MAXTORCONST][13], kv4[MAXTOR4CONST][13], kv5[MAXTOR5CONST][13];
173 char kvdel[MAXTORDEL][13];
174 float tv1[MAXTORCONST], tv2[MAXTORCONST], tv3[MAXTORCONST];
175 float tv4[MAXTORCONST], tv5[MAXTORCONST], tv6[MAXTORCONST];
176 int phase1[MAXTORCONST], phase2[MAXTORCONST], phase3[MAXTORCONST];
177 int phase4[MAXTORCONST], phase5[MAXTORCONST], phase6[MAXTORCONST];
178 float tv41[MAXTOR4CONST], tv42[MAXTOR4CONST], tv43[MAXTOR4CONST];
179 int phase41[MAXTOR4CONST], phase42[MAXTOR4CONST], phase43[MAXTOR4CONST];
180 float tv51[MAXTOR5CONST], tv52[MAXTOR5CONST], tv53[MAXTOR5CONST];
181 int phase51[MAXTOR5CONST], phase52[MAXTOR5CONST], phase53[MAXTOR5CONST];
182 float tvdel1[MAXTORDEL], tvdel2[MAXTORDEL], tvdel3[MAXTORDEL];
183 int phasedel1[MAXTORDEL], phasedel2[MAXTORDEL], phasedel3[MAXTORDEL];
184 } torkn1;
185
186 struct t_torknp {
187 int npitor;
188 char kv[MAXPITORCONST][13];
189 int ph1[MAXPITORCONST], ph2[MAXPITORCONST], ph3[MAXPITORCONST];
190 float tv1[MAXPITORCONST], tv2[MAXPITORCONST], tv3[MAXPITORCONST];
191 } torknp;
192
193 struct t_vdw1 {
194 int nvdw;
195 float rad[MAXVDWCONST], eps[MAXVDWCONST];
196 int lpd[MAXVDWCONST], ihtyp[MAXVDWCONST], ihdon[MAXVDWCONST];
197 float alpha[MAXVDWCONST],n[MAXVDWCONST],a[MAXVDWCONST],g[MAXVDWCONST];
198 char da[MAXVDWCONST][2];
199 } vdw1;
200
201 struct t_vdwpr_k {
202 int nvdwpr;
203 int ia1[MAXBONDCONST],ia2[MAXBONDCONST];
204 char kv[MAXBONDCONST][7];
205 float radius[MAXBONDCONST], eps[MAXBONDCONST];
206 } vdwpr_k;
207
208 struct t_charge_k {
209 int ncharge, nbndchrg, nbndchrgdel;
210 int type[MAXATOMTYPE], btype[MAXBONDCONST], btypedel[MAXBONDCONST];
211 float charge[MAXATOMTYPE], bcharge[MAXBONDCONST], formchrg[MAXATOMTYPE], bchargedel[MAXBONDCONST];
212 float typechrg[MAXATOMTYPE];
213 } charge_k;
214
215 struct t_amberchrg_k {
216 int ncharge, type[MAXATOMTYPE], res_type[MAXATOMTYPE];
217 char symbol[MAXATOMTYPE][4];
218 float chrg[MAXATOMTYPE];
219 } amberchrg_k;
220
221 struct t_oplschrg_k {
222 int ncharge, type[MAXOPLS];
223 char chrgstring[MAXOPLS][25];
224 float chrg[MAXOPLS];
225 } oplschrg_k;
226
227 struct t_dipole_k {
228 int ndipole,ndipole3,ndipole4,ndipole5;
229 char kb[MAXBONDCONST][7], kb3[MAXBOND3CONST][7], kb4[MAXBOND4CONST][7], kb5[MAXBOND5CONST][7];
230 float bmom[MAXBONDCONST],bmom3[MAXBOND3CONST],bmom4[MAXBOND4CONST],bmom5[MAXBOND5CONST];
231 } dipole_k;
232
233 struct t_ehpara {
234 int neheat, nevhf;
235 int nn[220];
236 float ee[220], estr[220], et[220]; // bond data
237 char cc[220][21], mm[155][21];
238 int cent[155];
239 char kheat[155][13];
240 float ss[155], ssless[155]; // structural data
241 } ehpara;
242
243 struct t_epiheat {
244 int npihf;
245 int nnp[125];
246 float eep[125], aa[125], bb[125], ccc[125];
247 char ccp[125][21];} epiheat;
248
249 struct t_metaldata {
250 int nmetal, type[200];
251 char name[200][3];
252 float radius[200], eps[200];
253 } metaldata;
254
255 EXTERN struct t_user {
256 int dielec;
257 } user;
258
259 void zero_data()
260 {
261 int ii,j;
262
263 bondk1.use_ring3 = FALSE;
264 bondk1.use_ring4 = FALSE;
265 bondk1.use_ring5 = FALSE;
266 bondpk.use_pibond = FALSE;
267 bondpk.use_pibond44i = FALSE;
268 bondpk.use_pibond45i = FALSE;
269 bondpk.use_pibond46i = FALSE;
270 bondpk.use_pibond55i = FALSE;
271 bondpk.use_pibond56i = FALSE;
272 bondpk.use_pibond66i = FALSE;
273 bondpk.use_pibond44o = FALSE;
274 bondpk.use_pibond45o = FALSE;
275 bondpk.use_pibond46o = FALSE;
276 bondpk.use_pibond55o = FALSE;
277 bondpk.use_pibond56o = FALSE;
278 bondpk.use_pibond66o = FALSE;
279 bondpk.use_pibond40 = FALSE;
280 bondpk.use_pibond50 = FALSE;
281 bondpk.use_pibond60 = FALSE;
282
283 angk1.use_ang3 = FALSE;
284 angk1.use_ang4 = FALSE;
285 angk1.use_ang5 = FALSE;
286 angf.use_angf = FALSE;
287
288 torkn1.use_tor4 = FALSE;
289 torkn1.use_tor5 = FALSE;
290
291 units.bndunit = 1.0;
292 units.cbnd = 0.0;
293 units.qbnd = 0.0;
294 units.angunit = 1.0 / (radian*radian);
295 units.cang = 0.0;
296 units.qang = 0.0;
297 units.pang = 0.0;
298 units.sang = 0.0;
299 units.aaunit = 1.0 / (radian*radian);
300 units.stbnunit = 1.0;
301 units.ureyunit = 1.0;
302 units.torsunit = 1.0;
303 units.storunit = 1.0;
304 units.v14scale = 1.0;
305 units.aterm = 0.0;
306 units.bterm = 0.0;
307 units.cterm = 0.0;
308 // units.dielec = 1.0;
309 units.chgscale = 1.0;
310 // atom type constants
311 atom_k.natomtype = 0;
312 charge_k.ncharge = 0;
313 charge_k.nbndchrg = 0;
314 charge_k.nbndchrgdel = 0;
315 amberchrg_k.ncharge = 0;
316 oplschrg_k.ncharge = 0;
317 for (ii = 0; ii < MAXATOMTYPE; ii ++)
318 {
319 atom_k.type[ii]= 0;
320 atom_k.valency[ii]= 0;
321 atom_k.tclass[ii] = 0;
322 atom_k.tclass1[ii] = 0;
323 atom_k.tclass2[ii] = 0;
324 atom_k.number[ii] = 0;
325 atom_k.ligands[ii] = 0;
326 atom_k.weight[ii] = 0.00F;
327 strcpy(atom_k.symbol[ii]," ");
328 strcpy(atom_k.description[ii]," ");
329 charge_k.type[ii] = 0;
330 charge_k.charge[ii] = 0.00F;
331 charge_k.formchrg[ii] = 0.00F;
332 charge_k.typechrg[ii] = 0.00F;
333 amberchrg_k.type[ii] = 0;
334 amberchrg_k.res_type[ii] = 0;
335 amberchrg_k.chrg[ii] = 0.0;
336 strcpy(amberchrg_k.symbol[ii]," ");
337 }
338 for (ii = 0; ii < MAXOPLS; ii++)
339 {
340 oplschrg_k.type[ii] = 0;
341 oplschrg_k.chrg[ii] = 0.0;
342 strcpy(oplschrg_k.chrgstring[ii]," ");
343 }
344 // metals
345 metaldata.nmetal = 0;
346 for (ii = 0; ii < 200; ii++)
347 {
348 metaldata.type[ii] = 0;
349 metaldata.radius[ii] = 0.0;
350 metaldata.eps[ii] = 0.0;
351 strcpy(metaldata.name[ii]," ");
352 }
353 // bond constant data
354 bondk1.nbnd = 0;
355 vdwpr_k.nvdwpr = 0;
356 dipole_k.ndipole = 0;
357 electroneg.nelecti = 0;
358 electroneg.nelectj = 0;
359
360 for( ii = 0; ii < MAXBONDCONST; ii++ )
361 {
362 strcpy(bondk1.kb[ii]," ");
363 bondk1.s[ii] = 0.;
364 bondk1.t[ii] = 0.;
365 strcpy(vdwpr_k.kv[ii]," ");
366 vdwpr_k.ia1[ii] = 0;
367 vdwpr_k.ia2[ii] = 0;
368 vdwpr_k.radius[ii] = 0.0;
369 vdwpr_k.eps[ii] = 0.0;
370 strcpy(dipole_k.kb[ii]," ");
371 dipole_k.bmom[ii] = 0.;
372 charge_k.btype[ii] = 0;
373 charge_k.bcharge[ii] = 0.0;
374 charge_k.btypedel[ii] = 0;
375 charge_k.bchargedel[ii] = 0.0;
376 }
377 // bond 3 constant
378 bondk1.nbnd3 = 0;
379 dipole_k.ndipole3 = 0;
380 for( ii = 0; ii < MAXBOND3CONST; ii++ )
381 {
382 strcpy(bondk1.kb3[ii]," ");
383 bondk1.s3[ii] = 0.;
384 bondk1.t3[ii] = 0.;
385 strcpy(dipole_k.kb3[ii]," ");
386 dipole_k.bmom3[ii] = 0.;
387 }
388 // bond 4 constant
389 bondk1.nbnd4 = 0;
390 dipole_k.ndipole4 = 0;
391 for( ii = 0; ii < MAXBOND4CONST; ii++ )
392 {
393 strcpy(bondk1.kb4[ii]," ");
394 bondk1.s4[ii] = 0.;
395 bondk1.t4[ii] = 0.;
396 strcpy(dipole_k.kb4[ii]," ");
397 dipole_k.bmom4[ii] = 0.;
398 }
399 // bond 5 constant
400 bondk1.nbnd5 = 0;
401 dipole_k.ndipole5 = 0;
402 for( ii = 0; ii < MAXBOND5CONST; ii++ )
403 {
404 strcpy(bondk1.kb5[ii]," ");
405 bondk1.s5[ii] = 0.;
406 bondk1.t5[ii] = 0.;
407 strcpy(dipole_k.kb5[ii]," ");
408 dipole_k.bmom5[ii] = 0.;
409 }
410 // deloc bond constant
411 bondk1.ndeloc = 0;
412 for( ii = 0; ii < MAXBONDDELOC; ii++ )
413 {
414 strcpy(bondk1.kbdel[ii]," ");
415 bondk1.sdel[ii] = 0.;
416 bondk1.tdel[ii] = 0.;
417 }
418 // VDW constants
419 vdw1.nvdw = 0;
420 for( ii = 0; ii < MAXVDWCONST; ii++ )
421 {
422 vdw1.rad[ii] = 0.;
423 vdw1.eps[ii] = 0.;
424 vdw1.lpd[ii] = 0;
425 vdw1.ihtyp[ii] = 0;
426 vdw1.ihdon[ii] = 0;
427 vdw1.alpha[ii] = 0.0;
428 vdw1.n[ii] = 0.0;
429 vdw1.a[ii] = 0.0;
430 vdw1.g[ii] = 0.0;
431 strcpy(vdw1.da[ii]," ");
432 }
433 // torsion
434 torkn1.ntor = 0;
435 for( ii = 0; ii < MAXTORCONST; ii++ )
436 {
437 strcpy(torkn1.kv[ii]," ");
438 torkn1.tv1[ii] = 0.;
439 torkn1.tv2[ii] = 0.;
440 torkn1.tv3[ii] = 0.;
441 torkn1.tv4[ii] = 0.;
442 torkn1.tv5[ii] = 0.;
443 torkn1.tv6[ii] = 0.;
444 torkn1.phase1[ii] = torkn1.phase2[ii] = torkn1.phase3[ii] = 0;
445 torkn1.phase4[ii] = torkn1.phase5[ii] = torkn1.phase6[ii] = 0;
446 }
447 // torsion 4
448 torkn1.ntor4 = 0;
449 for( ii = 0; ii < MAXTOR4CONST; ii++ )
450 {
451 strcpy(torkn1.kv4[ii]," ");
452 torkn1.tv41[ii] = 0.;
453 torkn1.tv42[ii] = 0.;
454 torkn1.tv43[ii] = 0.;
455 torkn1.phase41[ii] = torkn1.phase42[ii] = torkn1.phase43[ii] = 0;
456 }
457 // torsion 5
458 torkn1.ntor5 = 0;
459 for( ii = 0; ii < MAXTOR5CONST; ii++ )
460 {
461 strcpy(torkn1.kv5[ii]," ");
462 torkn1.tv51[ii] = 0.;
463 torkn1.tv52[ii] = 0.;
464 torkn1.tv53[ii] = 0.;
465 torkn1.phase51[ii] = torkn1.phase52[ii] = torkn1.phase53[ii] = 0;
466 }
467 // torsion delocalized
468 torkn1.ntordel = 0;
469 for( ii = 0; ii < MAXTORDEL; ii++ )
470 {
471 strcpy(torkn1.kvdel[ii]," ");
472 torkn1.torindex[ii] = 0;
473 torkn1.tvdel1[ii] = 0.;
474 torkn1.tvdel2[ii] = 0.;
475 torkn1.tvdel3[ii] = 0.;
476 torkn1.phasedel1[ii] = torkn1.phasedel2[ii] = torkn1.phasedel3[ii] = 0;
477 }
478 // fourier angles
479 angf.nfang = 0;
480 for (ii=0; ii < MAXANGCONST; ii++ )
481 {
482 strcpy(angf.kftype[ii]," ");
483 angf.fcon[ii] = 0.0;
484 angf.fc0[ii] = 0.0;
485 angf.fc1[ii] = 0.0;
486 angf.fc2[ii] = 0.0;
487 angf.fc3[ii] = 0.0;
488 angf.fc4[ii] = 0.0;
489 angf.fc5[ii] = 0.0;
490 angf.fc6[ii] = 0.0;
491 }
492 // angle
493 angk1.nang = 0;
494 for( ii = 0; ii < MAXANGCONST; ii++ )
495 {
496 strcpy(angk1.ktype[ii]," ");
497 angk1.con[ii] = 0.;
498 for( j = 0; j < 3; j++ )
499 angk1.ang[ii][j] = 0.;
500 }
501 // angle 3
502 angk1.nang3 = 0;
503 for( ii = 0; ii < MAXANG3CONST; ii++ )
504 {
505 strcpy(angk1.ktype3[ii]," ");
506 angk1.con3[ii] = 0.;
507 for( j = 0; j < 3; j++ )
508 angk1.ang3[ii][j] = 0.;
509 }
510 // angle 4
511 angk1.nang4 = 0;
512 for( ii = 0; ii < MAXANG4CONST; ii++ )
513 {
514 strcpy(angk1.ktype4[ii]," ");
515 angk1.con4[ii] = 0.;
516 for( j = 0; j < 3; j++ )
517 angk1.ang4[ii][j] = 0.;
518 }
519 // angle 5
520 angk1.nang5 = 0;
521 for( ii = 0; ii < MAXANG5CONST; ii++ )
522 {
523 strcpy(angk1.ktype5[ii]," ");
524 angk1.con5[ii] = 0.;
525 for( j = 0; j < 3; j++ )
526 angk1.ang5[ii][j] = 0.;
527 }
528 // angle delocalized
529 angk1.ndel = 0;
530 for( ii = 0; ii < MAXANGDEL; ii++ )
531 {
532 strcpy(angk1.kdel[ii]," ");
533 angk1.condel[ii] = 0.;
534 for( j = 0; j < 3; j++ )
535 angk1.angdel[ii][j] = 0.;
536 }
537 // angle3 delocalized
538 angk1.ndel3 = 0;
539 for( ii = 0; ii < MAXANG3DEL; ii++ )
540 {
541 strcpy(angk1.kdel3[ii]," ");
542 angk1.condel3[ii] = 0.;
543 for( j = 0; j < 3; j++ )
544 angk1.angdel3[ii][j] = 0.;
545 }
546 // angle4 delocalized
547 angk1.ndel4 = 0;
548 for( ii = 0; ii < MAXANG4DEL; ii++ )
549 {
550 strcpy(angk1.kdel4[ii]," ");
551 angk1.condel4[ii] = 0.;
552 for( j = 0; j < 3; j++ )
553 angk1.angdel4[ii][j] = 0.;
554 }
555 // urey bradley
556 ureybrad_k.nurey_brad = 0;
557 for (ii = 0; ii < MAXUREY; ii++)
558 {
559 strcpy(ureybrad_k.kubang[ii]," ");
560 ureybrad_k.ubconst[ii] = 0.0;
561 ureybrad_k.ubdist[ii] = 0.0;
562 }
563 // out of plane
564 ooplane_k.nopbend = 0;
565 for( ii = 0; ii < MAXOOP; ii++ )
566 {
567 strcpy(ooplane_k.iopb[ii]," ");
568 ooplane_k.copb[ii] = 0.;
569 }
570 // improper torsions
571 improptor_k.nimptor = 0;
572 improptor_k.nimprop = 0;
573 for( ii = 0; ii < MAXIMP; ii++ )
574 {
575 strcpy(improptor_k.kv[ii]," ");
576 improptor_k.cimptor[ii] = 0.;
577 improptor_k.tdi[ii] = 0.;
578 improptor_k.v1[ii] = 0.0;
579 improptor_k.v2[ii] = 0.0;
580 improptor_k.v3[ii] = 0.0;
581 improptor_k.ph1[ii] = 0;
582 improptor_k.ph2[ii] = 0;
583 improptor_k.ph3[ii] = 0;
584 }
585 // cross terms
586 crossterm_k.nangang = 0;
587 crossterm_k.nstrbnd = 0;
588 crossterm_k.nstrtor = 0;
589 for (ii = 0; ii < MAXAA; ii++)
590 {
591 crossterm_k.ang_ang[ii] = 0;
592 crossterm_k.aacon[ii][0] = 0.0;
593 crossterm_k.aacon[ii][1] = 0.0;
594 crossterm_k.aacon[ii][2] = 0.0;
595 }
596 for (ii = 0; ii < MAXSTBN; ii++)
597 {
598 strcpy(crossterm_k.stbn[ii]," ");
599 crossterm_k.stbnindex[ii] = 0;
600 crossterm_k.stbncon[ii][0] = 0.0;
601 crossterm_k.stbncon[ii][1] = 0.0;
602 crossterm_k.stbncon[ii][2] = 0.0;
603 }
604 for (ii = 0; ii < MAXSTRTOR; ii++)
605 {
606 strcpy(crossterm_k.str_tor[ii]," ");
607 crossterm_k.str_torcon[ii] = 0.0;
608 }
609
610
611 // heat parameters
612 ehpara.neheat = 0;
613 ehpara.nevhf = 0;
614 for( ii = 0; ii < 220; ii++ )
615 {
616 ehpara.nn[ii] = 0;
617 ehpara.ee[ii] = 0.;
618 ehpara.estr[ii] = 0.;
619 ehpara.et[ii] = 0.;
620 strcpy( ehpara.cc[ii], " " );
621 }
622 for( ii = 0; ii < 155; ii++ )
623 {
624 strcpy( ehpara.mm[ii], " " );
625 strcpy( ehpara.kheat[ii], " " );
626 ehpara.ss[ii] = 0.;
627 ehpara.ssless[ii] = 0.;
628 ehpara.cent[ii] = 0;
629 }
630 // pi heat parameters
631 epiheat.npihf = 0;
632 for( ii = 0; ii < 125; ii++ )
633 {
634 epiheat.nnp[ii] = 0;
635 epiheat.eep[ii] = 0.;
636 epiheat.aa[ii] = 0.;
637 epiheat.bb[ii] = 0.;
638 epiheat.ccc[ii] = 0.;
639 strcpy( epiheat.ccp[ii], " " );
640 }
641 // pi atom data
642 piatomk.npiatom = 0;
643 for (ii=0; ii < MAXPIATOM; ii++)
644 {
645 piatomk.kat[ii] = 0;
646 piatomk.qp[ii] = 0;
647 piatomk.q[ii] = 0.0;
648 piatomk.ion[ii] = 0.0;
649 piatomk.emz[ii] = 0.0;
650 piatomk.zor[ii] = 0.0;
651 piatomk.zz[ii] = 0.0;
652 piatomk.w1[ii] = 0.0;
653 piatomk.w2[ii] = 0.0;
654 piatomk.w3[ii] = 0.0;
655 }
656 // pi bond constants
657 bondpk.npibond = 0;
658 bondpk.npibond44i = 0;
659 bondpk.npibond45i = 0;
660 bondpk.npibond46i = 0;
661 bondpk.npibond55i = 0;
662 bondpk.npibond56i = 0;
663 bondpk.npibond66i = 0;
664 bondpk.npibond44o = 0;
665 bondpk.npibond45o = 0;
666 bondpk.npibond46o = 0;
667 bondpk.npibond55o = 0;
668 bondpk.npibond56o = 0;
669 bondpk.npibond66o = 0;
670 bondpk.npibond40 = 0;
671 bondpk.npibond50 = 0;
672 bondpk.npibond60 = 0;
673 for (ii = 0; ii < 20; ii++)
674 {
675 strcpy(bondpk.kb44i[ii]," ");
676 strcpy(bondpk.kb45i[ii]," ");
677 strcpy(bondpk.kb46i[ii]," ");
678 strcpy(bondpk.kb55i[ii]," ");
679 strcpy(bondpk.kb56i[ii]," ");
680 strcpy(bondpk.kb66i[ii]," ");
681 strcpy(bondpk.kb44o[ii]," ");
682 strcpy(bondpk.kb45o[ii]," ");
683 strcpy(bondpk.kb46o[ii]," ");
684 strcpy(bondpk.kb55o[ii]," ");
685 strcpy(bondpk.kb56o[ii]," ");
686 strcpy(bondpk.kb66o[ii]," ");
687 strcpy(bondpk.kb40[ii]," ");
688 strcpy(bondpk.kb50[ii]," ");
689 strcpy(bondpk.kb60[ii]," ");
690
691 bondpk.bk44i[ii] = 0.0;
692 bondpk.bl44i[ii] = 0.0;
693 bondpk.bmom44i[ii] = 0.0;
694 bondpk.sslop44i[ii] = 0.0;
695 bondpk.tslop44i[ii] = 0.0;
696 bondpk.tslop244i[ii] = 0.0;
697 bondpk.bk45i[ii] = 0.0;
698 bondpk.bl45i[ii] = 0.0;
699 bondpk.bmom45i[ii] = 0.0;
700 bondpk.sslop45i[ii] = 0.0;
701 bondpk.tslop45i[ii] = 0.0;
702 bondpk.tslop245i[ii] = 0.0;
703 bondpk.bk46i[ii] = 0.0;
704 bondpk.bl46i[ii] = 0.0;
705 bondpk.bmom46i[ii] = 0.0;
706 bondpk.sslop46i[ii] = 0.0;
707 bondpk.tslop46i[ii] = 0.0;
708 bondpk.tslop246i[ii] = 0.0;
709 bondpk.bk55i[ii] = 0.0;
710 bondpk.bl55i[ii] = 0.0;
711 bondpk.bmom55i[ii] = 0.0;
712 bondpk.sslop55i[ii] = 0.0;
713 bondpk.tslop55i[ii] = 0.0;
714 bondpk.tslop255i[ii] = 0.0;
715 bondpk.bk56i[ii] = 0.0;
716 bondpk.bl56i[ii] = 0.0;
717 bondpk.bmom56i[ii] = 0.0;
718 bondpk.sslop56i[ii] = 0.0;
719 bondpk.tslop56i[ii] = 0.0;
720 bondpk.tslop256i[ii] = 0.0;
721 bondpk.bk66i[ii] = 0.0;
722 bondpk.bl66i[ii] = 0.0;
723 bondpk.bmom66i[ii] = 0.0;
724 bondpk.sslop66i[ii] = 0.0;
725 bondpk.tslop66i[ii] = 0.0;
726 bondpk.tslop266i[ii] = 0.0;
727 bondpk.bk44o[ii] = 0.0;
728 bondpk.bl44o[ii] = 0.0;
729 bondpk.bmom44o[ii] = 0.0;
730 bondpk.sslop44o[ii] = 0.0;
731 bondpk.tslop44o[ii] = 0.0;
732 bondpk.tslop244o[ii] = 0.0;
733 bondpk.bk45o[ii] = 0.0;
734 bondpk.bl45o[ii] = 0.0;
735 bondpk.bmom45o[ii] = 0.0;
736 bondpk.sslop45o[ii] = 0.0;
737 bondpk.tslop45o[ii] = 0.0;
738 bondpk.tslop245o[ii] = 0.0;
739 bondpk.bk46o[ii] = 0.0;
740 bondpk.bl46o[ii] = 0.0;
741 bondpk.bmom46o[ii] = 0.0;
742 bondpk.sslop46o[ii] = 0.0;
743 bondpk.tslop46o[ii] = 0.0;
744 bondpk.tslop246o[ii] = 0.0;
745 bondpk.bk55o[ii] = 0.0;
746 bondpk.bl55o[ii] = 0.0;
747 bondpk.bmom55o[ii] = 0.0;
748 bondpk.sslop55o[ii] = 0.0;
749 bondpk.tslop55o[ii] = 0.0;
750 bondpk.tslop255o[ii] = 0.0;
751 bondpk.bk56o[ii] = 0.0;
752 bondpk.bl56o[ii] = 0.0;
753 bondpk.bmom56o[ii] = 0.0;
754 bondpk.sslop56o[ii] = 0.0;
755 bondpk.tslop56o[ii] = 0.0;
756 bondpk.tslop256o[ii] = 0.0;
757 bondpk.bk66o[ii] = 0.0;
758 bondpk.bl66o[ii] = 0.0;
759 bondpk.bmom66o[ii] = 0.0;
760 bondpk.sslop66o[ii] = 0.0;
761 bondpk.tslop66o[ii] = 0.0;
762 bondpk.tslop266o[ii] = 0.0;
763 bondpk.bk40[ii] = 0.0;
764 bondpk.bl40[ii] = 0.0;
765 bondpk.bmom40[ii] = 0.0;
766 bondpk.sslop40[ii] = 0.0;
767 bondpk.tslop40[ii] = 0.0;
768 bondpk.tslop240[ii] = 0.0;
769 bondpk.bk50[ii] = 0.0;
770 bondpk.bl50[ii] = 0.0;
771 bondpk.bmom50[ii] = 0.0;
772 bondpk.sslop50[ii] = 0.0;
773 bondpk.tslop50[ii] = 0.0;
774 bondpk.tslop250[ii] = 0.0;
775 bondpk.bk60[ii] = 0.0;
776 bondpk.bl60[ii] = 0.0;
777 bondpk.bmom60[ii] = 0.0;
778 bondpk.sslop60[ii] = 0.0;
779 bondpk.tslop60[ii] = 0.0;
780 bondpk.tslop260[ii] = 0.0;
781 }
782 for (ii = 0; ii < MAXPIBONDCONST; ii++)
783 {
784 strcpy(bondpk.kb[ii]," ");
785 bondpk.bk[ii] = 0.0;
786 bondpk.bl[ii] = 0.0;
787 bondpk.bmom[ii] = 0.0;
788 bondpk.sslop[ii] = 0.0;
789 bondpk.tslop[ii] = 0.0;
790 bondpk.tslop2[ii] = 0.0;
791 }
792 picorrect.fudge1 = 0.0;
793 picorrect.fudge2 = 0.0;
794 picorrect.fudge3 = 0.0;
795 picorrect.fudge4 = 0.0;
796 picorrect.beta_fudgef = 0.0;
797 picorrect.beta_fudgeh = 0.0;
798
799 // pi torsions
800 torknp.npitor = 0;
801 for (ii = 0; ii < MAXPITORCONST; ii++)
802 {
803 strcpy(torknp.kv[ii]," ");
804 torknp.ph1[ii] = 0;
805 torknp.ph2[ii] = 0;
806 torknp.ph3[ii] = 0;
807 torknp.tv1[ii] = 0.0;
808 torknp.tv2[ii] = 0.0;
809 torknp.tv3[ii] = 0.0;
810 }
811 // pi angles
812 angkp1.npiang = 0;
813 for (ii = 0; ii < MAXPIANGCONST; ii++)
814 {
815 strcpy(angkp1.kpa[ii]," ");
816 angkp1.pacon[ii] = 0.0;
817 angkp1.panat[ii][0] = 0.0;
818 angkp1.panat[ii][1] = 0.0;
819 angkp1.panat[ii][2] = 0.0;
820 angkp1.piobp[ii] = 0.0;
821 }
822
823 }
824 /* =========================================== */
825 void get_added_const()
826 {
827 int ia,ib,ic,id, ip1,ip2,ip3,iz,if3,if4,if5;
828 float f1,f2,f3,f4;
829 float v1[6];
830 int se1[6];
831 char pa[3],pb[3],pc[3],pd[3],pt[13];
832 char line[151], iptemp[21], dummy[10];
833 FILE *wfile;
834
835 wfile = fopen_path(minim_control.added_path,minim_control.added_name,"r");
836 if (wfile == NULL)
837 {
838 message_alert("Error opening added constants file","Error");
839 fprintf(pcmoutfile,"Error reading added constants file: %s\n",minim_control.added_name);
840 return;
841 }
842
843 fprintf(pcmoutfile,"\nThe Following Added Parameters were read:\n\n");
844 while ( FetchRecord(wfile,line) )
845 {
846 sscanf(line,"%s",iptemp);
847
848 if (strcmp(iptemp,"bond") == 0)
849 {
850 sscanf(line,"%s %d %d %f %f",dummy,&ia,&ib,&f1,&f2);
851 fprintf(pcmoutfile,"Bond: AtomTypes %d %d Blen %f Bk %f \n",ia,ib,f1,f2);
852 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE)
853 {
854 iz = check_bondconst(ia,ib,f1,f2);
855 if (iz == FALSE)
856 {
857 bondk1.s[bondk1.nbnd] = f1;
858 bondk1.t[bondk1.nbnd] = f2;
859 numeral(ia,pa,3);
860 numeral(ib,pb,3);
861 strcpy(pt,pa);
862 strcat(pt,pb);
863 strcpy(bondk1.kb[bondk1.nbnd],pt);
864 bondk1.nbnd++;
865 }
866 } else
867 {
868 message_alert("Error reading bond atom types in added constants file","Error");
869 }
870 } else if (strcmp(iptemp,"bond5") == 0)
871 {
872 iz = sscanf(line,"%s %d %d %f %f",dummy,&ia,&ib,&f1,&f2);
873 fprintf(pcmoutfile,"Bond5: AtomTypes %d %d Blen %f Bk %f \n",ia,ib,f1,f2);
874 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && iz > 3)
875 {
876 iz = check_bond5const(ia,ib,f1,f2);
877 if (iz == FALSE)
878 {
879 bondk1.s5[bondk1.nbnd5] = f1;
880 bondk1.t5[bondk1.nbnd5] = f2;
881 numeral(ia,pa,3);
882 numeral(ib,pb,3);
883 strcpy(pt,pa);
884 strcat(pt,pb);
885 strcpy(bondk1.kb5[bondk1.nbnd5],pt);
886 bondk1.nbnd5++;
887 }
888 } else
889 {
890 message_alert("Error reading bond atom types in added constants file","Error");
891 }
892 } else if (strcmp(iptemp,"bond4") == 0)
893 {
894 iz = sscanf(line,"%s %d %d %f %f",dummy,&ia,&ib,&f1,&f2);
895 fprintf(pcmoutfile,"Bond4: AtomTypes %d %d Blen %f Bk %f \n",ia,ib,f1,f2);
896 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && iz > 3)
897 {
898 iz = check_bond4const(ia,ib,f1,f2);
899 if (iz == FALSE)
900 {
901 bondk1.s4[bondk1.nbnd4] = f1;
902 bondk1.t4[bondk1.nbnd4] = f2;
903 numeral(ia,pa,3);
904 numeral(ib,pb,3);
905 strcpy(pt,pa);
906 strcat(pt,pb);
907 strcpy(bondk1.kb4[bondk1.nbnd4],pt);
908 bondk1.nbnd4++;
909 }
910 } else
911 {
912 message_alert("Error reading bond atom types in added constants file","Error");
913 }
914 } else if (strcmp(iptemp,"bond3") == 0)
915 {
916 sscanf(line,"%s %d %d %f %f",dummy,&ia,&ib,&f1,&f2);
917 fprintf(pcmoutfile,"Bond3: AtomTypes %d %d Blen %f Bk %f \n",ia,ib,f1,f2);
918 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE)
919 {
920 iz = check_bond3const(ia,ib,f1,f2);
921 if (iz == FALSE)
922 {
923 bondk1.s3[bondk1.nbnd3] = f1;
924 bondk1.t3[bondk1.nbnd3] = f2;
925 numeral(ia,pa,3);
926 numeral(ib,pb,3);
927 strcpy(pt,pa);
928 strcat(pt,pb);
929 strcpy(bondk1.kb3[bondk1.nbnd3],pt);
930 bondk1.nbnd3++;
931 }
932 } else
933 {
934 message_alert("Error reading bond atom types in added constants file","Error");
935 }
936 } else if (strcmp(iptemp,"angle") == 0)
937 {
938 f1 =f2=f3=f4=0.0;
939 sscanf(line,"%s %d %d %d %f %f %f %f",dummy,&ia,&ib,&ic,&f1,&f2,&f3,&f4);
940 fprintf(pcmoutfile,"Angle: AtomTypes %d %d %d Anat %f Acon %f \n",ia,ib,ic,f2,f1);
941 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
942 {
943 iz = check_angleconst(ia,ib,ic,f1,f2,f3,f4);
944 if (iz == FALSE)
945 {
946 angk1.con[angk1.nang] = f1;
947 angk1.ang[angk1.nang][0] = f2;
948 angk1.ang[angk1.nang][1] = f3;
949 angk1.ang[angk1.nang][2] = f4;
950 numeral(ia,pa,3);
951 numeral(ib,pb,3);
952 numeral(ic,pc,3);
953 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc);
954 strcpy(angk1.ktype[angk1.nang],pt);
955 angk1.nang++;
956 }
957 } else
958 {
959 message_alert("Error reading Angle atom types in added constants file","Error");
960 }
961 } else if (strcmp(iptemp,"angle5") == 0)
962 {
963 f1 =f2=f3=f4=0.0;
964 sscanf(line,"%s %d %d %d %f %f %f %f",dummy,&ia,&ib,&ic,&f1,&f2,&f3,&f4);
965 fprintf(pcmoutfile,"Angle5: AtomTypes %d %d %d Anat %f Acon %f \n",ia,ib,ic,f2,f1);
966 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
967 {
968 iz = check_angle5const(ia,ib,ic,f1,f2,f3,f4);
969 if (iz == FALSE)
970 {
971 angk1.con5[angk1.nang5] = f1;
972 angk1.ang5[angk1.nang5][0] = f2;
973 angk1.ang5[angk1.nang5][1] = f3;
974 angk1.ang5[angk1.nang5][2] = f4;
975 numeral(ia,pa,3);
976 numeral(ib,pb,3);
977 numeral(ic,pc,3);
978 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc);
979 strcpy(angk1.ktype5[angk1.nang5],pt);
980 angk1.nang5++;
981 }
982 } else
983 {
984 message_alert("Error reading Angle atom types in added constants file","Error");
985 }
986 } else if (strcmp(iptemp,"angle4") == 0)
987 {
988 f1 =f2=f3=f4=0.0;
989 sscanf(line,"%s %d %d %d %f %f %f %f",dummy,&ia,&ib,&ic,&f1,&f2,&f3,&f4);
990 fprintf(pcmoutfile,"Angle4: AtomTypes %d %d %d Anat %f Acon %f \n",ia,ib,ic,f2,f1);
991 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
992 {
993 iz = check_angle4const(ia,ib,ic,f1,f2,f3,f4);
994 if (iz == FALSE)
995 {
996 angk1.con4[angk1.nang4] = f1;
997 angk1.ang4[angk1.nang4][0] = f2;
998 angk1.ang4[angk1.nang4][1] = f3;
999 angk1.ang4[angk1.nang4][2] = f4;
1000 numeral(ia,pa,3);
1001 numeral(ib,pb,3);
1002 numeral(ic,pc,3);
1003 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc);
1004 strcpy(angk1.ktype4[angk1.nang4],pt);
1005 angk1.nang4++;
1006 }
1007 } else
1008 {
1009 message_alert("Error reading Angle atom types in added constants file","Error");
1010 }
1011 } else if (strcmp(iptemp,"angle3") == 0)
1012 {
1013 f1 =f2=f3=f4=0.0;
1014 sscanf(line,"%s %d %d %d %f %f %f %f",dummy,&ia,&ib,&ic,&f1,&f2,&f3,&f4);
1015 fprintf(pcmoutfile,"Angle3: AtomTypes %d %d %d Anat %f Acon %f \n",ia,ib,ic,f2,f1);
1016 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
1017 {
1018 iz = check_angle3const(ia,ib,ic,f1,f2,f3,f4);
1019 if (iz == FALSE)
1020 {
1021 angk1.con3[angk1.nang3] = f1;
1022 angk1.ang3[angk1.nang3][0] = f2;
1023 angk1.ang3[angk1.nang3][1] = f3;
1024 angk1.ang3[angk1.nang3][2] = f4;
1025 numeral(ia,pa,3);
1026 numeral(ib,pb,3);
1027 numeral(ic,pc,3);
1028 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc);
1029 strcpy(angk1.ktype3[angk1.nang3],pt);
1030 angk1.nang3++;
1031 }
1032 } else
1033 {
1034 message_alert("Error reading Angle atom types in added constants file","Error");
1035 }
1036 } else if (strcmp(iptemp,"torsion") == 0)
1037 {
1038 sscanf(line,"%s %d %d %d %d %f %d %f %d %f %d",dummy,&ia,&ib,&ic,&id,&f1,&ip1,&f2,
1039 &ip2,&f3,&ip3);
1040 fprintf(pcmoutfile,"Torsion: AtomTypes %d %d %d %d V1 %f V2 %f V3 %f\n",ia,ib,ic,id,f1,f2,f3);
1041 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE && id < MAXATOMTYPE)
1042 {
1043 iz = check_torsionconst(ia,ib,ic,id,f1,f2,f3,ip1,ip2,ip3);
1044 if (iz == FALSE)
1045 {
1046 v1[0] = f1; v1[1] = f2; v1[2] = f3;
1047 v1[3] = v1[4] = v1[5] = 0.0;
1048 se1[0] = ip1; se1[1] = ip2; se1[2] = ip3;
1049 se1[3] = se1[4] = se1[5] = 0;
1050 torphase(6, v1, se1);
1051 torkn1.tv1[torkn1.ntor] = v1[0];
1052 torkn1.phase1[torkn1.ntor] = se1[0];
1053 torkn1.tv2[torkn1.ntor] = v1[1];
1054 torkn1.phase2[torkn1.ntor] = se1[1];
1055 torkn1.tv3[torkn1.ntor] = v1[2];
1056 torkn1.phase3[torkn1.ntor] = se1[2];
1057 torkn1.tv4[torkn1.ntor] = v1[3];
1058 torkn1.phase4[torkn1.ntor] = se1[3];
1059 torkn1.tv5[torkn1.ntor] = v1[4];
1060 torkn1.phase5[torkn1.ntor] = se1[4];
1061 torkn1.tv6[torkn1.ntor] = v1[5];
1062 torkn1.phase6[torkn1.ntor] = se1[5];
1063 numeral(ia,pa,3);
1064 numeral(ib,pb,3);
1065 numeral(ic,pc,3);
1066 numeral(id,pd,3);
1067 strcpy(pt,pa);
1068 strcat(pt,pb); strcat(pt,pc); strcat(pt,pd);
1069 strcpy(torkn1.kv[torkn1.ntor],pt);
1070 torkn1.ntor++;
1071 }
1072 } else
1073 {
1074 message_alert("Error reading Torsion atom types in added constants file","Error");
1075 }
1076 } else if (strcmp(iptemp,"torsion4") == 0)
1077 {
1078 sscanf(line,"%s %d %d %d %d %f %d %f %d %f %d",dummy,&ia,&ib,&ic,&id,&f1,&ip1,&f2,
1079 &ip2,&f3,&ip3);
1080 fprintf(pcmoutfile,"Torsion4: AtomTypes %d %d %d %d V1 %f V2 %f V3 %f\n",ia,ib,ic,id,f1,f2,f3);
1081 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE && id < MAXATOMTYPE)
1082 {
1083 iz = check_torsion4const(ia,ib,ic,id,f1,f2,f3,ip1,ip2,ip3);
1084 if (iz == FALSE)
1085 {
1086 v1[0] = f1; v1[1] = f2; v1[2] = f3;
1087 v1[3] = v1[4] = v1[5] = 0.0;
1088 se1[0] = ip1; se1[1] = ip2; se1[2] = ip3;
1089 se1[3] = se1[4] = se1[5] = 0;
1090 torphase(6, v1, se1);
1091 torkn1.tv41[torkn1.ntor4] = v1[0];
1092 torkn1.phase41[torkn1.ntor4] = se1[0];
1093 torkn1.tv42[torkn1.ntor4] = v1[1];
1094 torkn1.phase42[torkn1.ntor4] = se1[1];
1095 torkn1.tv43[torkn1.ntor4] = v1[2];
1096 torkn1.phase43[torkn1.ntor4] = se1[2];
1097 numeral(ia,pa,3);
1098 numeral(ib,pb,3);
1099 numeral(ic,pc,3);
1100 numeral(id,pd,3);
1101 strcpy(pt,pa);
1102 strcat(pt,pb); strcat(pt,pc); strcat(pt,pd);
1103 strcpy(torkn1.kv4[torkn1.ntor4],pt);
1104 torkn1.ntor4++;
1105 }
1106 } else
1107 {
1108 message_alert("Error reading Torsion atom types in added constants file","Error");
1109 }
1110 } else if (strcmp(iptemp,"torsion5") == 0)
1111 {
1112 sscanf(line,"%s %d %d %d %d %f %d %f %d %f %d",dummy,&ia,&ib,&ic,&id,&f1,&ip1,&f2,
1113 &ip2,&f3,&ip3);
1114 fprintf(pcmoutfile,"Torsion5: AtomTypes %d %d %d %d V1 %f V2 %f V3 %f\n",ia,ib,ic,id,f1,f2,f3);
1115 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE && id < MAXATOMTYPE)
1116 {
1117 iz = check_torsion5const(ia,ib,ic,id,f1,f2,f3,ip1,ip2,ip3);
1118 if (iz == FALSE)
1119 {
1120 v1[0] = f1; v1[1] = f2; v1[2] = f3;
1121 v1[3] = v1[4] = v1[5] = 0.0;
1122 se1[0] = ip1; se1[1] = ip2; se1[2] = ip3;
1123 se1[3] = se1[4] = se1[5] = 0;
1124 torphase(6, v1, se1);
1125 torkn1.tv51[torkn1.ntor5] = v1[0];
1126 torkn1.phase51[torkn1.ntor5] = se1[0];
1127 torkn1.tv52[torkn1.ntor5] = v1[1];
1128 torkn1.phase52[torkn1.ntor5] = se1[1];
1129 torkn1.tv53[torkn1.ntor5] = v1[2];
1130 torkn1.phase53[torkn1.ntor5] = se1[2];
1131 numeral(ia,pa,3);
1132 numeral(ib,pb,3);
1133 numeral(ic,pc,3);
1134 numeral(id,pd,3);
1135 strcpy(pt,pa);
1136 strcat(pt,pb); strcat(pt,pc); strcat(pt,pd);
1137 strcpy(torkn1.kv5[torkn1.ntor5],pt);
1138 torkn1.ntor5++;
1139 }
1140 } else
1141 {
1142 message_alert("Error reading Torsion atom types in added constants file","Error");
1143 }
1144 } else if (strcmp(iptemp,"vdw") == 0)
1145 {
1146 sscanf(line,"%s %d %f %f %d %d %d",dummy,&ia,&f1,&f2,&if3,&if4,&if5);
1147 fprintf(pcmoutfile,"VDW: AtomTypes %d Rad %f Eps %f \n",ia,f1,f2);
1148 vdw1.rad[ia] = f1;
1149 vdw1.eps[ia] = f2;
1150 vdw1.lpd[ia] = if3;
1151 vdw1.ihdon[ia] = if4;
1152 vdw1.ihtyp[ia] = if5;
1153 } else if (strcmp(iptemp,"metal") == 0)
1154 {
1155 sscanf(line,"%s %d %f %f",dummy,&ia,&f1,&f2);
1156 fprintf(pcmoutfile,"Metal: AtomTypes %d Rad %f Eps %f \n",ia,f1,f2);
1157 metaldata.radius[ia] = f1;
1158 metaldata.eps[ia] = f2;
1159 } else if (strcmp(iptemp,"vdwpr") == 0)
1160 {
1161 sscanf(line,"%s %d %d %f %f",dummy, &ia, &ib, &f1,&f2);
1162 fprintf(pcmoutfile,"VDWPR: AtomTypes %d %d Rad %f Eps %f \n",ia,ib,f1,f2);
1163 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE)
1164 {
1165 iz = check_vdwpr(ia,ib,f1,f2);
1166 if (iz == FALSE)
1167 {
1168 numeral(ia,pa,3);
1169 numeral(ib,pb,3);
1170 strcpy(pt,pa); strcat(pt,pb);
1171 strcpy(vdwpr_k.kv[vdwpr_k .nvdwpr],pt);
1172 vdwpr_k.ia1[vdwpr_k .nvdwpr] = ia;
1173 vdwpr_k.ia2[vdwpr_k .nvdwpr] = ib;
1174 vdwpr_k.radius[vdwpr_k .nvdwpr] = f1;
1175 vdwpr_k.eps[vdwpr_k .nvdwpr] = f2;
1176 vdwpr_k .nvdwpr++;
1177 }
1178 } else
1179 {
1180 message_alert("Error reading VDWPR atom types in added constants file","Error");
1181 }
1182 } else if (strcmp(iptemp,"opbend") == 0)
1183 {
1184 sscanf( line, "%s %d %d %d %d %f", dummy, &ia, &ib, &ic,&id,&f1 );
1185 fprintf(pcmoutfile,"OPBEND: AtomTypes %d %d %d %d Const %f \n",ia,ib,ic,id,f1);
1186 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
1187 {
1188 iz = check_opbend(ia,ib,ic,id,f1);
1189 if (iz == FALSE)
1190 {
1191 numeral(ia,pa,3);
1192 numeral(ib,pb,3);
1193 numeral(ic,pc,3);
1194 numeral(id,pd,3);
1195 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc); strcat(pt,pd);
1196 strcpy(ooplane_k.iopb[ooplane_k.nopbend],pt);
1197 ooplane_k.nopbend++;
1198 }
1199 } else
1200 {
1201 message_alert("Error reading Opbend atom types in added constants file","Error");
1202 }
1203 } else if (strcmp(iptemp,"strbnd") == 0)
1204 {
1205 id = 0;
1206 sscanf(line,"%s %d %d %d %f %f %f",dummy, &ia, &ib, &ic,
1207 &f1,&f2,&f3);
1208 fprintf(pcmoutfile,"STRBEND: AtomTypes %d %d Const %f %f %f\n",ia,ib,f1,f2,f3);
1209 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE && ic < MAXATOMTYPE)
1210 {
1211 iz = check_strbnd(ia,ib,ic,f1,f2,f3);
1212 if (iz == FALSE)
1213 {
1214 numeral(ia,pa,3);
1215 numeral(ib,pb,3);
1216 numeral(ic,pc,3);
1217 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc);
1218 strcpy(crossterm_k.stbn[crossterm_k.nstrbnd],pt);
1219 crossterm_k.stbncon[crossterm_k.nstrbnd][0] = f1;
1220 crossterm_k.stbncon[crossterm_k.nstrbnd][1] = f2;
1221 crossterm_k.stbncon[crossterm_k.nstrbnd][2] = f3;
1222 crossterm_k.stbnindex[crossterm_k.nstrbnd] = 0;
1223 crossterm_k.nstrbnd++;
1224 }
1225 } else
1226 {
1227 message_alert("Error reading Strbend atom types in added constants file","Error");
1228 }
1229 } else if (strcmp(iptemp,"dipole") == 0)
1230 {
1231 sscanf(line,"%s %d %d %f",dummy,&ia,&ib,&f1);
1232 fprintf(pcmoutfile,"DIPOLE: AtomTypes %d %d Bond Moment %f \n",ia,ib,f1);
1233 if (ia < MAXATOMTYPE && ib < MAXATOMTYPE)
1234 {
1235 iz = check_dipoleconst(ia,ib,f1);
1236 if (iz == FALSE)
1237 {
1238 dipole_k.bmom[dipole_k.ndipole] = f1;
1239 numeral(ia,pa,3);
1240 numeral(ib,pb,3);
1241 strcpy(pt,pa); strcat(pt,pb);
1242 strcpy(dipole_k.kb[dipole_k.ndipole],pt);
1243 dipole_k.ndipole++;
1244 }
1245 } else
1246 {
1247 message_alert("Error reading Dipole atom types in added constants file","Error");
1248 }
1249 }
1250 }
1251 fclose(wfile);
1252 }
1253 /* ========================================== */
1254 int check_vdwpr(int ia, int ib,float f1, float f2)
1255 {
1256 int i;
1257 char pa[3],pb[3],pt[13];
1258
1259 numeral(ia,pa,3);
1260 numeral(ib,pb,3);
1261 strcpy(pt,pa);
1262 strcat(pt,pb);
1263 for (i=0; i < vdwpr_k .nvdwpr; i++)
1264 {
1265 if (strcmp(pt,vdwpr_k.kv[i]) == 0)
1266 {
1267 vdwpr_k.radius[i] = f1;
1268 vdwpr_k.eps[i] = f2;
1269 return TRUE;
1270 }
1271 }
1272 return FALSE;
1273 }
1274 /* ========================================== */
1275 int check_strbnd(int ia, int ib, int ic,float f1, float f2, float f3)
1276 {
1277 int i;
1278 char pa[3],pb[3],pc[3],pt[13];
1279
1280 numeral(ia,pa,3);
1281 numeral(ib,pb,3);
1282 numeral(ic,pc,3);
1283 strcpy(pt,pa);
1284 strcat(pt,pb);
1285 strcat(pt,pc);
1286 for (i=0; i < crossterm_k.nstrbnd; i++)
1287 {
1288 if (strcmp(pt,crossterm_k.stbn[i]) == 0)
1289 {
1290 crossterm_k.stbncon[i][0] = f1;
1291 crossterm_k.stbncon[i][1] = f2;
1292 crossterm_k.stbncon[i][2] = f3;
1293 return TRUE;
1294 }
1295 }
1296 return FALSE;
1297 }
1298 /* ========================================== */
1299 int check_opbend(int ia,int ib,int ic,int id, float ftemp)
1300 {
1301 int i;
1302 char pa[3],pb[3],pc[3],pd[3],pt[13];
1303 numeral(ia,pa,3);
1304 numeral(ib,pb,3);
1305 numeral(ic,pc,3);
1306 numeral(id,pd,3);
1307 strcpy(pt,pa);
1308 strcat(pt,pb);
1309 strcat(pt,pc);
1310 strcat(pt,pd);
1311 for (i=0; i < ooplane_k.nopbend; i++)
1312 {
1313 if (strcmp(pt,ooplane_k.iopb[i]) == 0)
1314 {
1315 ooplane_k.copb[i] = ftemp;
1316 return TRUE;
1317 }
1318 }
1319 return FALSE;
1320 }
1321 /* ========================================== */
1322 int check_dipoleconst(int ia,int ib,float bmom)
1323 {
1324 int i;
1325 char pa[3],pb[3],pt[13];
1326
1327 numeral(ia,pa,3);
1328 numeral(ib,pb,3);
1329 strcpy(pt,pa); strcat(pt,pb);
1330 for (i=0; i < dipole_k.ndipole; i++)
1331 {
1332 if (strcmp(pt,dipole_k.kb[i]) == 0)
1333 {
1334 dipole_k.bmom[i] = bmom;
1335 return TRUE;
1336 }
1337 }
1338 return FALSE;
1339 }
1340 /* ========================================== */
1341 int check_torsionconst(int ia,int ib,int ic,int id,float v1,float v2, float v3,
1342 int ip1, int ip2, int ip3)
1343 {
1344 int i;
1345 char pa[3],pb[3],pc[3],pd[3],pt[13];
1346
1347 numeral(ia,pa,3);
1348 numeral(ib,pb,3);
1349 numeral(ic,pc,3);
1350 numeral(id,pd,3);
1351 strcpy(pt,pa);
1352 strcat(pt,pb);
1353 strcat(pt,pc);
1354 strcat(pt,pd);
1355 for (i= 0; i < torkn1.ntor; i++)
1356 {
1357 if (strcmp(pt,torkn1.kv[i]) == 0)
1358 {
1359 torkn1.tv1[i] = v1;
1360 torkn1.tv2[i] = v2;
1361 torkn1.tv3[i] = v3;
1362 return TRUE;
1363 }
1364 }
1365 return FALSE;
1366 }
1367 /* ========================================== */
1368 int check_torsion4const(int ia,int ib,int ic,int id,float v1,float v2, float v3,
1369 int ip1, int ip2, int ip3)
1370 {
1371 int i;
1372 char pa[3],pb[3],pc[3],pd[3],pt[13];
1373
1374 numeral(ia,pa,3);
1375 numeral(ib,pb,3);
1376 numeral(ic,pc,3);
1377 numeral(id,pd,3);
1378 strcpy(pt,pa);
1379 strcat(pt,pb);
1380 strcat(pt,pc);
1381 strcat(pt,pd);
1382 for (i= 0; i < torkn1.ntor4; i++)
1383 {
1384 if (strcmp(pt,torkn1.kv4[i]) == 0)
1385 {
1386 torkn1.tv41[i] = v1;
1387 torkn1.tv42[i] = v2;
1388 torkn1.tv43[i] = v3;
1389 return TRUE;
1390 }
1391 }
1392 return FALSE;
1393 }
1394 /* ========================================== */
1395 int check_torsion5const(int ia,int ib,int ic,int id,float v1,float v2, float v3,
1396 int ip1, int ip2, int ip3)
1397 {
1398 int i;
1399 char pa[3],pb[3],pc[3],pd[3],pt[13];
1400
1401 numeral(ia,pa,3);
1402 numeral(ib,pb,3);
1403 numeral(ic,pc,3);
1404 numeral(id,pd,3);
1405 strcpy(pt,pa);
1406 strcat(pt,pb);
1407 strcat(pt,pc);
1408 strcat(pt,pd);
1409 for (i= 0; i < torkn1.ntor5; i++)
1410 {
1411 if (strcmp(pt,torkn1.kv5[i]) == 0)
1412 {
1413 torkn1.tv51[i] = v1;
1414 torkn1.tv52[i] = v2;
1415 torkn1.tv53[i] = v3;
1416 return TRUE;
1417 }
1418 }
1419 return FALSE;
1420 }
1421 /* ========================================== */
1422 int check_angleconst(int ia,int ib,int ic,float f1, float f2,float f3,float f4)
1423 {
1424 int i;
1425 char pa[3],pb[3],pc[3],pt[13];
1426
1427 numeral(ia,pa,3);
1428 numeral(ib,pb,3);
1429 numeral(ic,pc,3);
1430 strcpy(pt,pa);
1431 strcat(pt,pb);
1432 strcat(pt,pc);
1433 for (i=0; i < angk1.nang; i++)
1434 {
1435 if (strcmp(pt,angk1.ktype[i]) == 0)
1436 {
1437 angk1.con[i] = f1;
1438 angk1.ang[i][0] = f2;
1439 angk1.ang[i][1] = f3;
1440 angk1.ang[i][2] = f4;
1441 return TRUE;
1442 }
1443 }
1444 return FALSE;
1445 }
1446 /* ========================================== */
1447 int check_angle5const(int ia,int ib,int ic,float f1, float f2,float f3,float f4)
1448 {
1449 int i;
1450 char pa[3],pb[3],pc[3],pt[13];
1451
1452 numeral(ia,pa,3);
1453 numeral(ib,pb,3);
1454 numeral(ic,pc,3);
1455 strcpy(pt,pa);
1456 strcat(pt,pb);
1457 strcat(pt,pc);
1458 for (i=0; i < angk1.nang5; i++)
1459 {
1460 if (strcmp(pt,angk1.ktype5[i]) == 0)
1461 {
1462 angk1.con5[i] = f1;
1463 angk1.ang5[i][0] = f2;
1464 angk1.ang5[i][1] = f3;
1465 angk1.ang5[i][2] = f4;
1466 return TRUE;
1467 }
1468 }
1469 return FALSE;
1470 }
1471 /* ========================================== */
1472 int check_angle4const(int ia,int ib,int ic,float f1, float f2,float f3,float f4)
1473 {
1474 int i;
1475 char pa[3],pb[3],pc[3],pt[13];
1476
1477 numeral(ia,pa,3);
1478 numeral(ib,pb,3);
1479 numeral(ic,pc,3);
1480 strcpy(pt,pa);
1481 strcat(pt,pb);
1482 strcat(pt,pc);
1483 for (i=0; i < angk1.nang4; i++)
1484 {
1485 if (strcmp(pt,angk1.ktype4[i]) == 0)
1486 {
1487 angk1.con4[i] = f1;
1488 angk1.ang4[i][0] = f2;
1489 angk1.ang4[i][1] = f3;
1490 angk1.ang4[i][2] = f4;
1491 return TRUE;
1492 }
1493 }
1494 return FALSE;
1495 }
1496 /* ========================================== */
1497 int check_angle3const(int ia,int ib,int ic,float f1, float f2,float f3,float f4)
1498 {
1499 int i;
1500 char pa[3],pb[3],pc[3],pt[13];
1501
1502 numeral(ia,pa,3);
1503 numeral(ib,pb,3);
1504 numeral(ic,pc,3);
1505 strcpy(pt,pa);
1506 strcat(pt,pb);
1507 strcat(pt,pc);
1508 for (i=0; i < angk1.nang3; i++)
1509 {
1510 if (strcmp(pt,angk1.ktype3[i]) == 0)
1511 {
1512 angk1.con3[i] = f1;
1513 angk1.ang3[i][0] = f2;
1514 angk1.ang3[i][1] = f3;
1515 angk1.ang3[i][2] = f4;
1516 return TRUE;
1517 }
1518 }
1519 return FALSE;
1520 }
1521 /* ========================================== */
1522 int check_bondconst(int ia,int ib,float f1, float f2)
1523 {
1524 int i;
1525 char pa[3],pb[3],pt[13];
1526
1527 numeral(ia,pa,3);
1528 numeral(ib,pb,3);
1529 strcpy(pt,pa);
1530 strcat(pt,pb);
1531 for (i=0; i < bondk1.nbnd; i++)
1532 {
1533 if (strcmp(pt,bondk1.kb[i]) == 0)
1534 {
1535 bondk1.s[i] = f1;
1536 bondk1.t[i] = f2;
1537 return TRUE;
1538 }
1539 }
1540 return FALSE;
1541 }
1542 /* ========================================== */
1543 int check_bond5const(int ia,int ib,float f1, float f2)
1544 {
1545 int i;
1546 char pa[3],pb[3],pt[13];
1547
1548 numeral(ia,pa,3);
1549 numeral(ib,pb,3);
1550 strcpy(pt,pa);
1551 strcat(pt,pb);
1552 for (i=0; i < bondk1.nbnd5; i++)
1553 {
1554 if (strcmp(pt,bondk1.kb5[i]) == 0)
1555 {
1556 bondk1.s5[i] = f1;
1557 bondk1.t5[i] = f2;
1558 return TRUE;
1559 }
1560 }
1561 return FALSE;
1562 }
1563 /* ========================================== */
1564 int check_bond4const(int ia,int ib,float f1, float f2)
1565 {
1566 int i;
1567 char pa[3],pb[3],pt[13];
1568
1569 numeral(ia,pa,3);
1570 numeral(ib,pb,3);
1571 strcpy(pt,pa);
1572 strcat(pt,pb);
1573 for (i=0; i < bondk1.nbnd4; i++)
1574 {
1575 if (strcmp(pt,bondk1.kb4[i]) == 0)
1576 {
1577 bondk1.s4[i] = f1;
1578 bondk1.t4[i] = f2;
1579 return TRUE;
1580 }
1581 }
1582 return FALSE;
1583 }
1584 /* ========================================== */
1585 int check_bond3const(int ia,int ib,float f1, float f2)
1586 {
1587 int i;
1588 char pa[3],pb[3],pt[13];
1589
1590 numeral(ia,pa,3);
1591 numeral(ib,pb,3);
1592 strcpy(pt,pa);
1593 strcat(pt,pb);
1594 for (i=0; i < bondk1.nbnd3; i++)
1595 {
1596 if (strcmp(pt,bondk1.kb3[i]) == 0)
1597 {
1598 bondk1.s3[i] = f1;
1599 bondk1.t3[i] = f2;
1600 return TRUE;
1601 }
1602 }
1603 return FALSE;
1604 }
1605 /* ============================================= */
1606 void read_datafiles(char *pfile)
1607 {
1608 /*
1609 char filename[256];
1610
1611 char *ev = NULL;
1612
1613 if ( (ev=getenv("ENGINE_DIR")) != NULL)
1614 {
1615 strcpy(filename,ev);
1616 strcat(filename,"/");
1617 strcat(filename,datafile);
1618 } else
1619 strcpy(filename,datafile);
1620 read_parameterfile(filename);
1621 */
1622 #include "mmxconst.h"
1623 #include "mmff94.h"
1624 if (!strncmp(pfile, "mmxconst",8)) {
1625 read_parameterfile(mmxconst);
1626 } else if (!strncmp(pfile, "mmff94",6)) {
1627 read_parameterfile(mmff94);
1628 }
1629 return;
1630 }
1631 // =================================================
1632 void read_parameterfile(char **parray)
1633 {
1634 char dumm[21], iptemp[21];
1635 char pa[4],pb[4],pt[7];
1636 char pc[4],pd[4],pang[10],ptor[13];
1637 int iz;
1638 int ihtype,lpde,ihdonor;
1639 float radius,epsilon,alpha,ntmp,atmp,gtmp;
1640 float v1[6];
1641 int se1[6];
1642 int iser, inumber, iligand, iclass, iclass1, iclass2, ivalence;
1643 char symbol[3], descript[25];
1644 float wtt;
1645 float charge, fchrg,tchrg;
1646 int i, iatm1, iatm2, ii, ja,
1647 jb, kk, kp1, kp2, kp3, kp4, kt1, kt2, kt3;
1648
1649 int irec=0;
1650 char *line;
1651
1652 /*
1653 FILE *datafile;
1654 datafile = fopen(string, "rt");
1655
1656 if (datafile == NULL)
1657 {
1658 char message[80];
1659 sprintf(message,"Unable to open the data file %s.\nPlease check that this file was installed\n and is in the same directory as PCWIN",string);
1660 message_alert(message,"Read Parameter");
1661 fprintf(stderr,"Unable to open the data file %s.\nPlease check that this file was installed\n and is in the same directory as PCWIN\n",string);
1662 fclose(datafile);
1663 return;
1664 }
1665
1666 while ( FetchRecord(datafile,line))
1667 */
1668 while (strlen(parray[irec]))
1669 {
1670 line = parray[irec];
1671 ++irec;
1672 sscanf(line,"%s",iptemp);
1673 /* force field descriptors */
1674 if (strcmp(iptemp,"forcefield") == 0)
1675 {
1676 sscanf(line,"%s %s",dumm, field.name);
1677 if (strcmp(field.name,"AMBER95") == 0)
1678 field.type = AMBER;
1679 else if (strcmp(field.name,"MMX") == 0)
1680 field.type = MMX;
1681 else if (strcmp(field.name,"MM2-1991") == 0)
1682 field.type = MM2;
1683 else if (strcmp(field.name,"MM2-PLUS") == 0)
1684 field.type = MM2;
1685 else if (strcmp(field.name,"MM3-1992") == 0 || strcmp(field.name,"MM3-1996") == 0 )
1686 field.type = MM3;
1687 else if (strcmp(field.name,"CHARMM22-PROTEIN") == 0)
1688 field.type = CHARMM;
1689 else if (strcmp(field.name,"MMFF94") == 0)
1690 field.type = MMFF94;
1691 else if (strcmp(field.name,"OPLSAA") == 0)
1692 field.type = OPLSAA;
1693 else
1694 field.type = UNKNOWN;
1695 } else if (strcmp(iptemp,"bondunit") == 0)
1696 {
1697 sscanf(line,"%s %f",dumm, &field.bondunit);
1698 units.bndunit = field.bondunit;
1699 } else if (strcmp(iptemp,"bond-cubic") == 0)
1700 {
1701 sscanf(line,"%s %f",dumm, &field.bond_cubic);
1702 units.cbnd = field.bond_cubic;
1703 } else if (strcmp(iptemp,"bond-quartic") == 0)
1704 {
1705 sscanf(line,"%s %f",dumm, &field.bond_quartic);
1706 units.qbnd = field.bond_quartic;
1707 } else if (strcmp(iptemp,"angleunit") == 0)
1708 {
1709 sscanf(line,"%s %f",dumm, &field.angleunit);
1710 units.angunit = field.angleunit;
1711 } else if (strcmp(iptemp,"angle-cubic") == 0)
1712 {
1713 sscanf(line,"%s %f",dumm, &field.angle_cubic);
1714 units.cang = field.angle_cubic;
1715 } else if (strcmp(iptemp,"angle-quartic") == 0)
1716 {
1717 sscanf(line,"%s %f",dumm, &field.angle_quartic);
1718 units.qang = field.angle_quartic;
1719 } else if (strcmp(iptemp,"angle-pentic") == 0)
1720 {
1721 sscanf(line,"%s %f",dumm, &field.angle_pentic);
1722 units.pang = field.angle_pentic;
1723 } else if (strcmp(iptemp,"angle-sextic") == 0)
1724 {
1725 sscanf(line,"%s %f",dumm, &field.angle_sextic);
1726 units.sang = field.angle_sextic;
1727 } else if (strcmp(iptemp,"str-bndunit") == 0)
1728 {
1729 sscanf(line,"%s %f",dumm, &field.str_bndunit);
1730 units.stbnunit = field.str_bndunit;
1731 } else if (strcmp(iptemp,"ang-angunit") == 0)
1732 {
1733 sscanf(line,"%s %f",dumm, &field.ang_angunit);
1734 units.aaunit = field.ang_angunit;
1735 } else if (strcmp(iptemp,"torsionunit") == 0)
1736 {
1737 sscanf(line,"%s %f",dumm, &field.torsionunit);
1738 units.torsunit = field.torsionunit;
1739 } else if (strcmp(iptemp,"str-torunit") == 0)
1740 {
1741 sscanf(line,"%s %f",dumm, &field.str_torunit);
1742 units.storunit = field.str_torunit;
1743 } else if (strcmp(iptemp,"vdwtype") == 0)
1744 {
1745 sscanf(line,"%s %s",dumm, field.vdwtype);
1746 if (strcmp(field.vdwtype ,"LENNARD-JONES") == 0)
1747 pot.use_lj = TRUE;
1748 else if (strcmp(field.vdwtype ,"BUCKINGHAM") == 0)
1749 pot.use_buck = TRUE;
1750 else if (strcmp(field.vdwtype ,"BUFFERED-14-7") == 0)
1751 pot.use_hal = TRUE;
1752 else if (strcmp(field.vdwtype ,"BGAUSSIAN") == 0)
1753 pot.use_gauss = TRUE;
1754 } else if (strcmp(iptemp,"radiustype") == 0)
1755 {
1756 sscanf(line,"%s %s",dumm, field.radiustype);
1757 } else if (strcmp(iptemp,"radiussize") == 0)
1758 {
1759 sscanf(line,"%s %s",dumm, field.radiussize);
1760 } else if (strcmp(iptemp,"radiusrule") == 0)
1761 {
1762 sscanf(line,"%s %s",dumm, field.radiusrule);
1763 } else if (strcmp(iptemp,"epsilonrule") == 0)
1764 {
1765 sscanf(line,"%s %s",dumm, field.epsrule);
1766 } else if (strcmp(iptemp,"a-expterm") == 0)
1767 {
1768 sscanf(line,"%s %f",dumm, &field.a_expterm);
1769 units.aterm = field.a_expterm;
1770 } else if (strcmp(iptemp,"b-expterm") == 0)
1771 {
1772 sscanf(line,"%s %f",dumm, &field.b_expterm);
1773 units.bterm = field.b_expterm;
1774 } else if (strcmp(iptemp,"c-expterm") == 0)
1775 {
1776 sscanf(line,"%s %f",dumm, &field.c_expterm);
1777 units.cterm = field.c_expterm;
1778 } else if (strcmp(iptemp,"vdw-14-scale") == 0)
1779 {
1780 sscanf(line,"%s %f",dumm, &field.vdw_14scale);
1781 units.v14scale = field.vdw_14scale;
1782 } else if (strcmp(iptemp,"dielectric") == 0)
1783 {
1784 sscanf(line,"%s %f",dumm, &field.dielectric);
1785 if (user.dielec == FALSE)
1786 units.dielec = field.dielectric;
1787 } else if (strcmp(iptemp,"chg-14-scale") == 0)
1788 {
1789 sscanf(line,"%s %f",dumm, &field.chg_14scale);
1790 units.chgscale = field.chg_14scale;
1791 } else if (strcmp(iptemp,"atom") == 0) /* atom type descriptors */
1792 {
1793 if (atom_k.natomtype >= MAXATOMTYPE )
1794 {
1795 message_alert("Error - Too many atom types","Read Parameter");
1796 fprintf(stderr,"Maximum number of atom types exceeded. Others will be ignored\n");
1797 //fclose(datafile);
1798 return;
1799 }
1800
1801 sscanf(line, "%s %d %s %22c %d %f %d %d %d %d %d",dumm,&iser, symbol, descript, &inumber, &wtt,
1802 &iligand, &ivalence, &iclass, &iclass1, &iclass2);
1803
1804 atom_k.type[iser] = iser;
1805 strcpy(atom_k.symbol[iser], symbol);
1806 strcpy(atom_k.description[iser], descript);
1807 atom_k.description[iser][20] = '\0';
1808 atom_k.number[iser] = inumber;
1809 atom_k.weight[iser] = wtt;
1810 atom_k.ligands[iser] = iligand;
1811 atom_k.tclass[iser] = iclass;
1812 atom_k.valency[iser] = ivalence;
1813 atom_k.tclass1[iser] = iclass1;
1814 atom_k.tclass2[iser] = iclass2;
1815 atom_k.natomtype++;
1816 } else if ( strcmp(iptemp,"metal") == 0) /* metal data */
1817 {
1818 if (metaldata.nmetal > 200)
1819 {
1820 message_alert("Error-Too many metals in Parameter file","Read Parameter");
1821 //fclose(datafile);
1822 return;
1823 }
1824 sscanf(line,"%s %d %s %f %f",dumm,&metaldata.type[metaldata.nmetal], metaldata.name[metaldata.nmetal],&metaldata.radius[metaldata.nmetal],
1825 &metaldata.eps[metaldata.nmetal]);
1826 metaldata.nmetal++;
1827 } else if( strcmp(iptemp,"bond") == 0 ) /* bond constants */
1828 {
1829 if (bondk1.nbnd >= MAXBONDCONST)
1830 {
1831 message_alert("Error - Too many bond constants","Read Parameter");
1832 fprintf(stderr,"Maximum number of bond constants exceeded. Others will be ignored\n");
1833 //fclose(datafile);
1834 return;
1835 }
1836
1837 sscanf( line, "%s %d %d %f %f", dumm, &ii, &kk,
1838 &bondk1.s[bondk1.nbnd], &bondk1.t[bondk1.nbnd]);
1839 numeral(ii,pa,3);
1840 numeral(kk,pb,3);
1841 strcpy(pt,pa);
1842 strcat(pt,pb);
1843 strcpy(bondk1.kb[bondk1.nbnd],pt);
1844 bondk1.nbnd++;
1845 } else if( strcmp(iptemp,"bond3") == 0 ) /* bond constants */
1846 {
1847 if (bondk1.nbnd3 >= MAXBOND3CONST)
1848 {
1849 message_alert("Error - Too many bond3 constants","Read Parameter");
1850 fprintf(stderr,"Maximum number of bond3 constants exceeded. Others will be ignored\n");
1851 //fclose(datafile);
1852 return;
1853 }
1854
1855 sscanf( line, "%s %d %d %f %f", dumm, &ii, &kk,
1856 &bondk1.s3[bondk1.nbnd3], &bondk1.t3[bondk1.nbnd3]);
1857 numeral(ii,pa,3);
1858 numeral(kk,pb,3);
1859 strcpy(pt,pa);
1860 strcat(pt,pb);
1861 strcpy(bondk1.kb3[bondk1.nbnd3],pt);
1862 // bondk1.kb3[bondk1.nbnd3] = ii*100 + kk;
1863 bondk1.nbnd3++;
1864 } else if( strcmp(iptemp,"bond4") == 0 ) /* bond constants */
1865 {
1866 if (bondk1.nbnd4 >= MAXBOND4CONST)
1867 {
1868 message_alert("Error - Too many bond4 constants","Read Parameter");
1869 fprintf(stderr,"Maximum number of bond4 constants exceeded. Others will be ignored\n");
1870 //fclose(datafile);
1871 return;
1872 }
1873
1874 sscanf( line, "%s %d %d %f %f", dumm, &ii, &kk,
1875 &bondk1.s4[bondk1.nbnd4], &bondk1.t4[bondk1.nbnd4]);
1876 numeral(ii,pa,3);
1877 numeral(kk,pb,3);
1878 strcpy(pt,pa);
1879 strcat(pt,pb);
1880 strcpy(bondk1.kb4[bondk1.nbnd4],pt);
1881 // bondk1.kb4[bondk1.nbnd4] = ii*100 + kk;
1882 bondk1.nbnd4++;
1883 } else if( strcmp(iptemp,"bond5") == 0 ) /* bond constants */
1884 {
1885 if (bondk1.nbnd5>= MAXBOND5CONST)
1886 {
1887 message_alert("Error - Too many bond5 constants","Read Parameter");
1888 fprintf(stderr,"Maximum number of bond5 constants exceeded. Others will be ignored\n");
1889 //fclose(datafile);
1890 return;
1891 }
1892
1893 sscanf( line, "%s %d %d %f %f", dumm, &ii, &kk,
1894 &bondk1.s5[bondk1.nbnd5], &bondk1.t5[bondk1.nbnd5]);
1895 numeral(ii,pa,3);
1896 numeral(kk,pb,3);
1897 strcpy(pt,pa);
1898 strcat(pt,pb);
1899 strcpy(bondk1.kb5[bondk1.nbnd5],pt);
1900 bondk1.nbnd5++;
1901 } else if( strcmp(iptemp,"bonddel") == 0 ) /* bond constants */
1902 {
1903 if (bondk1.ndeloc>= MAXBONDDELOC)
1904 {
1905 message_alert("Error - Too many delocalized bond constants","Read Parameter");
1906 fprintf(stderr,"Maximum number of delocalized bond constants exceeded. Others will be ignored\n");
1907 //fclose(datafile);
1908 return;
1909 }
1910
1911 sscanf( line, "%s %d %d %f %f", dumm, &ii, &kk,
1912 &bondk1.sdel[bondk1.ndeloc], &bondk1.tdel[bondk1.ndeloc]);
1913 numeral(ii,pa,3);
1914 numeral(kk,pb,3);
1915 strcpy(pt,pa);
1916 strcat(pt,pb);
1917 strcpy(bondk1.kbdel[bondk1.ndeloc],pt);
1918 bondk1.ndeloc++;
1919 } else if (strcmp(iptemp, "electroi") == 0)
1920 {
1921 sscanf(line,"%s %d %d %d %f",dumm,&electroneg.itype[electroneg.nelecti],
1922 &electroneg.ibond[electroneg.nelecti],
1923 &electroneg.iattach[electroneg.nelecti],
1924 &electroneg.icorr[electroneg.nelecti]);
1925 electroneg.nelecti++;
1926 } else if (strcmp(iptemp, "electroj") == 0)
1927 {
1928 sscanf(line,"%s %d %d %d %f",dumm,&electroneg.jtype[electroneg.nelectj],
1929 &electroneg.jbond[electroneg.nelectj],
1930 &electroneg.jattach[electroneg.nelectj],
1931 &electroneg.jcorr[electroneg.nelectj]);
1932 electroneg.nelectj++;
1933 } else if (strcmp(iptemp, "piatom") == 0)
1934 {
1935 if (piatomk.npiatom > MAXPIATOM)
1936 {
1937 message_alert("Error - Too many piatom constants","Read Parameter");
1938 fprintf(stderr,"Maximum number of piatom constants exceeded. Others will be ignored\n");
1939 //fclose(datafile);
1940 return;
1941 }
1942 sscanf(line,"%s %d %f %f %f %f %f %f %f %f %d", dumm, &piatomk.kat[piatomk.npiatom],
1943 &piatomk.q[piatomk.npiatom], &piatomk.ion[piatomk.npiatom], &piatomk.emz[piatomk.npiatom],
1944 &piatomk.zor[piatomk.npiatom],&piatomk.zz[piatomk.npiatom], &piatomk.w1[piatomk.npiatom],
1945 &piatomk.w2[piatomk.npiatom], &piatomk.w3[piatomk.npiatom],&piatomk.qp[piatomk.npiatom]);
1946 piatomk.npiatom++;
1947 } else if (strcmp(iptemp, "pibond40") == 0)
1948 {
1949 if (bondpk.npibond40 > 20 )
1950 {
1951 }
1952 bondpk.use_pibond40 = TRUE;
1953 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
1954 &bondpk.bk40[bondpk.npibond40], &bondpk.bl40[bondpk.npibond40], &bondpk.bmom40[bondpk.npibond40],
1955 &bondpk.sslop40[bondpk.npibond40], &bondpk.tslop40[bondpk.npibond40], &bondpk.tslop240[bondpk.npibond40]);
1956 numeral(ii,pa,3);
1957 numeral(kk,pb,3);
1958 strcpy(pt,pa);
1959 strcat(pt,pb);
1960 strcpy(bondpk.kb40[bondpk.npibond40],pt);
1961 bondpk.npibond40++;
1962 } else if (strcmp(iptemp, "pibond50") == 0)
1963 {
1964 if (bondpk.npibond50 > 20 )
1965 {
1966 }
1967 bondpk.use_pibond50 = TRUE;
1968 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
1969 &bondpk.bk50[bondpk.npibond50], &bondpk.bl50[bondpk.npibond50], &bondpk.bmom50[bondpk.npibond50],
1970 &bondpk.sslop50[bondpk.npibond50], &bondpk.tslop50[bondpk.npibond50], &bondpk.tslop250[bondpk.npibond50]);
1971 numeral(ii,pa,3);
1972 numeral(kk,pb,3);
1973 strcpy(pt,pa);
1974 strcat(pt,pb);
1975 strcpy(bondpk.kb50[bondpk.npibond50],pt);
1976 bondpk.npibond50++;
1977 } else if (strcmp(iptemp, "pibond60") == 0)
1978 {
1979 if (bondpk.npibond60 > 20 )
1980 {
1981 }
1982 bondpk.use_pibond60 = TRUE;
1983 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
1984 &bondpk.bk60[bondpk.npibond60], &bondpk.bl60[bondpk.npibond60], &bondpk.bmom60[bondpk.npibond60],
1985 &bondpk.sslop60[bondpk.npibond60], &bondpk.tslop60[bondpk.npibond60], &bondpk.tslop260[bondpk.npibond60]);
1986 numeral(ii,pa,3);
1987 numeral(kk,pb,3);
1988 strcpy(pt,pa);
1989 strcat(pt,pb);
1990 strcpy(bondpk.kb60[bondpk.npibond60],pt);
1991 bondpk.npibond60++;
1992 } else if (strcmp(iptemp, "pibond44i") == 0)
1993 {
1994 if (bondpk.npibond44i > 20 )
1995 {
1996 }
1997 bondpk.use_pibond44i = TRUE;
1998 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
1999 &bondpk.bk44i[bondpk.npibond44i], &bondpk.bl44i[bondpk.npibond44i], &bondpk.bmom44i[bondpk.npibond44i],
2000 &bondpk.sslop44i[bondpk.npibond44i], &bondpk.tslop44i[bondpk.npibond44i], &bondpk.tslop244i[bondpk.npibond44i]);
2001 numeral(ii,pa,3);
2002 numeral(kk,pb,3);
2003 strcpy(pt,pa);
2004 strcat(pt,pb);
2005 strcpy(bondpk.kb44i[bondpk.npibond44i],pt);
2006 bondpk.npibond44i++;
2007 } else if (strcmp(iptemp, "pibond45i") == 0)
2008 {
2009 if (bondpk.npibond45i > 20 )
2010 {
2011 }
2012 bondpk.use_pibond45i = TRUE;
2013 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2014 &bondpk.bk45i[bondpk.npibond45i], &bondpk.bl45i[bondpk.npibond45i], &bondpk.bmom45i[bondpk.npibond45i],
2015 &bondpk.sslop45i[bondpk.npibond45i], &bondpk.tslop45i[bondpk.npibond45i], &bondpk.tslop245i[bondpk.npibond45i]);
2016 numeral(ii,pa,3);
2017 numeral(kk,pb,3);
2018 strcpy(pt,pa);
2019 strcat(pt,pb);
2020 strcpy(bondpk.kb45i[bondpk.npibond45i],pt);
2021 bondpk.npibond45i++;
2022 } else if (strcmp(iptemp, "pibond46i") == 0)
2023 {
2024 if (bondpk.npibond46i > 20 )
2025 {
2026 }
2027 bondpk.use_pibond46i = TRUE;
2028 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2029 &bondpk.bk46i[bondpk.npibond46i], &bondpk.bl46i[bondpk.npibond46i], &bondpk.bmom46i[bondpk.npibond46i],
2030 &bondpk.sslop46i[bondpk.npibond46i], &bondpk.tslop46i[bondpk.npibond46i], &bondpk.tslop246i[bondpk.npibond46i]);
2031 numeral(ii,pa,3);
2032 numeral(kk,pb,3);
2033 strcpy(pt,pa);
2034 strcat(pt,pb);
2035 strcpy(bondpk.kb46i[bondpk.npibond46i],pt);
2036 bondpk.npibond46i++;
2037 } else if (strcmp(iptemp, "pibond55i") == 0)
2038 {
2039 if (bondpk.npibond55i > 20 )
2040 {
2041 }
2042 bondpk.use_pibond55i = TRUE;
2043 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2044 &bondpk.bk55i[bondpk.npibond55i], &bondpk.bl55i[bondpk.npibond55i], &bondpk.bmom55i[bondpk.npibond55i],
2045 &bondpk.sslop55i[bondpk.npibond55i], &bondpk.tslop55i[bondpk.npibond55i], &bondpk.tslop255i[bondpk.npibond55i]);
2046 numeral(ii,pa,3);
2047 numeral(kk,pb,3);
2048 strcpy(pt,pa);
2049 strcat(pt,pb);
2050 strcpy(bondpk.kb55i[bondpk.npibond55i],pt);
2051 bondpk.npibond55i++;
2052 } else if (strcmp(iptemp, "pibond56i") == 0)
2053 {
2054 if (bondpk.npibond56i > 20 )
2055 {
2056 }
2057 bondpk.use_pibond56i = TRUE;
2058 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2059 &bondpk.bk56i[bondpk.npibond56i], &bondpk.bl56i[bondpk.npibond56i], &bondpk.bmom56i[bondpk.npibond56i],
2060 &bondpk.sslop56i[bondpk.npibond56i], &bondpk.tslop56i[bondpk.npibond56i], &bondpk.tslop256i[bondpk.npibond56i]);
2061 numeral(ii,pa,3);
2062 numeral(kk,pb,3);
2063 strcpy(pt,pa);
2064 strcat(pt,pb);
2065 strcpy(bondpk.kb56i[bondpk.npibond56i],pt);
2066 bondpk.npibond56i++;
2067 } else if (strcmp(iptemp, "pibond66i") == 0)
2068 {
2069 if (bondpk.npibond66i > 20 )
2070 {
2071 }
2072 bondpk.use_pibond66i = TRUE;
2073 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2074 &bondpk.bk66i[bondpk.npibond66i], &bondpk.bl66i[bondpk.npibond66i], &bondpk.bmom66i[bondpk.npibond66i],
2075 &bondpk.sslop66i[bondpk.npibond66i], &bondpk.tslop66i[bondpk.npibond66i], &bondpk.tslop266i[bondpk.npibond66i]);
2076 numeral(ii,pa,3);
2077 numeral(kk,pb,3);
2078 strcpy(pt,pa);
2079 strcat(pt,pb);
2080 strcpy(bondpk.kb66i[bondpk.npibond66i],pt);
2081 bondpk.npibond66i++;
2082 } else if (strcmp(iptemp, "pibond44o") == 0)
2083 {
2084 if (bondpk.npibond44o > 20 )
2085 {
2086 }
2087 bondpk.use_pibond44o = TRUE;
2088 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2089 &bondpk.bk44o[bondpk.npibond44o], &bondpk.bl44o[bondpk.npibond44o], &bondpk.bmom44o[bondpk.npibond44o],
2090 &bondpk.sslop44o[bondpk.npibond44o], &bondpk.tslop44o[bondpk.npibond44o], &bondpk.tslop244o[bondpk.npibond44o]);
2091 numeral(ii,pa,3);
2092 numeral(kk,pb,3);
2093 strcpy(pt,pa);
2094 strcat(pt,pb);
2095 strcpy(bondpk.kb44o[bondpk.npibond44o],pt);
2096 bondpk.npibond44o++;
2097 } else if (strcmp(iptemp, "pibond45o") == 0)
2098 {
2099 if (bondpk.npibond45o > 20 )
2100 {
2101 }
2102 bondpk.use_pibond45o = TRUE;
2103 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2104 &bondpk.bk45o[bondpk.npibond45o], &bondpk.bl45o[bondpk.npibond45o], &bondpk.bmom45o[bondpk.npibond45o],
2105 &bondpk.sslop45o[bondpk.npibond45o], &bondpk.tslop45o[bondpk.npibond45o], &bondpk.tslop245o[bondpk.npibond45o]);
2106 numeral(ii,pa,3);
2107 numeral(kk,pb,3);
2108 strcpy(pt,pa);
2109 strcat(pt,pb);
2110 strcpy(bondpk.kb45o[bondpk.npibond45o],pt);
2111 bondpk.npibond45o++;
2112 } else if (strcmp(iptemp, "pibond46o") == 0)
2113 {
2114 if (bondpk.npibond46o > 20 )
2115 {
2116 }
2117 bondpk.use_pibond46o = TRUE;
2118 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2119 &bondpk.bk46o[bondpk.npibond46o], &bondpk.bl46o[bondpk.npibond46o], &bondpk.bmom46o[bondpk.npibond46o],
2120 &bondpk.sslop46o[bondpk.npibond46o], &bondpk.tslop46o[bondpk.npibond46o], &bondpk.tslop246o[bondpk.npibond46o]);
2121 numeral(ii,pa,3);
2122 numeral(kk,pb,3);
2123 strcpy(pt,pa);
2124 strcat(pt,pb);
2125 strcpy(bondpk.kb46o[bondpk.npibond46o],pt);
2126 bondpk.npibond46o++;
2127 } else if (strcmp(iptemp, "pibond55o") == 0)
2128 {
2129 if (bondpk.npibond55o > 20 )
2130 {
2131 }
2132 bondpk.use_pibond55o = TRUE;
2133 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2134 &bondpk.bk55o[bondpk.npibond55o], &bondpk.bl55o[bondpk.npibond55o], &bondpk.bmom55o[bondpk.npibond55o],
2135 &bondpk.sslop55o[bondpk.npibond55o], &bondpk.tslop55o[bondpk.npibond55o], &bondpk.tslop255o[bondpk.npibond55o]);
2136 numeral(ii,pa,3);
2137 numeral(kk,pb,3);
2138 strcpy(pt,pa);
2139 strcat(pt,pb);
2140 strcpy(bondpk.kb55o[bondpk.npibond55o],pt);
2141 bondpk.npibond55o++;
2142 } else if (strcmp(iptemp, "pibond56o") == 0)
2143 {
2144 if (bondpk.npibond56o > 20 )
2145 {
2146 }
2147 bondpk.use_pibond56o = TRUE;
2148 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2149 &bondpk.bk56o[bondpk.npibond56o], &bondpk.bl56o[bondpk.npibond56o], &bondpk.bmom56o[bondpk.npibond56o],
2150 &bondpk.sslop56o[bondpk.npibond56o], &bondpk.tslop56o[bondpk.npibond56o], &bondpk.tslop256o[bondpk.npibond56o]);
2151 numeral(ii,pa,3);
2152 numeral(kk,pb,3);
2153 strcpy(pt,pa);
2154 strcat(pt,pb);
2155 strcpy(bondpk.kb56o[bondpk.npibond56o],pt);
2156 bondpk.npibond56o++;
2157 } else if (strcmp(iptemp, "pibond66o") == 0)
2158 {
2159 if (bondpk.npibond66o > 20 )
2160 {
2161 }
2162 bondpk.use_pibond66o = TRUE;
2163 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2164 &bondpk.bk66o[bondpk.npibond66o], &bondpk.bl66o[bondpk.npibond66o], &bondpk.bmom66o[bondpk.npibond66o],
2165 &bondpk.sslop66o[bondpk.npibond66o], &bondpk.tslop66o[bondpk.npibond66o], &bondpk.tslop266o[bondpk.npibond66o]);
2166 numeral(ii,pa,3);
2167 numeral(kk,pb,3);
2168 strcpy(pt,pa);
2169 strcat(pt,pb);
2170 strcpy(bondpk.kb66o[bondpk.npibond66o],pt);
2171 bondpk.npibond66o++;
2172 } else if (strcmp(iptemp, "pibond") == 0)
2173 {
2174 if (bondpk.npibond > MAXPIBONDCONST )
2175 {
2176 }
2177 bondpk.use_pibond = TRUE;
2178 sscanf(line,"%s %d %d %f %f %f %f %f %f",dumm, &ii, &kk,
2179 &bondpk.bk[bondpk.npibond], &bondpk.bl[bondpk.npibond], &bondpk.bmom[bondpk.npibond],
2180 &bondpk.sslop[bondpk.npibond], &bondpk.tslop[bondpk.npibond], &bondpk.tslop2[bondpk.npibond]);
2181 numeral(ii,pa,3);
2182 numeral(kk,pb,3);
2183 strcpy(pt,pa);
2184 strcat(pt,pb);
2185 strcpy(bondpk.kb[bondpk.npibond],pt);
2186 bondpk.npibond++;
2187 } else if (strcmp(iptemp, "picorrect") == 0)
2188 {
2189 sscanf(line,"%s %f %f %f %f",dumm,&picorrect.fudge1,&picorrect.fudge2,&picorrect.fudge3,
2190 &picorrect.fudge4);
2191 } else if (strcmp(iptemp,"piangle") == 0)
2192 {
2193 if (angkp1.npiang > MAXPIANGCONST)
2194 {
2195 }
2196 sscanf(line,"%s %d %d %d %f %f %f %f",dumm,&kt1,&kt2,&kt3,&angkp1.pacon[angkp1.npiang],
2197 &angkp1.panat[angkp1.npiang][0],&angkp1.panat[angkp1.npiang][1],&angkp1.panat[angkp1.npiang][1]);
2198 numeral(kt1,pa,3);
2199 numeral(kt2,pb,3);
2200 numeral(kt3,pc,3);
2201 strcpy(pt,pa);
2202 strcat(pt,pb); strcat(pt,pc);
2203 strcpy(angkp1.kpa[angkp1.npiang],pt);
2204 angkp1.npiang++;
2205 } else if (strcmp(iptemp,"dipole") == 0)
2206 {
2207 if (dipole_k.ndipole > MAXBONDCONST)
2208 {
2209 message_alert("Error - Too many bond dipoles","Read Parameter");
2210 fprintf(stderr,"Maximum number of bond dipole constants exceeded. Others will be ignored\n");
2211 //fclose(datafile);
2212 return;
2213 }
2214 sscanf( line,"%s %d %d %f",dumm, &ii, &kk, &radius);
2215 numeral(ii,pa,3);
2216 numeral(kk,pb,3);
2217 strcpy(pt,pa); strcat(pt,pb);
2218 strcpy(dipole_k.kb[dipole_k.ndipole],pt);
2219 dipole_k.bmom[dipole_k.ndipole] = radius;
2220 dipole_k.ndipole++;
2221 } else if (strcmp(iptemp, "charge") == 0)
2222 {
2223 if (charge_k.ncharge > MAXATOMTYPE)
2224 {
2225 message_alert("Error - Too many atom charges","Read Parameter");
2226 fprintf(stderr,"Maximum number of atom charge constants exceeded. Others will be ignored\n");
2227 //fclose(datafile);
2228 return;
2229 }
2230 sscanf( line,"%s %d %f", dumm, &charge_k.type[charge_k.ncharge], &charge_k.charge[charge_k.ncharge]);
2231 charge_k.ncharge++;
2232 } else if (strcmp(iptemp, "oplschrg") == 0)
2233 {
2234 if (oplschrg_k.ncharge > MAXOPLS)
2235 {
2236 message_alert("Error - Too many opls charges","Read Parameter");
2237 fprintf(stderr,"Maximum number of opls charge constants exceeded. Others will be ignored\n");
2238 //fclose(datafile);
2239 return;
2240 }
2241 sscanf(line,"%s %d %f %s\n",dumm,&oplschrg_k.type[oplschrg_k.ncharge],&oplschrg_k.chrg[oplschrg_k.ncharge],
2242 oplschrg_k.chrgstring[oplschrg_k.ncharge]);
2243 oplschrg_k.ncharge++;
2244 } else if (strcmp(iptemp, "amberchrg") == 0)
2245 {
2246 if (amberchrg_k.ncharge > MAXATOMTYPE)
2247 {
2248 message_alert("Error - Too many amber charges","Read Parameter");
2249 fprintf(stderr,"Maximum number of amber charge constants exceeded. Others will be ignored\n");
2250 //fclose(datafile);
2251 return;
2252 }
2253 for (iz=0;iz < 25; iz++) descript[iz] = ' ';
2254
2255 sscanf(line,"%s %d %f %s %25c",dumm,&amberchrg_k.type[amberchrg_k.ncharge],
2256 &amberchrg_k.chrg[amberchrg_k.ncharge],amberchrg_k.symbol[amberchrg_k.ncharge], descript);
2257 for (iz=24; iz > 0; iz--)
2258 {
2259 if ( isalpha(descript[iz]) != 0)
2260 {
2261 descript[iz+1] = '\0';
2262 break;
2263 }
2264 }
2265 if (strcmp(descript,"Glycine") == 0)
2266 amberchrg_k.res_type[amberchrg_k.ncharge] = GLY;
2267 else if (strcmp(descript,"Alanine") == 0)
2268 amberchrg_k.res_type[amberchrg_k.ncharge] = ALA;
2269 else if (strcmp(descript,"Valine") == 0)
2270 amberchrg_k.res_type[amberchrg_k.ncharge] = VAL;
2271 else if (strcmp(descript,"Leucine") == 0)
2272 amberchrg_k.res_type[amberchrg_k.ncharge] = LEU;
2273 else if (strcmp(descript,"Isoleucine") == 0)
2274 amberchrg_k.res_type[amberchrg_k.ncharge] = ILE;
2275 else if (strcmp(descript,"Serine") == 0)
2276 amberchrg_k.res_type[amberchrg_k.ncharge] = SER;
2277 else if (strcmp(descript,"Threonine") == 0)
2278 amberchrg_k.res_type[amberchrg_k.ncharge] = THR;
2279 else if (strcmp(descript,"Cysteine (-SH") == 0)
2280 amberchrg_k.res_type[amberchrg_k.ncharge] = CYSH;
2281 else if (strcmp(descript,"Cystine (-SS") == 0)
2282 amberchrg_k.res_type[amberchrg_k.ncharge] = CYS;
2283 else if (strcmp(descript,"Proline") == 0)
2284 amberchrg_k.res_type[amberchrg_k.ncharge] = PRO;
2285 else if (strcmp(descript,"Phenylalanine") == 0)
2286 amberchrg_k.res_type[amberchrg_k.ncharge] = PHE;
2287 else if (strcmp(descript,"Tyrosine") == 0)
2288 amberchrg_k.res_type[amberchrg_k.ncharge] = TYR;
2289 else if (strcmp(descript,"Tryptophan") == 0)
2290 amberchrg_k.res_type[amberchrg_k.ncharge] = TRP;
2291 else if (strcmp(descript,"Histidine") == 0)
2292 amberchrg_k.res_type[amberchrg_k.ncharge] = HISP;
2293 else if (strcmp(descript,"Histidine (HD") == 0)
2294 amberchrg_k.res_type[amberchrg_k.ncharge] = HIS;
2295 else if (strcmp(descript,"Histidine (HE") == 0)
2296 amberchrg_k.res_type[amberchrg_k.ncharge] = HISE;
2297 else if (strcmp(descript,"Aspartic Acid") == 0)
2298 amberchrg_k.res_type[amberchrg_k.ncharge] = ASP;
2299 else if (strcmp(descript,"Asparagine") == 0)
2300 amberchrg_k.res_type[amberchrg_k.ncharge] = ASN;
2301 else if (strcmp(descript,"Glutamic Acid") == 0)
2302 amberchrg_k.res_type[amberchrg_k.ncharge] = GLU;
2303 else if (strcmp(descript,"Glutamine") == 0)
2304 amberchrg_k.res_type[amberchrg_k.ncharge] = GLN;
2305 else if (strcmp(descript,"Methionine") == 0)
2306 amberchrg_k.res_type[amberchrg_k.ncharge] = MET;
2307 else if (strcmp(descript,"Lysine") == 0)
2308 amberchrg_k.res_type[amberchrg_k.ncharge] = LYS;
2309 else if (strcmp(descript,"Arginine") == 0)
2310 amberchrg_k.res_type[amberchrg_k.ncharge] = ARG;
2311 else
2312 amberchrg_k.res_type[amberchrg_k.ncharge] = UNK;
2313 amberchrg_k.ncharge++;
2314 } else if (strcmp(iptemp, "mmffchrg") == 0)
2315 {
2316 if (charge_k.ncharge > MAXATOMTYPE)
2317 {
2318 message_alert("Error - Too many atom charges","Read Parameter");
2319 fprintf(stderr,"Maximum number of atom charge constants exceeded. Others will be ignored\n");
2320 //fclose(datafile);
2321 return;
2322 }
2323 sscanf( line,"%s %d %f %f %f", dumm, &i, &charge, &fchrg, &tchrg);
2324 charge_k.type[i] = i;
2325 charge_k.charge[i] = charge;
2326 charge_k.formchrg[i] = fchrg;
2327 charge_k.typechrg[i] = tchrg;
2328 } else if (strcmp(iptemp,"bndchrgdel") == 0)
2329 {
2330 if (charge_k.nbndchrgdel > MAXBONDCONST)
2331 {
2332 message_alert("Error - Too many bond charges","Read Parameter");
2333 fprintf(stderr,"Maximum number of bond charge constants exceeded. Others will be ignored\n");
2334 //fclose(datafile);
2335 return;
2336 }
2337 sscanf(line,"%s %d %d %f",dumm,&kp1,&kp2,&charge_k.bchargedel[charge_k.nbndchrgdel]);
2338 charge_k.btypedel[charge_k.nbndchrgdel] = kp1*100+kp2;
2339 charge_k.nbndchrgdel++;
2340 } else if (strcmp(iptemp,"bndchrg") == 0)
2341 {
2342 if (charge_k.nbndchrg > MAXBONDCONST)
2343 {
2344 message_alert("Error - Too many bond charges","Read Parameter");
2345 fprintf(stderr,"Maximum number of bond charge constants exceeded. Others will be ignored\n");
2346 //fclose(datafile);
2347 return;
2348 }
2349 sscanf(line,"%s %d %d %f",dumm,&kp1,&kp2,&charge_k.bcharge[charge_k.nbndchrg]);
2350 charge_k.btype[charge_k.nbndchrg] = kp1*100+kp2;
2351 charge_k.nbndchrg++;
2352 } else if (strcmp(iptemp,"vdwmmff") == 0)
2353 {
2354 if (vdw1.nvdw > MAXVDWCONST)
2355 {
2356 message_alert("Error - Too many vdw constants","Read Parameter");
2357 fprintf(stderr,"Maximum number of vdw constants exceeded. Others will be ignored\n");
2358 //fclose(datafile);
2359 return;
2360 }
2361 sscanf( line, "%s %d %f %f %f %f %s", dumm, &i, &alpha, &ntmp, &atmp, &gtmp, symbol);
2362 vdw1.alpha[i] = alpha;
2363 vdw1.n[i] = ntmp;
2364 vdw1.a[i] = atmp;
2365 vdw1.g[i] = gtmp;
2366 strcpy(vdw1.da[i],symbol);
2367 vdw1.nvdw++;
2368 } else if( strcmp(iptemp,"vdw") == 0 )
2369 {
2370 if (vdw1.nvdw > MAXVDWCONST)
2371 {
2372 message_alert("Error - Too many vdw constants","Read Parameter");
2373 fprintf(stderr,"Maximum number of vdw constants exceeded. Others will be ignored\n");
2374 //fclose(datafile);
2375 return;
2376 }
2377 sscanf( line, "%s %d %f %f %d %d %d", dumm, &i, &radius, &epsilon, &lpde, &ihtype, &ihdonor);
2378
2379 vdw1.rad[i] = radius;
2380 vdw1.eps[i] = epsilon;
2381 vdw1.lpd[i] = lpde;
2382 vdw1.ihdon[i] = ihdonor;
2383 vdw1.ihtyp[i] = ihtype;
2384 vdw1.nvdw++;
2385 }
2386 /* torsion read */
2387 else if( strcmp(iptemp,"torsion4") == 0 )
2388 {
2389 if (torkn1.ntor4 >= MAXTOR4CONST)
2390 {
2391 message_alert("Error - Too many torsion 4 constants","Read Parameter");
2392 fprintf(stderr,"Maximum number of torsion 4 constants exceeded. Others will be ignored\n");
2393 //fclose(datafile);
2394 return;
2395 }
2396 for(i=0; i < 6; i++)
2397 v1[i] = se1[i] = 0.0;
2398 iz = sscanf(line, "%s %d %d %d %d %f %d %f %d %f %d %f %d %f %d %f %d", dumm, &kp1,
2399 &kp2, &kp3, &kp4 ,
2400 &v1[0], &se1[0],&v1[1], &se1[1],&v1[2], &se1[2],
2401 &v1[3], &se1[3],&v1[4], &se1[4],&v1[5], &se1[5]);
2402 torphase(6, v1, se1);
2403 torkn1.tv41[torkn1.ntor4] = v1[0];
2404 torkn1.tv42[torkn1.ntor4] = v1[1];
2405 torkn1.tv43[torkn1.ntor4] = v1[2];
2406 torkn1.phase41[torkn1.ntor4] = se1[0];
2407 torkn1.phase42[torkn1.ntor4] = se1[1];
2408 torkn1.phase43[torkn1.ntor4] = se1[2];
2409
2410 numeral(kp1,pa,3);
2411 numeral(kp2,pb,3);
2412 numeral(kp3,pc,3);
2413 numeral(kp4,pd,3);
2414 strcpy(ptor,pa);
2415 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2416 strcpy(torkn1.kv4[torkn1.ntor4],ptor);
2417 torkn1.ntor4++;
2418 }else if( strcmp(iptemp,"torsion5") == 0 )
2419 {
2420 if (torkn1.ntor5 >= MAXTOR5CONST)
2421 {
2422 message_alert("Error - Too many torsion 5 constants","Read Parameter");
2423 fprintf(stderr,"Maximum number of torsion 5 constants exceeded. Others will be ignored\n");
2424 //fclose(datafile);
2425 return;
2426 }
2427 for(i=0; i < 6; i++)
2428 v1[i] = se1[i] = 0.0;
2429 iz = sscanf(line, "%s %d %d %d %d %f %d %f %d %f %d %f %d %f %d %f %d", dumm, &kp1,
2430 &kp2, &kp3, &kp4 ,
2431 &v1[0], &se1[0],&v1[1], &se1[1],&v1[2], &se1[2],
2432 &v1[3], &se1[3],&v1[4], &se1[4],&v1[5], &se1[5]);
2433 torphase(6, v1, se1);
2434 torkn1.tv51[torkn1.ntor5] = v1[0];
2435 torkn1.tv52[torkn1.ntor5] = v1[1];
2436 torkn1.tv53[torkn1.ntor5] = v1[2];
2437 torkn1.phase51[torkn1.ntor5] = se1[0];
2438 torkn1.phase52[torkn1.ntor5] = se1[1];
2439 torkn1.phase53[torkn1.ntor5] = se1[2];
2440 numeral(kp1,pa,3);
2441 numeral(kp2,pb,3);
2442 numeral(kp3,pc,3);
2443 numeral(kp4,pd,3);
2444 strcpy(ptor,pa);
2445 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2446 strcpy(torkn1.kv5[torkn1.ntor5],ptor);
2447 torkn1.ntor5++;
2448 }else if( strcmp(iptemp,"torsiondel") == 0 )
2449 {
2450 if (torkn1.ntordel >= MAXTORDEL)
2451 {
2452 message_alert("Error - Too many delocalized torsion constants","Read Parameter");
2453 fprintf(stderr,"Maximum number of delocalized torsion constants exceeded. Others will be ignored\n");
2454 //fclose(datafile);
2455 return;
2456 }
2457 for(i=0; i < 6; i++)
2458 v1[i] = se1[i] = 0.0;
2459 iz = sscanf(line, "%s %d %d %d %d %d %f %d %f %d %f %d %f %d %f %d %f %d", dumm, &torkn1.torindex[torkn1.ntordel],
2460 &kp1, &kp2, &kp3, &kp4 ,
2461 &v1[0], &se1[0],&v1[1], &se1[1],&v1[2], &se1[2],
2462 &v1[3], &se1[3],&v1[4], &se1[4],&v1[5], &se1[5]);
2463 torphase(6, v1, se1);
2464 torkn1.tvdel1[torkn1.ntordel] = v1[0];
2465 torkn1.tvdel2[torkn1.ntordel] = v1[1];
2466 torkn1.tvdel3[torkn1.ntordel] = v1[2];
2467 torkn1.phasedel1[torkn1.ntordel] = se1[0];
2468 torkn1.phasedel2[torkn1.ntordel] = se1[1];
2469 torkn1.phasedel3[torkn1.ntordel] = se1[2];
2470 numeral(kp1,pa,3);
2471 numeral(kp2,pb,3);
2472 numeral(kp3,pc,3);
2473 numeral(kp4,pd,3);
2474 strcpy(ptor,pa);
2475 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2476 strcpy(torkn1.kvdel[torkn1.ntordel],ptor);
2477 torkn1.ntordel++;
2478 }else if( strcmp(iptemp, "torsion") == 0 )
2479 {
2480 if (torkn1.ntor >= MAXTORCONST)
2481 {
2482 message_alert("Error - Too many torsion constants","Read Parameter");
2483 fprintf(stderr,"Maximum number of torsion constants exceeded. Others will be ignored\n");
2484 //fclose(datafile);
2485 return;
2486 }
2487 for(i=0; i < 6; i++)
2488 v1[i] = se1[i] = 0.0;
2489
2490 sscanf( line, "%s %d %d %d %d %f %d %f %d %f %d %f %d %f %d %f %d", dumm,
2491 &kp1, &kp2, &kp3, &kp4,
2492 &v1[0], &se1[0],&v1[1], &se1[1],&v1[2], &se1[2],
2493 &v1[3], &se1[3],&v1[4], &se1[4],&v1[5], &se1[5]);
2494 torphase(6, v1, se1);
2495 torkn1.tv1[torkn1.ntor] = v1[0];
2496 torkn1.phase1[torkn1.ntor] = se1[0];
2497 torkn1.tv2[torkn1.ntor] = v1[1];
2498 torkn1.phase2[torkn1.ntor] = se1[1];
2499 torkn1.tv3[torkn1.ntor] = v1[2];
2500 torkn1.phase3[torkn1.ntor] = se1[2];
2501 torkn1.tv4[torkn1.ntor] = v1[3];
2502 torkn1.phase4[torkn1.ntor] = se1[3];
2503 torkn1.tv5[torkn1.ntor] = v1[4];
2504 torkn1.phase5[torkn1.ntor] = se1[4];
2505 torkn1.tv6[torkn1.ntor] = v1[5];
2506 torkn1.phase6[torkn1.ntor] = se1[5];
2507 numeral(kp1,pa,3);
2508 numeral(kp2,pb,3);
2509 numeral(kp3,pc,3);
2510 numeral(kp4,pd,3);
2511 strcpy(ptor,pa);
2512 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2513 strcpy(torkn1.kv[torkn1.ntor],ptor);
2514
2515 // torkn1.kv[torkn1.ntor] = ((kp1*100 + kp2)*100 + kp3)*100 + kp4;
2516 torkn1.ntor++;
2517 }else if (strcmp(iptemp, "pitorsion") == 0)
2518 {
2519 if (torknp.npitor > MAXPITORCONST)
2520 {
2521 }
2522 sscanf( line,"%s %d %d %d %d %f %d %f %d %f %d", dumm, &kp1, &kp2, &kp3, &kp4,
2523 &v1[0], &se1[0], &v1[1], &se1[1], &v1[2], &se1[2]);
2524
2525 torphase(3, v1,se1);
2526 torknp.tv1[torknp.npitor] = v1[0];
2527 torknp.ph1[torknp.npitor] = se1[0];
2528 torknp.tv2[torknp.npitor] = v1[1];
2529 torknp.ph2[torknp.npitor] = se1[1];
2530 torknp.tv3[torknp.npitor] = v1[2];
2531 torknp.ph3[torknp.npitor] = se1[2];
2532 numeral(kp1,pa,3);
2533 numeral(kp2,pb,3);
2534 numeral(kp3,pc,3);
2535 numeral(kp4,pd,3);
2536 strcpy(ptor,pa);
2537 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2538 strcpy(torknp.kv[torknp.npitor],ptor);
2539 // torknp.kv[torknp.npitor] = ((kp1*100 + kp2)*100 + kp3)*100 + kp4;
2540 torknp.npitor++;
2541 } else if( strcmp(iptemp, "imptors") == 0)
2542 {
2543 if (improptor_k.nimptor >= MAXIMP)
2544 {
2545 message_alert("Error - Too many improper torsion constants","Read Parameter");
2546 fprintf(stderr,"Maximum number of improper torsion constants exceeded. Others will be ignored\n");
2547 //fclose(datafile);
2548 return;
2549 }
2550 sscanf( line, "%s %d %d %d %d %f %d %f %d %f %d", dumm,
2551 &kp1, &kp2, &kp3, &kp4,
2552 &v1[0], &se1[0], &v1[1], &se1[1], &v1[2], &se1[2]);
2553 torphase(3,v1,se1);
2554 improptor_k.v1[improptor_k.nimptor] = v1[0];
2555 improptor_k.v2[improptor_k.nimptor] = v1[1];
2556 improptor_k.v3[improptor_k.nimptor] = v1[2];
2557 improptor_k.ph1[improptor_k.nimptor] = se1[0];
2558 improptor_k.ph2[improptor_k.nimptor] = se1[1];
2559 improptor_k.ph3[improptor_k.nimptor] = se1[2];
2560 numeral(kp1,pa,3);
2561 numeral(kp2,pb,3);
2562 numeral(kp3,pc,3);
2563 numeral(kp4,pd,3);
2564 strcpy(ptor,pa);
2565 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2566 strcpy(improptor_k.kv[improptor_k.nimptor],ptor);
2567 // improptor_k.kv[improptor_k.nimptor] = ((kp1*100 + kp2)*100 + kp3)*100 + kp4;
2568 improptor_k.nimptor++;
2569
2570 } else if( strcmp(iptemp, "improper") == 0)
2571 {
2572 if (improptor_k.nimptor >= MAXIMP)
2573 {
2574 message_alert("Error - Too many improper torsion constants","Read Parameter");
2575 fprintf(stderr,"Maximum number of improper torsion constants exceeded. Others will be ignored\n");
2576 //fclose(datafile);
2577 return;
2578 }
2579 sscanf( line, "%s %d %d %d %d %f %f", dumm,
2580 &kp1, &kp2, &kp3, &kp4,
2581 &improptor_k.cimptor[improptor_k.nimptor], &improptor_k.tdi[improptor_k.nimptor]);
2582 numeral(kp1,pa,3);
2583 numeral(kp2,pb,3);
2584 numeral(kp3,pc,3);
2585 numeral(kp4,pd,3);
2586 strcpy(ptor,pa);
2587 strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2588 strcpy(improptor_k.kv[improptor_k.nimptor],ptor);
2589 improptor_k.nimptor++;
2590 } else if( strcmp(iptemp, "ureybrad") == 0)
2591 {
2592 if (ureybrad_k.nurey_brad > MAXUREY)
2593 {
2594 message_alert("Error - Too many UreyBrad constants","Read Parameter");
2595 fprintf(stderr,"Maximum number of ureybradley constants exceeded. Others will be ignored\n");
2596 //fclose(datafile);
2597 return;
2598 }
2599 sscanf(line, "%s %d %d %d %f %f",dumm,
2600 &kp1, &kp2, &kp3, &ureybrad_k.ubconst[ureybrad_k.nurey_brad],
2601 &ureybrad_k.ubdist[ureybrad_k.nurey_brad]);
2602 numeral(kp1,pa,3);
2603 numeral(kp2,pb,3);
2604 numeral(kp3,pc,3);
2605 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2606 strcpy(ureybrad_k.kubang[ureybrad_k.nurey_brad],pang);
2607 ureybrad_k.nurey_brad++;
2608 } else if (strcmp(iptemp, "anglef") == 0)
2609 {
2610 sscanf(line,"%s %d %d %d %f %f %f %f %f %f %f %f",dumm, &kt1,&kt2,&kt3, &angf.fcon[angf.nfang],
2611 &angf.fc0[angf.nfang],&angf.fc1[angf.nfang],&angf.fc2[angf.nfang],&angf.fc3[angf.nfang],
2612 &angf.fc4[angf.nfang],&angf.fc5[angf.nfang],&angf.fc6[angf.nfang]);
2613 numeral(kt1,pa,3);
2614 numeral(kt2,pb,3);
2615 numeral(kt3,pc,3);
2616 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2617 strcpy(angf.kftype[angf.nfang],pang);
2618 angf.nfang++;
2619 } else if( strcmp(iptemp, "angle5") == 0 )
2620 {
2621 if (angk1.nang5 >= MAXANG5CONST)
2622 {
2623 message_alert("Error - Too many angle 5 constants","Read Parameter");
2624 fprintf(stderr,"Maximum number of angle 5 constants exceeded. Others will be ignored\n");
2625 //fclose(datafile);
2626 return;
2627 }
2628 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2629 &kt1, &kt2, &kt3, &angk1.con5[angk1.nang5], &angk1.ang5[angk1.nang5][0],
2630 &angk1.ang5[angk1.nang5][1], &angk1.ang5[angk1.nang5][2] );
2631 numeral(kt1,pa,3);
2632 numeral(kt2,pb,3);
2633 numeral(kt3,pc,3);
2634 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2635 strcpy(angk1.ktype5[angk1.nang5],pang);
2636 angk1.nang5++;
2637 } else if( strcmp(iptemp, "angle4") == 0 )
2638 {
2639 if (angk1.nang4 >= MAXANG4CONST)
2640 {
2641 message_alert("Error - Too many angle 4 constants","Read Parameter");
2642 fprintf(stderr,"Maximum number of angle 4 constants exceeded. Others will be ignored\n");
2643 //fclose(datafile);
2644 return;
2645 }
2646 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2647 &kt1, &kt2, &kt3, &angk1.con4[angk1.nang4], &angk1.ang4[angk1.nang4][0],
2648 &angk1.ang4[angk1.nang4][1], &angk1.ang4[angk1.nang4][2] );
2649 numeral(kt1,pa,3);
2650 numeral(kt2,pb,3);
2651 numeral(kt3,pc,3);
2652 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2653 strcpy(angk1.ktype4[angk1.nang4],pang);
2654 angk1.nang4++;
2655 } else if( strcmp(iptemp, "angle3") == 0 )
2656 {
2657 if (angk1.nang3 >= MAXANG3CONST )
2658 {
2659 message_alert("Error - Too many angle 3 constants","Read Parameter");
2660 fprintf(stderr,"Maximum number of angle 3 constants exceeded. Others will be ignored\n");
2661 //fclose(datafile);
2662 return;
2663 }
2664 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2665 &kt1, &kt2, &kt3, &angk1.con3[angk1.nang3], &angk1.ang3[angk1.nang3][0],
2666 &angk1.ang3[angk1.nang3][1], &angk1.ang3[angk1.nang3][2] );
2667 numeral(kt1,pa,3);
2668 numeral(kt2,pb,3);
2669 numeral(kt3,pc,3);
2670 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2671 strcpy(angk1.ktype3[angk1.nang3],pang);
2672 angk1.nang3++;
2673 } else if( strcmp(iptemp, "angle") == 0 )
2674 {
2675 if (angk1.nang >= MAXANGCONST)
2676 {
2677 message_alert("Error - Too many angle constants","Read Parameter");
2678 fprintf(stderr,"Maximum number of angle constants exceeded. Others will be ignored\n");
2679 //fclose(datafile);
2680 return;
2681 }
2682 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2683 &kt1, &kt2, &kt3, &angk1.con[angk1.nang], &angk1.ang[angk1.nang][0],
2684 &angk1.ang[angk1.nang][1], &angk1.ang[angk1.nang][2] );
2685 numeral(kt1,pa,3);
2686 numeral(kt2,pb,3);
2687 numeral(kt3,pc,3);
2688 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2689 strcpy(angk1.ktype[angk1.nang],pang);
2690 angk1.nang++;
2691 } else if( strcmp(iptemp, "angdel") == 0 )
2692 {
2693 if (angk1.ndel >= MAXANGDEL)
2694 {
2695 message_alert("Error - Too many delocalized angle constants","Read Parameter");
2696 fprintf(stderr,"Maximum number of delocalized angle constants exceeded. Others will be ignored\n");
2697 //fclose(datafile);
2698 return;
2699 }
2700 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2701 &kt1, &kt2, &kt3, &angk1.condel[angk1.ndel], &angk1.angdel[angk1.ndel][0],
2702 &angk1.angdel[angk1.ndel][1], &angk1.angdel[angk1.ndel][2] );
2703 numeral(kt1,pa,3);
2704 numeral(kt2,pb,3);
2705 numeral(kt3,pc,3);
2706 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2707 strcpy(angk1.kdel[angk1.ndel],pang);
2708 angk1.ndel++;
2709 } else if( strcmp(iptemp, "ang3del") == 0 )
2710 {
2711 if (angk1.ndel3 >= MAXANG3DEL)
2712 {
2713 message_alert("Error - Too many delocalized angle constants","Read Parameter");
2714 fprintf(stderr,"Maximum number of delocalized angle constants exceeded. Others will be ignored\n");
2715 //fclose(datafile);
2716 return;
2717 }
2718 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2719 &kt1, &kt2, &kt3, &angk1.condel3[angk1.ndel3], &angk1.angdel3[angk1.ndel3][0],
2720 &angk1.angdel3[angk1.ndel3][1], &angk1.angdel3[angk1.ndel3][2] );
2721 numeral(kt1,pa,3);
2722 numeral(kt2,pb,3);
2723 numeral(kt3,pc,3);
2724 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2725 strcpy(angk1.kdel3[angk1.ndel3],pang);
2726 angk1.ndel3++;
2727 } else if( strcmp(iptemp, "ang4del") == 0 )
2728 {
2729 if (angk1.ndel4 >= MAXANG4DEL)
2730 {
2731 message_alert("Error - Too many delocalized angle constants","Read Parameter");
2732 fprintf(stderr,"Maximum number of delocalized angle constants exceeded. Others will be ignored\n");
2733 //fclose(datafile);
2734 return;
2735 }
2736 sscanf( line, "%s %d %d %d %f %f %f %f", dumm,
2737 &kt1, &kt2, &kt3, &angk1.condel4[angk1.ndel4], &angk1.angdel4[angk1.ndel4][0],
2738 &angk1.angdel4[angk1.ndel4][1], &angk1.angdel4[angk1.ndel4][2] );
2739 numeral(kt1,pa,3);
2740 numeral(kt2,pb,3);
2741 numeral(kt3,pc,3);
2742 strcpy(pang,pa); strcat(pang,pb); strcat(pang,pc);
2743 strcpy(angk1.kdel4[angk1.ndel4],pang);
2744 angk1.ndel4++;
2745 } else if( strcmp(iptemp, "opbend") == 0 )
2746 {
2747 if (ooplane_k.nopbend >= MAXOOP)
2748 {
2749 message_alert("Error - Too many out of plane bending constants","Read Parameter");
2750 fprintf(stderr,"Maximum number of out of plane bend constants exceeded. Others will be ignored\n");
2751 //fclose(datafile);
2752 return;
2753 }
2754 sscanf( line, "%s %d %d %d %d %f", dumm, &kp1, &kp2, &kp3,&kp4,
2755 &ooplane_k.copb[ooplane_k.nopbend] );
2756 numeral(kp1,pa,3);
2757 numeral(kp2,pb,3);
2758 numeral(kp3,pc,3);
2759 numeral(kp4,pd,3);
2760 strcpy(ptor,pa); strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2761 strcpy(ooplane_k.iopb[ooplane_k.nopbend],ptor);
2762 ooplane_k.nopbend++;
2763 } else if (strcmp(iptemp, "strbnd") == 0)
2764 {
2765 if (crossterm_k.nstrbnd > MAXSTBN)
2766 {
2767 message_alert("Error - Too many str bend constants","Read Parameter");
2768 fprintf(stderr,"Maximum number of str bend constants exceeded. Others will be ignored\n");
2769 //fclose(datafile);
2770 return;
2771 }
2772 kp4 = 0;
2773 sscanf(line,"%s %d %d %d %f %f %f %d",dumm, &kp1, &kp2, &kp3,
2774 &crossterm_k.stbncon[crossterm_k.nstrbnd][0],
2775 &crossterm_k.stbncon[crossterm_k.nstrbnd][1],
2776 &crossterm_k.stbncon[crossterm_k.nstrbnd][2], &kp4);
2777 numeral(kp1,pa,3);
2778 numeral(kp2,pb,3);
2779 numeral(kp3,pc,3);
2780 strcpy(ptor,pa); strcat(ptor,pb); strcat(ptor,pc);
2781 strcpy(crossterm_k.stbn[crossterm_k.nstrbnd],ptor);
2782 crossterm_k.stbnindex[crossterm_k.nstrbnd] = kp4;
2783 crossterm_k.nstrbnd++;
2784 } else if (strcmp(iptemp, "angang") == 0)
2785 {
2786 if (crossterm_k.nangang > MAXAA)
2787 {
2788 message_alert("Error - Too many ang ang constants","Read Parameter");
2789 fprintf(stderr,"Maximum number of ang ang constants exceeded. Others will be ignored\n");
2790 //fclose(datafile);
2791 return;
2792 }
2793 sscanf(line,"%s %d %f %f %f",dumm, &crossterm_k.ang_ang[crossterm_k.nangang],
2794 &crossterm_k.aacon[crossterm_k.nangang][0],
2795 &crossterm_k.aacon[crossterm_k.nangang][1],
2796 &crossterm_k.aacon[crossterm_k.nangang][2]);
2797 crossterm_k.nangang++;
2798 } else if (strcmp(iptemp, "strtors") == 0)
2799 {
2800 if (crossterm_k.nstrtor > MAXSTRTOR)
2801 {
2802 message_alert("Error - Too many str tor constants","Read Parameter");
2803 fprintf(stderr,"Maximum number of str tor constants exceeded. Others will be ignored\n");
2804 //fclose(datafile);
2805 return;
2806 }
2807 sscanf(line,"%s %d %d %f",dumm, &kt1, &kt2, &crossterm_k.str_torcon[crossterm_k.nstrtor]);
2808 numeral(kt1,pa,3);
2809 numeral(kt2,pb,3);
2810 strcpy(pt,pa); strcat(pt,pb);
2811 strcpy(crossterm_k.str_tor[crossterm_k.nstrtor],pt);
2812 crossterm_k.nstrtor++;
2813 } else if (strcmp(iptemp, "vdwpr") == 0)
2814 {
2815 if (vdwpr_k .nvdwpr > MAXBONDCONST)
2816 {
2817 message_alert("Error - Too many vdwpr constants","Read Parameter");
2818 fprintf(stderr,"Maximum number of vdwpr constants exceeded. Others will be ignored\n");
2819 //fclose(datafile);
2820 return;
2821 }
2822 sscanf(line,"%s %d %d %f %f",dumm, &ii, &kk, &vdwpr_k.radius[vdwpr_k .nvdwpr],
2823 &vdwpr_k.eps[vdwpr_k .nvdwpr]);
2824 vdwpr_k.ia1[vdwpr_k .nvdwpr] = ii;
2825 vdwpr_k.ia2[vdwpr_k .nvdwpr] = kk;
2826 numeral(ii,pa,3);
2827 numeral(kk,pb,3);
2828 strcpy(pt,pa); strcat(pt,pb);
2829 strcpy(vdwpr_k.kv[vdwpr_k .nvdwpr],pt);
2830 vdwpr_k .nvdwpr++;
2831 } else if( strcmp(iptemp, "BDHF") == 0 )
2832 {
2833 if (ehpara.neheat >= 220)
2834 {
2835 fprintf(stderr,"Maximum number of BDHF constants exceeded. Others will be ignored\n");
2836 //fclose(datafile);
2837 return;
2838 }
2839 sscanf( line, "%s %d %d %20c %f %f %f", dumm, &ja, &jb,
2840 ehpara.cc[ehpara.neheat], &ehpara.ee[ehpara.neheat], &ehpara.estr[ehpara.neheat],
2841 &ehpara.et[ehpara.neheat] );
2842 ehpara.nn[ehpara.neheat] = ja*100 + jb;
2843 ehpara.neheat++;
2844 } else if( strcmp(iptemp, "EVHF") == 0 )
2845 {
2846 if (ehpara.nevhf >= 155)
2847 {
2848 fprintf(stderr,"Maximum number of EVHF constants exceeded. Others will be ignored\n");
2849 //fclose(datafile);
2850 return;
2851 }
2852 sscanf( line, "%s %d %d %d %d %d %20c %f %f", dumm, &ehpara.cent[ehpara.nevhf],
2853 &kp1,&kp2,&kp3,&kp4, ehpara.mm[ehpara.nevhf],
2854 &ehpara.ss[ehpara.nevhf], &ehpara.ssless[ehpara.nevhf]);
2855 numeral(kp1,pa,3);
2856 numeral(kp2,pb,3);
2857 numeral(kp3,pc,3);
2858 numeral(kp4,pd,3);
2859 strcpy(ptor,pa); strcat(ptor,pb); strcat(ptor,pc); strcat(ptor,pd);
2860 strcpy(ehpara.kheat[ehpara.nevhf],ptor);
2861 ehpara.nevhf++;
2862 } else if( strcmp(iptemp, "PIHF") == 0 )
2863 {
2864 if (epiheat.npihf >= 125)
2865 {
2866 fprintf(stderr,"Maximum number of PIHF constants exceeded. Others will be ignored\n");
2867 //fclose(datafile);
2868 return;
2869 }
2870 sscanf( line, "%s %d %d %20c %f %f %f %f ", dumm,
2871 &iatm1, &iatm2, epiheat.ccp[epiheat.npihf], &epiheat.eep[epiheat.npihf],
2872 &epiheat.aa[epiheat.npihf], &epiheat.bb[epiheat.npihf], &epiheat.ccc[epiheat.npihf] );
2873 epiheat.nnp[epiheat.npihf] = iatm1*100 + iatm2;
2874 epiheat.npihf++;
2875 }
2876 }
2877
2878 //fclose(datafile);
2879
2880 /*
2881 fprintf(stderr," field : %s\n",field.name);
2882 fprintf(stderr," Atom Types: %d\n",atom_k.natomtype);
2883 fprintf(stderr," Bonds: %d Bond3: %d Bond4: %d Bond5: %d\n",
2884 bondk1.nbnd,bondk1.nbnd3, bondk1.nbnd4, bondk1.nbnd5);
2885 fprintf(stderr," Angle: %d Angle3: %d Angle4: %d Angle5: %d\n",
2886 angk1.nang,angk1.nang3, angk1.nang4, angk1.nang5);
2887 fprintf(stderr," Torsion: %d Torsion4: %d Torsion5: %d\n",
2888 torkn1.ntor, torkn1.ntor4, torkn1.ntor5);
2889 fprintf(stderr," Vdw: %d OOP: %d Dipole: %d Charge: %d Improper: %d\n",
2890 vdw1.nvdw,ooplane_k.nopbend, dipole_k.ndipole, charge_k.ncharge, improptor_k.nimptor);
2891 fprintf(stderr," STBN: %d ANGANG: %d STRTOR: %d VDWPR: %d\n",
2892 crossterm_k.nstrbnd, crossterm_k.nangang, crossterm_k.nstrtor, vdwpr_k.nvdwpr);
2893 */
2894
2895 return;
2896 }
2897
2898
2899 void torphase(int icount, float v1[6], int se[6])
2900 {
2901 int i;
2902 float amp[6], phase[6];
2903 int fold[6];
2904
2905 for (i=0; i < 6; i++)
2906 {
2907 fold[i] = 0;
2908 amp[i] = phase[i] = 0.0;
2909 }
2910
2911 for (i=0; i < icount; i++)
2912 {
2913 amp[i] = v1[i];
2914 fold[i] = abs( (int)(2.0*se[i]) - (int) se[i]);
2915 if (se[i] > 0.0)
2916 phase[i] = 1.0;
2917 else
2918 phase[i] = -1.0;
2919 v1[i] = 0.0;
2920 se[i] = 0;
2921 }
2922
2923 for (i=0; i < icount; i++)
2924 {
2925 if (fold[i] != 0 && fold[i] <= icount)
2926 {
2927 v1[fold[i]-1] = amp[i];
2928 se[fold[i]-1] = phase[i];
2929 }
2930 }
2931 }
2932
2933