ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/mengine.c
Revision: 20
Committed: Mon Jun 30 22:00:43 2008 UTC (11 years, 1 month ago) by tjod
Original Path: trunk/smi23d/src/mengine/mengine.c
File size: 3435 byte(s)
Log Message:
Add -a switch to cause H atoms to be added, deleting existing ones.
With -a, mengine behaves as the original.
Formal charges are not always preserved, by the original or
the modified mengine with or without the -a switch.
It appears that negative charges are preserved (benzoic acid).
A positive charge on a N atom (an amine) is not preserved.
Charges are recognized in CHG records and in atom records.
Charges are output only in atom records.

Line File contents
1 #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 #include <malloc.h>
27
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
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 "-a\tAdd hydrogen atoms; delete existing ones\n"
70 "-d\tEvaluate dipole moment\n"
71 "-x\tEvaluate XlogP\n"
72 "-i\tEvaluate vibrational data\n\n");
73 }
74
75 /* ==================================================== */
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 char *mmxfile = NULL;
85
86 int flags = 0;
87
88 /*
89 filename = strdup("caffeine.sdf");
90 outfile = strdup("output.sdf");
91 */
92 mmff94file = strdup("mmff94.prm");
93 mmxfile = strdup("mmxconst.prm");
94
95 int c;
96 while ((c = getopt(argc, argv, "e:o:p:c:havdxi")) != -1) {
97 switch(c) {
98 case 'a':
99 flags = flags | DO_ADDH;
100 break;
101 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 pcmoutfile = stdout;
144 initialize_pcmodel(mmxfile);
145 initialize();
146 minim_values.iprint = 0; //FALSE;
147 initialize_gmmx();
148
149 read_gmmxinp(mmff94file, stdin, flags);
150
151 fclose(pcmoutfile);
152
153 free(mmff94file);
154 free(mmxfile);
155 /*
156 free(filename);
157 free(outfile);
158 */
159
160 exit(0);
161 }
162 //