--- trunk/src/applications/staticProps/StaticPropsCmd.c 2006/09/20 20:13:40 1041 +++ trunk/src/applications/staticProps/StaticPropsCmd.c 2008/01/23 21:21:50 1213 @@ -1,7 +1,7 @@ /* - File autogenerated by gengetopt version 2.16 + File autogenerated by gengetopt version 2.19.1 generated with the following command: - gengetopt -F StaticPropsCmd + gengetopt --file-name=StaticPropsCmd -u The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -21,6 +21,54 @@ #include "StaticPropsCmd.h" +const char *gengetopt_args_info_purpose = ""; + +const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; + +const char *gengetopt_args_info_description = ""; + +const char *gengetopt_args_info_help[] = { + " -h, --help Print help and exit", + " -V, --version Print version and exit", + " -i, --input=filename input dump file", + " -o, --output=filename output file name", + " -n, --step=INT process every n frame (default=`1')", + " -b, --nbins=INT number of bins (general purpose) \n (default=`100')", + " -x, --nbins_x=INT number of bins in x axis (default=`100')", + " -y, --nbins_y=INT number of bins in y axis (default=`100')", + " -a, --nanglebins=INT number of bins for cos(angle) (default=`50')", + " --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", + " -c, --rcut=DOUBLE cutoff radius (rcut)", + " -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", + " --sele1=selection script select the first stuntdouble set", + " --sele2=selection script select the second stuntdouble set", + " --sele3=selection script select the third stuntdouble set", + " --refsele=selection script\n select reference (use and only use with --gxyz)", + " --molname=STRING molecule name", + " --begin=INT begin internal index", + " --end=INT end internal index", + " --radius=DOUBLE nanoparticle radius", + "\n Group: staticProps\n an option of this group is required", + " --bo bond order parameter (--rcut must be specified)", + " --bor bond order parameter as a function of radius \n (--rcut must be specified)", + " --bad N(theta) bond angle density within (--rcut must \n be specified)", + " -g, --gofr g(r)", + " --gofz g(z)", + " --r_theta g(r, cos(theta))", + " --r_omega g(r, cos(omega))", + " --theta_omega g(cos(theta), cos(omega))", + " --gxyz g(x, y, z)", + " -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", + " --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", + " -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", + " -d, --density density plot", + " --slab_density slab density", + " --hxy hxy", + " --rho_r rho of R", + " --hullvol hull volume of nanoparticle", + 0 +}; + static void clear_given (struct gengetopt_args_info *args_info); static @@ -48,7 +96,6 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->nbins_y_given = 0 ; args_info->nanglebins_given = 0 ; args_info->length_given = 0 ; - args_info->LegendreL_given = 0 ; args_info->rcut_given = 0 ; args_info->zoffset_given = 0 ; args_info->sele1_given = 0 ; @@ -58,8 +105,12 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->molname_given = 0 ; args_info->begin_given = 0 ; args_info->end_given = 0 ; + args_info->radius_given = 0 ; args_info->bo_given = 0 ; + args_info->bor_given = 0 ; + args_info->bad_given = 0 ; args_info->gofr_given = 0 ; + args_info->gofz_given = 0 ; args_info->r_theta_given = 0 ; args_info->r_omega_given = 0 ; args_info->theta_omega_given = 0 ; @@ -70,6 +121,8 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->density_given = 0 ; args_info->slab_density_given = 0 ; args_info->hxy_given = 0 ; + args_info->rho_r_given = 0 ; + args_info->hullvol_given = 0 ; args_info->staticProps_group_counter = 0 ; } @@ -91,7 +144,6 @@ void clear_args (struct gengetopt_args_info *args_info args_info->nanglebins_arg = 50; args_info->nanglebins_orig = NULL; args_info->length_orig = NULL; - args_info->LegendreL_orig = NULL; args_info->rcut_orig = NULL; args_info->zoffset_arg = 0; args_info->zoffset_orig = NULL; @@ -107,6 +159,50 @@ void clear_args (struct gengetopt_args_info *args_info args_info->molname_orig = NULL; args_info->begin_orig = NULL; args_info->end_orig = NULL; + args_info->radius_orig = NULL; + +} + +static +void init_args_info(struct gengetopt_args_info *args_info) +{ + args_info->help_help = gengetopt_args_info_help[0] ; + args_info->version_help = gengetopt_args_info_help[1] ; + args_info->input_help = gengetopt_args_info_help[2] ; + args_info->output_help = gengetopt_args_info_help[3] ; + args_info->step_help = gengetopt_args_info_help[4] ; + args_info->nbins_help = gengetopt_args_info_help[5] ; + args_info->nbins_x_help = gengetopt_args_info_help[6] ; + args_info->nbins_y_help = gengetopt_args_info_help[7] ; + args_info->nanglebins_help = gengetopt_args_info_help[8] ; + args_info->length_help = gengetopt_args_info_help[9] ; + args_info->rcut_help = gengetopt_args_info_help[10] ; + args_info->zoffset_help = gengetopt_args_info_help[11] ; + args_info->sele1_help = gengetopt_args_info_help[12] ; + args_info->sele2_help = gengetopt_args_info_help[13] ; + args_info->sele3_help = gengetopt_args_info_help[14] ; + args_info->refsele_help = gengetopt_args_info_help[15] ; + args_info->molname_help = gengetopt_args_info_help[16] ; + args_info->begin_help = gengetopt_args_info_help[17] ; + args_info->end_help = gengetopt_args_info_help[18] ; + args_info->radius_help = gengetopt_args_info_help[19] ; + args_info->bo_help = gengetopt_args_info_help[20] ; + args_info->bor_help = gengetopt_args_info_help[21] ; + args_info->bad_help = gengetopt_args_info_help[22] ; + args_info->gofr_help = gengetopt_args_info_help[23] ; + args_info->gofz_help = gengetopt_args_info_help[24] ; + args_info->r_theta_help = gengetopt_args_info_help[25] ; + args_info->r_omega_help = gengetopt_args_info_help[26] ; + args_info->theta_omega_help = gengetopt_args_info_help[27] ; + args_info->gxyz_help = gengetopt_args_info_help[28] ; + args_info->p2_help = gengetopt_args_info_help[29] ; + args_info->rp2_help = gengetopt_args_info_help[30] ; + args_info->scd_help = gengetopt_args_info_help[31] ; + args_info->density_help = gengetopt_args_info_help[32] ; + args_info->slab_density_help = gengetopt_args_info_help[33] ; + args_info->hxy_help = gengetopt_args_info_help[34] ; + args_info->rho_r_help = gengetopt_args_info_help[35] ; + args_info->hullvol_help = gengetopt_args_info_help[36] ; } @@ -119,42 +215,19 @@ cmdline_parser_print_help (void) void cmdline_parser_print_help (void) { + int i = 0; cmdline_parser_print_version (); - printf("\nUsage: StaticProps [OPTIONS]...\n\n"); - printf("%s\n"," -h, --help Print help and exit"); - printf("%s\n"," -V, --version Print version and exit"); - printf("%s\n"," -i, --input=filename input dump file"); - printf("%s\n"," -o, --output=filename output file name"); - printf("%s\n"," -n, --step=INT process every n frame (default=`1')"); - printf("%s\n"," -b, --nbins=INT number of bins (general purpose) \n (default=`100')"); - printf("%s\n"," -x, --nbins_x=INT number of bins in x axis (default=`100')"); - printf("%s\n"," -y, --nbins_y=INT number of bins in y axis (default=`100')"); - printf("%s\n"," -a, --nanglebins=INT number of bins for cos(angle) (default=`50')"); - printf("%s\n"," --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)"); - printf("%s\n"," -l, --LegendreL=INT Order of Legendre Polynomial (used for Bond \n Order calculations)"); - printf("%s\n"," -c, --rcut=DOUBLE cutoff radius (rcut)"); - printf("%s\n"," -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')"); - printf("%s\n"," --sele1=selection script select the first stuntdouble set"); - printf("%s\n"," --sele2=selection script select the second stuntdouble set"); - printf("%s\n"," --sele3=selection script select the third stuntdouble set"); - printf("%s\n"," --refsele=selection script\n select reference (use and only use with --gxyz)"); - printf("%s\n"," --molname=STRING molecule name"); - printf("%s\n"," --begin=INT begin internal index"); - printf("%s\n"," --end=INT end internal index"); - printf("%s\n","\n Group: staticProps\n an option of this group is required"); - printf("%s\n"," --bo bond order parameter (--rcut and --LegendreL \n must be specified"); - printf("%s\n"," -g, --gofr g(r)"); - printf("%s\n"," --r_theta g(r, cos(theta))"); - printf("%s\n"," --r_omega g(r, cos(omega))"); - printf("%s\n"," --theta_omega g(cos(theta), cos(omega))"); - printf("%s\n"," --gxyz g(x, y, z)"); - printf("%s\n"," -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)"); - printf("%s\n"," --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)"); - printf("%s\n"," -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)"); - printf("%s\n"," -d, --density density plot"); - printf("%s\n"," --slab_density slab density"); - printf("%s\n"," --hxy hxy"); - + + if (strlen(gengetopt_args_info_purpose) > 0) + printf("\n%s\n", gengetopt_args_info_purpose); + + printf("\n%s\n\n", gengetopt_args_info_usage); + + if (strlen(gengetopt_args_info_description) > 0) + printf("%s\n", gengetopt_args_info_description); + + while (gengetopt_args_info_help[i]) + printf("%s\n", gengetopt_args_info_help[i++]); } void @@ -162,12 +235,17 @@ cmdline_parser_init (struct gengetopt_args_info *args_ { clear_given (args_info); clear_args (args_info); + init_args_info (args_info); + + args_info->inputs = NULL; + args_info->inputs_num = 0; } static void cmdline_parser_release (struct gengetopt_args_info *args_info) { + unsigned int i; if (args_info->input_arg) { free (args_info->input_arg); /* free previous argument */ @@ -218,11 +296,6 @@ cmdline_parser_release (struct gengetopt_args_info *ar free (args_info->length_orig); /* free previous argument */ args_info->length_orig = 0; } - if (args_info->LegendreL_orig) - { - free (args_info->LegendreL_orig); /* free previous argument */ - args_info->LegendreL_orig = 0; - } if (args_info->rcut_orig) { free (args_info->rcut_orig); /* free previous argument */ @@ -293,7 +366,18 @@ cmdline_parser_release (struct gengetopt_args_info *ar free (args_info->end_orig); /* free previous argument */ args_info->end_orig = 0; } + if (args_info->radius_orig) + { + free (args_info->radius_orig); /* free previous argument */ + args_info->radius_orig = 0; + } + for (i = 0; i < args_info->inputs_num; ++i) + free (args_info->inputs [i]); + + if (args_info->inputs_num) + free (args_info->inputs); + clear_given (args_info); } @@ -373,13 +457,6 @@ cmdline_parser_file_save(const char *filename, struct fprintf(outfile, "%s\n", "length"); } } - if (args_info->LegendreL_given) { - if (args_info->LegendreL_orig) { - fprintf(outfile, "%s=\"%s\"\n", "LegendreL", args_info->LegendreL_orig); - } else { - fprintf(outfile, "%s\n", "LegendreL"); - } - } if (args_info->rcut_given) { if (args_info->rcut_orig) { fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig); @@ -443,12 +520,28 @@ cmdline_parser_file_save(const char *filename, struct fprintf(outfile, "%s\n", "end"); } } + if (args_info->radius_given) { + if (args_info->radius_orig) { + fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig); + } else { + fprintf(outfile, "%s\n", "radius"); + } + } if (args_info->bo_given) { fprintf(outfile, "%s\n", "bo"); } + if (args_info->bor_given) { + fprintf(outfile, "%s\n", "bor"); + } + if (args_info->bad_given) { + fprintf(outfile, "%s\n", "bad"); + } if (args_info->gofr_given) { fprintf(outfile, "%s\n", "gofr"); } + if (args_info->gofz_given) { + fprintf(outfile, "%s\n", "gofz"); + } if (args_info->r_theta_given) { fprintf(outfile, "%s\n", "r_theta"); } @@ -479,6 +572,12 @@ cmdline_parser_file_save(const char *filename, struct if (args_info->hxy_given) { fprintf(outfile, "%s\n", "hxy"); } + if (args_info->rho_r_given) { + fprintf(outfile, "%s\n", "rho_r"); + } + if (args_info->hullvol_given) { + fprintf(outfile, "%s\n", "hullvol"); + } fclose (outfile); @@ -519,7 +618,10 @@ reset_group_staticProps(struct gengetopt_args_info *ar return; args_info->bo_given = 0 ; + args_info->bor_given = 0 ; + args_info->bad_given = 0 ; args_info->gofr_given = 0 ; + args_info->gofz_given = 0 ; args_info->r_theta_given = 0 ; args_info->r_omega_given = 0 ; args_info->theta_omega_given = 0 ; @@ -530,6 +632,8 @@ reset_group_staticProps(struct gengetopt_args_info *ar args_info->density_given = 0 ; args_info->slab_density_given = 0 ; args_info->hxy_given = 0 ; + args_info->rho_r_given = 0 ; + args_info->hullvol_given = 0 ; args_info->staticProps_group_counter = 0; } @@ -578,17 +682,21 @@ cmdline_parser_required2 (struct gengetopt_args_info * { int error = 0; + /* checks for required options */ if (! args_info->input_given) { fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); error = 1; } + if (args_info->staticProps_group_counter == 0) { 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 : "")); error = 1; } + + /* checks for dependences among options */ return error; } @@ -627,7 +735,6 @@ cmdline_parser_internal (int argc, char * const *argv, { "nbins_y", 1, NULL, 'y' }, { "nanglebins", 1, NULL, 'a' }, { "length", 1, NULL, 0 }, - { "LegendreL", 1, NULL, 'l' }, { "rcut", 1, NULL, 'c' }, { "zoffset", 1, NULL, 'z' }, { "sele1", 1, NULL, 0 }, @@ -637,8 +744,12 @@ cmdline_parser_internal (int argc, char * const *argv, { "molname", 1, NULL, 0 }, { "begin", 1, NULL, 0 }, { "end", 1, NULL, 0 }, + { "radius", 1, NULL, 0 }, { "bo", 0, NULL, 0 }, + { "bor", 0, NULL, 0 }, + { "bad", 0, NULL, 0 }, { "gofr", 0, NULL, 'g' }, + { "gofz", 0, NULL, 0 }, { "r_theta", 0, NULL, 0 }, { "r_omega", 0, NULL, 0 }, { "theta_omega", 0, NULL, 0 }, @@ -649,11 +760,13 @@ cmdline_parser_internal (int argc, char * const *argv, { "density", 0, NULL, 'd' }, { "slab_density", 0, NULL, 0 }, { "hxy", 0, NULL, 0 }, + { "rho_r", 0, NULL, 0 }, + { "hullvol", 0, NULL, 0 }, { NULL, 0, NULL, 0 } }; stop_char = 0; - c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:l:c:z:gpsd", long_options, &option_index); + c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -803,26 +916,6 @@ cmdline_parser_internal (int argc, char * const *argv, if (args_info->nanglebins_orig) free (args_info->nanglebins_orig); /* free previous string */ args_info->nanglebins_orig = gengetopt_strdup (optarg); - break; - - case 'l': /* Order of Legendre Polynomial (used for Bond Order calculations). */ - if (local_args_info.LegendreL_given) - { - fprintf (stderr, "%s: `--LegendreL' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->LegendreL_given && ! override) - continue; - local_args_info.LegendreL_given = 1; - args_info->LegendreL_given = 1; - args_info->LegendreL_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); - goto failure; - } - if (args_info->LegendreL_orig) - free (args_info->LegendreL_orig); /* free previous string */ - args_info->LegendreL_orig = gengetopt_strdup (optarg); break; case 'c': /* cutoff radius (rcut). */ @@ -1085,7 +1178,28 @@ cmdline_parser_internal (int argc, char * const *argv, free (args_info->end_orig); /* free previous string */ args_info->end_orig = gengetopt_strdup (optarg); } - /* bond order parameter (--rcut and --LegendreL must be specified. */ + /* nanoparticle radius. */ + else if (strcmp (long_options[option_index].name, "radius") == 0) + { + if (local_args_info.radius_given) + { + fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->radius_given && ! override) + continue; + local_args_info.radius_given = 1; + args_info->radius_given = 1; + args_info->radius_arg = strtod (optarg, &stop_char); + if (!(stop_char && *stop_char == '\0')) { + fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + goto failure; + } + if (args_info->radius_orig) + free (args_info->radius_orig); /* free previous string */ + args_info->radius_orig = gengetopt_strdup (optarg); + } + /* bond order parameter (--rcut must be specified). */ else if (strcmp (long_options[option_index].name, "bo") == 0) { if (local_args_info.bo_given) @@ -1102,6 +1216,57 @@ cmdline_parser_internal (int argc, char * const *argv, args_info->staticProps_group_counter += 1; break; } + /* bond order parameter as a function of radius (--rcut must be specified). */ + else if (strcmp (long_options[option_index].name, "bor") == 0) + { + if (local_args_info.bor_given) + { + fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->bor_given && ! override) + continue; + local_args_info.bor_given = 1; + args_info->bor_given = 1; + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + break; + } + /* N(theta) bond angle density within (--rcut must be specified). */ + else if (strcmp (long_options[option_index].name, "bad") == 0) + { + if (local_args_info.bad_given) + { + fprintf (stderr, "%s: `--bad' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->bad_given && ! override) + continue; + local_args_info.bad_given = 1; + args_info->bad_given = 1; + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + break; + } + /* g(z). */ + else if (strcmp (long_options[option_index].name, "gofz") == 0) + { + if (local_args_info.gofz_given) + { + fprintf (stderr, "%s: `--gofz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->gofz_given && ! override) + continue; + local_args_info.gofz_given = 1; + args_info->gofz_given = 1; + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + break; + } /* g(r, cos(theta)). */ else if (strcmp (long_options[option_index].name, "r_theta") == 0) { @@ -1221,6 +1386,40 @@ cmdline_parser_internal (int argc, char * const *argv, args_info->staticProps_group_counter += 1; break; } + /* rho of R. */ + else if (strcmp (long_options[option_index].name, "rho_r") == 0) + { + if (local_args_info.rho_r_given) + { + fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->rho_r_given && ! override) + continue; + local_args_info.rho_r_given = 1; + args_info->rho_r_given = 1; + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + break; + } + /* hull volume of nanoparticle. */ + else if (strcmp (long_options[option_index].name, "hullvol") == 0) + { + if (local_args_info.hullvol_given) + { + fprintf (stderr, "%s: `--hullvol' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->hullvol_given && ! override) + continue; + local_args_info.hullvol_given = 1; + args_info->hullvol_given = 1; + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + break; + } break; case '?': /* Invalid option. */ @@ -1251,6 +1450,30 @@ cmdline_parser_internal (int argc, char * const *argv, if ( error ) return (EXIT_FAILURE); + if (optind < argc) + { + int i = 0 ; + int found_prog_name = 0; + /* whether program name, i.e., argv[0], is in the remaining args + (this may happen with some implementations of getopt, + but surely not with the one included by gengetopt) */ + + i = optind; + while (i < argc) + if (argv[i++] == argv[0]) { + found_prog_name = 1; + break; + } + i = 0; + + args_info->inputs_num = argc - optind - found_prog_name; + args_info->inputs = + (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; + while (optind < argc) + if (argv[optind++] != argv[0]) + args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; + } + return 0; failure: