ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/field.c
Revision: 103
Committed: Thu Feb 19 01:37:38 2009 UTC (12 years, 5 months ago) by gilbertke
File size: 9849 byte(s)
Log Message:
major rewrite - removing global data, adding electrostatics tag to read_sdf
Line User Rev File contents
1 wdelano 58 #define EXTERN extern
2    
3     #include "pcwin.h"
4     #include "pcmod.h"
5     #include "pot.h"
6     #include "field.h"
7     #include "fix.h"
8 gilbertke 103 #include "job_control.h"
9 wdelano 58
10     EXTERN struct t_minim_values {
11     int iprint, ndc, nconst;
12     float dielc;
13     } minim_values;
14    
15 gilbertke 103 void set_field(int type);
16 wdelano 58 void potoff(void);
17 gilbertke 103 int get_field(void);
18     int use_solvation(void);
19     void set_solvation(int);
20     int use_bond(void);
21     int use_angle(void);
22     int use_strbnd(void);
23     int use_opbend_wilson(void);
24     int use_tors(void);
25     int use_strtor(void);
26     int use_hal(void);
27     int use_charge(void);
28     int use_bufcharge(void);
29     int use_geom(void);
30     int use_solv(void);
31 wdelano 58
32 gilbertke 103 void set_field_name(char *);
33     void set_field_bondunit(float ftemp);
34     void set_field_bondcubic(float ftemp);
35     void set_field_bondquartic(float ftemp);
36     void set_field_angleunit(float ftemp);
37     void set_field_anglecubic(float ftemp);
38     void set_field_anglequartic(float ftemp);
39     void set_field_anglepentic(float ftemp);
40     void set_field_anglesextic(float ftemp);
41     void set_field_strbndunit(float ftemp);
42     void set_field_angangunit(float ftemp);
43     void set_field_strtorunit(float ftemp);
44     void set_field_torsionunit(float ftemp);
45     void set_field_vdwtype(char *name);
46     void set_field_radiustype(char *name);
47     void set_field_radiussize(char *name);
48     void set_field_radiusrule(char *name);
49     void set_field_epsrule(char *name);
50     void set_field_aterm(float ftemp);
51     void set_field_bterm(float ftemp);
52     void set_field_cterm(float ftemp);
53     void set_field_vdwscale(float ftemp);
54     void set_field_chrgscale(float ftemp);
55     void set_field_dielectric(float ftemp);
56    
57     char * get_radiustype(void);
58     char * get_radiussize(void);
59     char * get_radiusrule(void);
60     char * get_epsrule(void);
61     // ======================
62     int get_field()
63 wdelano 58 {
64 gilbertke 103 return field.type;
65     }
66     // ====================
67     char * get_radiustype()
68     {
69     return field.radiustype;
70     }
71     char * get_radiussize()
72     {
73     return field.radiussize;
74     }
75     char * get_radiusrule()
76     {
77     return field.radiusrule;
78     }
79     char * get_epsrule()
80     {
81     return field.radiusrule;
82     }
83     // =================
84     void set_field_name(char *name)
85     {
86     strcpy(field.name,name);
87     }
88     // =========== bonds =============
89     void set_field_bondunit(float ftemp)
90     {
91     field.bondunit = ftemp;
92     }
93     void set_field_bondcubic(float ftemp)
94     {
95     field.bond_cubic = ftemp;
96     }
97     void set_field_bondquartic(float ftemp)
98     {
99     field.bond_quartic = ftemp;
100     }
101     // ============ angles ==============
102     void set_field_angleunit(float ftemp)
103     {
104     field.angleunit = ftemp;
105     }
106     void set_field_anglecubic(float ftemp)
107     {
108     field.angle_cubic = ftemp;
109     }
110     void set_field_anglequartic(float ftemp)
111     {
112     field.angle_quartic = ftemp;
113     }
114     void set_field_anglepentic(float ftemp)
115     {
116     field.angle_pentic = ftemp;
117     }
118     void set_field_anglesextic(float ftemp)
119     {
120     field.angle_sextic = ftemp;
121     }
122     // =========== cross terms ===============
123     void set_field_strbndunit(float ftemp)
124     {
125     field.str_bndunit = ftemp;
126     }
127     void set_field_angangunit(float ftemp)
128     {
129     field.ang_angunit = ftemp;
130     }
131     void set_field_strtorunit(float ftemp)
132     {
133     field.str_torunit = ftemp;
134     }
135     // =============== torsions ===========
136     void set_field_torsionunit(float ftemp)
137     {
138     field.torsionunit = ftemp;
139     }
140     // ================ vdw ==============
141     void set_field_vdwtype(char *name)
142     {
143     strcpy(field.vdwtype,name);
144     }
145     void set_field_radiustype(char *name)
146     {
147     strcpy(field.radiustype,name);
148     }
149     void set_field_radiussize(char *name)
150     {
151     strcpy(field.radiussize,name);
152     }
153     void set_field_radiusrule(char *name)
154     {
155     strcpy(field.radiusrule,name);
156     }
157     void set_field_epsrule(char *name)
158     {
159     strcpy(field.epsrule,name);
160     }
161     void set_field_aterm(float ftemp)
162     {
163     field.a_expterm = ftemp;
164     }
165     void set_field_bterm(float ftemp)
166     {
167     field.b_expterm = ftemp;
168     }
169     void set_field_cterm(float ftemp)
170     {
171     field.c_expterm = ftemp;
172     }
173     void set_field_vdwscale(float ftemp)
174     {
175     field.vdw_14scale = ftemp;
176     }
177     void set_field_dielectric(float ftemp)
178     {
179     field.dielectric = ftemp;
180     }
181     void set_field_chrgscale(float ftemp)
182     {
183     field.chg_14scale = ftemp;
184     }
185     // ================
186     void set_field(int type)
187     {
188     field.type = type;
189 wdelano 58 pot.use_bond = FALSE;
190     pot.use_angle = FALSE;
191     pot.use_strbnd = FALSE;
192     pot.use_urey = FALSE;
193     pot.use_angang = FALSE;
194     pot.use_opbend = FALSE;
195     pot.use_improp = FALSE;
196     pot.use_imptor = FALSE;
197     pot.use_tors = FALSE;
198     pot.use_strtor = FALSE;
199     pot.use_tortor = FALSE;
200     pot.use_vdw = FALSE;
201     pot.use_lj = FALSE;
202     pot.use_buck = FALSE;
203     pot.use_hal = FALSE;
204     pot.use_gauss = FALSE;
205     pot.use_charge = FALSE;
206     pot.use_bufcharge = FALSE;
207     pot.use_chrgdpl = FALSE;
208     pot.use_dipole = FALSE;
209     pot.use_polar = FALSE;
210     pot.use_geom = FALSE;
211     pot.use_extra = FALSE;
212     pot.use_picalc = FALSE;
213     pot.use_hbond = FALSE;
214     pot.use_coordb = FALSE;
215     pot.use_opbend_wilson = FALSE;
216     pot.use_highcoord = FALSE;
217    
218 gilbertke 103 if (type == MMX )
219 wdelano 58 {
220     pot.use_bond = TRUE;
221     pot.use_angle = TRUE;
222     pot.use_strbnd = TRUE;
223     pot.use_opbend = TRUE;
224     pot.use_opbend_wilson = FALSE;
225     pot.use_tors = TRUE;
226     pot.use_vdw = TRUE;
227     pot.use_buck = TRUE;
228     pot.use_lj = FALSE;
229     pot.use_hal = FALSE;
230     pot.use_gauss = FALSE;
231 gilbertke 103 pot.use_hbond = FALSE;
232 wdelano 58
233     pot.use_bufcharge= FALSE;
234     if (minim_values.ndc == 4)
235     {
236     pot.use_charge = TRUE;
237     pot.use_dipole = FALSE;
238     }else
239     {
240     pot.use_charge = FALSE;
241     pot.use_dipole = TRUE;
242     }
243     pot.use_urey = FALSE;
244    
245     pot.use_angang = FALSE;
246     pot.use_improp = FALSE;
247     pot.use_imptor = FALSE;
248     pot.use_strtor = FALSE;
249     pot.use_tortor = FALSE;
250 gilbertke 103 } else if (type == MM3)
251 wdelano 58 {
252     pot.use_bond = TRUE;
253     pot.use_angle = TRUE;
254     pot.use_strbnd = TRUE;
255     pot.use_opbend = TRUE;
256     pot.use_opbend_wilson = FALSE;
257     pot.use_tors = TRUE;
258     pot.use_vdw = TRUE;
259     pot.use_buck = TRUE;
260     pot.use_lj = FALSE;
261     pot.use_hal = FALSE;
262     pot.use_hbond = FALSE;
263    
264     pot.use_gauss = FALSE;
265     pot.use_charge = FALSE;
266     pot.use_bufcharge= FALSE;
267     pot.use_dipole = TRUE;
268     pot.use_urey = FALSE;
269     pot.use_improp = FALSE;
270     pot.use_imptor = FALSE;
271     pot.use_angang = TRUE;
272     pot.use_strtor = TRUE;
273 gilbertke 103 } else if (type == MMFF94)
274 wdelano 58 {
275     pot.use_bond = TRUE;
276     pot.use_angle = TRUE;
277     pot.use_strbnd = TRUE;
278     pot.use_opbend = FALSE;
279     pot.use_opbend_wilson = TRUE;
280     pot.use_tors = TRUE;
281    
282     pot.use_vdw = FALSE;
283     pot.use_buck = FALSE;
284     pot.use_lj = FALSE;
285     pot.use_hal = TRUE;
286    
287     pot.use_hbond = FALSE;
288 gilbertke 103 pot.use_picalc = FALSE;
289 wdelano 58
290     pot.use_gauss = FALSE;
291     pot.use_charge = FALSE;
292     pot.use_bufcharge= TRUE;
293     pot.use_dipole = FALSE;
294     pot.use_urey = FALSE;
295     pot.use_improp = FALSE;
296     pot.use_imptor = FALSE;
297     pot.use_angang = FALSE;
298     pot.use_strtor = FALSE;
299     }
300     if (fx_dist.ndfix > 0) pot.use_geom = TRUE;
301     if (fx_angle.nafix > 0) pot.use_geom = TRUE;
302     if (fx_torsion.ntfix > 0) pot.use_geom = TRUE;
303     if (restrain_atom.natom_restrain > 0) pot.use_geom = TRUE;
304 gilbertke 103 if (job_control.use_gbsa) pot.use_solv = TRUE;
305 wdelano 58 }
306     // ============================
307     void potoff()
308     {
309     pot.use_bond = FALSE;
310     pot.use_angle = FALSE;
311     pot.use_strbnd = FALSE;
312     pot.use_urey = FALSE;
313     pot.use_angang = FALSE;
314     pot.use_opbend = FALSE;
315     pot.use_improp = FALSE;
316     pot.use_imptor = FALSE;
317     pot.use_tors = FALSE;
318     pot.use_strtor = FALSE;
319     pot.use_tortor = FALSE;
320     pot.use_vdw = FALSE;
321     pot.use_lj = FALSE;
322     pot.use_buck = FALSE;
323     pot.use_hal = FALSE;
324     pot.use_gauss = FALSE;
325     pot.use_charge = FALSE;
326     pot.use_bufcharge = FALSE;
327     pot.use_chrgdpl = FALSE;
328     pot.use_dipole = FALSE;
329     pot.use_polar = FALSE;
330     pot.use_solv = FALSE;
331     pot.use_geom = FALSE;
332     pot.use_extra = FALSE;
333     pot.use_picalc = FALSE;
334     pot.use_hbond = FALSE;
335     pot.use_coordb = FALSE;
336     pot.use_opbend_wilson = FALSE;
337     }
338 gilbertke 103 // ================ Solvation information ===========
339     static int SOLVATION = FALSE;
340 wdelano 58
341 gilbertke 103 int use_solvation()
342     {
343     if (SOLVATION)
344     return TRUE;
345     else
346     return FALSE;
347     }
348     void set_solvation(int mode)
349     {
350     if (mode)
351     SOLVATION = TRUE;
352     else
353     SOLVATION = FALSE;
354     }
355     // ==================
356     int use_bond(void)
357     {
358     if (pot.use_bond)
359     return TRUE;
360     else
361     return FALSE;
362     }
363     int use_angle(void)
364     {
365     if (pot.use_angle)
366     return TRUE;
367     else
368     return FALSE;
369     }
370     int use_strbnd(void)
371     {
372     if (pot.use_strbnd)
373     return TRUE;
374     else
375     return FALSE;
376     }
377     int use_opbend_wilson(void)
378     {
379     if (pot.use_opbend_wilson)
380     return TRUE;
381     else
382     return FALSE;
383     }
384     int use_tors(void)
385     {
386     if (pot.use_tors)
387     return TRUE;
388     else
389     return FALSE;
390     }
391     int use_strtor(void)
392     {
393     if (pot.use_strtor)
394     return TRUE;
395     else
396     return FALSE;
397     }
398     int use_hal(void)
399     {
400     if (pot.use_hal)
401     return TRUE;
402     else
403     return FALSE;
404     }
405     int use_charge(void)
406     {
407     if (pot.use_charge)
408     return TRUE;
409     else
410     return FALSE;
411     }
412     int use_bufcharge(void)
413     {
414     if (pot.use_bufcharge)
415     return TRUE;
416     else
417     return FALSE;
418     }
419     int use_geom(void)
420     {
421     if (pot.use_geom)
422     return TRUE;
423     else
424     return FALSE;
425     }
426     int use_solv(void)
427     {
428     if (pot.use_solv)
429     return TRUE;
430     else
431     return FALSE;
432     }