--- trunk/src/applications/staticProps/StaticPropsCmd.c 2007/04/11 23:27:20 1128 +++ trunk/src/applications/staticProps/StaticPropsCmd.cpp 2014/04/29 17:32:31 1993 @@ -1,7 +1,7 @@ /* - File autogenerated by gengetopt version 2.19.1 + File autogenerated by gengetopt version 2.22.4 generated with the following command: - gengetopt -i StaticProps.ggo -F StaticPropsCmd -u + gengetopt --file-name=StaticPropsCmd --unamed-opts The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -17,8 +17,16 @@ #include #include -#include "getopt.h" +#ifndef FIX_UNUSED +#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ +#endif +#ifdef WIN32 +#include "utils/wingetopt.h" +#else +#include +#endif + #include "StaticPropsCmd.h" const char *gengetopt_args_info_purpose = ""; @@ -36,43 +44,72 @@ const char *gengetopt_args_info_help[] = { " -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')", + " --nbins_z=INT number of bins in z 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)", + " --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')", " --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)", + " --comsele=selection script\n select stunt doubles for center-of-mass \n reference point", + " --seleoffset=INT global index offset for a second object (used \n to define a vector between sites in molecule)", + " --seleoffset2=INT global index offset for a third object (used to \n define a vector between sites in molecule)", " --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)", + " --ior icosahedral bond order parameter as a function \n of radius (--rcut must be specified)", + " --for FCC bond order parameter as a function of \n radius (--rcut must be specified)", + " --bad N(theta) bond angle density within (--rcut must \n be specified)", + " --count count of molecules matching selection criteria \n (and associated statistics)", " -g, --gofr g(r)", + " --gofz g(z)", " --r_theta g(r, cos(theta))", " --r_omega g(r, cos(omega))", + " --r_z g(r, z)", " --theta_omega g(cos(theta), cos(omega))", " --gxyz g(x, y, z)", - " -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", + " --twodgofr 2D g(r) (Slab width --dz must be specified)", + " -p, --p2 p2 order parameter (--sele1 must be specified, \n --sele2 is optional)", " --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", + " --p_angle p(cos(theta)) (--sele1 must be specified, \n --sele2 is optional)", " --hxy hxy", " --rho_r rho of R", + " --angle_r angle of R", + " --hullvol hull volume of nanoparticle", + " --rodlength length of nanorod", + " -Q, --tet_param tetrahedrality order parameter (Qk)", + " --tet_param_z spatially-resolved tetrahedrality order \n parameter Qk(z)", + " --rnemdz slab-resolved RNEMD statistics (temperature, \n density, velocity)", + " --rnemdr shell-resolved RNEMD statistics (temperature, \n density, angular velocity)", + " --rnemdrt shell and angle-resolved RNEMD statistics \n (temperature, density, angular velocity)", + " --uFreqMap electrostatic potential to frequency map based \n on the Cho nitrile fits", 0 }; +typedef enum {ARG_NO + , ARG_STRING + , ARG_INT + , ARG_DOUBLE +} cmdline_parser_arg_type; + static void clear_given (struct gengetopt_args_info *args_info); static void clear_args (struct gengetopt_args_info *args_info); static int -cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); +cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params, const char *additional_error); static int cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); @@ -91,38 +128,61 @@ void clear_given (struct gengetopt_args_info *args_inf args_info->nbins_given = 0 ; args_info->nbins_x_given = 0 ; args_info->nbins_y_given = 0 ; + args_info->nbins_z_given = 0 ; args_info->nanglebins_given = 0 ; - args_info->length_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 ; args_info->sele1_given = 0 ; args_info->sele2_given = 0 ; args_info->sele3_given = 0 ; args_info->refsele_given = 0 ; + args_info->comsele_given = 0 ; + args_info->seleoffset_given = 0 ; + args_info->seleoffset2_given = 0 ; 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->ior_given = 0 ; + args_info->for_given = 0 ; + args_info->bad_given = 0 ; + args_info->count_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->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 ; args_info->density_given = 0 ; args_info->slab_density_given = 0 ; + args_info->p_angle_given = 0 ; args_info->hxy_given = 0 ; args_info->rho_r_given = 0 ; + args_info->angle_r_given = 0 ; + args_info->hullvol_given = 0 ; + args_info->rodlength_given = 0 ; + args_info->tet_param_given = 0 ; + args_info->tet_param_z_given = 0 ; + args_info->rnemdz_given = 0 ; + args_info->rnemdr_given = 0 ; + args_info->rnemdrt_given = 0 ; + args_info->uFreqMap_given = 0 ; args_info->staticProps_group_counter = 0 ; } static void clear_args (struct gengetopt_args_info *args_info) { + FIX_UNUSED (args_info); args_info->input_arg = NULL; args_info->input_orig = NULL; args_info->output_arg = NULL; @@ -135,10 +195,14 @@ void clear_args (struct gengetopt_args_info *args_info args_info->nbins_x_orig = NULL; args_info->nbins_y_arg = 100; args_info->nbins_y_orig = NULL; + args_info->nbins_z_arg = 100; + args_info->nbins_z_orig = NULL; args_info->nanglebins_arg = 50; args_info->nanglebins_orig = NULL; - args_info->length_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; args_info->zoffset_orig = NULL; args_info->sele1_arg = NULL; @@ -149,6 +213,10 @@ void clear_args (struct gengetopt_args_info *args_info args_info->sele3_orig = NULL; args_info->refsele_arg = NULL; args_info->refsele_orig = NULL; + args_info->comsele_arg = NULL; + args_info->comsele_orig = NULL; + args_info->seleoffset_orig = NULL; + args_info->seleoffset2_orig = NULL; args_info->molname_arg = NULL; args_info->molname_orig = NULL; args_info->begin_orig = NULL; @@ -160,6 +228,8 @@ void init_args_info(struct gengetopt_args_info *args_i 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] ; @@ -168,55 +238,85 @@ void init_args_info(struct gengetopt_args_info *args_i 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->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->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->gofr_help = gengetopt_args_info_help[22] ; - args_info->r_theta_help = gengetopt_args_info_help[23] ; - args_info->r_omega_help = gengetopt_args_info_help[24] ; - args_info->theta_omega_help = gengetopt_args_info_help[25] ; - args_info->gxyz_help = gengetopt_args_info_help[26] ; - args_info->p2_help = gengetopt_args_info_help[27] ; - args_info->rp2_help = gengetopt_args_info_help[28] ; - args_info->scd_help = gengetopt_args_info_help[29] ; - args_info->density_help = gengetopt_args_info_help[30] ; - args_info->slab_density_help = gengetopt_args_info_help[31] ; - args_info->hxy_help = gengetopt_args_info_help[32] ; - args_info->rho_r_help = gengetopt_args_info_help[33] ; + 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->seleoffset_help = gengetopt_args_info_help[20] ; + args_info->seleoffset2_help = gengetopt_args_info_help[21] ; + args_info->molname_help = gengetopt_args_info_help[22] ; + args_info->begin_help = gengetopt_args_info_help[23] ; + args_info->end_help = gengetopt_args_info_help[24] ; + args_info->radius_help = gengetopt_args_info_help[25] ; + args_info->bo_help = gengetopt_args_info_help[27] ; + args_info->ior_help = gengetopt_args_info_help[28] ; + args_info->for_help = gengetopt_args_info_help[29] ; + args_info->bad_help = gengetopt_args_info_help[30] ; + args_info->count_help = gengetopt_args_info_help[31] ; + args_info->gofr_help = gengetopt_args_info_help[32] ; + args_info->gofz_help = gengetopt_args_info_help[33] ; + args_info->r_theta_help = gengetopt_args_info_help[34] ; + args_info->r_omega_help = gengetopt_args_info_help[35] ; + args_info->r_z_help = gengetopt_args_info_help[36] ; + args_info->theta_omega_help = gengetopt_args_info_help[37] ; + args_info->gxyz_help = gengetopt_args_info_help[38] ; + args_info->twodgofr_help = gengetopt_args_info_help[39] ; + args_info->p2_help = gengetopt_args_info_help[40] ; + args_info->rp2_help = gengetopt_args_info_help[41] ; + args_info->scd_help = gengetopt_args_info_help[42] ; + args_info->density_help = gengetopt_args_info_help[43] ; + args_info->slab_density_help = gengetopt_args_info_help[44] ; + args_info->p_angle_help = gengetopt_args_info_help[45] ; + args_info->hxy_help = gengetopt_args_info_help[46] ; + args_info->rho_r_help = gengetopt_args_info_help[47] ; + args_info->angle_r_help = gengetopt_args_info_help[48] ; + args_info->hullvol_help = gengetopt_args_info_help[49] ; + args_info->rodlength_help = gengetopt_args_info_help[50] ; + args_info->tet_param_help = gengetopt_args_info_help[51] ; + args_info->tet_param_z_help = gengetopt_args_info_help[52] ; + args_info->rnemdz_help = gengetopt_args_info_help[53] ; + args_info->rnemdr_help = gengetopt_args_info_help[54] ; + args_info->rnemdrt_help = gengetopt_args_info_help[55] ; + args_info->uFreqMap_help = gengetopt_args_info_help[56] ; } void cmdline_parser_print_version (void) { - printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); + printf ("%s %s\n", + (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), + CMDLINE_PARSER_VERSION); } -void -cmdline_parser_print_help (void) -{ - int i = 0; +static void print_help_common(void) { cmdline_parser_print_version (); 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_usage) > 0) + printf("\n%s\n", gengetopt_args_info_usage); + printf("\n"); + if (strlen(gengetopt_args_info_description) > 0) - printf("%s\n", gengetopt_args_info_description); + printf("%s\n\n", gengetopt_args_info_description); +} +void +cmdline_parser_print_help (void) +{ + int i = 0; + print_help_common(); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]); } @@ -228,151 +328,233 @@ cmdline_parser_init (struct gengetopt_args_info *args_ clear_args (args_info); init_args_info (args_info); - args_info->inputs = NULL; + args_info->inputs = 0; args_info->inputs_num = 0; } +void +cmdline_parser_params_init(struct cmdline_parser_params *params) +{ + if (params) + { + params->override = 0; + params->initialize = 1; + params->check_required = 1; + params->check_ambiguity = 0; + params->print_errors = 1; + } +} + +struct cmdline_parser_params * +cmdline_parser_params_create(void) +{ + struct cmdline_parser_params *params = + (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); + cmdline_parser_params_init(params); + return params; +} + static void -cmdline_parser_release (struct gengetopt_args_info *args_info) +free_string_field (char **s) { - - unsigned int i; - if (args_info->input_arg) + if (*s) { - free (args_info->input_arg); /* free previous argument */ - args_info->input_arg = 0; - } - if (args_info->input_orig) - { - free (args_info->input_orig); /* free previous argument */ - args_info->input_orig = 0; - } - if (args_info->output_arg) - { - free (args_info->output_arg); /* free previous argument */ - args_info->output_arg = 0; - } - if (args_info->output_orig) - { - free (args_info->output_orig); /* free previous argument */ - args_info->output_orig = 0; - } - if (args_info->step_orig) - { - free (args_info->step_orig); /* free previous argument */ - args_info->step_orig = 0; - } - if (args_info->nbins_orig) - { - free (args_info->nbins_orig); /* free previous argument */ - args_info->nbins_orig = 0; - } - if (args_info->nbins_x_orig) - { - free (args_info->nbins_x_orig); /* free previous argument */ - args_info->nbins_x_orig = 0; - } - if (args_info->nbins_y_orig) - { - free (args_info->nbins_y_orig); /* free previous argument */ - args_info->nbins_y_orig = 0; - } - if (args_info->nanglebins_orig) - { - free (args_info->nanglebins_orig); /* free previous argument */ - args_info->nanglebins_orig = 0; - } - if (args_info->length_orig) - { - free (args_info->length_orig); /* free previous argument */ - args_info->length_orig = 0; + free (*s); + *s = 0; } - if (args_info->rcut_orig) - { - free (args_info->rcut_orig); /* free previous argument */ - args_info->rcut_orig = 0; - } - if (args_info->zoffset_orig) - { - free (args_info->zoffset_orig); /* free previous argument */ - args_info->zoffset_orig = 0; - } - if (args_info->sele1_arg) - { - free (args_info->sele1_arg); /* free previous argument */ - args_info->sele1_arg = 0; - } - if (args_info->sele1_orig) - { - free (args_info->sele1_orig); /* free previous argument */ - args_info->sele1_orig = 0; - } - if (args_info->sele2_arg) - { - free (args_info->sele2_arg); /* free previous argument */ - args_info->sele2_arg = 0; - } - if (args_info->sele2_orig) - { - free (args_info->sele2_orig); /* free previous argument */ - args_info->sele2_orig = 0; - } - if (args_info->sele3_arg) - { - free (args_info->sele3_arg); /* free previous argument */ - args_info->sele3_arg = 0; - } - if (args_info->sele3_orig) - { - free (args_info->sele3_orig); /* free previous argument */ - args_info->sele3_orig = 0; - } - if (args_info->refsele_arg) - { - free (args_info->refsele_arg); /* free previous argument */ - args_info->refsele_arg = 0; - } - if (args_info->refsele_orig) - { - free (args_info->refsele_orig); /* free previous argument */ - args_info->refsele_orig = 0; - } - if (args_info->molname_arg) - { - free (args_info->molname_arg); /* free previous argument */ - args_info->molname_arg = 0; - } - if (args_info->molname_orig) - { - free (args_info->molname_orig); /* free previous argument */ - args_info->molname_orig = 0; - } - if (args_info->begin_orig) - { - free (args_info->begin_orig); /* free previous argument */ - args_info->begin_orig = 0; - } - if (args_info->end_orig) - { - 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; - } +} + + +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)); + free_string_field (&(args_info->output_orig)); + free_string_field (&(args_info->step_orig)); + free_string_field (&(args_info->nbins_orig)); + free_string_field (&(args_info->nbins_x_orig)); + free_string_field (&(args_info->nbins_y_orig)); + 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)); + free_string_field (&(args_info->sele1_arg)); + free_string_field (&(args_info->sele1_orig)); + free_string_field (&(args_info->sele2_arg)); + free_string_field (&(args_info->sele2_orig)); + free_string_field (&(args_info->sele3_arg)); + free_string_field (&(args_info->sele3_orig)); + free_string_field (&(args_info->refsele_arg)); + free_string_field (&(args_info->refsele_orig)); + free_string_field (&(args_info->comsele_arg)); + free_string_field (&(args_info->comsele_orig)); + free_string_field (&(args_info->seleoffset_orig)); + free_string_field (&(args_info->seleoffset2_orig)); + free_string_field (&(args_info->molname_arg)); + free_string_field (&(args_info->molname_orig)); + free_string_field (&(args_info->begin_orig)); + free_string_field (&(args_info->end_orig)); + 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); } + +static void +write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) +{ + FIX_UNUSED (values); + if (arg) { + fprintf(outfile, "%s=\"%s\"\n", opt, arg); + } else { + fprintf(outfile, "%s\n", opt); + } +} + + int +cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) +{ + int i = 0; + + if (!outfile) + { + fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); + return EXIT_FAILURE; + } + + if (args_info->help_given) + write_into_file(outfile, "help", 0, 0 ); + if (args_info->version_given) + write_into_file(outfile, "version", 0, 0 ); + if (args_info->input_given) + write_into_file(outfile, "input", args_info->input_orig, 0); + if (args_info->output_given) + write_into_file(outfile, "output", args_info->output_orig, 0); + if (args_info->step_given) + write_into_file(outfile, "step", args_info->step_orig, 0); + if (args_info->nbins_given) + write_into_file(outfile, "nbins", args_info->nbins_orig, 0); + if (args_info->nbins_x_given) + write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); + if (args_info->nbins_y_given) + write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); + if (args_info->nbins_z_given) + write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); + if (args_info->nanglebins_given) + 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) + write_into_file(outfile, "zlength", args_info->zlength_orig, 0); + if (args_info->zoffset_given) + write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); + if (args_info->sele1_given) + write_into_file(outfile, "sele1", args_info->sele1_orig, 0); + if (args_info->sele2_given) + write_into_file(outfile, "sele2", args_info->sele2_orig, 0); + if (args_info->sele3_given) + write_into_file(outfile, "sele3", args_info->sele3_orig, 0); + if (args_info->refsele_given) + write_into_file(outfile, "refsele", args_info->refsele_orig, 0); + if (args_info->comsele_given) + write_into_file(outfile, "comsele", args_info->comsele_orig, 0); + if (args_info->seleoffset_given) + write_into_file(outfile, "seleoffset", args_info->seleoffset_orig, 0); + if (args_info->seleoffset2_given) + write_into_file(outfile, "seleoffset2", args_info->seleoffset2_orig, 0); + if (args_info->molname_given) + write_into_file(outfile, "molname", args_info->molname_orig, 0); + if (args_info->begin_given) + write_into_file(outfile, "begin", args_info->begin_orig, 0); + if (args_info->end_given) + write_into_file(outfile, "end", args_info->end_orig, 0); + if (args_info->radius_given) + write_into_file(outfile, "radius", args_info->radius_orig, 0); + if (args_info->bo_given) + write_into_file(outfile, "bo", 0, 0 ); + if (args_info->ior_given) + write_into_file(outfile, "ior", 0, 0 ); + if (args_info->for_given) + write_into_file(outfile, "for", 0, 0 ); + if (args_info->bad_given) + write_into_file(outfile, "bad", 0, 0 ); + if (args_info->count_given) + write_into_file(outfile, "count", 0, 0 ); + if (args_info->gofr_given) + write_into_file(outfile, "gofr", 0, 0 ); + if (args_info->gofz_given) + write_into_file(outfile, "gofz", 0, 0 ); + if (args_info->r_theta_given) + write_into_file(outfile, "r_theta", 0, 0 ); + if (args_info->r_omega_given) + write_into_file(outfile, "r_omega", 0, 0 ); + if (args_info->r_z_given) + write_into_file(outfile, "r_z", 0, 0 ); + if (args_info->theta_omega_given) + 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) + write_into_file(outfile, "rp2", 0, 0 ); + if (args_info->scd_given) + write_into_file(outfile, "scd", 0, 0 ); + if (args_info->density_given) + write_into_file(outfile, "density", 0, 0 ); + if (args_info->slab_density_given) + write_into_file(outfile, "slab_density", 0, 0 ); + if (args_info->p_angle_given) + write_into_file(outfile, "p_angle", 0, 0 ); + if (args_info->hxy_given) + write_into_file(outfile, "hxy", 0, 0 ); + if (args_info->rho_r_given) + write_into_file(outfile, "rho_r", 0, 0 ); + if (args_info->angle_r_given) + write_into_file(outfile, "angle_r", 0, 0 ); + if (args_info->hullvol_given) + write_into_file(outfile, "hullvol", 0, 0 ); + if (args_info->rodlength_given) + write_into_file(outfile, "rodlength", 0, 0 ); + if (args_info->tet_param_given) + write_into_file(outfile, "tet_param", 0, 0 ); + if (args_info->tet_param_z_given) + write_into_file(outfile, "tet_param_z", 0, 0 ); + if (args_info->rnemdz_given) + write_into_file(outfile, "rnemdz", 0, 0 ); + if (args_info->rnemdr_given) + write_into_file(outfile, "rnemdr", 0, 0 ); + if (args_info->rnemdrt_given) + write_into_file(outfile, "rnemdrt", 0, 0 ); + if (args_info->uFreqMap_given) + write_into_file(outfile, "uFreqMap", 0, 0 ); + + + i = EXIT_SUCCESS; + return i; +} + +int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; @@ -386,184 +568,9 @@ cmdline_parser_file_save(const char *filename, struct return EXIT_FAILURE; } - if (args_info->help_given) { - fprintf(outfile, "%s\n", "help"); - } - if (args_info->version_given) { - fprintf(outfile, "%s\n", "version"); - } - if (args_info->input_given) { - if (args_info->input_orig) { - fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); - } else { - fprintf(outfile, "%s\n", "input"); - } - } - if (args_info->output_given) { - if (args_info->output_orig) { - fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); - } else { - fprintf(outfile, "%s\n", "output"); - } - } - if (args_info->step_given) { - if (args_info->step_orig) { - fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig); - } else { - fprintf(outfile, "%s\n", "step"); - } - } - if (args_info->nbins_given) { - if (args_info->nbins_orig) { - fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig); - } else { - fprintf(outfile, "%s\n", "nbins"); - } - } - if (args_info->nbins_x_given) { - if (args_info->nbins_x_orig) { - fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig); - } else { - fprintf(outfile, "%s\n", "nbins_x"); - } - } - if (args_info->nbins_y_given) { - if (args_info->nbins_y_orig) { - fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig); - } else { - fprintf(outfile, "%s\n", "nbins_y"); - } - } - if (args_info->nanglebins_given) { - if (args_info->nanglebins_orig) { - fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig); - } else { - fprintf(outfile, "%s\n", "nanglebins"); - } - } - if (args_info->length_given) { - if (args_info->length_orig) { - fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig); - } else { - fprintf(outfile, "%s\n", "length"); - } - } - if (args_info->rcut_given) { - if (args_info->rcut_orig) { - fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig); - } else { - fprintf(outfile, "%s\n", "rcut"); - } - } - if (args_info->zoffset_given) { - if (args_info->zoffset_orig) { - fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig); - } else { - fprintf(outfile, "%s\n", "zoffset"); - } - } - if (args_info->sele1_given) { - if (args_info->sele1_orig) { - fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); - } else { - fprintf(outfile, "%s\n", "sele1"); - } - } - if (args_info->sele2_given) { - if (args_info->sele2_orig) { - fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); - } else { - fprintf(outfile, "%s\n", "sele2"); - } - } - if (args_info->sele3_given) { - if (args_info->sele3_orig) { - fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig); - } else { - fprintf(outfile, "%s\n", "sele3"); - } - } - if (args_info->refsele_given) { - if (args_info->refsele_orig) { - fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig); - } else { - fprintf(outfile, "%s\n", "refsele"); - } - } - if (args_info->molname_given) { - if (args_info->molname_orig) { - fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig); - } else { - fprintf(outfile, "%s\n", "molname"); - } - } - if (args_info->begin_given) { - if (args_info->begin_orig) { - fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig); - } else { - fprintf(outfile, "%s\n", "begin"); - } - } - if (args_info->end_given) { - if (args_info->end_orig) { - fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig); - } else { - 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->gofr_given) { - fprintf(outfile, "%s\n", "gofr"); - } - if (args_info->r_theta_given) { - fprintf(outfile, "%s\n", "r_theta"); - } - if (args_info->r_omega_given) { - fprintf(outfile, "%s\n", "r_omega"); - } - if (args_info->theta_omega_given) { - fprintf(outfile, "%s\n", "theta_omega"); - } - if (args_info->gxyz_given) { - fprintf(outfile, "%s\n", "gxyz"); - } - if (args_info->p2_given) { - fprintf(outfile, "%s\n", "p2"); - } - if (args_info->rp2_given) { - fprintf(outfile, "%s\n", "rp2"); - } - if (args_info->scd_given) { - fprintf(outfile, "%s\n", "scd"); - } - if (args_info->density_given) { - fprintf(outfile, "%s\n", "density"); - } - if (args_info->slab_density_given) { - fprintf(outfile, "%s\n", "slab_density"); - } - if (args_info->hxy_given) { - fprintf(outfile, "%s\n", "hxy"); - } - if (args_info->rho_r_given) { - fprintf(outfile, "%s\n", "rho_r"); - } - + i = cmdline_parser_dump(outfile, args_info); fclose (outfile); - i = EXIT_SUCCESS; return i; } @@ -573,13 +580,11 @@ cmdline_parser_free (struct gengetopt_args_info *args_ cmdline_parser_release (args_info); } - -/* gengetopt_strdup() */ -/* strdup.c replacement of strdup, which is not standard */ +/** @brief replacement of strdup, which is not standard */ char * gengetopt_strdup (const char *s) { - char *result = NULL; + char *result = 0; if (!s) return result; @@ -591,45 +596,81 @@ static void } static void -reset_group_staticProps(struct gengetopt_args_info *args_info); - -static void reset_group_staticProps(struct gengetopt_args_info *args_info) { if (! args_info->staticProps_group_counter) return; args_info->bo_given = 0 ; - args_info->bor_given = 0 ; + args_info->ior_given = 0 ; + args_info->for_given = 0 ; + args_info->bad_given = 0 ; + args_info->count_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->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 ; args_info->density_given = 0 ; args_info->slab_density_given = 0 ; + args_info->p_angle_given = 0 ; args_info->hxy_given = 0 ; args_info->rho_r_given = 0 ; + args_info->angle_r_given = 0 ; + args_info->hullvol_given = 0 ; + args_info->rodlength_given = 0 ; + args_info->tet_param_given = 0 ; + args_info->tet_param_z_given = 0 ; + args_info->rnemdz_given = 0 ; + args_info->rnemdr_given = 0 ; + args_info->rnemdrt_given = 0 ; + args_info->uFreqMap_given = 0 ; args_info->staticProps_group_counter = 0; } int -cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) +cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) { return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); } int -cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) +cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params) { int result; + result = cmdline_parser_internal (argc, argv, args_info, params, 0); - result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); + if (result == EXIT_FAILURE) + { + cmdline_parser_free (args_info); + exit (EXIT_FAILURE); + } + + return result; +} +int +cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) +{ + int result; + struct cmdline_parser_params params; + + params.override = override; + params.initialize = initialize; + params.check_required = check_required; + params.check_ambiguity = 0; + params.print_errors = 1; + + result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); + if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); @@ -644,7 +685,7 @@ cmdline_parser_required (struct gengetopt_args_info *a { int result = EXIT_SUCCESS; - if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) + if (cmdline_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) @@ -660,6 +701,7 @@ cmdline_parser_required2 (struct gengetopt_args_info * cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error = 0; + FIX_UNUSED (additional_error); /* checks for required options */ if (! args_info->input_given) @@ -670,7 +712,7 @@ cmdline_parser_required2 (struct gengetopt_args_info * 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 : "")); + 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; } @@ -680,13 +722,144 @@ cmdline_parser_required2 (struct gengetopt_args_info * return error; } + +static char *package_name = 0; + +/** + * @brief updates an option + * @param field the generic pointer to the field to update + * @param orig_field the pointer to the orig field + * @param field_given the pointer to the number of occurrence of this option + * @param prev_given the pointer to the number of occurrence already seen + * @param value the argument for this option (if null no arg was specified) + * @param possible_values the possible values for this option (if specified) + * @param default_value the default value (in case the option only accepts fixed values) + * @param arg_type the type of this option + * @param check_ambiguity @see cmdline_parser_params.check_ambiguity + * @param override @see cmdline_parser_params.override + * @param no_free whether to free a possible previous value + * @param multiple_option whether this is a multiple option + * @param long_opt the corresponding long option + * @param short_opt the corresponding short option (or '-' if none) + * @param additional_error possible further error specification + */ +static +int update_arg(void *field, char **orig_field, + unsigned int *field_given, unsigned int *prev_given, + char *value, const char *possible_values[], + const char *default_value, + cmdline_parser_arg_type arg_type, + int check_ambiguity, int override, + int no_free, int multiple_option, + const char *long_opt, char short_opt, + const char *additional_error) +{ + char *stop_char = 0; + const char *val = value; + int found; + char **string_field; + FIX_UNUSED (field); + + stop_char = 0; + found = 0; + + if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) + { + if (short_opt != '-') + fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", + package_name, long_opt, short_opt, + (additional_error ? additional_error : "")); + else + fprintf (stderr, "%s: `--%s' option given more than once%s\n", + package_name, long_opt, + (additional_error ? additional_error : "")); + return 1; /* failure */ + } + + FIX_UNUSED (default_value); + + if (field_given && *field_given && ! override) + return 0; + if (prev_given) + (*prev_given)++; + if (field_given) + (*field_given)++; + if (possible_values) + val = possible_values[found]; + + switch(arg_type) { + case ARG_INT: + if (val) *((int *)field) = strtol (val, &stop_char, 0); + break; + case ARG_DOUBLE: + if (val) *((double *)field) = strtod (val, &stop_char); + break; + case ARG_STRING: + if (val) { + string_field = (char **)field; + if (!no_free && *string_field) + free (*string_field); /* free previous string */ + *string_field = gengetopt_strdup (val); + } + break; + default: + break; + }; + + /* check numeric conversion */ + switch(arg_type) { + case ARG_INT: + case ARG_DOUBLE: + if (val && !(stop_char && *stop_char == '\0')) { + fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); + return 1; /* failure */ + } + break; + default: + ; + }; + + /* store the original value */ + switch(arg_type) { + case ARG_NO: + break; + default: + if (value && orig_field) { + if (no_free) { + *orig_field = value; + } else { + if (*orig_field) + free (*orig_field); /* free previous string */ + *orig_field = gengetopt_strdup (value); + } + } + }; + + return 0; /* OK */ +} + + int -cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) +cmdline_parser_internal ( + int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params, const char *additional_error) { int c; /* Character of the parsed option. */ int error = 0; struct gengetopt_args_info local_args_info; + + int override; + int initialize; + int check_required; + int check_ambiguity; + + package_name = argv[0]; + + override = params->override; + initialize = params->initialize; + check_required = params->check_required; + check_ambiguity = params->check_ambiguity; if (initialize) cmdline_parser_init (args_info); @@ -695,13 +868,12 @@ cmdline_parser_internal (int argc, char * const *argv, optarg = 0; optind = 0; - opterr = 1; + opterr = params->print_errors; optopt = '?'; while (1) { int option_index = 0; - char *stop_char; static struct option long_options[] = { { "help", 0, NULL, 'h' }, @@ -712,37 +884,58 @@ cmdline_parser_internal (int argc, char * const *argv, { "nbins", 1, NULL, 'b' }, { "nbins_x", 1, NULL, 'x' }, { "nbins_y", 1, NULL, 'y' }, + { "nbins_z", 1, NULL, 0 }, { "nanglebins", 1, NULL, 'a' }, - { "length", 1, NULL, 0 }, { "rcut", 1, NULL, 'c' }, + { "dz", 1, NULL, 0 }, + { "length", 1, NULL, 0 }, + { "zlength", 1, NULL, 0 }, { "zoffset", 1, NULL, 'z' }, { "sele1", 1, NULL, 0 }, { "sele2", 1, NULL, 0 }, { "sele3", 1, NULL, 0 }, { "refsele", 1, NULL, 0 }, + { "comsele", 1, NULL, 0 }, + { "seleoffset", 1, NULL, 0 }, + { "seleoffset2", 1, NULL, 0 }, { "molname", 1, NULL, 0 }, { "begin", 1, NULL, 0 }, { "end", 1, NULL, 0 }, { "radius", 1, NULL, 0 }, { "bo", 0, NULL, 0 }, - { "bor", 0, NULL, 0 }, + { "ior", 0, NULL, 0 }, + { "for", 0, NULL, 0 }, + { "bad", 0, NULL, 0 }, + { "count", 0, NULL, 0 }, { "gofr", 0, NULL, 'g' }, + { "gofz", 0, NULL, 0 }, { "r_theta", 0, NULL, 0 }, { "r_omega", 0, NULL, 0 }, + { "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' }, { "density", 0, NULL, 'd' }, { "slab_density", 0, NULL, 0 }, + { "p_angle", 0, NULL, 0 }, { "hxy", 0, NULL, 0 }, { "rho_r", 0, NULL, 0 }, - { NULL, 0, NULL, 0 } + { "angle_r", 0, NULL, 0 }, + { "hullvol", 0, NULL, 0 }, + { "rodlength", 0, NULL, 0 }, + { "tet_param", 0, NULL, 'Q' }, + { "tet_param_z", 0, NULL, 0 }, + { "rnemdz", 0, NULL, 0 }, + { "rnemdr", 0, NULL, 0 }, + { "rnemdrt", 0, NULL, 0 }, + { "uFreqMap", 0, NULL, 0 }, + { 0, 0, 0, 0 } }; - stop_char = 0; - c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); + c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ @@ -759,593 +952,826 @@ cmdline_parser_internal (int argc, char * const *argv, exit (EXIT_SUCCESS); case 'i': /* input dump file. */ - if (local_args_info.input_given) - { - fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->input_given && ! override) - continue; - local_args_info.input_given = 1; - args_info->input_given = 1; - if (args_info->input_arg) - free (args_info->input_arg); /* free previous string */ - args_info->input_arg = gengetopt_strdup (optarg); - if (args_info->input_orig) - free (args_info->input_orig); /* free previous string */ - args_info->input_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->input_arg), + &(args_info->input_orig), &(args_info->input_given), + &(local_args_info.input_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "input", 'i', + additional_error)) + goto failure; + break; - case 'o': /* output file name. */ - if (local_args_info.output_given) - { - fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->output_given && ! override) - continue; - local_args_info.output_given = 1; - args_info->output_given = 1; - if (args_info->output_arg) - free (args_info->output_arg); /* free previous string */ - args_info->output_arg = gengetopt_strdup (optarg); - if (args_info->output_orig) - free (args_info->output_orig); /* free previous string */ - args_info->output_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->output_arg), + &(args_info->output_orig), &(args_info->output_given), + &(local_args_info.output_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "output", 'o', + additional_error)) + goto failure; + break; - case 'n': /* process every n frame. */ - if (local_args_info.step_given) - { - fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->step_given && ! override) - continue; - local_args_info.step_given = 1; - args_info->step_given = 1; - args_info->step_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->step_arg), + &(args_info->step_orig), &(args_info->step_given), + &(local_args_info.step_given), optarg, 0, "1", ARG_INT, + check_ambiguity, override, 0, 0, + "step", 'n', + additional_error)) goto failure; - } - if (args_info->step_orig) - free (args_info->step_orig); /* free previous string */ - args_info->step_orig = gengetopt_strdup (optarg); + break; - case 'b': /* number of bins (general purpose). */ - if (local_args_info.nbins_given) - { - fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->nbins_given && ! override) - continue; - local_args_info.nbins_given = 1; - args_info->nbins_given = 1; - args_info->nbins_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->nbins_orig) - free (args_info->nbins_orig); /* free previous string */ - args_info->nbins_orig = gengetopt_strdup (optarg); - break; - + + + if (update_arg( (void *)&(args_info->nbins_arg), + &(args_info->nbins_orig), &(args_info->nbins_given), + &(local_args_info.nbins_given), optarg, 0, "100", ARG_INT, + check_ambiguity, override, 0, 0, + "nbins", 'b', + additional_error)) + goto failure; + + break; case 'x': /* number of bins in x axis. */ - if (local_args_info.nbins_x_given) - { - fprintf (stderr, "%s: `--nbins_x' (`-x') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->nbins_x_given && ! override) - continue; - local_args_info.nbins_x_given = 1; - args_info->nbins_x_given = 1; - args_info->nbins_x_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->nbins_x_arg), + &(args_info->nbins_x_orig), &(args_info->nbins_x_given), + &(local_args_info.nbins_x_given), optarg, 0, "100", ARG_INT, + check_ambiguity, override, 0, 0, + "nbins_x", 'x', + additional_error)) goto failure; - } - if (args_info->nbins_x_orig) - free (args_info->nbins_x_orig); /* free previous string */ - args_info->nbins_x_orig = gengetopt_strdup (optarg); + break; - case 'y': /* number of bins in y axis. */ - if (local_args_info.nbins_y_given) - { - fprintf (stderr, "%s: `--nbins_y' (`-y') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->nbins_y_given && ! override) - continue; - local_args_info.nbins_y_given = 1; - args_info->nbins_y_given = 1; - args_info->nbins_y_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->nbins_y_arg), + &(args_info->nbins_y_orig), &(args_info->nbins_y_given), + &(local_args_info.nbins_y_given), optarg, 0, "100", ARG_INT, + check_ambiguity, override, 0, 0, + "nbins_y", 'y', + additional_error)) goto failure; - } - if (args_info->nbins_y_orig) - free (args_info->nbins_y_orig); /* free previous string */ - args_info->nbins_y_orig = gengetopt_strdup (optarg); + break; - case 'a': /* number of bins for cos(angle). */ - if (local_args_info.nanglebins_given) - { - fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->nanglebins_given && ! override) - continue; - local_args_info.nanglebins_given = 1; - args_info->nanglebins_given = 1; - args_info->nanglebins_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->nanglebins_arg), + &(args_info->nanglebins_orig), &(args_info->nanglebins_given), + &(local_args_info.nanglebins_given), optarg, 0, "50", ARG_INT, + check_ambiguity, override, 0, 0, + "nanglebins", 'a', + additional_error)) goto failure; - } - if (args_info->nanglebins_orig) - free (args_info->nanglebins_orig); /* free previous string */ - args_info->nanglebins_orig = gengetopt_strdup (optarg); + break; - case 'c': /* cutoff radius (rcut). */ - if (local_args_info.rcut_given) - { - fprintf (stderr, "%s: `--rcut' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->rcut_given && ! override) - continue; - local_args_info.rcut_given = 1; - args_info->rcut_given = 1; - args_info->rcut_arg = strtod (optarg, &stop_char); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->rcut_arg), + &(args_info->rcut_orig), &(args_info->rcut_given), + &(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "rcut", 'c', + additional_error)) goto failure; - } - if (args_info->rcut_orig) - free (args_info->rcut_orig); /* free previous string */ - args_info->rcut_orig = gengetopt_strdup (optarg); + break; - case 'z': /* Where to set the zero for the slab_density calculation. */ - if (local_args_info.zoffset_given) - { - fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->zoffset_given && ! override) - continue; - local_args_info.zoffset_given = 1; - args_info->zoffset_given = 1; - args_info->zoffset_arg = strtod (optarg, &stop_char); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->zoffset_arg), + &(args_info->zoffset_orig), &(args_info->zoffset_given), + &(local_args_info.zoffset_given), optarg, 0, "0", ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "zoffset", 'z', + additional_error)) goto failure; - } - if (args_info->zoffset_orig) - free (args_info->zoffset_orig); /* free previous string */ - args_info->zoffset_orig = gengetopt_strdup (optarg); + break; - case 'g': /* g(r). */ - if (local_args_info.gofr_given) - { - fprintf (stderr, "%s: `--gofr' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->gofr_given && ! override) - continue; - local_args_info.gofr_given = 1; - args_info->gofr_given = 1; + 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->gofr_given), + &(local_args_info.gofr_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "gofr", 'g', + additional_error)) + goto failure; + break; - - case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ - if (local_args_info.p2_given) - { - fprintf (stderr, "%s: `--p2' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->p2_given && ! override) - continue; - local_args_info.p2_given = 1; - args_info->p2_given = 1; + case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ + 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->p2_given), + &(local_args_info.p2_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "p2", 'p', + additional_error)) + goto failure; + break; - case 's': /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */ - if (local_args_info.scd_given) - { - fprintf (stderr, "%s: `--scd' (`-s') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->scd_given && ! override) - continue; - local_args_info.scd_given = 1; - args_info->scd_given = 1; + 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->scd_given), + &(local_args_info.scd_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "scd", 's', + additional_error)) + goto failure; + break; - case 'd': /* density plot. */ - if (local_args_info.density_given) - { - fprintf (stderr, "%s: `--density' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->density_given && ! override) - continue; - local_args_info.density_given = 1; - args_info->density_given = 1; + 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->density_given), + &(local_args_info.density_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "density", 'd', + additional_error)) + goto failure; + break; + case 'Q': /* tetrahedrality order parameter (Qk). */ + + 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->tet_param_given), + &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "tet_param", 'Q', + additional_error)) + goto failure; + + break; - case 0: /* Long option with no short option */ - /* maximum length (Defaults to 1/2 smallest length of first frame). */ - if (strcmp (long_options[option_index].name, "length") == 0) + /* number of bins in z axis. */ + if (strcmp (long_options[option_index].name, "nbins_z") == 0) { - if (local_args_info.length_given) - { - fprintf (stderr, "%s: `--length' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->length_given && ! override) - continue; - local_args_info.length_given = 1; - args_info->length_given = 1; - args_info->length_arg = strtod (optarg, &stop_char); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->nbins_z_arg), + &(args_info->nbins_z_orig), &(args_info->nbins_z_given), + &(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, + check_ambiguity, override, 0, 0, + "nbins_z", '-', + additional_error)) goto failure; - } - if (args_info->length_orig) - free (args_info->length_orig); /* free previous string */ - args_info->length_orig = gengetopt_strdup (optarg); + } + /* 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; + + } + /* maximum length (Defaults to 1/2 smallest length of first frame). */ + else if (strcmp (long_options[option_index].name, "length") == 0) + { + + + if (update_arg( (void *)&(args_info->length_arg), + &(args_info->length_orig), &(args_info->length_given), + &(local_args_info.length_given), optarg, 0, 0, ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "length", '-', + additional_error)) + goto failure; + + } + /* maximum length (Defaults to 1/2 smallest length of first frame). */ + else if (strcmp (long_options[option_index].name, "zlength") == 0) + { + + + if (update_arg( (void *)&(args_info->zlength_arg), + &(args_info->zlength_orig), &(args_info->zlength_given), + &(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "zlength", '-', + additional_error)) + goto failure; + + } /* select the first stuntdouble set. */ else if (strcmp (long_options[option_index].name, "sele1") == 0) { - if (local_args_info.sele1_given) - { - fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->sele1_given && ! override) - continue; - local_args_info.sele1_given = 1; - args_info->sele1_given = 1; - if (args_info->sele1_arg) - free (args_info->sele1_arg); /* free previous string */ - args_info->sele1_arg = gengetopt_strdup (optarg); - if (args_info->sele1_orig) - free (args_info->sele1_orig); /* free previous string */ - args_info->sele1_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->sele1_arg), + &(args_info->sele1_orig), &(args_info->sele1_given), + &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "sele1", '-', + additional_error)) + goto failure; + } /* select the second stuntdouble set. */ else if (strcmp (long_options[option_index].name, "sele2") == 0) { - if (local_args_info.sele2_given) - { - fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->sele2_given && ! override) - continue; - local_args_info.sele2_given = 1; - args_info->sele2_given = 1; - if (args_info->sele2_arg) - free (args_info->sele2_arg); /* free previous string */ - args_info->sele2_arg = gengetopt_strdup (optarg); - if (args_info->sele2_orig) - free (args_info->sele2_orig); /* free previous string */ - args_info->sele2_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->sele2_arg), + &(args_info->sele2_orig), &(args_info->sele2_given), + &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "sele2", '-', + additional_error)) + goto failure; + } /* select the third stuntdouble set. */ else if (strcmp (long_options[option_index].name, "sele3") == 0) { - if (local_args_info.sele3_given) - { - fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->sele3_given && ! override) - continue; - local_args_info.sele3_given = 1; - args_info->sele3_given = 1; - if (args_info->sele3_arg) - free (args_info->sele3_arg); /* free previous string */ - args_info->sele3_arg = gengetopt_strdup (optarg); - if (args_info->sele3_orig) - free (args_info->sele3_orig); /* free previous string */ - args_info->sele3_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->sele3_arg), + &(args_info->sele3_orig), &(args_info->sele3_given), + &(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "sele3", '-', + additional_error)) + goto failure; + } /* select reference (use and only use with --gxyz). */ else if (strcmp (long_options[option_index].name, "refsele") == 0) { - if (local_args_info.refsele_given) - { - fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->refsele_given && ! override) - continue; - local_args_info.refsele_given = 1; - args_info->refsele_given = 1; - if (args_info->refsele_arg) - free (args_info->refsele_arg); /* free previous string */ - args_info->refsele_arg = gengetopt_strdup (optarg); - if (args_info->refsele_orig) - free (args_info->refsele_orig); /* free previous string */ - args_info->refsele_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->refsele_arg), + &(args_info->refsele_orig), &(args_info->refsele_given), + &(local_args_info.refsele_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "refsele", '-', + additional_error)) + goto failure; + } + /* select stunt doubles for center-of-mass reference point. */ + else if (strcmp (long_options[option_index].name, "comsele") == 0) + { + + + if (update_arg( (void *)&(args_info->comsele_arg), + &(args_info->comsele_orig), &(args_info->comsele_given), + &(local_args_info.comsele_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "comsele", '-', + additional_error)) + goto failure; + + } + /* global index offset for a second object (used to define a vector between sites in molecule). */ + else if (strcmp (long_options[option_index].name, "seleoffset") == 0) + { + + + if (update_arg( (void *)&(args_info->seleoffset_arg), + &(args_info->seleoffset_orig), &(args_info->seleoffset_given), + &(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT, + check_ambiguity, override, 0, 0, + "seleoffset", '-', + additional_error)) + goto failure; + + } + /* global index offset for a third object (used to define a vector between sites in molecule). */ + else if (strcmp (long_options[option_index].name, "seleoffset2") == 0) + { + + + if (update_arg( (void *)&(args_info->seleoffset2_arg), + &(args_info->seleoffset2_orig), &(args_info->seleoffset2_given), + &(local_args_info.seleoffset2_given), optarg, 0, 0, ARG_INT, + check_ambiguity, override, 0, 0, + "seleoffset2", '-', + additional_error)) + goto failure; + + } /* molecule name. */ else if (strcmp (long_options[option_index].name, "molname") == 0) { - if (local_args_info.molname_given) - { - fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->molname_given && ! override) - continue; - local_args_info.molname_given = 1; - args_info->molname_given = 1; - if (args_info->molname_arg) - free (args_info->molname_arg); /* free previous string */ - args_info->molname_arg = gengetopt_strdup (optarg); - if (args_info->molname_orig) - free (args_info->molname_orig); /* free previous string */ - args_info->molname_orig = gengetopt_strdup (optarg); + + + if (update_arg( (void *)&(args_info->molname_arg), + &(args_info->molname_orig), &(args_info->molname_given), + &(local_args_info.molname_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "molname", '-', + additional_error)) + goto failure; + } /* begin internal index. */ else if (strcmp (long_options[option_index].name, "begin") == 0) { - if (local_args_info.begin_given) - { - fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->begin_given && ! override) - continue; - local_args_info.begin_given = 1; - args_info->begin_given = 1; - args_info->begin_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->begin_arg), + &(args_info->begin_orig), &(args_info->begin_given), + &(local_args_info.begin_given), optarg, 0, 0, ARG_INT, + check_ambiguity, override, 0, 0, + "begin", '-', + additional_error)) goto failure; - } - if (args_info->begin_orig) - free (args_info->begin_orig); /* free previous string */ - args_info->begin_orig = gengetopt_strdup (optarg); + } /* end internal index. */ else if (strcmp (long_options[option_index].name, "end") == 0) { - if (local_args_info.end_given) - { - fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->end_given && ! override) - continue; - local_args_info.end_given = 1; - args_info->end_given = 1; - args_info->end_arg = strtol (optarg, &stop_char, 0); - if (!(stop_char && *stop_char == '\0')) { - fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); + + + if (update_arg( (void *)&(args_info->end_arg), + &(args_info->end_orig), &(args_info->end_given), + &(local_args_info.end_given), optarg, 0, 0, ARG_INT, + check_ambiguity, override, 0, 0, + "end", '-', + additional_error)) goto failure; - } - if (args_info->end_orig) - free (args_info->end_orig); /* free previous string */ - args_info->end_orig = gengetopt_strdup (optarg); + } /* 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); + + + if (update_arg( (void *)&(args_info->radius_arg), + &(args_info->radius_orig), &(args_info->radius_given), + &(local_args_info.radius_given), optarg, 0, 0, ARG_DOUBLE, + check_ambiguity, override, 0, 0, + "radius", '-', + additional_error)) 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) - { - fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->bo_given && ! override) - continue; - local_args_info.bo_given = 1; - args_info->bo_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->bo_given), + &(local_args_info.bo_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "bo", '-', + additional_error)) + goto failure; + } - /* bond order parameter as a function of radius (--rcut must be specified). */ - else if (strcmp (long_options[option_index].name, "bor") == 0) + /* icosahedral bond order parameter as a function of radius (--rcut must be specified). */ + else if (strcmp (long_options[option_index].name, "ior") == 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; + + if (update_arg( 0 , + 0 , &(args_info->ior_given), + &(local_args_info.ior_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "ior", '-', + additional_error)) + goto failure; + } + /* FCC bond order parameter as a function of radius (--rcut must be specified). */ + else if (strcmp (long_options[option_index].name, "for") == 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->for_given), + &(local_args_info.for_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "for", '-', + additional_error)) + goto failure; + + } + /* N(theta) bond angle density within (--rcut must be specified). */ + else if (strcmp (long_options[option_index].name, "bad") == 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->bad_given), + &(local_args_info.bad_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "bad", '-', + additional_error)) + goto failure; + + } + /* count of molecules matching selection criteria (and associated statistics). */ + else if (strcmp (long_options[option_index].name, "count") == 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->count_given), + &(local_args_info.count_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "count", '-', + additional_error)) + goto failure; + + } + /* g(z). */ + else if (strcmp (long_options[option_index].name, "gofz") == 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->gofz_given), + &(local_args_info.gofz_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "gofz", '-', + additional_error)) + goto failure; + + } /* g(r, cos(theta)). */ else if (strcmp (long_options[option_index].name, "r_theta") == 0) { - if (local_args_info.r_theta_given) - { - fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->r_theta_given && ! override) - continue; - local_args_info.r_theta_given = 1; - args_info->r_theta_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->r_theta_given), + &(local_args_info.r_theta_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "r_theta", '-', + additional_error)) + goto failure; + } /* g(r, cos(omega)). */ else if (strcmp (long_options[option_index].name, "r_omega") == 0) { - if (local_args_info.r_omega_given) - { - fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->r_omega_given && ! override) - continue; - local_args_info.r_omega_given = 1; - args_info->r_omega_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->r_omega_given), + &(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "r_omega", '-', + additional_error)) + goto failure; + } + /* g(r, z). */ + else if (strcmp (long_options[option_index].name, "r_z") == 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->r_z_given), + &(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "r_z", '-', + additional_error)) + goto failure; + + } /* g(cos(theta), cos(omega)). */ else if (strcmp (long_options[option_index].name, "theta_omega") == 0) { - if (local_args_info.theta_omega_given) - { - fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->theta_omega_given && ! override) - continue; - local_args_info.theta_omega_given = 1; - args_info->theta_omega_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->theta_omega_given), + &(local_args_info.theta_omega_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "theta_omega", '-', + additional_error)) + goto failure; + } /* g(x, y, z). */ else if (strcmp (long_options[option_index].name, "gxyz") == 0) { - if (local_args_info.gxyz_given) - { - fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->gxyz_given && ! override) - continue; - local_args_info.gxyz_given = 1; - args_info->gxyz_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->gxyz_given), + &(local_args_info.gxyz_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "gxyz", '-', + additional_error)) + 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) { - if (local_args_info.rp2_given) - { - fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->rp2_given && ! override) - continue; - local_args_info.rp2_given = 1; - args_info->rp2_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->rp2_given), + &(local_args_info.rp2_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rp2", '-', + additional_error)) + goto failure; + } /* slab density. */ else if (strcmp (long_options[option_index].name, "slab_density") == 0) { - if (local_args_info.slab_density_given) - { - fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->slab_density_given && ! override) - continue; - local_args_info.slab_density_given = 1; - args_info->slab_density_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->slab_density_given), + &(local_args_info.slab_density_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "slab_density", '-', + additional_error)) + goto failure; + } + /* p(cos(theta)) (--sele1 must be specified, --sele2 is optional). */ + else if (strcmp (long_options[option_index].name, "p_angle") == 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->p_angle_given), + &(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "p_angle", '-', + additional_error)) + goto failure; + + } /* hxy. */ else if (strcmp (long_options[option_index].name, "hxy") == 0) { - if (local_args_info.hxy_given) - { - fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); - goto failure; - } - if (args_info->hxy_given && ! override) - continue; - local_args_info.hxy_given = 1; - args_info->hxy_given = 1; + if (args_info->staticProps_group_counter && override) reset_group_staticProps (args_info); args_info->staticProps_group_counter += 1; - break; + + if (update_arg( 0 , + 0 , &(args_info->hxy_given), + &(local_args_info.hxy_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "hxy", '-', + additional_error)) + goto failure; + } /* 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; + + if (update_arg( 0 , + 0 , &(args_info->rho_r_given), + &(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rho_r", '-', + additional_error)) + goto failure; + } + /* angle of R. */ + else if (strcmp (long_options[option_index].name, "angle_r") == 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->angle_r_given), + &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "angle_r", '-', + additional_error)) + goto failure; + + } + /* hull volume of nanoparticle. */ + else if (strcmp (long_options[option_index].name, "hullvol") == 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->hullvol_given), + &(local_args_info.hullvol_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "hullvol", '-', + additional_error)) + goto failure; + + } + /* length of nanorod. */ + else if (strcmp (long_options[option_index].name, "rodlength") == 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->rodlength_given), + &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rodlength", '-', + additional_error)) + goto failure; + + } + /* spatially-resolved tetrahedrality order parameter Qk(z). */ + else if (strcmp (long_options[option_index].name, "tet_param_z") == 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->tet_param_z_given), + &(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "tet_param_z", '-', + additional_error)) + goto failure; + + } + /* slab-resolved RNEMD statistics (temperature, density, velocity). */ + else if (strcmp (long_options[option_index].name, "rnemdz") == 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->rnemdz_given), + &(local_args_info.rnemdz_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rnemdz", '-', + additional_error)) + goto failure; + + } + /* shell-resolved RNEMD statistics (temperature, density, angular velocity). */ + else if (strcmp (long_options[option_index].name, "rnemdr") == 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->rnemdr_given), + &(local_args_info.rnemdr_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rnemdr", '-', + additional_error)) + goto failure; + + } + /* shell and angle-resolved RNEMD statistics (temperature, density, angular velocity). */ + else if (strcmp (long_options[option_index].name, "rnemdrt") == 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->rnemdrt_given), + &(local_args_info.rnemdrt_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "rnemdrt", '-', + additional_error)) + goto failure; + + } + /* electrostatic potential to frequency map based on the Cho nitrile fits. */ + else if (strcmp (long_options[option_index].name, "uFreqMap") == 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->uFreqMap_given), + &(local_args_info.uFreqMap_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "uFreqMap", '-', + additional_error)) + goto failure; + + } + break; case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ @@ -1359,7 +1785,7 @@ cmdline_parser_internal (int argc, char * const *argv, if (args_info->staticProps_group_counter > 1) { - 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 : "")); + 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 : "")); error = 1; }