ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/smi23d/src/mengine/gmmx.c
Revision: 3
Committed: Mon Jun 9 21:38:26 2008 UTC (11 years, 4 months ago) by tjod
File size: 3765 byte(s)
Log Message:
test

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