OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
DynamicPropsCmd.cpp
1/*
2 File autogenerated by gengetopt version 2.23
3 generated with the following command:
4 gengetopt --no-handle-error --include-getopt --show-required --unamed-opts --file-name=DynamicPropsCmd --c-extension=cpp --header-extension=hpp
5
6 The developers of gengetopt consider the fixed text that goes in all
7 gengetopt output files to be in the public domain:
8 we make no copyright claims on it.
9*/
10
11/* If we use autoconf. */
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19
20#ifndef FIX_UNUSED
21#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22#endif
23
24
25#include "DynamicPropsCmd.hpp"
26
27const char *gengetopt_args_info_purpose = "Computes a variety of time correlation functions from the\nconfigurations stored in a dump file. Typical examples of time\ncorrelation functions are the mean square displacement and the\nvelocity autocorrelation functions. The selection syntax can be used\nto specify the StuntDoubles that will be used for the calculation. A\ngeneral time correlation function can be thought of as:\n\n C(t) = < A(0) * B(t) >\n\nwhere A(t) and B(t) are time-dependent properties, and the < >\nindicates an average over the initial time and atoms (if A and B are\nproperties of atoms).\n\nExample:\n DynamicProps -i longRun.dump --rcorr --sele1=\"select SPCE_RB_0\"";
28
29const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTION]... [FILE]...";
30
31const char *gengetopt_args_info_versiontext = "";
32
33const char *gengetopt_args_info_description = "";
34
35const char *gengetopt_args_info_help[] = {
36 " -h, --help Print help and exit",
37 " -V, --version Print version and exit",
38 " -i, --input=filename input dump file (mandatory)",
39 " -o, --output=filename output file name",
40 " --sele1=selection script select first stuntdouble set",
41 " --sele2=selection script select second stuntdouble set (if sele2 is not\n set, use script from sele1)",
42 " --sele3=selection script select third stuntdouble set",
43 " --order=INT Lengendre Polynomial Order",
44 " -n, --nbins=INT Number of bins (default=`100')",
45 " -z, --nzbins=INT Number of Z bins (default=`100')",
46 " -c, --rcut=DOUBLE cutoff radius (angstroms)",
47 " --OOcut=DOUBLE Oxygen-Oxygen cutoff radius (angstroms)\n (default=`3.5')",
48 " --thetacut=DOUBLE HOO cutoff angle (degrees) (default=`30')",
49 " --OHcut=DOUBLE Oxygen-Hydrogen cutoff radius (angstroms)\n (default=`2.45')",
50 " --privilegedAxis=ENUM which axis is special for spatial analysis\n (default = z axis) (possible values=\"x\",\n \"y\", \"z\" default=`z')",
51 " --length=DOUBLE maximum length (default=`100')",
52 " --dipoleX=DOUBLE X-component of the dipole with respect to body\n frame (default=`0.0')",
53 " --dipoleY=DOUBLE Y-component of the dipole with respect to body\n frame (default=`0.0')",
54 " --dipoleZ=DOUBLE Z-component of the dipole with respect to body\n frame (default=`-1.0')",
55 "\n Group: correlation function\n an option of this group is required",
56 " -s, --selecorr selection correlation function",
57 " -r, --rcorr mean squared displacement",
58 " --rcorrZ mean squared displacement binned by Z",
59 " -v, --vcorr velocity correlation function",
60 " --vcorrZ velocity correlation function along z-axis",
61 " --vcorrR velocity correlation function projected\n radially",
62 " --vaOutProdcorr Velocity - Velocity auto outer product\n correlation function",
63 " --waOutProdcorr Angular Velocity - Angular Velocity auto outer\n product correlation function",
64 " --vwOutProdcorr Velocity - Angular Velocity outer product\n correlation function",
65 " --wvOutProdcorr Angular Velocity - Velocity outer product\n correlation function",
66 " -w, --wcorr charge velocity correlation function",
67 " -d, --dcorr dipole correlation function",
68 " -l, --lcorr Lengendre correlation function",
69 " --lcorrZ Lengendre correlation function binned by Z",
70 " --cohZ Lengendre correlation function for OH bond\n vectors binned by Z",
71 " -M, --sdcorr System dipole correlation function",
72 " --r_rcorr Radial msd",
73 " --thetacorr Angular msd",
74 " --drcorr Directional msd for particles with unit vectors",
75 " --stresscorr Stress tensor correlation function",
76 " -b, --bondcorr Bond extension correlation function",
77 " -f, --freqfluccorr Frequency Fluctuation correlation function",
78 " -j, --jumptime Hydrogen bond jump time correlation function",
79 " --jumptimeZ Hydrogen bond jump time correlation function\n binned by Z",
80 " --jumptimeR Hydrogen bond jump time correlation function\n binned by R around a third selection",
81 " --persistence Hydrogen bond persistence correlation function",
82 " --pjcorr Momentum - Angular Momentum cross correlation\n function",
83 " --ftcorr Force - Torque cross correlation function",
84 " --ckcorr Charge - Kinetic energy cross correlation\n function",
85 " --cscorr Charge - Orientation order parameter\n (Cos\theta) cross correlation function",
86 " --facorr Force - Force auto correlation function",
87 " --tfcorr Torque - Force Cross correlation function",
88 " --tacorr Torque auto correlation function",
89 " --disp Displacement correlation function",
90 " --dispZ Displacement correlation function binned by Z",
91 " --current Current density auto correlation function",
92 " --onsager Onsager coefficient correlation functions",
93 " --ddisp Collective Dipole displacement function\n (Helfand moment of Current Density)",
94 " --rotAngleDisp Displacement correlation function for rotation\n angles",
95 " --meandisp mean displacement",
96 0
97};
98
99typedef enum {ARG_NO
100 , ARG_STRING
101 , ARG_INT
102 , ARG_DOUBLE
103 , ARG_ENUM
104} cmdline_parser_arg_type;
105
106static
107void clear_given (struct gengetopt_args_info *args_info);
108static
109void clear_args (struct gengetopt_args_info *args_info);
110
111static int
112cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
113 struct cmdline_parser_params *params, const char *additional_error);
114
115static int
116cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
117
118const char *cmdline_parser_privilegedAxis_values[] = {"x", "y", "z", 0}; /*< Possible values for privilegedAxis. */
119
120static char *
121gengetopt_strdup (const char *s);
122
123static
124void clear_given (struct gengetopt_args_info *args_info)
125{
126 args_info->help_given = 0 ;
127 args_info->version_given = 0 ;
128 args_info->input_given = 0 ;
129 args_info->output_given = 0 ;
130 args_info->sele1_given = 0 ;
131 args_info->sele2_given = 0 ;
132 args_info->sele3_given = 0 ;
133 args_info->order_given = 0 ;
134 args_info->nbins_given = 0 ;
135 args_info->nzbins_given = 0 ;
136 args_info->rcut_given = 0 ;
137 args_info->OOcut_given = 0 ;
138 args_info->thetacut_given = 0 ;
139 args_info->OHcut_given = 0 ;
140 args_info->privilegedAxis_given = 0 ;
141 args_info->length_given = 0 ;
142 args_info->dipoleX_given = 0 ;
143 args_info->dipoleY_given = 0 ;
144 args_info->dipoleZ_given = 0 ;
145 args_info->selecorr_given = 0 ;
146 args_info->rcorr_given = 0 ;
147 args_info->rcorrZ_given = 0 ;
148 args_info->vcorr_given = 0 ;
149 args_info->vcorrZ_given = 0 ;
150 args_info->vcorrR_given = 0 ;
151 args_info->vaOutProdcorr_given = 0 ;
152 args_info->waOutProdcorr_given = 0 ;
153 args_info->vwOutProdcorr_given = 0 ;
154 args_info->wvOutProdcorr_given = 0 ;
155 args_info->wcorr_given = 0 ;
156 args_info->dcorr_given = 0 ;
157 args_info->lcorr_given = 0 ;
158 args_info->lcorrZ_given = 0 ;
159 args_info->cohZ_given = 0 ;
160 args_info->sdcorr_given = 0 ;
161 args_info->r_rcorr_given = 0 ;
162 args_info->thetacorr_given = 0 ;
163 args_info->drcorr_given = 0 ;
164 args_info->stresscorr_given = 0 ;
165 args_info->bondcorr_given = 0 ;
166 args_info->freqfluccorr_given = 0 ;
167 args_info->jumptime_given = 0 ;
168 args_info->jumptimeZ_given = 0 ;
169 args_info->jumptimeR_given = 0 ;
170 args_info->persistence_given = 0 ;
171 args_info->pjcorr_given = 0 ;
172 args_info->ftcorr_given = 0 ;
173 args_info->ckcorr_given = 0 ;
174 args_info->cscorr_given = 0 ;
175 args_info->facorr_given = 0 ;
176 args_info->tfcorr_given = 0 ;
177 args_info->tacorr_given = 0 ;
178 args_info->disp_given = 0 ;
179 args_info->dispZ_given = 0 ;
180 args_info->current_given = 0 ;
181 args_info->onsager_given = 0 ;
182 args_info->ddisp_given = 0 ;
183 args_info->rotAngleDisp_given = 0 ;
184 args_info->meandisp_given = 0 ;
186}
187
188static
189void clear_args (struct gengetopt_args_info *args_info)
190{
191 FIX_UNUSED (args_info);
192 args_info->input_arg = NULL;
193 args_info->input_orig = NULL;
194 args_info->output_arg = NULL;
195 args_info->output_orig = NULL;
196 args_info->sele1_arg = NULL;
197 args_info->sele1_orig = NULL;
198 args_info->sele2_arg = NULL;
199 args_info->sele2_orig = NULL;
200 args_info->sele3_arg = NULL;
201 args_info->sele3_orig = NULL;
202 args_info->order_orig = NULL;
203 args_info->nbins_arg = 100;
204 args_info->nbins_orig = NULL;
205 args_info->nzbins_arg = 100;
206 args_info->nzbins_orig = NULL;
207 args_info->rcut_orig = NULL;
208 args_info->OOcut_arg = 3.5;
209 args_info->OOcut_orig = NULL;
210 args_info->thetacut_arg = 30;
211 args_info->thetacut_orig = NULL;
212 args_info->OHcut_arg = 2.45;
213 args_info->OHcut_orig = NULL;
214 args_info->privilegedAxis_arg = privilegedAxis_arg_z;
215 args_info->privilegedAxis_orig = NULL;
216 args_info->length_arg = 100;
217 args_info->length_orig = NULL;
218 args_info->dipoleX_arg = 0.0;
219 args_info->dipoleX_orig = NULL;
220 args_info->dipoleY_arg = 0.0;
221 args_info->dipoleY_orig = NULL;
222 args_info->dipoleZ_arg = -1.0;
223 args_info->dipoleZ_orig = NULL;
224
225}
226
227static
228void init_args_info(struct gengetopt_args_info *args_info)
229{
230
231
232 args_info->help_help = gengetopt_args_info_help[0] ;
233 args_info->version_help = gengetopt_args_info_help[1] ;
234 args_info->input_help = gengetopt_args_info_help[2] ;
235 args_info->output_help = gengetopt_args_info_help[3] ;
236 args_info->sele1_help = gengetopt_args_info_help[4] ;
237 args_info->sele2_help = gengetopt_args_info_help[5] ;
238 args_info->sele3_help = gengetopt_args_info_help[6] ;
239 args_info->order_help = gengetopt_args_info_help[7] ;
240 args_info->nbins_help = gengetopt_args_info_help[8] ;
241 args_info->nzbins_help = gengetopt_args_info_help[9] ;
242 args_info->rcut_help = gengetopt_args_info_help[10] ;
243 args_info->OOcut_help = gengetopt_args_info_help[11] ;
244 args_info->thetacut_help = gengetopt_args_info_help[12] ;
245 args_info->OHcut_help = gengetopt_args_info_help[13] ;
246 args_info->privilegedAxis_help = gengetopt_args_info_help[14] ;
247 args_info->length_help = gengetopt_args_info_help[15] ;
248 args_info->dipoleX_help = gengetopt_args_info_help[16] ;
249 args_info->dipoleY_help = gengetopt_args_info_help[17] ;
250 args_info->dipoleZ_help = gengetopt_args_info_help[18] ;
251 args_info->selecorr_help = gengetopt_args_info_help[20] ;
252 args_info->rcorr_help = gengetopt_args_info_help[21] ;
253 args_info->rcorrZ_help = gengetopt_args_info_help[22] ;
254 args_info->vcorr_help = gengetopt_args_info_help[23] ;
255 args_info->vcorrZ_help = gengetopt_args_info_help[24] ;
256 args_info->vcorrR_help = gengetopt_args_info_help[25] ;
257 args_info->vaOutProdcorr_help = gengetopt_args_info_help[26] ;
258 args_info->waOutProdcorr_help = gengetopt_args_info_help[27] ;
259 args_info->vwOutProdcorr_help = gengetopt_args_info_help[28] ;
260 args_info->wvOutProdcorr_help = gengetopt_args_info_help[29] ;
261 args_info->wcorr_help = gengetopt_args_info_help[30] ;
262 args_info->dcorr_help = gengetopt_args_info_help[31] ;
263 args_info->lcorr_help = gengetopt_args_info_help[32] ;
264 args_info->lcorrZ_help = gengetopt_args_info_help[33] ;
265 args_info->cohZ_help = gengetopt_args_info_help[34] ;
266 args_info->sdcorr_help = gengetopt_args_info_help[35] ;
267 args_info->r_rcorr_help = gengetopt_args_info_help[36] ;
268 args_info->thetacorr_help = gengetopt_args_info_help[37] ;
269 args_info->drcorr_help = gengetopt_args_info_help[38] ;
270 args_info->stresscorr_help = gengetopt_args_info_help[39] ;
271 args_info->bondcorr_help = gengetopt_args_info_help[40] ;
272 args_info->freqfluccorr_help = gengetopt_args_info_help[41] ;
273 args_info->jumptime_help = gengetopt_args_info_help[42] ;
274 args_info->jumptimeZ_help = gengetopt_args_info_help[43] ;
275 args_info->jumptimeR_help = gengetopt_args_info_help[44] ;
276 args_info->persistence_help = gengetopt_args_info_help[45] ;
277 args_info->pjcorr_help = gengetopt_args_info_help[46] ;
278 args_info->ftcorr_help = gengetopt_args_info_help[47] ;
279 args_info->ckcorr_help = gengetopt_args_info_help[48] ;
280 args_info->cscorr_help = gengetopt_args_info_help[49] ;
281 args_info->facorr_help = gengetopt_args_info_help[50] ;
282 args_info->tfcorr_help = gengetopt_args_info_help[51] ;
283 args_info->tacorr_help = gengetopt_args_info_help[52] ;
284 args_info->disp_help = gengetopt_args_info_help[53] ;
285 args_info->dispZ_help = gengetopt_args_info_help[54] ;
286 args_info->current_help = gengetopt_args_info_help[55] ;
287 args_info->onsager_help = gengetopt_args_info_help[56] ;
288 args_info->ddisp_help = gengetopt_args_info_help[57] ;
289 args_info->rotAngleDisp_help = gengetopt_args_info_help[58] ;
290 args_info->meandisp_help = gengetopt_args_info_help[59] ;
291
292}
293
294void
295cmdline_parser_print_version (void)
296{
297 printf ("%s %s\n",
300
301 if (strlen(gengetopt_args_info_versiontext) > 0)
302 printf("\n%s\n", gengetopt_args_info_versiontext);
303}
304
305static void print_help_common(void)
306{
307 size_t len_purpose = strlen(gengetopt_args_info_purpose);
308 size_t len_usage = strlen(gengetopt_args_info_usage);
309
310 if (len_usage > 0) {
311 printf("%s\n", gengetopt_args_info_usage);
312 }
313 if (len_purpose > 0) {
314 printf("%s\n", gengetopt_args_info_purpose);
315 }
316
317 if (len_usage || len_purpose) {
318 printf("\n");
319 }
320
321 if (strlen(gengetopt_args_info_description) > 0) {
322 printf("%s\n\n", gengetopt_args_info_description);
323 }
324}
325
326void
327cmdline_parser_print_help (void)
328{
329 int i = 0;
330 print_help_common();
331 while (gengetopt_args_info_help[i])
332 printf("%s\n", gengetopt_args_info_help[i++]);
333}
334
335void
336cmdline_parser_init (struct gengetopt_args_info *args_info)
337{
338 clear_given (args_info);
339 clear_args (args_info);
340 init_args_info (args_info);
341
342 args_info->inputs = 0;
343 args_info->inputs_num = 0;
344}
345
346void
347cmdline_parser_params_init(struct cmdline_parser_params *params)
348{
349 if (params)
350 {
351 params->override = 0;
352 params->initialize = 1;
353 params->check_required = 1;
354 params->check_ambiguity = 0;
355 params->print_errors = 1;
356 }
357}
358
361{
362 struct cmdline_parser_params *params =
363 (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
365 return params;
366}
367
368static void
369free_string_field (char **s)
370{
371 if (*s)
372 {
373 free (*s);
374 *s = 0;
375 }
376}
377
378
379static void
380cmdline_parser_release (struct gengetopt_args_info *args_info)
381{
382 unsigned int i;
383 free_string_field (&(args_info->input_arg));
384 free_string_field (&(args_info->input_orig));
385 free_string_field (&(args_info->output_arg));
386 free_string_field (&(args_info->output_orig));
387 free_string_field (&(args_info->sele1_arg));
388 free_string_field (&(args_info->sele1_orig));
389 free_string_field (&(args_info->sele2_arg));
390 free_string_field (&(args_info->sele2_orig));
391 free_string_field (&(args_info->sele3_arg));
392 free_string_field (&(args_info->sele3_orig));
393 free_string_field (&(args_info->order_orig));
394 free_string_field (&(args_info->nbins_orig));
395 free_string_field (&(args_info->nzbins_orig));
396 free_string_field (&(args_info->rcut_orig));
397 free_string_field (&(args_info->OOcut_orig));
398 free_string_field (&(args_info->thetacut_orig));
399 free_string_field (&(args_info->OHcut_orig));
400 free_string_field (&(args_info->privilegedAxis_orig));
401 free_string_field (&(args_info->length_orig));
402 free_string_field (&(args_info->dipoleX_orig));
403 free_string_field (&(args_info->dipoleY_orig));
404 free_string_field (&(args_info->dipoleZ_orig));
405
406
407 for (i = 0; i < args_info->inputs_num; ++i)
408 free (args_info->inputs [i]);
409
410 if (args_info->inputs_num)
411 free (args_info->inputs);
412
413 clear_given (args_info);
414}
415
416/**
417 * @param val the value to check
418 * @param values the possible values
419 * @return the index of the matched value:
420 * -1 if no value matched,
421 * -2 if more than one value has matched
422 */
423static int
424check_possible_values(const char *val, const char *values[])
425{
426 int i, found, last;
427 size_t len;
428
429 if (!val) /* otherwise strlen() crashes below */
430 return -1; /* -1 means no argument for the option */
431
432 found = last = 0;
433
434 for (i = 0, len = strlen(val); values[i]; ++i)
435 {
436 if (strncmp(val, values[i], len) == 0)
437 {
438 ++found;
439 last = i;
440 if (strlen(values[i]) == len)
441 return i; /* exact macth no need to check more */
442 }
443 }
444
445 if (found == 1) /* one match: OK */
446 return last;
447
448 return (found ? -2 : -1); /* return many values or none matched */
449}
450
451
452static void
453write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
454{
455 int found = -1;
456 if (arg) {
457 if (values) {
458 found = check_possible_values(arg, values);
459 }
460 if (found >= 0)
461 fprintf(outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]);
462 else
463 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
464 } else {
465 fprintf(outfile, "%s\n", opt);
466 }
467}
468
469
470int
471cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
472{
473 int i = 0;
474
475 if (!outfile)
476 {
477 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
478 return EXIT_FAILURE;
479 }
480
481 if (args_info->help_given)
482 write_into_file(outfile, "help", 0, 0 );
483 if (args_info->version_given)
484 write_into_file(outfile, "version", 0, 0 );
485 if (args_info->input_given)
486 write_into_file(outfile, "input", args_info->input_orig, 0);
487 if (args_info->output_given)
488 write_into_file(outfile, "output", args_info->output_orig, 0);
489 if (args_info->sele1_given)
490 write_into_file(outfile, "sele1", args_info->sele1_orig, 0);
491 if (args_info->sele2_given)
492 write_into_file(outfile, "sele2", args_info->sele2_orig, 0);
493 if (args_info->sele3_given)
494 write_into_file(outfile, "sele3", args_info->sele3_orig, 0);
495 if (args_info->order_given)
496 write_into_file(outfile, "order", args_info->order_orig, 0);
497 if (args_info->nbins_given)
498 write_into_file(outfile, "nbins", args_info->nbins_orig, 0);
499 if (args_info->nzbins_given)
500 write_into_file(outfile, "nzbins", args_info->nzbins_orig, 0);
501 if (args_info->rcut_given)
502 write_into_file(outfile, "rcut", args_info->rcut_orig, 0);
503 if (args_info->OOcut_given)
504 write_into_file(outfile, "OOcut", args_info->OOcut_orig, 0);
505 if (args_info->thetacut_given)
506 write_into_file(outfile, "thetacut", args_info->thetacut_orig, 0);
507 if (args_info->OHcut_given)
508 write_into_file(outfile, "OHcut", args_info->OHcut_orig, 0);
509 if (args_info->privilegedAxis_given)
510 write_into_file(outfile, "privilegedAxis", args_info->privilegedAxis_orig, cmdline_parser_privilegedAxis_values);
511 if (args_info->length_given)
512 write_into_file(outfile, "length", args_info->length_orig, 0);
513 if (args_info->dipoleX_given)
514 write_into_file(outfile, "dipoleX", args_info->dipoleX_orig, 0);
515 if (args_info->dipoleY_given)
516 write_into_file(outfile, "dipoleY", args_info->dipoleY_orig, 0);
517 if (args_info->dipoleZ_given)
518 write_into_file(outfile, "dipoleZ", args_info->dipoleZ_orig, 0);
519 if (args_info->selecorr_given)
520 write_into_file(outfile, "selecorr", 0, 0 );
521 if (args_info->rcorr_given)
522 write_into_file(outfile, "rcorr", 0, 0 );
523 if (args_info->rcorrZ_given)
524 write_into_file(outfile, "rcorrZ", 0, 0 );
525 if (args_info->vcorr_given)
526 write_into_file(outfile, "vcorr", 0, 0 );
527 if (args_info->vcorrZ_given)
528 write_into_file(outfile, "vcorrZ", 0, 0 );
529 if (args_info->vcorrR_given)
530 write_into_file(outfile, "vcorrR", 0, 0 );
531 if (args_info->vaOutProdcorr_given)
532 write_into_file(outfile, "vaOutProdcorr", 0, 0 );
533 if (args_info->waOutProdcorr_given)
534 write_into_file(outfile, "waOutProdcorr", 0, 0 );
535 if (args_info->vwOutProdcorr_given)
536 write_into_file(outfile, "vwOutProdcorr", 0, 0 );
537 if (args_info->wvOutProdcorr_given)
538 write_into_file(outfile, "wvOutProdcorr", 0, 0 );
539 if (args_info->wcorr_given)
540 write_into_file(outfile, "wcorr", 0, 0 );
541 if (args_info->dcorr_given)
542 write_into_file(outfile, "dcorr", 0, 0 );
543 if (args_info->lcorr_given)
544 write_into_file(outfile, "lcorr", 0, 0 );
545 if (args_info->lcorrZ_given)
546 write_into_file(outfile, "lcorrZ", 0, 0 );
547 if (args_info->cohZ_given)
548 write_into_file(outfile, "cohZ", 0, 0 );
549 if (args_info->sdcorr_given)
550 write_into_file(outfile, "sdcorr", 0, 0 );
551 if (args_info->r_rcorr_given)
552 write_into_file(outfile, "r_rcorr", 0, 0 );
553 if (args_info->thetacorr_given)
554 write_into_file(outfile, "thetacorr", 0, 0 );
555 if (args_info->drcorr_given)
556 write_into_file(outfile, "drcorr", 0, 0 );
557 if (args_info->stresscorr_given)
558 write_into_file(outfile, "stresscorr", 0, 0 );
559 if (args_info->bondcorr_given)
560 write_into_file(outfile, "bondcorr", 0, 0 );
561 if (args_info->freqfluccorr_given)
562 write_into_file(outfile, "freqfluccorr", 0, 0 );
563 if (args_info->jumptime_given)
564 write_into_file(outfile, "jumptime", 0, 0 );
565 if (args_info->jumptimeZ_given)
566 write_into_file(outfile, "jumptimeZ", 0, 0 );
567 if (args_info->jumptimeR_given)
568 write_into_file(outfile, "jumptimeR", 0, 0 );
569 if (args_info->persistence_given)
570 write_into_file(outfile, "persistence", 0, 0 );
571 if (args_info->pjcorr_given)
572 write_into_file(outfile, "pjcorr", 0, 0 );
573 if (args_info->ftcorr_given)
574 write_into_file(outfile, "ftcorr", 0, 0 );
575 if (args_info->ckcorr_given)
576 write_into_file(outfile, "ckcorr", 0, 0 );
577 if (args_info->cscorr_given)
578 write_into_file(outfile, "cscorr", 0, 0 );
579 if (args_info->facorr_given)
580 write_into_file(outfile, "facorr", 0, 0 );
581 if (args_info->tfcorr_given)
582 write_into_file(outfile, "tfcorr", 0, 0 );
583 if (args_info->tacorr_given)
584 write_into_file(outfile, "tacorr", 0, 0 );
585 if (args_info->disp_given)
586 write_into_file(outfile, "disp", 0, 0 );
587 if (args_info->dispZ_given)
588 write_into_file(outfile, "dispZ", 0, 0 );
589 if (args_info->current_given)
590 write_into_file(outfile, "current", 0, 0 );
591 if (args_info->onsager_given)
592 write_into_file(outfile, "onsager", 0, 0 );
593 if (args_info->ddisp_given)
594 write_into_file(outfile, "ddisp", 0, 0 );
595 if (args_info->rotAngleDisp_given)
596 write_into_file(outfile, "rotAngleDisp", 0, 0 );
597 if (args_info->meandisp_given)
598 write_into_file(outfile, "meandisp", 0, 0 );
599
600
601 i = EXIT_SUCCESS;
602 return i;
603}
604
605int
606cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
607{
608 FILE *outfile;
609 int i = 0;
610
611 outfile = fopen(filename, "w");
612
613 if (!outfile)
614 {
615 fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
616 return EXIT_FAILURE;
617 }
618
619 i = cmdline_parser_dump(outfile, args_info);
620 fclose (outfile);
621
622 return i;
623}
624
625void
627{
628 cmdline_parser_release (args_info);
629}
630
631/** @brief replacement of strdup, which is not standard */
632char *
633gengetopt_strdup (const char *s)
634{
635 char *result = 0;
636 if (!s)
637 return result;
638
639 result = (char*)malloc(strlen(s) + 1);
640 if (result == (char*)0)
641 return (char*)0;
642 strcpy(result, s);
643 return result;
644}
645
646static void
647reset_group_correlation_function(struct gengetopt_args_info *args_info)
648{
649 if (! args_info->correlation_function_group_counter)
650 return;
651
652 args_info->selecorr_given = 0 ;
653 args_info->rcorr_given = 0 ;
654 args_info->rcorrZ_given = 0 ;
655 args_info->vcorr_given = 0 ;
656 args_info->vcorrZ_given = 0 ;
657 args_info->vcorrR_given = 0 ;
658 args_info->vaOutProdcorr_given = 0 ;
659 args_info->waOutProdcorr_given = 0 ;
660 args_info->vwOutProdcorr_given = 0 ;
661 args_info->wvOutProdcorr_given = 0 ;
662 args_info->wcorr_given = 0 ;
663 args_info->dcorr_given = 0 ;
664 args_info->lcorr_given = 0 ;
665 args_info->lcorrZ_given = 0 ;
666 args_info->cohZ_given = 0 ;
667 args_info->sdcorr_given = 0 ;
668 args_info->r_rcorr_given = 0 ;
669 args_info->thetacorr_given = 0 ;
670 args_info->drcorr_given = 0 ;
671 args_info->stresscorr_given = 0 ;
672 args_info->bondcorr_given = 0 ;
673 args_info->freqfluccorr_given = 0 ;
674 args_info->jumptime_given = 0 ;
675 args_info->jumptimeZ_given = 0 ;
676 args_info->jumptimeR_given = 0 ;
677 args_info->persistence_given = 0 ;
678 args_info->pjcorr_given = 0 ;
679 args_info->ftcorr_given = 0 ;
680 args_info->ckcorr_given = 0 ;
681 args_info->cscorr_given = 0 ;
682 args_info->facorr_given = 0 ;
683 args_info->tfcorr_given = 0 ;
684 args_info->tacorr_given = 0 ;
685 args_info->disp_given = 0 ;
686 args_info->dispZ_given = 0 ;
687 args_info->current_given = 0 ;
688 args_info->onsager_given = 0 ;
689 args_info->ddisp_given = 0 ;
690 args_info->rotAngleDisp_given = 0 ;
691 args_info->meandisp_given = 0 ;
692
694}
695
696int
697cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
698{
699 return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
700}
701
702int
703cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
704 struct cmdline_parser_params *params)
705{
706 int result;
707 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
708
709 return result;
710}
711
712int
713cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
714{
715 int result;
716 struct cmdline_parser_params params;
717
718 params.override = override;
719 params.initialize = initialize;
721 params.check_ambiguity = 0;
722 params.print_errors = 1;
723
724 result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
725
726 return result;
727}
728
729int
730cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
731{
732 int result = EXIT_SUCCESS;
733
734 if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
735 result = EXIT_FAILURE;
736
737 return result;
738}
739
740int
741cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
742{
743 int error_occurred = 0;
744 FIX_UNUSED (additional_error);
745
746 /* checks for required options */
747 if (! args_info->input_given)
748 {
749 fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
750 error_occurred = 1;
751 }
752
753 if (args_info->correlation_function_group_counter == 0)
754 {
755 fprintf (stderr, "%s: %d options of group correlation function were given. One is required%s.\n", prog_name, args_info->correlation_function_group_counter, (additional_error ? additional_error : ""));
756 error_occurred = 1;
757 }
758
759
760 /* checks for dependences among options */
761
762 return error_occurred;
763}
764
765/*
766 * Extracted from the glibc source tree, version 2.3.6
767 *
768 * Licensed under the GPL as per the whole glibc source tree.
769 *
770 * This file was modified so that getopt_long can be called
771 * many times without risking previous memory to be spoiled.
772 *
773 * Modified by Andre Noll and Lorenzo Bettini for use in
774 * GNU gengetopt generated files.
775 *
776 */
777
778/*
779 * we must include anything we need since this file is not thought to be
780 * inserted in a file already using getopt.h
781 *
782 * Lorenzo
783 */
784
785struct option
786{
787 const char *name;
788 /* has_arg can't be an enum because some compilers complain about
789 type mismatches in all the code that assumes it is an int. */
790 int has_arg;
791 int *flag;
792 int val;
793};
794
795/* This version of `getopt' appears to the caller like standard Unix `getopt'
796 but it behaves differently for the user, since it allows the user
797 to intersperse the options with the other arguments.
798
799 As `getopt' works, it permutes the elements of ARGV so that,
800 when it is done, all the options precede everything else. Thus
801 all application programs are extended to handle flexible argument order.
802*/
803/*
804 If the field `flag' is not NULL, it points to a variable that is set
805 to the value given in the field `val' when the option is found, but
806 left unchanged if the option is not found.
807
808 To have a long-named option do something other than set an `int' to
809 a compiled-in constant, such as set a value from `custom_optarg', set the
810 option's `flag' field to zero and its `val' field to a nonzero
811 value (the equivalent single-letter option character, if there is
812 one). For long options that have a zero `flag' field, `getopt'
813 returns the contents of the `val' field. */
814
815/* Names for the values of the `has_arg' field of `struct option'. */
816#ifndef no_argument
817#define no_argument 0
818#endif
819
820#ifndef required_argument
821#define required_argument 1
822#endif
823
824#ifndef optional_argument
825#define optional_argument 2
826#endif
827
828struct custom_getopt_data {
829 /*
830 * These have exactly the same meaning as the corresponding global variables,
831 * except that they are used for the reentrant versions of getopt.
832 */
833 int custom_optind;
834 int custom_opterr;
835 int custom_optopt;
836 char *custom_optarg;
837
838 /* True if the internal members have been initialized. */
839 int initialized;
840
841 /*
842 * The next char to be scanned in the option-element in which the last option
843 * character we returned was found. This allows us to pick up the scan where
844 * we left off. If this is zero, or a null string, it means resume the scan by
845 * advancing to the next ARGV-element.
846 */
847 char *nextchar;
848
849 /*
850 * Describe the part of ARGV that contains non-options that have been skipped.
851 * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
852 * the index after the last of them.
853 */
854 int first_nonopt;
855 int last_nonopt;
856};
857
858/*
859 * the variables optarg, optind, opterr and optopt are renamed with
860 * the custom_ prefix so that they don't interfere with getopt ones.
861 *
862 * Moreover they're static so they are visible only from within the
863 * file where this very file will be included.
864 */
865
866/*
867 * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an
868 * option that takes an argument, the argument value is returned here.
869 */
870static char *custom_optarg;
871
872/*
873 * Index in ARGV of the next element to be scanned. This is used for
874 * communication to and from the caller and for communication between
875 * successive calls to `custom_getopt'.
876 *
877 * On entry to `custom_getopt', 1 means this is the first call; initialize.
878 *
879 * When `custom_getopt' returns -1, this is the index of the first of the non-option
880 * elements that the caller should itself scan.
881 *
882 * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV
883 * has been scanned so far.
884 *
885 * 1003.2 says this must be 1 before any call.
886 */
887static int custom_optind = 1;
888
889/*
890 * Callers store zero here to inhibit the error message for unrecognized
891 * options.
892 */
893static int custom_opterr = 1;
894
895/*
896 * Set to an option character which was unrecognized. This must be initialized
897 * on some systems to avoid linking in the system's own getopt implementation.
898 */
899static int custom_optopt = '?';
900
901/*
902 * Exchange two adjacent subsequences of ARGV. One subsequence is elements
903 * [first_nonopt,last_nonopt) which contains all the non-options that have been
904 * skipped so far. The other is elements [last_nonopt,custom_optind), which contains
905 * all the options processed since those non-options were skipped.
906 * `first_nonopt' and `last_nonopt' are relocated so that they describe the new
907 * indices of the non-options in ARGV after they are moved.
908 */
909static void exchange(char **argv, struct custom_getopt_data *d)
910{
911 int bottom = d->first_nonopt;
912 int middle = d->last_nonopt;
913 int top = d->custom_optind;
914 char *tem;
915
916 /*
917 * Exchange the shorter segment with the far end of the longer segment.
918 * That puts the shorter segment into the right place. It leaves the
919 * longer segment in the right place overall, but it consists of two
920 * parts that need to be swapped next.
921 */
922 while (top > middle && middle > bottom) {
923 if (top - middle > middle - bottom) {
924 /* Bottom segment is the short one. */
925 int len = middle - bottom;
926 int i;
927
928 /* Swap it with the top part of the top segment. */
929 for (i = 0; i < len; i++) {
930 tem = argv[bottom + i];
931 argv[bottom + i] =
932 argv[top - (middle - bottom) + i];
933 argv[top - (middle - bottom) + i] = tem;
934 }
935 /* Exclude the moved bottom segment from further swapping. */
936 top -= len;
937 } else {
938 /* Top segment is the short one. */
939 int len = top - middle;
940 int i;
941
942 /* Swap it with the bottom part of the bottom segment. */
943 for (i = 0; i < len; i++) {
944 tem = argv[bottom + i];
945 argv[bottom + i] = argv[middle + i];
946 argv[middle + i] = tem;
947 }
948 /* Exclude the moved top segment from further swapping. */
949 bottom += len;
950 }
951 }
952 /* Update records for the slots the non-options now occupy. */
953 d->first_nonopt += (d->custom_optind - d->last_nonopt);
954 d->last_nonopt = d->custom_optind;
955}
956
957/* Initialize the internal data when the first call is made. */
958static void custom_getopt_initialize(struct custom_getopt_data *d)
959{
960 /*
961 * Start processing options with ARGV-element 1 (since ARGV-element 0
962 * is the program name); the sequence of previously skipped non-option
963 * ARGV-elements is empty.
964 */
965 d->first_nonopt = d->last_nonopt = d->custom_optind;
966 d->nextchar = NULL;
967 d->initialized = 1;
968}
969
970#define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
971
972/* return: zero: continue, nonzero: return given value to user */
973static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
974 struct custom_getopt_data *d)
975{
976 /*
977 * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
978 * moved back by the user (who may also have changed the arguments).
979 */
980 if (d->last_nonopt > d->custom_optind)
981 d->last_nonopt = d->custom_optind;
982 if (d->first_nonopt > d->custom_optind)
983 d->first_nonopt = d->custom_optind;
984 /*
985 * If we have just processed some options following some
986 * non-options, exchange them so that the options come first.
987 */
988 if (d->first_nonopt != d->last_nonopt &&
989 d->last_nonopt != d->custom_optind)
990 exchange((char **) argv, d);
991 else if (d->last_nonopt != d->custom_optind)
992 d->first_nonopt = d->custom_optind;
993 /*
994 * Skip any additional non-options and extend the range of
995 * non-options previously skipped.
996 */
997 while (d->custom_optind < argc && NONOPTION_P)
998 d->custom_optind++;
999 d->last_nonopt = d->custom_optind;
1000 /*
1001 * The special ARGV-element `--' means premature end of options. Skip
1002 * it like a null option, then exchange with previous non-options as if
1003 * it were an option, then skip everything else like a non-option.
1004 */
1005 if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
1006 d->custom_optind++;
1007 if (d->first_nonopt != d->last_nonopt
1008 && d->last_nonopt != d->custom_optind)
1009 exchange((char **) argv, d);
1010 else if (d->first_nonopt == d->last_nonopt)
1011 d->first_nonopt = d->custom_optind;
1012 d->last_nonopt = argc;
1013 d->custom_optind = argc;
1014 }
1015 /*
1016 * If we have done all the ARGV-elements, stop the scan and back over
1017 * any non-options that we skipped and permuted.
1018 */
1019 if (d->custom_optind == argc) {
1020 /*
1021 * Set the next-arg-index to point at the non-options that we
1022 * previously skipped, so the caller will digest them.
1023 */
1024 if (d->first_nonopt != d->last_nonopt)
1025 d->custom_optind = d->first_nonopt;
1026 return -1;
1027 }
1028 /*
1029 * If we have come to a non-option and did not permute it, either stop
1030 * the scan or describe it to the caller and pass it by.
1031 */
1032 if (NONOPTION_P) {
1033 d->custom_optarg = argv[d->custom_optind++];
1034 return 1;
1035 }
1036 /*
1037 * We have found another option-ARGV-element. Skip the initial
1038 * punctuation.
1039 */
1040 d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
1041 return 0;
1042}
1043
1044/*
1045 * Check whether the ARGV-element is a long option.
1046 *
1047 * If there's a long option "fubar" and the ARGV-element is "-fu", consider
1048 * that an abbreviation of the long option, just like "--fu", and not "-f" with
1049 * arg "u".
1050 *
1051 * This distinction seems to be the most useful approach.
1052 *
1053 */
1054static int check_long_opt(int argc, char *const *argv, const char *optstring,
1055 const struct option *longopts, int *longind,
1056 int print_errors, struct custom_getopt_data *d)
1057{
1058 char *nameend;
1059 const struct option *p;
1060 const struct option *pfound = NULL;
1061 int exact = 0;
1062 int ambig = 0;
1063 int indfound = -1;
1064 int option_index;
1065
1066 for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
1067 /* Do nothing. */ ;
1068
1069 /* Test all long options for either exact match or abbreviated matches */
1070 for (p = longopts, option_index = 0; p->name; p++, option_index++)
1071 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
1072 if ((unsigned int) (nameend - d->nextchar)
1073 == (unsigned int) strlen(p->name)) {
1074 /* Exact match found. */
1075 pfound = p;
1076 indfound = option_index;
1077 exact = 1;
1078 break;
1079 } else if (pfound == NULL) {
1080 /* First nonexact match found. */
1081 pfound = p;
1082 indfound = option_index;
1083 } else if (pfound->has_arg != p->has_arg
1084 || pfound->flag != p->flag
1085 || pfound->val != p->val)
1086 /* Second or later nonexact match found. */
1087 ambig = 1;
1088 }
1089 if (ambig && !exact) {
1090 if (print_errors) {
1091 fprintf(stderr,
1092 "%s: option `%s' is ambiguous\n",
1093 argv[0], argv[d->custom_optind]);
1094 }
1095 d->nextchar += strlen(d->nextchar);
1096 d->custom_optind++;
1097 d->custom_optopt = 0;
1098 return '?';
1099 }
1100 if (pfound) {
1101 option_index = indfound;
1102 d->custom_optind++;
1103 if (*nameend) {
1104 if (pfound->has_arg != no_argument)
1105 d->custom_optarg = nameend + 1;
1106 else {
1107 if (print_errors) {
1108 if (argv[d->custom_optind - 1][1] == '-') {
1109 /* --option */
1110 fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
1111 argv[0], pfound->name);
1112 } else {
1113 /* +option or -option */
1114 fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
1115 argv[0], argv[d->custom_optind - 1][0], pfound->name);
1116 }
1117
1118 }
1119 d->nextchar += strlen(d->nextchar);
1120 d->custom_optopt = pfound->val;
1121 return '?';
1122 }
1123 } else if (pfound->has_arg == required_argument) {
1124 if (d->custom_optind < argc)
1125 d->custom_optarg = argv[d->custom_optind++];
1126 else {
1127 if (print_errors) {
1128 fprintf(stderr,
1129 "%s: option `%s' requires an argument\n",
1130 argv[0],
1131 argv[d->custom_optind - 1]);
1132 }
1133 d->nextchar += strlen(d->nextchar);
1134 d->custom_optopt = pfound->val;
1135 return optstring[0] == ':' ? ':' : '?';
1136 }
1137 }
1138 d->nextchar += strlen(d->nextchar);
1139 if (longind != NULL)
1140 *longind = option_index;
1141 if (pfound->flag) {
1142 *(pfound->flag) = pfound->val;
1143 return 0;
1144 }
1145 return pfound->val;
1146 }
1147 /*
1148 * Can't find it as a long option. If this is not getopt_long_only, or
1149 * the option starts with '--' or is not a valid short option, then
1150 * it's an error. Otherwise interpret it as a short option.
1151 */
1152 if (print_errors) {
1153 if (argv[d->custom_optind][1] == '-') {
1154 /* --option */
1155 fprintf(stderr,
1156 "%s: unrecognized option `--%s'\n",
1157 argv[0], d->nextchar);
1158 } else {
1159 /* +option or -option */
1160 fprintf(stderr,
1161 "%s: unrecognized option `%c%s'\n",
1162 argv[0], argv[d->custom_optind][0],
1163 d->nextchar);
1164 }
1165 }
1166 d->nextchar = (char *) "";
1167 d->custom_optind++;
1168 d->custom_optopt = 0;
1169 return '?';
1170}
1171
1172static int check_short_opt(int argc, char *const *argv, const char *optstring,
1173 int print_errors, struct custom_getopt_data *d)
1174{
1175 char c = *d->nextchar++;
1176 const char *temp = strchr(optstring, c);
1177
1178 /* Increment `custom_optind' when we start to process its last character. */
1179 if (*d->nextchar == '\0')
1180 ++d->custom_optind;
1181 if (!temp || c == ':') {
1182 if (print_errors)
1183 fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
1184
1185 d->custom_optopt = c;
1186 return '?';
1187 }
1188 if (temp[1] == ':') {
1189 if (temp[2] == ':') {
1190 /* This is an option that accepts an argument optionally. */
1191 if (*d->nextchar != '\0') {
1192 d->custom_optarg = d->nextchar;
1193 d->custom_optind++;
1194 } else
1195 d->custom_optarg = NULL;
1196 d->nextchar = NULL;
1197 } else {
1198 /* This is an option that requires an argument. */
1199 if (*d->nextchar != '\0') {
1200 d->custom_optarg = d->nextchar;
1201 /*
1202 * If we end this ARGV-element by taking the
1203 * rest as an arg, we must advance to the next
1204 * element now.
1205 */
1206 d->custom_optind++;
1207 } else if (d->custom_optind == argc) {
1208 if (print_errors) {
1209 fprintf(stderr,
1210 "%s: option requires an argument -- %c\n",
1211 argv[0], c);
1212 }
1213 d->custom_optopt = c;
1214 if (optstring[0] == ':')
1215 c = ':';
1216 else
1217 c = '?';
1218 } else
1219 /*
1220 * We already incremented `custom_optind' once;
1221 * increment it again when taking next ARGV-elt
1222 * as argument.
1223 */
1224 d->custom_optarg = argv[d->custom_optind++];
1225 d->nextchar = NULL;
1226 }
1227 }
1228 return c;
1229}
1230
1231/*
1232 * Scan elements of ARGV for option characters given in OPTSTRING.
1233 *
1234 * If an element of ARGV starts with '-', and is not exactly "-" or "--",
1235 * then it is an option element. The characters of this element
1236 * (aside from the initial '-') are option characters. If `getopt'
1237 * is called repeatedly, it returns successively each of the option characters
1238 * from each of the option elements.
1239 *
1240 * If `getopt' finds another option character, it returns that character,
1241 * updating `custom_optind' and `nextchar' so that the next call to `getopt' can
1242 * resume the scan with the following option character or ARGV-element.
1243 *
1244 * If there are no more option characters, `getopt' returns -1.
1245 * Then `custom_optind' is the index in ARGV of the first ARGV-element
1246 * that is not an option. (The ARGV-elements have been permuted
1247 * so that those that are not options now come last.)
1248 *
1249 * OPTSTRING is a string containing the legitimate option characters.
1250 * If an option character is seen that is not listed in OPTSTRING,
1251 * return '?' after printing an error message. If you set `custom_opterr' to
1252 * zero, the error message is suppressed but we still return '?'.
1253 *
1254 * If a char in OPTSTRING is followed by a colon, that means it wants an arg,
1255 * so the following text in the same ARGV-element, or the text of the following
1256 * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that
1257 * wants an optional arg; if there is text in the current ARGV-element,
1258 * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero.
1259 *
1260 * If OPTSTRING starts with `-' or `+', it requests different methods of
1261 * handling the non-option ARGV-elements.
1262 * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
1263 *
1264 * Long-named options begin with `--' instead of `-'.
1265 * Their names may be abbreviated as long as the abbreviation is unique
1266 * or is an exact match for some defined option. If they have an
1267 * argument, it follows the option name in the same ARGV-element, separated
1268 * from the option name by a `=', or else the in next ARGV-element.
1269 * When `getopt' finds a long-named option, it returns 0 if that option's
1270 * `flag' field is nonzero, the value of the option's `val' field
1271 * if the `flag' field is zero.
1272 *
1273 * The elements of ARGV aren't really const, because we permute them.
1274 * But we pretend they're const in the prototype to be compatible
1275 * with other systems.
1276 *
1277 * LONGOPTS is a vector of `struct option' terminated by an
1278 * element containing a name which is zero.
1279 *
1280 * LONGIND returns the index in LONGOPT of the long-named option found.
1281 * It is only valid when a long-named option has been found by the most
1282 * recent call.
1283 *
1284 * Return the option character from OPTS just read. Return -1 when there are
1285 * no more options. For unrecognized options, or options missing arguments,
1286 * `custom_optopt' is set to the option letter, and '?' is returned.
1287 *
1288 * The OPTS string is a list of characters which are recognized option letters,
1289 * optionally followed by colons, specifying that that letter takes an
1290 * argument, to be placed in `custom_optarg'.
1291 *
1292 * If a letter in OPTS is followed by two colons, its argument is optional.
1293 * This behavior is specific to the GNU `getopt'.
1294 *
1295 * The argument `--' causes premature termination of argument scanning,
1296 * explicitly telling `getopt' that there are no more options. If OPTS begins
1297 * with `--', then non-option arguments are treated as arguments to the option
1298 * '\0'. This behavior is specific to the GNU `getopt'.
1299 */
1300
1301static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
1302 const struct option *longopts, int *longind,
1303 struct custom_getopt_data *d)
1304{
1305 int ret, print_errors = d->custom_opterr;
1306
1307 if (optstring[0] == ':')
1308 print_errors = 0;
1309 if (argc < 1)
1310 return -1;
1311 d->custom_optarg = NULL;
1312
1313 /*
1314 * This is a big difference with GNU getopt, since optind == 0
1315 * means initialization while here 1 means first call.
1316 */
1317 if (d->custom_optind == 0 || !d->initialized) {
1318 if (d->custom_optind == 0)
1319 d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
1320 custom_getopt_initialize(d);
1321 }
1322 if (d->nextchar == NULL || *d->nextchar == '\0') {
1323 ret = shuffle_argv(argc, argv, longopts, d);
1324 if (ret)
1325 return ret;
1326 }
1327 if (longopts && (argv[d->custom_optind][1] == '-' ))
1328 return check_long_opt(argc, argv, optstring, longopts,
1329 longind, print_errors, d);
1330 return check_short_opt(argc, argv, optstring, print_errors, d);
1331}
1332
1333static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
1334 const struct option *longopts, int *longind)
1335{
1336 int result;
1337 /* Keep a global copy of all internal members of d */
1338 static struct custom_getopt_data d;
1339
1340 d.custom_optind = custom_optind;
1341 d.custom_opterr = custom_opterr;
1342 result = getopt_internal_r(argc, argv, optstring, longopts,
1343 longind, &d);
1344 custom_optind = d.custom_optind;
1345 custom_optarg = d.custom_optarg;
1346 custom_optopt = d.custom_optopt;
1347 return result;
1348}
1349
1350static int custom_getopt_long (int argc, char *const *argv, const char *options,
1351 const struct option *long_options, int *opt_index)
1352{
1353 return custom_getopt_internal(argc, argv, options, long_options,
1354 opt_index);
1355}
1356
1357
1358static char *package_name = 0;
1359
1360/**
1361 * @brief updates an option
1362 * @param field the generic pointer to the field to update
1363 * @param orig_field the pointer to the orig field
1364 * @param field_given the pointer to the number of occurrence of this option
1365 * @param prev_given the pointer to the number of occurrence already seen
1366 * @param value the argument for this option (if null no arg was specified)
1367 * @param possible_values the possible values for this option (if specified)
1368 * @param default_value the default value (in case the option only accepts fixed values)
1369 * @param arg_type the type of this option
1370 * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
1371 * @param override @see cmdline_parser_params.override
1372 * @param no_free whether to free a possible previous value
1373 * @param multiple_option whether this is a multiple option
1374 * @param long_opt the corresponding long option
1375 * @param short_opt the corresponding short option (or '-' if none)
1376 * @param additional_error possible further error specification
1377 */
1378static
1379int update_arg(void *field, char **orig_field,
1380 unsigned int *field_given, unsigned int *prev_given,
1381 char *value, const char *possible_values[],
1382 const char *default_value,
1383 cmdline_parser_arg_type arg_type,
1384 int check_ambiguity, int override,
1385 int no_free, int multiple_option,
1386 const char *long_opt, char short_opt,
1387 const char *additional_error)
1388{
1389 char *stop_char = 0;
1390 const char *val = value;
1391 int found;
1392 char **string_field;
1393 FIX_UNUSED (field);
1394
1395 stop_char = 0;
1396 found = 0;
1397
1398 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1399 {
1400 if (short_opt != '-')
1401 fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
1402 package_name, long_opt, short_opt,
1403 (additional_error ? additional_error : ""));
1404 else
1405 fprintf (stderr, "%s: `--%s' option given more than once%s\n",
1406 package_name, long_opt,
1407 (additional_error ? additional_error : ""));
1408 return 1; /* failure */
1409 }
1410
1411 if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0)
1412 {
1413 if (short_opt != '-')
1414 fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n",
1415 package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, short_opt,
1416 (additional_error ? additional_error : ""));
1417 else
1418 fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n",
1419 package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt,
1420 (additional_error ? additional_error : ""));
1421 return 1; /* failure */
1422 }
1423
1424 if (field_given && *field_given && ! override)
1425 return 0;
1426 if (prev_given)
1427 (*prev_given)++;
1428 if (field_given)
1429 (*field_given)++;
1430 if (possible_values)
1431 val = possible_values[found];
1432
1433 switch(arg_type) {
1434 case ARG_INT:
1435 if (val) *((int *)field) = strtol (val, &stop_char, 0);
1436 break;
1437 case ARG_DOUBLE:
1438 if (val) *((double *)field) = strtod (val, &stop_char);
1439 break;
1440 case ARG_ENUM:
1441 if (val) *((int *)field) = found;
1442 break;
1443 case ARG_STRING:
1444 if (val) {
1445 string_field = (char **)field;
1446 if (!no_free && *string_field)
1447 free (*string_field); /* free previous string */
1448 *string_field = gengetopt_strdup (val);
1449 }
1450 break;
1451 default:
1452 break;
1453 };
1454
1455 /* check numeric conversion */
1456 switch(arg_type) {
1457 case ARG_INT:
1458 case ARG_DOUBLE:
1459 if (val && !(stop_char && *stop_char == '\0')) {
1460 fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
1461 return 1; /* failure */
1462 }
1463 break;
1464 default:
1465 ;
1466 };
1467
1468 /* store the original value */
1469 switch(arg_type) {
1470 case ARG_NO:
1471 break;
1472 default:
1473 if (value && orig_field) {
1474 if (no_free) {
1475 *orig_field = value;
1476 } else {
1477 if (*orig_field)
1478 free (*orig_field); /* free previous string */
1479 *orig_field = gengetopt_strdup (value);
1480 }
1481 }
1482 };
1483
1484 return 0; /* OK */
1485}
1486
1487
1488int
1489cmdline_parser_internal (
1490 int argc, char **argv, struct gengetopt_args_info *args_info,
1491 struct cmdline_parser_params *params, const char *additional_error)
1492{
1493 int c; /* Character of the parsed option. */
1494
1495 int error_occurred = 0;
1496 struct gengetopt_args_info local_args_info;
1497
1498 int override;
1499 int initialize;
1500 int check_required;
1501 int check_ambiguity;
1502
1503 char *optarg;
1504 int optind;
1505 int opterr;
1506 int optopt;
1507
1508 package_name = argv[0];
1509
1510 /* TODO: Why is this here? It is not used anywhere. */
1511 override = params->override;
1512 FIX_UNUSED(override);
1513
1514 initialize = params->initialize;
1515 check_required = params->check_required;
1516
1517 /* TODO: Why is this here? It is not used anywhere. */
1518 check_ambiguity = params->check_ambiguity;
1519 FIX_UNUSED(check_ambiguity);
1520
1521 if (initialize)
1522 cmdline_parser_init (args_info);
1523
1524 cmdline_parser_init (&local_args_info);
1525
1526 optarg = 0;
1527 optind = 0;
1528 opterr = params->print_errors;
1529 optopt = '?';
1530
1531 while (1)
1532 {
1533 int option_index = 0;
1534
1535 static struct option long_options[] = {
1536 { "help", 0, NULL, 'h' },
1537 { "version", 0, NULL, 'V' },
1538 { "input", 1, NULL, 'i' },
1539 { "output", 1, NULL, 'o' },
1540 { "sele1", 1, NULL, 0 },
1541 { "sele2", 1, NULL, 0 },
1542 { "sele3", 1, NULL, 0 },
1543 { "order", 1, NULL, 0 },
1544 { "nbins", 1, NULL, 'n' },
1545 { "nzbins", 1, NULL, 'z' },
1546 { "rcut", 1, NULL, 'c' },
1547 { "OOcut", 1, NULL, 0 },
1548 { "thetacut", 1, NULL, 0 },
1549 { "OHcut", 1, NULL, 0 },
1550 { "privilegedAxis", 1, NULL, 0 },
1551 { "length", 1, NULL, 0 },
1552 { "dipoleX", 1, NULL, 0 },
1553 { "dipoleY", 1, NULL, 0 },
1554 { "dipoleZ", 1, NULL, 0 },
1555 { "selecorr", 0, NULL, 's' },
1556 { "rcorr", 0, NULL, 'r' },
1557 { "rcorrZ", 0, NULL, 0 },
1558 { "vcorr", 0, NULL, 'v' },
1559 { "vcorrZ", 0, NULL, 0 },
1560 { "vcorrR", 0, NULL, 0 },
1561 { "vaOutProdcorr", 0, NULL, 0 },
1562 { "waOutProdcorr", 0, NULL, 0 },
1563 { "vwOutProdcorr", 0, NULL, 0 },
1564 { "wvOutProdcorr", 0, NULL, 0 },
1565 { "wcorr", 0, NULL, 'w' },
1566 { "dcorr", 0, NULL, 'd' },
1567 { "lcorr", 0, NULL, 'l' },
1568 { "lcorrZ", 0, NULL, 0 },
1569 { "cohZ", 0, NULL, 0 },
1570 { "sdcorr", 0, NULL, 'M' },
1571 { "r_rcorr", 0, NULL, 0 },
1572 { "thetacorr", 0, NULL, 0 },
1573 { "drcorr", 0, NULL, 0 },
1574 { "stresscorr", 0, NULL, 0 },
1575 { "bondcorr", 0, NULL, 'b' },
1576 { "freqfluccorr", 0, NULL, 'f' },
1577 { "jumptime", 0, NULL, 'j' },
1578 { "jumptimeZ", 0, NULL, 0 },
1579 { "jumptimeR", 0, NULL, 0 },
1580 { "persistence", 0, NULL, 0 },
1581 { "pjcorr", 0, NULL, 0 },
1582 { "ftcorr", 0, NULL, 0 },
1583 { "ckcorr", 0, NULL, 0 },
1584 { "cscorr", 0, NULL, 0 },
1585 { "facorr", 0, NULL, 0 },
1586 { "tfcorr", 0, NULL, 0 },
1587 { "tacorr", 0, NULL, 0 },
1588 { "disp", 0, NULL, 0 },
1589 { "dispZ", 0, NULL, 0 },
1590 { "current", 0, NULL, 0 },
1591 { "onsager", 0, NULL, 0 },
1592 { "ddisp", 0, NULL, 0 },
1593 { "rotAngleDisp", 0, NULL, 0 },
1594 { "meandisp", 0, NULL, 0 },
1595 { 0, 0, 0, 0 }
1596 };
1597
1598 custom_optarg = optarg;
1599 custom_optind = optind;
1600 custom_opterr = opterr;
1601 custom_optopt = optopt;
1602
1603 c = custom_getopt_long (argc, argv, "hVi:o:n:z:c:srvwdlMbfj", long_options, &option_index);
1604
1605 optarg = custom_optarg;
1606 optind = custom_optind;
1607 opterr = custom_opterr;
1608 optopt = custom_optopt;
1609
1610 if (c == -1) break; /* Exit from `while (1)' loop. */
1611
1612 switch (c)
1613 {
1614 case 'h': /* Print help and exit. */
1615 cmdline_parser_print_help ();
1616 cmdline_parser_free (&local_args_info);
1617 exit (EXIT_SUCCESS);
1618
1619 case 'V': /* Print version and exit. */
1620 cmdline_parser_print_version ();
1621 cmdline_parser_free (&local_args_info);
1622 exit (EXIT_SUCCESS);
1623
1624 case 'i': /* input dump file. */
1625
1626
1627 if (update_arg( (void *)&(args_info->input_arg),
1628 &(args_info->input_orig), &(args_info->input_given),
1629 &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
1630 check_ambiguity, override, 0, 0,
1631 "input", 'i',
1632 additional_error))
1633 goto failure;
1634
1635 break;
1636 case 'o': /* output file name. */
1637
1638
1639 if (update_arg( (void *)&(args_info->output_arg),
1640 &(args_info->output_orig), &(args_info->output_given),
1641 &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
1642 check_ambiguity, override, 0, 0,
1643 "output", 'o',
1644 additional_error))
1645 goto failure;
1646
1647 break;
1648 case 'n': /* Number of bins. */
1649
1650
1651 if (update_arg( (void *)&(args_info->nbins_arg),
1652 &(args_info->nbins_orig), &(args_info->nbins_given),
1653 &(local_args_info.nbins_given), optarg, 0, "100", ARG_INT,
1654 check_ambiguity, override, 0, 0,
1655 "nbins", 'n',
1656 additional_error))
1657 goto failure;
1658
1659 break;
1660 case 'z': /* Number of Z bins. */
1661
1662
1663 if (update_arg( (void *)&(args_info->nzbins_arg),
1664 &(args_info->nzbins_orig), &(args_info->nzbins_given),
1665 &(local_args_info.nzbins_given), optarg, 0, "100", ARG_INT,
1666 check_ambiguity, override, 0, 0,
1667 "nzbins", 'z',
1668 additional_error))
1669 goto failure;
1670
1671 break;
1672 case 'c': /* cutoff radius (angstroms). */
1673
1674
1675 if (update_arg( (void *)&(args_info->rcut_arg),
1676 &(args_info->rcut_orig), &(args_info->rcut_given),
1677 &(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE,
1678 check_ambiguity, override, 0, 0,
1679 "rcut", 'c',
1680 additional_error))
1681 goto failure;
1682
1683 break;
1684 case 's': /* selection correlation function. */
1685
1686 if (args_info->correlation_function_group_counter && override)
1687 reset_group_correlation_function (args_info);
1688 args_info->correlation_function_group_counter += 1;
1689
1690 if (update_arg( 0 ,
1691 0 , &(args_info->selecorr_given),
1692 &(local_args_info.selecorr_given), optarg, 0, 0, ARG_NO,
1693 check_ambiguity, override, 0, 0,
1694 "selecorr", 's',
1695 additional_error))
1696 goto failure;
1697
1698 break;
1699 case 'r': /* mean squared displacement. */
1700
1701 if (args_info->correlation_function_group_counter && override)
1702 reset_group_correlation_function (args_info);
1703 args_info->correlation_function_group_counter += 1;
1704
1705 if (update_arg( 0 ,
1706 0 , &(args_info->rcorr_given),
1707 &(local_args_info.rcorr_given), optarg, 0, 0, ARG_NO,
1708 check_ambiguity, override, 0, 0,
1709 "rcorr", 'r',
1710 additional_error))
1711 goto failure;
1712
1713 break;
1714 case 'v': /* velocity correlation function. */
1715
1716 if (args_info->correlation_function_group_counter && override)
1717 reset_group_correlation_function (args_info);
1718 args_info->correlation_function_group_counter += 1;
1719
1720 if (update_arg( 0 ,
1721 0 , &(args_info->vcorr_given),
1722 &(local_args_info.vcorr_given), optarg, 0, 0, ARG_NO,
1723 check_ambiguity, override, 0, 0,
1724 "vcorr", 'v',
1725 additional_error))
1726 goto failure;
1727
1728 break;
1729 case 'w': /* charge velocity correlation function. */
1730
1731 if (args_info->correlation_function_group_counter && override)
1732 reset_group_correlation_function (args_info);
1733 args_info->correlation_function_group_counter += 1;
1734
1735 if (update_arg( 0 ,
1736 0 , &(args_info->wcorr_given),
1737 &(local_args_info.wcorr_given), optarg, 0, 0, ARG_NO,
1738 check_ambiguity, override, 0, 0,
1739 "wcorr", 'w',
1740 additional_error))
1741 goto failure;
1742
1743 break;
1744 case 'd': /* dipole correlation function. */
1745
1746 if (args_info->correlation_function_group_counter && override)
1747 reset_group_correlation_function (args_info);
1748 args_info->correlation_function_group_counter += 1;
1749
1750 if (update_arg( 0 ,
1751 0 , &(args_info->dcorr_given),
1752 &(local_args_info.dcorr_given), optarg, 0, 0, ARG_NO,
1753 check_ambiguity, override, 0, 0,
1754 "dcorr", 'd',
1755 additional_error))
1756 goto failure;
1757
1758 break;
1759 case 'l': /* Lengendre correlation function. */
1760
1761 if (args_info->correlation_function_group_counter && override)
1762 reset_group_correlation_function (args_info);
1763 args_info->correlation_function_group_counter += 1;
1764
1765 if (update_arg( 0 ,
1766 0 , &(args_info->lcorr_given),
1767 &(local_args_info.lcorr_given), optarg, 0, 0, ARG_NO,
1768 check_ambiguity, override, 0, 0,
1769 "lcorr", 'l',
1770 additional_error))
1771 goto failure;
1772
1773 break;
1774 case 'M': /* System dipole correlation function. */
1775
1776 if (args_info->correlation_function_group_counter && override)
1777 reset_group_correlation_function (args_info);
1778 args_info->correlation_function_group_counter += 1;
1779
1780 if (update_arg( 0 ,
1781 0 , &(args_info->sdcorr_given),
1782 &(local_args_info.sdcorr_given), optarg, 0, 0, ARG_NO,
1783 check_ambiguity, override, 0, 0,
1784 "sdcorr", 'M',
1785 additional_error))
1786 goto failure;
1787
1788 break;
1789 case 'b': /* Bond extension correlation function. */
1790
1791 if (args_info->correlation_function_group_counter && override)
1792 reset_group_correlation_function (args_info);
1793 args_info->correlation_function_group_counter += 1;
1794
1795 if (update_arg( 0 ,
1796 0 , &(args_info->bondcorr_given),
1797 &(local_args_info.bondcorr_given), optarg, 0, 0, ARG_NO,
1798 check_ambiguity, override, 0, 0,
1799 "bondcorr", 'b',
1800 additional_error))
1801 goto failure;
1802
1803 break;
1804 case 'f': /* Frequency Fluctuation correlation function. */
1805
1806 if (args_info->correlation_function_group_counter && override)
1807 reset_group_correlation_function (args_info);
1808 args_info->correlation_function_group_counter += 1;
1809
1810 if (update_arg( 0 ,
1811 0 , &(args_info->freqfluccorr_given),
1812 &(local_args_info.freqfluccorr_given), optarg, 0, 0, ARG_NO,
1813 check_ambiguity, override, 0, 0,
1814 "freqfluccorr", 'f',
1815 additional_error))
1816 goto failure;
1817
1818 break;
1819 case 'j': /* Hydrogen bond jump time correlation function. */
1820
1821 if (args_info->correlation_function_group_counter && override)
1822 reset_group_correlation_function (args_info);
1823 args_info->correlation_function_group_counter += 1;
1824
1825 if (update_arg( 0 ,
1826 0 , &(args_info->jumptime_given),
1827 &(local_args_info.jumptime_given), optarg, 0, 0, ARG_NO,
1828 check_ambiguity, override, 0, 0,
1829 "jumptime", 'j',
1830 additional_error))
1831 goto failure;
1832
1833 break;
1834
1835 case 0: /* Long option with no short option */
1836 /* select first stuntdouble set. */
1837 if (strcmp (long_options[option_index].name, "sele1") == 0)
1838 {
1839
1840
1841 if (update_arg( (void *)&(args_info->sele1_arg),
1842 &(args_info->sele1_orig), &(args_info->sele1_given),
1843 &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING,
1844 check_ambiguity, override, 0, 0,
1845 "sele1", '-',
1846 additional_error))
1847 goto failure;
1848
1849 }
1850 /* select second stuntdouble set (if sele2 is not set, use script from sele1). */
1851 else if (strcmp (long_options[option_index].name, "sele2") == 0)
1852 {
1853
1854
1855 if (update_arg( (void *)&(args_info->sele2_arg),
1856 &(args_info->sele2_orig), &(args_info->sele2_given),
1857 &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING,
1858 check_ambiguity, override, 0, 0,
1859 "sele2", '-',
1860 additional_error))
1861 goto failure;
1862
1863 }
1864 /* select third stuntdouble set. */
1865 else if (strcmp (long_options[option_index].name, "sele3") == 0)
1866 {
1867
1868
1869 if (update_arg( (void *)&(args_info->sele3_arg),
1870 &(args_info->sele3_orig), &(args_info->sele3_given),
1871 &(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING,
1872 check_ambiguity, override, 0, 0,
1873 "sele3", '-',
1874 additional_error))
1875 goto failure;
1876
1877 }
1878 /* Lengendre Polynomial Order. */
1879 else if (strcmp (long_options[option_index].name, "order") == 0)
1880 {
1881
1882
1883 if (update_arg( (void *)&(args_info->order_arg),
1884 &(args_info->order_orig), &(args_info->order_given),
1885 &(local_args_info.order_given), optarg, 0, 0, ARG_INT,
1886 check_ambiguity, override, 0, 0,
1887 "order", '-',
1888 additional_error))
1889 goto failure;
1890
1891 }
1892 /* Oxygen-Oxygen cutoff radius (angstroms). */
1893 else if (strcmp (long_options[option_index].name, "OOcut") == 0)
1894 {
1895
1896
1897 if (update_arg( (void *)&(args_info->OOcut_arg),
1898 &(args_info->OOcut_orig), &(args_info->OOcut_given),
1899 &(local_args_info.OOcut_given), optarg, 0, "3.5", ARG_DOUBLE,
1900 check_ambiguity, override, 0, 0,
1901 "OOcut", '-',
1902 additional_error))
1903 goto failure;
1904
1905 }
1906 /* HOO cutoff angle (degrees). */
1907 else if (strcmp (long_options[option_index].name, "thetacut") == 0)
1908 {
1909
1910
1911 if (update_arg( (void *)&(args_info->thetacut_arg),
1912 &(args_info->thetacut_orig), &(args_info->thetacut_given),
1913 &(local_args_info.thetacut_given), optarg, 0, "30", ARG_DOUBLE,
1914 check_ambiguity, override, 0, 0,
1915 "thetacut", '-',
1916 additional_error))
1917 goto failure;
1918
1919 }
1920 /* Oxygen-Hydrogen cutoff radius (angstroms). */
1921 else if (strcmp (long_options[option_index].name, "OHcut") == 0)
1922 {
1923
1924
1925 if (update_arg( (void *)&(args_info->OHcut_arg),
1926 &(args_info->OHcut_orig), &(args_info->OHcut_given),
1927 &(local_args_info.OHcut_given), optarg, 0, "2.45", ARG_DOUBLE,
1928 check_ambiguity, override, 0, 0,
1929 "OHcut", '-',
1930 additional_error))
1931 goto failure;
1932
1933 }
1934 /* which axis is special for spatial analysis (default = z axis). */
1935 else if (strcmp (long_options[option_index].name, "privilegedAxis") == 0)
1936 {
1937
1938
1939 if (update_arg( (void *)&(args_info->privilegedAxis_arg),
1940 &(args_info->privilegedAxis_orig), &(args_info->privilegedAxis_given),
1941 &(local_args_info.privilegedAxis_given), optarg, cmdline_parser_privilegedAxis_values, "z", ARG_ENUM,
1942 check_ambiguity, override, 0, 0,
1943 "privilegedAxis", '-',
1944 additional_error))
1945 goto failure;
1946
1947 }
1948 /* maximum length. */
1949 else if (strcmp (long_options[option_index].name, "length") == 0)
1950 {
1951
1952
1953 if (update_arg( (void *)&(args_info->length_arg),
1954 &(args_info->length_orig), &(args_info->length_given),
1955 &(local_args_info.length_given), optarg, 0, "100", ARG_DOUBLE,
1956 check_ambiguity, override, 0, 0,
1957 "length", '-',
1958 additional_error))
1959 goto failure;
1960
1961 }
1962 /* X-component of the dipole with respect to body frame. */
1963 else if (strcmp (long_options[option_index].name, "dipoleX") == 0)
1964 {
1965
1966
1967 if (update_arg( (void *)&(args_info->dipoleX_arg),
1968 &(args_info->dipoleX_orig), &(args_info->dipoleX_given),
1969 &(local_args_info.dipoleX_given), optarg, 0, "0.0", ARG_DOUBLE,
1970 check_ambiguity, override, 0, 0,
1971 "dipoleX", '-',
1972 additional_error))
1973 goto failure;
1974
1975 }
1976 /* Y-component of the dipole with respect to body frame. */
1977 else if (strcmp (long_options[option_index].name, "dipoleY") == 0)
1978 {
1979
1980
1981 if (update_arg( (void *)&(args_info->dipoleY_arg),
1982 &(args_info->dipoleY_orig), &(args_info->dipoleY_given),
1983 &(local_args_info.dipoleY_given), optarg, 0, "0.0", ARG_DOUBLE,
1984 check_ambiguity, override, 0, 0,
1985 "dipoleY", '-',
1986 additional_error))
1987 goto failure;
1988
1989 }
1990 /* Z-component of the dipole with respect to body frame. */
1991 else if (strcmp (long_options[option_index].name, "dipoleZ") == 0)
1992 {
1993
1994
1995 if (update_arg( (void *)&(args_info->dipoleZ_arg),
1996 &(args_info->dipoleZ_orig), &(args_info->dipoleZ_given),
1997 &(local_args_info.dipoleZ_given), optarg, 0, "-1.0", ARG_DOUBLE,
1998 check_ambiguity, override, 0, 0,
1999 "dipoleZ", '-',
2000 additional_error))
2001 goto failure;
2002
2003 }
2004 /* mean squared displacement binned by Z. */
2005 else if (strcmp (long_options[option_index].name, "rcorrZ") == 0)
2006 {
2007
2008 if (args_info->correlation_function_group_counter && override)
2009 reset_group_correlation_function (args_info);
2010 args_info->correlation_function_group_counter += 1;
2011
2012 if (update_arg( 0 ,
2013 0 , &(args_info->rcorrZ_given),
2014 &(local_args_info.rcorrZ_given), optarg, 0, 0, ARG_NO,
2015 check_ambiguity, override, 0, 0,
2016 "rcorrZ", '-',
2017 additional_error))
2018 goto failure;
2019
2020 }
2021 /* velocity correlation function along z-axis. */
2022 else if (strcmp (long_options[option_index].name, "vcorrZ") == 0)
2023 {
2024
2025 if (args_info->correlation_function_group_counter && override)
2026 reset_group_correlation_function (args_info);
2027 args_info->correlation_function_group_counter += 1;
2028
2029 if (update_arg( 0 ,
2030 0 , &(args_info->vcorrZ_given),
2031 &(local_args_info.vcorrZ_given), optarg, 0, 0, ARG_NO,
2032 check_ambiguity, override, 0, 0,
2033 "vcorrZ", '-',
2034 additional_error))
2035 goto failure;
2036
2037 }
2038 /* velocity correlation function projected radially. */
2039 else if (strcmp (long_options[option_index].name, "vcorrR") == 0)
2040 {
2041
2042 if (args_info->correlation_function_group_counter && override)
2043 reset_group_correlation_function (args_info);
2044 args_info->correlation_function_group_counter += 1;
2045
2046 if (update_arg( 0 ,
2047 0 , &(args_info->vcorrR_given),
2048 &(local_args_info.vcorrR_given), optarg, 0, 0, ARG_NO,
2049 check_ambiguity, override, 0, 0,
2050 "vcorrR", '-',
2051 additional_error))
2052 goto failure;
2053
2054 }
2055 /* Velocity - Velocity auto outer product correlation function. */
2056 else if (strcmp (long_options[option_index].name, "vaOutProdcorr") == 0)
2057 {
2058
2059 if (args_info->correlation_function_group_counter && override)
2060 reset_group_correlation_function (args_info);
2061 args_info->correlation_function_group_counter += 1;
2062
2063 if (update_arg( 0 ,
2064 0 , &(args_info->vaOutProdcorr_given),
2065 &(local_args_info.vaOutProdcorr_given), optarg, 0, 0, ARG_NO,
2066 check_ambiguity, override, 0, 0,
2067 "vaOutProdcorr", '-',
2068 additional_error))
2069 goto failure;
2070
2071 }
2072 /* Angular Velocity - Angular Velocity auto outer product correlation function. */
2073 else if (strcmp (long_options[option_index].name, "waOutProdcorr") == 0)
2074 {
2075
2076 if (args_info->correlation_function_group_counter && override)
2077 reset_group_correlation_function (args_info);
2078 args_info->correlation_function_group_counter += 1;
2079
2080 if (update_arg( 0 ,
2081 0 , &(args_info->waOutProdcorr_given),
2082 &(local_args_info.waOutProdcorr_given), optarg, 0, 0, ARG_NO,
2083 check_ambiguity, override, 0, 0,
2084 "waOutProdcorr", '-',
2085 additional_error))
2086 goto failure;
2087
2088 }
2089 /* Velocity - Angular Velocity outer product correlation function. */
2090 else if (strcmp (long_options[option_index].name, "vwOutProdcorr") == 0)
2091 {
2092
2093 if (args_info->correlation_function_group_counter && override)
2094 reset_group_correlation_function (args_info);
2095 args_info->correlation_function_group_counter += 1;
2096
2097 if (update_arg( 0 ,
2098 0 , &(args_info->vwOutProdcorr_given),
2099 &(local_args_info.vwOutProdcorr_given), optarg, 0, 0, ARG_NO,
2100 check_ambiguity, override, 0, 0,
2101 "vwOutProdcorr", '-',
2102 additional_error))
2103 goto failure;
2104
2105 }
2106 /* Angular Velocity - Velocity outer product correlation function. */
2107 else if (strcmp (long_options[option_index].name, "wvOutProdcorr") == 0)
2108 {
2109
2110 if (args_info->correlation_function_group_counter && override)
2111 reset_group_correlation_function (args_info);
2112 args_info->correlation_function_group_counter += 1;
2113
2114 if (update_arg( 0 ,
2115 0 , &(args_info->wvOutProdcorr_given),
2116 &(local_args_info.wvOutProdcorr_given), optarg, 0, 0, ARG_NO,
2117 check_ambiguity, override, 0, 0,
2118 "wvOutProdcorr", '-',
2119 additional_error))
2120 goto failure;
2121
2122 }
2123 /* Lengendre correlation function binned by Z. */
2124 else if (strcmp (long_options[option_index].name, "lcorrZ") == 0)
2125 {
2126
2127 if (args_info->correlation_function_group_counter && override)
2128 reset_group_correlation_function (args_info);
2129 args_info->correlation_function_group_counter += 1;
2130
2131 if (update_arg( 0 ,
2132 0 , &(args_info->lcorrZ_given),
2133 &(local_args_info.lcorrZ_given), optarg, 0, 0, ARG_NO,
2134 check_ambiguity, override, 0, 0,
2135 "lcorrZ", '-',
2136 additional_error))
2137 goto failure;
2138
2139 }
2140 /* Lengendre correlation function for OH bond vectors binned by Z. */
2141 else if (strcmp (long_options[option_index].name, "cohZ") == 0)
2142 {
2143
2144 if (args_info->correlation_function_group_counter && override)
2145 reset_group_correlation_function (args_info);
2146 args_info->correlation_function_group_counter += 1;
2147
2148 if (update_arg( 0 ,
2149 0 , &(args_info->cohZ_given),
2150 &(local_args_info.cohZ_given), optarg, 0, 0, ARG_NO,
2151 check_ambiguity, override, 0, 0,
2152 "cohZ", '-',
2153 additional_error))
2154 goto failure;
2155
2156 }
2157 /* Radial msd. */
2158 else if (strcmp (long_options[option_index].name, "r_rcorr") == 0)
2159 {
2160
2161 if (args_info->correlation_function_group_counter && override)
2162 reset_group_correlation_function (args_info);
2163 args_info->correlation_function_group_counter += 1;
2164
2165 if (update_arg( 0 ,
2166 0 , &(args_info->r_rcorr_given),
2167 &(local_args_info.r_rcorr_given), optarg, 0, 0, ARG_NO,
2168 check_ambiguity, override, 0, 0,
2169 "r_rcorr", '-',
2170 additional_error))
2171 goto failure;
2172
2173 }
2174 /* Angular msd. */
2175 else if (strcmp (long_options[option_index].name, "thetacorr") == 0)
2176 {
2177
2178 if (args_info->correlation_function_group_counter && override)
2179 reset_group_correlation_function (args_info);
2180 args_info->correlation_function_group_counter += 1;
2181
2182 if (update_arg( 0 ,
2183 0 , &(args_info->thetacorr_given),
2184 &(local_args_info.thetacorr_given), optarg, 0, 0, ARG_NO,
2185 check_ambiguity, override, 0, 0,
2186 "thetacorr", '-',
2187 additional_error))
2188 goto failure;
2189
2190 }
2191 /* Directional msd for particles with unit vectors. */
2192 else if (strcmp (long_options[option_index].name, "drcorr") == 0)
2193 {
2194
2195 if (args_info->correlation_function_group_counter && override)
2196 reset_group_correlation_function (args_info);
2197 args_info->correlation_function_group_counter += 1;
2198
2199 if (update_arg( 0 ,
2200 0 , &(args_info->drcorr_given),
2201 &(local_args_info.drcorr_given), optarg, 0, 0, ARG_NO,
2202 check_ambiguity, override, 0, 0,
2203 "drcorr", '-',
2204 additional_error))
2205 goto failure;
2206
2207 }
2208 /* Stress tensor correlation function. */
2209 else if (strcmp (long_options[option_index].name, "stresscorr") == 0)
2210 {
2211
2212 if (args_info->correlation_function_group_counter && override)
2213 reset_group_correlation_function (args_info);
2214 args_info->correlation_function_group_counter += 1;
2215
2216 if (update_arg( 0 ,
2217 0 , &(args_info->stresscorr_given),
2218 &(local_args_info.stresscorr_given), optarg, 0, 0, ARG_NO,
2219 check_ambiguity, override, 0, 0,
2220 "stresscorr", '-',
2221 additional_error))
2222 goto failure;
2223
2224 }
2225 /* Hydrogen bond jump time correlation function binned by Z. */
2226 else if (strcmp (long_options[option_index].name, "jumptimeZ") == 0)
2227 {
2228
2229 if (args_info->correlation_function_group_counter && override)
2230 reset_group_correlation_function (args_info);
2231 args_info->correlation_function_group_counter += 1;
2232
2233 if (update_arg( 0 ,
2234 0 , &(args_info->jumptimeZ_given),
2235 &(local_args_info.jumptimeZ_given), optarg, 0, 0, ARG_NO,
2236 check_ambiguity, override, 0, 0,
2237 "jumptimeZ", '-',
2238 additional_error))
2239 goto failure;
2240
2241 }
2242 /* Hydrogen bond jump time correlation function binned by R around a third selection. */
2243 else if (strcmp (long_options[option_index].name, "jumptimeR") == 0)
2244 {
2245
2246 if (args_info->correlation_function_group_counter && override)
2247 reset_group_correlation_function (args_info);
2248 args_info->correlation_function_group_counter += 1;
2249
2250 if (update_arg( 0 ,
2251 0 , &(args_info->jumptimeR_given),
2252 &(local_args_info.jumptimeR_given), optarg, 0, 0, ARG_NO,
2253 check_ambiguity, override, 0, 0,
2254 "jumptimeR", '-',
2255 additional_error))
2256 goto failure;
2257
2258 }
2259 /* Hydrogen bond persistence correlation function. */
2260 else if (strcmp (long_options[option_index].name, "persistence") == 0)
2261 {
2262
2263 if (args_info->correlation_function_group_counter && override)
2264 reset_group_correlation_function (args_info);
2265 args_info->correlation_function_group_counter += 1;
2266
2267 if (update_arg( 0 ,
2268 0 , &(args_info->persistence_given),
2269 &(local_args_info.persistence_given), optarg, 0, 0, ARG_NO,
2270 check_ambiguity, override, 0, 0,
2271 "persistence", '-',
2272 additional_error))
2273 goto failure;
2274
2275 }
2276 /* Momentum - Angular Momentum cross correlation function. */
2277 else if (strcmp (long_options[option_index].name, "pjcorr") == 0)
2278 {
2279
2280 if (args_info->correlation_function_group_counter && override)
2281 reset_group_correlation_function (args_info);
2282 args_info->correlation_function_group_counter += 1;
2283
2284 if (update_arg( 0 ,
2285 0 , &(args_info->pjcorr_given),
2286 &(local_args_info.pjcorr_given), optarg, 0, 0, ARG_NO,
2287 check_ambiguity, override, 0, 0,
2288 "pjcorr", '-',
2289 additional_error))
2290 goto failure;
2291
2292 }
2293 /* Force - Torque cross correlation function. */
2294 else if (strcmp (long_options[option_index].name, "ftcorr") == 0)
2295 {
2296
2297 if (args_info->correlation_function_group_counter && override)
2298 reset_group_correlation_function (args_info);
2299 args_info->correlation_function_group_counter += 1;
2300
2301 if (update_arg( 0 ,
2302 0 , &(args_info->ftcorr_given),
2303 &(local_args_info.ftcorr_given), optarg, 0, 0, ARG_NO,
2304 check_ambiguity, override, 0, 0,
2305 "ftcorr", '-',
2306 additional_error))
2307 goto failure;
2308
2309 }
2310 /* Charge - Kinetic energy cross correlation function. */
2311 else if (strcmp (long_options[option_index].name, "ckcorr") == 0)
2312 {
2313
2314 if (args_info->correlation_function_group_counter && override)
2315 reset_group_correlation_function (args_info);
2316 args_info->correlation_function_group_counter += 1;
2317
2318 if (update_arg( 0 ,
2319 0 , &(args_info->ckcorr_given),
2320 &(local_args_info.ckcorr_given), optarg, 0, 0, ARG_NO,
2321 check_ambiguity, override, 0, 0,
2322 "ckcorr", '-',
2323 additional_error))
2324 goto failure;
2325
2326 }
2327 /* Charge - Orientation order parameter (Cos\theta) cross correlation function. */
2328 else if (strcmp (long_options[option_index].name, "cscorr") == 0)
2329 {
2330
2331 if (args_info->correlation_function_group_counter && override)
2332 reset_group_correlation_function (args_info);
2333 args_info->correlation_function_group_counter += 1;
2334
2335 if (update_arg( 0 ,
2336 0 , &(args_info->cscorr_given),
2337 &(local_args_info.cscorr_given), optarg, 0, 0, ARG_NO,
2338 check_ambiguity, override, 0, 0,
2339 "cscorr", '-',
2340 additional_error))
2341 goto failure;
2342
2343 }
2344 /* Force - Force auto correlation function. */
2345 else if (strcmp (long_options[option_index].name, "facorr") == 0)
2346 {
2347
2348 if (args_info->correlation_function_group_counter && override)
2349 reset_group_correlation_function (args_info);
2350 args_info->correlation_function_group_counter += 1;
2351
2352 if (update_arg( 0 ,
2353 0 , &(args_info->facorr_given),
2354 &(local_args_info.facorr_given), optarg, 0, 0, ARG_NO,
2355 check_ambiguity, override, 0, 0,
2356 "facorr", '-',
2357 additional_error))
2358 goto failure;
2359
2360 }
2361 /* Torque - Force Cross correlation function. */
2362 else if (strcmp (long_options[option_index].name, "tfcorr") == 0)
2363 {
2364
2365 if (args_info->correlation_function_group_counter && override)
2366 reset_group_correlation_function (args_info);
2367 args_info->correlation_function_group_counter += 1;
2368
2369 if (update_arg( 0 ,
2370 0 , &(args_info->tfcorr_given),
2371 &(local_args_info.tfcorr_given), optarg, 0, 0, ARG_NO,
2372 check_ambiguity, override, 0, 0,
2373 "tfcorr", '-',
2374 additional_error))
2375 goto failure;
2376
2377 }
2378 /* Torque auto correlation function. */
2379 else if (strcmp (long_options[option_index].name, "tacorr") == 0)
2380 {
2381
2382 if (args_info->correlation_function_group_counter && override)
2383 reset_group_correlation_function (args_info);
2384 args_info->correlation_function_group_counter += 1;
2385
2386 if (update_arg( 0 ,
2387 0 , &(args_info->tacorr_given),
2388 &(local_args_info.tacorr_given), optarg, 0, 0, ARG_NO,
2389 check_ambiguity, override, 0, 0,
2390 "tacorr", '-',
2391 additional_error))
2392 goto failure;
2393
2394 }
2395 /* Displacement correlation function. */
2396 else if (strcmp (long_options[option_index].name, "disp") == 0)
2397 {
2398
2399 if (args_info->correlation_function_group_counter && override)
2400 reset_group_correlation_function (args_info);
2401 args_info->correlation_function_group_counter += 1;
2402
2403 if (update_arg( 0 ,
2404 0 , &(args_info->disp_given),
2405 &(local_args_info.disp_given), optarg, 0, 0, ARG_NO,
2406 check_ambiguity, override, 0, 0,
2407 "disp", '-',
2408 additional_error))
2409 goto failure;
2410
2411 }
2412 /* Displacement correlation function binned by Z. */
2413 else if (strcmp (long_options[option_index].name, "dispZ") == 0)
2414 {
2415
2416 if (args_info->correlation_function_group_counter && override)
2417 reset_group_correlation_function (args_info);
2418 args_info->correlation_function_group_counter += 1;
2419
2420 if (update_arg( 0 ,
2421 0 , &(args_info->dispZ_given),
2422 &(local_args_info.dispZ_given), optarg, 0, 0, ARG_NO,
2423 check_ambiguity, override, 0, 0,
2424 "dispZ", '-',
2425 additional_error))
2426 goto failure;
2427
2428 }
2429 /* Current density auto correlation function. */
2430 else if (strcmp (long_options[option_index].name, "current") == 0)
2431 {
2432
2433 if (args_info->correlation_function_group_counter && override)
2434 reset_group_correlation_function (args_info);
2435 args_info->correlation_function_group_counter += 1;
2436
2437 if (update_arg( 0 ,
2438 0 , &(args_info->current_given),
2439 &(local_args_info.current_given), optarg, 0, 0, ARG_NO,
2440 check_ambiguity, override, 0, 0,
2441 "current", '-',
2442 additional_error))
2443 goto failure;
2444
2445 }
2446 /* Onsager coefficient correlation functions. */
2447 else if (strcmp (long_options[option_index].name, "onsager") == 0)
2448 {
2449
2450 if (args_info->correlation_function_group_counter && override)
2451 reset_group_correlation_function (args_info);
2452 args_info->correlation_function_group_counter += 1;
2453
2454 if (update_arg( 0 ,
2455 0 , &(args_info->onsager_given),
2456 &(local_args_info.onsager_given), optarg, 0, 0, ARG_NO,
2457 check_ambiguity, override, 0, 0,
2458 "onsager", '-',
2459 additional_error))
2460 goto failure;
2461
2462 }
2463 /* Collective Dipole displacement function (Helfand moment of Current Density). */
2464 else if (strcmp (long_options[option_index].name, "ddisp") == 0)
2465 {
2466
2467 if (args_info->correlation_function_group_counter && override)
2468 reset_group_correlation_function (args_info);
2469 args_info->correlation_function_group_counter += 1;
2470
2471 if (update_arg( 0 ,
2472 0 , &(args_info->ddisp_given),
2473 &(local_args_info.ddisp_given), optarg, 0, 0, ARG_NO,
2474 check_ambiguity, override, 0, 0,
2475 "ddisp", '-',
2476 additional_error))
2477 goto failure;
2478
2479 }
2480 /* Displacement correlation function for rotation angles. */
2481 else if (strcmp (long_options[option_index].name, "rotAngleDisp") == 0)
2482 {
2483
2484 if (args_info->correlation_function_group_counter && override)
2485 reset_group_correlation_function (args_info);
2486 args_info->correlation_function_group_counter += 1;
2487
2488 if (update_arg( 0 ,
2489 0 , &(args_info->rotAngleDisp_given),
2490 &(local_args_info.rotAngleDisp_given), optarg, 0, 0, ARG_NO,
2491 check_ambiguity, override, 0, 0,
2492 "rotAngleDisp", '-',
2493 additional_error))
2494 goto failure;
2495
2496 }
2497 /* mean displacement. */
2498 else if (strcmp (long_options[option_index].name, "meandisp") == 0)
2499 {
2500
2501 if (args_info->correlation_function_group_counter && override)
2502 reset_group_correlation_function (args_info);
2503 args_info->correlation_function_group_counter += 1;
2504
2505 if (update_arg( 0 ,
2506 0 , &(args_info->meandisp_given),
2507 &(local_args_info.meandisp_given), optarg, 0, 0, ARG_NO,
2508 check_ambiguity, override, 0, 0,
2509 "meandisp", '-',
2510 additional_error))
2511 goto failure;
2512
2513 }
2514
2515 break;
2516 case '?': /* Invalid option. */
2517 /* `getopt_long' already printed an error message. */
2518 goto failure;
2519
2520 default: /* bug: option not considered. */
2521 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
2522 abort ();
2523 } /* switch */
2524 } /* while */
2525
2526 if (args_info->correlation_function_group_counter > 1)
2527 {
2528 fprintf (stderr, "%s: %d options of group correlation function were given. One is required%s.\n", argv[0], args_info->correlation_function_group_counter, (additional_error ? additional_error : ""));
2529 error_occurred = 1;
2530 }
2531
2532
2533
2534 if (check_required)
2535 {
2536 error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error);
2537 }
2538
2539 cmdline_parser_release (&local_args_info);
2540
2541 if ( error_occurred )
2542 return (EXIT_FAILURE);
2543
2544 if (optind < argc)
2545 {
2546 int i = 0 ;
2547 int found_prog_name = 0;
2548 /* whether program name, i.e., argv[0], is in the remaining args
2549 (this may happen with some implementations of getopt,
2550 but surely not with the one included by gengetopt) */
2551
2552
2553 args_info->inputs_num = argc - optind - found_prog_name;
2554 args_info->inputs =
2555 (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
2556 while (optind < argc)
2557 args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;
2558 }
2559
2560 return 0;
2561
2562failure:
2563
2564 cmdline_parser_release (&local_args_info);
2565 return (EXIT_FAILURE);
2566}
2567/* vim: set ft=c noet ts=8 sts=8 sw=8 tw=80 nojs spell : */
#define CMDLINE_PARSER_VERSION
the program version
#define CMDLINE_PARSER_PACKAGE_NAME
the complete program name (used for help and version)
#define CMDLINE_PARSER_PACKAGE
the program name (used for printing errors)
The header file for the command line option parser generated by GNU Gengetopt version 2....
The additional parameters to pass to parser functions.
int print_errors
whether getopt_long should print an error message for a bad option (default 1)
int check_required
whether to check that all required options were provided (default 1)
int check_ambiguity
whether to check for options already specified in the option structure gengetopt_args_info (default 0...
int initialize
whether to initialize the option structure gengetopt_args_info (default 1)
int override
whether to override possibly already present options (default 0)
Where the command line options are stored.
unsigned int jumptimeZ_given
Whether jumptimeZ was given.
const char * jumptimeZ_help
Hydrogen bond jump time correlation function binned by Z help description.
char * sele2_arg
select second stuntdouble set (if sele2 is not set, use script from sele1).
const char * vwOutProdcorr_help
Velocity - Angular Velocity outer product correlation function help description.
unsigned int persistence_given
Whether persistence was given.
char * nbins_orig
Number of bins original value given at command line.
char * dipoleX_orig
X-component of the dipole with respect to body frame original value given at command line.
unsigned int freqfluccorr_given
Whether freqfluccorr was given.
unsigned int r_rcorr_given
Whether r_rcorr was given.
unsigned int output_given
Whether output was given.
const char * ckcorr_help
Charge - Kinetic energy cross correlation function help description.
unsigned int vcorrZ_given
Whether vcorrZ was given.
const char * ftcorr_help
Force - Torque cross correlation function help description.
unsigned int privilegedAxis_given
Whether privilegedAxis was given.
unsigned int drcorr_given
Whether drcorr was given.
unsigned int selecorr_given
Whether selecorr was given.
unsigned int OHcut_given
Whether OHcut was given.
const char * rcut_help
cutoff radius (angstroms) help description.
unsigned int thetacut_given
Whether thetacut was given.
const char * lcorr_help
Lengendre correlation function help description.
const char * dcorr_help
dipole correlation function help description.
unsigned int dcorr_given
Whether dcorr was given.
char * output_orig
output file name original value given at command line.
const char * output_help
output file name help description.
const char * nbins_help
Number of bins help description.
const char * dipoleZ_help
Z-component of the dipole with respect to body frame help description.
unsigned int onsager_given
Whether onsager was given.
unsigned int current_given
Whether current was given.
unsigned int sele3_given
Whether sele3 was given.
double dipoleZ_arg
Z-component of the dipole with respect to body frame (default='-1.0').
unsigned int lcorrZ_given
Whether lcorrZ was given.
const char * sele1_help
select first stuntdouble set help description.
unsigned int disp_given
Whether disp was given.
unsigned int order_given
Whether order was given.
const char * jumptime_help
Hydrogen bond jump time correlation function help description.
const char * waOutProdcorr_help
Angular Velocity - Angular Velocity auto outer product correlation function help description.
char * dipoleY_orig
Y-component of the dipole with respect to body frame original value given at command line.
const char * tfcorr_help
Torque - Force Cross correlation function help description.
const char * persistence_help
Hydrogen bond persistence correlation function help description.
char * sele3_orig
select third stuntdouble set original value given at command line.
unsigned int tacorr_given
Whether tacorr was given.
const char * OHcut_help
Oxygen-Hydrogen cutoff radius (angstroms) help description.
const char * sele2_help
select second stuntdouble set (if sele2 is not set, use script from sele1) help description.
unsigned inputs_num
unamed options number
char * privilegedAxis_orig
which axis is special for spatial analysis (default = z axis) original value given at command line.
unsigned int OOcut_given
Whether OOcut was given.
int order_arg
Lengendre Polynomial Order.
const char * selecorr_help
selection correlation function help description.
double dipoleY_arg
Y-component of the dipole with respect to body frame (default='0.0').
unsigned int vcorr_given
Whether vcorr was given.
unsigned int tfcorr_given
Whether tfcorr was given.
const char * rotAngleDisp_help
Displacement correlation function for rotation angles help description.
unsigned int wcorr_given
Whether wcorr was given.
unsigned int pjcorr_given
Whether pjcorr was given.
const char * thetacut_help
HOO cutoff angle (degrees) help description.
char * order_orig
Lengendre Polynomial Order original value given at command line.
const char * wcorr_help
charge velocity correlation function help description.
unsigned int lcorr_given
Whether lcorr was given.
char * OOcut_orig
Oxygen-Oxygen cutoff radius (angstroms) original value given at command line.
const char * stresscorr_help
Stress tensor correlation function help description.
unsigned int meandisp_given
Whether meandisp was given.
double length_arg
maximum length (default='100').
unsigned int facorr_given
Whether facorr was given.
unsigned int bondcorr_given
Whether bondcorr was given.
const char * help_help
Print help and exit help description.
char * sele3_arg
select third stuntdouble set.
const char * cscorr_help
Charge - Orientation order parameter (Cos\theta) cross correlation function help description.
const char * rcorrZ_help
mean squared displacement binned by Z help description.
unsigned int dipoleX_given
Whether dipoleX was given.
char * output_arg
output file name.
char ** inputs
unamed options (options without names)
const char * thetacorr_help
Angular msd help description.
unsigned int cscorr_given
Whether cscorr was given.
unsigned int jumptimeR_given
Whether jumptimeR was given.
unsigned int rcorr_given
Whether rcorr was given.
char * input_arg
input dump file.
double thetacut_arg
HOO cutoff angle (degrees) (default='30').
unsigned int dipoleZ_given
Whether dipoleZ was given.
unsigned int vwOutProdcorr_given
Whether vwOutProdcorr was given.
char * thetacut_orig
HOO cutoff angle (degrees) original value given at command line.
unsigned int sele1_given
Whether sele1 was given.
unsigned int length_given
Whether length was given.
const char * order_help
Lengendre Polynomial Order help description.
const char * wvOutProdcorr_help
Angular Velocity - Velocity outer product correlation function help description.
const char * vcorrR_help
velocity correlation function projected radially help description.
unsigned int ddisp_given
Whether ddisp was given.
double rcut_arg
cutoff radius (angstroms).
unsigned int jumptime_given
Whether jumptime was given.
char * nzbins_orig
Number of Z bins original value given at command line.
unsigned int ftcorr_given
Whether ftcorr was given.
unsigned int wvOutProdcorr_given
Whether wvOutProdcorr was given.
unsigned int stresscorr_given
Whether stresscorr was given.
unsigned int vaOutProdcorr_given
Whether vaOutProdcorr was given.
const char * rcorr_help
mean squared displacement help description.
const char * privilegedAxis_help
which axis is special for spatial analysis (default = z axis) help description.
char * sele2_orig
select second stuntdouble set (if sele2 is not set, use script from sele1) original value given at co...
const char * current_help
Current density auto correlation function help description.
const char * meandisp_help
mean displacement help description.
const char * vaOutProdcorr_help
Velocity - Velocity auto outer product correlation function help description.
unsigned int dispZ_given
Whether dispZ was given.
const char * freqfluccorr_help
Frequency Fluctuation correlation function help description.
const char * bondcorr_help
Bond extension correlation function help description.
const char * facorr_help
Force - Force auto correlation function help description.
const char * r_rcorr_help
Radial msd help description.
char * sele1_orig
select first stuntdouble set original value given at command line.
unsigned int rotAngleDisp_given
Whether rotAngleDisp was given.
unsigned int cohZ_given
Whether cohZ was given.
double OHcut_arg
Oxygen-Hydrogen cutoff radius (angstroms) (default='2.45').
char * length_orig
maximum length original value given at command line.
char * sele1_arg
select first stuntdouble set.
unsigned int ckcorr_given
Whether ckcorr was given.
const char * pjcorr_help
Momentum - Angular Momentum cross correlation function help description.
unsigned int dipoleY_given
Whether dipoleY was given.
const char * nzbins_help
Number of Z bins help description.
const char * drcorr_help
Directional msd for particles with unit vectors help description.
double dipoleX_arg
X-component of the dipole with respect to body frame (default='0.0').
unsigned int rcut_given
Whether rcut was given.
const char * ddisp_help
Collective Dipole displacement function (Helfand moment of Current Density) help description.
const char * tacorr_help
Torque auto correlation function help description.
int correlation_function_group_counter
Counter for group correlation_function.
char * OHcut_orig
Oxygen-Hydrogen cutoff radius (angstroms) original value given at command line.
unsigned int help_given
Whether help was given.
const char * sele3_help
select third stuntdouble set help description.
const char * vcorrZ_help
velocity correlation function along z-axis help description.
const char * vcorr_help
velocity correlation function help description.
unsigned int input_given
Whether input was given.
unsigned int rcorrZ_given
Whether rcorrZ was given.
int nbins_arg
Number of bins (default='100').
const char * onsager_help
Onsager coefficient correlation functions help description.
unsigned int sdcorr_given
Whether sdcorr was given.
enum enum_privilegedAxis privilegedAxis_arg
which axis is special for spatial analysis (default = z axis) (default='z').
unsigned int version_given
Whether version was given.
char * dipoleZ_orig
Z-component of the dipole with respect to body frame original value given at command line.
unsigned int thetacorr_given
Whether thetacorr was given.
const char * jumptimeR_help
Hydrogen bond jump time correlation function binned by R around a third selection help description.
const char * length_help
maximum length help description.
const char * dispZ_help
Displacement correlation function binned by Z help description.
const char * dipoleX_help
X-component of the dipole with respect to body frame help description.
unsigned int sele2_given
Whether sele2 was given.
const char * sdcorr_help
System dipole correlation function help description.
const char * version_help
Print version and exit help description.
char * input_orig
input dump file original value given at command line.
const char * disp_help
Displacement correlation function help description.
unsigned int nbins_given
Whether nbins was given.
unsigned int vcorrR_given
Whether vcorrR was given.
const char * lcorrZ_help
Lengendre correlation function binned by Z help description.
const char * cohZ_help
Lengendre correlation function for OH bond vectors binned by Z help description.
const char * OOcut_help
Oxygen-Oxygen cutoff radius (angstroms) help description.
unsigned int nzbins_given
Whether nzbins was given.
double OOcut_arg
Oxygen-Oxygen cutoff radius (angstroms) (default='3.5').
unsigned int waOutProdcorr_given
Whether waOutProdcorr was given.
char * rcut_orig
cutoff radius (angstroms) original value given at command line.
const char * input_help
input dump file help description.
int nzbins_arg
Number of Z bins (default='100').
const char * dipoleY_help
Y-component of the dipole with respect to body frame help description.
int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
Save the contents of the option struct into an already open FILE stream.
int cmdline_parser(int argc, char **argv, struct gengetopt_args_info *args_info)
The command line parser.
int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
Save the contents of the option struct into a (text) file.
int cmdline_parser2(int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
The command line parser (version with additional parameters - deprecated)
int cmdline_parser_required(struct gengetopt_args_info *args_info, const char *prog_name)
Checks that all the required options were specified.
struct cmdline_parser_params * cmdline_parser_params_create(void)
Allocates dynamically a cmdline_parser_params structure and initializes all its fields to their defau...
int cmdline_parser_ext(int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params)
The command line parser (version with additional parameters)
void cmdline_parser_init(struct gengetopt_args_info *args_info)
Initializes the passed gengetopt_args_info structure's fields (also set default values for options th...
void cmdline_parser_free(struct gengetopt_args_info *args_info)
Deallocates the string fields of the gengetopt_args_info structure (but does not deallocate the struc...
void cmdline_parser_params_init(struct cmdline_parser_params *params)
Initializes all the fields a cmdline_parser_params structure to their default values.