| 1 |  | /* | 
| 2 | < | File autogenerated by gengetopt version 2.15 | 
| 2 | > | File autogenerated by gengetopt version 2.19.1 | 
| 3 |  | generated with the following command: | 
| 4 | < | gengetopt -i StaticProps.ggo -F StaticPropsCmd | 
| 4 | > | gengetopt --file-name=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: | 
| 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 | + | "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)", | 
| 55 | + | "  -g, --gofr                    g(r)", | 
| 56 | + | "      --r_theta                 g(r, cos(theta))", | 
| 57 | + | "      --r_omega                 g(r, cos(omega))", | 
| 58 | + | "      --theta_omega             g(cos(theta), cos(omega))", | 
| 59 | + | "      --gxyz                    g(x, y, z)", | 
| 60 | + | "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)", | 
| 61 | + | "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)", | 
| 62 | + | "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)", | 
| 63 | + | "  -d, --density                 density plot", | 
| 64 | + | "      --slab_density            slab density", | 
| 65 | + | "      --hxy                     hxy", | 
| 66 | + | "      --rho_r                   rho of R", | 
| 67 | + | "      --hullvol                 hull volume of nanoparticle", | 
| 68 | + | 0 | 
| 69 | + | }; | 
| 70 | + |  | 
| 71 |  | static | 
| 72 |  | void clear_given (struct gengetopt_args_info *args_info); | 
| 73 |  | static | 
| 106 |  | args_info->end_given = 0 ; | 
| 107 |  | args_info->radius_given = 0 ; | 
| 108 |  | args_info->bo_given = 0 ; | 
| 109 | + | args_info->bor_given = 0 ; | 
| 110 | + | args_info->bad_given = 0 ; | 
| 111 |  | args_info->gofr_given = 0 ; | 
| 112 |  | args_info->r_theta_given = 0 ; | 
| 113 |  | args_info->r_omega_given = 0 ; | 
| 120 |  | args_info->slab_density_given = 0 ; | 
| 121 |  | args_info->hxy_given = 0 ; | 
| 122 |  | args_info->rho_r_given = 0 ; | 
| 123 | + | args_info->hullvol_given = 0 ; | 
| 124 |  | args_info->staticProps_group_counter = 0 ; | 
| 125 |  | } | 
| 126 |  |  | 
| 161 |  |  | 
| 162 |  | } | 
| 163 |  |  | 
| 164 | + | static | 
| 165 | + | void init_args_info(struct gengetopt_args_info *args_info) | 
| 166 | + | { | 
| 167 | + | args_info->help_help = gengetopt_args_info_help[0] ; | 
| 168 | + | args_info->version_help = gengetopt_args_info_help[1] ; | 
| 169 | + | args_info->input_help = gengetopt_args_info_help[2] ; | 
| 170 | + | args_info->output_help = gengetopt_args_info_help[3] ; | 
| 171 | + | args_info->step_help = gengetopt_args_info_help[4] ; | 
| 172 | + | args_info->nbins_help = gengetopt_args_info_help[5] ; | 
| 173 | + | args_info->nbins_x_help = gengetopt_args_info_help[6] ; | 
| 174 | + | args_info->nbins_y_help = gengetopt_args_info_help[7] ; | 
| 175 | + | args_info->nanglebins_help = gengetopt_args_info_help[8] ; | 
| 176 | + | args_info->length_help = gengetopt_args_info_help[9] ; | 
| 177 | + | args_info->rcut_help = gengetopt_args_info_help[10] ; | 
| 178 | + | args_info->zoffset_help = gengetopt_args_info_help[11] ; | 
| 179 | + | args_info->sele1_help = gengetopt_args_info_help[12] ; | 
| 180 | + | args_info->sele2_help = gengetopt_args_info_help[13] ; | 
| 181 | + | args_info->sele3_help = gengetopt_args_info_help[14] ; | 
| 182 | + | args_info->refsele_help = gengetopt_args_info_help[15] ; | 
| 183 | + | args_info->molname_help = gengetopt_args_info_help[16] ; | 
| 184 | + | args_info->begin_help = gengetopt_args_info_help[17] ; | 
| 185 | + | args_info->end_help = gengetopt_args_info_help[18] ; | 
| 186 | + | args_info->radius_help = gengetopt_args_info_help[19] ; | 
| 187 | + | args_info->bo_help = gengetopt_args_info_help[20] ; | 
| 188 | + | args_info->bor_help = gengetopt_args_info_help[21] ; | 
| 189 | + | args_info->bad_help = gengetopt_args_info_help[22] ; | 
| 190 | + | args_info->gofr_help = gengetopt_args_info_help[23] ; | 
| 191 | + | args_info->r_theta_help = gengetopt_args_info_help[24] ; | 
| 192 | + | args_info->r_omega_help = gengetopt_args_info_help[25] ; | 
| 193 | + | args_info->theta_omega_help = gengetopt_args_info_help[26] ; | 
| 194 | + | args_info->gxyz_help = gengetopt_args_info_help[27] ; | 
| 195 | + | args_info->p2_help = gengetopt_args_info_help[28] ; | 
| 196 | + | args_info->rp2_help = gengetopt_args_info_help[29] ; | 
| 197 | + | args_info->scd_help = gengetopt_args_info_help[30] ; | 
| 198 | + | args_info->density_help = gengetopt_args_info_help[31] ; | 
| 199 | + | args_info->slab_density_help = gengetopt_args_info_help[32] ; | 
| 200 | + | args_info->hxy_help = gengetopt_args_info_help[33] ; | 
| 201 | + | args_info->rho_r_help = gengetopt_args_info_help[34] ; | 
| 202 | + | args_info->hullvol_help = gengetopt_args_info_help[35] ; | 
| 203 | + |  | 
| 204 | + | } | 
| 205 | + |  | 
| 206 |  | void | 
| 207 |  | cmdline_parser_print_version (void) | 
| 208 |  | { | 
| 212 |  | void | 
| 213 |  | cmdline_parser_print_help (void) | 
| 214 |  | { | 
| 215 | + | int i = 0; | 
| 216 |  | cmdline_parser_print_version (); | 
| 217 | < | printf("\nUsage: StaticProps [OPTIONS]...\n\n"); | 
| 218 | < | printf("%s\n","  -h, --help                    Print help and exit"); | 
| 219 | < | printf("%s\n","  -V, --version                 Print version and exit"); | 
| 220 | < | printf("%s\n","  -i, --input=filename          input dump file"); | 
| 221 | < | printf("%s\n","  -o, --output=filename         output file name"); | 
| 222 | < | printf("%s\n","  -n, --step=INT                process every n frame  (default=`1')"); | 
| 223 | < | printf("%s\n","  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')"); | 
| 224 | < | printf("%s\n","  -x, --nbins_x=INT             number of bins in x axis  (default=`100')"); | 
| 225 | < | printf("%s\n","  -y, --nbins_y=INT             number of bins in y axis  (default=`100')"); | 
| 226 | < | printf("%s\n","  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')"); | 
| 227 | < | printf("%s\n","      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)"); | 
| 135 | < | printf("%s\n","  -c, --rcut=DOUBLE             cutoff radius (rcut)"); | 
| 136 | < | printf("%s\n","  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')"); | 
| 137 | < | printf("%s\n","      --sele1=selection script  select the first stuntdouble set"); | 
| 138 | < | printf("%s\n","      --sele2=selection script  select the second stuntdouble set"); | 
| 139 | < | printf("%s\n","      --sele3=selection script  select the third stuntdouble set"); | 
| 140 | < | printf("%s\n","      --refsele=selection script\n                                select reference (use and only use with --gxyz)"); | 
| 141 | < | printf("%s\n","      --molname=STRING          molecule name"); | 
| 142 | < | printf("%s\n","      --begin=INT               begin internal index"); | 
| 143 | < | printf("%s\n","      --end=INT                 end internal index"); | 
| 144 | < | printf("%s\n","      --radius=DOUBLE           nanoparticle radius"); | 
| 145 | < | printf("%s\n","\n Group: staticProps\n   an option of this group is required"); | 
| 146 | < | printf("%s\n","      --bo                      bond order parameter (--rcut must be specified"); | 
| 147 | < | printf("%s\n","  -g, --gofr                    g(r)"); | 
| 148 | < | printf("%s\n","      --r_theta                 g(r, cos(theta))"); | 
| 149 | < | printf("%s\n","      --r_omega                 g(r, cos(omega))"); | 
| 150 | < | printf("%s\n","      --theta_omega             g(cos(theta), cos(omega))"); | 
| 151 | < | printf("%s\n","      --gxyz                    g(x, y, z)"); | 
| 152 | < | printf("%s\n","  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)"); | 
| 153 | < | printf("%s\n","      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)"); | 
| 154 | < | printf("%s\n","  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)"); | 
| 155 | < | printf("%s\n","  -d, --density                 density plot"); | 
| 156 | < | printf("%s\n","      --slab_density            slab density"); | 
| 157 | < | printf("%s\n","      --hxy                     hxy"); | 
| 158 | < | printf("%s\n","      --rho_r                   rho of R"); | 
| 159 | < |  | 
| 217 | > |  | 
| 218 | > | if (strlen(gengetopt_args_info_purpose) > 0) | 
| 219 | > | printf("\n%s\n", gengetopt_args_info_purpose); | 
| 220 | > |  | 
| 221 | > | printf("\n%s\n\n", gengetopt_args_info_usage); | 
| 222 | > |  | 
| 223 | > | if (strlen(gengetopt_args_info_description) > 0) | 
| 224 | > | printf("%s\n", gengetopt_args_info_description); | 
| 225 | > |  | 
| 226 | > | while (gengetopt_args_info_help[i]) | 
| 227 | > | printf("%s\n", gengetopt_args_info_help[i++]); | 
| 228 |  | } | 
| 229 |  |  | 
| 230 |  | void | 
| 232 |  | { | 
| 233 |  | clear_given (args_info); | 
| 234 |  | clear_args (args_info); | 
| 235 | + | init_args_info (args_info); | 
| 236 | + |  | 
| 237 | + | args_info->inputs = NULL; | 
| 238 | + | args_info->inputs_num = 0; | 
| 239 |  | } | 
| 240 |  |  | 
| 241 |  | static void | 
| 242 |  | cmdline_parser_release (struct gengetopt_args_info *args_info) | 
| 243 |  | { | 
| 244 |  |  | 
| 245 | + | unsigned int i; | 
| 246 |  | if (args_info->input_arg) | 
| 247 |  | { | 
| 248 |  | free (args_info->input_arg); /* free previous argument */ | 
| 369 |  | args_info->radius_orig = 0; | 
| 370 |  | } | 
| 371 |  |  | 
| 372 | + | for (i = 0; i < args_info->inputs_num; ++i) | 
| 373 | + | free (args_info->inputs [i]); | 
| 374 | + |  | 
| 375 | + | if (args_info->inputs_num) | 
| 376 | + | free (args_info->inputs); | 
| 377 | + |  | 
| 378 |  | clear_given (args_info); | 
| 379 |  | } | 
| 380 |  |  | 
| 527 |  | if (args_info->bo_given) { | 
| 528 |  | fprintf(outfile, "%s\n", "bo"); | 
| 529 |  | } | 
| 530 | + | if (args_info->bor_given) { | 
| 531 | + | fprintf(outfile, "%s\n", "bor"); | 
| 532 | + | } | 
| 533 | + | if (args_info->bad_given) { | 
| 534 | + | fprintf(outfile, "%s\n", "bad"); | 
| 535 | + | } | 
| 536 |  | if (args_info->gofr_given) { | 
| 537 |  | fprintf(outfile, "%s\n", "gofr"); | 
| 538 |  | } | 
| 569 |  | if (args_info->rho_r_given) { | 
| 570 |  | fprintf(outfile, "%s\n", "rho_r"); | 
| 571 |  | } | 
| 572 | + | if (args_info->hullvol_given) { | 
| 573 | + | fprintf(outfile, "%s\n", "hullvol"); | 
| 574 | + | } | 
| 575 |  |  | 
| 576 |  | fclose (outfile); | 
| 577 |  |  | 
| 612 |  | return; | 
| 613 |  |  | 
| 614 |  | args_info->bo_given = 0 ; | 
| 615 | + | args_info->bor_given = 0 ; | 
| 616 | + | args_info->bad_given = 0 ; | 
| 617 |  | args_info->gofr_given = 0 ; | 
| 618 |  | args_info->r_theta_given = 0 ; | 
| 619 |  | args_info->r_omega_given = 0 ; | 
| 626 |  | args_info->slab_density_given = 0 ; | 
| 627 |  | args_info->hxy_given = 0 ; | 
| 628 |  | args_info->rho_r_given = 0 ; | 
| 629 | + | args_info->hullvol_given = 0 ; | 
| 630 |  |  | 
| 631 |  | args_info->staticProps_group_counter = 0; | 
| 632 |  | } | 
| 675 |  | { | 
| 676 |  | int error = 0; | 
| 677 |  |  | 
| 678 | + | /* checks for required options */ | 
| 679 |  | if (! args_info->input_given) | 
| 680 |  | { | 
| 681 |  | fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); | 
| 682 |  | error = 1; | 
| 683 |  | } | 
| 684 | + |  | 
| 685 |  | if (args_info->staticProps_group_counter == 0) | 
| 686 |  | { | 
| 687 |  | 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 : "")); | 
| 689 |  | } | 
| 690 |  |  | 
| 691 |  |  | 
| 692 | + | /* checks for dependences among options */ | 
| 693 | + |  | 
| 694 |  | return error; | 
| 695 |  | } | 
| 696 |  |  | 
| 708 |  | cmdline_parser_init (&local_args_info); | 
| 709 |  |  | 
| 710 |  | optarg = 0; | 
| 711 | < | optind = 1; | 
| 711 | > | optind = 0; | 
| 712 |  | opterr = 1; | 
| 713 |  | optopt = '?'; | 
| 714 |  |  | 
| 739 |  | { "end",        1, NULL, 0 }, | 
| 740 |  | { "radius",     1, NULL, 0 }, | 
| 741 |  | { "bo", 0, NULL, 0 }, | 
| 742 | + | { "bor",        0, NULL, 0 }, | 
| 743 | + | { "bad",        0, NULL, 0 }, | 
| 744 |  | { "gofr",       0, NULL, 'g' }, | 
| 745 |  | { "r_theta",    0, NULL, 0 }, | 
| 746 |  | { "r_omega",    0, NULL, 0 }, | 
| 753 |  | { "slab_density",       0, NULL, 0 }, | 
| 754 |  | { "hxy",        0, NULL, 0 }, | 
| 755 |  | { "rho_r",      0, NULL, 0 }, | 
| 756 | + | { "hullvol",    0, NULL, 0 }, | 
| 757 |  | { NULL, 0, NULL, 0 } | 
| 758 |  | }; | 
| 759 |  |  | 
| 1191 |  | free (args_info->radius_orig); /* free previous string */ | 
| 1192 |  | args_info->radius_orig = gengetopt_strdup (optarg); | 
| 1193 |  | } | 
| 1194 | < | /* bond order parameter (--rcut must be specified.  */ | 
| 1194 | > | /* bond order parameter (--rcut must be specified).  */ | 
| 1195 |  | else if (strcmp (long_options[option_index].name, "bo") == 0) | 
| 1196 |  | { | 
| 1197 |  | if (local_args_info.bo_given) | 
| 1203 |  | continue; | 
| 1204 |  | local_args_info.bo_given = 1; | 
| 1205 |  | args_info->bo_given = 1; | 
| 1206 | + | if (args_info->staticProps_group_counter && override) | 
| 1207 | + | reset_group_staticProps (args_info); | 
| 1208 | + | args_info->staticProps_group_counter += 1; | 
| 1209 | + | break; | 
| 1210 | + | } | 
| 1211 | + | /* bond order parameter as a function of radius (--rcut must be specified).  */ | 
| 1212 | + | else if (strcmp (long_options[option_index].name, "bor") == 0) | 
| 1213 | + | { | 
| 1214 | + | if (local_args_info.bor_given) | 
| 1215 | + | { | 
| 1216 | + | fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1217 | + | goto failure; | 
| 1218 | + | } | 
| 1219 | + | if (args_info->bor_given && ! override) | 
| 1220 | + | continue; | 
| 1221 | + | local_args_info.bor_given = 1; | 
| 1222 | + | args_info->bor_given = 1; | 
| 1223 |  | if (args_info->staticProps_group_counter && override) | 
| 1224 |  | reset_group_staticProps (args_info); | 
| 1225 |  | args_info->staticProps_group_counter += 1; | 
| 1226 |  | break; | 
| 1227 |  | } | 
| 1228 | + | /* N(theta) bond angle density within (--rcut must be specified).  */ | 
| 1229 | + | else if (strcmp (long_options[option_index].name, "bad") == 0) | 
| 1230 | + | { | 
| 1231 | + | if (local_args_info.bad_given) | 
| 1232 | + | { | 
| 1233 | + | fprintf (stderr, "%s: `--bad' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1234 | + | goto failure; | 
| 1235 | + | } | 
| 1236 | + | if (args_info->bad_given && ! override) | 
| 1237 | + | continue; | 
| 1238 | + | local_args_info.bad_given = 1; | 
| 1239 | + | args_info->bad_given = 1; | 
| 1240 | + | if (args_info->staticProps_group_counter && override) | 
| 1241 | + | reset_group_staticProps (args_info); | 
| 1242 | + | args_info->staticProps_group_counter += 1; | 
| 1243 | + | break; | 
| 1244 | + | } | 
| 1245 |  | /* g(r, cos(theta)).  */ | 
| 1246 |  | else if (strcmp (long_options[option_index].name, "r_theta") == 0) | 
| 1247 |  | { | 
| 1378 |  | args_info->staticProps_group_counter += 1; | 
| 1379 |  | break; | 
| 1380 |  | } | 
| 1381 | + | /* hull volume of nanoparticle.  */ | 
| 1382 | + | else if (strcmp (long_options[option_index].name, "hullvol") == 0) | 
| 1383 | + | { | 
| 1384 | + | if (local_args_info.hullvol_given) | 
| 1385 | + | { | 
| 1386 | + | fprintf (stderr, "%s: `--hullvol' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 1387 | + | goto failure; | 
| 1388 | + | } | 
| 1389 | + | if (args_info->hullvol_given && ! override) | 
| 1390 | + | continue; | 
| 1391 | + | local_args_info.hullvol_given = 1; | 
| 1392 | + | args_info->hullvol_given = 1; | 
| 1393 | + | if (args_info->staticProps_group_counter && override) | 
| 1394 | + | reset_group_staticProps (args_info); | 
| 1395 | + | args_info->staticProps_group_counter += 1; | 
| 1396 | + | break; | 
| 1397 | + | } | 
| 1398 |  |  | 
| 1399 |  | break; | 
| 1400 |  | case '?':       /* Invalid option.  */ | 
| 1425 |  | if ( error ) | 
| 1426 |  | return (EXIT_FAILURE); | 
| 1427 |  |  | 
| 1428 | + | if (optind < argc) | 
| 1429 | + | { | 
| 1430 | + | int i = 0 ; | 
| 1431 | + | int found_prog_name = 0; | 
| 1432 | + | /* whether program name, i.e., argv[0], is in the remaining args | 
| 1433 | + | (this may happen with some implementations of getopt, | 
| 1434 | + | but surely not with the one included by gengetopt) */ | 
| 1435 | + |  | 
| 1436 | + | i = optind; | 
| 1437 | + | while (i < argc) | 
| 1438 | + | if (argv[i++] == argv[0]) { | 
| 1439 | + | found_prog_name = 1; | 
| 1440 | + | break; | 
| 1441 | + | } | 
| 1442 | + | i = 0; | 
| 1443 | + |  | 
| 1444 | + | args_info->inputs_num = argc - optind - found_prog_name; | 
| 1445 | + | args_info->inputs = | 
| 1446 | + | (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; | 
| 1447 | + | while (optind < argc) | 
| 1448 | + | if (argv[optind++] != argv[0]) | 
| 1449 | + | args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; | 
| 1450 | + | } | 
| 1451 | + |  | 
| 1452 |  | return 0; | 
| 1453 |  |  | 
| 1454 |  | failure: |