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