ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/mengine.c
Revision: 34
Committed: Wed Jul 23 19:12:47 2008 UTC (11 years, 4 months ago) by tjod
File size: 3444 byte(s)
Log Message:
remove include malloc.h for osx compatibility

Line User Rev File contents
1 tjod 15 #define EXTERN
2     #include "pcwin.h"
3     #include "pcmod.h"
4     #include "energies.h"
5     #include "substr.h"
6     #include "pot.h"
7     #include "angles.h"
8    
9     #include "rings.h"
10     #include "torsions.h"
11     #include "nonbond.h"
12     #include "bonds_ff.h"
13     #include "derivs.h"
14     #include "hess.h"
15     #include "field.h"
16     #include "atom_k.h"
17     #include "cutoffs.h"
18     #include "solv.h"
19     #include "gmmx.h"
20     #include "fix.h"
21    
22     #include <stdio.h>
23     #include <stdlib.h>
24     #include <unistd.h>
25     #include <string.h>
26 tjod 34 //#include <malloc.h>
27 tjod 15
28     EXTERN FILE *pcmoutfile;
29    
30     struct t_rotbond {
31     int nbonds, bond[200][2], bond_res[200];
32     int incl_amide, incl_alkene;
33     } rotbond;
34     struct t_minim_values {
35     int iprint, ndc, nconst;
36     float dielc;
37     } minim_values;
38    
39     struct t_minim_control {
40     int type, method, field, added_const;
41     char added_path[256],added_name[256];
42     } minim_control;
43     EXTERN struct t_files {
44     int nfiles, append, batch, icurrent, ibatno;
45     } files;
46     char Savename[80];
47    
48     /*
49     void initialize_pcmodel(char*);
50     void mmp22mod(int,int);
51     void pcmfin(int, int);
52     void initialize(void);
53     void mmxsub(int);
54     void check_numfile(int, char *);
55     void mac2mod(int, int);
56     void bbchk(void);
57     void type(void);
58     void initialize_gmmx(void);
59     void read_gmmxinp(char*, char*, char*, FILE*, int);
60     void run_gmmx(void);
61     void search_rings(int);
62     */
63    
64 tjod 16
65     void usage(void) {
66     printf("\nUsage: mengine [-hvdxi] reads sdf on stdin, writes on stdout\n\n"
67     "-h\tThis help page\n"
68     "-v\tVerbose output\n"
69 tjod 20 "-a\tAdd hydrogen atoms; delete existing ones\n"
70 tjod 16 "-d\tEvaluate dipole moment\n"
71     "-x\tEvaluate XlogP\n"
72     "-i\tEvaluate vibrational data\n\n");
73     }
74    
75 tjod 15 /* ==================================================== */
76     int main(int argc, char *argv[])
77     {
78     int i;
79     char *filename = NULL;
80     char *line = NULL;
81    
82     char *outfile = NULL;
83     char *mmff94file = NULL;
84 tjod 25 //char *mmxfile = NULL;
85 tjod 15
86     int flags = 0;
87    
88     /*
89     filename = strdup("caffeine.sdf");
90     outfile = strdup("output.sdf");
91     */
92     mmff94file = strdup("mmff94.prm");
93 tjod 25 // mmxfile = strdup("mmxconst.prm");
94 tjod 15
95 tjod 16 int c;
96 tjod 20 while ((c = getopt(argc, argv, "e:o:p:c:havdxi")) != -1) {
97 tjod 16 switch(c) {
98 tjod 20 case 'a':
99     flags = flags | DO_ADDH;
100     break;
101 tjod 16 case 'd':
102     flags = flags | DO_DIPOLE;
103     break;
104     case 'x':
105     flags = flags | DO_XLOGP;
106     break;
107     case 'i':
108     flags = flags | DO_VIBRATION;
109     break;
110     case 'v':
111     VERBOSE = 1;
112     break;
113     case 'h':
114     usage();
115     exit(-1);
116     /*
117     case 'o':
118     outfile = strdup(optarg);
119     break;
120     case 'p':
121     mmff94file = strdup(optarg);
122     break;
123     case 'c':
124     mmxfile = strdup(optarg);
125     break;
126     case 'e':
127     logfilename = strdup(optarg);
128     break;
129     */
130     case '?':
131     if (isprint (optopt))
132     fprintf (stderr, "Unknown option `-%c'.\n", optopt);
133     else
134     fprintf (stderr,
135     "Unknown option character `\\x%x'.\n",
136     optopt);
137     return 1;
138     default:
139     abort ();
140     }
141     }
142    
143 tjod 15 pcmoutfile = stdout;
144 tjod 25 initialize_pcmodel("mmxconst");
145 tjod 15 initialize();
146     minim_values.iprint = 0; //FALSE;
147     initialize_gmmx();
148    
149 tjod 25 read_gmmxinp("mmff94", stdin, flags);
150 tjod 15
151     fclose(pcmoutfile);
152    
153     free(mmff94file);
154 tjod 25 // free(mmxfile);
155 tjod 15 /*
156     free(filename);
157     free(outfile);
158     */
159    
160     exit(0);
161     }
162     //