--- trunk/src/applications/staticProps/StaticPropsCmd.c 2010/06/08 20:26:50 1445 +++ trunk/src/applications/staticProps/StaticPropsCmd.c 2010/06/23 19:25:02 1454 @@ -1,7 +1,7 @@ /* File autogenerated by gengetopt version 2.22 generated with the following command: - gengetopt -F StaticPropsCmd + gengetopt -F StaticPropsCmd -u The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -23,7 +23,7 @@ const char *gengetopt_args_info_purpose = ""; const char *gengetopt_args_info_purpose = ""; -const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]..."; +const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; const char *gengetopt_args_info_description = ""; @@ -39,6 +39,7 @@ const char *gengetopt_args_info_help[] = { " --nbins_z=INT number of bins in z axis (default=`100')", " -a, --nanglebins=INT number of bins for cos(angle) (default=`50')", " -c, --rcut=DOUBLE cutoff radius (rcut)", + " --dz=DOUBLE slab width (dz)", " --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", " --zlength=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", " -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", @@ -62,6 +63,7 @@ const char *gengetopt_args_info_help[] = { " --r_z g(r, z)", " --theta_omega g(cos(theta), cos(omega))", " --gxyz g(x, y, z)", + " --twodgofr 2D g(r) (Slab width --dz must be specified)", " -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)", @@ -109,6 +111,7 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->nbins_z_given = 0 ; args_info->nanglebins_given = 0 ; args_info->rcut_given = 0 ; + args_info->dz_given = 0 ; args_info->length_given = 0 ; args_info->zlength_given = 0 ; args_info->zoffset_given = 0 ; @@ -131,6 +134,7 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->r_z_given = 0 ; args_info->theta_omega_given = 0 ; args_info->gxyz_given = 0 ; + args_info->twodgofr_given = 0 ; args_info->p2_given = 0 ; args_info->rp2_given = 0 ; args_info->scd_given = 0 ; @@ -163,6 +167,7 @@ void clear_args (struct gengetopt_args_info *args_info args_info->nanglebins_arg = 50; args_info->nanglebins_orig = NULL; args_info->rcut_orig = NULL; + args_info->dz_orig = NULL; args_info->length_orig = NULL; args_info->zlength_orig = NULL; args_info->zoffset_arg = 0; @@ -201,37 +206,39 @@ void init_args_info(struct gengetopt_args_info *args_i args_info->nbins_z_help = gengetopt_args_info_help[8] ; args_info->nanglebins_help = gengetopt_args_info_help[9] ; args_info->rcut_help = gengetopt_args_info_help[10] ; - args_info->length_help = gengetopt_args_info_help[11] ; - args_info->zlength_help = gengetopt_args_info_help[12] ; - args_info->zoffset_help = gengetopt_args_info_help[13] ; - args_info->sele1_help = gengetopt_args_info_help[14] ; - args_info->sele2_help = gengetopt_args_info_help[15] ; - args_info->sele3_help = gengetopt_args_info_help[16] ; - args_info->refsele_help = gengetopt_args_info_help[17] ; - args_info->comsele_help = gengetopt_args_info_help[18] ; - args_info->molname_help = gengetopt_args_info_help[19] ; - args_info->begin_help = gengetopt_args_info_help[20] ; - args_info->end_help = gengetopt_args_info_help[21] ; - args_info->radius_help = gengetopt_args_info_help[22] ; - args_info->bo_help = gengetopt_args_info_help[24] ; - args_info->bor_help = gengetopt_args_info_help[25] ; - args_info->bad_help = gengetopt_args_info_help[26] ; - args_info->gofr_help = gengetopt_args_info_help[27] ; - args_info->gofz_help = gengetopt_args_info_help[28] ; - args_info->r_theta_help = gengetopt_args_info_help[29] ; - args_info->r_omega_help = gengetopt_args_info_help[30] ; - args_info->r_z_help = gengetopt_args_info_help[31] ; - args_info->theta_omega_help = gengetopt_args_info_help[32] ; - args_info->gxyz_help = gengetopt_args_info_help[33] ; - args_info->p2_help = gengetopt_args_info_help[34] ; - args_info->rp2_help = gengetopt_args_info_help[35] ; - args_info->scd_help = gengetopt_args_info_help[36] ; - args_info->density_help = gengetopt_args_info_help[37] ; - args_info->slab_density_help = gengetopt_args_info_help[38] ; - args_info->p_angle_help = gengetopt_args_info_help[39] ; - args_info->hxy_help = gengetopt_args_info_help[40] ; - args_info->rho_r_help = gengetopt_args_info_help[41] ; - args_info->hullvol_help = gengetopt_args_info_help[42] ; + args_info->dz_help = gengetopt_args_info_help[11] ; + args_info->length_help = gengetopt_args_info_help[12] ; + args_info->zlength_help = gengetopt_args_info_help[13] ; + args_info->zoffset_help = gengetopt_args_info_help[14] ; + args_info->sele1_help = gengetopt_args_info_help[15] ; + args_info->sele2_help = gengetopt_args_info_help[16] ; + args_info->sele3_help = gengetopt_args_info_help[17] ; + args_info->refsele_help = gengetopt_args_info_help[18] ; + args_info->comsele_help = gengetopt_args_info_help[19] ; + args_info->molname_help = gengetopt_args_info_help[20] ; + args_info->begin_help = gengetopt_args_info_help[21] ; + args_info->end_help = gengetopt_args_info_help[22] ; + args_info->radius_help = gengetopt_args_info_help[23] ; + args_info->bo_help = gengetopt_args_info_help[25] ; + args_info->bor_help = gengetopt_args_info_help[26] ; + args_info->bad_help = gengetopt_args_info_help[27] ; + args_info->gofr_help = gengetopt_args_info_help[28] ; + args_info->gofz_help = gengetopt_args_info_help[29] ; + args_info->r_theta_help = gengetopt_args_info_help[30] ; + args_info->r_omega_help = gengetopt_args_info_help[31] ; + args_info->r_z_help = gengetopt_args_info_help[32] ; + args_info->theta_omega_help = gengetopt_args_info_help[33] ; + args_info->gxyz_help = gengetopt_args_info_help[34] ; + args_info->twodgofr_help = gengetopt_args_info_help[35] ; + args_info->p2_help = gengetopt_args_info_help[36] ; + args_info->rp2_help = gengetopt_args_info_help[37] ; + args_info->scd_help = gengetopt_args_info_help[38] ; + args_info->density_help = gengetopt_args_info_help[39] ; + args_info->slab_density_help = gengetopt_args_info_help[40] ; + args_info->p_angle_help = gengetopt_args_info_help[41] ; + args_info->hxy_help = gengetopt_args_info_help[42] ; + args_info->rho_r_help = gengetopt_args_info_help[43] ; + args_info->hullvol_help = gengetopt_args_info_help[44] ; } @@ -271,6 +278,9 @@ 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; } void @@ -309,7 +319,7 @@ cmdline_parser_release (struct gengetopt_args_info *ar static void cmdline_parser_release (struct gengetopt_args_info *args_info) { - + unsigned int i; free_string_field (&(args_info->input_arg)); free_string_field (&(args_info->input_orig)); free_string_field (&(args_info->output_arg)); @@ -321,6 +331,7 @@ cmdline_parser_release (struct gengetopt_args_info *ar free_string_field (&(args_info->nbins_z_orig)); free_string_field (&(args_info->nanglebins_orig)); free_string_field (&(args_info->rcut_orig)); + free_string_field (&(args_info->dz_orig)); free_string_field (&(args_info->length_orig)); free_string_field (&(args_info->zlength_orig)); free_string_field (&(args_info->zoffset_orig)); @@ -341,6 +352,11 @@ cmdline_parser_release (struct gengetopt_args_info *ar free_string_field (&(args_info->radius_orig)); + 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); } @@ -390,6 +406,8 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_ar write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); if (args_info->rcut_given) write_into_file(outfile, "rcut", args_info->rcut_orig, 0); + if (args_info->dz_given) + write_into_file(outfile, "dz", args_info->dz_orig, 0); if (args_info->length_given) write_into_file(outfile, "length", args_info->length_orig, 0); if (args_info->zlength_given) @@ -434,6 +452,8 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_ar write_into_file(outfile, "theta_omega", 0, 0 ); if (args_info->gxyz_given) write_into_file(outfile, "gxyz", 0, 0 ); + if (args_info->twodgofr_given) + write_into_file(outfile, "twodgofr", 0, 0 ); if (args_info->p2_given) write_into_file(outfile, "p2", 0, 0 ); if (args_info->rp2_given) @@ -515,6 +535,7 @@ reset_group_staticProps(struct gengetopt_args_info *ar args_info->r_z_given = 0 ; args_info->theta_omega_given = 0 ; args_info->gxyz_given = 0 ; + args_info->twodgofr_given = 0 ; args_info->p2_given = 0 ; args_info->rp2_given = 0 ; args_info->scd_given = 0 ; @@ -775,6 +796,7 @@ cmdline_parser_internal (int argc, char * const *argv, { "nbins_z", 1, NULL, 0 }, { "nanglebins", 1, NULL, 'a' }, { "rcut", 1, NULL, 'c' }, + { "dz", 1, NULL, 0 }, { "length", 1, NULL, 0 }, { "zlength", 1, NULL, 0 }, { "zoffset", 1, NULL, 'z' }, @@ -797,6 +819,7 @@ cmdline_parser_internal (int argc, char * const *argv, { "r_z", 0, NULL, 0 }, { "theta_omega", 0, NULL, 0 }, { "gxyz", 0, NULL, 0 }, + { "twodgofr", 0, NULL, 0 }, { "p2", 0, NULL, 'p' }, { "rp2", 0, NULL, 0 }, { "scd", 0, NULL, 's' }, @@ -1005,6 +1028,20 @@ cmdline_parser_internal (int argc, char * const *argv, &(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, check_ambiguity, override, 0, 0, "nbins_z", '-', + additional_error)) + goto failure; + + } + /* slab width (dz). */ + else if (strcmp (long_options[option_index].name, "dz") == 0) + { + + + if (update_arg( (void *)&(args_info->dz_arg), + &(args_info->dz_orig), &(args_info->dz_given), + &(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "dz", '-', additional_error)) goto failure; @@ -1316,6 +1353,23 @@ cmdline_parser_internal (int argc, char * const *argv, goto failure; } + /* 2D g(r) (Slab width --dz must be specified). */ + else if (strcmp (long_options[option_index].name, "twodgofr") == 0) + { + + if (args_info->staticProps_group_counter && override) + reset_group_staticProps (args_info); + args_info->staticProps_group_counter += 1; + + if (update_arg( 0 , + 0 , &(args_info->twodgofr_given), + &(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "twodgofr", '-', + additional_error)) + goto failure; + + } /* rp2 order parameter (--sele1 and --sele2 must be specified). */ else if (strcmp (long_options[option_index].name, "rp2") == 0) { @@ -1448,6 +1502,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: