21#define FIX_UNUSED(X) (void) (X)
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\"";
29const char *gengetopt_args_info_usage =
"Usage: DynamicProps [OPTION]... [FILE]...";
31const char *gengetopt_args_info_versiontext =
"";
33const char *gengetopt_args_info_description =
"";
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 " --seleoffset=INT global index offset for a second object (used\n to define a vector between sites in molecule)",
44 " --order=INT Lengendre Polynomial Order",
45 " -n, --nbins=INT Number of bins (default=`100')",
46 " -z, --nzbins=INT Number of Z bins (default=`100')",
47 " --tcorr=DOUBLE Correlation time (length of each window) in fs\n (default=`100000.0')",
48 " --nstart=INT Number of frames to skip at start of trajectory\n (default=`0')",
49 " --tsep=DOUBLE Separation time between correlation windows (0\n = no gap) (default=`0.0')",
50 " --t_apod=DOUBLE Apodization time (fs) [filters tcorr with\n exp(-t/t_apod) in Fourier-transformed\n spectroscopic functions] (default=`0.0')",
51 " --t_zerofill=DOUBLE Zero-fill time (fs) [Pads time correlation\n functions with zeros from tcorr -> t_zerofill\n in Fourier-transformed spectroscopic\n functions] (default=`0.0')",
52 " -c, --rcut=DOUBLE cutoff radius (angstroms)",
53 " --OOcut=DOUBLE Oxygen-Oxygen cutoff radius (angstroms)\n (default=`3.5')",
54 " --thetacut=DOUBLE HOO cutoff angle (degrees) (default=`30')",
55 " --OHcut=DOUBLE Oxygen-Hydrogen cutoff radius (angstroms)\n (default=`2.45')",
56 " --privilegedAxis=ENUM which axis is special for spatial analysis\n (default = z axis) (possible values=\"x\",\n \"y\", \"z\" default=`z')",
57 " --length=DOUBLE maximum length (default=`100')",
58 " --dipoleX=DOUBLE X-component of the dipole with respect to body\n frame (default=`0.0')",
59 " --dipoleY=DOUBLE Y-component of the dipole with respect to body\n frame (default=`0.0')",
60 " --dipoleZ=DOUBLE Z-component of the dipole with respect to body\n frame (default=`-1.0')",
61 " --selectionMode=ENUM How to treat objects which leave a dynamic\n selection and then return later (default =\n survival) (possible values=\"survival\",\n \"restart\" default=`survival')",
62 " --sfgPolarization=STRING SFG polarization combination: ssp, ppp, sps\n (default=`ssp')",
63 " --fermiCoupling=DOUBLE Fermi coupling [cm-1] for stretch-bend coupling\n in SFG spectra (default=`25')",
64 "\n Group: correlation function\n an option of this group is required",
65 " -s, --selecorr selection correlation function",
66 " -r, --rcorr mean squared displacement",
67 " --rcorrZ mean squared displacement binned by Z",
68 " -v, --vcorr velocity correlation function",
69 " --vcorrZ velocity correlation function along z-axis",
70 " --vcorrR velocity correlation function projected\n radially",
71 " --vaOutProdcorr Velocity - Velocity auto outer product\n correlation function",
72 " --waOutProdcorr Angular Velocity - Angular Velocity auto outer\n product correlation function",
73 " --vwOutProdcorr Velocity - Angular Velocity outer product\n correlation function",
74 " --wvOutProdcorr Angular Velocity - Velocity outer product\n correlation function",
75 " -w, --wcorr charge velocity correlation function",
76 " -d, --dcorr dipole correlation function",
77 " -l, --lcorr Lengendre correlation function",
78 " --lcorrZ Lengendre correlation function binned by Z",
79 " --cohZ Lengendre correlation function for OH bond\n vectors binned by Z",
80 " -M, --sdcorr System dipole correlation function",
81 " --r_rcorr Radial msd",
82 " --thetacorr Angular msd",
83 " --drcorr Directional msd for particles with unit vectors",
84 " --stresscorr Stress tensor correlation function",
85 " -b, --bondcorr Bond extension correlation function",
86 " -f, --freqfluccorr Frequency Fluctuation correlation function",
87 " -j, --jumptime Hydrogen bond jump time correlation function",
88 " --jumptimeZ Hydrogen bond jump time correlation function\n binned by Z",
89 " --jumptimeR Hydrogen bond jump time correlation function\n binned by R around a third selection",
90 " --persistence Hydrogen bond persistence correlation function",
91 " --pjcorr Momentum - Angular Momentum cross correlation\n function",
92 " --ftcorr Force - Torque cross correlation function",
93 " --ckcorr Charge - Kinetic energy cross correlation\n function",
94 " --cscorr Charge - Orientation order parameter\n (Cos\theta) cross correlation function",
95 " --facorr Force - Force auto correlation function",
96 " --tfcorr Torque - Force Cross correlation function",
97 " --tacorr Torque auto correlation function",
98 " --disp Displacement correlation function",
99 " --dispZ Displacement correlation function binned by Z",
100 " --current Current density auto correlation function",
101 " --onsager Onsager coefficient correlation functions",
102 " --ddisp Collective Dipole displacement function\n (Helfand moment of Current Density)",
103 " --rotAngleDisp Displacement correlation function for rotation\n angles",
104 " --meandisp mean displacement",
105 " --sfg SFG susceptibility spectrum (exciton model) -\n use molecular selections",
114} cmdline_parser_arg_type;
126cmdline_parser_required2 (
struct gengetopt_args_info *args_info,
const char *prog_name,
const char *additional_error);
128const char *cmdline_parser_privilegedAxis_values[] = {
"x",
"y",
"z", 0};
129const char *cmdline_parser_selectionMode_values[] = {
"survival",
"restart", 0};
132gengetopt_strdup (
const char *s);
212 FIX_UNUSED (args_info);
270 args_info->
help_help = gengetopt_args_info_help[0] ;
272 args_info->
input_help = gengetopt_args_info_help[2] ;
273 args_info->
output_help = gengetopt_args_info_help[3] ;
274 args_info->
sele1_help = gengetopt_args_info_help[4] ;
275 args_info->
sele2_help = gengetopt_args_info_help[5] ;
276 args_info->
sele3_help = gengetopt_args_info_help[6] ;
278 args_info->
order_help = gengetopt_args_info_help[8] ;
279 args_info->
nbins_help = gengetopt_args_info_help[9] ;
280 args_info->
nzbins_help = gengetopt_args_info_help[10] ;
281 args_info->
tcorr_help = gengetopt_args_info_help[11] ;
282 args_info->
nstart_help = gengetopt_args_info_help[12] ;
283 args_info->
tsep_help = gengetopt_args_info_help[13] ;
284 args_info->
t_apod_help = gengetopt_args_info_help[14] ;
286 args_info->
rcut_help = gengetopt_args_info_help[16] ;
287 args_info->
OOcut_help = gengetopt_args_info_help[17] ;
289 args_info->
OHcut_help = gengetopt_args_info_help[19] ;
291 args_info->
length_help = gengetopt_args_info_help[21] ;
292 args_info->
dipoleX_help = gengetopt_args_info_help[22] ;
293 args_info->
dipoleY_help = gengetopt_args_info_help[23] ;
294 args_info->
dipoleZ_help = gengetopt_args_info_help[24] ;
299 args_info->
rcorr_help = gengetopt_args_info_help[30] ;
300 args_info->
rcorrZ_help = gengetopt_args_info_help[31] ;
301 args_info->
vcorr_help = gengetopt_args_info_help[32] ;
302 args_info->
vcorrZ_help = gengetopt_args_info_help[33] ;
303 args_info->
vcorrR_help = gengetopt_args_info_help[34] ;
308 args_info->
wcorr_help = gengetopt_args_info_help[39] ;
309 args_info->
dcorr_help = gengetopt_args_info_help[40] ;
310 args_info->
lcorr_help = gengetopt_args_info_help[41] ;
311 args_info->
lcorrZ_help = gengetopt_args_info_help[42] ;
312 args_info->
cohZ_help = gengetopt_args_info_help[43] ;
313 args_info->
sdcorr_help = gengetopt_args_info_help[44] ;
314 args_info->
r_rcorr_help = gengetopt_args_info_help[45] ;
316 args_info->
drcorr_help = gengetopt_args_info_help[47] ;
324 args_info->
pjcorr_help = gengetopt_args_info_help[55] ;
325 args_info->
ftcorr_help = gengetopt_args_info_help[56] ;
326 args_info->
ckcorr_help = gengetopt_args_info_help[57] ;
327 args_info->
cscorr_help = gengetopt_args_info_help[58] ;
328 args_info->
facorr_help = gengetopt_args_info_help[59] ;
329 args_info->
tfcorr_help = gengetopt_args_info_help[60] ;
330 args_info->
tacorr_help = gengetopt_args_info_help[61] ;
331 args_info->
disp_help = gengetopt_args_info_help[62] ;
332 args_info->
dispZ_help = gengetopt_args_info_help[63] ;
333 args_info->
current_help = gengetopt_args_info_help[64] ;
334 args_info->
onsager_help = gengetopt_args_info_help[65] ;
335 args_info->
ddisp_help = gengetopt_args_info_help[66] ;
338 args_info->
sfg_help = gengetopt_args_info_help[69] ;
349 if (strlen(gengetopt_args_info_versiontext) > 0)
350 printf(
"\n%s\n", gengetopt_args_info_versiontext);
353static void print_help_common(
void)
355 size_t len_purpose = strlen(gengetopt_args_info_purpose);
356 size_t len_usage = strlen(gengetopt_args_info_usage);
359 printf(
"%s\n", gengetopt_args_info_usage);
361 if (len_purpose > 0) {
362 printf(
"%s\n", gengetopt_args_info_purpose);
365 if (len_usage || len_purpose) {
369 if (strlen(gengetopt_args_info_description) > 0) {
370 printf(
"%s\n\n", gengetopt_args_info_description);
379 while (gengetopt_args_info_help[i])
380 printf(
"%s\n", gengetopt_args_info_help[i++]);
386 clear_given (args_info);
387 clear_args (args_info);
388 init_args_info (args_info);
417free_string_field (
char **s)
431 free_string_field (&(args_info->
input_arg));
435 free_string_field (&(args_info->
sele1_arg));
437 free_string_field (&(args_info->
sele2_arg));
439 free_string_field (&(args_info->
sele3_arg));
447 free_string_field (&(args_info->
tsep_orig));
450 free_string_field (&(args_info->
rcut_orig));
466 free (args_info->
inputs [i]);
471 clear_given (args_info);
482check_possible_values(
const char *val,
const char *values[])
492 for (i = 0, len = strlen(val); values[i]; ++i)
494 if (strncmp(val, values[i], len) == 0)
498 if (strlen(values[i]) == len)
506 return (found ? -2 : -1);
511write_into_file(FILE *outfile,
const char *opt,
const char *arg,
const char *values[])
516 found = check_possible_values(arg, values);
519 fprintf(outfile,
"%s=\"%s\" # %s\n", opt, arg, values[found]);
521 fprintf(outfile,
"%s=\"%s\"\n", opt, arg);
523 fprintf(outfile,
"%s\n", opt);
540 write_into_file(outfile,
"help", 0, 0 );
542 write_into_file(outfile,
"version", 0, 0 );
544 write_into_file(outfile,
"input", args_info->
input_orig, 0);
546 write_into_file(outfile,
"output", args_info->
output_orig, 0);
548 write_into_file(outfile,
"sele1", args_info->
sele1_orig, 0);
550 write_into_file(outfile,
"sele2", args_info->
sele2_orig, 0);
552 write_into_file(outfile,
"sele3", args_info->
sele3_orig, 0);
556 write_into_file(outfile,
"order", args_info->
order_orig, 0);
558 write_into_file(outfile,
"nbins", args_info->
nbins_orig, 0);
560 write_into_file(outfile,
"nzbins", args_info->
nzbins_orig, 0);
562 write_into_file(outfile,
"tcorr", args_info->
tcorr_orig, 0);
564 write_into_file(outfile,
"nstart", args_info->
nstart_orig, 0);
566 write_into_file(outfile,
"tsep", args_info->
tsep_orig, 0);
568 write_into_file(outfile,
"t_apod", args_info->
t_apod_orig, 0);
572 write_into_file(outfile,
"rcut", args_info->
rcut_orig, 0);
574 write_into_file(outfile,
"OOcut", args_info->
OOcut_orig, 0);
576 write_into_file(outfile,
"thetacut", args_info->
thetacut_orig, 0);
578 write_into_file(outfile,
"OHcut", args_info->
OHcut_orig, 0);
580 write_into_file(outfile,
"privilegedAxis", args_info->
privilegedAxis_orig, cmdline_parser_privilegedAxis_values);
582 write_into_file(outfile,
"length", args_info->
length_orig, 0);
584 write_into_file(outfile,
"dipoleX", args_info->
dipoleX_orig, 0);
586 write_into_file(outfile,
"dipoleY", args_info->
dipoleY_orig, 0);
588 write_into_file(outfile,
"dipoleZ", args_info->
dipoleZ_orig, 0);
590 write_into_file(outfile,
"selectionMode", args_info->
selectionMode_orig, cmdline_parser_selectionMode_values);
596 write_into_file(outfile,
"selecorr", 0, 0 );
598 write_into_file(outfile,
"rcorr", 0, 0 );
600 write_into_file(outfile,
"rcorrZ", 0, 0 );
602 write_into_file(outfile,
"vcorr", 0, 0 );
604 write_into_file(outfile,
"vcorrZ", 0, 0 );
606 write_into_file(outfile,
"vcorrR", 0, 0 );
608 write_into_file(outfile,
"vaOutProdcorr", 0, 0 );
610 write_into_file(outfile,
"waOutProdcorr", 0, 0 );
612 write_into_file(outfile,
"vwOutProdcorr", 0, 0 );
614 write_into_file(outfile,
"wvOutProdcorr", 0, 0 );
616 write_into_file(outfile,
"wcorr", 0, 0 );
618 write_into_file(outfile,
"dcorr", 0, 0 );
620 write_into_file(outfile,
"lcorr", 0, 0 );
622 write_into_file(outfile,
"lcorrZ", 0, 0 );
624 write_into_file(outfile,
"cohZ", 0, 0 );
626 write_into_file(outfile,
"sdcorr", 0, 0 );
628 write_into_file(outfile,
"r_rcorr", 0, 0 );
630 write_into_file(outfile,
"thetacorr", 0, 0 );
632 write_into_file(outfile,
"drcorr", 0, 0 );
634 write_into_file(outfile,
"stresscorr", 0, 0 );
636 write_into_file(outfile,
"bondcorr", 0, 0 );
638 write_into_file(outfile,
"freqfluccorr", 0, 0 );
640 write_into_file(outfile,
"jumptime", 0, 0 );
642 write_into_file(outfile,
"jumptimeZ", 0, 0 );
644 write_into_file(outfile,
"jumptimeR", 0, 0 );
646 write_into_file(outfile,
"persistence", 0, 0 );
648 write_into_file(outfile,
"pjcorr", 0, 0 );
650 write_into_file(outfile,
"ftcorr", 0, 0 );
652 write_into_file(outfile,
"ckcorr", 0, 0 );
654 write_into_file(outfile,
"cscorr", 0, 0 );
656 write_into_file(outfile,
"facorr", 0, 0 );
658 write_into_file(outfile,
"tfcorr", 0, 0 );
660 write_into_file(outfile,
"tacorr", 0, 0 );
662 write_into_file(outfile,
"disp", 0, 0 );
664 write_into_file(outfile,
"dispZ", 0, 0 );
666 write_into_file(outfile,
"current", 0, 0 );
668 write_into_file(outfile,
"onsager", 0, 0 );
670 write_into_file(outfile,
"ddisp", 0, 0 );
672 write_into_file(outfile,
"rotAngleDisp", 0, 0 );
674 write_into_file(outfile,
"meandisp", 0, 0 );
676 write_into_file(outfile,
"sfg", 0, 0 );
689 outfile = fopen(filename,
"w");
706 cmdline_parser_release (args_info);
711gengetopt_strdup (
const char *s)
717 result = (
char*)malloc(strlen(s) + 1);
718 if (result == (
char*)0)
786 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
803 result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0);
811 int result = EXIT_SUCCESS;
813 if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
814 result = EXIT_FAILURE;
820cmdline_parser_required2 (
struct gengetopt_args_info *args_info,
const char *prog_name,
const char *additional_error)
822 int error_occurred = 0;
823 FIX_UNUSED (additional_error);
828 fprintf (stderr,
"%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error :
""));
834 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 :
""));
841 return error_occurred;
899#ifndef required_argument
900#define required_argument 1
903#ifndef optional_argument
904#define optional_argument 2
907struct custom_getopt_data {
949static char *custom_optarg;
966static int custom_optind = 1;
972static int custom_opterr = 1;
978static int custom_optopt =
'?';
988static void exchange(
char **argv,
struct custom_getopt_data *d)
990 int bottom = d->first_nonopt;
991 int middle = d->last_nonopt;
992 int top = d->custom_optind;
1001 while (top > middle && middle > bottom) {
1002 if (top - middle > middle - bottom) {
1004 int len = middle - bottom;
1008 for (i = 0; i < len; i++) {
1009 tem = argv[bottom + i];
1011 argv[top - (middle - bottom) + i];
1012 argv[top - (middle - bottom) + i] = tem;
1018 int len = top - middle;
1022 for (i = 0; i < len; i++) {
1023 tem = argv[bottom + i];
1024 argv[bottom + i] = argv[middle + i];
1025 argv[middle + i] = tem;
1032 d->first_nonopt += (d->custom_optind - d->last_nonopt);
1033 d->last_nonopt = d->custom_optind;
1037static void custom_getopt_initialize(
struct custom_getopt_data *d)
1044 d->first_nonopt = d->last_nonopt = d->custom_optind;
1049#define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
1052static int shuffle_argv(
int argc,
char *
const *argv,
const struct option *longopts,
1053 struct custom_getopt_data *d)
1059 if (d->last_nonopt > d->custom_optind)
1060 d->last_nonopt = d->custom_optind;
1061 if (d->first_nonopt > d->custom_optind)
1062 d->first_nonopt = d->custom_optind;
1067 if (d->first_nonopt != d->last_nonopt &&
1068 d->last_nonopt != d->custom_optind)
1069 exchange((
char **) argv, d);
1070 else if (d->last_nonopt != d->custom_optind)
1071 d->first_nonopt = d->custom_optind;
1076 while (d->custom_optind < argc && NONOPTION_P)
1078 d->last_nonopt = d->custom_optind;
1084 if (d->custom_optind != argc && !strcmp(argv[d->custom_optind],
"--")) {
1086 if (d->first_nonopt != d->last_nonopt
1087 && d->last_nonopt != d->custom_optind)
1088 exchange((
char **) argv, d);
1089 else if (d->first_nonopt == d->last_nonopt)
1090 d->first_nonopt = d->custom_optind;
1091 d->last_nonopt = argc;
1092 d->custom_optind = argc;
1098 if (d->custom_optind == argc) {
1103 if (d->first_nonopt != d->last_nonopt)
1104 d->custom_optind = d->first_nonopt;
1112 d->custom_optarg = argv[d->custom_optind++];
1119 d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] ==
'-'));
1133static int check_long_opt(
int argc,
char *
const *argv,
const char *optstring,
1134 const struct option *longopts,
int *longind,
1135 int print_errors,
struct custom_getopt_data *d)
1138 const struct option *p;
1139 const struct option *pfound = NULL;
1145 for (nameend = d->nextchar; *nameend && *nameend !=
'='; nameend++)
1149 for (p = longopts, option_index = 0; p->name; p++, option_index++)
1150 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
1151 if ((
unsigned int) (nameend - d->nextchar)
1152 == (
unsigned int) strlen(p->name)) {
1155 indfound = option_index;
1158 }
else if (pfound == NULL) {
1161 indfound = option_index;
1162 }
else if (pfound->has_arg != p->has_arg
1163 || pfound->flag != p->flag
1164 || pfound->val != p->val)
1168 if (ambig && !exact) {
1171 "%s: option `%s' is ambiguous\n",
1172 argv[0], argv[d->custom_optind]);
1174 d->nextchar += strlen(d->nextchar);
1176 d->custom_optopt = 0;
1180 option_index = indfound;
1183 if (pfound->has_arg != no_argument)
1184 d->custom_optarg = nameend + 1;
1187 if (argv[d->custom_optind - 1][1] ==
'-') {
1189 fprintf(stderr,
"%s: option `--%s' doesn't allow an argument\n",
1190 argv[0], pfound->name);
1193 fprintf(stderr,
"%s: option `%c%s' doesn't allow an argument\n",
1194 argv[0], argv[d->custom_optind - 1][0], pfound->name);
1198 d->nextchar += strlen(d->nextchar);
1199 d->custom_optopt = pfound->val;
1202 }
else if (pfound->has_arg == required_argument) {
1203 if (d->custom_optind < argc)
1204 d->custom_optarg = argv[d->custom_optind++];
1208 "%s: option `%s' requires an argument\n",
1210 argv[d->custom_optind - 1]);
1212 d->nextchar += strlen(d->nextchar);
1213 d->custom_optopt = pfound->val;
1214 return optstring[0] ==
':' ?
':' :
'?';
1217 d->nextchar += strlen(d->nextchar);
1218 if (longind != NULL)
1219 *longind = option_index;
1221 *(pfound->flag) = pfound->val;
1232 if (argv[d->custom_optind][1] ==
'-') {
1235 "%s: unrecognized option `--%s'\n",
1236 argv[0], d->nextchar);
1240 "%s: unrecognized option `%c%s'\n",
1241 argv[0], argv[d->custom_optind][0],
1245 d->nextchar = (
char *)
"";
1247 d->custom_optopt = 0;
1251static int check_short_opt(
int argc,
char *
const *argv,
const char *optstring,
1252 int print_errors,
struct custom_getopt_data *d)
1254 char c = *d->nextchar++;
1255 const char *temp = strchr(optstring, c);
1258 if (*d->nextchar ==
'\0')
1260 if (!temp || c ==
':') {
1262 fprintf(stderr,
"%s: invalid option -- %c\n", argv[0], c);
1264 d->custom_optopt = c;
1267 if (temp[1] ==
':') {
1268 if (temp[2] ==
':') {
1270 if (*d->nextchar !=
'\0') {
1271 d->custom_optarg = d->nextchar;
1274 d->custom_optarg = NULL;
1278 if (*d->nextchar !=
'\0') {
1279 d->custom_optarg = d->nextchar;
1286 }
else if (d->custom_optind == argc) {
1289 "%s: option requires an argument -- %c\n",
1292 d->custom_optopt = c;
1293 if (optstring[0] ==
':')
1303 d->custom_optarg = argv[d->custom_optind++];
1380static int getopt_internal_r(
int argc,
char *
const *argv,
const char *optstring,
1381 const struct option *longopts,
int *longind,
1382 struct custom_getopt_data *d)
1384 int ret, print_errors = d->custom_opterr;
1386 if (optstring[0] ==
':')
1390 d->custom_optarg = NULL;
1396 if (d->custom_optind == 0 || !d->initialized) {
1397 if (d->custom_optind == 0)
1398 d->custom_optind = 1;
1399 custom_getopt_initialize(d);
1401 if (d->nextchar == NULL || *d->nextchar ==
'\0') {
1402 ret = shuffle_argv(argc, argv, longopts, d);
1406 if (longopts && (argv[d->custom_optind][1] ==
'-' ))
1407 return check_long_opt(argc, argv, optstring, longopts,
1408 longind, print_errors, d);
1409 return check_short_opt(argc, argv, optstring, print_errors, d);
1412static int custom_getopt_internal(
int argc,
char *
const *argv,
const char *optstring,
1413 const struct option *longopts,
int *longind)
1417 static struct custom_getopt_data d;
1419 d.custom_optind = custom_optind;
1420 d.custom_opterr = custom_opterr;
1421 result = getopt_internal_r(argc, argv, optstring, longopts,
1423 custom_optind = d.custom_optind;
1424 custom_optarg = d.custom_optarg;
1425 custom_optopt = d.custom_optopt;
1429static int custom_getopt_long (
int argc,
char *
const *argv,
const char *options,
1430 const struct option *long_options,
int *opt_index)
1432 return custom_getopt_internal(argc, argv, options, long_options,
1437static char *package_name = 0;
1458int update_arg(
void *field,
char **orig_field,
1459 unsigned int *field_given,
unsigned int *prev_given,
1460 char *value,
const char *possible_values[],
1461 const char *default_value,
1462 cmdline_parser_arg_type arg_type,
1463 int check_ambiguity,
int override,
1464 int no_free,
int multiple_option,
1465 const char *long_opt,
char short_opt,
1466 const char *additional_error)
1468 char *stop_char = 0;
1469 const char *val = value;
1471 char **string_field;
1477 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1479 if (short_opt !=
'-')
1480 fprintf (stderr,
"%s: `--%s' (`-%c') option given more than once%s\n",
1481 package_name, long_opt, short_opt,
1482 (additional_error ? additional_error :
""));
1484 fprintf (stderr,
"%s: `--%s' option given more than once%s\n",
1485 package_name, long_opt,
1486 (additional_error ? additional_error :
""));
1490 if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0)
1492 if (short_opt !=
'-')
1493 fprintf (stderr,
"%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n",
1494 package_name, (found == -2) ?
"ambiguous" :
"invalid", value, long_opt, short_opt,
1495 (additional_error ? additional_error :
""));
1497 fprintf (stderr,
"%s: %s argument, \"%s\", for option `--%s'%s\n",
1498 package_name, (found == -2) ?
"ambiguous" :
"invalid", value, long_opt,
1499 (additional_error ? additional_error :
""));
1503 if (field_given && *field_given && !
override)
1509 if (possible_values)
1510 val = possible_values[found];
1514 if (val) *((
int *)field) = strtol (val, &stop_char, 0);
1517 if (val) *((
double *)field) = strtod (val, &stop_char);
1520 if (val) *((
int *)field) = found;
1524 string_field = (
char **)field;
1525 if (!no_free && *string_field)
1526 free (*string_field);
1527 *string_field = gengetopt_strdup (val);
1538 if (val && !(stop_char && *stop_char ==
'\0')) {
1539 fprintf(stderr,
"%s: invalid numeric value: %s\n", package_name, val);
1552 if (value && orig_field) {
1554 *orig_field = value;
1558 *orig_field = gengetopt_strdup (value);
1568cmdline_parser_internal (
1574 int error_occurred = 0;
1580 int check_ambiguity;
1587 package_name = argv[0];
1591 FIX_UNUSED(
override);
1598 FIX_UNUSED(check_ambiguity);
1612 int option_index = 0;
1614 static struct option long_options[] = {
1615 {
"help", 0, NULL,
'h' },
1616 {
"version", 0, NULL,
'V' },
1617 {
"input", 1, NULL,
'i' },
1618 {
"output", 1, NULL,
'o' },
1619 {
"sele1", 1, NULL, 0 },
1620 {
"sele2", 1, NULL, 0 },
1621 {
"sele3", 1, NULL, 0 },
1622 {
"seleoffset", 1, NULL, 0 },
1623 {
"order", 1, NULL, 0 },
1624 {
"nbins", 1, NULL,
'n' },
1625 {
"nzbins", 1, NULL,
'z' },
1626 {
"tcorr", 1, NULL, 0 },
1627 {
"nstart", 1, NULL, 0 },
1628 {
"tsep", 1, NULL, 0 },
1629 {
"t_apod", 1, NULL, 0 },
1630 {
"t_zerofill", 1, NULL, 0 },
1631 {
"rcut", 1, NULL,
'c' },
1632 {
"OOcut", 1, NULL, 0 },
1633 {
"thetacut", 1, NULL, 0 },
1634 {
"OHcut", 1, NULL, 0 },
1635 {
"privilegedAxis", 1, NULL, 0 },
1636 {
"length", 1, NULL, 0 },
1637 {
"dipoleX", 1, NULL, 0 },
1638 {
"dipoleY", 1, NULL, 0 },
1639 {
"dipoleZ", 1, NULL, 0 },
1640 {
"selectionMode", 1, NULL, 0 },
1641 {
"sfgPolarization", 1, NULL, 0 },
1642 {
"fermiCoupling", 1, NULL, 0 },
1643 {
"selecorr", 0, NULL,
's' },
1644 {
"rcorr", 0, NULL,
'r' },
1645 {
"rcorrZ", 0, NULL, 0 },
1646 {
"vcorr", 0, NULL,
'v' },
1647 {
"vcorrZ", 0, NULL, 0 },
1648 {
"vcorrR", 0, NULL, 0 },
1649 {
"vaOutProdcorr", 0, NULL, 0 },
1650 {
"waOutProdcorr", 0, NULL, 0 },
1651 {
"vwOutProdcorr", 0, NULL, 0 },
1652 {
"wvOutProdcorr", 0, NULL, 0 },
1653 {
"wcorr", 0, NULL,
'w' },
1654 {
"dcorr", 0, NULL,
'd' },
1655 {
"lcorr", 0, NULL,
'l' },
1656 {
"lcorrZ", 0, NULL, 0 },
1657 {
"cohZ", 0, NULL, 0 },
1658 {
"sdcorr", 0, NULL,
'M' },
1659 {
"r_rcorr", 0, NULL, 0 },
1660 {
"thetacorr", 0, NULL, 0 },
1661 {
"drcorr", 0, NULL, 0 },
1662 {
"stresscorr", 0, NULL, 0 },
1663 {
"bondcorr", 0, NULL,
'b' },
1664 {
"freqfluccorr", 0, NULL,
'f' },
1665 {
"jumptime", 0, NULL,
'j' },
1666 {
"jumptimeZ", 0, NULL, 0 },
1667 {
"jumptimeR", 0, NULL, 0 },
1668 {
"persistence", 0, NULL, 0 },
1669 {
"pjcorr", 0, NULL, 0 },
1670 {
"ftcorr", 0, NULL, 0 },
1671 {
"ckcorr", 0, NULL, 0 },
1672 {
"cscorr", 0, NULL, 0 },
1673 {
"facorr", 0, NULL, 0 },
1674 {
"tfcorr", 0, NULL, 0 },
1675 {
"tacorr", 0, NULL, 0 },
1676 {
"disp", 0, NULL, 0 },
1677 {
"dispZ", 0, NULL, 0 },
1678 {
"current", 0, NULL, 0 },
1679 {
"onsager", 0, NULL, 0 },
1680 {
"ddisp", 0, NULL, 0 },
1681 {
"rotAngleDisp", 0, NULL, 0 },
1682 {
"meandisp", 0, NULL, 0 },
1683 {
"sfg", 0, NULL, 0 },
1687 custom_optarg = optarg;
1688 custom_optind = optind;
1689 custom_opterr = opterr;
1690 custom_optopt = optopt;
1692 c = custom_getopt_long (argc, argv,
"hVi:o:n:z:c:srvwdlMbfj", long_options, &option_index);
1694 optarg = custom_optarg;
1695 optind = custom_optind;
1696 opterr = custom_opterr;
1697 optopt = custom_optopt;
1705 cmdline_parser_free (&local_args_info);
1706 exit (EXIT_SUCCESS);
1710 cmdline_parser_free (&local_args_info);
1711 exit (EXIT_SUCCESS);
1716 if (update_arg( (
void *)&(args_info->
input_arg),
1718 &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
1719 check_ambiguity,
override, 0, 0,
1728 if (update_arg( (
void *)&(args_info->
output_arg),
1730 &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
1731 check_ambiguity,
override, 0, 0,
1740 if (update_arg( (
void *)&(args_info->
nbins_arg),
1742 &(local_args_info.nbins_given), optarg, 0,
"100", ARG_INT,
1743 check_ambiguity,
override, 0, 0,
1752 if (update_arg( (
void *)&(args_info->
nzbins_arg),
1754 &(local_args_info.nzbins_given), optarg, 0,
"100", ARG_INT,
1755 check_ambiguity,
override, 0, 0,
1764 if (update_arg( (
void *)&(args_info->
rcut_arg),
1766 &(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE,
1767 check_ambiguity,
override, 0, 0,
1776 reset_group_correlation_function (args_info);
1781 &(local_args_info.selecorr_given), optarg, 0, 0, ARG_NO,
1782 check_ambiguity,
override, 0, 0,
1791 reset_group_correlation_function (args_info);
1796 &(local_args_info.rcorr_given), optarg, 0, 0, ARG_NO,
1797 check_ambiguity,
override, 0, 0,
1806 reset_group_correlation_function (args_info);
1811 &(local_args_info.vcorr_given), optarg, 0, 0, ARG_NO,
1812 check_ambiguity,
override, 0, 0,
1821 reset_group_correlation_function (args_info);
1826 &(local_args_info.wcorr_given), optarg, 0, 0, ARG_NO,
1827 check_ambiguity,
override, 0, 0,
1836 reset_group_correlation_function (args_info);
1841 &(local_args_info.dcorr_given), optarg, 0, 0, ARG_NO,
1842 check_ambiguity,
override, 0, 0,
1851 reset_group_correlation_function (args_info);
1856 &(local_args_info.lcorr_given), optarg, 0, 0, ARG_NO,
1857 check_ambiguity,
override, 0, 0,
1866 reset_group_correlation_function (args_info);
1871 &(local_args_info.sdcorr_given), optarg, 0, 0, ARG_NO,
1872 check_ambiguity,
override, 0, 0,
1881 reset_group_correlation_function (args_info);
1886 &(local_args_info.bondcorr_given), optarg, 0, 0, ARG_NO,
1887 check_ambiguity,
override, 0, 0,
1896 reset_group_correlation_function (args_info);
1901 &(local_args_info.freqfluccorr_given), optarg, 0, 0, ARG_NO,
1902 check_ambiguity,
override, 0, 0,
1903 "freqfluccorr",
'f',
1911 reset_group_correlation_function (args_info);
1916 &(local_args_info.jumptime_given), optarg, 0, 0, ARG_NO,
1917 check_ambiguity,
override, 0, 0,
1926 if (strcmp (long_options[option_index].name,
"sele1") == 0)
1930 if (update_arg( (
void *)&(args_info->
sele1_arg),
1932 &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING,
1933 check_ambiguity,
override, 0, 0,
1940 else if (strcmp (long_options[option_index].name,
"sele2") == 0)
1944 if (update_arg( (
void *)&(args_info->
sele2_arg),
1946 &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING,
1947 check_ambiguity,
override, 0, 0,
1954 else if (strcmp (long_options[option_index].name,
"sele3") == 0)
1958 if (update_arg( (
void *)&(args_info->
sele3_arg),
1960 &(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING,
1961 check_ambiguity,
override, 0, 0,
1968 else if (strcmp (long_options[option_index].name,
"seleoffset") == 0)
1974 &(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT,
1975 check_ambiguity,
override, 0, 0,
1982 else if (strcmp (long_options[option_index].name,
"order") == 0)
1986 if (update_arg( (
void *)&(args_info->
order_arg),
1988 &(local_args_info.order_given), optarg, 0, 0, ARG_INT,
1989 check_ambiguity,
override, 0, 0,
1996 else if (strcmp (long_options[option_index].name,
"tcorr") == 0)
2000 if (update_arg( (
void *)&(args_info->
tcorr_arg),
2002 &(local_args_info.tcorr_given), optarg, 0,
"100000.0", ARG_DOUBLE,
2003 check_ambiguity,
override, 0, 0,
2010 else if (strcmp (long_options[option_index].name,
"nstart") == 0)
2014 if (update_arg( (
void *)&(args_info->
nstart_arg),
2016 &(local_args_info.nstart_given), optarg, 0,
"0", ARG_INT,
2017 check_ambiguity,
override, 0, 0,
2024 else if (strcmp (long_options[option_index].name,
"tsep") == 0)
2028 if (update_arg( (
void *)&(args_info->
tsep_arg),
2030 &(local_args_info.tsep_given), optarg, 0,
"0.0", ARG_DOUBLE,
2031 check_ambiguity,
override, 0, 0,
2038 else if (strcmp (long_options[option_index].name,
"t_apod") == 0)
2042 if (update_arg( (
void *)&(args_info->
t_apod_arg),
2044 &(local_args_info.t_apod_given), optarg, 0,
"0.0", ARG_DOUBLE,
2045 check_ambiguity,
override, 0, 0,
2052 else if (strcmp (long_options[option_index].name,
"t_zerofill") == 0)
2058 &(local_args_info.t_zerofill_given), optarg, 0,
"0.0", ARG_DOUBLE,
2059 check_ambiguity,
override, 0, 0,
2066 else if (strcmp (long_options[option_index].name,
"OOcut") == 0)
2070 if (update_arg( (
void *)&(args_info->
OOcut_arg),
2072 &(local_args_info.OOcut_given), optarg, 0,
"3.5", ARG_DOUBLE,
2073 check_ambiguity,
override, 0, 0,
2080 else if (strcmp (long_options[option_index].name,
"thetacut") == 0)
2086 &(local_args_info.thetacut_given), optarg, 0,
"30", ARG_DOUBLE,
2087 check_ambiguity,
override, 0, 0,
2094 else if (strcmp (long_options[option_index].name,
"OHcut") == 0)
2098 if (update_arg( (
void *)&(args_info->
OHcut_arg),
2100 &(local_args_info.OHcut_given), optarg, 0,
"2.45", ARG_DOUBLE,
2101 check_ambiguity,
override, 0, 0,
2108 else if (strcmp (long_options[option_index].name,
"privilegedAxis") == 0)
2114 &(local_args_info.privilegedAxis_given), optarg, cmdline_parser_privilegedAxis_values,
"z", ARG_ENUM,
2115 check_ambiguity,
override, 0, 0,
2116 "privilegedAxis",
'-',
2122 else if (strcmp (long_options[option_index].name,
"length") == 0)
2126 if (update_arg( (
void *)&(args_info->
length_arg),
2128 &(local_args_info.length_given), optarg, 0,
"100", ARG_DOUBLE,
2129 check_ambiguity,
override, 0, 0,
2136 else if (strcmp (long_options[option_index].name,
"dipoleX") == 0)
2140 if (update_arg( (
void *)&(args_info->
dipoleX_arg),
2142 &(local_args_info.dipoleX_given), optarg, 0,
"0.0", ARG_DOUBLE,
2143 check_ambiguity,
override, 0, 0,
2150 else if (strcmp (long_options[option_index].name,
"dipoleY") == 0)
2154 if (update_arg( (
void *)&(args_info->
dipoleY_arg),
2156 &(local_args_info.dipoleY_given), optarg, 0,
"0.0", ARG_DOUBLE,
2157 check_ambiguity,
override, 0, 0,
2164 else if (strcmp (long_options[option_index].name,
"dipoleZ") == 0)
2168 if (update_arg( (
void *)&(args_info->
dipoleZ_arg),
2170 &(local_args_info.dipoleZ_given), optarg, 0,
"-1.0", ARG_DOUBLE,
2171 check_ambiguity,
override, 0, 0,
2178 else if (strcmp (long_options[option_index].name,
"selectionMode") == 0)
2184 &(local_args_info.selectionMode_given), optarg, cmdline_parser_selectionMode_values,
"survival", ARG_ENUM,
2185 check_ambiguity,
override, 0, 0,
2186 "selectionMode",
'-',
2192 else if (strcmp (long_options[option_index].name,
"sfgPolarization") == 0)
2198 &(local_args_info.sfgPolarization_given), optarg, 0,
"ssp", ARG_STRING,
2199 check_ambiguity,
override, 0, 0,
2200 "sfgPolarization",
'-',
2206 else if (strcmp (long_options[option_index].name,
"fermiCoupling") == 0)
2212 &(local_args_info.fermiCoupling_given), optarg, 0,
"25", ARG_DOUBLE,
2213 check_ambiguity,
override, 0, 0,
2214 "fermiCoupling",
'-',
2220 else if (strcmp (long_options[option_index].name,
"rcorrZ") == 0)
2224 reset_group_correlation_function (args_info);
2229 &(local_args_info.rcorrZ_given), optarg, 0, 0, ARG_NO,
2230 check_ambiguity,
override, 0, 0,
2237 else if (strcmp (long_options[option_index].name,
"vcorrZ") == 0)
2241 reset_group_correlation_function (args_info);
2246 &(local_args_info.vcorrZ_given), optarg, 0, 0, ARG_NO,
2247 check_ambiguity,
override, 0, 0,
2254 else if (strcmp (long_options[option_index].name,
"vcorrR") == 0)
2258 reset_group_correlation_function (args_info);
2263 &(local_args_info.vcorrR_given), optarg, 0, 0, ARG_NO,
2264 check_ambiguity,
override, 0, 0,
2271 else if (strcmp (long_options[option_index].name,
"vaOutProdcorr") == 0)
2275 reset_group_correlation_function (args_info);
2280 &(local_args_info.vaOutProdcorr_given), optarg, 0, 0, ARG_NO,
2281 check_ambiguity,
override, 0, 0,
2282 "vaOutProdcorr",
'-',
2288 else if (strcmp (long_options[option_index].name,
"waOutProdcorr") == 0)
2292 reset_group_correlation_function (args_info);
2297 &(local_args_info.waOutProdcorr_given), optarg, 0, 0, ARG_NO,
2298 check_ambiguity,
override, 0, 0,
2299 "waOutProdcorr",
'-',
2305 else if (strcmp (long_options[option_index].name,
"vwOutProdcorr") == 0)
2309 reset_group_correlation_function (args_info);
2314 &(local_args_info.vwOutProdcorr_given), optarg, 0, 0, ARG_NO,
2315 check_ambiguity,
override, 0, 0,
2316 "vwOutProdcorr",
'-',
2322 else if (strcmp (long_options[option_index].name,
"wvOutProdcorr") == 0)
2326 reset_group_correlation_function (args_info);
2331 &(local_args_info.wvOutProdcorr_given), optarg, 0, 0, ARG_NO,
2332 check_ambiguity,
override, 0, 0,
2333 "wvOutProdcorr",
'-',
2339 else if (strcmp (long_options[option_index].name,
"lcorrZ") == 0)
2343 reset_group_correlation_function (args_info);
2348 &(local_args_info.lcorrZ_given), optarg, 0, 0, ARG_NO,
2349 check_ambiguity,
override, 0, 0,
2356 else if (strcmp (long_options[option_index].name,
"cohZ") == 0)
2360 reset_group_correlation_function (args_info);
2365 &(local_args_info.cohZ_given), optarg, 0, 0, ARG_NO,
2366 check_ambiguity,
override, 0, 0,
2373 else if (strcmp (long_options[option_index].name,
"r_rcorr") == 0)
2377 reset_group_correlation_function (args_info);
2382 &(local_args_info.r_rcorr_given), optarg, 0, 0, ARG_NO,
2383 check_ambiguity,
override, 0, 0,
2390 else if (strcmp (long_options[option_index].name,
"thetacorr") == 0)
2394 reset_group_correlation_function (args_info);
2399 &(local_args_info.thetacorr_given), optarg, 0, 0, ARG_NO,
2400 check_ambiguity,
override, 0, 0,
2407 else if (strcmp (long_options[option_index].name,
"drcorr") == 0)
2411 reset_group_correlation_function (args_info);
2416 &(local_args_info.drcorr_given), optarg, 0, 0, ARG_NO,
2417 check_ambiguity,
override, 0, 0,
2424 else if (strcmp (long_options[option_index].name,
"stresscorr") == 0)
2428 reset_group_correlation_function (args_info);
2433 &(local_args_info.stresscorr_given), optarg, 0, 0, ARG_NO,
2434 check_ambiguity,
override, 0, 0,
2441 else if (strcmp (long_options[option_index].name,
"jumptimeZ") == 0)
2445 reset_group_correlation_function (args_info);
2450 &(local_args_info.jumptimeZ_given), optarg, 0, 0, ARG_NO,
2451 check_ambiguity,
override, 0, 0,
2458 else if (strcmp (long_options[option_index].name,
"jumptimeR") == 0)
2462 reset_group_correlation_function (args_info);
2467 &(local_args_info.jumptimeR_given), optarg, 0, 0, ARG_NO,
2468 check_ambiguity,
override, 0, 0,
2475 else if (strcmp (long_options[option_index].name,
"persistence") == 0)
2479 reset_group_correlation_function (args_info);
2484 &(local_args_info.persistence_given), optarg, 0, 0, ARG_NO,
2485 check_ambiguity,
override, 0, 0,
2492 else if (strcmp (long_options[option_index].name,
"pjcorr") == 0)
2496 reset_group_correlation_function (args_info);
2501 &(local_args_info.pjcorr_given), optarg, 0, 0, ARG_NO,
2502 check_ambiguity,
override, 0, 0,
2509 else if (strcmp (long_options[option_index].name,
"ftcorr") == 0)
2513 reset_group_correlation_function (args_info);
2518 &(local_args_info.ftcorr_given), optarg, 0, 0, ARG_NO,
2519 check_ambiguity,
override, 0, 0,
2526 else if (strcmp (long_options[option_index].name,
"ckcorr") == 0)
2530 reset_group_correlation_function (args_info);
2535 &(local_args_info.ckcorr_given), optarg, 0, 0, ARG_NO,
2536 check_ambiguity,
override, 0, 0,
2543 else if (strcmp (long_options[option_index].name,
"cscorr") == 0)
2547 reset_group_correlation_function (args_info);
2552 &(local_args_info.cscorr_given), optarg, 0, 0, ARG_NO,
2553 check_ambiguity,
override, 0, 0,
2560 else if (strcmp (long_options[option_index].name,
"facorr") == 0)
2564 reset_group_correlation_function (args_info);
2569 &(local_args_info.facorr_given), optarg, 0, 0, ARG_NO,
2570 check_ambiguity,
override, 0, 0,
2577 else if (strcmp (long_options[option_index].name,
"tfcorr") == 0)
2581 reset_group_correlation_function (args_info);
2586 &(local_args_info.tfcorr_given), optarg, 0, 0, ARG_NO,
2587 check_ambiguity,
override, 0, 0,
2594 else if (strcmp (long_options[option_index].name,
"tacorr") == 0)
2598 reset_group_correlation_function (args_info);
2603 &(local_args_info.tacorr_given), optarg, 0, 0, ARG_NO,
2604 check_ambiguity,
override, 0, 0,
2611 else if (strcmp (long_options[option_index].name,
"disp") == 0)
2615 reset_group_correlation_function (args_info);
2620 &(local_args_info.disp_given), optarg, 0, 0, ARG_NO,
2621 check_ambiguity,
override, 0, 0,
2628 else if (strcmp (long_options[option_index].name,
"dispZ") == 0)
2632 reset_group_correlation_function (args_info);
2637 &(local_args_info.dispZ_given), optarg, 0, 0, ARG_NO,
2638 check_ambiguity,
override, 0, 0,
2645 else if (strcmp (long_options[option_index].name,
"current") == 0)
2649 reset_group_correlation_function (args_info);
2654 &(local_args_info.current_given), optarg, 0, 0, ARG_NO,
2655 check_ambiguity,
override, 0, 0,
2662 else if (strcmp (long_options[option_index].name,
"onsager") == 0)
2666 reset_group_correlation_function (args_info);
2671 &(local_args_info.onsager_given), optarg, 0, 0, ARG_NO,
2672 check_ambiguity,
override, 0, 0,
2679 else if (strcmp (long_options[option_index].name,
"ddisp") == 0)
2683 reset_group_correlation_function (args_info);
2688 &(local_args_info.ddisp_given), optarg, 0, 0, ARG_NO,
2689 check_ambiguity,
override, 0, 0,
2696 else if (strcmp (long_options[option_index].name,
"rotAngleDisp") == 0)
2700 reset_group_correlation_function (args_info);
2705 &(local_args_info.rotAngleDisp_given), optarg, 0, 0, ARG_NO,
2706 check_ambiguity,
override, 0, 0,
2707 "rotAngleDisp",
'-',
2713 else if (strcmp (long_options[option_index].name,
"meandisp") == 0)
2717 reset_group_correlation_function (args_info);
2722 &(local_args_info.meandisp_given), optarg, 0, 0, ARG_NO,
2723 check_ambiguity,
override, 0, 0,
2730 else if (strcmp (long_options[option_index].name,
"sfg") == 0)
2734 reset_group_correlation_function (args_info);
2739 &(local_args_info.sfg_given), optarg, 0, 0, ARG_NO,
2740 check_ambiguity,
override, 0, 0,
2753 fprintf (stderr,
"%s: option unknown: %c%s\n",
CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error :
""));
2760 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 :
""));
2768 error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error);
2771 cmdline_parser_release (&local_args_info);
2773 if ( error_occurred )
2774 return (EXIT_FAILURE);
2779 int found_prog_name = 0;
2785 args_info->
inputs_num = argc - optind - found_prog_name;
2787 (
char **)(malloc ((args_info->
inputs_num)*
sizeof(
char *))) ;
2788 while (optind < argc)
2789 args_info->
inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;
2796 cmdline_parser_release (&local_args_info);
2797 return (EXIT_FAILURE);
#define CMDLINE_PARSER_VERSION
the program version
void cmdline_parser_print_version(void)
Print the version.
struct cmdline_parser_params * cmdline_parser_params_create(void)
Allocates dynamically a cmdline_parser_params structure and initializes all its fields to their defau...
void cmdline_parser_print_help(void)
Print the help.
#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.
char * nstart_orig
Number of frames to skip at start of trajectory original value given at command line.
unsigned int selectionMode_given
Whether selectionMode was given.
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 * tsep_help
Separation time between correlation windows (0 = no gap) help description.
const char * nbins_help
Number of bins help description.
unsigned int tcorr_given
Whether tcorr was given.
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.
char * sfgPolarization_arg
SFG polarization combination: ssp, ppp, sps (default='ssp').
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.
const char * seleoffset_help
global index offset for a second object (used to define a vector between sites in molecule) help desc...
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.
double t_apod_arg
Apodization time (fs) [filters tcorr with exp(-t/t_apod) in Fourier-transformed spectroscopic functio...
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
const char * t_zerofill_help
Zero-fill time (fs) [Pads time correlation functions with zeros from tcorr -> t_zerofill in Fourier-t...
unsigned int tsep_given
Whether tsep was given.
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.
unsigned int fermiCoupling_given
Whether fermiCoupling was given.
char * order_orig
Lengendre Polynomial Order original value given at command line.
char * fermiCoupling_orig
Fermi coupling [cm-1] for stretch-bend coupling in SFG spectra original value given at command line.
const char * wcorr_help
charge velocity correlation function help description.
double fermiCoupling_arg
Fermi coupling [cm-1] for stretch-bend coupling in SFG spectra (default='25').
unsigned int lcorr_given
Whether lcorr was given.
char * sfgPolarization_orig
SFG polarization combination: ssp, ppp, sps original value given at command line.
char * OOcut_orig
Oxygen-Oxygen cutoff radius (angstroms) original value given at command line.
const char * stresscorr_help
Stress tensor correlation function help description.
unsigned int meandisp_given
Whether meandisp was given.
double length_arg
maximum length (default='100').
unsigned int facorr_given
Whether facorr was given.
unsigned int bondcorr_given
Whether bondcorr was given.
const char * help_help
Print help and exit help description.
char * sele3_arg
select third stuntdouble set.
const char * cscorr_help
Charge - Orientation order parameter (Cos\theta) cross correlation function help description.
char * seleoffset_orig
global index offset for a second object (used to define a vector between sites in molecule) original ...
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.
unsigned int t_apod_given
Whether t_apod was given.
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.
char * t_zerofill_orig
Zero-fill time (fs) [Pads time correlation functions with zeros from tcorr -> t_zerofill in Fourier-t...
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.
char * t_apod_orig
Apodization time (fs) [filters tcorr with exp(-t/t_apod) in Fourier-transformed spectroscopic functio...
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 sfg_given
Whether sfg was given.
unsigned int length_given
Whether length was given.
int seleoffset_arg
global index offset for a second object (used to define a vector between sites in molecule).
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.
unsigned int nstart_given
Whether nstart was given.
double rcut_arg
cutoff radius (angstroms).
double tsep_arg
Separation time between correlation windows (0 = no gap) (default='0.0').
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.
const char * sfg_help
SFG susceptibility spectrum (exciton model) - use molecular selections help description.
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.
unsigned int t_zerofill_given
Whether t_zerofill was given.
char * sele2_orig
select second stuntdouble set (if sele2 is not set, use script from sele1) original value given at co...
const char * current_help
Current density auto correlation function help description.
const char * meandisp_help
mean displacement help description.
const char * vaOutProdcorr_help
Velocity - Velocity auto outer product correlation function help description.
const char * selectionMode_help
How to treat objects which leave a dynamic selection and then return later (default = survival) help ...
unsigned int dispZ_given
Whether dispZ was given.
const char * freqfluccorr_help
Frequency Fluctuation correlation function help description.
const char * t_apod_help
Apodization time (fs) [filters tcorr with exp(-t/t_apod) in Fourier-transformed spectroscopic functio...
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.
char * tcorr_orig
Correlation time (length of each window) in fs 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.
int nstart_arg
Number of frames to skip at start of trajectory (default='0').
const char * pjcorr_help
Momentum - Angular Momentum cross correlation function help description.
const char * fermiCoupling_help
Fermi coupling [cm-1] for stretch-bend coupling in SFG spectra 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.
enum enum_selectionMode selectionMode_arg
How to treat objects which leave a dynamic selection and then return later (default = survival) (defa...
const char * vcorr_help
velocity correlation function help description.
char * tsep_orig
Separation time between correlation windows (0 = no gap) original value given at command line.
unsigned int input_given
Whether input was given.
unsigned int rcorrZ_given
Whether rcorrZ was given.
const char * tcorr_help
Correlation time (length of each window) in fs help description.
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').
double t_zerofill_arg
Zero-fill time (fs) [Pads time correlation functions with zeros from tcorr -> t_zerofill in Fourier-t...
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 * sfgPolarization_help
SFG polarization combination: ssp, ppp, sps 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.
unsigned int sfgPolarization_given
Whether sfgPolarization was given.
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.
double tcorr_arg
Correlation time (length of each window) in fs (default='100000.0').
char * selectionMode_orig
How to treat objects which leave a dynamic selection and then return later (default = survival) origi...
unsigned int seleoffset_given
Whether seleoffset was given.
const char * input_help
input dump file help description.
int nzbins_arg
Number of Z bins (default='100').
const char * nstart_help
Number of frames to skip at start of trajectory help description.
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.
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.