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