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