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