| 1 |  | /* | 
| 2 | < | File autogenerated by gengetopt version 2.15 | 
| 2 | > | File autogenerated by gengetopt version 2.22.4 | 
| 3 |  | generated with the following command: | 
| 4 | < | gengetopt -u -i DynamicProps.ggo -F DynamicPropsCmd | 
| 4 | > | gengetopt --file-name=DynamicPropsCmd --unamed-opts | 
| 5 |  |  | 
| 6 |  | The developers of gengetopt consider the fixed text that goes in all | 
| 7 |  | gengetopt output files to be in the public domain: | 
| 17 |  | #include <stdlib.h> | 
| 18 |  | #include <string.h> | 
| 19 |  |  | 
| 20 | < | #include "getopt.h" | 
| 20 | > | #ifndef FIX_UNUSED | 
| 21 | > | #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ | 
| 22 | > | #endif | 
| 23 |  |  | 
| 24 | + | #ifdef WIN32 | 
| 25 | + | #include "utils/wingetopt.h" | 
| 26 | + | #else | 
| 27 | + | #include <getopt.h> | 
| 28 | + | #endif | 
| 29 | + |  | 
| 30 |  | #include "DynamicPropsCmd.h" | 
| 31 |  |  | 
| 32 | + | const char *gengetopt_args_info_purpose = ""; | 
| 33 | + |  | 
| 34 | + | const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]... [FILES]..."; | 
| 35 | + |  | 
| 36 | + | const char *gengetopt_args_info_description = ""; | 
| 37 | + |  | 
| 38 | + | const char *gengetopt_args_info_help[] = { | 
| 39 | + | "  -h, --help                    Print help and exit", | 
| 40 | + | "  -V, --version                 Print version and exit", | 
| 41 | + | "  -i, --input=filename          input dump file", | 
| 42 | + | "  -o, --output=filename         output file name", | 
| 43 | + | "      --sele1=selection script  select first stuntdouble set", | 
| 44 | + | "      --sele2=selection script  select second stuntdouble set (if sele2 is not \n                                  set, use script from sele1)", | 
| 45 | + | "      --order=INT               Lengendre Polynomial Order", | 
| 46 | + | "  -z, --nzbins=INT              Number of Z bins  (default=`100')", | 
| 47 | + | "  -m, --memory=memory specification\n                                Available memory (defaults to 2G)  \n                                  (default=`2G')", | 
| 48 | + | "\n Group: dynamicProps\n   an option of this group is required", | 
| 49 | + | "  -s, --selecorr                selection correlation function", | 
| 50 | + | "  -r, --rcorr                   rmsd", | 
| 51 | + | "  -v, --vcorr                   velocity correlation function", | 
| 52 | + | "  -d, --dcorr                   dipole correlation function", | 
| 53 | + | "  -l, --lcorr                   Lengendre correlation function", | 
| 54 | + | "      --lcorrZ                  Lengendre correlation function binned by Z", | 
| 55 | + | "      --cohZ                    Lengendre correlation function for OH bond \n                                  vectors binned by Z", | 
| 56 | + | "  -M, --sdcorr                  System dipole correlation function", | 
| 57 | + | "      --r_rcorr                 Radial rmsd", | 
| 58 | + | "      --thetacorr               Angular rmsd", | 
| 59 | + | "      --drcorr                  Directional rmsd for particles with unit \n                                  vectors", | 
| 60 | + | "      --helfandEcorr            Helfand moment for thermal conductvity", | 
| 61 | + | "  -p, --momentum                Helfand momentum for viscosity", | 
| 62 | + | "      --stresscorr              Stress tensor correlation function", | 
| 63 | + | "  -b, --bondcorr                Bond extension correlation function", | 
| 64 | + | "  -f, --freqfluccorr            Frequency Fluctuation correlation function", | 
| 65 | + | 0 | 
| 66 | + | }; | 
| 67 | + |  | 
| 68 | + | typedef enum {ARG_NO | 
| 69 | + | , ARG_STRING | 
| 70 | + | , ARG_INT | 
| 71 | + | } cmdline_parser_arg_type; | 
| 72 | + |  | 
| 73 |  | static | 
| 74 |  | void clear_given (struct gengetopt_args_info *args_info); | 
| 75 |  | static | 
| 76 |  | void clear_args (struct gengetopt_args_info *args_info); | 
| 77 |  |  | 
| 78 |  | static int | 
| 79 | < | 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); | 
| 79 | > | cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, | 
| 80 | > | struct cmdline_parser_params *params, const char *additional_error); | 
| 81 |  |  | 
| 82 |  | static int | 
| 83 |  | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); | 
| 95 |  | args_info->sele1_given = 0 ; | 
| 96 |  | args_info->sele2_given = 0 ; | 
| 97 |  | args_info->order_given = 0 ; | 
| 98 | + | args_info->nzbins_given = 0 ; | 
| 99 | + | args_info->memory_given = 0 ; | 
| 100 | + | args_info->selecorr_given = 0 ; | 
| 101 |  | args_info->rcorr_given = 0 ; | 
| 102 |  | args_info->vcorr_given = 0 ; | 
| 103 |  | args_info->dcorr_given = 0 ; | 
| 104 |  | args_info->lcorr_given = 0 ; | 
| 105 | + | args_info->lcorrZ_given = 0 ; | 
| 106 | + | args_info->cohZ_given = 0 ; | 
| 107 | + | args_info->sdcorr_given = 0 ; | 
| 108 |  | args_info->r_rcorr_given = 0 ; | 
| 109 |  | args_info->thetacorr_given = 0 ; | 
| 110 | + | args_info->drcorr_given = 0 ; | 
| 111 | + | args_info->helfandEcorr_given = 0 ; | 
| 112 | + | args_info->momentum_given = 0 ; | 
| 113 | + | args_info->stresscorr_given = 0 ; | 
| 114 | + | args_info->bondcorr_given = 0 ; | 
| 115 | + | args_info->freqfluccorr_given = 0 ; | 
| 116 |  | args_info->dynamicProps_group_counter = 0 ; | 
| 117 |  | } | 
| 118 |  |  | 
| 119 |  | static | 
| 120 |  | void clear_args (struct gengetopt_args_info *args_info) | 
| 121 |  | { | 
| 122 | + | FIX_UNUSED (args_info); | 
| 123 |  | args_info->input_arg = NULL; | 
| 124 |  | args_info->input_orig = NULL; | 
| 125 |  | args_info->output_arg = NULL; | 
| 129 |  | args_info->sele2_arg = NULL; | 
| 130 |  | args_info->sele2_orig = NULL; | 
| 131 |  | args_info->order_orig = NULL; | 
| 132 | + | args_info->nzbins_arg = 100; | 
| 133 | + | args_info->nzbins_orig = NULL; | 
| 134 | + | args_info->memory_arg = gengetopt_strdup ("2G"); | 
| 135 | + | args_info->memory_orig = NULL; | 
| 136 |  |  | 
| 137 |  | } | 
| 138 |  |  | 
| 139 | + | static | 
| 140 | + | void init_args_info(struct gengetopt_args_info *args_info) | 
| 141 | + | { | 
| 142 | + |  | 
| 143 | + |  | 
| 144 | + | args_info->help_help = gengetopt_args_info_help[0] ; | 
| 145 | + | args_info->version_help = gengetopt_args_info_help[1] ; | 
| 146 | + | args_info->input_help = gengetopt_args_info_help[2] ; | 
| 147 | + | args_info->output_help = gengetopt_args_info_help[3] ; | 
| 148 | + | args_info->sele1_help = gengetopt_args_info_help[4] ; | 
| 149 | + | args_info->sele2_help = gengetopt_args_info_help[5] ; | 
| 150 | + | args_info->order_help = gengetopt_args_info_help[6] ; | 
| 151 | + | args_info->nzbins_help = gengetopt_args_info_help[7] ; | 
| 152 | + | args_info->memory_help = gengetopt_args_info_help[8] ; | 
| 153 | + | args_info->selecorr_help = gengetopt_args_info_help[10] ; | 
| 154 | + | args_info->rcorr_help = gengetopt_args_info_help[11] ; | 
| 155 | + | args_info->vcorr_help = gengetopt_args_info_help[12] ; | 
| 156 | + | args_info->dcorr_help = gengetopt_args_info_help[13] ; | 
| 157 | + | args_info->lcorr_help = gengetopt_args_info_help[14] ; | 
| 158 | + | args_info->lcorrZ_help = gengetopt_args_info_help[15] ; | 
| 159 | + | args_info->cohZ_help = gengetopt_args_info_help[16] ; | 
| 160 | + | args_info->sdcorr_help = gengetopt_args_info_help[17] ; | 
| 161 | + | args_info->r_rcorr_help = gengetopt_args_info_help[18] ; | 
| 162 | + | args_info->thetacorr_help = gengetopt_args_info_help[19] ; | 
| 163 | + | args_info->drcorr_help = gengetopt_args_info_help[20] ; | 
| 164 | + | args_info->helfandEcorr_help = gengetopt_args_info_help[21] ; | 
| 165 | + | args_info->momentum_help = gengetopt_args_info_help[22] ; | 
| 166 | + | args_info->stresscorr_help = gengetopt_args_info_help[23] ; | 
| 167 | + | args_info->bondcorr_help = gengetopt_args_info_help[24] ; | 
| 168 | + | args_info->freqfluccorr_help = gengetopt_args_info_help[25] ; | 
| 169 | + |  | 
| 170 | + | } | 
| 171 | + |  | 
| 172 |  | void | 
| 173 |  | cmdline_parser_print_version (void) | 
| 174 |  | { | 
| 175 | < | printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); | 
| 175 | > | printf ("%s %s\n", | 
| 176 | > | (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), | 
| 177 | > | CMDLINE_PARSER_VERSION); | 
| 178 |  | } | 
| 179 |  |  | 
| 180 | + | static void print_help_common(void) { | 
| 181 | + | cmdline_parser_print_version (); | 
| 182 | + |  | 
| 183 | + | if (strlen(gengetopt_args_info_purpose) > 0) | 
| 184 | + | printf("\n%s\n", gengetopt_args_info_purpose); | 
| 185 | + |  | 
| 186 | + | if (strlen(gengetopt_args_info_usage) > 0) | 
| 187 | + | printf("\n%s\n", gengetopt_args_info_usage); | 
| 188 | + |  | 
| 189 | + | printf("\n"); | 
| 190 | + |  | 
| 191 | + | if (strlen(gengetopt_args_info_description) > 0) | 
| 192 | + | printf("%s\n\n", gengetopt_args_info_description); | 
| 193 | + | } | 
| 194 | + |  | 
| 195 |  | void | 
| 196 |  | cmdline_parser_print_help (void) | 
| 197 |  | { | 
| 198 | < | cmdline_parser_print_version (); | 
| 199 | < | printf("\nUsage: DynamicProps [OPTIONS]... [FILES]...\n\n"); | 
| 200 | < | printf("%s\n","  -h, --help                    Print help and exit"); | 
| 201 | < | printf("%s\n","  -V, --version                 Print version and exit"); | 
| 85 | < | printf("%s\n","  -i, --input=filename          input dump file"); | 
| 86 | < | printf("%s\n","  -o, --output=filename         output file name"); | 
| 87 | < | printf("%s\n","      --sele1=selection script  select first stuntdouble set"); | 
| 88 | < | printf("%s\n","      --sele2=selection script  select second stuntdouble set (if sele2 is not \n                                  set, use script from sele1)"); | 
| 89 | < | printf("%s\n","      --order=INT               Lengendre Polynomial Order"); | 
| 90 | < | printf("%s\n","\n Group: dynamicProps\n   an option of this group is required"); | 
| 91 | < | printf("%s\n","  -r, --rcorr                   rmsd"); | 
| 92 | < | printf("%s\n","  -v, --vcorr                   velocity correlation function"); | 
| 93 | < | printf("%s\n","  -d, --dcorr                   dipole correlation function"); | 
| 94 | < | printf("%s\n","  -l, --lcorr                   Lengendre correlation function"); | 
| 95 | < | printf("%s\n","      --r_rcorr                 Radial rmsd"); | 
| 96 | < | printf("%s\n","      --thetacorr               Angular rmsd"); | 
| 97 | < |  | 
| 198 | > | int i = 0; | 
| 199 | > | print_help_common(); | 
| 200 | > | while (gengetopt_args_info_help[i]) | 
| 201 | > | printf("%s\n", gengetopt_args_info_help[i++]); | 
| 202 |  | } | 
| 203 |  |  | 
| 204 |  | void | 
| 206 |  | { | 
| 207 |  | clear_given (args_info); | 
| 208 |  | clear_args (args_info); | 
| 209 | + | init_args_info (args_info); | 
| 210 |  |  | 
| 211 | < | args_info->inputs = NULL; | 
| 211 | > | args_info->inputs = 0; | 
| 212 |  | args_info->inputs_num = 0; | 
| 213 |  | } | 
| 214 |  |  | 
| 215 | + | void | 
| 216 | + | cmdline_parser_params_init(struct cmdline_parser_params *params) | 
| 217 | + | { | 
| 218 | + | if (params) | 
| 219 | + | { | 
| 220 | + | params->override = 0; | 
| 221 | + | params->initialize = 1; | 
| 222 | + | params->check_required = 1; | 
| 223 | + | params->check_ambiguity = 0; | 
| 224 | + | params->print_errors = 1; | 
| 225 | + | } | 
| 226 | + | } | 
| 227 | + |  | 
| 228 | + | struct cmdline_parser_params * | 
| 229 | + | cmdline_parser_params_create(void) | 
| 230 | + | { | 
| 231 | + | struct cmdline_parser_params *params = | 
| 232 | + | (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); | 
| 233 | + | cmdline_parser_params_init(params); | 
| 234 | + | return params; | 
| 235 | + | } | 
| 236 | + |  | 
| 237 |  | static void | 
| 238 | < | cmdline_parser_release (struct gengetopt_args_info *args_info) | 
| 238 | > | free_string_field (char **s) | 
| 239 |  | { | 
| 240 | < |  | 
| 114 | < | unsigned int i; | 
| 115 | < | if (args_info->input_arg) | 
| 240 | > | if (*s) | 
| 241 |  | { | 
| 242 | < | free (args_info->input_arg); /* free previous argument */ | 
| 243 | < | args_info->input_arg = 0; | 
| 242 | > | free (*s); | 
| 243 | > | *s = 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->sele1_arg) | 
| 261 | < | { | 
| 262 | < | free (args_info->sele1_arg); /* free previous argument */ | 
| 263 | < | args_info->sele1_arg = 0; | 
| 139 | < | } | 
| 140 | < | if (args_info->sele1_orig) | 
| 141 | < | { | 
| 142 | < | free (args_info->sele1_orig); /* free previous argument */ | 
| 143 | < | args_info->sele1_orig = 0; | 
| 144 | < | } | 
| 145 | < | if (args_info->sele2_arg) | 
| 146 | < | { | 
| 147 | < | free (args_info->sele2_arg); /* free previous argument */ | 
| 148 | < | args_info->sele2_arg = 0; | 
| 149 | < | } | 
| 150 | < | if (args_info->sele2_orig) | 
| 151 | < | { | 
| 152 | < | free (args_info->sele2_orig); /* free previous argument */ | 
| 153 | < | args_info->sele2_orig = 0; | 
| 154 | < | } | 
| 155 | < | if (args_info->order_orig) | 
| 156 | < | { | 
| 157 | < | free (args_info->order_orig); /* free previous argument */ | 
| 158 | < | args_info->order_orig = 0; | 
| 159 | < | } | 
| 245 | > | } | 
| 246 | > |  | 
| 247 | > |  | 
| 248 | > | static void | 
| 249 | > | cmdline_parser_release (struct gengetopt_args_info *args_info) | 
| 250 | > | { | 
| 251 | > | unsigned int i; | 
| 252 | > | free_string_field (&(args_info->input_arg)); | 
| 253 | > | free_string_field (&(args_info->input_orig)); | 
| 254 | > | free_string_field (&(args_info->output_arg)); | 
| 255 | > | free_string_field (&(args_info->output_orig)); | 
| 256 | > | free_string_field (&(args_info->sele1_arg)); | 
| 257 | > | free_string_field (&(args_info->sele1_orig)); | 
| 258 | > | free_string_field (&(args_info->sele2_arg)); | 
| 259 | > | free_string_field (&(args_info->sele2_orig)); | 
| 260 | > | free_string_field (&(args_info->order_orig)); | 
| 261 | > | free_string_field (&(args_info->nzbins_orig)); | 
| 262 | > | free_string_field (&(args_info->memory_arg)); | 
| 263 | > | free_string_field (&(args_info->memory_orig)); | 
| 264 |  |  | 
| 265 | + |  | 
| 266 |  | for (i = 0; i < args_info->inputs_num; ++i) | 
| 267 |  | free (args_info->inputs [i]); | 
| 268 | < |  | 
| 268 | > |  | 
| 269 |  | if (args_info->inputs_num) | 
| 270 |  | free (args_info->inputs); | 
| 271 | < |  | 
| 271 | > |  | 
| 272 |  | clear_given (args_info); | 
| 273 |  | } | 
| 274 |  |  | 
| 275 | + |  | 
| 276 | + | static void | 
| 277 | + | write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) | 
| 278 | + | { | 
| 279 | + | FIX_UNUSED (values); | 
| 280 | + | if (arg) { | 
| 281 | + | fprintf(outfile, "%s=\"%s\"\n", opt, arg); | 
| 282 | + | } else { | 
| 283 | + | fprintf(outfile, "%s\n", opt); | 
| 284 | + | } | 
| 285 | + | } | 
| 286 | + |  | 
| 287 | + |  | 
| 288 |  | int | 
| 289 | + | cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) | 
| 290 | + | { | 
| 291 | + | int i = 0; | 
| 292 | + |  | 
| 293 | + | if (!outfile) | 
| 294 | + | { | 
| 295 | + | fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); | 
| 296 | + | return EXIT_FAILURE; | 
| 297 | + | } | 
| 298 | + |  | 
| 299 | + | if (args_info->help_given) | 
| 300 | + | write_into_file(outfile, "help", 0, 0 ); | 
| 301 | + | if (args_info->version_given) | 
| 302 | + | write_into_file(outfile, "version", 0, 0 ); | 
| 303 | + | if (args_info->input_given) | 
| 304 | + | write_into_file(outfile, "input", args_info->input_orig, 0); | 
| 305 | + | if (args_info->output_given) | 
| 306 | + | write_into_file(outfile, "output", args_info->output_orig, 0); | 
| 307 | + | if (args_info->sele1_given) | 
| 308 | + | write_into_file(outfile, "sele1", args_info->sele1_orig, 0); | 
| 309 | + | if (args_info->sele2_given) | 
| 310 | + | write_into_file(outfile, "sele2", args_info->sele2_orig, 0); | 
| 311 | + | if (args_info->order_given) | 
| 312 | + | write_into_file(outfile, "order", args_info->order_orig, 0); | 
| 313 | + | if (args_info->nzbins_given) | 
| 314 | + | write_into_file(outfile, "nzbins", args_info->nzbins_orig, 0); | 
| 315 | + | if (args_info->memory_given) | 
| 316 | + | write_into_file(outfile, "memory", args_info->memory_orig, 0); | 
| 317 | + | if (args_info->selecorr_given) | 
| 318 | + | write_into_file(outfile, "selecorr", 0, 0 ); | 
| 319 | + | if (args_info->rcorr_given) | 
| 320 | + | write_into_file(outfile, "rcorr", 0, 0 ); | 
| 321 | + | if (args_info->vcorr_given) | 
| 322 | + | write_into_file(outfile, "vcorr", 0, 0 ); | 
| 323 | + | if (args_info->dcorr_given) | 
| 324 | + | write_into_file(outfile, "dcorr", 0, 0 ); | 
| 325 | + | if (args_info->lcorr_given) | 
| 326 | + | write_into_file(outfile, "lcorr", 0, 0 ); | 
| 327 | + | if (args_info->lcorrZ_given) | 
| 328 | + | write_into_file(outfile, "lcorrZ", 0, 0 ); | 
| 329 | + | if (args_info->cohZ_given) | 
| 330 | + | write_into_file(outfile, "cohZ", 0, 0 ); | 
| 331 | + | if (args_info->sdcorr_given) | 
| 332 | + | write_into_file(outfile, "sdcorr", 0, 0 ); | 
| 333 | + | if (args_info->r_rcorr_given) | 
| 334 | + | write_into_file(outfile, "r_rcorr", 0, 0 ); | 
| 335 | + | if (args_info->thetacorr_given) | 
| 336 | + | write_into_file(outfile, "thetacorr", 0, 0 ); | 
| 337 | + | if (args_info->drcorr_given) | 
| 338 | + | write_into_file(outfile, "drcorr", 0, 0 ); | 
| 339 | + | if (args_info->helfandEcorr_given) | 
| 340 | + | write_into_file(outfile, "helfandEcorr", 0, 0 ); | 
| 341 | + | if (args_info->momentum_given) | 
| 342 | + | write_into_file(outfile, "momentum", 0, 0 ); | 
| 343 | + | if (args_info->stresscorr_given) | 
| 344 | + | write_into_file(outfile, "stresscorr", 0, 0 ); | 
| 345 | + | if (args_info->bondcorr_given) | 
| 346 | + | write_into_file(outfile, "bondcorr", 0, 0 ); | 
| 347 | + | if (args_info->freqfluccorr_given) | 
| 348 | + | write_into_file(outfile, "freqfluccorr", 0, 0 ); | 
| 349 | + |  | 
| 350 | + |  | 
| 351 | + | i = EXIT_SUCCESS; | 
| 352 | + | return i; | 
| 353 | + | } | 
| 354 | + |  | 
| 355 | + | int | 
| 356 |  | cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) | 
| 357 |  | { | 
| 358 |  | FILE *outfile; | 
| 366 |  | return EXIT_FAILURE; | 
| 367 |  | } | 
| 368 |  |  | 
| 369 | < | if (args_info->help_given) { | 
| 185 | < | fprintf(outfile, "%s\n", "help"); | 
| 186 | < | } | 
| 187 | < | if (args_info->version_given) { | 
| 188 | < | fprintf(outfile, "%s\n", "version"); | 
| 189 | < | } | 
| 190 | < | if (args_info->input_given) { | 
| 191 | < | if (args_info->input_orig) { | 
| 192 | < | fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); | 
| 193 | < | } else { | 
| 194 | < | fprintf(outfile, "%s\n", "input"); | 
| 195 | < | } | 
| 196 | < | } | 
| 197 | < | if (args_info->output_given) { | 
| 198 | < | if (args_info->output_orig) { | 
| 199 | < | fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); | 
| 200 | < | } else { | 
| 201 | < | fprintf(outfile, "%s\n", "output"); | 
| 202 | < | } | 
| 203 | < | } | 
| 204 | < | if (args_info->sele1_given) { | 
| 205 | < | if (args_info->sele1_orig) { | 
| 206 | < | fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); | 
| 207 | < | } else { | 
| 208 | < | fprintf(outfile, "%s\n", "sele1"); | 
| 209 | < | } | 
| 210 | < | } | 
| 211 | < | if (args_info->sele2_given) { | 
| 212 | < | if (args_info->sele2_orig) { | 
| 213 | < | fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); | 
| 214 | < | } else { | 
| 215 | < | fprintf(outfile, "%s\n", "sele2"); | 
| 216 | < | } | 
| 217 | < | } | 
| 218 | < | if (args_info->order_given) { | 
| 219 | < | if (args_info->order_orig) { | 
| 220 | < | fprintf(outfile, "%s=\"%s\"\n", "order", args_info->order_orig); | 
| 221 | < | } else { | 
| 222 | < | fprintf(outfile, "%s\n", "order"); | 
| 223 | < | } | 
| 224 | < | } | 
| 225 | < | if (args_info->rcorr_given) { | 
| 226 | < | fprintf(outfile, "%s\n", "rcorr"); | 
| 227 | < | } | 
| 228 | < | if (args_info->vcorr_given) { | 
| 229 | < | fprintf(outfile, "%s\n", "vcorr"); | 
| 230 | < | } | 
| 231 | < | if (args_info->dcorr_given) { | 
| 232 | < | fprintf(outfile, "%s\n", "dcorr"); | 
| 233 | < | } | 
| 234 | < | if (args_info->lcorr_given) { | 
| 235 | < | fprintf(outfile, "%s\n", "lcorr"); | 
| 236 | < | } | 
| 237 | < | if (args_info->r_rcorr_given) { | 
| 238 | < | fprintf(outfile, "%s\n", "r_rcorr"); | 
| 239 | < | } | 
| 240 | < | if (args_info->thetacorr_given) { | 
| 241 | < | fprintf(outfile, "%s\n", "thetacorr"); | 
| 242 | < | } | 
| 243 | < |  | 
| 369 | > | i = cmdline_parser_dump(outfile, args_info); | 
| 370 |  | fclose (outfile); | 
| 371 |  |  | 
| 246 | – | i = EXIT_SUCCESS; | 
| 372 |  | return i; | 
| 373 |  | } | 
| 374 |  |  | 
| 378 |  | cmdline_parser_release (args_info); | 
| 379 |  | } | 
| 380 |  |  | 
| 381 | < |  | 
| 257 | < | /* gengetopt_strdup() */ | 
| 258 | < | /* strdup.c replacement of strdup, which is not standard */ | 
| 381 | > | /** @brief replacement of strdup, which is not standard */ | 
| 382 |  | char * | 
| 383 |  | gengetopt_strdup (const char *s) | 
| 384 |  | { | 
| 385 | < | char *result = NULL; | 
| 385 | > | char *result = 0; | 
| 386 |  | if (!s) | 
| 387 |  | return result; | 
| 388 |  |  | 
| 394 |  | } | 
| 395 |  |  | 
| 396 |  | static void | 
| 274 | – | reset_group_dynamicProps(struct gengetopt_args_info *args_info); | 
| 275 | – |  | 
| 276 | – | static void | 
| 397 |  | reset_group_dynamicProps(struct gengetopt_args_info *args_info) | 
| 398 |  | { | 
| 399 |  | if (! args_info->dynamicProps_group_counter) | 
| 400 |  | return; | 
| 401 |  |  | 
| 402 | + | args_info->selecorr_given = 0 ; | 
| 403 |  | args_info->rcorr_given = 0 ; | 
| 404 |  | args_info->vcorr_given = 0 ; | 
| 405 |  | args_info->dcorr_given = 0 ; | 
| 406 |  | args_info->lcorr_given = 0 ; | 
| 407 | + | args_info->lcorrZ_given = 0 ; | 
| 408 | + | args_info->cohZ_given = 0 ; | 
| 409 | + | args_info->sdcorr_given = 0 ; | 
| 410 |  | args_info->r_rcorr_given = 0 ; | 
| 411 |  | args_info->thetacorr_given = 0 ; | 
| 412 | + | args_info->drcorr_given = 0 ; | 
| 413 | + | args_info->helfandEcorr_given = 0 ; | 
| 414 | + | args_info->momentum_given = 0 ; | 
| 415 | + | args_info->stresscorr_given = 0 ; | 
| 416 | + | args_info->bondcorr_given = 0 ; | 
| 417 | + | args_info->freqfluccorr_given = 0 ; | 
| 418 |  |  | 
| 419 |  | args_info->dynamicProps_group_counter = 0; | 
| 420 |  | } | 
| 421 |  |  | 
| 422 |  | int | 
| 423 | < | cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) | 
| 423 | > | cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) | 
| 424 |  | { | 
| 425 |  | return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); | 
| 426 |  | } | 
| 427 |  |  | 
| 428 |  | int | 
| 429 | < | cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) | 
| 429 | > | cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, | 
| 430 | > | struct cmdline_parser_params *params) | 
| 431 |  | { | 
| 432 |  | int result; | 
| 433 | + | result = cmdline_parser_internal (argc, argv, args_info, params, 0); | 
| 434 |  |  | 
| 435 | < | result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); | 
| 435 | > | if (result == EXIT_FAILURE) | 
| 436 | > | { | 
| 437 | > | cmdline_parser_free (args_info); | 
| 438 | > | exit (EXIT_FAILURE); | 
| 439 | > | } | 
| 440 | > |  | 
| 441 | > | return result; | 
| 442 | > | } | 
| 443 |  |  | 
| 444 | + | int | 
| 445 | + | cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) | 
| 446 | + | { | 
| 447 | + | int result; | 
| 448 | + | struct cmdline_parser_params params; | 
| 449 | + |  | 
| 450 | + | params.override = override; | 
| 451 | + | params.initialize = initialize; | 
| 452 | + | params.check_required = check_required; | 
| 453 | + | params.check_ambiguity = 0; | 
| 454 | + | params.print_errors = 1; | 
| 455 | + |  | 
| 456 | + | result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); | 
| 457 | + |  | 
| 458 |  | if (result == EXIT_FAILURE) | 
| 459 |  | { | 
| 460 |  | cmdline_parser_free (args_info); | 
| 469 |  | { | 
| 470 |  | int result = EXIT_SUCCESS; | 
| 471 |  |  | 
| 472 | < | if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) | 
| 472 | > | if (cmdline_parser_required2(args_info, prog_name, 0) > 0) | 
| 473 |  | result = EXIT_FAILURE; | 
| 474 |  |  | 
| 475 |  | if (result == EXIT_FAILURE) | 
| 485 |  | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) | 
| 486 |  | { | 
| 487 |  | int error = 0; | 
| 488 | + | FIX_UNUSED (additional_error); | 
| 489 |  |  | 
| 490 | + | /* checks for required options */ | 
| 491 |  | if (! args_info->input_given) | 
| 492 |  | { | 
| 493 |  | fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); | 
| 494 |  | error = 1; | 
| 495 |  | } | 
| 496 | + |  | 
| 497 |  | if (args_info->dynamicProps_group_counter == 0) | 
| 498 |  | { | 
| 499 | < | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 499 | > | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required%s.\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 500 |  | error = 1; | 
| 501 |  | } | 
| 502 |  |  | 
| 503 |  |  | 
| 504 | + | /* checks for dependences among options */ | 
| 505 | + |  | 
| 506 |  | return error; | 
| 507 |  | } | 
| 508 |  |  | 
| 509 | + |  | 
| 510 | + | static char *package_name = 0; | 
| 511 | + |  | 
| 512 | + | /** | 
| 513 | + | * @brief updates an option | 
| 514 | + | * @param field the generic pointer to the field to update | 
| 515 | + | * @param orig_field the pointer to the orig field | 
| 516 | + | * @param field_given the pointer to the number of occurrence of this option | 
| 517 | + | * @param prev_given the pointer to the number of occurrence already seen | 
| 518 | + | * @param value the argument for this option (if null no arg was specified) | 
| 519 | + | * @param possible_values the possible values for this option (if specified) | 
| 520 | + | * @param default_value the default value (in case the option only accepts fixed values) | 
| 521 | + | * @param arg_type the type of this option | 
| 522 | + | * @param check_ambiguity @see cmdline_parser_params.check_ambiguity | 
| 523 | + | * @param override @see cmdline_parser_params.override | 
| 524 | + | * @param no_free whether to free a possible previous value | 
| 525 | + | * @param multiple_option whether this is a multiple option | 
| 526 | + | * @param long_opt the corresponding long option | 
| 527 | + | * @param short_opt the corresponding short option (or '-' if none) | 
| 528 | + | * @param additional_error possible further error specification | 
| 529 | + | */ | 
| 530 | + | static | 
| 531 | + | int update_arg(void *field, char **orig_field, | 
| 532 | + | unsigned int *field_given, unsigned int *prev_given, | 
| 533 | + | char *value, const char *possible_values[], | 
| 534 | + | const char *default_value, | 
| 535 | + | cmdline_parser_arg_type arg_type, | 
| 536 | + | int check_ambiguity, int override, | 
| 537 | + | int no_free, int multiple_option, | 
| 538 | + | const char *long_opt, char short_opt, | 
| 539 | + | const char *additional_error) | 
| 540 | + | { | 
| 541 | + | char *stop_char = 0; | 
| 542 | + | const char *val = value; | 
| 543 | + | int found; | 
| 544 | + | char **string_field; | 
| 545 | + | FIX_UNUSED (field); | 
| 546 | + |  | 
| 547 | + | stop_char = 0; | 
| 548 | + | found = 0; | 
| 549 | + |  | 
| 550 | + | if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) | 
| 551 | + | { | 
| 552 | + | if (short_opt != '-') | 
| 553 | + | fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", | 
| 554 | + | package_name, long_opt, short_opt, | 
| 555 | + | (additional_error ? additional_error : "")); | 
| 556 | + | else | 
| 557 | + | fprintf (stderr, "%s: `--%s' option given more than once%s\n", | 
| 558 | + | package_name, long_opt, | 
| 559 | + | (additional_error ? additional_error : "")); | 
| 560 | + | return 1; /* failure */ | 
| 561 | + | } | 
| 562 | + |  | 
| 563 | + | FIX_UNUSED (default_value); | 
| 564 | + |  | 
| 565 | + | if (field_given && *field_given && ! override) | 
| 566 | + | return 0; | 
| 567 | + | if (prev_given) | 
| 568 | + | (*prev_given)++; | 
| 569 | + | if (field_given) | 
| 570 | + | (*field_given)++; | 
| 571 | + | if (possible_values) | 
| 572 | + | val = possible_values[found]; | 
| 573 | + |  | 
| 574 | + | switch(arg_type) { | 
| 575 | + | case ARG_INT: | 
| 576 | + | if (val) *((int *)field) = strtol (val, &stop_char, 0); | 
| 577 | + | break; | 
| 578 | + | case ARG_STRING: | 
| 579 | + | if (val) { | 
| 580 | + | string_field = (char **)field; | 
| 581 | + | if (!no_free && *string_field) | 
| 582 | + | free (*string_field); /* free previous string */ | 
| 583 | + | *string_field = gengetopt_strdup (val); | 
| 584 | + | } | 
| 585 | + | break; | 
| 586 | + | default: | 
| 587 | + | break; | 
| 588 | + | }; | 
| 589 | + |  | 
| 590 | + | /* check numeric conversion */ | 
| 591 | + | switch(arg_type) { | 
| 592 | + | case ARG_INT: | 
| 593 | + | if (val && !(stop_char && *stop_char == '\0')) { | 
| 594 | + | fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); | 
| 595 | + | return 1; /* failure */ | 
| 596 | + | } | 
| 597 | + | break; | 
| 598 | + | default: | 
| 599 | + | ; | 
| 600 | + | }; | 
| 601 | + |  | 
| 602 | + | /* store the original value */ | 
| 603 | + | switch(arg_type) { | 
| 604 | + | case ARG_NO: | 
| 605 | + | break; | 
| 606 | + | default: | 
| 607 | + | if (value && orig_field) { | 
| 608 | + | if (no_free) { | 
| 609 | + | *orig_field = value; | 
| 610 | + | } else { | 
| 611 | + | if (*orig_field) | 
| 612 | + | free (*orig_field); /* free previous string */ | 
| 613 | + | *orig_field = gengetopt_strdup (value); | 
| 614 | + | } | 
| 615 | + | } | 
| 616 | + | }; | 
| 617 | + |  | 
| 618 | + | return 0; /* OK */ | 
| 619 | + | } | 
| 620 | + |  | 
| 621 | + |  | 
| 622 |  | int | 
| 623 | < | 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) | 
| 623 | > | cmdline_parser_internal ( | 
| 624 | > | int argc, char **argv, struct gengetopt_args_info *args_info, | 
| 625 | > | struct cmdline_parser_params *params, const char *additional_error) | 
| 626 |  | { | 
| 627 |  | int c;        /* Character of the parsed option.  */ | 
| 628 |  |  | 
| 629 |  | int error = 0; | 
| 630 |  | struct gengetopt_args_info local_args_info; | 
| 631 | + |  | 
| 632 | + | int override; | 
| 633 | + | int initialize; | 
| 634 | + | int check_required; | 
| 635 | + | int check_ambiguity; | 
| 636 | + |  | 
| 637 | + | package_name = argv[0]; | 
| 638 | + |  | 
| 639 | + | override = params->override; | 
| 640 | + | initialize = params->initialize; | 
| 641 | + | check_required = params->check_required; | 
| 642 | + | check_ambiguity = params->check_ambiguity; | 
| 643 |  |  | 
| 644 |  | if (initialize) | 
| 645 |  | cmdline_parser_init (args_info); | 
| 647 |  | cmdline_parser_init (&local_args_info); | 
| 648 |  |  | 
| 649 |  | optarg = 0; | 
| 650 | < | optind = 1; | 
| 651 | < | opterr = 1; | 
| 650 | > | optind = 0; | 
| 651 | > | opterr = params->print_errors; | 
| 652 |  | optopt = '?'; | 
| 653 |  |  | 
| 654 |  | while (1) | 
| 655 |  | { | 
| 656 |  | int option_index = 0; | 
| 372 | – | char *stop_char; | 
| 657 |  |  | 
| 658 |  | static struct option long_options[] = { | 
| 659 |  | { "help",       0, NULL, 'h' }, | 
| 663 |  | { "sele1",      1, NULL, 0 }, | 
| 664 |  | { "sele2",      1, NULL, 0 }, | 
| 665 |  | { "order",      1, NULL, 0 }, | 
| 666 | + | { "nzbins",     1, NULL, 'z' }, | 
| 667 | + | { "memory",     1, NULL, 'm' }, | 
| 668 | + | { "selecorr",   0, NULL, 's' }, | 
| 669 |  | { "rcorr",      0, NULL, 'r' }, | 
| 670 |  | { "vcorr",      0, NULL, 'v' }, | 
| 671 |  | { "dcorr",      0, NULL, 'd' }, | 
| 672 |  | { "lcorr",      0, NULL, 'l' }, | 
| 673 | + | { "lcorrZ",     0, NULL, 0 }, | 
| 674 | + | { "cohZ",       0, NULL, 0 }, | 
| 675 | + | { "sdcorr",     0, NULL, 'M' }, | 
| 676 |  | { "r_rcorr",    0, NULL, 0 }, | 
| 677 |  | { "thetacorr",  0, NULL, 0 }, | 
| 678 | < | { NULL, 0, NULL, 0 } | 
| 678 | > | { "drcorr",     0, NULL, 0 }, | 
| 679 | > | { "helfandEcorr",       0, NULL, 0 }, | 
| 680 | > | { "momentum",   0, NULL, 'p' }, | 
| 681 | > | { "stresscorr", 0, NULL, 0 }, | 
| 682 | > | { "bondcorr",   0, NULL, 'b' }, | 
| 683 | > | { "freqfluccorr",       0, NULL, 'f' }, | 
| 684 | > | { 0,  0, 0, 0 } | 
| 685 |  | }; | 
| 686 |  |  | 
| 687 | < | stop_char = 0; | 
| 392 | < | c = getopt_long (argc, argv, "hVi:o:rvdl", long_options, &option_index); | 
| 687 | > | c = getopt_long (argc, argv, "hVi:o:z:m:srvdlMpbf", long_options, &option_index); | 
| 688 |  |  | 
| 689 |  | if (c == -1) break;       /* Exit from `while (1)' loop.  */ | 
| 690 |  |  | 
| 701 |  | exit (EXIT_SUCCESS); | 
| 702 |  |  | 
| 703 |  | case 'i':       /* input dump file.  */ | 
| 704 | < | if (local_args_info.input_given) | 
| 705 | < | { | 
| 706 | < | fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 707 | < | goto failure; | 
| 708 | < | } | 
| 709 | < | if (args_info->input_given && ! override) | 
| 710 | < | continue; | 
| 711 | < | local_args_info.input_given = 1; | 
| 712 | < | args_info->input_given = 1; | 
| 713 | < | if (args_info->input_arg) | 
| 419 | < | free (args_info->input_arg); /* free previous string */ | 
| 420 | < | args_info->input_arg = gengetopt_strdup (optarg); | 
| 421 | < | if (args_info->input_orig) | 
| 422 | < | free (args_info->input_orig); /* free previous string */ | 
| 423 | < | args_info->input_orig = gengetopt_strdup (optarg); | 
| 704 | > |  | 
| 705 | > |  | 
| 706 | > | if (update_arg( (void *)&(args_info->input_arg), | 
| 707 | > | &(args_info->input_orig), &(args_info->input_given), | 
| 708 | > | &(local_args_info.input_given), optarg, 0, 0, ARG_STRING, | 
| 709 | > | check_ambiguity, override, 0, 0, | 
| 710 | > | "input", 'i', | 
| 711 | > | additional_error)) | 
| 712 | > | goto failure; | 
| 713 | > |  | 
| 714 |  | break; | 
| 425 | – |  | 
| 715 |  | case 'o':       /* output file name.  */ | 
| 716 | < | if (local_args_info.output_given) | 
| 717 | < | { | 
| 718 | < | fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 719 | < | goto failure; | 
| 720 | < | } | 
| 721 | < | if (args_info->output_given && ! override) | 
| 722 | < | continue; | 
| 723 | < | local_args_info.output_given = 1; | 
| 724 | < | args_info->output_given = 1; | 
| 725 | < | if (args_info->output_arg) | 
| 437 | < | free (args_info->output_arg); /* free previous string */ | 
| 438 | < | args_info->output_arg = gengetopt_strdup (optarg); | 
| 439 | < | if (args_info->output_orig) | 
| 440 | < | free (args_info->output_orig); /* free previous string */ | 
| 441 | < | args_info->output_orig = gengetopt_strdup (optarg); | 
| 716 | > |  | 
| 717 | > |  | 
| 718 | > | if (update_arg( (void *)&(args_info->output_arg), | 
| 719 | > | &(args_info->output_orig), &(args_info->output_given), | 
| 720 | > | &(local_args_info.output_given), optarg, 0, 0, ARG_STRING, | 
| 721 | > | check_ambiguity, override, 0, 0, | 
| 722 | > | "output", 'o', | 
| 723 | > | additional_error)) | 
| 724 | > | goto failure; | 
| 725 | > |  | 
| 726 |  | break; | 
| 727 | < |  | 
| 727 | > | case 'z':       /* Number of Z bins.  */ | 
| 728 | > |  | 
| 729 | > |  | 
| 730 | > | if (update_arg( (void *)&(args_info->nzbins_arg), | 
| 731 | > | &(args_info->nzbins_orig), &(args_info->nzbins_given), | 
| 732 | > | &(local_args_info.nzbins_given), optarg, 0, "100", ARG_INT, | 
| 733 | > | check_ambiguity, override, 0, 0, | 
| 734 | > | "nzbins", 'z', | 
| 735 | > | additional_error)) | 
| 736 | > | goto failure; | 
| 737 | > |  | 
| 738 | > | break; | 
| 739 | > | case 'm':       /* Available memory (defaults to 2G).  */ | 
| 740 | > |  | 
| 741 | > |  | 
| 742 | > | if (update_arg( (void *)&(args_info->memory_arg), | 
| 743 | > | &(args_info->memory_orig), &(args_info->memory_given), | 
| 744 | > | &(local_args_info.memory_given), optarg, 0, "2G", ARG_STRING, | 
| 745 | > | check_ambiguity, override, 0, 0, | 
| 746 | > | "memory", 'm', | 
| 747 | > | additional_error)) | 
| 748 | > | goto failure; | 
| 749 | > |  | 
| 750 | > | break; | 
| 751 | > | case 's':       /* selection correlation function.  */ | 
| 752 | > |  | 
| 753 | > | if (args_info->dynamicProps_group_counter && override) | 
| 754 | > | reset_group_dynamicProps (args_info); | 
| 755 | > | args_info->dynamicProps_group_counter += 1; | 
| 756 | > |  | 
| 757 | > | if (update_arg( 0 , | 
| 758 | > | 0 , &(args_info->selecorr_given), | 
| 759 | > | &(local_args_info.selecorr_given), optarg, 0, 0, ARG_NO, | 
| 760 | > | check_ambiguity, override, 0, 0, | 
| 761 | > | "selecorr", 's', | 
| 762 | > | additional_error)) | 
| 763 | > | goto failure; | 
| 764 | > |  | 
| 765 | > | break; | 
| 766 |  | case 'r':       /* rmsd.  */ | 
| 767 | < | if (local_args_info.rcorr_given) | 
| 446 | < | { | 
| 447 | < | fprintf (stderr, "%s: `--rcorr' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 448 | < | goto failure; | 
| 449 | < | } | 
| 450 | < | if (args_info->rcorr_given && ! override) | 
| 451 | < | continue; | 
| 452 | < | local_args_info.rcorr_given = 1; | 
| 453 | < | args_info->rcorr_given = 1; | 
| 767 | > |  | 
| 768 |  | if (args_info->dynamicProps_group_counter && override) | 
| 769 |  | reset_group_dynamicProps (args_info); | 
| 770 |  | args_info->dynamicProps_group_counter += 1; | 
| 771 | + |  | 
| 772 | + | if (update_arg( 0 , | 
| 773 | + | 0 , &(args_info->rcorr_given), | 
| 774 | + | &(local_args_info.rcorr_given), optarg, 0, 0, ARG_NO, | 
| 775 | + | check_ambiguity, override, 0, 0, | 
| 776 | + | "rcorr", 'r', | 
| 777 | + | additional_error)) | 
| 778 | + | goto failure; | 
| 779 | + |  | 
| 780 |  | break; | 
| 458 | – |  | 
| 781 |  | case 'v':       /* velocity correlation function.  */ | 
| 782 | < | if (local_args_info.vcorr_given) | 
| 461 | < | { | 
| 462 | < | fprintf (stderr, "%s: `--vcorr' (`-v') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 463 | < | goto failure; | 
| 464 | < | } | 
| 465 | < | if (args_info->vcorr_given && ! override) | 
| 466 | < | continue; | 
| 467 | < | local_args_info.vcorr_given = 1; | 
| 468 | < | args_info->vcorr_given = 1; | 
| 782 | > |  | 
| 783 |  | if (args_info->dynamicProps_group_counter && override) | 
| 784 |  | reset_group_dynamicProps (args_info); | 
| 785 |  | args_info->dynamicProps_group_counter += 1; | 
| 786 | + |  | 
| 787 | + | if (update_arg( 0 , | 
| 788 | + | 0 , &(args_info->vcorr_given), | 
| 789 | + | &(local_args_info.vcorr_given), optarg, 0, 0, ARG_NO, | 
| 790 | + | check_ambiguity, override, 0, 0, | 
| 791 | + | "vcorr", 'v', | 
| 792 | + | additional_error)) | 
| 793 | + | goto failure; | 
| 794 | + |  | 
| 795 |  | break; | 
| 473 | – |  | 
| 796 |  | case 'd':       /* dipole correlation function.  */ | 
| 797 | < | if (local_args_info.dcorr_given) | 
| 476 | < | { | 
| 477 | < | fprintf (stderr, "%s: `--dcorr' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 478 | < | goto failure; | 
| 479 | < | } | 
| 480 | < | if (args_info->dcorr_given && ! override) | 
| 481 | < | continue; | 
| 482 | < | local_args_info.dcorr_given = 1; | 
| 483 | < | args_info->dcorr_given = 1; | 
| 797 | > |  | 
| 798 |  | if (args_info->dynamicProps_group_counter && override) | 
| 799 |  | reset_group_dynamicProps (args_info); | 
| 800 |  | args_info->dynamicProps_group_counter += 1; | 
| 801 | + |  | 
| 802 | + | if (update_arg( 0 , | 
| 803 | + | 0 , &(args_info->dcorr_given), | 
| 804 | + | &(local_args_info.dcorr_given), optarg, 0, 0, ARG_NO, | 
| 805 | + | check_ambiguity, override, 0, 0, | 
| 806 | + | "dcorr", 'd', | 
| 807 | + | additional_error)) | 
| 808 | + | goto failure; | 
| 809 | + |  | 
| 810 |  | break; | 
| 488 | – |  | 
| 811 |  | case 'l':       /* Lengendre correlation function.  */ | 
| 812 | < | if (local_args_info.lcorr_given) | 
| 491 | < | { | 
| 492 | < | fprintf (stderr, "%s: `--lcorr' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 493 | < | goto failure; | 
| 494 | < | } | 
| 495 | < | if (args_info->lcorr_given && ! override) | 
| 496 | < | continue; | 
| 497 | < | local_args_info.lcorr_given = 1; | 
| 498 | < | args_info->lcorr_given = 1; | 
| 812 | > |  | 
| 813 |  | if (args_info->dynamicProps_group_counter && override) | 
| 814 |  | reset_group_dynamicProps (args_info); | 
| 815 |  | args_info->dynamicProps_group_counter += 1; | 
| 816 | + |  | 
| 817 | + | if (update_arg( 0 , | 
| 818 | + | 0 , &(args_info->lcorr_given), | 
| 819 | + | &(local_args_info.lcorr_given), optarg, 0, 0, ARG_NO, | 
| 820 | + | check_ambiguity, override, 0, 0, | 
| 821 | + | "lcorr", 'l', | 
| 822 | + | additional_error)) | 
| 823 | + | goto failure; | 
| 824 | + |  | 
| 825 |  | break; | 
| 826 | < |  | 
| 826 | > | case 'M':       /* System dipole correlation function.  */ | 
| 827 | > |  | 
| 828 | > | if (args_info->dynamicProps_group_counter && override) | 
| 829 | > | reset_group_dynamicProps (args_info); | 
| 830 | > | args_info->dynamicProps_group_counter += 1; | 
| 831 | > |  | 
| 832 | > | if (update_arg( 0 , | 
| 833 | > | 0 , &(args_info->sdcorr_given), | 
| 834 | > | &(local_args_info.sdcorr_given), optarg, 0, 0, ARG_NO, | 
| 835 | > | check_ambiguity, override, 0, 0, | 
| 836 | > | "sdcorr", 'M', | 
| 837 | > | additional_error)) | 
| 838 | > | goto failure; | 
| 839 | > |  | 
| 840 | > | break; | 
| 841 | > | case 'p':       /* Helfand momentum for viscosity.  */ | 
| 842 | > |  | 
| 843 | > | if (args_info->dynamicProps_group_counter && override) | 
| 844 | > | reset_group_dynamicProps (args_info); | 
| 845 | > | args_info->dynamicProps_group_counter += 1; | 
| 846 | > |  | 
| 847 | > | if (update_arg( 0 , | 
| 848 | > | 0 , &(args_info->momentum_given), | 
| 849 | > | &(local_args_info.momentum_given), optarg, 0, 0, ARG_NO, | 
| 850 | > | check_ambiguity, override, 0, 0, | 
| 851 | > | "momentum", 'p', | 
| 852 | > | additional_error)) | 
| 853 | > | goto failure; | 
| 854 | > |  | 
| 855 | > | break; | 
| 856 | > | case 'b':       /* Bond extension correlation function.  */ | 
| 857 | > |  | 
| 858 | > | if (args_info->dynamicProps_group_counter && override) | 
| 859 | > | reset_group_dynamicProps (args_info); | 
| 860 | > | args_info->dynamicProps_group_counter += 1; | 
| 861 | > |  | 
| 862 | > | if (update_arg( 0 , | 
| 863 | > | 0 , &(args_info->bondcorr_given), | 
| 864 | > | &(local_args_info.bondcorr_given), optarg, 0, 0, ARG_NO, | 
| 865 | > | check_ambiguity, override, 0, 0, | 
| 866 | > | "bondcorr", 'b', | 
| 867 | > | additional_error)) | 
| 868 | > | goto failure; | 
| 869 | > |  | 
| 870 | > | break; | 
| 871 | > | case 'f':       /* Frequency Fluctuation correlation function.  */ | 
| 872 | > |  | 
| 873 | > | if (args_info->dynamicProps_group_counter && override) | 
| 874 | > | reset_group_dynamicProps (args_info); | 
| 875 | > | args_info->dynamicProps_group_counter += 1; | 
| 876 | > |  | 
| 877 | > | if (update_arg( 0 , | 
| 878 | > | 0 , &(args_info->freqfluccorr_given), | 
| 879 | > | &(local_args_info.freqfluccorr_given), optarg, 0, 0, ARG_NO, | 
| 880 | > | check_ambiguity, override, 0, 0, | 
| 881 | > | "freqfluccorr", 'f', | 
| 882 | > | additional_error)) | 
| 883 | > | goto failure; | 
| 884 | > |  | 
| 885 | > | break; | 
| 886 |  |  | 
| 887 |  | case 0: /* Long option with no short option */ | 
| 888 |  | /* select first stuntdouble set.  */ | 
| 889 |  | if (strcmp (long_options[option_index].name, "sele1") == 0) | 
| 890 |  | { | 
| 891 | < | if (local_args_info.sele1_given) | 
| 892 | < | { | 
| 893 | < | fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 894 | < | goto failure; | 
| 895 | < | } | 
| 896 | < | if (args_info->sele1_given && ! override) | 
| 897 | < | continue; | 
| 898 | < | local_args_info.sele1_given = 1; | 
| 899 | < | args_info->sele1_given = 1; | 
| 900 | < | if (args_info->sele1_arg) | 
| 519 | < | free (args_info->sele1_arg); /* free previous string */ | 
| 520 | < | args_info->sele1_arg = gengetopt_strdup (optarg); | 
| 521 | < | if (args_info->sele1_orig) | 
| 522 | < | free (args_info->sele1_orig); /* free previous string */ | 
| 523 | < | args_info->sele1_orig = gengetopt_strdup (optarg); | 
| 891 | > |  | 
| 892 | > |  | 
| 893 | > | if (update_arg( (void *)&(args_info->sele1_arg), | 
| 894 | > | &(args_info->sele1_orig), &(args_info->sele1_given), | 
| 895 | > | &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING, | 
| 896 | > | check_ambiguity, override, 0, 0, | 
| 897 | > | "sele1", '-', | 
| 898 | > | additional_error)) | 
| 899 | > | goto failure; | 
| 900 | > |  | 
| 901 |  | } | 
| 902 |  | /* select second stuntdouble set (if sele2 is not set, use script from sele1).  */ | 
| 903 |  | else if (strcmp (long_options[option_index].name, "sele2") == 0) | 
| 904 |  | { | 
| 905 | < | if (local_args_info.sele2_given) | 
| 906 | < | { | 
| 907 | < | fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 908 | < | goto failure; | 
| 909 | < | } | 
| 910 | < | if (args_info->sele2_given && ! override) | 
| 911 | < | continue; | 
| 912 | < | local_args_info.sele2_given = 1; | 
| 913 | < | args_info->sele2_given = 1; | 
| 914 | < | if (args_info->sele2_arg) | 
| 538 | < | free (args_info->sele2_arg); /* free previous string */ | 
| 539 | < | args_info->sele2_arg = gengetopt_strdup (optarg); | 
| 540 | < | if (args_info->sele2_orig) | 
| 541 | < | free (args_info->sele2_orig); /* free previous string */ | 
| 542 | < | args_info->sele2_orig = gengetopt_strdup (optarg); | 
| 905 | > |  | 
| 906 | > |  | 
| 907 | > | if (update_arg( (void *)&(args_info->sele2_arg), | 
| 908 | > | &(args_info->sele2_orig), &(args_info->sele2_given), | 
| 909 | > | &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING, | 
| 910 | > | check_ambiguity, override, 0, 0, | 
| 911 | > | "sele2", '-', | 
| 912 | > | additional_error)) | 
| 913 | > | goto failure; | 
| 914 | > |  | 
| 915 |  | } | 
| 916 |  | /* Lengendre Polynomial Order.  */ | 
| 917 |  | else if (strcmp (long_options[option_index].name, "order") == 0) | 
| 918 |  | { | 
| 919 | < | if (local_args_info.order_given) | 
| 920 | < | { | 
| 921 | < | fprintf (stderr, "%s: `--order' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 922 | < | goto failure; | 
| 923 | < | } | 
| 924 | < | if (args_info->order_given && ! override) | 
| 925 | < | continue; | 
| 926 | < | local_args_info.order_given = 1; | 
| 555 | < | args_info->order_given = 1; | 
| 556 | < | args_info->order_arg = strtol (optarg, &stop_char, 0); | 
| 557 | < | if (!(stop_char && *stop_char == '\0')) { | 
| 558 | < | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 919 | > |  | 
| 920 | > |  | 
| 921 | > | if (update_arg( (void *)&(args_info->order_arg), | 
| 922 | > | &(args_info->order_orig), &(args_info->order_given), | 
| 923 | > | &(local_args_info.order_given), optarg, 0, 0, ARG_INT, | 
| 924 | > | check_ambiguity, override, 0, 0, | 
| 925 | > | "order", '-', | 
| 926 | > | additional_error)) | 
| 927 |  | goto failure; | 
| 928 | < | } | 
| 561 | < | if (args_info->order_orig) | 
| 562 | < | free (args_info->order_orig); /* free previous string */ | 
| 563 | < | args_info->order_orig = gengetopt_strdup (optarg); | 
| 928 | > |  | 
| 929 |  | } | 
| 930 | + | /* Lengendre correlation function binned by Z.  */ | 
| 931 | + | else if (strcmp (long_options[option_index].name, "lcorrZ") == 0) | 
| 932 | + | { | 
| 933 | + |  | 
| 934 | + | if (args_info->dynamicProps_group_counter && override) | 
| 935 | + | reset_group_dynamicProps (args_info); | 
| 936 | + | args_info->dynamicProps_group_counter += 1; | 
| 937 | + |  | 
| 938 | + | if (update_arg( 0 , | 
| 939 | + | 0 , &(args_info->lcorrZ_given), | 
| 940 | + | &(local_args_info.lcorrZ_given), optarg, 0, 0, ARG_NO, | 
| 941 | + | check_ambiguity, override, 0, 0, | 
| 942 | + | "lcorrZ", '-', | 
| 943 | + | additional_error)) | 
| 944 | + | goto failure; | 
| 945 | + |  | 
| 946 | + | } | 
| 947 | + | /* Lengendre correlation function for OH bond vectors binned by Z.  */ | 
| 948 | + | else if (strcmp (long_options[option_index].name, "cohZ") == 0) | 
| 949 | + | { | 
| 950 | + |  | 
| 951 | + | if (args_info->dynamicProps_group_counter && override) | 
| 952 | + | reset_group_dynamicProps (args_info); | 
| 953 | + | args_info->dynamicProps_group_counter += 1; | 
| 954 | + |  | 
| 955 | + | if (update_arg( 0 , | 
| 956 | + | 0 , &(args_info->cohZ_given), | 
| 957 | + | &(local_args_info.cohZ_given), optarg, 0, 0, ARG_NO, | 
| 958 | + | check_ambiguity, override, 0, 0, | 
| 959 | + | "cohZ", '-', | 
| 960 | + | additional_error)) | 
| 961 | + | goto failure; | 
| 962 | + |  | 
| 963 | + | } | 
| 964 |  | /* Radial rmsd.  */ | 
| 965 |  | else if (strcmp (long_options[option_index].name, "r_rcorr") == 0) | 
| 966 |  | { | 
| 967 | < | if (local_args_info.r_rcorr_given) | 
| 569 | < | { | 
| 570 | < | fprintf (stderr, "%s: `--r_rcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 571 | < | goto failure; | 
| 572 | < | } | 
| 573 | < | if (args_info->r_rcorr_given && ! override) | 
| 574 | < | continue; | 
| 575 | < | local_args_info.r_rcorr_given = 1; | 
| 576 | < | args_info->r_rcorr_given = 1; | 
| 967 | > |  | 
| 968 |  | if (args_info->dynamicProps_group_counter && override) | 
| 969 |  | reset_group_dynamicProps (args_info); | 
| 970 |  | args_info->dynamicProps_group_counter += 1; | 
| 971 | < | break; | 
| 971 | > |  | 
| 972 | > | if (update_arg( 0 , | 
| 973 | > | 0 , &(args_info->r_rcorr_given), | 
| 974 | > | &(local_args_info.r_rcorr_given), optarg, 0, 0, ARG_NO, | 
| 975 | > | check_ambiguity, override, 0, 0, | 
| 976 | > | "r_rcorr", '-', | 
| 977 | > | additional_error)) | 
| 978 | > | goto failure; | 
| 979 | > |  | 
| 980 |  | } | 
| 981 |  | /* Angular rmsd.  */ | 
| 982 |  | else if (strcmp (long_options[option_index].name, "thetacorr") == 0) | 
| 983 |  | { | 
| 984 | < | if (local_args_info.thetacorr_given) | 
| 586 | < | { | 
| 587 | < | fprintf (stderr, "%s: `--thetacorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 588 | < | goto failure; | 
| 589 | < | } | 
| 590 | < | if (args_info->thetacorr_given && ! override) | 
| 591 | < | continue; | 
| 592 | < | local_args_info.thetacorr_given = 1; | 
| 593 | < | args_info->thetacorr_given = 1; | 
| 984 | > |  | 
| 985 |  | if (args_info->dynamicProps_group_counter && override) | 
| 986 |  | reset_group_dynamicProps (args_info); | 
| 987 |  | args_info->dynamicProps_group_counter += 1; | 
| 988 | < | break; | 
| 988 | > |  | 
| 989 | > | if (update_arg( 0 , | 
| 990 | > | 0 , &(args_info->thetacorr_given), | 
| 991 | > | &(local_args_info.thetacorr_given), optarg, 0, 0, ARG_NO, | 
| 992 | > | check_ambiguity, override, 0, 0, | 
| 993 | > | "thetacorr", '-', | 
| 994 | > | additional_error)) | 
| 995 | > | goto failure; | 
| 996 | > |  | 
| 997 |  | } | 
| 998 | + | /* Directional rmsd for particles with unit vectors.  */ | 
| 999 | + | else if (strcmp (long_options[option_index].name, "drcorr") == 0) | 
| 1000 | + | { | 
| 1001 |  |  | 
| 1002 | + | if (args_info->dynamicProps_group_counter && override) | 
| 1003 | + | reset_group_dynamicProps (args_info); | 
| 1004 | + | args_info->dynamicProps_group_counter += 1; | 
| 1005 | + |  | 
| 1006 | + | if (update_arg( 0 , | 
| 1007 | + | 0 , &(args_info->drcorr_given), | 
| 1008 | + | &(local_args_info.drcorr_given), optarg, 0, 0, ARG_NO, | 
| 1009 | + | check_ambiguity, override, 0, 0, | 
| 1010 | + | "drcorr", '-', | 
| 1011 | + | additional_error)) | 
| 1012 | + | goto failure; | 
| 1013 | + |  | 
| 1014 | + | } | 
| 1015 | + | /* Helfand moment for thermal conductvity.  */ | 
| 1016 | + | else if (strcmp (long_options[option_index].name, "helfandEcorr") == 0) | 
| 1017 | + | { | 
| 1018 | + |  | 
| 1019 | + | if (args_info->dynamicProps_group_counter && override) | 
| 1020 | + | reset_group_dynamicProps (args_info); | 
| 1021 | + | args_info->dynamicProps_group_counter += 1; | 
| 1022 | + |  | 
| 1023 | + | if (update_arg( 0 , | 
| 1024 | + | 0 , &(args_info->helfandEcorr_given), | 
| 1025 | + | &(local_args_info.helfandEcorr_given), optarg, 0, 0, ARG_NO, | 
| 1026 | + | check_ambiguity, override, 0, 0, | 
| 1027 | + | "helfandEcorr", '-', | 
| 1028 | + | additional_error)) | 
| 1029 | + | goto failure; | 
| 1030 | + |  | 
| 1031 | + | } | 
| 1032 | + | /* Stress tensor correlation function.  */ | 
| 1033 | + | else if (strcmp (long_options[option_index].name, "stresscorr") == 0) | 
| 1034 | + | { | 
| 1035 | + |  | 
| 1036 | + | if (args_info->dynamicProps_group_counter && override) | 
| 1037 | + | reset_group_dynamicProps (args_info); | 
| 1038 | + | args_info->dynamicProps_group_counter += 1; | 
| 1039 | + |  | 
| 1040 | + | if (update_arg( 0 , | 
| 1041 | + | 0 , &(args_info->stresscorr_given), | 
| 1042 | + | &(local_args_info.stresscorr_given), optarg, 0, 0, ARG_NO, | 
| 1043 | + | check_ambiguity, override, 0, 0, | 
| 1044 | + | "stresscorr", '-', | 
| 1045 | + | additional_error)) | 
| 1046 | + | goto failure; | 
| 1047 | + |  | 
| 1048 | + | } | 
| 1049 | + |  | 
| 1050 |  | break; | 
| 1051 |  | case '?':       /* Invalid option.  */ | 
| 1052 |  | /* `getopt_long' already printed an error message.  */ | 
| 1060 |  |  | 
| 1061 |  | if (args_info->dynamicProps_group_counter > 1) | 
| 1062 |  | { | 
| 1063 | < | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 1063 | > | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required%s.\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 1064 |  | error = 1; | 
| 1065 |  | } | 
| 1066 |  |  | 
| 1079 |  | if (optind < argc) | 
| 1080 |  | { | 
| 1081 |  | int i = 0 ; | 
| 1082 | + | int found_prog_name = 0; | 
| 1083 | + | /* whether program name, i.e., argv[0], is in the remaining args | 
| 1084 | + | (this may happen with some implementations of getopt, | 
| 1085 | + | but surely not with the one included by gengetopt) */ | 
| 1086 |  |  | 
| 1087 | < | args_info->inputs_num = argc - optind ; | 
| 1087 | > | i = optind; | 
| 1088 | > | while (i < argc) | 
| 1089 | > | if (argv[i++] == argv[0]) { | 
| 1090 | > | found_prog_name = 1; | 
| 1091 | > | break; | 
| 1092 | > | } | 
| 1093 | > | i = 0; | 
| 1094 | > |  | 
| 1095 | > | args_info->inputs_num = argc - optind - found_prog_name; | 
| 1096 |  | args_info->inputs = | 
| 1097 |  | (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; | 
| 1098 |  | while (optind < argc) | 
| 1099 | < | args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; | 
| 1099 | > | if (argv[optind++] != argv[0]) | 
| 1100 | > | args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; | 
| 1101 |  | } | 
| 1102 |  |  | 
| 1103 |  | return 0; |