1 |
tim |
320 |
/* |
2 |
xsun |
1213 |
File autogenerated by gengetopt version 2.19.1 |
3 |
tim |
320 |
generated with the following command: |
4 |
xsun |
1183 |
gengetopt -F DynamicPropsCmd |
5 |
tim |
320 |
|
6 |
|
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
|
gengetopt output files to be in the public domain: |
8 |
|
|
we make no copyright claims on it. |
9 |
|
|
*/ |
10 |
|
|
|
11 |
chuckv |
1098 |
/* If we use autoconf. */ |
12 |
|
|
#ifdef HAVE_CONFIG_H |
13 |
|
|
#include "config.h" |
14 |
|
|
#endif |
15 |
tim |
320 |
|
16 |
|
|
#include <stdio.h> |
17 |
|
|
#include <stdlib.h> |
18 |
|
|
#include <string.h> |
19 |
|
|
|
20 |
|
|
#include "getopt.h" |
21 |
|
|
|
22 |
|
|
#include "DynamicPropsCmd.h" |
23 |
|
|
|
24 |
xsun |
1213 |
const char *gengetopt_args_info_purpose = ""; |
25 |
|
|
|
26 |
|
|
const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]..."; |
27 |
|
|
|
28 |
|
|
const char *gengetopt_args_info_description = ""; |
29 |
|
|
|
30 |
|
|
const char *gengetopt_args_info_help[] = { |
31 |
|
|
" -h, --help Print help and exit", |
32 |
|
|
" -V, --version Print version and exit", |
33 |
|
|
" -i, --input=filename input dump file", |
34 |
|
|
" -o, --output=filename output file name", |
35 |
|
|
" --sele1=selection script select first stuntdouble set", |
36 |
|
|
" --sele2=selection script select second stuntdouble set (if sele2 is not \n set, use script from sele1)", |
37 |
|
|
" --order=INT Lengendre Polynomial Order", |
38 |
|
|
"\n Group: dynamicProps\n an option of this group is required", |
39 |
|
|
" -r, --rcorr rmsd", |
40 |
|
|
" -v, --vcorr velocity correlation function", |
41 |
|
|
" -d, --dcorr dipole correlation function", |
42 |
|
|
" -l, --lcorr Lengendre correlation function", |
43 |
|
|
" --r_rcorr Radial rmsd", |
44 |
|
|
" --thetacorr Angular rmsd", |
45 |
|
|
" --drcorr Directional rmsd for particles with unit \n vectors", |
46 |
|
|
0 |
47 |
|
|
}; |
48 |
|
|
|
49 |
chuckv |
1098 |
static |
50 |
|
|
void clear_given (struct gengetopt_args_info *args_info); |
51 |
|
|
static |
52 |
|
|
void clear_args (struct gengetopt_args_info *args_info); |
53 |
|
|
|
54 |
|
|
static int |
55 |
|
|
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); |
56 |
|
|
|
57 |
|
|
static int |
58 |
|
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
59 |
|
|
|
60 |
|
|
static char * |
61 |
|
|
gengetopt_strdup (const char *s); |
62 |
|
|
|
63 |
|
|
static |
64 |
|
|
void clear_given (struct gengetopt_args_info *args_info) |
65 |
|
|
{ |
66 |
|
|
args_info->help_given = 0 ; |
67 |
|
|
args_info->version_given = 0 ; |
68 |
|
|
args_info->input_given = 0 ; |
69 |
|
|
args_info->output_given = 0 ; |
70 |
|
|
args_info->sele1_given = 0 ; |
71 |
|
|
args_info->sele2_given = 0 ; |
72 |
|
|
args_info->order_given = 0 ; |
73 |
|
|
args_info->rcorr_given = 0 ; |
74 |
|
|
args_info->vcorr_given = 0 ; |
75 |
|
|
args_info->dcorr_given = 0 ; |
76 |
|
|
args_info->lcorr_given = 0 ; |
77 |
|
|
args_info->r_rcorr_given = 0 ; |
78 |
chuckv |
1112 |
args_info->thetacorr_given = 0 ; |
79 |
xsun |
1183 |
args_info->drcorr_given = 0 ; |
80 |
chuckv |
1098 |
args_info->dynamicProps_group_counter = 0 ; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
static |
84 |
|
|
void clear_args (struct gengetopt_args_info *args_info) |
85 |
|
|
{ |
86 |
|
|
args_info->input_arg = NULL; |
87 |
|
|
args_info->input_orig = NULL; |
88 |
|
|
args_info->output_arg = NULL; |
89 |
|
|
args_info->output_orig = NULL; |
90 |
|
|
args_info->sele1_arg = NULL; |
91 |
|
|
args_info->sele1_orig = NULL; |
92 |
|
|
args_info->sele2_arg = NULL; |
93 |
|
|
args_info->sele2_orig = NULL; |
94 |
|
|
args_info->order_orig = NULL; |
95 |
|
|
|
96 |
|
|
} |
97 |
|
|
|
98 |
xsun |
1213 |
static |
99 |
|
|
void init_args_info(struct gengetopt_args_info *args_info) |
100 |
|
|
{ |
101 |
|
|
args_info->help_help = gengetopt_args_info_help[0] ; |
102 |
|
|
args_info->version_help = gengetopt_args_info_help[1] ; |
103 |
|
|
args_info->input_help = gengetopt_args_info_help[2] ; |
104 |
|
|
args_info->output_help = gengetopt_args_info_help[3] ; |
105 |
|
|
args_info->sele1_help = gengetopt_args_info_help[4] ; |
106 |
|
|
args_info->sele2_help = gengetopt_args_info_help[5] ; |
107 |
|
|
args_info->order_help = gengetopt_args_info_help[6] ; |
108 |
|
|
args_info->rcorr_help = gengetopt_args_info_help[7] ; |
109 |
|
|
args_info->vcorr_help = gengetopt_args_info_help[8] ; |
110 |
|
|
args_info->dcorr_help = gengetopt_args_info_help[9] ; |
111 |
|
|
args_info->lcorr_help = gengetopt_args_info_help[10] ; |
112 |
|
|
args_info->r_rcorr_help = gengetopt_args_info_help[11] ; |
113 |
|
|
args_info->thetacorr_help = gengetopt_args_info_help[12] ; |
114 |
|
|
args_info->drcorr_help = gengetopt_args_info_help[13] ; |
115 |
|
|
|
116 |
|
|
} |
117 |
|
|
|
118 |
tim |
320 |
void |
119 |
|
|
cmdline_parser_print_version (void) |
120 |
|
|
{ |
121 |
|
|
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
void |
125 |
|
|
cmdline_parser_print_help (void) |
126 |
|
|
{ |
127 |
xsun |
1213 |
int i = 0; |
128 |
tim |
320 |
cmdline_parser_print_version (); |
129 |
xsun |
1213 |
|
130 |
|
|
if (strlen(gengetopt_args_info_purpose) > 0) |
131 |
|
|
printf("\n%s\n", gengetopt_args_info_purpose); |
132 |
|
|
|
133 |
|
|
printf("\n%s\n\n", gengetopt_args_info_usage); |
134 |
|
|
|
135 |
|
|
if (strlen(gengetopt_args_info_description) > 0) |
136 |
|
|
printf("%s\n", gengetopt_args_info_description); |
137 |
|
|
|
138 |
|
|
while (gengetopt_args_info_help[i]) |
139 |
|
|
printf("%s\n", gengetopt_args_info_help[i++]); |
140 |
tim |
320 |
} |
141 |
|
|
|
142 |
chuckv |
1098 |
void |
143 |
|
|
cmdline_parser_init (struct gengetopt_args_info *args_info) |
144 |
|
|
{ |
145 |
|
|
clear_given (args_info); |
146 |
|
|
clear_args (args_info); |
147 |
xsun |
1213 |
init_args_info (args_info); |
148 |
chuckv |
1098 |
} |
149 |
tim |
320 |
|
150 |
chuckv |
1098 |
static void |
151 |
|
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
152 |
|
|
{ |
153 |
|
|
|
154 |
|
|
if (args_info->input_arg) |
155 |
|
|
{ |
156 |
|
|
free (args_info->input_arg); /* free previous argument */ |
157 |
|
|
args_info->input_arg = 0; |
158 |
|
|
} |
159 |
|
|
if (args_info->input_orig) |
160 |
|
|
{ |
161 |
|
|
free (args_info->input_orig); /* free previous argument */ |
162 |
|
|
args_info->input_orig = 0; |
163 |
|
|
} |
164 |
|
|
if (args_info->output_arg) |
165 |
|
|
{ |
166 |
|
|
free (args_info->output_arg); /* free previous argument */ |
167 |
|
|
args_info->output_arg = 0; |
168 |
|
|
} |
169 |
|
|
if (args_info->output_orig) |
170 |
|
|
{ |
171 |
|
|
free (args_info->output_orig); /* free previous argument */ |
172 |
|
|
args_info->output_orig = 0; |
173 |
|
|
} |
174 |
|
|
if (args_info->sele1_arg) |
175 |
|
|
{ |
176 |
|
|
free (args_info->sele1_arg); /* free previous argument */ |
177 |
|
|
args_info->sele1_arg = 0; |
178 |
|
|
} |
179 |
|
|
if (args_info->sele1_orig) |
180 |
|
|
{ |
181 |
|
|
free (args_info->sele1_orig); /* free previous argument */ |
182 |
|
|
args_info->sele1_orig = 0; |
183 |
|
|
} |
184 |
|
|
if (args_info->sele2_arg) |
185 |
|
|
{ |
186 |
|
|
free (args_info->sele2_arg); /* free previous argument */ |
187 |
|
|
args_info->sele2_arg = 0; |
188 |
|
|
} |
189 |
|
|
if (args_info->sele2_orig) |
190 |
|
|
{ |
191 |
|
|
free (args_info->sele2_orig); /* free previous argument */ |
192 |
|
|
args_info->sele2_orig = 0; |
193 |
|
|
} |
194 |
|
|
if (args_info->order_orig) |
195 |
|
|
{ |
196 |
|
|
free (args_info->order_orig); /* free previous argument */ |
197 |
|
|
args_info->order_orig = 0; |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
clear_given (args_info); |
201 |
|
|
} |
202 |
tim |
320 |
|
203 |
chuckv |
1098 |
int |
204 |
|
|
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
205 |
|
|
{ |
206 |
|
|
FILE *outfile; |
207 |
|
|
int i = 0; |
208 |
|
|
|
209 |
|
|
outfile = fopen(filename, "w"); |
210 |
|
|
|
211 |
|
|
if (!outfile) |
212 |
|
|
{ |
213 |
|
|
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); |
214 |
|
|
return EXIT_FAILURE; |
215 |
|
|
} |
216 |
|
|
|
217 |
|
|
if (args_info->help_given) { |
218 |
|
|
fprintf(outfile, "%s\n", "help"); |
219 |
|
|
} |
220 |
|
|
if (args_info->version_given) { |
221 |
|
|
fprintf(outfile, "%s\n", "version"); |
222 |
|
|
} |
223 |
|
|
if (args_info->input_given) { |
224 |
|
|
if (args_info->input_orig) { |
225 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); |
226 |
|
|
} else { |
227 |
|
|
fprintf(outfile, "%s\n", "input"); |
228 |
|
|
} |
229 |
|
|
} |
230 |
|
|
if (args_info->output_given) { |
231 |
|
|
if (args_info->output_orig) { |
232 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
233 |
|
|
} else { |
234 |
|
|
fprintf(outfile, "%s\n", "output"); |
235 |
|
|
} |
236 |
|
|
} |
237 |
|
|
if (args_info->sele1_given) { |
238 |
|
|
if (args_info->sele1_orig) { |
239 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); |
240 |
|
|
} else { |
241 |
|
|
fprintf(outfile, "%s\n", "sele1"); |
242 |
|
|
} |
243 |
|
|
} |
244 |
|
|
if (args_info->sele2_given) { |
245 |
|
|
if (args_info->sele2_orig) { |
246 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); |
247 |
|
|
} else { |
248 |
|
|
fprintf(outfile, "%s\n", "sele2"); |
249 |
|
|
} |
250 |
|
|
} |
251 |
|
|
if (args_info->order_given) { |
252 |
|
|
if (args_info->order_orig) { |
253 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "order", args_info->order_orig); |
254 |
|
|
} else { |
255 |
|
|
fprintf(outfile, "%s\n", "order"); |
256 |
|
|
} |
257 |
|
|
} |
258 |
|
|
if (args_info->rcorr_given) { |
259 |
|
|
fprintf(outfile, "%s\n", "rcorr"); |
260 |
|
|
} |
261 |
|
|
if (args_info->vcorr_given) { |
262 |
|
|
fprintf(outfile, "%s\n", "vcorr"); |
263 |
|
|
} |
264 |
|
|
if (args_info->dcorr_given) { |
265 |
|
|
fprintf(outfile, "%s\n", "dcorr"); |
266 |
|
|
} |
267 |
|
|
if (args_info->lcorr_given) { |
268 |
|
|
fprintf(outfile, "%s\n", "lcorr"); |
269 |
|
|
} |
270 |
|
|
if (args_info->r_rcorr_given) { |
271 |
|
|
fprintf(outfile, "%s\n", "r_rcorr"); |
272 |
|
|
} |
273 |
chuckv |
1112 |
if (args_info->thetacorr_given) { |
274 |
|
|
fprintf(outfile, "%s\n", "thetacorr"); |
275 |
|
|
} |
276 |
xsun |
1183 |
if (args_info->drcorr_given) { |
277 |
|
|
fprintf(outfile, "%s\n", "drcorr"); |
278 |
|
|
} |
279 |
chuckv |
1098 |
|
280 |
|
|
fclose (outfile); |
281 |
|
|
|
282 |
|
|
i = EXIT_SUCCESS; |
283 |
|
|
return i; |
284 |
|
|
} |
285 |
|
|
|
286 |
|
|
void |
287 |
|
|
cmdline_parser_free (struct gengetopt_args_info *args_info) |
288 |
|
|
{ |
289 |
|
|
cmdline_parser_release (args_info); |
290 |
|
|
} |
291 |
|
|
|
292 |
|
|
|
293 |
tim |
320 |
/* gengetopt_strdup() */ |
294 |
|
|
/* strdup.c replacement of strdup, which is not standard */ |
295 |
|
|
char * |
296 |
|
|
gengetopt_strdup (const char *s) |
297 |
|
|
{ |
298 |
chuckv |
1098 |
char *result = NULL; |
299 |
|
|
if (!s) |
300 |
|
|
return result; |
301 |
|
|
|
302 |
|
|
result = (char*)malloc(strlen(s) + 1); |
303 |
tim |
320 |
if (result == (char*)0) |
304 |
|
|
return (char*)0; |
305 |
|
|
strcpy(result, s); |
306 |
|
|
return result; |
307 |
|
|
} |
308 |
|
|
|
309 |
chuckv |
1098 |
static void |
310 |
|
|
reset_group_dynamicProps(struct gengetopt_args_info *args_info); |
311 |
|
|
|
312 |
|
|
static void |
313 |
|
|
reset_group_dynamicProps(struct gengetopt_args_info *args_info) |
314 |
tim |
320 |
{ |
315 |
chuckv |
1098 |
if (! args_info->dynamicProps_group_counter) |
316 |
|
|
return; |
317 |
tim |
320 |
|
318 |
|
|
args_info->rcorr_given = 0 ; |
319 |
|
|
args_info->vcorr_given = 0 ; |
320 |
|
|
args_info->dcorr_given = 0 ; |
321 |
tim |
876 |
args_info->lcorr_given = 0 ; |
322 |
chuckv |
1098 |
args_info->r_rcorr_given = 0 ; |
323 |
chuckv |
1112 |
args_info->thetacorr_given = 0 ; |
324 |
xsun |
1183 |
args_info->drcorr_given = 0 ; |
325 |
chuckv |
1098 |
|
326 |
|
|
args_info->dynamicProps_group_counter = 0; |
327 |
tim |
876 |
} |
328 |
tim |
320 |
|
329 |
chuckv |
1098 |
int |
330 |
|
|
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
331 |
|
|
{ |
332 |
|
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
333 |
|
|
} |
334 |
tim |
320 |
|
335 |
chuckv |
1098 |
int |
336 |
|
|
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
337 |
|
|
{ |
338 |
|
|
int result; |
339 |
|
|
|
340 |
|
|
result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); |
341 |
|
|
|
342 |
|
|
if (result == EXIT_FAILURE) |
343 |
|
|
{ |
344 |
|
|
cmdline_parser_free (args_info); |
345 |
|
|
exit (EXIT_FAILURE); |
346 |
|
|
} |
347 |
|
|
|
348 |
|
|
return result; |
349 |
|
|
} |
350 |
|
|
|
351 |
|
|
int |
352 |
|
|
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) |
353 |
|
|
{ |
354 |
|
|
int result = EXIT_SUCCESS; |
355 |
|
|
|
356 |
|
|
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
357 |
|
|
result = EXIT_FAILURE; |
358 |
|
|
|
359 |
|
|
if (result == EXIT_FAILURE) |
360 |
|
|
{ |
361 |
|
|
cmdline_parser_free (args_info); |
362 |
|
|
exit (EXIT_FAILURE); |
363 |
|
|
} |
364 |
|
|
|
365 |
|
|
return result; |
366 |
|
|
} |
367 |
|
|
|
368 |
|
|
int |
369 |
|
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
370 |
|
|
{ |
371 |
|
|
int error = 0; |
372 |
|
|
|
373 |
xsun |
1213 |
/* checks for required options */ |
374 |
chuckv |
1098 |
if (! args_info->input_given) |
375 |
|
|
{ |
376 |
|
|
fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
377 |
|
|
error = 1; |
378 |
|
|
} |
379 |
xsun |
1213 |
|
380 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter == 0) |
381 |
|
|
{ |
382 |
|
|
fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); |
383 |
|
|
error = 1; |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
|
387 |
xsun |
1213 |
/* checks for dependences among options */ |
388 |
|
|
|
389 |
chuckv |
1098 |
return error; |
390 |
|
|
} |
391 |
|
|
|
392 |
|
|
int |
393 |
|
|
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) |
394 |
|
|
{ |
395 |
|
|
int c; /* Character of the parsed option. */ |
396 |
|
|
|
397 |
|
|
int error = 0; |
398 |
|
|
struct gengetopt_args_info local_args_info; |
399 |
|
|
|
400 |
|
|
if (initialize) |
401 |
|
|
cmdline_parser_init (args_info); |
402 |
|
|
|
403 |
|
|
cmdline_parser_init (&local_args_info); |
404 |
|
|
|
405 |
tim |
320 |
optarg = 0; |
406 |
xsun |
1183 |
optind = 0; |
407 |
tim |
320 |
opterr = 1; |
408 |
|
|
optopt = '?'; |
409 |
|
|
|
410 |
|
|
while (1) |
411 |
|
|
{ |
412 |
|
|
int option_index = 0; |
413 |
|
|
char *stop_char; |
414 |
|
|
|
415 |
|
|
static struct option long_options[] = { |
416 |
|
|
{ "help", 0, NULL, 'h' }, |
417 |
|
|
{ "version", 0, NULL, 'V' }, |
418 |
|
|
{ "input", 1, NULL, 'i' }, |
419 |
|
|
{ "output", 1, NULL, 'o' }, |
420 |
|
|
{ "sele1", 1, NULL, 0 }, |
421 |
|
|
{ "sele2", 1, NULL, 0 }, |
422 |
tim |
876 |
{ "order", 1, NULL, 0 }, |
423 |
tim |
320 |
{ "rcorr", 0, NULL, 'r' }, |
424 |
|
|
{ "vcorr", 0, NULL, 'v' }, |
425 |
|
|
{ "dcorr", 0, NULL, 'd' }, |
426 |
tim |
876 |
{ "lcorr", 0, NULL, 'l' }, |
427 |
chuckv |
1098 |
{ "r_rcorr", 0, NULL, 0 }, |
428 |
chuckv |
1112 |
{ "thetacorr", 0, NULL, 0 }, |
429 |
xsun |
1183 |
{ "drcorr", 0, NULL, 0 }, |
430 |
tim |
320 |
{ NULL, 0, NULL, 0 } |
431 |
|
|
}; |
432 |
|
|
|
433 |
|
|
stop_char = 0; |
434 |
tim |
917 |
c = getopt_long (argc, argv, "hVi:o:rvdl", long_options, &option_index); |
435 |
tim |
320 |
|
436 |
|
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
437 |
|
|
|
438 |
|
|
switch (c) |
439 |
|
|
{ |
440 |
|
|
case 'h': /* Print help and exit. */ |
441 |
|
|
cmdline_parser_print_help (); |
442 |
chuckv |
1098 |
cmdline_parser_free (&local_args_info); |
443 |
tim |
320 |
exit (EXIT_SUCCESS); |
444 |
|
|
|
445 |
|
|
case 'V': /* Print version and exit. */ |
446 |
|
|
cmdline_parser_print_version (); |
447 |
chuckv |
1098 |
cmdline_parser_free (&local_args_info); |
448 |
tim |
320 |
exit (EXIT_SUCCESS); |
449 |
|
|
|
450 |
|
|
case 'i': /* input dump file. */ |
451 |
chuckv |
1098 |
if (local_args_info.input_given) |
452 |
tim |
320 |
{ |
453 |
chuckv |
1098 |
fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
454 |
|
|
goto failure; |
455 |
tim |
320 |
} |
456 |
chuckv |
1098 |
if (args_info->input_given && ! override) |
457 |
|
|
continue; |
458 |
|
|
local_args_info.input_given = 1; |
459 |
tim |
320 |
args_info->input_given = 1; |
460 |
chuckv |
1098 |
if (args_info->input_arg) |
461 |
|
|
free (args_info->input_arg); /* free previous string */ |
462 |
tim |
320 |
args_info->input_arg = gengetopt_strdup (optarg); |
463 |
chuckv |
1098 |
if (args_info->input_orig) |
464 |
|
|
free (args_info->input_orig); /* free previous string */ |
465 |
|
|
args_info->input_orig = gengetopt_strdup (optarg); |
466 |
tim |
320 |
break; |
467 |
|
|
|
468 |
|
|
case 'o': /* output file name. */ |
469 |
chuckv |
1098 |
if (local_args_info.output_given) |
470 |
tim |
320 |
{ |
471 |
chuckv |
1098 |
fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
472 |
|
|
goto failure; |
473 |
tim |
320 |
} |
474 |
chuckv |
1098 |
if (args_info->output_given && ! override) |
475 |
|
|
continue; |
476 |
|
|
local_args_info.output_given = 1; |
477 |
tim |
320 |
args_info->output_given = 1; |
478 |
chuckv |
1098 |
if (args_info->output_arg) |
479 |
|
|
free (args_info->output_arg); /* free previous string */ |
480 |
tim |
320 |
args_info->output_arg = gengetopt_strdup (optarg); |
481 |
chuckv |
1098 |
if (args_info->output_orig) |
482 |
|
|
free (args_info->output_orig); /* free previous string */ |
483 |
|
|
args_info->output_orig = gengetopt_strdup (optarg); |
484 |
tim |
320 |
break; |
485 |
|
|
|
486 |
tim |
917 |
case 'r': /* rmsd. */ |
487 |
chuckv |
1098 |
if (local_args_info.rcorr_given) |
488 |
tim |
320 |
{ |
489 |
chuckv |
1098 |
fprintf (stderr, "%s: `--rcorr' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
490 |
|
|
goto failure; |
491 |
tim |
320 |
} |
492 |
chuckv |
1098 |
if (args_info->rcorr_given && ! override) |
493 |
|
|
continue; |
494 |
|
|
local_args_info.rcorr_given = 1; |
495 |
tim |
320 |
args_info->rcorr_given = 1; |
496 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter && override) |
497 |
|
|
reset_group_dynamicProps (args_info); |
498 |
|
|
args_info->dynamicProps_group_counter += 1; |
499 |
|
|
break; |
500 |
tim |
320 |
|
501 |
|
|
case 'v': /* velocity correlation function. */ |
502 |
chuckv |
1098 |
if (local_args_info.vcorr_given) |
503 |
tim |
320 |
{ |
504 |
chuckv |
1098 |
fprintf (stderr, "%s: `--vcorr' (`-v') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
505 |
|
|
goto failure; |
506 |
tim |
320 |
} |
507 |
chuckv |
1098 |
if (args_info->vcorr_given && ! override) |
508 |
|
|
continue; |
509 |
|
|
local_args_info.vcorr_given = 1; |
510 |
tim |
320 |
args_info->vcorr_given = 1; |
511 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter && override) |
512 |
|
|
reset_group_dynamicProps (args_info); |
513 |
|
|
args_info->dynamicProps_group_counter += 1; |
514 |
|
|
break; |
515 |
tim |
320 |
|
516 |
|
|
case 'd': /* dipole correlation function. */ |
517 |
chuckv |
1098 |
if (local_args_info.dcorr_given) |
518 |
tim |
320 |
{ |
519 |
chuckv |
1098 |
fprintf (stderr, "%s: `--dcorr' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
520 |
|
|
goto failure; |
521 |
tim |
320 |
} |
522 |
chuckv |
1098 |
if (args_info->dcorr_given && ! override) |
523 |
|
|
continue; |
524 |
|
|
local_args_info.dcorr_given = 1; |
525 |
tim |
320 |
args_info->dcorr_given = 1; |
526 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter && override) |
527 |
|
|
reset_group_dynamicProps (args_info); |
528 |
|
|
args_info->dynamicProps_group_counter += 1; |
529 |
|
|
break; |
530 |
tim |
320 |
|
531 |
tim |
876 |
case 'l': /* Lengendre correlation function. */ |
532 |
chuckv |
1098 |
if (local_args_info.lcorr_given) |
533 |
tim |
876 |
{ |
534 |
chuckv |
1098 |
fprintf (stderr, "%s: `--lcorr' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
535 |
|
|
goto failure; |
536 |
tim |
876 |
} |
537 |
chuckv |
1098 |
if (args_info->lcorr_given && ! override) |
538 |
|
|
continue; |
539 |
|
|
local_args_info.lcorr_given = 1; |
540 |
tim |
876 |
args_info->lcorr_given = 1; |
541 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter && override) |
542 |
|
|
reset_group_dynamicProps (args_info); |
543 |
|
|
args_info->dynamicProps_group_counter += 1; |
544 |
|
|
break; |
545 |
tim |
320 |
|
546 |
tim |
876 |
|
547 |
tim |
320 |
case 0: /* Long option with no short option */ |
548 |
|
|
/* select first stuntdouble set. */ |
549 |
|
|
if (strcmp (long_options[option_index].name, "sele1") == 0) |
550 |
tim |
876 |
{ |
551 |
chuckv |
1098 |
if (local_args_info.sele1_given) |
552 |
tim |
876 |
{ |
553 |
chuckv |
1098 |
fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
554 |
|
|
goto failure; |
555 |
tim |
876 |
} |
556 |
chuckv |
1098 |
if (args_info->sele1_given && ! override) |
557 |
|
|
continue; |
558 |
|
|
local_args_info.sele1_given = 1; |
559 |
tim |
876 |
args_info->sele1_given = 1; |
560 |
chuckv |
1098 |
if (args_info->sele1_arg) |
561 |
|
|
free (args_info->sele1_arg); /* free previous string */ |
562 |
tim |
876 |
args_info->sele1_arg = gengetopt_strdup (optarg); |
563 |
chuckv |
1098 |
if (args_info->sele1_orig) |
564 |
|
|
free (args_info->sele1_orig); /* free previous string */ |
565 |
|
|
args_info->sele1_orig = gengetopt_strdup (optarg); |
566 |
tim |
876 |
} |
567 |
tim |
320 |
/* select second stuntdouble set (if sele2 is not set, use script from sele1). */ |
568 |
|
|
else if (strcmp (long_options[option_index].name, "sele2") == 0) |
569 |
tim |
876 |
{ |
570 |
chuckv |
1098 |
if (local_args_info.sele2_given) |
571 |
tim |
876 |
{ |
572 |
chuckv |
1098 |
fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
573 |
|
|
goto failure; |
574 |
tim |
876 |
} |
575 |
chuckv |
1098 |
if (args_info->sele2_given && ! override) |
576 |
|
|
continue; |
577 |
|
|
local_args_info.sele2_given = 1; |
578 |
tim |
876 |
args_info->sele2_given = 1; |
579 |
chuckv |
1098 |
if (args_info->sele2_arg) |
580 |
|
|
free (args_info->sele2_arg); /* free previous string */ |
581 |
tim |
876 |
args_info->sele2_arg = gengetopt_strdup (optarg); |
582 |
chuckv |
1098 |
if (args_info->sele2_orig) |
583 |
|
|
free (args_info->sele2_orig); /* free previous string */ |
584 |
|
|
args_info->sele2_orig = gengetopt_strdup (optarg); |
585 |
tim |
876 |
} |
586 |
|
|
/* Lengendre Polynomial Order. */ |
587 |
|
|
else if (strcmp (long_options[option_index].name, "order") == 0) |
588 |
|
|
{ |
589 |
chuckv |
1098 |
if (local_args_info.order_given) |
590 |
tim |
876 |
{ |
591 |
chuckv |
1098 |
fprintf (stderr, "%s: `--order' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
592 |
|
|
goto failure; |
593 |
tim |
876 |
} |
594 |
chuckv |
1098 |
if (args_info->order_given && ! override) |
595 |
|
|
continue; |
596 |
|
|
local_args_info.order_given = 1; |
597 |
tim |
876 |
args_info->order_given = 1; |
598 |
chuckv |
1098 |
args_info->order_arg = strtol (optarg, &stop_char, 0); |
599 |
|
|
if (!(stop_char && *stop_char == '\0')) { |
600 |
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
601 |
|
|
goto failure; |
602 |
|
|
} |
603 |
|
|
if (args_info->order_orig) |
604 |
|
|
free (args_info->order_orig); /* free previous string */ |
605 |
|
|
args_info->order_orig = gengetopt_strdup (optarg); |
606 |
|
|
} |
607 |
|
|
/* Radial rmsd. */ |
608 |
|
|
else if (strcmp (long_options[option_index].name, "r_rcorr") == 0) |
609 |
|
|
{ |
610 |
|
|
if (local_args_info.r_rcorr_given) |
611 |
|
|
{ |
612 |
|
|
fprintf (stderr, "%s: `--r_rcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
613 |
|
|
goto failure; |
614 |
|
|
} |
615 |
|
|
if (args_info->r_rcorr_given && ! override) |
616 |
|
|
continue; |
617 |
|
|
local_args_info.r_rcorr_given = 1; |
618 |
|
|
args_info->r_rcorr_given = 1; |
619 |
|
|
if (args_info->dynamicProps_group_counter && override) |
620 |
|
|
reset_group_dynamicProps (args_info); |
621 |
|
|
args_info->dynamicProps_group_counter += 1; |
622 |
tim |
876 |
break; |
623 |
|
|
} |
624 |
chuckv |
1112 |
/* Angular rmsd. */ |
625 |
|
|
else if (strcmp (long_options[option_index].name, "thetacorr") == 0) |
626 |
|
|
{ |
627 |
|
|
if (local_args_info.thetacorr_given) |
628 |
|
|
{ |
629 |
|
|
fprintf (stderr, "%s: `--thetacorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
630 |
|
|
goto failure; |
631 |
|
|
} |
632 |
|
|
if (args_info->thetacorr_given && ! override) |
633 |
|
|
continue; |
634 |
|
|
local_args_info.thetacorr_given = 1; |
635 |
|
|
args_info->thetacorr_given = 1; |
636 |
|
|
if (args_info->dynamicProps_group_counter && override) |
637 |
|
|
reset_group_dynamicProps (args_info); |
638 |
|
|
args_info->dynamicProps_group_counter += 1; |
639 |
|
|
break; |
640 |
|
|
} |
641 |
xsun |
1183 |
/* Directional rmsd for particles with unit vectors. */ |
642 |
|
|
else if (strcmp (long_options[option_index].name, "drcorr") == 0) |
643 |
|
|
{ |
644 |
|
|
if (local_args_info.drcorr_given) |
645 |
|
|
{ |
646 |
|
|
fprintf (stderr, "%s: `--drcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
647 |
|
|
goto failure; |
648 |
|
|
} |
649 |
|
|
if (args_info->drcorr_given && ! override) |
650 |
|
|
continue; |
651 |
|
|
local_args_info.drcorr_given = 1; |
652 |
|
|
args_info->drcorr_given = 1; |
653 |
|
|
if (args_info->dynamicProps_group_counter && override) |
654 |
|
|
reset_group_dynamicProps (args_info); |
655 |
|
|
args_info->dynamicProps_group_counter += 1; |
656 |
|
|
break; |
657 |
|
|
} |
658 |
tim |
876 |
|
659 |
chuckv |
1098 |
break; |
660 |
tim |
320 |
case '?': /* Invalid option. */ |
661 |
|
|
/* `getopt_long' already printed an error message. */ |
662 |
chuckv |
1098 |
goto failure; |
663 |
tim |
320 |
|
664 |
|
|
default: /* bug: option not considered. */ |
665 |
chuckv |
1098 |
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); |
666 |
tim |
320 |
abort (); |
667 |
|
|
} /* switch */ |
668 |
|
|
} /* while */ |
669 |
|
|
|
670 |
chuckv |
1098 |
if (args_info->dynamicProps_group_counter > 1) |
671 |
tim |
320 |
{ |
672 |
chuckv |
1098 |
fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); |
673 |
|
|
error = 1; |
674 |
tim |
320 |
} |
675 |
|
|
|
676 |
|
|
|
677 |
chuckv |
1098 |
|
678 |
|
|
if (check_required) |
679 |
tim |
320 |
{ |
680 |
chuckv |
1098 |
error += cmdline_parser_required2 (args_info, argv[0], additional_error); |
681 |
tim |
320 |
} |
682 |
|
|
|
683 |
chuckv |
1098 |
cmdline_parser_release (&local_args_info); |
684 |
|
|
|
685 |
|
|
if ( error ) |
686 |
|
|
return (EXIT_FAILURE); |
687 |
|
|
|
688 |
tim |
320 |
return 0; |
689 |
chuckv |
1098 |
|
690 |
|
|
failure: |
691 |
|
|
|
692 |
|
|
cmdline_parser_release (&local_args_info); |
693 |
|
|
return (EXIT_FAILURE); |
694 |
tim |
320 |
} |