1 |
|
/* |
2 |
< |
File autogenerated by gengetopt version 2.22 |
2 |
> |
File autogenerated by gengetopt version 2.22.4 |
3 |
|
generated with the following command: |
4 |
< |
gengetopt -F StaticPropsCmd |
4 |
> |
gengetopt -i StaticProps.ggo -c cpp -F StaticPropsCmd -u |
5 |
|
|
6 |
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
gengetopt output files to be in the public domain: |
17 |
|
#include <stdlib.h> |
18 |
|
#include <string.h> |
19 |
|
|
20 |
< |
#include "getopt.h" |
20 |
> |
#ifndef FIX_UNUSED |
21 |
> |
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ |
22 |
> |
#endif |
23 |
|
|
24 |
+ |
#include <getopt.h> |
25 |
+ |
|
26 |
|
#include "StaticPropsCmd.h" |
27 |
|
|
28 |
|
const char *gengetopt_args_info_purpose = ""; |
29 |
|
|
30 |
< |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]..."; |
30 |
> |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; |
31 |
|
|
32 |
|
const char *gengetopt_args_info_description = ""; |
33 |
|
|
40 |
|
" -b, --nbins=INT number of bins (general purpose) \n (default=`100')", |
41 |
|
" -x, --nbins_x=INT number of bins in x axis (default=`100')", |
42 |
|
" -y, --nbins_y=INT number of bins in y axis (default=`100')", |
43 |
+ |
" --nbins_z=INT number of bins in z axis (default=`100')", |
44 |
|
" -a, --nanglebins=INT number of bins for cos(angle) (default=`50')", |
40 |
– |
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
45 |
|
" -c, --rcut=DOUBLE cutoff radius (rcut)", |
46 |
+ |
" --dz=DOUBLE slab width (dz)", |
47 |
+ |
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
48 |
+ |
" --zlength=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
49 |
|
" -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", |
50 |
|
" --sele1=selection script select the first stuntdouble set", |
51 |
|
" --sele2=selection script select the second stuntdouble set", |
60 |
|
" --bo bond order parameter (--rcut must be specified)", |
61 |
|
" --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
62 |
|
" --bad N(theta) bond angle density within (--rcut must \n be specified)", |
63 |
+ |
" --count count of molecules matching selection criteria \n (and associated statistics)", |
64 |
|
" -g, --gofr g(r)", |
65 |
|
" --gofz g(z)", |
66 |
|
" --r_theta g(r, cos(theta))", |
67 |
|
" --r_omega g(r, cos(omega))", |
68 |
+ |
" --r_z g(r, z)", |
69 |
|
" --theta_omega g(cos(theta), cos(omega))", |
70 |
|
" --gxyz g(x, y, z)", |
71 |
< |
" -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
71 |
> |
" --twodgofr 2D g(r) (Slab width --dz must be specified)", |
72 |
> |
" -p, --p2 p2 order parameter (--sele1 must be specified, \n --sele2 is optional)", |
73 |
|
" --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", |
74 |
|
" -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
75 |
|
" -d, --density density plot", |
76 |
|
" --slab_density slab density", |
77 |
+ |
" --p_angle p(cos(theta))", |
78 |
|
" --hxy hxy", |
79 |
|
" --rho_r rho of R", |
80 |
+ |
" --angle_r angle of R", |
81 |
|
" --hullvol hull volume of nanoparticle", |
82 |
+ |
" --rodlength length of nanorod", |
83 |
+ |
" -Q, --tet_param tetrahedrality order parameter", |
84 |
+ |
" --tet_param_z tetrahedrality order parameter by zbin(--sele1 \n must be specified)", |
85 |
|
0 |
86 |
|
}; |
87 |
|
|
97 |
|
void clear_args (struct gengetopt_args_info *args_info); |
98 |
|
|
99 |
|
static int |
100 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
100 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
101 |
|
struct cmdline_parser_params *params, const char *additional_error); |
102 |
|
|
103 |
|
static int |
117 |
|
args_info->nbins_given = 0 ; |
118 |
|
args_info->nbins_x_given = 0 ; |
119 |
|
args_info->nbins_y_given = 0 ; |
120 |
+ |
args_info->nbins_z_given = 0 ; |
121 |
|
args_info->nanglebins_given = 0 ; |
106 |
– |
args_info->length_given = 0 ; |
122 |
|
args_info->rcut_given = 0 ; |
123 |
+ |
args_info->dz_given = 0 ; |
124 |
+ |
args_info->length_given = 0 ; |
125 |
+ |
args_info->zlength_given = 0 ; |
126 |
|
args_info->zoffset_given = 0 ; |
127 |
|
args_info->sele1_given = 0 ; |
128 |
|
args_info->sele2_given = 0 ; |
136 |
|
args_info->bo_given = 0 ; |
137 |
|
args_info->bor_given = 0 ; |
138 |
|
args_info->bad_given = 0 ; |
139 |
+ |
args_info->count_given = 0 ; |
140 |
|
args_info->gofr_given = 0 ; |
141 |
|
args_info->gofz_given = 0 ; |
142 |
|
args_info->r_theta_given = 0 ; |
143 |
|
args_info->r_omega_given = 0 ; |
144 |
+ |
args_info->r_z_given = 0 ; |
145 |
|
args_info->theta_omega_given = 0 ; |
146 |
|
args_info->gxyz_given = 0 ; |
147 |
+ |
args_info->twodgofr_given = 0 ; |
148 |
|
args_info->p2_given = 0 ; |
149 |
|
args_info->rp2_given = 0 ; |
150 |
|
args_info->scd_given = 0 ; |
151 |
|
args_info->density_given = 0 ; |
152 |
|
args_info->slab_density_given = 0 ; |
153 |
+ |
args_info->p_angle_given = 0 ; |
154 |
|
args_info->hxy_given = 0 ; |
155 |
|
args_info->rho_r_given = 0 ; |
156 |
+ |
args_info->angle_r_given = 0 ; |
157 |
|
args_info->hullvol_given = 0 ; |
158 |
+ |
args_info->rodlength_given = 0 ; |
159 |
+ |
args_info->tet_param_given = 0 ; |
160 |
+ |
args_info->tet_param_z_given = 0 ; |
161 |
|
args_info->staticProps_group_counter = 0 ; |
162 |
|
} |
163 |
|
|
164 |
|
static |
165 |
|
void clear_args (struct gengetopt_args_info *args_info) |
166 |
|
{ |
167 |
+ |
FIX_UNUSED (args_info); |
168 |
|
args_info->input_arg = NULL; |
169 |
|
args_info->input_orig = NULL; |
170 |
|
args_info->output_arg = NULL; |
177 |
|
args_info->nbins_x_orig = NULL; |
178 |
|
args_info->nbins_y_arg = 100; |
179 |
|
args_info->nbins_y_orig = NULL; |
180 |
+ |
args_info->nbins_z_arg = 100; |
181 |
+ |
args_info->nbins_z_orig = NULL; |
182 |
|
args_info->nanglebins_arg = 50; |
183 |
|
args_info->nanglebins_orig = NULL; |
155 |
– |
args_info->length_orig = NULL; |
184 |
|
args_info->rcut_orig = NULL; |
185 |
+ |
args_info->dz_orig = NULL; |
186 |
+ |
args_info->length_orig = NULL; |
187 |
+ |
args_info->zlength_orig = NULL; |
188 |
|
args_info->zoffset_arg = 0; |
189 |
|
args_info->zoffset_orig = NULL; |
190 |
|
args_info->sele1_arg = NULL; |
218 |
|
args_info->nbins_help = gengetopt_args_info_help[5] ; |
219 |
|
args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
220 |
|
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
221 |
< |
args_info->nanglebins_help = gengetopt_args_info_help[8] ; |
222 |
< |
args_info->length_help = gengetopt_args_info_help[9] ; |
221 |
> |
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
222 |
> |
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
223 |
|
args_info->rcut_help = gengetopt_args_info_help[10] ; |
224 |
< |
args_info->zoffset_help = gengetopt_args_info_help[11] ; |
225 |
< |
args_info->sele1_help = gengetopt_args_info_help[12] ; |
226 |
< |
args_info->sele2_help = gengetopt_args_info_help[13] ; |
227 |
< |
args_info->sele3_help = gengetopt_args_info_help[14] ; |
228 |
< |
args_info->refsele_help = gengetopt_args_info_help[15] ; |
229 |
< |
args_info->comsele_help = gengetopt_args_info_help[16] ; |
230 |
< |
args_info->molname_help = gengetopt_args_info_help[17] ; |
231 |
< |
args_info->begin_help = gengetopt_args_info_help[18] ; |
232 |
< |
args_info->end_help = gengetopt_args_info_help[19] ; |
233 |
< |
args_info->radius_help = gengetopt_args_info_help[20] ; |
234 |
< |
args_info->bo_help = gengetopt_args_info_help[22] ; |
235 |
< |
args_info->bor_help = gengetopt_args_info_help[23] ; |
236 |
< |
args_info->bad_help = gengetopt_args_info_help[24] ; |
237 |
< |
args_info->gofr_help = gengetopt_args_info_help[25] ; |
238 |
< |
args_info->gofz_help = gengetopt_args_info_help[26] ; |
239 |
< |
args_info->r_theta_help = gengetopt_args_info_help[27] ; |
240 |
< |
args_info->r_omega_help = gengetopt_args_info_help[28] ; |
241 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[29] ; |
242 |
< |
args_info->gxyz_help = gengetopt_args_info_help[30] ; |
243 |
< |
args_info->p2_help = gengetopt_args_info_help[31] ; |
244 |
< |
args_info->rp2_help = gengetopt_args_info_help[32] ; |
245 |
< |
args_info->scd_help = gengetopt_args_info_help[33] ; |
246 |
< |
args_info->density_help = gengetopt_args_info_help[34] ; |
247 |
< |
args_info->slab_density_help = gengetopt_args_info_help[35] ; |
248 |
< |
args_info->hxy_help = gengetopt_args_info_help[36] ; |
249 |
< |
args_info->rho_r_help = gengetopt_args_info_help[37] ; |
250 |
< |
args_info->hullvol_help = gengetopt_args_info_help[38] ; |
224 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
225 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
226 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
227 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
228 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
229 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
230 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
231 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
232 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
233 |
> |
args_info->molname_help = gengetopt_args_info_help[20] ; |
234 |
> |
args_info->begin_help = gengetopt_args_info_help[21] ; |
235 |
> |
args_info->end_help = gengetopt_args_info_help[22] ; |
236 |
> |
args_info->radius_help = gengetopt_args_info_help[23] ; |
237 |
> |
args_info->bo_help = gengetopt_args_info_help[25] ; |
238 |
> |
args_info->bor_help = gengetopt_args_info_help[26] ; |
239 |
> |
args_info->bad_help = gengetopt_args_info_help[27] ; |
240 |
> |
args_info->count_help = gengetopt_args_info_help[28] ; |
241 |
> |
args_info->gofr_help = gengetopt_args_info_help[29] ; |
242 |
> |
args_info->gofz_help = gengetopt_args_info_help[30] ; |
243 |
> |
args_info->r_theta_help = gengetopt_args_info_help[31] ; |
244 |
> |
args_info->r_omega_help = gengetopt_args_info_help[32] ; |
245 |
> |
args_info->r_z_help = gengetopt_args_info_help[33] ; |
246 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[34] ; |
247 |
> |
args_info->gxyz_help = gengetopt_args_info_help[35] ; |
248 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[36] ; |
249 |
> |
args_info->p2_help = gengetopt_args_info_help[37] ; |
250 |
> |
args_info->rp2_help = gengetopt_args_info_help[38] ; |
251 |
> |
args_info->scd_help = gengetopt_args_info_help[39] ; |
252 |
> |
args_info->density_help = gengetopt_args_info_help[40] ; |
253 |
> |
args_info->slab_density_help = gengetopt_args_info_help[41] ; |
254 |
> |
args_info->p_angle_help = gengetopt_args_info_help[42] ; |
255 |
> |
args_info->hxy_help = gengetopt_args_info_help[43] ; |
256 |
> |
args_info->rho_r_help = gengetopt_args_info_help[44] ; |
257 |
> |
args_info->angle_r_help = gengetopt_args_info_help[45] ; |
258 |
> |
args_info->hullvol_help = gengetopt_args_info_help[46] ; |
259 |
> |
args_info->rodlength_help = gengetopt_args_info_help[47] ; |
260 |
> |
args_info->tet_param_help = gengetopt_args_info_help[48] ; |
261 |
> |
args_info->tet_param_z_help = gengetopt_args_info_help[49] ; |
262 |
|
|
263 |
|
} |
264 |
|
|
265 |
|
void |
266 |
|
cmdline_parser_print_version (void) |
267 |
|
{ |
268 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
268 |
> |
printf ("%s %s\n", |
269 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
270 |
> |
CMDLINE_PARSER_VERSION); |
271 |
|
} |
272 |
|
|
273 |
|
static void print_help_common(void) { |
282 |
|
printf("\n"); |
283 |
|
|
284 |
|
if (strlen(gengetopt_args_info_description) > 0) |
285 |
< |
printf("%s\n", gengetopt_args_info_description); |
285 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
286 |
|
} |
287 |
|
|
288 |
|
void |
300 |
|
clear_given (args_info); |
301 |
|
clear_args (args_info); |
302 |
|
init_args_info (args_info); |
303 |
+ |
|
304 |
+ |
args_info->inputs = 0; |
305 |
+ |
args_info->inputs_num = 0; |
306 |
|
} |
307 |
|
|
308 |
|
void |
341 |
|
static void |
342 |
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
343 |
|
{ |
344 |
< |
|
344 |
> |
unsigned int i; |
345 |
|
free_string_field (&(args_info->input_arg)); |
346 |
|
free_string_field (&(args_info->input_orig)); |
347 |
|
free_string_field (&(args_info->output_arg)); |
350 |
|
free_string_field (&(args_info->nbins_orig)); |
351 |
|
free_string_field (&(args_info->nbins_x_orig)); |
352 |
|
free_string_field (&(args_info->nbins_y_orig)); |
353 |
+ |
free_string_field (&(args_info->nbins_z_orig)); |
354 |
|
free_string_field (&(args_info->nanglebins_orig)); |
307 |
– |
free_string_field (&(args_info->length_orig)); |
355 |
|
free_string_field (&(args_info->rcut_orig)); |
356 |
+ |
free_string_field (&(args_info->dz_orig)); |
357 |
+ |
free_string_field (&(args_info->length_orig)); |
358 |
+ |
free_string_field (&(args_info->zlength_orig)); |
359 |
|
free_string_field (&(args_info->zoffset_orig)); |
360 |
|
free_string_field (&(args_info->sele1_arg)); |
361 |
|
free_string_field (&(args_info->sele1_orig)); |
374 |
|
free_string_field (&(args_info->radius_orig)); |
375 |
|
|
376 |
|
|
377 |
+ |
for (i = 0; i < args_info->inputs_num; ++i) |
378 |
+ |
free (args_info->inputs [i]); |
379 |
|
|
380 |
+ |
if (args_info->inputs_num) |
381 |
+ |
free (args_info->inputs); |
382 |
+ |
|
383 |
|
clear_given (args_info); |
384 |
|
} |
385 |
|
|
386 |
|
|
387 |
|
static void |
388 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
388 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
389 |
|
{ |
390 |
+ |
FIX_UNUSED (values); |
391 |
|
if (arg) { |
392 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
393 |
|
} else { |
423 |
|
write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); |
424 |
|
if (args_info->nbins_y_given) |
425 |
|
write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); |
426 |
+ |
if (args_info->nbins_z_given) |
427 |
+ |
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
428 |
|
if (args_info->nanglebins_given) |
429 |
|
write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); |
372 |
– |
if (args_info->length_given) |
373 |
– |
write_into_file(outfile, "length", args_info->length_orig, 0); |
430 |
|
if (args_info->rcut_given) |
431 |
|
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
432 |
+ |
if (args_info->dz_given) |
433 |
+ |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
434 |
+ |
if (args_info->length_given) |
435 |
+ |
write_into_file(outfile, "length", args_info->length_orig, 0); |
436 |
+ |
if (args_info->zlength_given) |
437 |
+ |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
438 |
|
if (args_info->zoffset_given) |
439 |
|
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
440 |
|
if (args_info->sele1_given) |
461 |
|
write_into_file(outfile, "bor", 0, 0 ); |
462 |
|
if (args_info->bad_given) |
463 |
|
write_into_file(outfile, "bad", 0, 0 ); |
464 |
+ |
if (args_info->count_given) |
465 |
+ |
write_into_file(outfile, "count", 0, 0 ); |
466 |
|
if (args_info->gofr_given) |
467 |
|
write_into_file(outfile, "gofr", 0, 0 ); |
468 |
|
if (args_info->gofz_given) |
471 |
|
write_into_file(outfile, "r_theta", 0, 0 ); |
472 |
|
if (args_info->r_omega_given) |
473 |
|
write_into_file(outfile, "r_omega", 0, 0 ); |
474 |
+ |
if (args_info->r_z_given) |
475 |
+ |
write_into_file(outfile, "r_z", 0, 0 ); |
476 |
|
if (args_info->theta_omega_given) |
477 |
|
write_into_file(outfile, "theta_omega", 0, 0 ); |
478 |
|
if (args_info->gxyz_given) |
479 |
|
write_into_file(outfile, "gxyz", 0, 0 ); |
480 |
+ |
if (args_info->twodgofr_given) |
481 |
+ |
write_into_file(outfile, "twodgofr", 0, 0 ); |
482 |
|
if (args_info->p2_given) |
483 |
|
write_into_file(outfile, "p2", 0, 0 ); |
484 |
|
if (args_info->rp2_given) |
489 |
|
write_into_file(outfile, "density", 0, 0 ); |
490 |
|
if (args_info->slab_density_given) |
491 |
|
write_into_file(outfile, "slab_density", 0, 0 ); |
492 |
+ |
if (args_info->p_angle_given) |
493 |
+ |
write_into_file(outfile, "p_angle", 0, 0 ); |
494 |
|
if (args_info->hxy_given) |
495 |
|
write_into_file(outfile, "hxy", 0, 0 ); |
496 |
|
if (args_info->rho_r_given) |
497 |
|
write_into_file(outfile, "rho_r", 0, 0 ); |
498 |
+ |
if (args_info->angle_r_given) |
499 |
+ |
write_into_file(outfile, "angle_r", 0, 0 ); |
500 |
|
if (args_info->hullvol_given) |
501 |
|
write_into_file(outfile, "hullvol", 0, 0 ); |
502 |
+ |
if (args_info->rodlength_given) |
503 |
+ |
write_into_file(outfile, "rodlength", 0, 0 ); |
504 |
+ |
if (args_info->tet_param_given) |
505 |
+ |
write_into_file(outfile, "tet_param", 0, 0 ); |
506 |
+ |
if (args_info->tet_param_z_given) |
507 |
+ |
write_into_file(outfile, "tet_param_z", 0, 0 ); |
508 |
|
|
509 |
|
|
510 |
|
i = EXIT_SUCCESS; |
541 |
|
char * |
542 |
|
gengetopt_strdup (const char *s) |
543 |
|
{ |
544 |
< |
char *result = NULL; |
544 |
> |
char *result = 0; |
545 |
|
if (!s) |
546 |
|
return result; |
547 |
|
|
561 |
|
args_info->bo_given = 0 ; |
562 |
|
args_info->bor_given = 0 ; |
563 |
|
args_info->bad_given = 0 ; |
564 |
+ |
args_info->count_given = 0 ; |
565 |
|
args_info->gofr_given = 0 ; |
566 |
|
args_info->gofz_given = 0 ; |
567 |
|
args_info->r_theta_given = 0 ; |
568 |
|
args_info->r_omega_given = 0 ; |
569 |
+ |
args_info->r_z_given = 0 ; |
570 |
|
args_info->theta_omega_given = 0 ; |
571 |
|
args_info->gxyz_given = 0 ; |
572 |
+ |
args_info->twodgofr_given = 0 ; |
573 |
|
args_info->p2_given = 0 ; |
574 |
|
args_info->rp2_given = 0 ; |
575 |
|
args_info->scd_given = 0 ; |
576 |
|
args_info->density_given = 0 ; |
577 |
|
args_info->slab_density_given = 0 ; |
578 |
+ |
args_info->p_angle_given = 0 ; |
579 |
|
args_info->hxy_given = 0 ; |
580 |
|
args_info->rho_r_given = 0 ; |
581 |
+ |
args_info->angle_r_given = 0 ; |
582 |
|
args_info->hullvol_given = 0 ; |
583 |
+ |
args_info->rodlength_given = 0 ; |
584 |
+ |
args_info->tet_param_given = 0 ; |
585 |
+ |
args_info->tet_param_z_given = 0 ; |
586 |
|
|
587 |
|
args_info->staticProps_group_counter = 0; |
588 |
|
} |
589 |
|
|
590 |
|
int |
591 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
591 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
592 |
|
{ |
593 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
594 |
|
} |
595 |
|
|
596 |
|
int |
597 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
597 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
598 |
|
struct cmdline_parser_params *params) |
599 |
|
{ |
600 |
|
int result; |
601 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
601 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
602 |
|
|
603 |
|
if (result == EXIT_FAILURE) |
604 |
|
{ |
610 |
|
} |
611 |
|
|
612 |
|
int |
613 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
613 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
614 |
|
{ |
615 |
|
int result; |
616 |
|
struct cmdline_parser_params params; |
621 |
|
params.check_ambiguity = 0; |
622 |
|
params.print_errors = 1; |
623 |
|
|
624 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
624 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
625 |
|
|
626 |
|
if (result == EXIT_FAILURE) |
627 |
|
{ |
637 |
|
{ |
638 |
|
int result = EXIT_SUCCESS; |
639 |
|
|
640 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
640 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
641 |
|
result = EXIT_FAILURE; |
642 |
|
|
643 |
|
if (result == EXIT_FAILURE) |
653 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
654 |
|
{ |
655 |
|
int error = 0; |
656 |
+ |
FIX_UNUSED (additional_error); |
657 |
|
|
658 |
|
/* checks for required options */ |
659 |
|
if (! args_info->input_given) |
664 |
|
|
665 |
|
if (args_info->staticProps_group_counter == 0) |
666 |
|
{ |
667 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
667 |
> |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
668 |
|
error = 1; |
669 |
|
} |
670 |
|
|
698 |
|
static |
699 |
|
int update_arg(void *field, char **orig_field, |
700 |
|
unsigned int *field_given, unsigned int *prev_given, |
701 |
< |
char *value, char *possible_values[], const char *default_value, |
701 |
> |
char *value, const char *possible_values[], |
702 |
> |
const char *default_value, |
703 |
|
cmdline_parser_arg_type arg_type, |
704 |
|
int check_ambiguity, int override, |
705 |
|
int no_free, int multiple_option, |
710 |
|
const char *val = value; |
711 |
|
int found; |
712 |
|
char **string_field; |
713 |
+ |
FIX_UNUSED (field); |
714 |
|
|
715 |
|
stop_char = 0; |
716 |
|
found = 0; |
728 |
|
return 1; /* failure */ |
729 |
|
} |
730 |
|
|
731 |
+ |
FIX_UNUSED (default_value); |
732 |
|
|
733 |
|
if (field_given && *field_given && ! override) |
734 |
|
return 0; |
792 |
|
|
793 |
|
|
794 |
|
int |
795 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
795 |
> |
cmdline_parser_internal ( |
796 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
797 |
|
struct cmdline_parser_params *params, const char *additional_error) |
798 |
|
{ |
799 |
|
int c; /* Character of the parsed option. */ |
836 |
|
{ "nbins", 1, NULL, 'b' }, |
837 |
|
{ "nbins_x", 1, NULL, 'x' }, |
838 |
|
{ "nbins_y", 1, NULL, 'y' }, |
839 |
+ |
{ "nbins_z", 1, NULL, 0 }, |
840 |
|
{ "nanglebins", 1, NULL, 'a' }, |
749 |
– |
{ "length", 1, NULL, 0 }, |
841 |
|
{ "rcut", 1, NULL, 'c' }, |
842 |
+ |
{ "dz", 1, NULL, 0 }, |
843 |
+ |
{ "length", 1, NULL, 0 }, |
844 |
+ |
{ "zlength", 1, NULL, 0 }, |
845 |
|
{ "zoffset", 1, NULL, 'z' }, |
846 |
|
{ "sele1", 1, NULL, 0 }, |
847 |
|
{ "sele2", 1, NULL, 0 }, |
855 |
|
{ "bo", 0, NULL, 0 }, |
856 |
|
{ "bor", 0, NULL, 0 }, |
857 |
|
{ "bad", 0, NULL, 0 }, |
858 |
+ |
{ "count", 0, NULL, 0 }, |
859 |
|
{ "gofr", 0, NULL, 'g' }, |
860 |
|
{ "gofz", 0, NULL, 0 }, |
861 |
|
{ "r_theta", 0, NULL, 0 }, |
862 |
|
{ "r_omega", 0, NULL, 0 }, |
863 |
+ |
{ "r_z", 0, NULL, 0 }, |
864 |
|
{ "theta_omega", 0, NULL, 0 }, |
865 |
|
{ "gxyz", 0, NULL, 0 }, |
866 |
+ |
{ "twodgofr", 0, NULL, 0 }, |
867 |
|
{ "p2", 0, NULL, 'p' }, |
868 |
|
{ "rp2", 0, NULL, 0 }, |
869 |
|
{ "scd", 0, NULL, 's' }, |
870 |
|
{ "density", 0, NULL, 'd' }, |
871 |
|
{ "slab_density", 0, NULL, 0 }, |
872 |
+ |
{ "p_angle", 0, NULL, 0 }, |
873 |
|
{ "hxy", 0, NULL, 0 }, |
874 |
|
{ "rho_r", 0, NULL, 0 }, |
875 |
+ |
{ "angle_r", 0, NULL, 0 }, |
876 |
|
{ "hullvol", 0, NULL, 0 }, |
877 |
< |
{ NULL, 0, NULL, 0 } |
877 |
> |
{ "rodlength", 0, NULL, 0 }, |
878 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
879 |
> |
{ "tet_param_z", 0, NULL, 0 }, |
880 |
> |
{ 0, 0, 0, 0 } |
881 |
|
}; |
882 |
|
|
883 |
< |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
883 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
884 |
|
|
885 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
886 |
|
|
1019 |
|
goto failure; |
1020 |
|
|
1021 |
|
break; |
1022 |
< |
case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ |
1022 |
> |
case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ |
1023 |
|
|
1024 |
|
if (args_info->staticProps_group_counter && override) |
1025 |
|
reset_group_staticProps (args_info); |
1064 |
|
goto failure; |
1065 |
|
|
1066 |
|
break; |
1067 |
+ |
case 'Q': /* tetrahedrality order parameter. */ |
1068 |
+ |
|
1069 |
+ |
if (args_info->staticProps_group_counter && override) |
1070 |
+ |
reset_group_staticProps (args_info); |
1071 |
+ |
args_info->staticProps_group_counter += 1; |
1072 |
+ |
|
1073 |
+ |
if (update_arg( 0 , |
1074 |
+ |
0 , &(args_info->tet_param_given), |
1075 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
1076 |
+ |
check_ambiguity, override, 0, 0, |
1077 |
+ |
"tet_param", 'Q', |
1078 |
+ |
additional_error)) |
1079 |
+ |
goto failure; |
1080 |
+ |
|
1081 |
+ |
break; |
1082 |
|
|
1083 |
|
case 0: /* Long option with no short option */ |
1084 |
+ |
/* number of bins in z axis. */ |
1085 |
+ |
if (strcmp (long_options[option_index].name, "nbins_z") == 0) |
1086 |
+ |
{ |
1087 |
+ |
|
1088 |
+ |
|
1089 |
+ |
if (update_arg( (void *)&(args_info->nbins_z_arg), |
1090 |
+ |
&(args_info->nbins_z_orig), &(args_info->nbins_z_given), |
1091 |
+ |
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
1092 |
+ |
check_ambiguity, override, 0, 0, |
1093 |
+ |
"nbins_z", '-', |
1094 |
+ |
additional_error)) |
1095 |
+ |
goto failure; |
1096 |
+ |
|
1097 |
+ |
} |
1098 |
+ |
/* slab width (dz). */ |
1099 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
1100 |
+ |
{ |
1101 |
+ |
|
1102 |
+ |
|
1103 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
1104 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
1105 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
1106 |
+ |
check_ambiguity, override, 0, 0, |
1107 |
+ |
"dz", '-', |
1108 |
+ |
additional_error)) |
1109 |
+ |
goto failure; |
1110 |
+ |
|
1111 |
+ |
} |
1112 |
|
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1113 |
< |
if (strcmp (long_options[option_index].name, "length") == 0) |
1113 |
> |
else if (strcmp (long_options[option_index].name, "length") == 0) |
1114 |
|
{ |
1115 |
|
|
1116 |
|
|
1123 |
|
goto failure; |
1124 |
|
|
1125 |
|
} |
1126 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1127 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1128 |
+ |
{ |
1129 |
+ |
|
1130 |
+ |
|
1131 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1132 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1133 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1134 |
+ |
check_ambiguity, override, 0, 0, |
1135 |
+ |
"zlength", '-', |
1136 |
+ |
additional_error)) |
1137 |
+ |
goto failure; |
1138 |
+ |
|
1139 |
+ |
} |
1140 |
|
/* select the first stuntdouble set. */ |
1141 |
|
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1142 |
|
{ |
1310 |
|
&(local_args_info.bad_given), optarg, 0, 0, ARG_NO, |
1311 |
|
check_ambiguity, override, 0, 0, |
1312 |
|
"bad", '-', |
1313 |
+ |
additional_error)) |
1314 |
+ |
goto failure; |
1315 |
+ |
|
1316 |
+ |
} |
1317 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
1318 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
1319 |
+ |
{ |
1320 |
+ |
|
1321 |
+ |
if (args_info->staticProps_group_counter && override) |
1322 |
+ |
reset_group_staticProps (args_info); |
1323 |
+ |
args_info->staticProps_group_counter += 1; |
1324 |
+ |
|
1325 |
+ |
if (update_arg( 0 , |
1326 |
+ |
0 , &(args_info->count_given), |
1327 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
1328 |
+ |
check_ambiguity, override, 0, 0, |
1329 |
+ |
"count", '-', |
1330 |
|
additional_error)) |
1331 |
|
goto failure; |
1332 |
|
|
1382 |
|
goto failure; |
1383 |
|
|
1384 |
|
} |
1385 |
+ |
/* g(r, z). */ |
1386 |
+ |
else if (strcmp (long_options[option_index].name, "r_z") == 0) |
1387 |
+ |
{ |
1388 |
+ |
|
1389 |
+ |
if (args_info->staticProps_group_counter && override) |
1390 |
+ |
reset_group_staticProps (args_info); |
1391 |
+ |
args_info->staticProps_group_counter += 1; |
1392 |
+ |
|
1393 |
+ |
if (update_arg( 0 , |
1394 |
+ |
0 , &(args_info->r_z_given), |
1395 |
+ |
&(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, |
1396 |
+ |
check_ambiguity, override, 0, 0, |
1397 |
+ |
"r_z", '-', |
1398 |
+ |
additional_error)) |
1399 |
+ |
goto failure; |
1400 |
+ |
|
1401 |
+ |
} |
1402 |
|
/* g(cos(theta), cos(omega)). */ |
1403 |
|
else if (strcmp (long_options[option_index].name, "theta_omega") == 0) |
1404 |
|
{ |
1433 |
|
goto failure; |
1434 |
|
|
1435 |
|
} |
1436 |
+ |
/* 2D g(r) (Slab width --dz must be specified). */ |
1437 |
+ |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
1438 |
+ |
{ |
1439 |
+ |
|
1440 |
+ |
if (args_info->staticProps_group_counter && override) |
1441 |
+ |
reset_group_staticProps (args_info); |
1442 |
+ |
args_info->staticProps_group_counter += 1; |
1443 |
+ |
|
1444 |
+ |
if (update_arg( 0 , |
1445 |
+ |
0 , &(args_info->twodgofr_given), |
1446 |
+ |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
1447 |
+ |
check_ambiguity, override, 0, 0, |
1448 |
+ |
"twodgofr", '-', |
1449 |
+ |
additional_error)) |
1450 |
+ |
goto failure; |
1451 |
+ |
|
1452 |
+ |
} |
1453 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1454 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1455 |
|
{ |
1484 |
|
goto failure; |
1485 |
|
|
1486 |
|
} |
1487 |
+ |
/* p(cos(theta)). */ |
1488 |
+ |
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
1489 |
+ |
{ |
1490 |
+ |
|
1491 |
+ |
if (args_info->staticProps_group_counter && override) |
1492 |
+ |
reset_group_staticProps (args_info); |
1493 |
+ |
args_info->staticProps_group_counter += 1; |
1494 |
+ |
|
1495 |
+ |
if (update_arg( 0 , |
1496 |
+ |
0 , &(args_info->p_angle_given), |
1497 |
+ |
&(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, |
1498 |
+ |
check_ambiguity, override, 0, 0, |
1499 |
+ |
"p_angle", '-', |
1500 |
+ |
additional_error)) |
1501 |
+ |
goto failure; |
1502 |
+ |
|
1503 |
+ |
} |
1504 |
|
/* hxy. */ |
1505 |
|
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1506 |
|
{ |
1535 |
|
goto failure; |
1536 |
|
|
1537 |
|
} |
1538 |
+ |
/* angle of R. */ |
1539 |
+ |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
1540 |
+ |
{ |
1541 |
+ |
|
1542 |
+ |
if (args_info->staticProps_group_counter && override) |
1543 |
+ |
reset_group_staticProps (args_info); |
1544 |
+ |
args_info->staticProps_group_counter += 1; |
1545 |
+ |
|
1546 |
+ |
if (update_arg( 0 , |
1547 |
+ |
0 , &(args_info->angle_r_given), |
1548 |
+ |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
1549 |
+ |
check_ambiguity, override, 0, 0, |
1550 |
+ |
"angle_r", '-', |
1551 |
+ |
additional_error)) |
1552 |
+ |
goto failure; |
1553 |
+ |
|
1554 |
+ |
} |
1555 |
|
/* hull volume of nanoparticle. */ |
1556 |
|
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
1557 |
|
{ |
1569 |
|
goto failure; |
1570 |
|
|
1571 |
|
} |
1572 |
+ |
/* length of nanorod. */ |
1573 |
+ |
else if (strcmp (long_options[option_index].name, "rodlength") == 0) |
1574 |
+ |
{ |
1575 |
|
|
1576 |
+ |
if (args_info->staticProps_group_counter && override) |
1577 |
+ |
reset_group_staticProps (args_info); |
1578 |
+ |
args_info->staticProps_group_counter += 1; |
1579 |
+ |
|
1580 |
+ |
if (update_arg( 0 , |
1581 |
+ |
0 , &(args_info->rodlength_given), |
1582 |
+ |
&(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, |
1583 |
+ |
check_ambiguity, override, 0, 0, |
1584 |
+ |
"rodlength", '-', |
1585 |
+ |
additional_error)) |
1586 |
+ |
goto failure; |
1587 |
+ |
|
1588 |
+ |
} |
1589 |
+ |
/* tetrahedrality order parameter by zbin(--sele1 must be specified). */ |
1590 |
+ |
else if (strcmp (long_options[option_index].name, "tet_param_z") == 0) |
1591 |
+ |
{ |
1592 |
+ |
|
1593 |
+ |
if (args_info->staticProps_group_counter && override) |
1594 |
+ |
reset_group_staticProps (args_info); |
1595 |
+ |
args_info->staticProps_group_counter += 1; |
1596 |
+ |
|
1597 |
+ |
if (update_arg( 0 , |
1598 |
+ |
0 , &(args_info->tet_param_z_given), |
1599 |
+ |
&(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO, |
1600 |
+ |
check_ambiguity, override, 0, 0, |
1601 |
+ |
"tet_param_z", '-', |
1602 |
+ |
additional_error)) |
1603 |
+ |
goto failure; |
1604 |
+ |
|
1605 |
+ |
} |
1606 |
+ |
|
1607 |
|
break; |
1608 |
|
case '?': /* Invalid option. */ |
1609 |
|
/* `getopt_long' already printed an error message. */ |
1617 |
|
|
1618 |
|
if (args_info->staticProps_group_counter > 1) |
1619 |
|
{ |
1620 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
1620 |
> |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
1621 |
|
error = 1; |
1622 |
|
} |
1623 |
|
|
1633 |
|
if ( error ) |
1634 |
|
return (EXIT_FAILURE); |
1635 |
|
|
1636 |
+ |
if (optind < argc) |
1637 |
+ |
{ |
1638 |
+ |
int i = 0 ; |
1639 |
+ |
int found_prog_name = 0; |
1640 |
+ |
/* whether program name, i.e., argv[0], is in the remaining args |
1641 |
+ |
(this may happen with some implementations of getopt, |
1642 |
+ |
but surely not with the one included by gengetopt) */ |
1643 |
+ |
|
1644 |
+ |
i = optind; |
1645 |
+ |
while (i < argc) |
1646 |
+ |
if (argv[i++] == argv[0]) { |
1647 |
+ |
found_prog_name = 1; |
1648 |
+ |
break; |
1649 |
+ |
} |
1650 |
+ |
i = 0; |
1651 |
+ |
|
1652 |
+ |
args_info->inputs_num = argc - optind - found_prog_name; |
1653 |
+ |
args_info->inputs = |
1654 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1655 |
+ |
while (optind < argc) |
1656 |
+ |
if (argv[optind++] != argv[0]) |
1657 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1658 |
+ |
} |
1659 |
+ |
|
1660 |
|
return 0; |
1661 |
|
|
1662 |
|
failure: |