ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/dynamicProps/DynamicPropsCmd.c
Revision: 1604
Committed: Mon Aug 8 18:53:40 2011 UTC (13 years, 8 months ago) by jmichalk
Content type: text/plain
File size: 28190 byte(s)
Log Message:
This commit should allow EADM simulations to be run on the cluster. Main additions include EADM_FF.hpp/cpp as well as a system dipole correlation option in DynamicProps.

File Contents

# User Rev Content
1 tim 320 /*
2 chuckv 1565 File autogenerated by gengetopt version 2.22.4
3 tim 320 generated with the following command:
4 jmichalk 1604 /usr/local/bin/gengetopt -F DynamicPropsCmd -i DynamicProps.ggo
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 chuckv 1565 #ifndef FIX_UNUSED
21     #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22     #endif
23 tim 320
24 chuckv 1565 #include <getopt.h>
25 tim 320
26 chuckv 1566 #include "DynamicPropsCmd.h"
27 chuckv 1565
28     const char *gengetopt_args_info_purpose = "";
29    
30 jmichalk 1604 const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]...";
31 chuckv 1565
32     const char *gengetopt_args_info_description = "";
33    
34     const char *gengetopt_args_info_help[] = {
35     " -h, --help Print help and exit",
36     " -V, --version Print version and exit",
37     " -i, --input=filename input dump file",
38     " -o, --output=filename output file name",
39     " --sele1=selection script select first stuntdouble set",
40     " --sele2=selection script select second stuntdouble set (if sele2 is not \n set, use script from sele1)",
41     " --order=INT Lengendre Polynomial Order",
42 gezelter 1596 " -m, --memory=memory specification\n Available memory (defaults to 2G) \n (default=`2G')",
43 chuckv 1565 "\n Group: dynamicProps\n an option of this group is required",
44     " -r, --rcorr rmsd",
45     " -v, --vcorr velocity correlation function",
46     " -d, --dcorr dipole correlation function",
47     " -l, --lcorr Lengendre correlation function",
48 jmichalk 1604 " -s, --sdcorr System dipole correlation function",
49 chuckv 1565 " --r_rcorr Radial rmsd",
50     " --thetacorr Angular rmsd",
51     " --drcorr Directional rmsd for particles with unit \n vectors",
52     " --helfandEcorr Helfand moment for thermal conductvity",
53     " --stresscorr Stress tensor correlation function",
54     0
55     };
56    
57     typedef enum {ARG_NO
58     , ARG_STRING
59     , ARG_INT
60     } cmdline_parser_arg_type;
61    
62 chuckv 1098 static
63     void clear_given (struct gengetopt_args_info *args_info);
64     static
65     void clear_args (struct gengetopt_args_info *args_info);
66    
67     static int
68 chuckv 1565 cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
69     struct cmdline_parser_params *params, const char *additional_error);
70 chuckv 1098
71     static int
72     cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
73    
74     static char *
75     gengetopt_strdup (const char *s);
76    
77     static
78     void clear_given (struct gengetopt_args_info *args_info)
79     {
80     args_info->help_given = 0 ;
81     args_info->version_given = 0 ;
82     args_info->input_given = 0 ;
83     args_info->output_given = 0 ;
84     args_info->sele1_given = 0 ;
85     args_info->sele2_given = 0 ;
86     args_info->order_given = 0 ;
87 gezelter 1596 args_info->memory_given = 0 ;
88 chuckv 1098 args_info->rcorr_given = 0 ;
89     args_info->vcorr_given = 0 ;
90     args_info->dcorr_given = 0 ;
91     args_info->lcorr_given = 0 ;
92 jmichalk 1604 args_info->sdcorr_given = 0 ;
93 chuckv 1098 args_info->r_rcorr_given = 0 ;
94 chuckv 1112 args_info->thetacorr_given = 0 ;
95 xsun 1183 args_info->drcorr_given = 0 ;
96 chuckv 1245 args_info->helfandEcorr_given = 0 ;
97 chuckv 1565 args_info->stresscorr_given = 0 ;
98 chuckv 1098 args_info->dynamicProps_group_counter = 0 ;
99     }
100    
101     static
102     void clear_args (struct gengetopt_args_info *args_info)
103     {
104 chuckv 1565 FIX_UNUSED (args_info);
105 chuckv 1098 args_info->input_arg = NULL;
106     args_info->input_orig = NULL;
107     args_info->output_arg = NULL;
108     args_info->output_orig = NULL;
109     args_info->sele1_arg = NULL;
110     args_info->sele1_orig = NULL;
111     args_info->sele2_arg = NULL;
112     args_info->sele2_orig = NULL;
113     args_info->order_orig = NULL;
114 gezelter 1596 args_info->memory_arg = gengetopt_strdup ("2G");
115     args_info->memory_orig = NULL;
116 chuckv 1098
117     }
118    
119 chuckv 1565 static
120     void init_args_info(struct gengetopt_args_info *args_info)
121     {
122    
123    
124     args_info->help_help = gengetopt_args_info_help[0] ;
125     args_info->version_help = gengetopt_args_info_help[1] ;
126     args_info->input_help = gengetopt_args_info_help[2] ;
127     args_info->output_help = gengetopt_args_info_help[3] ;
128     args_info->sele1_help = gengetopt_args_info_help[4] ;
129     args_info->sele2_help = gengetopt_args_info_help[5] ;
130     args_info->order_help = gengetopt_args_info_help[6] ;
131 gezelter 1596 args_info->memory_help = gengetopt_args_info_help[7] ;
132     args_info->rcorr_help = gengetopt_args_info_help[9] ;
133     args_info->vcorr_help = gengetopt_args_info_help[10] ;
134     args_info->dcorr_help = gengetopt_args_info_help[11] ;
135     args_info->lcorr_help = gengetopt_args_info_help[12] ;
136 jmichalk 1604 args_info->sdcorr_help = gengetopt_args_info_help[13] ;
137     args_info->r_rcorr_help = gengetopt_args_info_help[14] ;
138     args_info->thetacorr_help = gengetopt_args_info_help[15] ;
139     args_info->drcorr_help = gengetopt_args_info_help[16] ;
140     args_info->helfandEcorr_help = gengetopt_args_info_help[17] ;
141     args_info->stresscorr_help = gengetopt_args_info_help[18] ;
142 chuckv 1565
143     }
144    
145 tim 320 void
146     cmdline_parser_print_version (void)
147     {
148 chuckv 1565 printf ("%s %s\n",
149     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
150     CMDLINE_PARSER_VERSION);
151 tim 320 }
152    
153 chuckv 1565 static void print_help_common(void) {
154     cmdline_parser_print_version ();
155    
156     if (strlen(gengetopt_args_info_purpose) > 0)
157     printf("\n%s\n", gengetopt_args_info_purpose);
158    
159     if (strlen(gengetopt_args_info_usage) > 0)
160     printf("\n%s\n", gengetopt_args_info_usage);
161    
162     printf("\n");
163    
164     if (strlen(gengetopt_args_info_description) > 0)
165     printf("%s\n\n", gengetopt_args_info_description);
166     }
167    
168 tim 320 void
169     cmdline_parser_print_help (void)
170     {
171 chuckv 1565 int i = 0;
172     print_help_common();
173     while (gengetopt_args_info_help[i])
174     printf("%s\n", gengetopt_args_info_help[i++]);
175 tim 320 }
176    
177 chuckv 1098 void
178     cmdline_parser_init (struct gengetopt_args_info *args_info)
179     {
180     clear_given (args_info);
181     clear_args (args_info);
182 chuckv 1565 init_args_info (args_info);
183 chuckv 1098 }
184 tim 320
185 chuckv 1565 void
186     cmdline_parser_params_init(struct cmdline_parser_params *params)
187     {
188     if (params)
189     {
190     params->override = 0;
191     params->initialize = 1;
192     params->check_required = 1;
193     params->check_ambiguity = 0;
194     params->print_errors = 1;
195     }
196     }
197    
198     struct cmdline_parser_params *
199     cmdline_parser_params_create(void)
200     {
201     struct cmdline_parser_params *params =
202     (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
203     cmdline_parser_params_init(params);
204     return params;
205     }
206    
207 chuckv 1098 static void
208 chuckv 1565 free_string_field (char **s)
209     {
210     if (*s)
211     {
212     free (*s);
213     *s = 0;
214     }
215     }
216    
217    
218     static void
219 chuckv 1098 cmdline_parser_release (struct gengetopt_args_info *args_info)
220     {
221 jmichalk 1604
222 chuckv 1565 free_string_field (&(args_info->input_arg));
223     free_string_field (&(args_info->input_orig));
224     free_string_field (&(args_info->output_arg));
225     free_string_field (&(args_info->output_orig));
226     free_string_field (&(args_info->sele1_arg));
227     free_string_field (&(args_info->sele1_orig));
228     free_string_field (&(args_info->sele2_arg));
229     free_string_field (&(args_info->sele2_orig));
230     free_string_field (&(args_info->order_orig));
231 gezelter 1596 free_string_field (&(args_info->memory_arg));
232     free_string_field (&(args_info->memory_orig));
233 chuckv 1098
234 chuckv 1565
235    
236     clear_given (args_info);
237     }
238    
239    
240     static void
241     write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
242     {
243     FIX_UNUSED (values);
244     if (arg) {
245     fprintf(outfile, "%s=\"%s\"\n", opt, arg);
246     } else {
247     fprintf(outfile, "%s\n", opt);
248     }
249     }
250    
251    
252     int
253     cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
254     {
255     int i = 0;
256    
257     if (!outfile)
258 chuckv 1098 {
259 chuckv 1565 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
260     return EXIT_FAILURE;
261 chuckv 1098 }
262 chuckv 1565
263     if (args_info->help_given)
264     write_into_file(outfile, "help", 0, 0 );
265     if (args_info->version_given)
266     write_into_file(outfile, "version", 0, 0 );
267     if (args_info->input_given)
268     write_into_file(outfile, "input", args_info->input_orig, 0);
269     if (args_info->output_given)
270     write_into_file(outfile, "output", args_info->output_orig, 0);
271     if (args_info->sele1_given)
272     write_into_file(outfile, "sele1", args_info->sele1_orig, 0);
273     if (args_info->sele2_given)
274     write_into_file(outfile, "sele2", args_info->sele2_orig, 0);
275     if (args_info->order_given)
276     write_into_file(outfile, "order", args_info->order_orig, 0);
277 gezelter 1596 if (args_info->memory_given)
278     write_into_file(outfile, "memory", args_info->memory_orig, 0);
279 chuckv 1565 if (args_info->rcorr_given)
280     write_into_file(outfile, "rcorr", 0, 0 );
281     if (args_info->vcorr_given)
282     write_into_file(outfile, "vcorr", 0, 0 );
283     if (args_info->dcorr_given)
284     write_into_file(outfile, "dcorr", 0, 0 );
285     if (args_info->lcorr_given)
286     write_into_file(outfile, "lcorr", 0, 0 );
287 jmichalk 1604 if (args_info->sdcorr_given)
288     write_into_file(outfile, "sdcorr", 0, 0 );
289 chuckv 1565 if (args_info->r_rcorr_given)
290     write_into_file(outfile, "r_rcorr", 0, 0 );
291     if (args_info->thetacorr_given)
292     write_into_file(outfile, "thetacorr", 0, 0 );
293     if (args_info->drcorr_given)
294     write_into_file(outfile, "drcorr", 0, 0 );
295     if (args_info->helfandEcorr_given)
296     write_into_file(outfile, "helfandEcorr", 0, 0 );
297     if (args_info->stresscorr_given)
298     write_into_file(outfile, "stresscorr", 0, 0 );
299 chuckv 1098
300 chuckv 1565
301     i = EXIT_SUCCESS;
302     return i;
303 chuckv 1098 }
304 tim 320
305 chuckv 1098 int
306     cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
307     {
308     FILE *outfile;
309     int i = 0;
310    
311     outfile = fopen(filename, "w");
312    
313     if (!outfile)
314     {
315     fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
316     return EXIT_FAILURE;
317     }
318    
319 chuckv 1565 i = cmdline_parser_dump(outfile, args_info);
320 chuckv 1098 fclose (outfile);
321    
322     return i;
323     }
324    
325     void
326     cmdline_parser_free (struct gengetopt_args_info *args_info)
327     {
328     cmdline_parser_release (args_info);
329     }
330    
331 chuckv 1565 /** @brief replacement of strdup, which is not standard */
332 tim 320 char *
333     gengetopt_strdup (const char *s)
334     {
335 chuckv 1565 char *result = 0;
336 chuckv 1098 if (!s)
337     return result;
338    
339     result = (char*)malloc(strlen(s) + 1);
340 tim 320 if (result == (char*)0)
341     return (char*)0;
342     strcpy(result, s);
343     return result;
344     }
345    
346 chuckv 1098 static void
347     reset_group_dynamicProps(struct gengetopt_args_info *args_info)
348 tim 320 {
349 chuckv 1098 if (! args_info->dynamicProps_group_counter)
350     return;
351 tim 320
352     args_info->rcorr_given = 0 ;
353     args_info->vcorr_given = 0 ;
354     args_info->dcorr_given = 0 ;
355 tim 876 args_info->lcorr_given = 0 ;
356 jmichalk 1604 args_info->sdcorr_given = 0 ;
357 chuckv 1098 args_info->r_rcorr_given = 0 ;
358 chuckv 1112 args_info->thetacorr_given = 0 ;
359 xsun 1183 args_info->drcorr_given = 0 ;
360 chuckv 1245 args_info->helfandEcorr_given = 0 ;
361 chuckv 1565 args_info->stresscorr_given = 0 ;
362 chuckv 1098
363     args_info->dynamicProps_group_counter = 0;
364 tim 876 }
365 tim 320
366 chuckv 1098 int
367 chuckv 1565 cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
368 chuckv 1098 {
369     return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
370     }
371 tim 320
372 chuckv 1098 int
373 chuckv 1565 cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
374     struct cmdline_parser_params *params)
375 chuckv 1098 {
376     int result;
377 chuckv 1565 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
378 chuckv 1098
379 chuckv 1565 if (result == EXIT_FAILURE)
380     {
381     cmdline_parser_free (args_info);
382     exit (EXIT_FAILURE);
383     }
384    
385     return result;
386     }
387 chuckv 1098
388 chuckv 1565 int
389     cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
390     {
391     int result;
392     struct cmdline_parser_params params;
393    
394     params.override = override;
395     params.initialize = initialize;
396     params.check_required = check_required;
397     params.check_ambiguity = 0;
398     params.print_errors = 1;
399    
400     result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
401    
402 chuckv 1098 if (result == EXIT_FAILURE)
403     {
404     cmdline_parser_free (args_info);
405     exit (EXIT_FAILURE);
406     }
407    
408     return result;
409     }
410    
411     int
412     cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
413     {
414     int result = EXIT_SUCCESS;
415    
416 chuckv 1565 if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
417 chuckv 1098 result = EXIT_FAILURE;
418    
419     if (result == EXIT_FAILURE)
420     {
421     cmdline_parser_free (args_info);
422     exit (EXIT_FAILURE);
423     }
424    
425     return result;
426     }
427    
428     int
429     cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
430     {
431     int error = 0;
432 chuckv 1565 FIX_UNUSED (additional_error);
433 chuckv 1098
434 chuckv 1565 /* checks for required options */
435 chuckv 1098 if (! args_info->input_given)
436     {
437     fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
438     error = 1;
439     }
440 chuckv 1565
441 chuckv 1098 if (args_info->dynamicProps_group_counter == 0)
442     {
443 chuckv 1565 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 : ""));
444 chuckv 1098 error = 1;
445     }
446    
447    
448 chuckv 1565 /* checks for dependences among options */
449    
450 chuckv 1098 return error;
451     }
452    
453 chuckv 1565
454     static char *package_name = 0;
455    
456     /**
457     * @brief updates an option
458     * @param field the generic pointer to the field to update
459     * @param orig_field the pointer to the orig field
460     * @param field_given the pointer to the number of occurrence of this option
461     * @param prev_given the pointer to the number of occurrence already seen
462     * @param value the argument for this option (if null no arg was specified)
463     * @param possible_values the possible values for this option (if specified)
464     * @param default_value the default value (in case the option only accepts fixed values)
465     * @param arg_type the type of this option
466     * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
467     * @param override @see cmdline_parser_params.override
468     * @param no_free whether to free a possible previous value
469     * @param multiple_option whether this is a multiple option
470     * @param long_opt the corresponding long option
471     * @param short_opt the corresponding short option (or '-' if none)
472     * @param additional_error possible further error specification
473     */
474     static
475     int update_arg(void *field, char **orig_field,
476     unsigned int *field_given, unsigned int *prev_given,
477     char *value, const char *possible_values[],
478     const char *default_value,
479     cmdline_parser_arg_type arg_type,
480     int check_ambiguity, int override,
481     int no_free, int multiple_option,
482     const char *long_opt, char short_opt,
483     const char *additional_error)
484     {
485     char *stop_char = 0;
486     const char *val = value;
487     int found;
488     char **string_field;
489     FIX_UNUSED (field);
490    
491     stop_char = 0;
492     found = 0;
493    
494     if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
495     {
496     if (short_opt != '-')
497     fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
498     package_name, long_opt, short_opt,
499     (additional_error ? additional_error : ""));
500     else
501     fprintf (stderr, "%s: `--%s' option given more than once%s\n",
502     package_name, long_opt,
503     (additional_error ? additional_error : ""));
504     return 1; /* failure */
505     }
506    
507     FIX_UNUSED (default_value);
508    
509     if (field_given && *field_given && ! override)
510     return 0;
511     if (prev_given)
512     (*prev_given)++;
513     if (field_given)
514     (*field_given)++;
515     if (possible_values)
516     val = possible_values[found];
517    
518     switch(arg_type) {
519     case ARG_INT:
520     if (val) *((int *)field) = strtol (val, &stop_char, 0);
521     break;
522     case ARG_STRING:
523     if (val) {
524     string_field = (char **)field;
525     if (!no_free && *string_field)
526     free (*string_field); /* free previous string */
527     *string_field = gengetopt_strdup (val);
528     }
529     break;
530     default:
531     break;
532     };
533    
534     /* check numeric conversion */
535     switch(arg_type) {
536     case ARG_INT:
537     if (val && !(stop_char && *stop_char == '\0')) {
538     fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
539     return 1; /* failure */
540     }
541     break;
542     default:
543     ;
544     };
545    
546     /* store the original value */
547     switch(arg_type) {
548     case ARG_NO:
549     break;
550     default:
551     if (value && orig_field) {
552     if (no_free) {
553     *orig_field = value;
554     } else {
555     if (*orig_field)
556     free (*orig_field); /* free previous string */
557     *orig_field = gengetopt_strdup (value);
558     }
559     }
560     };
561    
562     return 0; /* OK */
563     }
564    
565    
566 chuckv 1098 int
567 chuckv 1565 cmdline_parser_internal (
568     int argc, char **argv, struct gengetopt_args_info *args_info,
569     struct cmdline_parser_params *params, const char *additional_error)
570 chuckv 1098 {
571     int c; /* Character of the parsed option. */
572    
573     int error = 0;
574     struct gengetopt_args_info local_args_info;
575 chuckv 1565
576     int override;
577     int initialize;
578     int check_required;
579     int check_ambiguity;
580    
581     package_name = argv[0];
582    
583     override = params->override;
584     initialize = params->initialize;
585     check_required = params->check_required;
586     check_ambiguity = params->check_ambiguity;
587 chuckv 1098
588     if (initialize)
589     cmdline_parser_init (args_info);
590    
591     cmdline_parser_init (&local_args_info);
592    
593 tim 320 optarg = 0;
594 chuckv 1565 optind = 0;
595     opterr = params->print_errors;
596 tim 320 optopt = '?';
597    
598     while (1)
599     {
600     int option_index = 0;
601    
602     static struct option long_options[] = {
603     { "help", 0, NULL, 'h' },
604     { "version", 0, NULL, 'V' },
605     { "input", 1, NULL, 'i' },
606     { "output", 1, NULL, 'o' },
607     { "sele1", 1, NULL, 0 },
608     { "sele2", 1, NULL, 0 },
609 tim 876 { "order", 1, NULL, 0 },
610 gezelter 1596 { "memory", 1, NULL, 'm' },
611 tim 320 { "rcorr", 0, NULL, 'r' },
612     { "vcorr", 0, NULL, 'v' },
613     { "dcorr", 0, NULL, 'd' },
614 tim 876 { "lcorr", 0, NULL, 'l' },
615 jmichalk 1604 { "sdcorr", 0, NULL, 's' },
616 chuckv 1098 { "r_rcorr", 0, NULL, 0 },
617 chuckv 1112 { "thetacorr", 0, NULL, 0 },
618 xsun 1183 { "drcorr", 0, NULL, 0 },
619 chuckv 1245 { "helfandEcorr", 0, NULL, 0 },
620 chuckv 1565 { "stresscorr", 0, NULL, 0 },
621     { 0, 0, 0, 0 }
622 tim 320 };
623    
624 jmichalk 1604 c = getopt_long (argc, argv, "hVi:o:m:rvdls", long_options, &option_index);
625 tim 320
626     if (c == -1) break; /* Exit from `while (1)' loop. */
627    
628     switch (c)
629     {
630     case 'h': /* Print help and exit. */
631     cmdline_parser_print_help ();
632 chuckv 1098 cmdline_parser_free (&local_args_info);
633 tim 320 exit (EXIT_SUCCESS);
634    
635     case 'V': /* Print version and exit. */
636     cmdline_parser_print_version ();
637 chuckv 1098 cmdline_parser_free (&local_args_info);
638 tim 320 exit (EXIT_SUCCESS);
639    
640     case 'i': /* input dump file. */
641 chuckv 1565
642    
643     if (update_arg( (void *)&(args_info->input_arg),
644     &(args_info->input_orig), &(args_info->input_given),
645     &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
646     check_ambiguity, override, 0, 0,
647     "input", 'i',
648     additional_error))
649     goto failure;
650    
651 tim 320 break;
652     case 'o': /* output file name. */
653 chuckv 1565
654    
655     if (update_arg( (void *)&(args_info->output_arg),
656     &(args_info->output_orig), &(args_info->output_given),
657     &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
658     check_ambiguity, override, 0, 0,
659     "output", 'o',
660     additional_error))
661     goto failure;
662    
663 tim 320 break;
664 gezelter 1596 case 'm': /* Available memory (defaults to 2G). */
665    
666    
667     if (update_arg( (void *)&(args_info->memory_arg),
668     &(args_info->memory_orig), &(args_info->memory_given),
669     &(local_args_info.memory_given), optarg, 0, "2G", ARG_STRING,
670     check_ambiguity, override, 0, 0,
671     "memory", 'm',
672     additional_error))
673     goto failure;
674    
675     break;
676 tim 917 case 'r': /* rmsd. */
677 chuckv 1565
678 chuckv 1098 if (args_info->dynamicProps_group_counter && override)
679     reset_group_dynamicProps (args_info);
680     args_info->dynamicProps_group_counter += 1;
681 chuckv 1565
682     if (update_arg( 0 ,
683     0 , &(args_info->rcorr_given),
684     &(local_args_info.rcorr_given), optarg, 0, 0, ARG_NO,
685     check_ambiguity, override, 0, 0,
686     "rcorr", 'r',
687     additional_error))
688     goto failure;
689    
690 chuckv 1098 break;
691 tim 320 case 'v': /* velocity correlation function. */
692 chuckv 1565
693 chuckv 1098 if (args_info->dynamicProps_group_counter && override)
694     reset_group_dynamicProps (args_info);
695     args_info->dynamicProps_group_counter += 1;
696 chuckv 1565
697     if (update_arg( 0 ,
698     0 , &(args_info->vcorr_given),
699     &(local_args_info.vcorr_given), optarg, 0, 0, ARG_NO,
700     check_ambiguity, override, 0, 0,
701     "vcorr", 'v',
702     additional_error))
703     goto failure;
704    
705 chuckv 1098 break;
706 tim 320 case 'd': /* dipole correlation function. */
707 chuckv 1565
708 chuckv 1098 if (args_info->dynamicProps_group_counter && override)
709     reset_group_dynamicProps (args_info);
710     args_info->dynamicProps_group_counter += 1;
711 chuckv 1565
712     if (update_arg( 0 ,
713     0 , &(args_info->dcorr_given),
714     &(local_args_info.dcorr_given), optarg, 0, 0, ARG_NO,
715     check_ambiguity, override, 0, 0,
716     "dcorr", 'd',
717     additional_error))
718     goto failure;
719    
720 chuckv 1098 break;
721 tim 876 case 'l': /* Lengendre correlation function. */
722 chuckv 1565
723 chuckv 1098 if (args_info->dynamicProps_group_counter && override)
724     reset_group_dynamicProps (args_info);
725     args_info->dynamicProps_group_counter += 1;
726 chuckv 1565
727     if (update_arg( 0 ,
728     0 , &(args_info->lcorr_given),
729     &(local_args_info.lcorr_given), optarg, 0, 0, ARG_NO,
730     check_ambiguity, override, 0, 0,
731     "lcorr", 'l',
732     additional_error))
733     goto failure;
734    
735 chuckv 1098 break;
736 jmichalk 1604 case 's': /* System dipole correlation function. */
737    
738     if (args_info->dynamicProps_group_counter && override)
739     reset_group_dynamicProps (args_info);
740     args_info->dynamicProps_group_counter += 1;
741    
742     if (update_arg( 0 ,
743     0 , &(args_info->sdcorr_given),
744     &(local_args_info.sdcorr_given), optarg, 0, 0, ARG_NO,
745     check_ambiguity, override, 0, 0,
746     "sdcorr", 's',
747     additional_error))
748     goto failure;
749    
750     break;
751 tim 320
752     case 0: /* Long option with no short option */
753     /* select first stuntdouble set. */
754     if (strcmp (long_options[option_index].name, "sele1") == 0)
755 tim 876 {
756 chuckv 1565
757    
758     if (update_arg( (void *)&(args_info->sele1_arg),
759     &(args_info->sele1_orig), &(args_info->sele1_given),
760     &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING,
761     check_ambiguity, override, 0, 0,
762     "sele1", '-',
763     additional_error))
764     goto failure;
765    
766 tim 876 }
767 tim 320 /* select second stuntdouble set (if sele2 is not set, use script from sele1). */
768     else if (strcmp (long_options[option_index].name, "sele2") == 0)
769 tim 876 {
770 chuckv 1565
771    
772     if (update_arg( (void *)&(args_info->sele2_arg),
773     &(args_info->sele2_orig), &(args_info->sele2_given),
774     &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING,
775     check_ambiguity, override, 0, 0,
776     "sele2", '-',
777     additional_error))
778     goto failure;
779    
780 tim 876 }
781     /* Lengendre Polynomial Order. */
782     else if (strcmp (long_options[option_index].name, "order") == 0)
783     {
784 chuckv 1565
785    
786     if (update_arg( (void *)&(args_info->order_arg),
787     &(args_info->order_orig), &(args_info->order_given),
788     &(local_args_info.order_given), optarg, 0, 0, ARG_INT,
789     check_ambiguity, override, 0, 0,
790     "order", '-',
791     additional_error))
792     goto failure;
793    
794 chuckv 1098 }
795     /* Radial rmsd. */
796     else if (strcmp (long_options[option_index].name, "r_rcorr") == 0)
797     {
798 chuckv 1565
799 chuckv 1098 if (args_info->dynamicProps_group_counter && override)
800     reset_group_dynamicProps (args_info);
801     args_info->dynamicProps_group_counter += 1;
802 chuckv 1565
803     if (update_arg( 0 ,
804     0 , &(args_info->r_rcorr_given),
805     &(local_args_info.r_rcorr_given), optarg, 0, 0, ARG_NO,
806     check_ambiguity, override, 0, 0,
807     "r_rcorr", '-',
808     additional_error))
809     goto failure;
810    
811 tim 876 }
812 chuckv 1112 /* Angular rmsd. */
813     else if (strcmp (long_options[option_index].name, "thetacorr") == 0)
814     {
815 chuckv 1565
816 chuckv 1112 if (args_info->dynamicProps_group_counter && override)
817     reset_group_dynamicProps (args_info);
818     args_info->dynamicProps_group_counter += 1;
819 chuckv 1565
820     if (update_arg( 0 ,
821     0 , &(args_info->thetacorr_given),
822     &(local_args_info.thetacorr_given), optarg, 0, 0, ARG_NO,
823     check_ambiguity, override, 0, 0,
824     "thetacorr", '-',
825     additional_error))
826     goto failure;
827    
828 chuckv 1112 }
829 xsun 1183 /* Directional rmsd for particles with unit vectors. */
830     else if (strcmp (long_options[option_index].name, "drcorr") == 0)
831     {
832 chuckv 1565
833 xsun 1183 if (args_info->dynamicProps_group_counter && override)
834     reset_group_dynamicProps (args_info);
835     args_info->dynamicProps_group_counter += 1;
836 chuckv 1565
837     if (update_arg( 0 ,
838     0 , &(args_info->drcorr_given),
839     &(local_args_info.drcorr_given), optarg, 0, 0, ARG_NO,
840     check_ambiguity, override, 0, 0,
841     "drcorr", '-',
842     additional_error))
843     goto failure;
844    
845 xsun 1183 }
846 chuckv 1245 /* Helfand moment for thermal conductvity. */
847     else if (strcmp (long_options[option_index].name, "helfandEcorr") == 0)
848     {
849 chuckv 1565
850 chuckv 1245 if (args_info->dynamicProps_group_counter && override)
851     reset_group_dynamicProps (args_info);
852     args_info->dynamicProps_group_counter += 1;
853 chuckv 1565
854     if (update_arg( 0 ,
855     0 , &(args_info->helfandEcorr_given),
856     &(local_args_info.helfandEcorr_given), optarg, 0, 0, ARG_NO,
857     check_ambiguity, override, 0, 0,
858     "helfandEcorr", '-',
859     additional_error))
860     goto failure;
861    
862 chuckv 1245 }
863 chuckv 1565 /* Stress tensor correlation function. */
864     else if (strcmp (long_options[option_index].name, "stresscorr") == 0)
865     {
866 tim 876
867 chuckv 1565 if (args_info->dynamicProps_group_counter && override)
868     reset_group_dynamicProps (args_info);
869     args_info->dynamicProps_group_counter += 1;
870    
871     if (update_arg( 0 ,
872     0 , &(args_info->stresscorr_given),
873     &(local_args_info.stresscorr_given), optarg, 0, 0, ARG_NO,
874     check_ambiguity, override, 0, 0,
875     "stresscorr", '-',
876     additional_error))
877     goto failure;
878    
879     }
880    
881 chuckv 1098 break;
882 tim 320 case '?': /* Invalid option. */
883     /* `getopt_long' already printed an error message. */
884 chuckv 1098 goto failure;
885 tim 320
886     default: /* bug: option not considered. */
887 chuckv 1098 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
888 tim 320 abort ();
889     } /* switch */
890     } /* while */
891    
892 chuckv 1098 if (args_info->dynamicProps_group_counter > 1)
893 tim 320 {
894 chuckv 1565 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 : ""));
895 chuckv 1098 error = 1;
896 tim 320 }
897    
898    
899 chuckv 1098
900     if (check_required)
901 tim 320 {
902 chuckv 1098 error += cmdline_parser_required2 (args_info, argv[0], additional_error);
903 tim 320 }
904    
905 chuckv 1098 cmdline_parser_release (&local_args_info);
906    
907     if ( error )
908     return (EXIT_FAILURE);
909    
910 tim 320 return 0;
911 chuckv 1098
912     failure:
913    
914     cmdline_parser_release (&local_args_info);
915     return (EXIT_FAILURE);
916 tim 320 }

Properties

Name Value
svn:keywords Author Id Revision Date