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