ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/initiali.c
Revision: 103
Committed: Thu Feb 19 01:37:38 2009 UTC (13 years, 3 months ago) by gilbertke
File size: 3721 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 "cutoffs.h"
6     #include "utility.h"
7     #include "fix.h"
8     #include "atom_k.h"
9 gilbertke 103 #include "job_control.h"
10 wdelano 58
11     void reset_atom_data(void);
12     void reset_calc_parameters(void);
13     void zero_data(void);
14     void read_datafiles(char *);
15     void initialize_pcmodel(char *);
16 gilbertke 103 void set_field(int);
17     int get_field(void);
18 wdelano 58 void message_alert(char *, char *);
19    
20    
21     EXTERN struct t_files {
22     int nfiles, append, batch, icurrent;
23     int ibatno;
24     } files;
25    
26     EXTERN struct t_minim_control {
27     int type, method, field, added_const;
28     char added_path[256],added_name[256];
29     } minim_control;
30    
31     EXTERN struct t_minim_values {
32     int iprint, ndc, nconst;
33     float dielc;
34     } minim_values;
35    
36     struct t_user {
37     int dielec;
38     } user;
39    
40     EXTERN struct t_pcmfile {
41     char string[200];
42     int head;
43     char token[20];
44     int state;
45     unsigned int nocaps;
46     } pcmfile;
47    
48    
49     // =======================================
50     void message_alert(char *astring, char *title)
51     {
52     fprintf(pcmlogfile,"%s\n",astring);
53     }
54     // ===================================
55     void initialize_pcmodel(char *mmxfilename)
56     {
57 gilbertke 103 int i,field;
58 wdelano 58 user.dielec = FALSE;
59     units.dielec = 1.0;
60     zero_data();
61     read_datafiles(mmxfilename);
62 gilbertke 103 set_field(MMX);
63 wdelano 58 // initialize atom definitions
64     atom_def.natomtype = atom_k.natomtype;
65     for (i=1; i < MAXATOMTYPE; i++)
66     {
67     atom_def.type[i] = atom_k.type[i];
68     atom_def.valency[i] = atom_k.valency[i];
69     atom_def.number[i] = atom_k.number[i];
70     atom_def.ligands[i] = atom_k.ligands[i];
71     atom_def.weight[i] = atom_k.weight[i];
72     strcpy(atom_def.symbol[i],atom_k.symbol[i]);
73     }
74 gilbertke 103 field = get_field();
75 wdelano 58 Openbox.ftype = FTYPE_PCM;
76     Savebox.ftype = FTYPE_PCM;
77     strcpy(Openbox.path,pcwindir);
78     strcpy(Savebox.path,pcwindir);
79     reset_calc_parameters();
80     natom = 0;
81     /* minimizer control */
82     minim_control.method = 3;
83     minim_control.field = MMX;
84     minim_control.added_const = FALSE;
85     // printout
86     minim_values.iprint = FALSE;
87     /* cutoffs */
88     cutoffs.vdwcut = 10.0;
89     cutoffs.pmecut = 9.0;
90     cutoffs.chrgcut = 100.0;
91     cutoffs.dipcut = 8.0;
92     // fixed stuff
93     fx_atom.natom_fix = 0;
94     fx_dist.ndfix = 0;
95     fx_angle.nafix = 0;
96     fx_torsion.ntfix = 0;
97     restrain_atom.natom_restrain = 0;
98 gilbertke 103 // job control
99     job_control.use_charge = FALSE;
100     job_control.use_scale_charge = FALSE;
101     job_control.use_gbsa = FALSE;
102     job_control.scale = 1.0;
103 wdelano 58 }
104    
105     int initialize(void)
106     {
107     natom = 0;
108     reset_calc_parameters();
109 gilbertke 103 // reset_atom_data();
110 wdelano 58 return(0);
111     }
112     /* ============================================== */
113     void reset_calc_parameters(void)
114     {
115    
116     /* default to hydrogen bonding on */
117     minim_values.ndc = 4;
118     minim_values.nconst= 0;
119     }
120     /* ============================================== */
121     void reset_atom_data(void)
122     {
123     int i, j;
124    
125     for (i = 0; i < MAXATOM; i++)
126     {
127 gilbertke 103 atom.use[i] = 0;
128     atom.x[i] = 0.0F; atom.y[i] = 0.0F; atom.z[i] = 0.0F;
129     atom.charge[i] = 0.0F;
130     atom.atomnum[i] = 0;
131     atom.formal_charge[i] = 0;
132     atom.atomwt[i] = 0.0;
133     atom.type[i] = 0;
134     atom.mmx_type[i] = 0;
135     atom.mm3_type[i] = 0;
136     atom.mmff_type[i] = 0;
137     atom.tclass[i] = 0;
138     *atom.name[i] = '\0';
139     atom.flags[i] = 0;
140 wdelano 58 for (j = 0; j < MAXIAT; j++)
141     {
142 gilbertke 103 atom.bo[i][j] = 0;
143     atom.iat[i][j] = 0;
144 wdelano 58 }
145     }
146     }