ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/mengine.c
(Generate patch)
# Line 1 | Line 1
1 + /* NOTICE: this source code file has been modified for use with FreeMOL */
2   #define EXTERN
3   #include "pcwin.h"
4   #include "pcmod.h"
# Line 23 | Line 24
24   #include <stdlib.h>
25   #include <unistd.h>
26   #include <string.h>
27 < #include <malloc.h>
27 > //#include <malloc.h>
28  
29   EXTERN FILE *pcmoutfile;
30  
# Line 61 | Line 62
62   void search_rings(int);
63   */
64  
65 +
66 + void usage(void) {
67 +  printf("\nUsage: mengine [-hvdxi] reads sdf on stdin, writes on stdout\n\n"
68 +         "-h\tThis help page\n"
69 +         "-v\tVerbose output\n"
70 +         "-a\tAdd hydrogen atoms; delete existing ones\n"
71 +         "-d\tEvaluate dipole moment\n"
72 +         "-x\tEvaluate XlogP\n"
73 +         "-i\tEvaluate vibrational data\n\n");
74 + }
75 +
76   /* ==================================================== */
77   int main(int argc, char *argv[])
78   {
# Line 70 | Line 82
82  
83      char *outfile = NULL;
84      char *mmff94file = NULL;
85 <    char *mmxfile = NULL;
74 <    char *logfilename = NULL;
85 >    //char *mmxfile = NULL;
86  
87      int flags = 0;
77    flags = flags | DO_DIPOLE;
78    flags = flags | DO_XLOGP;
79    flags = flags | DO_VIBRATION;
88  
89   /*
90      filename = strdup("caffeine.sdf");
91      outfile = strdup("output.sdf");
92   */
93      mmff94file = strdup("mmff94.prm");
94 <    mmxfile = strdup("mmxconst.prm");
95 <    logfilename= strdup("error.log");
94 > //    mmxfile = strdup("mmxconst.prm");
95 >
96 >    int c;
97 >    while ((c = getopt(argc, argv, "e:o:p:c:havdxi")) != -1) {
98 >      switch(c) {
99 >      case 'a':
100 >        flags = flags | DO_ADDH;
101 >        break;
102 >      case 'd':
103 >        flags = flags | DO_DIPOLE;
104 >        break;
105 >      case 'x':
106 >        flags = flags | DO_XLOGP;
107 >        break;
108 >      case 'i':
109 >        flags = flags | DO_VIBRATION;
110 >        break;
111 >      case 'v':
112 >        VERBOSE = 1;
113 >        break;
114 >      case 'h':
115 >        usage();
116 >        exit(-1);
117 > /*
118 >      case 'o':
119 >        outfile = strdup(optarg);
120 >        break;
121 >      case 'p':
122 >        mmff94file = strdup(optarg);
123 >        break;
124 >      case 'c':
125 >        mmxfile = strdup(optarg);
126 >        break;
127 >      case 'e':
128 >        logfilename = strdup(optarg);
129 >        break;
130 > */
131 >      case '?':
132 >        if (isprint (optopt))
133 >         fprintf (stderr, "Unknown option `-%c'.\n", optopt);
134 >        else
135 >          fprintf (stderr,
136 >                   "Unknown option character `\\x%x'.\n",
137 >                   optopt);
138 >        return 1;
139 >      default:
140 >        abort ();
141 >      }
142 >    }
143  
144      pcmoutfile = stdout;
145 <    initialize_pcmodel(mmxfile);
145 >    initialize_pcmodel("mmxconst");
146      initialize();
147      minim_values.iprint = 0; //FALSE;
148      initialize_gmmx();
149  
150 <    read_gmmxinp(logfilename, outfile, mmff94file, stdin, flags);
150 >    read_gmmxinp("mmff94", stdin, flags);
151  
152      fclose(pcmoutfile);
153  
154      free(mmff94file);
155 <    free(mmxfile);
101 <    free(logfilename);
155 > //    free(mmxfile);
156   /*
157      free(filename);
158      free(outfile);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines