ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/staticProps/StaticPropsCmd.c
(Generate patch)

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 1522 by kstocke1, Fri Nov 19 20:26:36 2010 UTC vs.
Revision 1585 by gezelter, Sun Jun 19 17:51:15 2011 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.22
2 >  File autogenerated by gengetopt version 2.22.4
3    generated with the following command:
4    gengetopt -F StaticPropsCmd -u
5  
# Line 17 | Line 17
17   #include <stdlib.h>
18   #include <string.h>
19  
20 < #include "getopt.h"
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 "StaticPropsCmd.h"
27  
28   const char *gengetopt_args_info_purpose = "";
# Line 36 | Line 40 | const char *gengetopt_args_info_help[] = {
40    "  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')",
41    "  -x, --nbins_x=INT             number of bins in x axis  (default=`100')",
42    "  -y, --nbins_y=INT             number of bins in y axis  (default=`100')",
43 +  "      --nbins_z=INT             number of bins in z axis  (default=`100')",
44    "  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')",
45    "  -c, --rcut=DOUBLE             cutoff radius (rcut)",
46    "      --dz=DOUBLE               slab width (dz)",
# Line 60 | Line 65 | const char *gengetopt_args_info_help[] = {
65    "      --gofz                    g(z)",
66    "      --r_theta                 g(r, cos(theta))",
67    "      --r_omega                 g(r, cos(omega))",
68 +  "      --r_z                     g(r, z)",
69    "      --theta_omega             g(cos(theta), cos(omega))",
70    "      --gxyz                    g(x, y, z)",
71    "      --twodgofr                2D g(r) (Slab width --dz must be specified)",
72 <  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
72 >  "  -p, --p2                      p2 order parameter (--sele1 must be specified, \n                                  --sele2 is optional)",
73    "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
74    "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
75    "  -d, --density                 density plot",
# Line 73 | Line 79 | const char *gengetopt_args_info_help[] = {
79    "      --rho_r                   rho of R",
80    "      --angle_r                 angle of R",
81    "      --hullvol                 hull volume of nanoparticle",
82 +  "      --rodlength               length of nanorod",
83 +  "  -Q, --tet_param               tetrahedrality order parameter",
84      0
85   };
86  
# Line 88 | Line 96 | static int
96   void clear_args (struct gengetopt_args_info *args_info);
97  
98   static int
99 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
99 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
100                          struct cmdline_parser_params *params, const char *additional_error);
101  
102   static int
# Line 108 | Line 116 | void clear_given (struct gengetopt_args_info *args_inf
116    args_info->nbins_given = 0 ;
117    args_info->nbins_x_given = 0 ;
118    args_info->nbins_y_given = 0 ;
119 +  args_info->nbins_z_given = 0 ;
120    args_info->nanglebins_given = 0 ;
121    args_info->rcut_given = 0 ;
122    args_info->dz_given = 0 ;
# Line 131 | Line 140 | void clear_given (struct gengetopt_args_info *args_inf
140    args_info->gofz_given = 0 ;
141    args_info->r_theta_given = 0 ;
142    args_info->r_omega_given = 0 ;
143 +  args_info->r_z_given = 0 ;
144    args_info->theta_omega_given = 0 ;
145    args_info->gxyz_given = 0 ;
146    args_info->twodgofr_given = 0 ;
# Line 144 | Line 154 | void clear_given (struct gengetopt_args_info *args_inf
154    args_info->rho_r_given = 0 ;
155    args_info->angle_r_given = 0 ;
156    args_info->hullvol_given = 0 ;
157 +  args_info->rodlength_given = 0 ;
158 +  args_info->tet_param_given = 0 ;
159    args_info->staticProps_group_counter = 0 ;
160   }
161  
162   static
163   void clear_args (struct gengetopt_args_info *args_info)
164   {
165 +  FIX_UNUSED (args_info);
166    args_info->input_arg = NULL;
167    args_info->input_orig = NULL;
168    args_info->output_arg = NULL;
# Line 162 | Line 175 | void clear_args (struct gengetopt_args_info *args_info
175    args_info->nbins_x_orig = NULL;
176    args_info->nbins_y_arg = 100;
177    args_info->nbins_y_orig = NULL;
178 +  args_info->nbins_z_arg = 100;
179 +  args_info->nbins_z_orig = NULL;
180    args_info->nanglebins_arg = 50;
181    args_info->nanglebins_orig = NULL;
182    args_info->rcut_orig = NULL;
# Line 237 | Line 252 | void init_args_info(struct gengetopt_args_info *args_i
252    args_info->p_angle_help = gengetopt_args_info_help[42] ;
253    args_info->hxy_help = gengetopt_args_info_help[43] ;
254    args_info->rho_r_help = gengetopt_args_info_help[44] ;
255 <  args_info->hullvol_help = gengetopt_args_info_help[45] ;
255 >  args_info->angle_r_help = gengetopt_args_info_help[45] ;
256 >  args_info->hullvol_help = gengetopt_args_info_help[46] ;
257 >  args_info->rodlength_help = gengetopt_args_info_help[47] ;
258 >  args_info->tet_param_help = gengetopt_args_info_help[48] ;
259    
260   }
261  
262   void
263   cmdline_parser_print_version (void)
264   {
265 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
265 >  printf ("%s %s\n",
266 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
267 >     CMDLINE_PARSER_VERSION);
268   }
269  
270   static void print_help_common(void) {
# Line 259 | Line 279 | static void print_help_common(void) {
279    printf("\n");
280  
281    if (strlen(gengetopt_args_info_description) > 0)
282 <    printf("%s\n", gengetopt_args_info_description);
282 >    printf("%s\n\n", gengetopt_args_info_description);
283   }
284  
285   void
# Line 278 | Line 298 | cmdline_parser_init (struct gengetopt_args_info *args_
298    clear_args (args_info);
299    init_args_info (args_info);
300  
301 <  args_info->inputs = NULL;
301 >  args_info->inputs = 0;
302    args_info->inputs_num = 0;
303   }
304  
# Line 327 | Line 347 | cmdline_parser_release (struct gengetopt_args_info *ar
347    free_string_field (&(args_info->nbins_orig));
348    free_string_field (&(args_info->nbins_x_orig));
349    free_string_field (&(args_info->nbins_y_orig));
350 +  free_string_field (&(args_info->nbins_z_orig));
351    free_string_field (&(args_info->nanglebins_orig));
352    free_string_field (&(args_info->rcut_orig));
353    free_string_field (&(args_info->dz_orig));
# Line 361 | Line 382 | static void
382  
383  
384   static void
385 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
385 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
386   {
387 +  FIX_UNUSED (values);
388    if (arg) {
389      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
390    } else {
# Line 398 | Line 420 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
420      write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0);
421    if (args_info->nbins_y_given)
422      write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0);
423 +  if (args_info->nbins_z_given)
424 +    write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0);
425    if (args_info->nanglebins_given)
426      write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0);
427    if (args_info->rcut_given)
# Line 444 | Line 468 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
468      write_into_file(outfile, "r_theta", 0, 0 );
469    if (args_info->r_omega_given)
470      write_into_file(outfile, "r_omega", 0, 0 );
471 +  if (args_info->r_z_given)
472 +    write_into_file(outfile, "r_z", 0, 0 );
473    if (args_info->theta_omega_given)
474      write_into_file(outfile, "theta_omega", 0, 0 );
475    if (args_info->gxyz_given)
# Line 470 | Line 496 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
496      write_into_file(outfile, "angle_r", 0, 0 );
497    if (args_info->hullvol_given)
498      write_into_file(outfile, "hullvol", 0, 0 );
499 +  if (args_info->rodlength_given)
500 +    write_into_file(outfile, "rodlength", 0, 0 );
501 +  if (args_info->tet_param_given)
502 +    write_into_file(outfile, "tet_param", 0, 0 );
503    
504  
505    i = EXIT_SUCCESS;
# Line 506 | Line 536 | gengetopt_strdup (const char *s)
536   char *
537   gengetopt_strdup (const char *s)
538   {
539 <  char *result = NULL;
539 >  char *result = 0;
540    if (!s)
541      return result;
542  
# Line 531 | Line 561 | reset_group_staticProps(struct gengetopt_args_info *ar
561    args_info->gofz_given = 0 ;
562    args_info->r_theta_given = 0 ;
563    args_info->r_omega_given = 0 ;
564 +  args_info->r_z_given = 0 ;
565    args_info->theta_omega_given = 0 ;
566    args_info->gxyz_given = 0 ;
567    args_info->twodgofr_given = 0 ;
# Line 544 | Line 575 | reset_group_staticProps(struct gengetopt_args_info *ar
575    args_info->rho_r_given = 0 ;
576    args_info->angle_r_given = 0 ;
577    args_info->hullvol_given = 0 ;
578 +  args_info->rodlength_given = 0 ;
579 +  args_info->tet_param_given = 0 ;
580  
581    args_info->staticProps_group_counter = 0;
582   }
583  
584   int
585 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
585 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
586   {
587    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
588   }
589  
590   int
591 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
591 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
592                     struct cmdline_parser_params *params)
593   {
594    int result;
595 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
595 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
596  
597    if (result == EXIT_FAILURE)
598      {
# Line 571 | Line 604 | int
604   }
605  
606   int
607 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
607 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
608   {
609    int result;
610    struct cmdline_parser_params params;
# Line 582 | Line 615 | cmdline_parser2 (int argc, char * const *argv, struct
615    params.check_ambiguity = 0;
616    params.print_errors = 1;
617  
618 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
618 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
619  
620    if (result == EXIT_FAILURE)
621      {
# Line 598 | Line 631 | cmdline_parser_required (struct gengetopt_args_info *a
631   {
632    int result = EXIT_SUCCESS;
633  
634 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
634 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
635      result = EXIT_FAILURE;
636  
637    if (result == EXIT_FAILURE)
# Line 614 | Line 647 | cmdline_parser_required2 (struct gengetopt_args_info *
647   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
648   {
649    int error = 0;
650 +  FIX_UNUSED (additional_error);
651  
652    /* checks for required options */
653    if (! args_info->input_given)
# Line 624 | Line 658 | cmdline_parser_required2 (struct gengetopt_args_info *
658    
659    if (args_info->staticProps_group_counter == 0)
660      {
661 <      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 : ""));
661 >      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 : ""));
662        error = 1;
663      }
664    
# Line 658 | Line 692 | int update_arg(void *field, char **orig_field,
692   static
693   int update_arg(void *field, char **orig_field,
694                 unsigned int *field_given, unsigned int *prev_given,
695 <               char *value, char *possible_values[], const char *default_value,
695 >               char *value, const char *possible_values[],
696 >               const char *default_value,
697                 cmdline_parser_arg_type arg_type,
698                 int check_ambiguity, int override,
699                 int no_free, int multiple_option,
# Line 669 | Line 704 | int update_arg(void *field, char **orig_field,
704    const char *val = value;
705    int found;
706    char **string_field;
707 +  FIX_UNUSED (field);
708  
709    stop_char = 0;
710    found = 0;
# Line 686 | Line 722 | int update_arg(void *field, char **orig_field,
722        return 1; /* failure */
723      }
724  
725 +  FIX_UNUSED (default_value);
726      
727    if (field_given && *field_given && ! override)
728      return 0;
# Line 749 | Line 786 | int
786  
787  
788   int
789 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
789 > cmdline_parser_internal (
790 >  int argc, char **argv, struct gengetopt_args_info *args_info,
791                          struct cmdline_parser_params *params, const char *additional_error)
792   {
793    int c;        /* Character of the parsed option.  */
# Line 792 | Line 830 | cmdline_parser_internal (int argc, char * const *argv,
830          { "nbins",      1, NULL, 'b' },
831          { "nbins_x",    1, NULL, 'x' },
832          { "nbins_y",    1, NULL, 'y' },
833 +        { "nbins_z",    1, NULL, 0 },
834          { "nanglebins", 1, NULL, 'a' },
835          { "rcut",       1, NULL, 'c' },
836          { "dz", 1, NULL, 0 },
# Line 815 | Line 854 | cmdline_parser_internal (int argc, char * const *argv,
854          { "gofz",       0, NULL, 0 },
855          { "r_theta",    0, NULL, 0 },
856          { "r_omega",    0, NULL, 0 },
857 +        { "r_z",        0, NULL, 0 },
858          { "theta_omega",        0, NULL, 0 },
859          { "gxyz",       0, NULL, 0 },
860          { "twodgofr",   0, NULL, 0 },
# Line 828 | Line 868 | cmdline_parser_internal (int argc, char * const *argv,
868          { "rho_r",      0, NULL, 0 },
869          { "angle_r",    0, NULL, 0 },
870          { "hullvol",    0, NULL, 0 },
871 <        { NULL, 0, NULL, 0 }
871 >        { "rodlength",  0, NULL, 0 },
872 >        { "tet_param",  0, NULL, 'Q' },
873 >        { 0,  0, 0, 0 }
874        };
875  
876 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
876 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
877  
878        if (c == -1) break;       /* Exit from `while (1)' loop.  */
879  
# Line 970 | Line 1012 | cmdline_parser_internal (int argc, char * const *argv,
1012              goto failure;
1013          
1014            break;
1015 <        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1015 >        case 'p':       /* p2 order parameter (--sele1 must be specified, --sele2 is optional).  */
1016          
1017            if (args_info->staticProps_group_counter && override)
1018              reset_group_staticProps (args_info);
# Line 1015 | Line 1057 | cmdline_parser_internal (int argc, char * const *argv,
1057              goto failure;
1058          
1059            break;
1060 +        case 'Q':       /* tetrahedrality order parameter.  */
1061 +        
1062 +          if (args_info->staticProps_group_counter && override)
1063 +            reset_group_staticProps (args_info);
1064 +          args_info->staticProps_group_counter += 1;
1065 +        
1066 +          if (update_arg( 0 ,
1067 +               0 , &(args_info->tet_param_given),
1068 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1069 +              check_ambiguity, override, 0, 0,
1070 +              "tet_param", 'Q',
1071 +              additional_error))
1072 +            goto failure;
1073 +        
1074 +          break;
1075  
1076          case 0: /* Long option with no short option */
1077 +          /* number of bins in z axis.  */
1078 +          if (strcmp (long_options[option_index].name, "nbins_z") == 0)
1079 +          {
1080 +          
1081 +          
1082 +            if (update_arg( (void *)&(args_info->nbins_z_arg),
1083 +                 &(args_info->nbins_z_orig), &(args_info->nbins_z_given),
1084 +                &(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT,
1085 +                check_ambiguity, override, 0, 0,
1086 +                "nbins_z", '-',
1087 +                additional_error))
1088 +              goto failure;
1089 +          
1090 +          }
1091            /* slab width (dz).  */
1092            else if (strcmp (long_options[option_index].name, "dz") == 0)
1093            {
# Line 1032 | Line 1103 | cmdline_parser_internal (int argc, char * const *argv,
1103            
1104            }
1105            /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1106 <          if (strcmp (long_options[option_index].name, "length") == 0)
1106 >          else if (strcmp (long_options[option_index].name, "length") == 0)
1107            {
1108            
1109            
# Line 1300 | Line 1371 | cmdline_parser_internal (int argc, char * const *argv,
1371                  &(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO,
1372                  check_ambiguity, override, 0, 0,
1373                  "r_omega", '-',
1374 +                additional_error))
1375 +              goto failure;
1376 +          
1377 +          }
1378 +          /* g(r, z).  */
1379 +          else if (strcmp (long_options[option_index].name, "r_z") == 0)
1380 +          {
1381 +          
1382 +            if (args_info->staticProps_group_counter && override)
1383 +              reset_group_staticProps (args_info);
1384 +            args_info->staticProps_group_counter += 1;
1385 +          
1386 +            if (update_arg( 0 ,
1387 +                 0 , &(args_info->r_z_given),
1388 +                &(local_args_info.r_z_given), optarg, 0, 0, ARG_NO,
1389 +                check_ambiguity, override, 0, 0,
1390 +                "r_z", '-',
1391                  additional_error))
1392                goto failure;
1393            
# Line 1474 | Line 1562 | cmdline_parser_internal (int argc, char * const *argv,
1562                goto failure;
1563            
1564            }
1565 +          /* length of nanorod.  */
1566 +          else if (strcmp (long_options[option_index].name, "rodlength") == 0)
1567 +          {
1568            
1569 +            if (args_info->staticProps_group_counter && override)
1570 +              reset_group_staticProps (args_info);
1571 +            args_info->staticProps_group_counter += 1;
1572 +          
1573 +            if (update_arg( 0 ,
1574 +                 0 , &(args_info->rodlength_given),
1575 +                &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO,
1576 +                check_ambiguity, override, 0, 0,
1577 +                "rodlength", '-',
1578 +                additional_error))
1579 +              goto failure;
1580 +          
1581 +          }
1582 +          
1583            break;
1584          case '?':       /* Invalid option.  */
1585            /* `getopt_long' already printed an error message.  */
# Line 1488 | Line 1593 | cmdline_parser_internal (int argc, char * const *argv,
1593  
1594    if (args_info->staticProps_group_counter > 1)
1595      {
1596 <      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 : ""));
1596 >      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 : ""));
1597        error = 1;
1598      }
1599    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines