ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/staticProps/StaticPropsCmd.c
Revision: 2701
Committed: Tue Apr 11 15:33:27 2006 UTC (18 years, 2 months ago) by gezelter
Content type: text/plain
File size: 37573 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 tim 1994 /*
2 gezelter 2701 File autogenerated by gengetopt version 2.16
3 tim 1994 generated with the following command:
4 gezelter 2701 gengetopt -F StaticPropsCmd
5 tim 1994
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 gezelter 2701 /* If we use autoconf. */
12     #ifdef HAVE_CONFIG_H
13     #include "config.h"
14     #endif
15 tim 1994
16     #include <stdio.h>
17     #include <stdlib.h>
18     #include <string.h>
19    
20     #include "getopt.h"
21    
22 tim 1995 #include "StaticPropsCmd.h"
23 tim 1994
24 gezelter 2701 static
25     void clear_given (struct gengetopt_args_info *args_info);
26     static
27     void clear_args (struct gengetopt_args_info *args_info);
28    
29     static int
30     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);
31    
32     static int
33     cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
34    
35     static char *
36     gengetopt_strdup (const char *s);
37    
38     static
39     void clear_given (struct gengetopt_args_info *args_info)
40     {
41     args_info->help_given = 0 ;
42     args_info->version_given = 0 ;
43     args_info->input_given = 0 ;
44     args_info->output_given = 0 ;
45     args_info->step_given = 0 ;
46     args_info->nrbins_given = 0 ;
47     args_info->nanglebins_given = 0 ;
48     args_info->length_given = 0 ;
49     args_info->zoffset_given = 0 ;
50     args_info->sele1_given = 0 ;
51     args_info->sele2_given = 0 ;
52     args_info->sele3_given = 0 ;
53     args_info->refsele_given = 0 ;
54     args_info->molname_given = 0 ;
55     args_info->begin_given = 0 ;
56     args_info->end_given = 0 ;
57     args_info->gofr_given = 0 ;
58     args_info->r_theta_given = 0 ;
59     args_info->r_omega_given = 0 ;
60     args_info->theta_omega_given = 0 ;
61     args_info->gxyz_given = 0 ;
62     args_info->p2_given = 0 ;
63     args_info->scd_given = 0 ;
64     args_info->density_given = 0 ;
65     args_info->slab_density_given = 0 ;
66     args_info->staticProps_group_counter = 0 ;
67     }
68    
69     static
70     void clear_args (struct gengetopt_args_info *args_info)
71     {
72     args_info->input_arg = NULL;
73     args_info->input_orig = NULL;
74     args_info->output_arg = NULL;
75     args_info->output_orig = NULL;
76     args_info->step_arg = 1;
77     args_info->step_orig = NULL;
78     args_info->nrbins_arg = 100;
79     args_info->nrbins_orig = NULL;
80     args_info->nanglebins_arg = 50;
81     args_info->nanglebins_orig = NULL;
82     args_info->length_orig = NULL;
83     args_info->zoffset_arg = 0;
84     args_info->zoffset_orig = NULL;
85     args_info->sele1_arg = NULL;
86     args_info->sele1_orig = NULL;
87     args_info->sele2_arg = NULL;
88     args_info->sele2_orig = NULL;
89     args_info->sele3_arg = NULL;
90     args_info->sele3_orig = NULL;
91     args_info->refsele_arg = NULL;
92     args_info->refsele_orig = NULL;
93     args_info->molname_arg = NULL;
94     args_info->molname_orig = NULL;
95     args_info->begin_orig = NULL;
96     args_info->end_orig = NULL;
97    
98     }
99    
100 tim 1994 void
101     cmdline_parser_print_version (void)
102     {
103     printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
104     }
105    
106     void
107     cmdline_parser_print_help (void)
108     {
109     cmdline_parser_print_version ();
110 gezelter 2701 printf("\nUsage: StaticProps [OPTIONS]...\n\n");
111     printf("%s\n"," -h, --help Print help and exit");
112     printf("%s\n"," -V, --version Print version and exit");
113     printf("%s\n"," -i, --input=filename input dump file");
114     printf("%s\n"," -o, --output=filename output file name");
115     printf("%s\n"," -n, --step=INT process every n frame (default=`1')");
116     printf("%s\n"," -r, --nrbins=INT number of bins for distance (default=`100')");
117     printf("%s\n"," -a, --nanglebins=INT number of bins for cos(angle) (default=`50')");
118     printf("%s\n"," -l, --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)");
119     printf("%s\n"," -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')");
120     printf("%s\n"," --sele1=selection script select the first stuntdouble set");
121     printf("%s\n"," --sele2=selection script select the second stuntdouble set");
122     printf("%s\n"," --sele3=selection script select the third stuntdouble set");
123     printf("%s\n"," --refsele=selection script\n select reference (use and only use with --gxyz)");
124     printf("%s\n"," --molname=STRING molecule name");
125     printf("%s\n"," --begin=INT begin interanl index");
126     printf("%s\n"," --end=INT end internal index");
127     printf("%s\n","\n Group: staticProps\n an option of this group is required");
128     printf("%s\n"," --gofr g(r)");
129     printf("%s\n"," --r_theta g(r, cos(theta))");
130     printf("%s\n"," --r_omega g(r, cos(omega))");
131     printf("%s\n"," --theta_omega g(cos(theta), cos(omega))");
132     printf("%s\n"," --gxyz g(x, y, z)");
133     printf("%s\n"," --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)");
134     printf("%s\n"," --scd scd order parameter(either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)");
135     printf("%s\n"," --density density plot (--sele1 must be specified)");
136     printf("%s\n"," --slab_density slab density (--sele1 must be specified)");
137    
138 tim 1994 }
139    
140 gezelter 2701 void
141     cmdline_parser_init (struct gengetopt_args_info *args_info)
142     {
143     clear_given (args_info);
144     clear_args (args_info);
145     }
146 tim 1994
147 gezelter 2701 static void
148     cmdline_parser_release (struct gengetopt_args_info *args_info)
149     {
150    
151     if (args_info->input_arg)
152     {
153     free (args_info->input_arg); /* free previous argument */
154     args_info->input_arg = 0;
155     }
156     if (args_info->input_orig)
157     {
158     free (args_info->input_orig); /* free previous argument */
159     args_info->input_orig = 0;
160     }
161     if (args_info->output_arg)
162     {
163     free (args_info->output_arg); /* free previous argument */
164     args_info->output_arg = 0;
165     }
166     if (args_info->output_orig)
167     {
168     free (args_info->output_orig); /* free previous argument */
169     args_info->output_orig = 0;
170     }
171     if (args_info->step_orig)
172     {
173     free (args_info->step_orig); /* free previous argument */
174     args_info->step_orig = 0;
175     }
176     if (args_info->nrbins_orig)
177     {
178     free (args_info->nrbins_orig); /* free previous argument */
179     args_info->nrbins_orig = 0;
180     }
181     if (args_info->nanglebins_orig)
182     {
183     free (args_info->nanglebins_orig); /* free previous argument */
184     args_info->nanglebins_orig = 0;
185     }
186     if (args_info->length_orig)
187     {
188     free (args_info->length_orig); /* free previous argument */
189     args_info->length_orig = 0;
190     }
191     if (args_info->zoffset_orig)
192     {
193     free (args_info->zoffset_orig); /* free previous argument */
194     args_info->zoffset_orig = 0;
195     }
196     if (args_info->sele1_arg)
197     {
198     free (args_info->sele1_arg); /* free previous argument */
199     args_info->sele1_arg = 0;
200     }
201     if (args_info->sele1_orig)
202     {
203     free (args_info->sele1_orig); /* free previous argument */
204     args_info->sele1_orig = 0;
205     }
206     if (args_info->sele2_arg)
207     {
208     free (args_info->sele2_arg); /* free previous argument */
209     args_info->sele2_arg = 0;
210     }
211     if (args_info->sele2_orig)
212     {
213     free (args_info->sele2_orig); /* free previous argument */
214     args_info->sele2_orig = 0;
215     }
216     if (args_info->sele3_arg)
217     {
218     free (args_info->sele3_arg); /* free previous argument */
219     args_info->sele3_arg = 0;
220     }
221     if (args_info->sele3_orig)
222     {
223     free (args_info->sele3_orig); /* free previous argument */
224     args_info->sele3_orig = 0;
225     }
226     if (args_info->refsele_arg)
227     {
228     free (args_info->refsele_arg); /* free previous argument */
229     args_info->refsele_arg = 0;
230     }
231     if (args_info->refsele_orig)
232     {
233     free (args_info->refsele_orig); /* free previous argument */
234     args_info->refsele_orig = 0;
235     }
236     if (args_info->molname_arg)
237     {
238     free (args_info->molname_arg); /* free previous argument */
239     args_info->molname_arg = 0;
240     }
241     if (args_info->molname_orig)
242     {
243     free (args_info->molname_orig); /* free previous argument */
244     args_info->molname_orig = 0;
245     }
246     if (args_info->begin_orig)
247     {
248     free (args_info->begin_orig); /* free previous argument */
249     args_info->begin_orig = 0;
250     }
251     if (args_info->end_orig)
252     {
253     free (args_info->end_orig); /* free previous argument */
254     args_info->end_orig = 0;
255     }
256    
257     clear_given (args_info);
258     }
259 tim 1994
260 gezelter 2701 int
261     cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
262     {
263     FILE *outfile;
264     int i = 0;
265    
266     outfile = fopen(filename, "w");
267    
268     if (!outfile)
269     {
270     fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
271     return EXIT_FAILURE;
272     }
273    
274     if (args_info->help_given) {
275     fprintf(outfile, "%s\n", "help");
276     }
277     if (args_info->version_given) {
278     fprintf(outfile, "%s\n", "version");
279     }
280     if (args_info->input_given) {
281     if (args_info->input_orig) {
282     fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig);
283     } else {
284     fprintf(outfile, "%s\n", "input");
285     }
286     }
287     if (args_info->output_given) {
288     if (args_info->output_orig) {
289     fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig);
290     } else {
291     fprintf(outfile, "%s\n", "output");
292     }
293     }
294     if (args_info->step_given) {
295     if (args_info->step_orig) {
296     fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig);
297     } else {
298     fprintf(outfile, "%s\n", "step");
299     }
300     }
301     if (args_info->nrbins_given) {
302     if (args_info->nrbins_orig) {
303     fprintf(outfile, "%s=\"%s\"\n", "nrbins", args_info->nrbins_orig);
304     } else {
305     fprintf(outfile, "%s\n", "nrbins");
306     }
307     }
308     if (args_info->nanglebins_given) {
309     if (args_info->nanglebins_orig) {
310     fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig);
311     } else {
312     fprintf(outfile, "%s\n", "nanglebins");
313     }
314     }
315     if (args_info->length_given) {
316     if (args_info->length_orig) {
317     fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig);
318     } else {
319     fprintf(outfile, "%s\n", "length");
320     }
321     }
322     if (args_info->zoffset_given) {
323     if (args_info->zoffset_orig) {
324     fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig);
325     } else {
326     fprintf(outfile, "%s\n", "zoffset");
327     }
328     }
329     if (args_info->sele1_given) {
330     if (args_info->sele1_orig) {
331     fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig);
332     } else {
333     fprintf(outfile, "%s\n", "sele1");
334     }
335     }
336     if (args_info->sele2_given) {
337     if (args_info->sele2_orig) {
338     fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig);
339     } else {
340     fprintf(outfile, "%s\n", "sele2");
341     }
342     }
343     if (args_info->sele3_given) {
344     if (args_info->sele3_orig) {
345     fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig);
346     } else {
347     fprintf(outfile, "%s\n", "sele3");
348     }
349     }
350     if (args_info->refsele_given) {
351     if (args_info->refsele_orig) {
352     fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig);
353     } else {
354     fprintf(outfile, "%s\n", "refsele");
355     }
356     }
357     if (args_info->molname_given) {
358     if (args_info->molname_orig) {
359     fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig);
360     } else {
361     fprintf(outfile, "%s\n", "molname");
362     }
363     }
364     if (args_info->begin_given) {
365     if (args_info->begin_orig) {
366     fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig);
367     } else {
368     fprintf(outfile, "%s\n", "begin");
369     }
370     }
371     if (args_info->end_given) {
372     if (args_info->end_orig) {
373     fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig);
374     } else {
375     fprintf(outfile, "%s\n", "end");
376     }
377     }
378     if (args_info->gofr_given) {
379     fprintf(outfile, "%s\n", "gofr");
380     }
381     if (args_info->r_theta_given) {
382     fprintf(outfile, "%s\n", "r_theta");
383     }
384     if (args_info->r_omega_given) {
385     fprintf(outfile, "%s\n", "r_omega");
386     }
387     if (args_info->theta_omega_given) {
388     fprintf(outfile, "%s\n", "theta_omega");
389     }
390     if (args_info->gxyz_given) {
391     fprintf(outfile, "%s\n", "gxyz");
392     }
393     if (args_info->p2_given) {
394     fprintf(outfile, "%s\n", "p2");
395     }
396     if (args_info->scd_given) {
397     fprintf(outfile, "%s\n", "scd");
398     }
399     if (args_info->density_given) {
400     fprintf(outfile, "%s\n", "density");
401     }
402     if (args_info->slab_density_given) {
403     fprintf(outfile, "%s\n", "slab_density");
404     }
405    
406     fclose (outfile);
407    
408     i = EXIT_SUCCESS;
409     return i;
410     }
411    
412     void
413     cmdline_parser_free (struct gengetopt_args_info *args_info)
414     {
415     cmdline_parser_release (args_info);
416     }
417    
418    
419 tim 1994 /* gengetopt_strdup() */
420     /* strdup.c replacement of strdup, which is not standard */
421     char *
422     gengetopt_strdup (const char *s)
423     {
424 gezelter 2701 char *result = NULL;
425     if (!s)
426     return result;
427    
428     result = (char*)malloc(strlen(s) + 1);
429 tim 1994 if (result == (char*)0)
430     return (char*)0;
431     strcpy(result, s);
432     return result;
433     }
434    
435 gezelter 2701 static void
436     reset_group_staticProps(struct gengetopt_args_info *args_info);
437    
438     static void
439     reset_group_staticProps(struct gengetopt_args_info *args_info)
440 tim 1994 {
441 gezelter 2701 if (! args_info->staticProps_group_counter)
442     return;
443 tim 1994
444     args_info->gofr_given = 0 ;
445     args_info->r_theta_given = 0 ;
446     args_info->r_omega_given = 0 ;
447     args_info->theta_omega_given = 0 ;
448 tim 2053 args_info->gxyz_given = 0 ;
449 tim 2240 args_info->p2_given = 0 ;
450 tim 2241 args_info->scd_given = 0 ;
451 tim 2242 args_info->density_given = 0 ;
452 tim 2539 args_info->slab_density_given = 0 ;
453 gezelter 2701
454     args_info->staticProps_group_counter = 0;
455 tim 2240 }
456 tim 1994
457 gezelter 2701 int
458     cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
459     {
460     return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
461     }
462 tim 1994
463 gezelter 2701 int
464     cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
465     {
466     int result;
467    
468     result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL);
469    
470     if (result == EXIT_FAILURE)
471     {
472     cmdline_parser_free (args_info);
473     exit (EXIT_FAILURE);
474     }
475    
476     return result;
477     }
478    
479     int
480     cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
481     {
482     int result = EXIT_SUCCESS;
483    
484     if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
485     result = EXIT_FAILURE;
486    
487     if (result == EXIT_FAILURE)
488     {
489     cmdline_parser_free (args_info);
490     exit (EXIT_FAILURE);
491     }
492    
493     return result;
494     }
495    
496     int
497     cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
498     {
499     int error = 0;
500    
501     if (! args_info->input_given)
502     {
503     fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
504     error = 1;
505     }
506     if (args_info->staticProps_group_counter == 0)
507     {
508     fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
509     error = 1;
510     }
511    
512    
513     return error;
514     }
515    
516     int
517     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)
518     {
519     int c; /* Character of the parsed option. */
520    
521     int error = 0;
522     struct gengetopt_args_info local_args_info;
523    
524     if (initialize)
525     cmdline_parser_init (args_info);
526    
527     cmdline_parser_init (&local_args_info);
528    
529 tim 1994 optarg = 0;
530 gezelter 2701 optind = 0;
531 tim 1994 opterr = 1;
532     optopt = '?';
533    
534     while (1)
535     {
536     int option_index = 0;
537     char *stop_char;
538    
539     static struct option long_options[] = {
540     { "help", 0, NULL, 'h' },
541     { "version", 0, NULL, 'V' },
542     { "input", 1, NULL, 'i' },
543     { "output", 1, NULL, 'o' },
544 tim 1995 { "step", 1, NULL, 'n' },
545     { "nrbins", 1, NULL, 'r' },
546 tim 1994 { "nanglebins", 1, NULL, 'a' },
547     { "length", 1, NULL, 'l' },
548 gezelter 2701 { "zoffset", 1, NULL, 'z' },
549 tim 1994 { "sele1", 1, NULL, 0 },
550     { "sele2", 1, NULL, 0 },
551 tim 2241 { "sele3", 1, NULL, 0 },
552 tim 2053 { "refsele", 1, NULL, 0 },
553 tim 2241 { "molname", 1, NULL, 0 },
554     { "begin", 1, NULL, 0 },
555     { "end", 1, NULL, 0 },
556 tim 1994 { "gofr", 0, NULL, 0 },
557     { "r_theta", 0, NULL, 0 },
558     { "r_omega", 0, NULL, 0 },
559     { "theta_omega", 0, NULL, 0 },
560 tim 2053 { "gxyz", 0, NULL, 0 },
561 tim 2240 { "p2", 0, NULL, 0 },
562 tim 2241 { "scd", 0, NULL, 0 },
563 tim 2242 { "density", 0, NULL, 0 },
564 tim 2539 { "slab_density", 0, NULL, 0 },
565 tim 1994 { NULL, 0, NULL, 0 }
566     };
567    
568     stop_char = 0;
569 gezelter 2701 c = getopt_long (argc, argv, "hVi:o:n:r:a:l:z:", long_options, &option_index);
570 tim 1994
571     if (c == -1) break; /* Exit from `while (1)' loop. */
572    
573     switch (c)
574     {
575     case 'h': /* Print help and exit. */
576     cmdline_parser_print_help ();
577 gezelter 2701 cmdline_parser_free (&local_args_info);
578 tim 1994 exit (EXIT_SUCCESS);
579    
580     case 'V': /* Print version and exit. */
581     cmdline_parser_print_version ();
582 gezelter 2701 cmdline_parser_free (&local_args_info);
583 tim 1994 exit (EXIT_SUCCESS);
584    
585     case 'i': /* input dump file. */
586 gezelter 2701 if (local_args_info.input_given)
587 tim 1994 {
588 gezelter 2701 fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
589     goto failure;
590 tim 1994 }
591 gezelter 2701 if (args_info->input_given && ! override)
592     continue;
593     local_args_info.input_given = 1;
594 tim 1994 args_info->input_given = 1;
595 gezelter 2701 if (args_info->input_arg)
596     free (args_info->input_arg); /* free previous string */
597 tim 1994 args_info->input_arg = gengetopt_strdup (optarg);
598 gezelter 2701 if (args_info->input_orig)
599     free (args_info->input_orig); /* free previous string */
600     args_info->input_orig = gengetopt_strdup (optarg);
601 tim 1994 break;
602    
603     case 'o': /* output file name. */
604 gezelter 2701 if (local_args_info.output_given)
605 tim 1994 {
606 gezelter 2701 fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
607     goto failure;
608 tim 1994 }
609 gezelter 2701 if (args_info->output_given && ! override)
610     continue;
611     local_args_info.output_given = 1;
612 tim 1994 args_info->output_given = 1;
613 gezelter 2701 if (args_info->output_arg)
614     free (args_info->output_arg); /* free previous string */
615 tim 1994 args_info->output_arg = gengetopt_strdup (optarg);
616 gezelter 2701 if (args_info->output_orig)
617     free (args_info->output_orig); /* free previous string */
618     args_info->output_orig = gengetopt_strdup (optarg);
619 tim 1994 break;
620    
621 tim 1995 case 'n': /* process every n frame. */
622 gezelter 2701 if (local_args_info.step_given)
623 tim 1994 {
624 gezelter 2701 fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
625     goto failure;
626 tim 1994 }
627 gezelter 2701 if (args_info->step_given && ! override)
628     continue;
629     local_args_info.step_given = 1;
630 tim 1995 args_info->step_given = 1;
631 gezelter 2701 args_info->step_arg = strtol (optarg, &stop_char, 0);
632     if (!(stop_char && *stop_char == '\0')) {
633     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
634     goto failure;
635     }
636     if (args_info->step_orig)
637     free (args_info->step_orig); /* free previous string */
638     args_info->step_orig = gengetopt_strdup (optarg);
639 tim 1994 break;
640    
641 tim 1995 case 'r': /* number of bins for distance. */
642 gezelter 2701 if (local_args_info.nrbins_given)
643 tim 1994 {
644 gezelter 2701 fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
645     goto failure;
646 tim 1994 }
647 gezelter 2701 if (args_info->nrbins_given && ! override)
648     continue;
649     local_args_info.nrbins_given = 1;
650 tim 1995 args_info->nrbins_given = 1;
651 gezelter 2701 args_info->nrbins_arg = strtol (optarg, &stop_char, 0);
652     if (!(stop_char && *stop_char == '\0')) {
653     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
654     goto failure;
655     }
656     if (args_info->nrbins_orig)
657     free (args_info->nrbins_orig); /* free previous string */
658     args_info->nrbins_orig = gengetopt_strdup (optarg);
659 tim 1994 break;
660    
661     case 'a': /* number of bins for cos(angle). */
662 gezelter 2701 if (local_args_info.nanglebins_given)
663 tim 1994 {
664 gezelter 2701 fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
665     goto failure;
666 tim 1994 }
667 gezelter 2701 if (args_info->nanglebins_given && ! override)
668     continue;
669     local_args_info.nanglebins_given = 1;
670 tim 1994 args_info->nanglebins_given = 1;
671 gezelter 2701 args_info->nanglebins_arg = strtol (optarg, &stop_char, 0);
672     if (!(stop_char && *stop_char == '\0')) {
673     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
674     goto failure;
675     }
676     if (args_info->nanglebins_orig)
677     free (args_info->nanglebins_orig); /* free previous string */
678     args_info->nanglebins_orig = gengetopt_strdup (optarg);
679 tim 1994 break;
680    
681 tim 2038 case 'l': /* maximum length (Defaults to 1/2 smallest length of first frame). */
682 gezelter 2701 if (local_args_info.length_given)
683 tim 1994 {
684 gezelter 2701 fprintf (stderr, "%s: `--length' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
685     goto failure;
686 tim 1994 }
687 gezelter 2701 if (args_info->length_given && ! override)
688     continue;
689     local_args_info.length_given = 1;
690 tim 1994 args_info->length_given = 1;
691 gezelter 2701 args_info->length_arg = strtod (optarg, &stop_char);
692     if (!(stop_char && *stop_char == '\0')) {
693     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
694     goto failure;
695     }
696     if (args_info->length_orig)
697     free (args_info->length_orig); /* free previous string */
698     args_info->length_orig = gengetopt_strdup (optarg);
699 tim 1994 break;
700    
701 gezelter 2701 case 'z': /* Where to set the zero for the slab_density calculation. */
702     if (local_args_info.zoffset_given)
703     {
704     fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
705     goto failure;
706     }
707     if (args_info->zoffset_given && ! override)
708     continue;
709     local_args_info.zoffset_given = 1;
710     args_info->zoffset_given = 1;
711     args_info->zoffset_arg = strtod (optarg, &stop_char);
712     if (!(stop_char && *stop_char == '\0')) {
713     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
714     goto failure;
715     }
716     if (args_info->zoffset_orig)
717     free (args_info->zoffset_orig); /* free previous string */
718     args_info->zoffset_orig = gengetopt_strdup (optarg);
719     break;
720 tim 1994
721 gezelter 2701
722 tim 1994 case 0: /* Long option with no short option */
723 tim 2241 /* select the first stuntdouble set. */
724 tim 1994 if (strcmp (long_options[option_index].name, "sele1") == 0)
725 tim 2240 {
726 gezelter 2701 if (local_args_info.sele1_given)
727 tim 2240 {
728 gezelter 2701 fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
729     goto failure;
730 tim 2240 }
731 gezelter 2701 if (args_info->sele1_given && ! override)
732     continue;
733     local_args_info.sele1_given = 1;
734 tim 2240 args_info->sele1_given = 1;
735 gezelter 2701 if (args_info->sele1_arg)
736     free (args_info->sele1_arg); /* free previous string */
737 tim 2240 args_info->sele1_arg = gengetopt_strdup (optarg);
738 gezelter 2701 if (args_info->sele1_orig)
739     free (args_info->sele1_orig); /* free previous string */
740     args_info->sele1_orig = gengetopt_strdup (optarg);
741 tim 2240 }
742 tim 2241 /* select the second stuntdouble set. */
743 tim 1994 else if (strcmp (long_options[option_index].name, "sele2") == 0)
744 tim 2240 {
745 gezelter 2701 if (local_args_info.sele2_given)
746 tim 2240 {
747 gezelter 2701 fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
748     goto failure;
749 tim 2240 }
750 gezelter 2701 if (args_info->sele2_given && ! override)
751     continue;
752     local_args_info.sele2_given = 1;
753 tim 2240 args_info->sele2_given = 1;
754 gezelter 2701 if (args_info->sele2_arg)
755     free (args_info->sele2_arg); /* free previous string */
756 tim 2240 args_info->sele2_arg = gengetopt_strdup (optarg);
757 gezelter 2701 if (args_info->sele2_orig)
758     free (args_info->sele2_orig); /* free previous string */
759     args_info->sele2_orig = gengetopt_strdup (optarg);
760 tim 2240 }
761 tim 2241 /* select the third stuntdouble set. */
762     else if (strcmp (long_options[option_index].name, "sele3") == 0)
763     {
764 gezelter 2701 if (local_args_info.sele3_given)
765 tim 2241 {
766 gezelter 2701 fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
767     goto failure;
768 tim 2241 }
769 gezelter 2701 if (args_info->sele3_given && ! override)
770     continue;
771     local_args_info.sele3_given = 1;
772 tim 2241 args_info->sele3_given = 1;
773 gezelter 2701 if (args_info->sele3_arg)
774     free (args_info->sele3_arg); /* free previous string */
775 tim 2241 args_info->sele3_arg = gengetopt_strdup (optarg);
776 gezelter 2701 if (args_info->sele3_orig)
777     free (args_info->sele3_orig); /* free previous string */
778     args_info->sele3_orig = gengetopt_strdup (optarg);
779 tim 2241 }
780 tim 2053 /* select reference (use and only use with --gxyz). */
781     else if (strcmp (long_options[option_index].name, "refsele") == 0)
782 tim 2240 {
783 gezelter 2701 if (local_args_info.refsele_given)
784 tim 2240 {
785 gezelter 2701 fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
786     goto failure;
787 tim 2240 }
788 gezelter 2701 if (args_info->refsele_given && ! override)
789     continue;
790     local_args_info.refsele_given = 1;
791 tim 2240 args_info->refsele_given = 1;
792 gezelter 2701 if (args_info->refsele_arg)
793     free (args_info->refsele_arg); /* free previous string */
794 tim 2240 args_info->refsele_arg = gengetopt_strdup (optarg);
795 gezelter 2701 if (args_info->refsele_orig)
796     free (args_info->refsele_orig); /* free previous string */
797     args_info->refsele_orig = gengetopt_strdup (optarg);
798 tim 2240 }
799 tim 2241 /* molecule name. */
800     else if (strcmp (long_options[option_index].name, "molname") == 0)
801     {
802 gezelter 2701 if (local_args_info.molname_given)
803 tim 2241 {
804 gezelter 2701 fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
805     goto failure;
806 tim 2241 }
807 gezelter 2701 if (args_info->molname_given && ! override)
808     continue;
809     local_args_info.molname_given = 1;
810 tim 2241 args_info->molname_given = 1;
811 gezelter 2701 if (args_info->molname_arg)
812     free (args_info->molname_arg); /* free previous string */
813 tim 2241 args_info->molname_arg = gengetopt_strdup (optarg);
814 gezelter 2701 if (args_info->molname_orig)
815     free (args_info->molname_orig); /* free previous string */
816     args_info->molname_orig = gengetopt_strdup (optarg);
817 tim 2241 }
818     /* begin interanl index. */
819     else if (strcmp (long_options[option_index].name, "begin") == 0)
820     {
821 gezelter 2701 if (local_args_info.begin_given)
822 tim 2241 {
823 gezelter 2701 fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
824     goto failure;
825 tim 2241 }
826 gezelter 2701 if (args_info->begin_given && ! override)
827     continue;
828     local_args_info.begin_given = 1;
829 tim 2241 args_info->begin_given = 1;
830 gezelter 2701 args_info->begin_arg = strtol (optarg, &stop_char, 0);
831     if (!(stop_char && *stop_char == '\0')) {
832     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
833     goto failure;
834     }
835     if (args_info->begin_orig)
836     free (args_info->begin_orig); /* free previous string */
837     args_info->begin_orig = gengetopt_strdup (optarg);
838 tim 2241 }
839     /* end internal index. */
840     else if (strcmp (long_options[option_index].name, "end") == 0)
841     {
842 gezelter 2701 if (local_args_info.end_given)
843 tim 2241 {
844 gezelter 2701 fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
845     goto failure;
846 tim 2241 }
847 gezelter 2701 if (args_info->end_given && ! override)
848     continue;
849     local_args_info.end_given = 1;
850 tim 2241 args_info->end_given = 1;
851 gezelter 2701 args_info->end_arg = strtol (optarg, &stop_char, 0);
852     if (!(stop_char && *stop_char == '\0')) {
853     fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
854     goto failure;
855     }
856     if (args_info->end_orig)
857     free (args_info->end_orig); /* free previous string */
858     args_info->end_orig = gengetopt_strdup (optarg);
859 tim 2241 }
860 tim 1994 /* g(r). */
861     else if (strcmp (long_options[option_index].name, "gofr") == 0)
862 tim 2240 {
863 gezelter 2701 if (local_args_info.gofr_given)
864 tim 2240 {
865 gezelter 2701 fprintf (stderr, "%s: `--gofr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
866     goto failure;
867 tim 2240 }
868 gezelter 2701 if (args_info->gofr_given && ! override)
869     continue;
870     local_args_info.gofr_given = 1;
871     args_info->gofr_given = 1;
872     if (args_info->staticProps_group_counter && override)
873     reset_group_staticProps (args_info);
874     args_info->staticProps_group_counter += 1;
875 tim 2240 break;
876     }
877 tim 1994 /* g(r, cos(theta)). */
878     else if (strcmp (long_options[option_index].name, "r_theta") == 0)
879 tim 2240 {
880 gezelter 2701 if (local_args_info.r_theta_given)
881 tim 2240 {
882 gezelter 2701 fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
883     goto failure;
884 tim 2240 }
885 gezelter 2701 if (args_info->r_theta_given && ! override)
886     continue;
887     local_args_info.r_theta_given = 1;
888     args_info->r_theta_given = 1;
889     if (args_info->staticProps_group_counter && override)
890     reset_group_staticProps (args_info);
891     args_info->staticProps_group_counter += 1;
892 tim 2240 break;
893     }
894 tim 1994 /* g(r, cos(omega)). */
895     else if (strcmp (long_options[option_index].name, "r_omega") == 0)
896 tim 2240 {
897 gezelter 2701 if (local_args_info.r_omega_given)
898 tim 2240 {
899 gezelter 2701 fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
900     goto failure;
901 tim 2240 }
902 gezelter 2701 if (args_info->r_omega_given && ! override)
903     continue;
904     local_args_info.r_omega_given = 1;
905     args_info->r_omega_given = 1;
906     if (args_info->staticProps_group_counter && override)
907     reset_group_staticProps (args_info);
908     args_info->staticProps_group_counter += 1;
909 tim 2240 break;
910     }
911 tim 1994 /* g(cos(theta), cos(omega)). */
912     else if (strcmp (long_options[option_index].name, "theta_omega") == 0)
913 tim 2240 {
914 gezelter 2701 if (local_args_info.theta_omega_given)
915 tim 2240 {
916 gezelter 2701 fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
917     goto failure;
918 tim 2240 }
919 gezelter 2701 if (args_info->theta_omega_given && ! override)
920     continue;
921     local_args_info.theta_omega_given = 1;
922     args_info->theta_omega_given = 1;
923     if (args_info->staticProps_group_counter && override)
924     reset_group_staticProps (args_info);
925     args_info->staticProps_group_counter += 1;
926 tim 2240 break;
927     }
928 tim 1994 /* g(x, y, z). */
929 tim 2053 else if (strcmp (long_options[option_index].name, "gxyz") == 0)
930 tim 2240 {
931 gezelter 2701 if (local_args_info.gxyz_given)
932 tim 2240 {
933 gezelter 2701 fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
934     goto failure;
935 tim 2240 }
936 gezelter 2701 if (args_info->gxyz_given && ! override)
937     continue;
938     local_args_info.gxyz_given = 1;
939     args_info->gxyz_given = 1;
940     if (args_info->staticProps_group_counter && override)
941     reset_group_staticProps (args_info);
942     args_info->staticProps_group_counter += 1;
943 tim 2240 break;
944     }
945 tim 2241 /* p2 order parameter (--sele1 and --sele2 must be specified). */
946 tim 2240 else if (strcmp (long_options[option_index].name, "p2") == 0)
947     {
948 gezelter 2701 if (local_args_info.p2_given)
949 tim 2240 {
950 gezelter 2701 fprintf (stderr, "%s: `--p2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
951     goto failure;
952 tim 2240 }
953 gezelter 2701 if (args_info->p2_given && ! override)
954     continue;
955     local_args_info.p2_given = 1;
956     args_info->p2_given = 1;
957     if (args_info->staticProps_group_counter && override)
958     reset_group_staticProps (args_info);
959     args_info->staticProps_group_counter += 1;
960 tim 2240 break;
961     }
962 tim 2241 /* scd order parameter(either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */
963     else if (strcmp (long_options[option_index].name, "scd") == 0)
964     {
965 gezelter 2701 if (local_args_info.scd_given)
966 tim 2241 {
967 gezelter 2701 fprintf (stderr, "%s: `--scd' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
968     goto failure;
969 tim 2241 }
970 gezelter 2701 if (args_info->scd_given && ! override)
971     continue;
972     local_args_info.scd_given = 1;
973     args_info->scd_given = 1;
974     if (args_info->staticProps_group_counter && override)
975     reset_group_staticProps (args_info);
976     args_info->staticProps_group_counter += 1;
977 tim 2241 break;
978     }
979 tim 2242 /* density plot (--sele1 must be specified). */
980     else if (strcmp (long_options[option_index].name, "density") == 0)
981     {
982 gezelter 2701 if (local_args_info.density_given)
983 tim 2242 {
984 gezelter 2701 fprintf (stderr, "%s: `--density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
985     goto failure;
986 tim 2242 }
987 gezelter 2701 if (args_info->density_given && ! override)
988     continue;
989     local_args_info.density_given = 1;
990     args_info->density_given = 1;
991     if (args_info->staticProps_group_counter && override)
992     reset_group_staticProps (args_info);
993     args_info->staticProps_group_counter += 1;
994 tim 2242 break;
995     }
996 tim 2539 /* slab density (--sele1 must be specified). */
997     else if (strcmp (long_options[option_index].name, "slab_density") == 0)
998     {
999 gezelter 2701 if (local_args_info.slab_density_given)
1000 tim 2539 {
1001 gezelter 2701 fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1002     goto failure;
1003 tim 2539 }
1004 gezelter 2701 if (args_info->slab_density_given && ! override)
1005     continue;
1006     local_args_info.slab_density_given = 1;
1007     args_info->slab_density_given = 1;
1008     if (args_info->staticProps_group_counter && override)
1009     reset_group_staticProps (args_info);
1010     args_info->staticProps_group_counter += 1;
1011 tim 2539 break;
1012     }
1013    
1014 gezelter 2701 break;
1015 tim 1994 case '?': /* Invalid option. */
1016     /* `getopt_long' already printed an error message. */
1017 gezelter 2701 goto failure;
1018 tim 1994
1019     default: /* bug: option not considered. */
1020 gezelter 2701 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1021 tim 1994 abort ();
1022     } /* switch */
1023     } /* while */
1024    
1025 gezelter 2701 if (args_info->staticProps_group_counter > 1)
1026 tim 1994 {
1027 gezelter 2701 fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
1028     error = 1;
1029 tim 1994 }
1030    
1031    
1032 gezelter 2701
1033     if (check_required)
1034 tim 1994 {
1035 gezelter 2701 error += cmdline_parser_required2 (args_info, argv[0], additional_error);
1036 tim 1994 }
1037    
1038 gezelter 2701 cmdline_parser_release (&local_args_info);
1039    
1040     if ( error )
1041     return (EXIT_FAILURE);
1042    
1043 tim 1994 return 0;
1044 gezelter 2701
1045     failure:
1046    
1047     cmdline_parser_release (&local_args_info);
1048     return (EXIT_FAILURE);
1049 tim 1994 }