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