ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/gmmx.c
Revision: 48
Committed: Thu Jul 31 16:34:52 2008 UTC (11 years, 8 months ago) by tjod
File size: 3957 byte(s)
Log Message:
Add modification notice to files modified for Freemol
per mengine/smi23d license requirements

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