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

# Content
1 /*
2 File autogenerated by gengetopt version 2.22.4
3 generated with the following command:
4 /usr/local/bin/gengetopt -F DynamicPropsCmd -i DynamicProps.ggo
5
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 /* If we use autoconf. */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19
20 #ifndef FIX_UNUSED
21 #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 #endif
23
24 #include <getopt.h>
25
26 #include "DynamicPropsCmd.h"
27
28 const char *gengetopt_args_info_purpose = "";
29
30 const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]...";
31
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 " -m, --memory=memory specification\n Available memory (defaults to 2G) \n (default=`2G')",
43 "\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 " -s, --sdcorr System dipole correlation function",
49 " --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 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 cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
69 struct cmdline_parser_params *params, const char *additional_error);
70
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 args_info->memory_given = 0 ;
88 args_info->rcorr_given = 0 ;
89 args_info->vcorr_given = 0 ;
90 args_info->dcorr_given = 0 ;
91 args_info->lcorr_given = 0 ;
92 args_info->sdcorr_given = 0 ;
93 args_info->r_rcorr_given = 0 ;
94 args_info->thetacorr_given = 0 ;
95 args_info->drcorr_given = 0 ;
96 args_info->helfandEcorr_given = 0 ;
97 args_info->stresscorr_given = 0 ;
98 args_info->dynamicProps_group_counter = 0 ;
99 }
100
101 static
102 void clear_args (struct gengetopt_args_info *args_info)
103 {
104 FIX_UNUSED (args_info);
105 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 args_info->memory_arg = gengetopt_strdup ("2G");
115 args_info->memory_orig = NULL;
116
117 }
118
119 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 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 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
143 }
144
145 void
146 cmdline_parser_print_version (void)
147 {
148 printf ("%s %s\n",
149 (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
150 CMDLINE_PARSER_VERSION);
151 }
152
153 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 void
169 cmdline_parser_print_help (void)
170 {
171 int i = 0;
172 print_help_common();
173 while (gengetopt_args_info_help[i])
174 printf("%s\n", gengetopt_args_info_help[i++]);
175 }
176
177 void
178 cmdline_parser_init (struct gengetopt_args_info *args_info)
179 {
180 clear_given (args_info);
181 clear_args (args_info);
182 init_args_info (args_info);
183 }
184
185 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 static void
208 free_string_field (char **s)
209 {
210 if (*s)
211 {
212 free (*s);
213 *s = 0;
214 }
215 }
216
217
218 static void
219 cmdline_parser_release (struct gengetopt_args_info *args_info)
220 {
221
222 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 free_string_field (&(args_info->memory_arg));
232 free_string_field (&(args_info->memory_orig));
233
234
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 {
259 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
260 return EXIT_FAILURE;
261 }
262
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 if (args_info->memory_given)
278 write_into_file(outfile, "memory", args_info->memory_orig, 0);
279 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 if (args_info->sdcorr_given)
288 write_into_file(outfile, "sdcorr", 0, 0 );
289 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
300
301 i = EXIT_SUCCESS;
302 return i;
303 }
304
305 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 i = cmdline_parser_dump(outfile, args_info);
320 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 /** @brief replacement of strdup, which is not standard */
332 char *
333 gengetopt_strdup (const char *s)
334 {
335 char *result = 0;
336 if (!s)
337 return result;
338
339 result = (char*)malloc(strlen(s) + 1);
340 if (result == (char*)0)
341 return (char*)0;
342 strcpy(result, s);
343 return result;
344 }
345
346 static void
347 reset_group_dynamicProps(struct gengetopt_args_info *args_info)
348 {
349 if (! args_info->dynamicProps_group_counter)
350 return;
351
352 args_info->rcorr_given = 0 ;
353 args_info->vcorr_given = 0 ;
354 args_info->dcorr_given = 0 ;
355 args_info->lcorr_given = 0 ;
356 args_info->sdcorr_given = 0 ;
357 args_info->r_rcorr_given = 0 ;
358 args_info->thetacorr_given = 0 ;
359 args_info->drcorr_given = 0 ;
360 args_info->helfandEcorr_given = 0 ;
361 args_info->stresscorr_given = 0 ;
362
363 args_info->dynamicProps_group_counter = 0;
364 }
365
366 int
367 cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
368 {
369 return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
370 }
371
372 int
373 cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
374 struct cmdline_parser_params *params)
375 {
376 int result;
377 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
378
379 if (result == EXIT_FAILURE)
380 {
381 cmdline_parser_free (args_info);
382 exit (EXIT_FAILURE);
383 }
384
385 return result;
386 }
387
388 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 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 if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
417 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 FIX_UNUSED (additional_error);
433
434 /* checks for required options */
435 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
441 if (args_info->dynamicProps_group_counter == 0)
442 {
443 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 error = 1;
445 }
446
447
448 /* checks for dependences among options */
449
450 return error;
451 }
452
453
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 int
567 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 {
571 int c; /* Character of the parsed option. */
572
573 int error = 0;
574 struct gengetopt_args_info local_args_info;
575
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
588 if (initialize)
589 cmdline_parser_init (args_info);
590
591 cmdline_parser_init (&local_args_info);
592
593 optarg = 0;
594 optind = 0;
595 opterr = params->print_errors;
596 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 { "order", 1, NULL, 0 },
610 { "memory", 1, NULL, 'm' },
611 { "rcorr", 0, NULL, 'r' },
612 { "vcorr", 0, NULL, 'v' },
613 { "dcorr", 0, NULL, 'd' },
614 { "lcorr", 0, NULL, 'l' },
615 { "sdcorr", 0, NULL, 's' },
616 { "r_rcorr", 0, NULL, 0 },
617 { "thetacorr", 0, NULL, 0 },
618 { "drcorr", 0, NULL, 0 },
619 { "helfandEcorr", 0, NULL, 0 },
620 { "stresscorr", 0, NULL, 0 },
621 { 0, 0, 0, 0 }
622 };
623
624 c = getopt_long (argc, argv, "hVi:o:m:rvdls", long_options, &option_index);
625
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 cmdline_parser_free (&local_args_info);
633 exit (EXIT_SUCCESS);
634
635 case 'V': /* Print version and exit. */
636 cmdline_parser_print_version ();
637 cmdline_parser_free (&local_args_info);
638 exit (EXIT_SUCCESS);
639
640 case 'i': /* input dump file. */
641
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 break;
652 case 'o': /* output file name. */
653
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 break;
664 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 case 'r': /* rmsd. */
677
678 if (args_info->dynamicProps_group_counter && override)
679 reset_group_dynamicProps (args_info);
680 args_info->dynamicProps_group_counter += 1;
681
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 break;
691 case 'v': /* velocity correlation function. */
692
693 if (args_info->dynamicProps_group_counter && override)
694 reset_group_dynamicProps (args_info);
695 args_info->dynamicProps_group_counter += 1;
696
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 break;
706 case 'd': /* dipole correlation function. */
707
708 if (args_info->dynamicProps_group_counter && override)
709 reset_group_dynamicProps (args_info);
710 args_info->dynamicProps_group_counter += 1;
711
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 break;
721 case 'l': /* Lengendre correlation function. */
722
723 if (args_info->dynamicProps_group_counter && override)
724 reset_group_dynamicProps (args_info);
725 args_info->dynamicProps_group_counter += 1;
726
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 break;
736 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
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 {
756
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 }
767 /* 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 {
770
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 }
781 /* Lengendre Polynomial Order. */
782 else if (strcmp (long_options[option_index].name, "order") == 0)
783 {
784
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 }
795 /* Radial rmsd. */
796 else if (strcmp (long_options[option_index].name, "r_rcorr") == 0)
797 {
798
799 if (args_info->dynamicProps_group_counter && override)
800 reset_group_dynamicProps (args_info);
801 args_info->dynamicProps_group_counter += 1;
802
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 }
812 /* Angular rmsd. */
813 else if (strcmp (long_options[option_index].name, "thetacorr") == 0)
814 {
815
816 if (args_info->dynamicProps_group_counter && override)
817 reset_group_dynamicProps (args_info);
818 args_info->dynamicProps_group_counter += 1;
819
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 }
829 /* Directional rmsd for particles with unit vectors. */
830 else if (strcmp (long_options[option_index].name, "drcorr") == 0)
831 {
832
833 if (args_info->dynamicProps_group_counter && override)
834 reset_group_dynamicProps (args_info);
835 args_info->dynamicProps_group_counter += 1;
836
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 }
846 /* Helfand moment for thermal conductvity. */
847 else if (strcmp (long_options[option_index].name, "helfandEcorr") == 0)
848 {
849
850 if (args_info->dynamicProps_group_counter && override)
851 reset_group_dynamicProps (args_info);
852 args_info->dynamicProps_group_counter += 1;
853
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 }
863 /* Stress tensor correlation function. */
864 else if (strcmp (long_options[option_index].name, "stresscorr") == 0)
865 {
866
867 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 break;
882 case '?': /* Invalid option. */
883 /* `getopt_long' already printed an error message. */
884 goto failure;
885
886 default: /* bug: option not considered. */
887 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
888 abort ();
889 } /* switch */
890 } /* while */
891
892 if (args_info->dynamicProps_group_counter > 1)
893 {
894 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 error = 1;
896 }
897
898
899
900 if (check_required)
901 {
902 error += cmdline_parser_required2 (args_info, argv[0], additional_error);
903 }
904
905 cmdline_parser_release (&local_args_info);
906
907 if ( error )
908 return (EXIT_FAILURE);
909
910 return 0;
911
912 failure:
913
914 cmdline_parser_release (&local_args_info);
915 return (EXIT_FAILURE);
916 }

Properties

Name Value
svn:keywords Author Id Revision Date