| 1 |  | /* | 
| 2 | < | File autogenerated by gengetopt version 2.11 | 
| 2 | > | File autogenerated by gengetopt version 2.19.1 | 
| 3 |  | generated with the following command: | 
| 4 | < | /home/maul/gezelter/tim/bin/gengetopt -F StaticPropsCmd | 
| 4 | > | gengetopt -i StaticProps.ggo -F StaticPropsCmd -u | 
| 5 |  |  | 
| 6 |  | The developers of gengetopt consider the fixed text that goes in all | 
| 7 |  | gengetopt output files to be in the public domain: | 
| 8 |  | we make no copyright claims on it. | 
| 9 |  | */ | 
| 10 |  |  | 
| 11 | – |  | 
| 12 | – | #include <stdio.h> | 
| 13 | – | #include <stdlib.h> | 
| 14 | – | #include <string.h> | 
| 15 | – |  | 
| 11 |  | /* If we use autoconf.  */ | 
| 12 |  | #ifdef HAVE_CONFIG_H | 
| 13 |  | #include "config.h" | 
| 14 |  | #endif | 
| 15 |  |  | 
| 16 | + | #include <stdio.h> | 
| 17 | + | #include <stdlib.h> | 
| 18 | + | #include <string.h> | 
| 19 | + |  | 
| 20 |  | #include "getopt.h" | 
| 21 |  |  | 
| 22 |  | #include "StaticPropsCmd.h" | 
| 23 |  |  | 
| 24 | + | const char *gengetopt_args_info_purpose = ""; | 
| 25 | + |  | 
| 26 | + | const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; | 
| 27 | + |  | 
| 28 | + | const char *gengetopt_args_info_description = ""; | 
| 29 | + |  | 
| 30 | + | const char *gengetopt_args_info_help[] = { | 
| 31 | + | "  -h, --help                    Print help and exit", | 
| 32 | + | "  -V, --version                 Print version and exit", | 
| 33 | + | "  -i, --input=filename          input dump file", | 
| 34 | + | "  -o, --output=filename         output file name", | 
| 35 | + | "  -n, --step=INT                process every n frame  (default=`1')", | 
| 36 | + | "  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')", | 
| 37 | + | "  -x, --nbins_x=INT             number of bins in x axis  (default=`100')", | 
| 38 | + | "  -y, --nbins_y=INT             number of bins in y axis  (default=`100')", | 
| 39 | + | "  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')", | 
| 40 | + | "      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)", | 
| 41 | + | "  -c, --rcut=DOUBLE             cutoff radius (rcut)", | 
| 42 | + | "  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')", | 
| 43 | + | "      --sele1=selection script  select the first stuntdouble set", | 
| 44 | + | "      --sele2=selection script  select the second stuntdouble set", | 
| 45 | + | "      --sele3=selection script  select the third stuntdouble set", | 
| 46 | + | "      --refsele=selection script\n                                select reference (use and only use with --gxyz)", | 
| 47 | + | "      --molname=STRING          molecule name", | 
| 48 | + | "      --begin=INT               begin internal index", | 
| 49 | + | "      --end=INT                 end internal index", | 
| 50 | + | "      --radius=DOUBLE           nanoparticle radius", | 
| 51 | + | "\n Group: staticProps\n   an option of this group is required", | 
| 52 | + | "      --bo                      bond order parameter (--rcut must be specified)", | 
| 53 | + | "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)", | 
| 54 | + | "  -g, --gofr                    g(r)", | 
| 55 | + | "      --r_theta                 g(r, cos(theta))", | 
| 56 | + | "      --r_omega                 g(r, cos(omega))", | 
| 57 | + | "      --theta_omega             g(cos(theta), cos(omega))", | 
| 58 | + | "      --gxyz                    g(x, y, z)", | 
| 59 | + | "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)", | 
| 60 | + | "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)", | 
| 61 | + | "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)", | 
| 62 | + | "  -d, --density                 density plot", | 
| 63 | + | "      --slab_density            slab density", | 
| 64 | + | "      --hxy                     hxy", | 
| 65 | + | "      --rho_r                   rho of R", | 
| 66 | + | 0 | 
| 67 | + | }; | 
| 68 | + |  | 
| 69 | + | static | 
| 70 | + | void clear_given (struct gengetopt_args_info *args_info); | 
| 71 | + | static | 
| 72 | + | void clear_args (struct gengetopt_args_info *args_info); | 
| 73 | + |  | 
| 74 | + | static int | 
| 75 | + | 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); | 
| 76 | + |  | 
| 77 | + | static int | 
| 78 | + | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); | 
| 79 | + |  | 
| 80 | + | static char * | 
| 81 | + | gengetopt_strdup (const char *s); | 
| 82 | + |  | 
| 83 | + | static | 
| 84 | + | void clear_given (struct gengetopt_args_info *args_info) | 
| 85 | + | { | 
| 86 | + | args_info->help_given = 0 ; | 
| 87 | + | args_info->version_given = 0 ; | 
| 88 | + | args_info->input_given = 0 ; | 
| 89 | + | args_info->output_given = 0 ; | 
| 90 | + | args_info->step_given = 0 ; | 
| 91 | + | args_info->nbins_given = 0 ; | 
| 92 | + | args_info->nbins_x_given = 0 ; | 
| 93 | + | args_info->nbins_y_given = 0 ; | 
| 94 | + | args_info->nanglebins_given = 0 ; | 
| 95 | + | args_info->length_given = 0 ; | 
| 96 | + | args_info->rcut_given = 0 ; | 
| 97 | + | args_info->zoffset_given = 0 ; | 
| 98 | + | args_info->sele1_given = 0 ; | 
| 99 | + | args_info->sele2_given = 0 ; | 
| 100 | + | args_info->sele3_given = 0 ; | 
| 101 | + | args_info->refsele_given = 0 ; | 
| 102 | + | args_info->molname_given = 0 ; | 
| 103 | + | args_info->begin_given = 0 ; | 
| 104 | + | args_info->end_given = 0 ; | 
| 105 | + | args_info->radius_given = 0 ; | 
| 106 | + | args_info->bo_given = 0 ; | 
| 107 | + | args_info->bor_given = 0 ; | 
| 108 | + | args_info->gofr_given = 0 ; | 
| 109 | + | args_info->r_theta_given = 0 ; | 
| 110 | + | args_info->r_omega_given = 0 ; | 
| 111 | + | args_info->theta_omega_given = 0 ; | 
| 112 | + | args_info->gxyz_given = 0 ; | 
| 113 | + | args_info->p2_given = 0 ; | 
| 114 | + | args_info->rp2_given = 0 ; | 
| 115 | + | args_info->scd_given = 0 ; | 
| 116 | + | args_info->density_given = 0 ; | 
| 117 | + | args_info->slab_density_given = 0 ; | 
| 118 | + | args_info->hxy_given = 0 ; | 
| 119 | + | args_info->rho_r_given = 0 ; | 
| 120 | + | args_info->staticProps_group_counter = 0 ; | 
| 121 | + | } | 
| 122 | + |  | 
| 123 | + | static | 
| 124 | + | void clear_args (struct gengetopt_args_info *args_info) | 
| 125 | + | { | 
| 126 | + | args_info->input_arg = NULL; | 
| 127 | + | args_info->input_orig = NULL; | 
| 128 | + | args_info->output_arg = NULL; | 
| 129 | + | args_info->output_orig = NULL; | 
| 130 | + | args_info->step_arg = 1; | 
| 131 | + | args_info->step_orig = NULL; | 
| 132 | + | args_info->nbins_arg = 100; | 
| 133 | + | args_info->nbins_orig = NULL; | 
| 134 | + | args_info->nbins_x_arg = 100; | 
| 135 | + | args_info->nbins_x_orig = NULL; | 
| 136 | + | args_info->nbins_y_arg = 100; | 
| 137 | + | args_info->nbins_y_orig = NULL; | 
| 138 | + | args_info->nanglebins_arg = 50; | 
| 139 | + | args_info->nanglebins_orig = NULL; | 
| 140 | + | args_info->length_orig = NULL; | 
| 141 | + | args_info->rcut_orig = NULL; | 
| 142 | + | args_info->zoffset_arg = 0; | 
| 143 | + | args_info->zoffset_orig = NULL; | 
| 144 | + | args_info->sele1_arg = NULL; | 
| 145 | + | args_info->sele1_orig = NULL; | 
| 146 | + | args_info->sele2_arg = NULL; | 
| 147 | + | args_info->sele2_orig = NULL; | 
| 148 | + | args_info->sele3_arg = NULL; | 
| 149 | + | args_info->sele3_orig = NULL; | 
| 150 | + | args_info->refsele_arg = NULL; | 
| 151 | + | args_info->refsele_orig = NULL; | 
| 152 | + | args_info->molname_arg = NULL; | 
| 153 | + | args_info->molname_orig = NULL; | 
| 154 | + | args_info->begin_orig = NULL; | 
| 155 | + | args_info->end_orig = NULL; | 
| 156 | + | args_info->radius_orig = NULL; | 
| 157 | + |  | 
| 158 | + | } | 
| 159 | + |  | 
| 160 | + | static | 
| 161 | + | void init_args_info(struct gengetopt_args_info *args_info) | 
| 162 | + | { | 
| 163 | + | args_info->help_help = gengetopt_args_info_help[0] ; | 
| 164 | + | args_info->version_help = gengetopt_args_info_help[1] ; | 
| 165 | + | args_info->input_help = gengetopt_args_info_help[2] ; | 
| 166 | + | args_info->output_help = gengetopt_args_info_help[3] ; | 
| 167 | + | args_info->step_help = gengetopt_args_info_help[4] ; | 
| 168 | + | args_info->nbins_help = gengetopt_args_info_help[5] ; | 
| 169 | + | args_info->nbins_x_help = gengetopt_args_info_help[6] ; | 
| 170 | + | args_info->nbins_y_help = gengetopt_args_info_help[7] ; | 
| 171 | + | args_info->nanglebins_help = gengetopt_args_info_help[8] ; | 
| 172 | + | args_info->length_help = gengetopt_args_info_help[9] ; | 
| 173 | + | args_info->rcut_help = gengetopt_args_info_help[10] ; | 
| 174 | + | args_info->zoffset_help = gengetopt_args_info_help[11] ; | 
| 175 | + | args_info->sele1_help = gengetopt_args_info_help[12] ; | 
| 176 | + | args_info->sele2_help = gengetopt_args_info_help[13] ; | 
| 177 | + | args_info->sele3_help = gengetopt_args_info_help[14] ; | 
| 178 | + | args_info->refsele_help = gengetopt_args_info_help[15] ; | 
| 179 | + | args_info->molname_help = gengetopt_args_info_help[16] ; | 
| 180 | + | args_info->begin_help = gengetopt_args_info_help[17] ; | 
| 181 | + | args_info->end_help = gengetopt_args_info_help[18] ; | 
| 182 | + | args_info->radius_help = gengetopt_args_info_help[19] ; | 
| 183 | + | args_info->bo_help = gengetopt_args_info_help[20] ; | 
| 184 | + | args_info->bor_help = gengetopt_args_info_help[21] ; | 
| 185 | + | args_info->gofr_help = gengetopt_args_info_help[22] ; | 
| 186 | + | args_info->r_theta_help = gengetopt_args_info_help[23] ; | 
| 187 | + | args_info->r_omega_help = gengetopt_args_info_help[24] ; | 
| 188 | + | args_info->theta_omega_help = gengetopt_args_info_help[25] ; | 
| 189 | + | args_info->gxyz_help = gengetopt_args_info_help[26] ; | 
| 190 | + | args_info->p2_help = gengetopt_args_info_help[27] ; | 
| 191 | + | args_info->rp2_help = gengetopt_args_info_help[28] ; | 
| 192 | + | args_info->scd_help = gengetopt_args_info_help[29] ; | 
| 193 | + | args_info->density_help = gengetopt_args_info_help[30] ; | 
| 194 | + | args_info->slab_density_help = gengetopt_args_info_help[31] ; | 
| 195 | + | args_info->hxy_help = gengetopt_args_info_help[32] ; | 
| 196 | + | args_info->rho_r_help = gengetopt_args_info_help[33] ; | 
| 197 | + |  | 
| 198 | + | } | 
| 199 | + |  | 
| 200 |  | void | 
| 201 |  | cmdline_parser_print_version (void) | 
| 202 |  | { | 
| 206 |  | void | 
| 207 |  | cmdline_parser_print_help (void) | 
| 208 |  | { | 
| 209 | + | int i = 0; | 
| 210 |  | cmdline_parser_print_version (); | 
| 211 | < | printf("\n" | 
| 212 | < | "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); | 
| 213 | < | printf("\n"); | 
| 214 | < | printf("  -h, --help                      Print help and exit\n"); | 
| 215 | < | printf("  -V, --version                   Print version and exit\n"); | 
| 216 | < | printf("  -i, --input=filename            input dump file\n"); | 
| 217 | < | printf("  -o, --output=filename           output file name\n"); | 
| 218 | < | printf("  -n, --step=INT                  process every n frame  (default=`1')\n"); | 
| 219 | < | printf("  -r, --nrbins=INT                number of bins for distance  (default=`100')\n"); | 
| 220 | < | printf("  -a, --nanglebins=INT            number of bins for cos(angle)  (default=\n                                    `50')\n"); | 
| 221 | < | printf("  -l, --length=DOUBLE             maximum length (Defaults to 1/2 smallest \n                                    length of first frame)\n"); | 
| 46 | < | printf("      --sele1=selection script    select first stuntdouble set\n"); | 
| 47 | < | printf("      --sele2=selection script    select second stuntdouble set\n"); | 
| 48 | < | printf("      --refsele=selection script  select reference (use and only use with \n                                    --gxyz)\n"); | 
| 49 | < | printf("\n"); | 
| 50 | < | printf(" Group: staticProps  an option of this group is required\n"); | 
| 51 | < | printf("      --gofr                      g(r)\n"); | 
| 52 | < | printf("      --r_theta                   g(r, cos(theta))\n"); | 
| 53 | < | printf("      --r_omega                   g(r, cos(omega))\n"); | 
| 54 | < | printf("      --theta_omega               g(cos(theta), cos(omega))\n"); | 
| 55 | < | printf("      --gxyz                      g(x, y, z)\n"); | 
| 211 | > |  | 
| 212 | > | if (strlen(gengetopt_args_info_purpose) > 0) | 
| 213 | > | printf("\n%s\n", gengetopt_args_info_purpose); | 
| 214 | > |  | 
| 215 | > | printf("\n%s\n\n", gengetopt_args_info_usage); | 
| 216 | > |  | 
| 217 | > | if (strlen(gengetopt_args_info_description) > 0) | 
| 218 | > | printf("%s\n", gengetopt_args_info_description); | 
| 219 | > |  | 
| 220 | > | while (gengetopt_args_info_help[i]) | 
| 221 | > | printf("%s\n", gengetopt_args_info_help[i++]); | 
| 222 |  | } | 
| 223 |  |  | 
| 224 | + | void | 
| 225 | + | cmdline_parser_init (struct gengetopt_args_info *args_info) | 
| 226 | + | { | 
| 227 | + | clear_given (args_info); | 
| 228 | + | clear_args (args_info); | 
| 229 | + | init_args_info (args_info); | 
| 230 |  |  | 
| 231 | < | static char *gengetopt_strdup (const char *s); | 
| 231 | > | args_info->inputs = NULL; | 
| 232 | > | args_info->inputs_num = 0; | 
| 233 | > | } | 
| 234 |  |  | 
| 235 | + | static void | 
| 236 | + | cmdline_parser_release (struct gengetopt_args_info *args_info) | 
| 237 | + | { | 
| 238 | + |  | 
| 239 | + | unsigned int i; | 
| 240 | + | if (args_info->input_arg) | 
| 241 | + | { | 
| 242 | + | free (args_info->input_arg); /* free previous argument */ | 
| 243 | + | args_info->input_arg = 0; | 
| 244 | + | } | 
| 245 | + | if (args_info->input_orig) | 
| 246 | + | { | 
| 247 | + | free (args_info->input_orig); /* free previous argument */ | 
| 248 | + | args_info->input_orig = 0; | 
| 249 | + | } | 
| 250 | + | if (args_info->output_arg) | 
| 251 | + | { | 
| 252 | + | free (args_info->output_arg); /* free previous argument */ | 
| 253 | + | args_info->output_arg = 0; | 
| 254 | + | } | 
| 255 | + | if (args_info->output_orig) | 
| 256 | + | { | 
| 257 | + | free (args_info->output_orig); /* free previous argument */ | 
| 258 | + | args_info->output_orig = 0; | 
| 259 | + | } | 
| 260 | + | if (args_info->step_orig) | 
| 261 | + | { | 
| 262 | + | free (args_info->step_orig); /* free previous argument */ | 
| 263 | + | args_info->step_orig = 0; | 
| 264 | + | } | 
| 265 | + | if (args_info->nbins_orig) | 
| 266 | + | { | 
| 267 | + | free (args_info->nbins_orig); /* free previous argument */ | 
| 268 | + | args_info->nbins_orig = 0; | 
| 269 | + | } | 
| 270 | + | if (args_info->nbins_x_orig) | 
| 271 | + | { | 
| 272 | + | free (args_info->nbins_x_orig); /* free previous argument */ | 
| 273 | + | args_info->nbins_x_orig = 0; | 
| 274 | + | } | 
| 275 | + | if (args_info->nbins_y_orig) | 
| 276 | + | { | 
| 277 | + | free (args_info->nbins_y_orig); /* free previous argument */ | 
| 278 | + | args_info->nbins_y_orig = 0; | 
| 279 | + | } | 
| 280 | + | if (args_info->nanglebins_orig) | 
| 281 | + | { | 
| 282 | + | free (args_info->nanglebins_orig); /* free previous argument */ | 
| 283 | + | args_info->nanglebins_orig = 0; | 
| 284 | + | } | 
| 285 | + | if (args_info->length_orig) | 
| 286 | + | { | 
| 287 | + | free (args_info->length_orig); /* free previous argument */ | 
| 288 | + | args_info->length_orig = 0; | 
| 289 | + | } | 
| 290 | + | if (args_info->rcut_orig) | 
| 291 | + | { | 
| 292 | + | free (args_info->rcut_orig); /* free previous argument */ | 
| 293 | + | args_info->rcut_orig = 0; | 
| 294 | + | } | 
| 295 | + | if (args_info->zoffset_orig) | 
| 296 | + | { | 
| 297 | + | free (args_info->zoffset_orig); /* free previous argument */ | 
| 298 | + | args_info->zoffset_orig = 0; | 
| 299 | + | } | 
| 300 | + | if (args_info->sele1_arg) | 
| 301 | + | { | 
| 302 | + | free (args_info->sele1_arg); /* free previous argument */ | 
| 303 | + | args_info->sele1_arg = 0; | 
| 304 | + | } | 
| 305 | + | if (args_info->sele1_orig) | 
| 306 | + | { | 
| 307 | + | free (args_info->sele1_orig); /* free previous argument */ | 
| 308 | + | args_info->sele1_orig = 0; | 
| 309 | + | } | 
| 310 | + | if (args_info->sele2_arg) | 
| 311 | + | { | 
| 312 | + | free (args_info->sele2_arg); /* free previous argument */ | 
| 313 | + | args_info->sele2_arg = 0; | 
| 314 | + | } | 
| 315 | + | if (args_info->sele2_orig) | 
| 316 | + | { | 
| 317 | + | free (args_info->sele2_orig); /* free previous argument */ | 
| 318 | + | args_info->sele2_orig = 0; | 
| 319 | + | } | 
| 320 | + | if (args_info->sele3_arg) | 
| 321 | + | { | 
| 322 | + | free (args_info->sele3_arg); /* free previous argument */ | 
| 323 | + | args_info->sele3_arg = 0; | 
| 324 | + | } | 
| 325 | + | if (args_info->sele3_orig) | 
| 326 | + | { | 
| 327 | + | free (args_info->sele3_orig); /* free previous argument */ | 
| 328 | + | args_info->sele3_orig = 0; | 
| 329 | + | } | 
| 330 | + | if (args_info->refsele_arg) | 
| 331 | + | { | 
| 332 | + | free (args_info->refsele_arg); /* free previous argument */ | 
| 333 | + | args_info->refsele_arg = 0; | 
| 334 | + | } | 
| 335 | + | if (args_info->refsele_orig) | 
| 336 | + | { | 
| 337 | + | free (args_info->refsele_orig); /* free previous argument */ | 
| 338 | + | args_info->refsele_orig = 0; | 
| 339 | + | } | 
| 340 | + | if (args_info->molname_arg) | 
| 341 | + | { | 
| 342 | + | free (args_info->molname_arg); /* free previous argument */ | 
| 343 | + | args_info->molname_arg = 0; | 
| 344 | + | } | 
| 345 | + | if (args_info->molname_orig) | 
| 346 | + | { | 
| 347 | + | free (args_info->molname_orig); /* free previous argument */ | 
| 348 | + | args_info->molname_orig = 0; | 
| 349 | + | } | 
| 350 | + | if (args_info->begin_orig) | 
| 351 | + | { | 
| 352 | + | free (args_info->begin_orig); /* free previous argument */ | 
| 353 | + | args_info->begin_orig = 0; | 
| 354 | + | } | 
| 355 | + | if (args_info->end_orig) | 
| 356 | + | { | 
| 357 | + | free (args_info->end_orig); /* free previous argument */ | 
| 358 | + | args_info->end_orig = 0; | 
| 359 | + | } | 
| 360 | + | if (args_info->radius_orig) | 
| 361 | + | { | 
| 362 | + | free (args_info->radius_orig); /* free previous argument */ | 
| 363 | + | args_info->radius_orig = 0; | 
| 364 | + | } | 
| 365 | + |  | 
| 366 | + | for (i = 0; i < args_info->inputs_num; ++i) | 
| 367 | + | free (args_info->inputs [i]); | 
| 368 | + |  | 
| 369 | + | if (args_info->inputs_num) | 
| 370 | + | free (args_info->inputs); | 
| 371 | + |  | 
| 372 | + | clear_given (args_info); | 
| 373 | + | } | 
| 374 | + |  | 
| 375 | + | int | 
| 376 | + | cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) | 
| 377 | + | { | 
| 378 | + | FILE *outfile; | 
| 379 | + | int i = 0; | 
| 380 | + |  | 
| 381 | + | outfile = fopen(filename, "w"); | 
| 382 | + |  | 
| 383 | + | if (!outfile) | 
| 384 | + | { | 
| 385 | + | fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); | 
| 386 | + | return EXIT_FAILURE; | 
| 387 | + | } | 
| 388 | + |  | 
| 389 | + | if (args_info->help_given) { | 
| 390 | + | fprintf(outfile, "%s\n", "help"); | 
| 391 | + | } | 
| 392 | + | if (args_info->version_given) { | 
| 393 | + | fprintf(outfile, "%s\n", "version"); | 
| 394 | + | } | 
| 395 | + | if (args_info->input_given) { | 
| 396 | + | if (args_info->input_orig) { | 
| 397 | + | fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); | 
| 398 | + | } else { | 
| 399 | + | fprintf(outfile, "%s\n", "input"); | 
| 400 | + | } | 
| 401 | + | } | 
| 402 | + | if (args_info->output_given) { | 
| 403 | + | if (args_info->output_orig) { | 
| 404 | + | fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); | 
| 405 | + | } else { | 
| 406 | + | fprintf(outfile, "%s\n", "output"); | 
| 407 | + | } | 
| 408 | + | } | 
| 409 | + | if (args_info->step_given) { | 
| 410 | + | if (args_info->step_orig) { | 
| 411 | + | fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig); | 
| 412 | + | } else { | 
| 413 | + | fprintf(outfile, "%s\n", "step"); | 
| 414 | + | } | 
| 415 | + | } | 
| 416 | + | if (args_info->nbins_given) { | 
| 417 | + | if (args_info->nbins_orig) { | 
| 418 | + | fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig); | 
| 419 | + | } else { | 
| 420 | + | fprintf(outfile, "%s\n", "nbins"); | 
| 421 | + | } | 
| 422 | + | } | 
| 423 | + | if (args_info->nbins_x_given) { | 
| 424 | + | if (args_info->nbins_x_orig) { | 
| 425 | + | fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig); | 
| 426 | + | } else { | 
| 427 | + | fprintf(outfile, "%s\n", "nbins_x"); | 
| 428 | + | } | 
| 429 | + | } | 
| 430 | + | if (args_info->nbins_y_given) { | 
| 431 | + | if (args_info->nbins_y_orig) { | 
| 432 | + | fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig); | 
| 433 | + | } else { | 
| 434 | + | fprintf(outfile, "%s\n", "nbins_y"); | 
| 435 | + | } | 
| 436 | + | } | 
| 437 | + | if (args_info->nanglebins_given) { | 
| 438 | + | if (args_info->nanglebins_orig) { | 
| 439 | + | fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig); | 
| 440 | + | } else { | 
| 441 | + | fprintf(outfile, "%s\n", "nanglebins"); | 
| 442 | + | } | 
| 443 | + | } | 
| 444 | + | if (args_info->length_given) { | 
| 445 | + | if (args_info->length_orig) { | 
| 446 | + | fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig); | 
| 447 | + | } else { | 
| 448 | + | fprintf(outfile, "%s\n", "length"); | 
| 449 | + | } | 
| 450 | + | } | 
| 451 | + | if (args_info->rcut_given) { | 
| 452 | + | if (args_info->rcut_orig) { | 
| 453 | + | fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig); | 
| 454 | + | } else { | 
| 455 | + | fprintf(outfile, "%s\n", "rcut"); | 
| 456 | + | } | 
| 457 | + | } | 
| 458 | + | if (args_info->zoffset_given) { | 
| 459 | + | if (args_info->zoffset_orig) { | 
| 460 | + | fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig); | 
| 461 | + | } else { | 
| 462 | + | fprintf(outfile, "%s\n", "zoffset"); | 
| 463 | + | } | 
| 464 | + | } | 
| 465 | + | if (args_info->sele1_given) { | 
| 466 | + | if (args_info->sele1_orig) { | 
| 467 | + | fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); | 
| 468 | + | } else { | 
| 469 | + | fprintf(outfile, "%s\n", "sele1"); | 
| 470 | + | } | 
| 471 | + | } | 
| 472 | + | if (args_info->sele2_given) { | 
| 473 | + | if (args_info->sele2_orig) { | 
| 474 | + | fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); | 
| 475 | + | } else { | 
| 476 | + | fprintf(outfile, "%s\n", "sele2"); | 
| 477 | + | } | 
| 478 | + | } | 
| 479 | + | if (args_info->sele3_given) { | 
| 480 | + | if (args_info->sele3_orig) { | 
| 481 | + | fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig); | 
| 482 | + | } else { | 
| 483 | + | fprintf(outfile, "%s\n", "sele3"); | 
| 484 | + | } | 
| 485 | + | } | 
| 486 | + | if (args_info->refsele_given) { | 
| 487 | + | if (args_info->refsele_orig) { | 
| 488 | + | fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig); | 
| 489 | + | } else { | 
| 490 | + | fprintf(outfile, "%s\n", "refsele"); | 
| 491 | + | } | 
| 492 | + | } | 
| 493 | + | if (args_info->molname_given) { | 
| 494 | + | if (args_info->molname_orig) { | 
| 495 | + | fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig); | 
| 496 | + | } else { | 
| 497 | + | fprintf(outfile, "%s\n", "molname"); | 
| 498 | + | } | 
| 499 | + | } | 
| 500 | + | if (args_info->begin_given) { | 
| 501 | + | if (args_info->begin_orig) { | 
| 502 | + | fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig); | 
| 503 | + | } else { | 
| 504 | + | fprintf(outfile, "%s\n", "begin"); | 
| 505 | + | } | 
| 506 | + | } | 
| 507 | + | if (args_info->end_given) { | 
| 508 | + | if (args_info->end_orig) { | 
| 509 | + | fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig); | 
| 510 | + | } else { | 
| 511 | + | fprintf(outfile, "%s\n", "end"); | 
| 512 | + | } | 
| 513 | + | } | 
| 514 | + | if (args_info->radius_given) { | 
| 515 | + | if (args_info->radius_orig) { | 
| 516 | + | fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig); | 
| 517 | + | } else { | 
| 518 | + | fprintf(outfile, "%s\n", "radius"); | 
| 519 | + | } | 
| 520 | + | } | 
| 521 | + | if (args_info->bo_given) { | 
| 522 | + | fprintf(outfile, "%s\n", "bo"); | 
| 523 | + | } | 
| 524 | + | if (args_info->bor_given) { | 
| 525 | + | fprintf(outfile, "%s\n", "bor"); | 
| 526 | + | } | 
| 527 | + | if (args_info->gofr_given) { | 
| 528 | + | fprintf(outfile, "%s\n", "gofr"); | 
| 529 | + | } | 
| 530 | + | if (args_info->r_theta_given) { | 
| 531 | + | fprintf(outfile, "%s\n", "r_theta"); | 
| 532 | + | } | 
| 533 | + | if (args_info->r_omega_given) { | 
| 534 | + | fprintf(outfile, "%s\n", "r_omega"); | 
| 535 | + | } | 
| 536 | + | if (args_info->theta_omega_given) { | 
| 537 | + | fprintf(outfile, "%s\n", "theta_omega"); | 
| 538 | + | } | 
| 539 | + | if (args_info->gxyz_given) { | 
| 540 | + | fprintf(outfile, "%s\n", "gxyz"); | 
| 541 | + | } | 
| 542 | + | if (args_info->p2_given) { | 
| 543 | + | fprintf(outfile, "%s\n", "p2"); | 
| 544 | + | } | 
| 545 | + | if (args_info->rp2_given) { | 
| 546 | + | fprintf(outfile, "%s\n", "rp2"); | 
| 547 | + | } | 
| 548 | + | if (args_info->scd_given) { | 
| 549 | + | fprintf(outfile, "%s\n", "scd"); | 
| 550 | + | } | 
| 551 | + | if (args_info->density_given) { | 
| 552 | + | fprintf(outfile, "%s\n", "density"); | 
| 553 | + | } | 
| 554 | + | if (args_info->slab_density_given) { | 
| 555 | + | fprintf(outfile, "%s\n", "slab_density"); | 
| 556 | + | } | 
| 557 | + | if (args_info->hxy_given) { | 
| 558 | + | fprintf(outfile, "%s\n", "hxy"); | 
| 559 | + | } | 
| 560 | + | if (args_info->rho_r_given) { | 
| 561 | + | fprintf(outfile, "%s\n", "rho_r"); | 
| 562 | + | } | 
| 563 | + |  | 
| 564 | + | fclose (outfile); | 
| 565 | + |  | 
| 566 | + | i = EXIT_SUCCESS; | 
| 567 | + | return i; | 
| 568 | + | } | 
| 569 | + |  | 
| 570 | + | void | 
| 571 | + | cmdline_parser_free (struct gengetopt_args_info *args_info) | 
| 572 | + | { | 
| 573 | + | cmdline_parser_release (args_info); | 
| 574 | + | } | 
| 575 | + |  | 
| 576 | + |  | 
| 577 |  | /* gengetopt_strdup() */ | 
| 578 |  | /* strdup.c replacement of strdup, which is not standard */ | 
| 579 |  | char * | 
| 580 |  | gengetopt_strdup (const char *s) | 
| 581 |  | { | 
| 582 | < | char *result = (char*)malloc(strlen(s) + 1); | 
| 582 | > | char *result = NULL; | 
| 583 | > | if (!s) | 
| 584 | > | return result; | 
| 585 | > |  | 
| 586 | > | result = (char*)malloc(strlen(s) + 1); | 
| 587 |  | if (result == (char*)0) | 
| 588 |  | return (char*)0; | 
| 589 |  | strcpy(result, s); | 
| 590 |  | return result; | 
| 591 |  | } | 
| 592 |  |  | 
| 593 | < | int | 
| 594 | < | cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) | 
| 75 | < | { | 
| 76 | < | int c;        /* Character of the parsed option.  */ | 
| 77 | < | int missing_required_options = 0; | 
| 78 | < | int staticProps_group_counter = 0; | 
| 79 | < |  | 
| 593 | > | static void | 
| 594 | > | reset_group_staticProps(struct gengetopt_args_info *args_info); | 
| 595 |  |  | 
| 596 | < | args_info->help_given = 0 ; | 
| 597 | < | args_info->version_given = 0 ; | 
| 598 | < | args_info->input_given = 0 ; | 
| 599 | < | args_info->output_given = 0 ; | 
| 600 | < | args_info->step_given = 0 ; | 
| 601 | < | args_info->nrbins_given = 0 ; | 
| 602 | < | args_info->nanglebins_given = 0 ; | 
| 603 | < | args_info->length_given = 0 ; | 
| 89 | < | args_info->sele1_given = 0 ; | 
| 90 | < | args_info->sele2_given = 0 ; | 
| 91 | < | args_info->refsele_given = 0 ; | 
| 596 | > | static void | 
| 597 | > | reset_group_staticProps(struct gengetopt_args_info *args_info) | 
| 598 | > | { | 
| 599 | > | if (! args_info->staticProps_group_counter) | 
| 600 | > | return; | 
| 601 | > |  | 
| 602 | > | args_info->bo_given = 0 ; | 
| 603 | > | args_info->bor_given = 0 ; | 
| 604 |  | args_info->gofr_given = 0 ; | 
| 605 |  | args_info->r_theta_given = 0 ; | 
| 606 |  | args_info->r_omega_given = 0 ; | 
| 607 |  | args_info->theta_omega_given = 0 ; | 
| 608 |  | args_info->gxyz_given = 0 ; | 
| 609 | < | #define clear_args() {                          \ | 
| 610 | < | args_info->input_arg = NULL;                \ | 
| 611 | < | args_info->output_arg = NULL;               \ | 
| 612 | < | args_info->step_arg = 1 ;                   \ | 
| 613 | < | args_info->nrbins_arg = 100 ;               \ | 
| 614 | < | args_info->nanglebins_arg = 50 ;            \ | 
| 615 | < | args_info->sele1_arg = NULL;                \ | 
| 104 | < | args_info->sele2_arg = NULL;                \ | 
| 105 | < | args_info->refsele_arg = NULL;              \ | 
| 106 | < | } | 
| 609 | > | args_info->p2_given = 0 ; | 
| 610 | > | args_info->rp2_given = 0 ; | 
| 611 | > | args_info->scd_given = 0 ; | 
| 612 | > | args_info->density_given = 0 ; | 
| 613 | > | args_info->slab_density_given = 0 ; | 
| 614 | > | args_info->hxy_given = 0 ; | 
| 615 | > | args_info->rho_r_given = 0 ; | 
| 616 |  |  | 
| 617 | < | clear_args(); | 
| 617 | > | args_info->staticProps_group_counter = 0; | 
| 618 | > | } | 
| 619 |  |  | 
| 620 | + | int | 
| 621 | + | cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) | 
| 622 | + | { | 
| 623 | + | return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); | 
| 624 | + | } | 
| 625 | + |  | 
| 626 | + | int | 
| 627 | + | cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) | 
| 628 | + | { | 
| 629 | + | int result; | 
| 630 | + |  | 
| 631 | + | result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); | 
| 632 | + |  | 
| 633 | + | if (result == EXIT_FAILURE) | 
| 634 | + | { | 
| 635 | + | cmdline_parser_free (args_info); | 
| 636 | + | exit (EXIT_FAILURE); | 
| 637 | + | } | 
| 638 | + |  | 
| 639 | + | return result; | 
| 640 | + | } | 
| 641 | + |  | 
| 642 | + | int | 
| 643 | + | cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) | 
| 644 | + | { | 
| 645 | + | int result = EXIT_SUCCESS; | 
| 646 | + |  | 
| 647 | + | if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) | 
| 648 | + | result = EXIT_FAILURE; | 
| 649 | + |  | 
| 650 | + | if (result == EXIT_FAILURE) | 
| 651 | + | { | 
| 652 | + | cmdline_parser_free (args_info); | 
| 653 | + | exit (EXIT_FAILURE); | 
| 654 | + | } | 
| 655 | + |  | 
| 656 | + | return result; | 
| 657 | + | } | 
| 658 | + |  | 
| 659 | + | int | 
| 660 | + | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) | 
| 661 | + | { | 
| 662 | + | int error = 0; | 
| 663 | + |  | 
| 664 | + | /* checks for required options */ | 
| 665 | + | if (! args_info->input_given) | 
| 666 | + | { | 
| 667 | + | fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); | 
| 668 | + | error = 1; | 
| 669 | + | } | 
| 670 | + |  | 
| 671 | + | if (args_info->staticProps_group_counter == 0) | 
| 672 | + | { | 
| 673 | + | 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 : "")); | 
| 674 | + | error = 1; | 
| 675 | + | } | 
| 676 | + |  | 
| 677 | + |  | 
| 678 | + | /* checks for dependences among options */ | 
| 679 | + |  | 
| 680 | + | return error; | 
| 681 | + | } | 
| 682 | + |  | 
| 683 | + | int | 
| 684 | + | 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) | 
| 685 | + | { | 
| 686 | + | int c;        /* Character of the parsed option.  */ | 
| 687 | + |  | 
| 688 | + | int error = 0; | 
| 689 | + | struct gengetopt_args_info local_args_info; | 
| 690 | + |  | 
| 691 | + | if (initialize) | 
| 692 | + | cmdline_parser_init (args_info); | 
| 693 | + |  | 
| 694 | + | cmdline_parser_init (&local_args_info); | 
| 695 | + |  | 
| 696 |  | optarg = 0; | 
| 697 | < | optind = 1; | 
| 697 | > | optind = 0; | 
| 698 |  | opterr = 1; | 
| 699 |  | optopt = '?'; | 
| 700 |  |  | 
| 709 |  | { "input",      1, NULL, 'i' }, | 
| 710 |  | { "output",     1, NULL, 'o' }, | 
| 711 |  | { "step",       1, NULL, 'n' }, | 
| 712 | < | { "nrbins",     1, NULL, 'r' }, | 
| 712 | > | { "nbins",      1, NULL, 'b' }, | 
| 713 | > | { "nbins_x",    1, NULL, 'x' }, | 
| 714 | > | { "nbins_y",    1, NULL, 'y' }, | 
| 715 |  | { "nanglebins", 1, NULL, 'a' }, | 
| 716 | < | { "length",     1, NULL, 'l' }, | 
| 716 | > | { "length",     1, NULL, 0 }, | 
| 717 | > | { "rcut",       1, NULL, 'c' }, | 
| 718 | > | { "zoffset",    1, NULL, 'z' }, | 
| 719 |  | { "sele1",      1, NULL, 0 }, | 
| 720 |  | { "sele2",      1, NULL, 0 }, | 
| 721 | + | { "sele3",      1, NULL, 0 }, | 
| 722 |  | { "refsele",    1, NULL, 0 }, | 
| 723 | < | { "gofr",       0, NULL, 0 }, | 
| 723 | > | { "molname",    1, NULL, 0 }, | 
| 724 | > | { "begin",      1, NULL, 0 }, | 
| 725 | > | { "end",        1, NULL, 0 }, | 
| 726 | > | { "radius",     1, NULL, 0 }, | 
| 727 | > | { "bo", 0, NULL, 0 }, | 
| 728 | > | { "bor",        0, NULL, 0 }, | 
| 729 | > | { "gofr",       0, NULL, 'g' }, | 
| 730 |  | { "r_theta",    0, NULL, 0 }, | 
| 731 |  | { "r_omega",    0, NULL, 0 }, | 
| 732 |  | { "theta_omega",        0, NULL, 0 }, | 
| 733 |  | { "gxyz",       0, NULL, 0 }, | 
| 734 | + | { "p2", 0, NULL, 'p' }, | 
| 735 | + | { "rp2",        0, NULL, 0 }, | 
| 736 | + | { "scd",        0, NULL, 's' }, | 
| 737 | + | { "density",    0, NULL, 'd' }, | 
| 738 | + | { "slab_density",       0, NULL, 0 }, | 
| 739 | + | { "hxy",        0, NULL, 0 }, | 
| 740 | + | { "rho_r",      0, NULL, 0 }, | 
| 741 |  | { NULL, 0, NULL, 0 } | 
| 742 |  | }; | 
| 743 |  |  | 
| 744 |  | stop_char = 0; | 
| 745 | < | c = getopt_long (argc, argv, "hVi:o:n:r:a:l:", long_options, &option_index); | 
| 745 | > | c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); | 
| 746 |  |  | 
| 747 |  | if (c == -1) break;       /* Exit from `while (1)' loop.  */ | 
| 748 |  |  | 
| 749 |  | switch (c) | 
| 750 |  | { | 
| 751 |  | case 'h':       /* Print help and exit.  */ | 
| 148 | – | clear_args (); | 
| 752 |  | cmdline_parser_print_help (); | 
| 753 | + | cmdline_parser_free (&local_args_info); | 
| 754 |  | exit (EXIT_SUCCESS); | 
| 755 |  |  | 
| 756 |  | case 'V':       /* Print version and exit.  */ | 
| 153 | – | clear_args (); | 
| 757 |  | cmdline_parser_print_version (); | 
| 758 | + | cmdline_parser_free (&local_args_info); | 
| 759 |  | exit (EXIT_SUCCESS); | 
| 760 |  |  | 
| 761 |  | case 'i':       /* input dump file.  */ | 
| 762 | < | if (args_info->input_given) | 
| 762 | > | if (local_args_info.input_given) | 
| 763 |  | { | 
| 764 | < | fprintf (stderr, "%s: `--input' (`-i') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 765 | < | clear_args (); | 
| 162 | < | exit (EXIT_FAILURE); | 
| 764 | > | fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 765 | > | goto failure; | 
| 766 |  | } | 
| 767 | + | if (args_info->input_given && ! override) | 
| 768 | + | continue; | 
| 769 | + | local_args_info.input_given = 1; | 
| 770 |  | args_info->input_given = 1; | 
| 771 | + | if (args_info->input_arg) | 
| 772 | + | free (args_info->input_arg); /* free previous string */ | 
| 773 |  | args_info->input_arg = gengetopt_strdup (optarg); | 
| 774 | + | if (args_info->input_orig) | 
| 775 | + | free (args_info->input_orig); /* free previous string */ | 
| 776 | + | args_info->input_orig = gengetopt_strdup (optarg); | 
| 777 |  | break; | 
| 778 |  |  | 
| 779 |  | case 'o':       /* output file name.  */ | 
| 780 | < | if (args_info->output_given) | 
| 780 | > | if (local_args_info.output_given) | 
| 781 |  | { | 
| 782 | < | fprintf (stderr, "%s: `--output' (`-o') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 783 | < | clear_args (); | 
| 173 | < | exit (EXIT_FAILURE); | 
| 782 | > | fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 783 | > | goto failure; | 
| 784 |  | } | 
| 785 | + | if (args_info->output_given && ! override) | 
| 786 | + | continue; | 
| 787 | + | local_args_info.output_given = 1; | 
| 788 |  | args_info->output_given = 1; | 
| 789 | + | if (args_info->output_arg) | 
| 790 | + | free (args_info->output_arg); /* free previous string */ | 
| 791 |  | args_info->output_arg = gengetopt_strdup (optarg); | 
| 792 | + | if (args_info->output_orig) | 
| 793 | + | free (args_info->output_orig); /* free previous string */ | 
| 794 | + | args_info->output_orig = gengetopt_strdup (optarg); | 
| 795 |  | break; | 
| 796 |  |  | 
| 797 |  | case 'n':       /* process every n frame.  */ | 
| 798 | < | if (args_info->step_given) | 
| 798 | > | if (local_args_info.step_given) | 
| 799 |  | { | 
| 800 | < | fprintf (stderr, "%s: `--step' (`-n') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 801 | < | clear_args (); | 
| 184 | < | exit (EXIT_FAILURE); | 
| 800 | > | fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 801 | > | goto failure; | 
| 802 |  | } | 
| 803 | + | if (args_info->step_given && ! override) | 
| 804 | + | continue; | 
| 805 | + | local_args_info.step_given = 1; | 
| 806 |  | args_info->step_given = 1; | 
| 807 | < | args_info->step_arg = strtol (optarg,&stop_char,0); | 
| 807 | > | args_info->step_arg = strtol (optarg, &stop_char, 0); | 
| 808 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 809 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 810 | > | goto failure; | 
| 811 | > | } | 
| 812 | > | if (args_info->step_orig) | 
| 813 | > | free (args_info->step_orig); /* free previous string */ | 
| 814 | > | args_info->step_orig = gengetopt_strdup (optarg); | 
| 815 |  | break; | 
| 816 |  |  | 
| 817 | < | case 'r':       /* number of bins for distance.  */ | 
| 818 | < | if (args_info->nrbins_given) | 
| 817 | > | case 'b':       /* number of bins (general purpose).  */ | 
| 818 | > | if (local_args_info.nbins_given) | 
| 819 |  | { | 
| 820 | < | fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 821 | < | clear_args (); | 
| 195 | < | exit (EXIT_FAILURE); | 
| 820 | > | fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 821 | > | goto failure; | 
| 822 |  | } | 
| 823 | < | args_info->nrbins_given = 1; | 
| 824 | < | args_info->nrbins_arg = strtol (optarg,&stop_char,0); | 
| 823 | > | if (args_info->nbins_given && ! override) | 
| 824 | > | continue; | 
| 825 | > | local_args_info.nbins_given = 1; | 
| 826 | > | args_info->nbins_given = 1; | 
| 827 | > | args_info->nbins_arg = strtol (optarg, &stop_char, 0); | 
| 828 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 829 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 830 | > | goto failure; | 
| 831 | > | } | 
| 832 | > | if (args_info->nbins_orig) | 
| 833 | > | free (args_info->nbins_orig); /* free previous string */ | 
| 834 | > | args_info->nbins_orig = gengetopt_strdup (optarg); | 
| 835 |  | break; | 
| 836 |  |  | 
| 837 | + | case 'x':       /* number of bins in x axis.  */ | 
| 838 | + | if (local_args_info.nbins_x_given) | 
| 839 | + | { | 
| 840 | + | fprintf (stderr, "%s: `--nbins_x' (`-x') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 841 | + | goto failure; | 
| 842 | + | } | 
| 843 | + | if (args_info->nbins_x_given && ! override) | 
| 844 | + | continue; | 
| 845 | + | local_args_info.nbins_x_given = 1; | 
| 846 | + | args_info->nbins_x_given = 1; | 
| 847 | + | args_info->nbins_x_arg = strtol (optarg, &stop_char, 0); | 
| 848 | + | if (!(stop_char && *stop_char == '\0')) { | 
| 849 | + | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 850 | + | goto failure; | 
| 851 | + | } | 
| 852 | + | if (args_info->nbins_x_orig) | 
| 853 | + | free (args_info->nbins_x_orig); /* free previous string */ | 
| 854 | + | args_info->nbins_x_orig = gengetopt_strdup (optarg); | 
| 855 | + | break; | 
| 856 | + |  | 
| 857 | + | case 'y':       /* number of bins in y axis.  */ | 
| 858 | + | if (local_args_info.nbins_y_given) | 
| 859 | + | { | 
| 860 | + | fprintf (stderr, "%s: `--nbins_y' (`-y') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 861 | + | goto failure; | 
| 862 | + | } | 
| 863 | + | if (args_info->nbins_y_given && ! override) | 
| 864 | + | continue; | 
| 865 | + | local_args_info.nbins_y_given = 1; | 
| 866 | + | args_info->nbins_y_given = 1; | 
| 867 | + | args_info->nbins_y_arg = strtol (optarg, &stop_char, 0); | 
| 868 | + | if (!(stop_char && *stop_char == '\0')) { | 
| 869 | + | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 870 | + | goto failure; | 
| 871 | + | } | 
| 872 | + | if (args_info->nbins_y_orig) | 
| 873 | + | free (args_info->nbins_y_orig); /* free previous string */ | 
| 874 | + | args_info->nbins_y_orig = gengetopt_strdup (optarg); | 
| 875 | + | break; | 
| 876 | + |  | 
| 877 |  | case 'a':       /* number of bins for cos(angle).  */ | 
| 878 | < | if (args_info->nanglebins_given) | 
| 878 | > | if (local_args_info.nanglebins_given) | 
| 879 |  | { | 
| 880 | < | fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 881 | < | clear_args (); | 
| 206 | < | exit (EXIT_FAILURE); | 
| 880 | > | fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 881 | > | goto failure; | 
| 882 |  | } | 
| 883 | + | if (args_info->nanglebins_given && ! override) | 
| 884 | + | continue; | 
| 885 | + | local_args_info.nanglebins_given = 1; | 
| 886 |  | args_info->nanglebins_given = 1; | 
| 887 | < | args_info->nanglebins_arg = strtol (optarg,&stop_char,0); | 
| 887 | > | args_info->nanglebins_arg = strtol (optarg, &stop_char, 0); | 
| 888 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 889 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 890 | > | goto failure; | 
| 891 | > | } | 
| 892 | > | if (args_info->nanglebins_orig) | 
| 893 | > | free (args_info->nanglebins_orig); /* free previous string */ | 
| 894 | > | args_info->nanglebins_orig = gengetopt_strdup (optarg); | 
| 895 |  | break; | 
| 896 |  |  | 
| 897 | < | case 'l':       /* maximum length (Defaults to 1/2 smallest length of first frame).  */ | 
| 898 | < | if (args_info->length_given) | 
| 897 | > | case 'c':       /* cutoff radius (rcut).  */ | 
| 898 | > | if (local_args_info.rcut_given) | 
| 899 |  | { | 
| 900 | < | fprintf (stderr, "%s: `--length' (`-l') option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 901 | < | clear_args (); | 
| 217 | < | exit (EXIT_FAILURE); | 
| 900 | > | fprintf (stderr, "%s: `--rcut' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 901 | > | goto failure; | 
| 902 |  | } | 
| 903 | < | args_info->length_given = 1; | 
| 904 | < | args_info->length_arg = strtod (optarg, NULL); | 
| 903 | > | if (args_info->rcut_given && ! override) | 
| 904 | > | continue; | 
| 905 | > | local_args_info.rcut_given = 1; | 
| 906 | > | args_info->rcut_given = 1; | 
| 907 | > | args_info->rcut_arg = strtod (optarg, &stop_char); | 
| 908 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 909 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 910 | > | goto failure; | 
| 911 | > | } | 
| 912 | > | if (args_info->rcut_orig) | 
| 913 | > | free (args_info->rcut_orig); /* free previous string */ | 
| 914 | > | args_info->rcut_orig = gengetopt_strdup (optarg); | 
| 915 |  | break; | 
| 916 |  |  | 
| 917 | + | case 'z':       /* Where to set the zero for the slab_density calculation.  */ | 
| 918 | + | if (local_args_info.zoffset_given) | 
| 919 | + | { | 
| 920 | + | fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 921 | + | goto failure; | 
| 922 | + | } | 
| 923 | + | if (args_info->zoffset_given && ! override) | 
| 924 | + | continue; | 
| 925 | + | local_args_info.zoffset_given = 1; | 
| 926 | + | args_info->zoffset_given = 1; | 
| 927 | + | args_info->zoffset_arg = strtod (optarg, &stop_char); | 
| 928 | + | if (!(stop_char && *stop_char == '\0')) { | 
| 929 | + | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 930 | + | goto failure; | 
| 931 | + | } | 
| 932 | + | if (args_info->zoffset_orig) | 
| 933 | + | free (args_info->zoffset_orig); /* free previous string */ | 
| 934 | + | args_info->zoffset_orig = gengetopt_strdup (optarg); | 
| 935 | + | break; | 
| 936 |  |  | 
| 937 | + | case 'g':       /* g(r).  */ | 
| 938 | + | if (local_args_info.gofr_given) | 
| 939 | + | { | 
| 940 | + | fprintf (stderr, "%s: `--gofr' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 941 | + | goto failure; | 
| 942 | + | } | 
| 943 | + | if (args_info->gofr_given && ! override) | 
| 944 | + | continue; | 
| 945 | + | local_args_info.gofr_given = 1; | 
| 946 | + | args_info->gofr_given = 1; | 
| 947 | + | if (args_info->staticProps_group_counter && override) | 
| 948 | + | reset_group_staticProps (args_info); | 
| 949 | + | args_info->staticProps_group_counter += 1; | 
| 950 | + | break; | 
| 951 | + |  | 
| 952 | + | case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */ | 
| 953 | + | if (local_args_info.p2_given) | 
| 954 | + | { | 
| 955 | + | fprintf (stderr, "%s: `--p2' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 956 | + | goto failure; | 
| 957 | + | } | 
| 958 | + | if (args_info->p2_given && ! override) | 
| 959 | + | continue; | 
| 960 | + | local_args_info.p2_given = 1; | 
| 961 | + | args_info->p2_given = 1; | 
| 962 | + | if (args_info->staticProps_group_counter && override) | 
| 963 | + | reset_group_staticProps (args_info); | 
| 964 | + | args_info->staticProps_group_counter += 1; | 
| 965 | + | break; | 
| 966 | + |  | 
| 967 | + | case 's':       /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified).  */ | 
| 968 | + | if (local_args_info.scd_given) | 
| 969 | + | { | 
| 970 | + | fprintf (stderr, "%s: `--scd' (`-s') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 971 | + | goto failure; | 
| 972 | + | } | 
| 973 | + | if (args_info->scd_given && ! override) | 
| 974 | + | continue; | 
| 975 | + | local_args_info.scd_given = 1; | 
| 976 | + | args_info->scd_given = 1; | 
| 977 | + | if (args_info->staticProps_group_counter && override) | 
| 978 | + | reset_group_staticProps (args_info); | 
| 979 | + | args_info->staticProps_group_counter += 1; | 
| 980 | + | break; | 
| 981 | + |  | 
| 982 | + | case 'd':       /* density plot.  */ | 
| 983 | + | if (local_args_info.density_given) | 
| 984 | + | { | 
| 985 | + | fprintf (stderr, "%s: `--density' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 986 | + | goto failure; | 
| 987 | + | } | 
| 988 | + | if (args_info->density_given && ! override) | 
| 989 | + | continue; | 
| 990 | + | local_args_info.density_given = 1; | 
| 991 | + | args_info->density_given = 1; | 
| 992 | + | if (args_info->staticProps_group_counter && override) | 
| 993 | + | reset_group_staticProps (args_info); | 
| 994 | + | args_info->staticProps_group_counter += 1; | 
| 995 | + | break; | 
| 996 | + |  | 
| 997 | + |  | 
| 998 |  | case 0: /* Long option with no short option */ | 
| 999 | < | /* select first stuntdouble set.  */ | 
| 1000 | < | if (strcmp (long_options[option_index].name, "sele1") == 0) | 
| 1001 | < | { | 
| 1002 | < | if (args_info->sele1_given) | 
| 1003 | < | { | 
| 1004 | < | fprintf (stderr, "%s: `--sele1' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1005 | < | clear_args (); | 
| 1006 | < | exit (EXIT_FAILURE); | 
| 1007 | < | } | 
| 1008 | < | args_info->sele1_given = 1; | 
| 1009 | < | args_info->sele1_arg = gengetopt_strdup (optarg); | 
| 1010 | < | break; | 
| 1011 | < | } | 
| 1012 | < |  | 
| 1013 | < | /* select second stuntdouble set.  */ | 
| 999 | > | /* maximum length (Defaults to 1/2 smallest length of first frame).  */ | 
| 1000 | > | if (strcmp (long_options[option_index].name, "length") == 0) | 
| 1001 | > | { | 
| 1002 | > | if (local_args_info.length_given) | 
| 1003 | > | { | 
| 1004 | > | fprintf (stderr, "%s: `--length' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1005 | > | goto failure; | 
| 1006 | > | } | 
| 1007 | > | if (args_info->length_given && ! override) | 
| 1008 | > | continue; | 
| 1009 | > | local_args_info.length_given = 1; | 
| 1010 | > | args_info->length_given = 1; | 
| 1011 | > | args_info->length_arg = strtod (optarg, &stop_char); | 
| 1012 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 1013 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 1014 | > | goto failure; | 
| 1015 | > | } | 
| 1016 | > | if (args_info->length_orig) | 
| 1017 | > | free (args_info->length_orig); /* free previous string */ | 
| 1018 | > | args_info->length_orig = gengetopt_strdup (optarg); | 
| 1019 | > | } | 
| 1020 | > | /* select the first stuntdouble set.  */ | 
| 1021 | > | else if (strcmp (long_options[option_index].name, "sele1") == 0) | 
| 1022 | > | { | 
| 1023 | > | if (local_args_info.sele1_given) | 
| 1024 | > | { | 
| 1025 | > | fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1026 | > | goto failure; | 
| 1027 | > | } | 
| 1028 | > | if (args_info->sele1_given && ! override) | 
| 1029 | > | continue; | 
| 1030 | > | local_args_info.sele1_given = 1; | 
| 1031 | > | args_info->sele1_given = 1; | 
| 1032 | > | if (args_info->sele1_arg) | 
| 1033 | > | free (args_info->sele1_arg); /* free previous string */ | 
| 1034 | > | args_info->sele1_arg = gengetopt_strdup (optarg); | 
| 1035 | > | if (args_info->sele1_orig) | 
| 1036 | > | free (args_info->sele1_orig); /* free previous string */ | 
| 1037 | > | args_info->sele1_orig = gengetopt_strdup (optarg); | 
| 1038 | > | } | 
| 1039 | > | /* select the second stuntdouble set.  */ | 
| 1040 |  | else if (strcmp (long_options[option_index].name, "sele2") == 0) | 
| 1041 | < | { | 
| 1042 | < | if (args_info->sele2_given) | 
| 1043 | < | { | 
| 1044 | < | fprintf (stderr, "%s: `--sele2' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1045 | < | clear_args (); | 
| 1046 | < | exit (EXIT_FAILURE); | 
| 1047 | < | } | 
| 1048 | < | args_info->sele2_given = 1; | 
| 1049 | < | args_info->sele2_arg = gengetopt_strdup (optarg); | 
| 1050 | < | break; | 
| 1051 | < | } | 
| 1052 | < |  | 
| 1041 | > | { | 
| 1042 | > | if (local_args_info.sele2_given) | 
| 1043 | > | { | 
| 1044 | > | fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1045 | > | goto failure; | 
| 1046 | > | } | 
| 1047 | > | if (args_info->sele2_given && ! override) | 
| 1048 | > | continue; | 
| 1049 | > | local_args_info.sele2_given = 1; | 
| 1050 | > | args_info->sele2_given = 1; | 
| 1051 | > | if (args_info->sele2_arg) | 
| 1052 | > | free (args_info->sele2_arg); /* free previous string */ | 
| 1053 | > | args_info->sele2_arg = gengetopt_strdup (optarg); | 
| 1054 | > | if (args_info->sele2_orig) | 
| 1055 | > | free (args_info->sele2_orig); /* free previous string */ | 
| 1056 | > | args_info->sele2_orig = gengetopt_strdup (optarg); | 
| 1057 | > | } | 
| 1058 | > | /* select the third stuntdouble set.  */ | 
| 1059 | > | else if (strcmp (long_options[option_index].name, "sele3") == 0) | 
| 1060 | > | { | 
| 1061 | > | if (local_args_info.sele3_given) | 
| 1062 | > | { | 
| 1063 | > | fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1064 | > | goto failure; | 
| 1065 | > | } | 
| 1066 | > | if (args_info->sele3_given && ! override) | 
| 1067 | > | continue; | 
| 1068 | > | local_args_info.sele3_given = 1; | 
| 1069 | > | args_info->sele3_given = 1; | 
| 1070 | > | if (args_info->sele3_arg) | 
| 1071 | > | free (args_info->sele3_arg); /* free previous string */ | 
| 1072 | > | args_info->sele3_arg = gengetopt_strdup (optarg); | 
| 1073 | > | if (args_info->sele3_orig) | 
| 1074 | > | free (args_info->sele3_orig); /* free previous string */ | 
| 1075 | > | args_info->sele3_orig = gengetopt_strdup (optarg); | 
| 1076 | > | } | 
| 1077 |  | /* select reference (use and only use with --gxyz).  */ | 
| 1078 |  | else if (strcmp (long_options[option_index].name, "refsele") == 0) | 
| 1079 | < | { | 
| 1080 | < | if (args_info->refsele_given) | 
| 1081 | < | { | 
| 1082 | < | fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1083 | < | clear_args (); | 
| 1084 | < | exit (EXIT_FAILURE); | 
| 1085 | < | } | 
| 1086 | < | args_info->refsele_given = 1; | 
| 1087 | < | args_info->refsele_arg = gengetopt_strdup (optarg); | 
| 1088 | < | break; | 
| 1089 | < | } | 
| 1090 | < |  | 
| 1091 | < | /* g(r).  */ | 
| 1092 | < | else if (strcmp (long_options[option_index].name, "gofr") == 0) | 
| 1093 | < | { | 
| 1094 | < | if (args_info->gofr_given) | 
| 1095 | < | { | 
| 1096 | < | fprintf (stderr, "%s: `--gofr' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1097 | < | clear_args (); | 
| 1098 | < | exit (EXIT_FAILURE); | 
| 1099 | < | } | 
| 1100 | < | args_info->gofr_given = 1; staticProps_group_counter += 1; | 
| 1101 | < |  | 
| 1102 | < | break; | 
| 1103 | < | } | 
| 1104 | < |  | 
| 1105 | < | /* g(r, cos(theta)).  */ | 
| 1106 | < | else if (strcmp (long_options[option_index].name, "r_theta") == 0) | 
| 1107 | < | { | 
| 1108 | < | if (args_info->r_theta_given) | 
| 1109 | < | { | 
| 1110 | < | fprintf (stderr, "%s: `--r_theta' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1111 | < | clear_args (); | 
| 1112 | < | exit (EXIT_FAILURE); | 
| 1113 | < | } | 
| 1114 | < | args_info->r_theta_given = 1; staticProps_group_counter += 1; | 
| 1115 | < |  | 
| 1116 | < | break; | 
| 1117 | < | } | 
| 1118 | < |  | 
| 1119 | < | /* g(r, cos(omega)).  */ | 
| 1120 | < | else if (strcmp (long_options[option_index].name, "r_omega") == 0) | 
| 1121 | < | { | 
| 1122 | < | if (args_info->r_omega_given) | 
| 1123 | < | { | 
| 1124 | < | fprintf (stderr, "%s: `--r_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1125 | < | clear_args (); | 
| 1126 | < | exit (EXIT_FAILURE); | 
| 1127 | < | } | 
| 1128 | < | args_info->r_omega_given = 1; staticProps_group_counter += 1; | 
| 1129 | < |  | 
| 1130 | < | break; | 
| 1131 | < | } | 
| 1132 | < |  | 
| 1079 | > | { | 
| 1080 | > | if (local_args_info.refsele_given) | 
| 1081 | > | { | 
| 1082 | > | fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1083 | > | goto failure; | 
| 1084 | > | } | 
| 1085 | > | if (args_info->refsele_given && ! override) | 
| 1086 | > | continue; | 
| 1087 | > | local_args_info.refsele_given = 1; | 
| 1088 | > | args_info->refsele_given = 1; | 
| 1089 | > | if (args_info->refsele_arg) | 
| 1090 | > | free (args_info->refsele_arg); /* free previous string */ | 
| 1091 | > | args_info->refsele_arg = gengetopt_strdup (optarg); | 
| 1092 | > | if (args_info->refsele_orig) | 
| 1093 | > | free (args_info->refsele_orig); /* free previous string */ | 
| 1094 | > | args_info->refsele_orig = gengetopt_strdup (optarg); | 
| 1095 | > | } | 
| 1096 | > | /* molecule name.  */ | 
| 1097 | > | else if (strcmp (long_options[option_index].name, "molname") == 0) | 
| 1098 | > | { | 
| 1099 | > | if (local_args_info.molname_given) | 
| 1100 | > | { | 
| 1101 | > | fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1102 | > | goto failure; | 
| 1103 | > | } | 
| 1104 | > | if (args_info->molname_given && ! override) | 
| 1105 | > | continue; | 
| 1106 | > | local_args_info.molname_given = 1; | 
| 1107 | > | args_info->molname_given = 1; | 
| 1108 | > | if (args_info->molname_arg) | 
| 1109 | > | free (args_info->molname_arg); /* free previous string */ | 
| 1110 | > | args_info->molname_arg = gengetopt_strdup (optarg); | 
| 1111 | > | if (args_info->molname_orig) | 
| 1112 | > | free (args_info->molname_orig); /* free previous string */ | 
| 1113 | > | args_info->molname_orig = gengetopt_strdup (optarg); | 
| 1114 | > | } | 
| 1115 | > | /* begin internal index.  */ | 
| 1116 | > | else if (strcmp (long_options[option_index].name, "begin") == 0) | 
| 1117 | > | { | 
| 1118 | > | if (local_args_info.begin_given) | 
| 1119 | > | { | 
| 1120 | > | fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1121 | > | goto failure; | 
| 1122 | > | } | 
| 1123 | > | if (args_info->begin_given && ! override) | 
| 1124 | > | continue; | 
| 1125 | > | local_args_info.begin_given = 1; | 
| 1126 | > | args_info->begin_given = 1; | 
| 1127 | > | args_info->begin_arg = strtol (optarg, &stop_char, 0); | 
| 1128 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 1129 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 1130 | > | goto failure; | 
| 1131 | > | } | 
| 1132 | > | if (args_info->begin_orig) | 
| 1133 | > | free (args_info->begin_orig); /* free previous string */ | 
| 1134 | > | args_info->begin_orig = gengetopt_strdup (optarg); | 
| 1135 | > | } | 
| 1136 | > | /* end internal index.  */ | 
| 1137 | > | else if (strcmp (long_options[option_index].name, "end") == 0) | 
| 1138 | > | { | 
| 1139 | > | if (local_args_info.end_given) | 
| 1140 | > | { | 
| 1141 | > | fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1142 | > | goto failure; | 
| 1143 | > | } | 
| 1144 | > | if (args_info->end_given && ! override) | 
| 1145 | > | continue; | 
| 1146 | > | local_args_info.end_given = 1; | 
| 1147 | > | args_info->end_given = 1; | 
| 1148 | > | args_info->end_arg = strtol (optarg, &stop_char, 0); | 
| 1149 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 1150 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 1151 | > | goto failure; | 
| 1152 | > | } | 
| 1153 | > | if (args_info->end_orig) | 
| 1154 | > | free (args_info->end_orig); /* free previous string */ | 
| 1155 | > | args_info->end_orig = gengetopt_strdup (optarg); | 
| 1156 | > | } | 
| 1157 | > | /* nanoparticle radius.  */ | 
| 1158 | > | else if (strcmp (long_options[option_index].name, "radius") == 0) | 
| 1159 | > | { | 
| 1160 | > | if (local_args_info.radius_given) | 
| 1161 | > | { | 
| 1162 | > | fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1163 | > | goto failure; | 
| 1164 | > | } | 
| 1165 | > | if (args_info->radius_given && ! override) | 
| 1166 | > | continue; | 
| 1167 | > | local_args_info.radius_given = 1; | 
| 1168 | > | args_info->radius_given = 1; | 
| 1169 | > | args_info->radius_arg = strtod (optarg, &stop_char); | 
| 1170 | > | if (!(stop_char && *stop_char == '\0')) { | 
| 1171 | > | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 1172 | > | goto failure; | 
| 1173 | > | } | 
| 1174 | > | if (args_info->radius_orig) | 
| 1175 | > | free (args_info->radius_orig); /* free previous string */ | 
| 1176 | > | args_info->radius_orig = gengetopt_strdup (optarg); | 
| 1177 | > | } | 
| 1178 | > | /* bond order parameter (--rcut must be specified).  */ | 
| 1179 | > | else if (strcmp (long_options[option_index].name, "bo") == 0) | 
| 1180 | > | { | 
| 1181 | > | if (local_args_info.bo_given) | 
| 1182 | > | { | 
| 1183 | > | fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1184 | > | goto failure; | 
| 1185 | > | } | 
| 1186 | > | if (args_info->bo_given && ! override) | 
| 1187 | > | continue; | 
| 1188 | > | local_args_info.bo_given = 1; | 
| 1189 | > | args_info->bo_given = 1; | 
| 1190 | > | if (args_info->staticProps_group_counter && override) | 
| 1191 | > | reset_group_staticProps (args_info); | 
| 1192 | > | args_info->staticProps_group_counter += 1; | 
| 1193 | > | break; | 
| 1194 | > | } | 
| 1195 | > | /* bond order parameter as a function of radius (--rcut must be specified).  */ | 
| 1196 | > | else if (strcmp (long_options[option_index].name, "bor") == 0) | 
| 1197 | > | { | 
| 1198 | > | if (local_args_info.bor_given) | 
| 1199 | > | { | 
| 1200 | > | fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1201 | > | goto failure; | 
| 1202 | > | } | 
| 1203 | > | if (args_info->bor_given && ! override) | 
| 1204 | > | continue; | 
| 1205 | > | local_args_info.bor_given = 1; | 
| 1206 | > | args_info->bor_given = 1; | 
| 1207 | > | if (args_info->staticProps_group_counter && override) | 
| 1208 | > | reset_group_staticProps (args_info); | 
| 1209 | > | args_info->staticProps_group_counter += 1; | 
| 1210 | > | break; | 
| 1211 | > | } | 
| 1212 | > | /* g(r, cos(theta)).  */ | 
| 1213 | > | else if (strcmp (long_options[option_index].name, "r_theta") == 0) | 
| 1214 | > | { | 
| 1215 | > | if (local_args_info.r_theta_given) | 
| 1216 | > | { | 
| 1217 | > | fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1218 | > | goto failure; | 
| 1219 | > | } | 
| 1220 | > | if (args_info->r_theta_given && ! override) | 
| 1221 | > | continue; | 
| 1222 | > | local_args_info.r_theta_given = 1; | 
| 1223 | > | args_info->r_theta_given = 1; | 
| 1224 | > | if (args_info->staticProps_group_counter && override) | 
| 1225 | > | reset_group_staticProps (args_info); | 
| 1226 | > | args_info->staticProps_group_counter += 1; | 
| 1227 | > | break; | 
| 1228 | > | } | 
| 1229 | > | /* g(r, cos(omega)).  */ | 
| 1230 | > | else if (strcmp (long_options[option_index].name, "r_omega") == 0) | 
| 1231 | > | { | 
| 1232 | > | if (local_args_info.r_omega_given) | 
| 1233 | > | { | 
| 1234 | > | fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1235 | > | goto failure; | 
| 1236 | > | } | 
| 1237 | > | if (args_info->r_omega_given && ! override) | 
| 1238 | > | continue; | 
| 1239 | > | local_args_info.r_omega_given = 1; | 
| 1240 | > | args_info->r_omega_given = 1; | 
| 1241 | > | if (args_info->staticProps_group_counter && override) | 
| 1242 | > | reset_group_staticProps (args_info); | 
| 1243 | > | args_info->staticProps_group_counter += 1; | 
| 1244 | > | break; | 
| 1245 | > | } | 
| 1246 |  | /* g(cos(theta), cos(omega)).  */ | 
| 1247 |  | else if (strcmp (long_options[option_index].name, "theta_omega") == 0) | 
| 1248 | < | { | 
| 1249 | < | if (args_info->theta_omega_given) | 
| 1250 | < | { | 
| 1251 | < | fprintf (stderr, "%s: `--theta_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1252 | < | clear_args (); | 
| 1253 | < | exit (EXIT_FAILURE); | 
| 1254 | < | } | 
| 1255 | < | args_info->theta_omega_given = 1; staticProps_group_counter += 1; | 
| 1256 | < |  | 
| 1257 | < | break; | 
| 1258 | < | } | 
| 1259 | < |  | 
| 1248 | > | { | 
| 1249 | > | if (local_args_info.theta_omega_given) | 
| 1250 | > | { | 
| 1251 | > | fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1252 | > | goto failure; | 
| 1253 | > | } | 
| 1254 | > | if (args_info->theta_omega_given && ! override) | 
| 1255 | > | continue; | 
| 1256 | > | local_args_info.theta_omega_given = 1; | 
| 1257 | > | args_info->theta_omega_given = 1; | 
| 1258 | > | if (args_info->staticProps_group_counter && override) | 
| 1259 | > | reset_group_staticProps (args_info); | 
| 1260 | > | args_info->staticProps_group_counter += 1; | 
| 1261 | > | break; | 
| 1262 | > | } | 
| 1263 |  | /* g(x, y, z).  */ | 
| 1264 |  | else if (strcmp (long_options[option_index].name, "gxyz") == 0) | 
| 1265 | < | { | 
| 1266 | < | if (args_info->gxyz_given) | 
| 1267 | < | { | 
| 1268 | < | fprintf (stderr, "%s: `--gxyz' option given more than once\n", CMDLINE_PARSER_PACKAGE); | 
| 1269 | < | clear_args (); | 
| 1270 | < | exit (EXIT_FAILURE); | 
| 1271 | < | } | 
| 1272 | < | args_info->gxyz_given = 1; staticProps_group_counter += 1; | 
| 1265 | > | { | 
| 1266 | > | if (local_args_info.gxyz_given) | 
| 1267 | > | { | 
| 1268 | > | fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1269 | > | goto failure; | 
| 1270 | > | } | 
| 1271 | > | if (args_info->gxyz_given && ! override) | 
| 1272 | > | continue; | 
| 1273 | > | local_args_info.gxyz_given = 1; | 
| 1274 | > | args_info->gxyz_given = 1; | 
| 1275 | > | if (args_info->staticProps_group_counter && override) | 
| 1276 | > | reset_group_staticProps (args_info); | 
| 1277 | > | args_info->staticProps_group_counter += 1; | 
| 1278 | > | break; | 
| 1279 | > | } | 
| 1280 | > | /* rp2 order parameter (--sele1 and --sele2 must be specified).  */ | 
| 1281 | > | else if (strcmp (long_options[option_index].name, "rp2") == 0) | 
| 1282 | > | { | 
| 1283 | > | if (local_args_info.rp2_given) | 
| 1284 | > | { | 
| 1285 | > | fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1286 | > | goto failure; | 
| 1287 | > | } | 
| 1288 | > | if (args_info->rp2_given && ! override) | 
| 1289 | > | continue; | 
| 1290 | > | local_args_info.rp2_given = 1; | 
| 1291 | > | args_info->rp2_given = 1; | 
| 1292 | > | if (args_info->staticProps_group_counter && override) | 
| 1293 | > | reset_group_staticProps (args_info); | 
| 1294 | > | args_info->staticProps_group_counter += 1; | 
| 1295 | > | break; | 
| 1296 | > | } | 
| 1297 | > | /* slab density.  */ | 
| 1298 | > | else if (strcmp (long_options[option_index].name, "slab_density") == 0) | 
| 1299 | > | { | 
| 1300 | > | if (local_args_info.slab_density_given) | 
| 1301 | > | { | 
| 1302 | > | fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1303 | > | goto failure; | 
| 1304 | > | } | 
| 1305 | > | if (args_info->slab_density_given && ! override) | 
| 1306 | > | continue; | 
| 1307 | > | local_args_info.slab_density_given = 1; | 
| 1308 | > | args_info->slab_density_given = 1; | 
| 1309 | > | if (args_info->staticProps_group_counter && override) | 
| 1310 | > | reset_group_staticProps (args_info); | 
| 1311 | > | args_info->staticProps_group_counter += 1; | 
| 1312 | > | break; | 
| 1313 | > | } | 
| 1314 | > | /* hxy.  */ | 
| 1315 | > | else if (strcmp (long_options[option_index].name, "hxy") == 0) | 
| 1316 | > | { | 
| 1317 | > | if (local_args_info.hxy_given) | 
| 1318 | > | { | 
| 1319 | > | fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1320 | > | goto failure; | 
| 1321 | > | } | 
| 1322 | > | if (args_info->hxy_given && ! override) | 
| 1323 | > | continue; | 
| 1324 | > | local_args_info.hxy_given = 1; | 
| 1325 | > | args_info->hxy_given = 1; | 
| 1326 | > | if (args_info->staticProps_group_counter && override) | 
| 1327 | > | reset_group_staticProps (args_info); | 
| 1328 | > | args_info->staticProps_group_counter += 1; | 
| 1329 | > | break; | 
| 1330 | > | } | 
| 1331 | > | /* rho of R.  */ | 
| 1332 | > | else if (strcmp (long_options[option_index].name, "rho_r") == 0) | 
| 1333 | > | { | 
| 1334 | > | if (local_args_info.rho_r_given) | 
| 1335 | > | { | 
| 1336 | > | fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1337 | > | goto failure; | 
| 1338 | > | } | 
| 1339 | > | if (args_info->rho_r_given && ! override) | 
| 1340 | > | continue; | 
| 1341 | > | local_args_info.rho_r_given = 1; | 
| 1342 | > | args_info->rho_r_given = 1; | 
| 1343 | > | if (args_info->staticProps_group_counter && override) | 
| 1344 | > | reset_group_staticProps (args_info); | 
| 1345 | > | args_info->staticProps_group_counter += 1; | 
| 1346 | > | break; | 
| 1347 | > | } | 
| 1348 |  |  | 
| 1349 | < | break; | 
| 335 | < | } | 
| 336 | < |  | 
| 337 | < |  | 
| 1349 | > | break; | 
| 1350 |  | case '?':       /* Invalid option.  */ | 
| 1351 |  | /* `getopt_long' already printed an error message.  */ | 
| 1352 | < | exit (EXIT_FAILURE); | 
| 1352 | > | goto failure; | 
| 1353 |  |  | 
| 1354 |  | default:        /* bug: option not considered.  */ | 
| 1355 | < | fprintf (stderr, "%s: option unknown: %c\n", CMDLINE_PARSER_PACKAGE, c); | 
| 1355 | > | fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); | 
| 1356 |  | abort (); | 
| 1357 |  | } /* switch */ | 
| 1358 |  | } /* while */ | 
| 1359 |  |  | 
| 1360 | < | if ( staticProps_group_counter != 1) | 
| 1360 | > | if (args_info->staticProps_group_counter > 1) | 
| 1361 |  | { | 
| 1362 | < | fprintf (stderr, "%s: %d options of group staticProps were given. One is required\n", CMDLINE_PARSER_PACKAGE, staticProps_group_counter); | 
| 1363 | < | missing_required_options = 1; | 
| 1362 | > | 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 : "")); | 
| 1363 | > | error = 1; | 
| 1364 |  | } | 
| 1365 |  |  | 
| 1366 |  |  | 
| 1367 | < | if (! args_info->input_given) | 
| 1367 | > |  | 
| 1368 | > | if (check_required) | 
| 1369 |  | { | 
| 1370 | < | fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE); | 
| 358 | < | missing_required_options = 1; | 
| 1370 | > | error += cmdline_parser_required2 (args_info, argv[0], additional_error); | 
| 1371 |  | } | 
| 360 | – | if ( missing_required_options ) | 
| 361 | – | exit (EXIT_FAILURE); | 
| 1372 |  |  | 
| 1373 | + | cmdline_parser_release (&local_args_info); | 
| 1374 | + |  | 
| 1375 | + | if ( error ) | 
| 1376 | + | return (EXIT_FAILURE); | 
| 1377 | + |  | 
| 1378 | + | if (optind < argc) | 
| 1379 | + | { | 
| 1380 | + | int i = 0 ; | 
| 1381 | + | int found_prog_name = 0; | 
| 1382 | + | /* whether program name, i.e., argv[0], is in the remaining args | 
| 1383 | + | (this may happen with some implementations of getopt, | 
| 1384 | + | but surely not with the one included by gengetopt) */ | 
| 1385 | + |  | 
| 1386 | + | i = optind; | 
| 1387 | + | while (i < argc) | 
| 1388 | + | if (argv[i++] == argv[0]) { | 
| 1389 | + | found_prog_name = 1; | 
| 1390 | + | break; | 
| 1391 | + | } | 
| 1392 | + | i = 0; | 
| 1393 | + |  | 
| 1394 | + | args_info->inputs_num = argc - optind - found_prog_name; | 
| 1395 | + | args_info->inputs = | 
| 1396 | + | (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; | 
| 1397 | + | while (optind < argc) | 
| 1398 | + | if (argv[optind++] != argv[0]) | 
| 1399 | + | args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; | 
| 1400 | + | } | 
| 1401 | + |  | 
| 1402 |  | return 0; | 
| 1403 | + |  | 
| 1404 | + | failure: | 
| 1405 | + |  | 
| 1406 | + | cmdline_parser_release (&local_args_info); | 
| 1407 | + | return (EXIT_FAILURE); | 
| 1408 |  | } |