ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/smi23d/src/mengine/readprm.c
Revision: 15
Committed: Thu Jun 19 00:26:16 2008 UTC (12 years, 4 months ago) by tjod
File size: 118081 byte(s)
Log Message:
Create new main program, mengine.c to replace gmmx.c
simplifying command line parsing (none).
Make mengine read stdin (sdf) and write stdout (sdf) instead
of files.  Makefile reflects change from gmmx to mengine.

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