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 -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 |
|
0 |
85 |
|
}; |
86 |
|
|
96 |
|
void clear_args (struct gengetopt_args_info *args_info); |
97 |
|
|
98 |
|
static int |
99 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
99 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
100 |
|
struct cmdline_parser_params *params, const char *additional_error); |
101 |
|
|
102 |
|
static int |
116 |
|
args_info->nbins_given = 0 ; |
117 |
|
args_info->nbins_x_given = 0 ; |
118 |
|
args_info->nbins_y_given = 0 ; |
119 |
+ |
args_info->nbins_z_given = 0 ; |
120 |
|
args_info->nanglebins_given = 0 ; |
106 |
– |
args_info->length_given = 0 ; |
121 |
|
args_info->rcut_given = 0 ; |
122 |
+ |
args_info->dz_given = 0 ; |
123 |
+ |
args_info->length_given = 0 ; |
124 |
+ |
args_info->zlength_given = 0 ; |
125 |
|
args_info->zoffset_given = 0 ; |
126 |
|
args_info->sele1_given = 0 ; |
127 |
|
args_info->sele2_given = 0 ; |
135 |
|
args_info->bo_given = 0 ; |
136 |
|
args_info->bor_given = 0 ; |
137 |
|
args_info->bad_given = 0 ; |
138 |
+ |
args_info->count_given = 0 ; |
139 |
|
args_info->gofr_given = 0 ; |
140 |
|
args_info->gofz_given = 0 ; |
141 |
|
args_info->r_theta_given = 0 ; |
142 |
|
args_info->r_omega_given = 0 ; |
143 |
+ |
args_info->r_z_given = 0 ; |
144 |
|
args_info->theta_omega_given = 0 ; |
145 |
|
args_info->gxyz_given = 0 ; |
146 |
+ |
args_info->twodgofr_given = 0 ; |
147 |
|
args_info->p2_given = 0 ; |
148 |
|
args_info->rp2_given = 0 ; |
149 |
|
args_info->scd_given = 0 ; |
150 |
|
args_info->density_given = 0 ; |
151 |
|
args_info->slab_density_given = 0 ; |
152 |
+ |
args_info->p_angle_given = 0 ; |
153 |
|
args_info->hxy_given = 0 ; |
154 |
|
args_info->rho_r_given = 0 ; |
155 |
+ |
args_info->angle_r_given = 0 ; |
156 |
|
args_info->hullvol_given = 0 ; |
157 |
+ |
args_info->rodlength_given = 0 ; |
158 |
+ |
args_info->tet_param_given = 0 ; |
159 |
|
args_info->staticProps_group_counter = 0 ; |
160 |
|
} |
161 |
|
|
162 |
|
static |
163 |
|
void clear_args (struct gengetopt_args_info *args_info) |
164 |
|
{ |
165 |
+ |
FIX_UNUSED (args_info); |
166 |
|
args_info->input_arg = NULL; |
167 |
|
args_info->input_orig = NULL; |
168 |
|
args_info->output_arg = NULL; |
175 |
|
args_info->nbins_x_orig = NULL; |
176 |
|
args_info->nbins_y_arg = 100; |
177 |
|
args_info->nbins_y_orig = NULL; |
178 |
+ |
args_info->nbins_z_arg = 100; |
179 |
+ |
args_info->nbins_z_orig = NULL; |
180 |
|
args_info->nanglebins_arg = 50; |
181 |
|
args_info->nanglebins_orig = NULL; |
155 |
– |
args_info->length_orig = NULL; |
182 |
|
args_info->rcut_orig = NULL; |
183 |
+ |
args_info->dz_orig = NULL; |
184 |
+ |
args_info->length_orig = NULL; |
185 |
+ |
args_info->zlength_orig = NULL; |
186 |
|
args_info->zoffset_arg = 0; |
187 |
|
args_info->zoffset_orig = NULL; |
188 |
|
args_info->sele1_arg = NULL; |
216 |
|
args_info->nbins_help = gengetopt_args_info_help[5] ; |
217 |
|
args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
218 |
|
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
219 |
< |
args_info->nanglebins_help = gengetopt_args_info_help[8] ; |
220 |
< |
args_info->length_help = gengetopt_args_info_help[9] ; |
219 |
> |
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
220 |
> |
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
221 |
|
args_info->rcut_help = gengetopt_args_info_help[10] ; |
222 |
< |
args_info->zoffset_help = gengetopt_args_info_help[11] ; |
223 |
< |
args_info->sele1_help = gengetopt_args_info_help[12] ; |
224 |
< |
args_info->sele2_help = gengetopt_args_info_help[13] ; |
225 |
< |
args_info->sele3_help = gengetopt_args_info_help[14] ; |
226 |
< |
args_info->refsele_help = gengetopt_args_info_help[15] ; |
227 |
< |
args_info->comsele_help = gengetopt_args_info_help[16] ; |
228 |
< |
args_info->molname_help = gengetopt_args_info_help[17] ; |
229 |
< |
args_info->begin_help = gengetopt_args_info_help[18] ; |
230 |
< |
args_info->end_help = gengetopt_args_info_help[19] ; |
231 |
< |
args_info->radius_help = gengetopt_args_info_help[20] ; |
232 |
< |
args_info->bo_help = gengetopt_args_info_help[22] ; |
233 |
< |
args_info->bor_help = gengetopt_args_info_help[23] ; |
234 |
< |
args_info->bad_help = gengetopt_args_info_help[24] ; |
235 |
< |
args_info->gofr_help = gengetopt_args_info_help[25] ; |
236 |
< |
args_info->gofz_help = gengetopt_args_info_help[26] ; |
237 |
< |
args_info->r_theta_help = gengetopt_args_info_help[27] ; |
238 |
< |
args_info->r_omega_help = gengetopt_args_info_help[28] ; |
239 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[29] ; |
240 |
< |
args_info->gxyz_help = gengetopt_args_info_help[30] ; |
241 |
< |
args_info->p2_help = gengetopt_args_info_help[31] ; |
242 |
< |
args_info->rp2_help = gengetopt_args_info_help[32] ; |
243 |
< |
args_info->scd_help = gengetopt_args_info_help[33] ; |
244 |
< |
args_info->density_help = gengetopt_args_info_help[34] ; |
245 |
< |
args_info->slab_density_help = gengetopt_args_info_help[35] ; |
246 |
< |
args_info->hxy_help = gengetopt_args_info_help[36] ; |
247 |
< |
args_info->rho_r_help = gengetopt_args_info_help[37] ; |
248 |
< |
args_info->hullvol_help = gengetopt_args_info_help[38] ; |
222 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
223 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
224 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
225 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
226 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
227 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
228 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
229 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
230 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
231 |
> |
args_info->molname_help = gengetopt_args_info_help[20] ; |
232 |
> |
args_info->begin_help = gengetopt_args_info_help[21] ; |
233 |
> |
args_info->end_help = gengetopt_args_info_help[22] ; |
234 |
> |
args_info->radius_help = gengetopt_args_info_help[23] ; |
235 |
> |
args_info->bo_help = gengetopt_args_info_help[25] ; |
236 |
> |
args_info->bor_help = gengetopt_args_info_help[26] ; |
237 |
> |
args_info->bad_help = gengetopt_args_info_help[27] ; |
238 |
> |
args_info->count_help = gengetopt_args_info_help[28] ; |
239 |
> |
args_info->gofr_help = gengetopt_args_info_help[29] ; |
240 |
> |
args_info->gofz_help = gengetopt_args_info_help[30] ; |
241 |
> |
args_info->r_theta_help = gengetopt_args_info_help[31] ; |
242 |
> |
args_info->r_omega_help = gengetopt_args_info_help[32] ; |
243 |
> |
args_info->r_z_help = gengetopt_args_info_help[33] ; |
244 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[34] ; |
245 |
> |
args_info->gxyz_help = gengetopt_args_info_help[35] ; |
246 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[36] ; |
247 |
> |
args_info->p2_help = gengetopt_args_info_help[37] ; |
248 |
> |
args_info->rp2_help = gengetopt_args_info_help[38] ; |
249 |
> |
args_info->scd_help = gengetopt_args_info_help[39] ; |
250 |
> |
args_info->density_help = gengetopt_args_info_help[40] ; |
251 |
> |
args_info->slab_density_help = gengetopt_args_info_help[41] ; |
252 |
> |
args_info->p_angle_help = gengetopt_args_info_help[42] ; |
253 |
> |
args_info->hxy_help = gengetopt_args_info_help[43] ; |
254 |
> |
args_info->rho_r_help = gengetopt_args_info_help[44] ; |
255 |
> |
args_info->angle_r_help = gengetopt_args_info_help[45] ; |
256 |
> |
args_info->hullvol_help = gengetopt_args_info_help[46] ; |
257 |
> |
args_info->rodlength_help = gengetopt_args_info_help[47] ; |
258 |
> |
args_info->tet_param_help = gengetopt_args_info_help[48] ; |
259 |
|
|
260 |
|
} |
261 |
|
|
262 |
|
void |
263 |
|
cmdline_parser_print_version (void) |
264 |
|
{ |
265 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
265 |
> |
printf ("%s %s\n", |
266 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
267 |
> |
CMDLINE_PARSER_VERSION); |
268 |
|
} |
269 |
|
|
270 |
|
static void print_help_common(void) { |
279 |
|
printf("\n"); |
280 |
|
|
281 |
|
if (strlen(gengetopt_args_info_description) > 0) |
282 |
< |
printf("%s\n", gengetopt_args_info_description); |
282 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
283 |
|
} |
284 |
|
|
285 |
|
void |
297 |
|
clear_given (args_info); |
298 |
|
clear_args (args_info); |
299 |
|
init_args_info (args_info); |
300 |
+ |
|
301 |
+ |
args_info->inputs = 0; |
302 |
+ |
args_info->inputs_num = 0; |
303 |
|
} |
304 |
|
|
305 |
|
void |
338 |
|
static void |
339 |
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
340 |
|
{ |
341 |
< |
|
341 |
> |
unsigned int i; |
342 |
|
free_string_field (&(args_info->input_arg)); |
343 |
|
free_string_field (&(args_info->input_orig)); |
344 |
|
free_string_field (&(args_info->output_arg)); |
347 |
|
free_string_field (&(args_info->nbins_orig)); |
348 |
|
free_string_field (&(args_info->nbins_x_orig)); |
349 |
|
free_string_field (&(args_info->nbins_y_orig)); |
350 |
+ |
free_string_field (&(args_info->nbins_z_orig)); |
351 |
|
free_string_field (&(args_info->nanglebins_orig)); |
307 |
– |
free_string_field (&(args_info->length_orig)); |
352 |
|
free_string_field (&(args_info->rcut_orig)); |
353 |
+ |
free_string_field (&(args_info->dz_orig)); |
354 |
+ |
free_string_field (&(args_info->length_orig)); |
355 |
+ |
free_string_field (&(args_info->zlength_orig)); |
356 |
|
free_string_field (&(args_info->zoffset_orig)); |
357 |
|
free_string_field (&(args_info->sele1_arg)); |
358 |
|
free_string_field (&(args_info->sele1_orig)); |
371 |
|
free_string_field (&(args_info->radius_orig)); |
372 |
|
|
373 |
|
|
374 |
+ |
for (i = 0; i < args_info->inputs_num; ++i) |
375 |
+ |
free (args_info->inputs [i]); |
376 |
|
|
377 |
+ |
if (args_info->inputs_num) |
378 |
+ |
free (args_info->inputs); |
379 |
+ |
|
380 |
|
clear_given (args_info); |
381 |
|
} |
382 |
|
|
383 |
|
|
384 |
|
static void |
385 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
385 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
386 |
|
{ |
387 |
+ |
FIX_UNUSED (values); |
388 |
|
if (arg) { |
389 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
390 |
|
} else { |
420 |
|
write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); |
421 |
|
if (args_info->nbins_y_given) |
422 |
|
write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); |
423 |
+ |
if (args_info->nbins_z_given) |
424 |
+ |
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
425 |
|
if (args_info->nanglebins_given) |
426 |
|
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); |
427 |
|
if (args_info->rcut_given) |
428 |
|
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
429 |
+ |
if (args_info->dz_given) |
430 |
+ |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
431 |
+ |
if (args_info->length_given) |
432 |
+ |
write_into_file(outfile, "length", args_info->length_orig, 0); |
433 |
+ |
if (args_info->zlength_given) |
434 |
+ |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
435 |
|
if (args_info->zoffset_given) |
436 |
|
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
437 |
|
if (args_info->sele1_given) |
458 |
|
write_into_file(outfile, "bor", 0, 0 ); |
459 |
|
if (args_info->bad_given) |
460 |
|
write_into_file(outfile, "bad", 0, 0 ); |
461 |
+ |
if (args_info->count_given) |
462 |
+ |
write_into_file(outfile, "count", 0, 0 ); |
463 |
|
if (args_info->gofr_given) |
464 |
|
write_into_file(outfile, "gofr", 0, 0 ); |
465 |
|
if (args_info->gofz_given) |
468 |
|
write_into_file(outfile, "r_theta", 0, 0 ); |
469 |
|
if (args_info->r_omega_given) |
470 |
|
write_into_file(outfile, "r_omega", 0, 0 ); |
471 |
+ |
if (args_info->r_z_given) |
472 |
+ |
write_into_file(outfile, "r_z", 0, 0 ); |
473 |
|
if (args_info->theta_omega_given) |
474 |
|
write_into_file(outfile, "theta_omega", 0, 0 ); |
475 |
|
if (args_info->gxyz_given) |
476 |
|
write_into_file(outfile, "gxyz", 0, 0 ); |
477 |
+ |
if (args_info->twodgofr_given) |
478 |
+ |
write_into_file(outfile, "twodgofr", 0, 0 ); |
479 |
|
if (args_info->p2_given) |
480 |
|
write_into_file(outfile, "p2", 0, 0 ); |
481 |
|
if (args_info->rp2_given) |
486 |
|
write_into_file(outfile, "density", 0, 0 ); |
487 |
|
if (args_info->slab_density_given) |
488 |
|
write_into_file(outfile, "slab_density", 0, 0 ); |
489 |
+ |
if (args_info->p_angle_given) |
490 |
+ |
write_into_file(outfile, "p_angle", 0, 0 ); |
491 |
|
if (args_info->hxy_given) |
492 |
|
write_into_file(outfile, "hxy", 0, 0 ); |
493 |
|
if (args_info->rho_r_given) |
494 |
|
write_into_file(outfile, "rho_r", 0, 0 ); |
495 |
+ |
if (args_info->angle_r_given) |
496 |
+ |
write_into_file(outfile, "angle_r", 0, 0 ); |
497 |
|
if (args_info->hullvol_given) |
498 |
|
write_into_file(outfile, "hullvol", 0, 0 ); |
499 |
+ |
if (args_info->rodlength_given) |
500 |
+ |
write_into_file(outfile, "rodlength", 0, 0 ); |
501 |
+ |
if (args_info->tet_param_given) |
502 |
+ |
write_into_file(outfile, "tet_param", 0, 0 ); |
503 |
|
|
504 |
|
|
505 |
|
i = EXIT_SUCCESS; |
536 |
|
char * |
537 |
|
gengetopt_strdup (const char *s) |
538 |
|
{ |
539 |
< |
char *result = NULL; |
539 |
> |
char *result = 0; |
540 |
|
if (!s) |
541 |
|
return result; |
542 |
|
|
556 |
|
args_info->bo_given = 0 ; |
557 |
|
args_info->bor_given = 0 ; |
558 |
|
args_info->bad_given = 0 ; |
559 |
+ |
args_info->count_given = 0 ; |
560 |
|
args_info->gofr_given = 0 ; |
561 |
|
args_info->gofz_given = 0 ; |
562 |
|
args_info->r_theta_given = 0 ; |
563 |
|
args_info->r_omega_given = 0 ; |
564 |
+ |
args_info->r_z_given = 0 ; |
565 |
|
args_info->theta_omega_given = 0 ; |
566 |
|
args_info->gxyz_given = 0 ; |
567 |
+ |
args_info->twodgofr_given = 0 ; |
568 |
|
args_info->p2_given = 0 ; |
569 |
|
args_info->rp2_given = 0 ; |
570 |
|
args_info->scd_given = 0 ; |
571 |
|
args_info->density_given = 0 ; |
572 |
|
args_info->slab_density_given = 0 ; |
573 |
+ |
args_info->p_angle_given = 0 ; |
574 |
|
args_info->hxy_given = 0 ; |
575 |
|
args_info->rho_r_given = 0 ; |
576 |
+ |
args_info->angle_r_given = 0 ; |
577 |
|
args_info->hullvol_given = 0 ; |
578 |
+ |
args_info->rodlength_given = 0 ; |
579 |
+ |
args_info->tet_param_given = 0 ; |
580 |
|
|
581 |
|
args_info->staticProps_group_counter = 0; |
582 |
|
} |
583 |
|
|
584 |
|
int |
585 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
585 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
586 |
|
{ |
587 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
588 |
|
} |
589 |
|
|
590 |
|
int |
591 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
591 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
592 |
|
struct cmdline_parser_params *params) |
593 |
|
{ |
594 |
|
int result; |
595 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
595 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
596 |
|
|
597 |
|
if (result == EXIT_FAILURE) |
598 |
|
{ |
604 |
|
} |
605 |
|
|
606 |
|
int |
607 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
607 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
608 |
|
{ |
609 |
|
int result; |
610 |
|
struct cmdline_parser_params params; |
615 |
|
params.check_ambiguity = 0; |
616 |
|
params.print_errors = 1; |
617 |
|
|
618 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
618 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
619 |
|
|
620 |
|
if (result == EXIT_FAILURE) |
621 |
|
{ |
631 |
|
{ |
632 |
|
int result = EXIT_SUCCESS; |
633 |
|
|
634 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
634 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
635 |
|
result = EXIT_FAILURE; |
636 |
|
|
637 |
|
if (result == EXIT_FAILURE) |
647 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
648 |
|
{ |
649 |
|
int error = 0; |
650 |
+ |
FIX_UNUSED (additional_error); |
651 |
|
|
652 |
|
/* checks for required options */ |
653 |
|
if (! args_info->input_given) |
658 |
|
|
659 |
|
if (args_info->staticProps_group_counter == 0) |
660 |
|
{ |
661 |
< |
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 : "")); |
661 |
> |
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 : "")); |
662 |
|
error = 1; |
663 |
|
} |
664 |
|
|
692 |
|
static |
693 |
|
int update_arg(void *field, char **orig_field, |
694 |
|
unsigned int *field_given, unsigned int *prev_given, |
695 |
< |
char *value, char *possible_values[], const char *default_value, |
695 |
> |
char *value, const char *possible_values[], |
696 |
> |
const char *default_value, |
697 |
|
cmdline_parser_arg_type arg_type, |
698 |
|
int check_ambiguity, int override, |
699 |
|
int no_free, int multiple_option, |
704 |
|
const char *val = value; |
705 |
|
int found; |
706 |
|
char **string_field; |
707 |
+ |
FIX_UNUSED (field); |
708 |
|
|
709 |
|
stop_char = 0; |
710 |
|
found = 0; |
722 |
|
return 1; /* failure */ |
723 |
|
} |
724 |
|
|
725 |
+ |
FIX_UNUSED (default_value); |
726 |
|
|
727 |
|
if (field_given && *field_given && ! override) |
728 |
|
return 0; |
786 |
|
|
787 |
|
|
788 |
|
int |
789 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
789 |
> |
cmdline_parser_internal ( |
790 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
791 |
|
struct cmdline_parser_params *params, const char *additional_error) |
792 |
|
{ |
793 |
|
int c; /* Character of the parsed option. */ |
830 |
|
{ "nbins", 1, NULL, 'b' }, |
831 |
|
{ "nbins_x", 1, NULL, 'x' }, |
832 |
|
{ "nbins_y", 1, NULL, 'y' }, |
833 |
+ |
{ "nbins_z", 1, NULL, 0 }, |
834 |
|
{ "nanglebins", 1, NULL, 'a' }, |
749 |
– |
{ "length", 1, NULL, 0 }, |
835 |
|
{ "rcut", 1, NULL, 'c' }, |
836 |
+ |
{ "dz", 1, NULL, 0 }, |
837 |
+ |
{ "length", 1, NULL, 0 }, |
838 |
+ |
{ "zlength", 1, NULL, 0 }, |
839 |
|
{ "zoffset", 1, NULL, 'z' }, |
840 |
|
{ "sele1", 1, NULL, 0 }, |
841 |
|
{ "sele2", 1, NULL, 0 }, |
849 |
|
{ "bo", 0, NULL, 0 }, |
850 |
|
{ "bor", 0, NULL, 0 }, |
851 |
|
{ "bad", 0, NULL, 0 }, |
852 |
+ |
{ "count", 0, NULL, 0 }, |
853 |
|
{ "gofr", 0, NULL, 'g' }, |
854 |
|
{ "gofz", 0, NULL, 0 }, |
855 |
|
{ "r_theta", 0, NULL, 0 }, |
856 |
|
{ "r_omega", 0, NULL, 0 }, |
857 |
+ |
{ "r_z", 0, NULL, 0 }, |
858 |
|
{ "theta_omega", 0, NULL, 0 }, |
859 |
|
{ "gxyz", 0, NULL, 0 }, |
860 |
+ |
{ "twodgofr", 0, NULL, 0 }, |
861 |
|
{ "p2", 0, NULL, 'p' }, |
862 |
|
{ "rp2", 0, NULL, 0 }, |
863 |
|
{ "scd", 0, NULL, 's' }, |
864 |
|
{ "density", 0, NULL, 'd' }, |
865 |
|
{ "slab_density", 0, NULL, 0 }, |
866 |
+ |
{ "p_angle", 0, NULL, 0 }, |
867 |
|
{ "hxy", 0, NULL, 0 }, |
868 |
|
{ "rho_r", 0, NULL, 0 }, |
869 |
+ |
{ "angle_r", 0, NULL, 0 }, |
870 |
|
{ "hullvol", 0, NULL, 0 }, |
871 |
< |
{ NULL, 0, NULL, 0 } |
871 |
> |
{ "rodlength", 0, NULL, 0 }, |
872 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
873 |
> |
{ 0, 0, 0, 0 } |
874 |
|
}; |
875 |
|
|
876 |
< |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
876 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
877 |
|
|
878 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
879 |
|
|
1012 |
|
goto failure; |
1013 |
|
|
1014 |
|
break; |
1015 |
< |
case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ |
1015 |
> |
case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ |
1016 |
|
|
1017 |
|
if (args_info->staticProps_group_counter && override) |
1018 |
|
reset_group_staticProps (args_info); |
1057 |
|
goto failure; |
1058 |
|
|
1059 |
|
break; |
1060 |
+ |
case 'Q': /* tetrahedrality order parameter. */ |
1061 |
+ |
|
1062 |
+ |
if (args_info->staticProps_group_counter && override) |
1063 |
+ |
reset_group_staticProps (args_info); |
1064 |
+ |
args_info->staticProps_group_counter += 1; |
1065 |
+ |
|
1066 |
+ |
if (update_arg( 0 , |
1067 |
+ |
0 , &(args_info->tet_param_given), |
1068 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
1069 |
+ |
check_ambiguity, override, 0, 0, |
1070 |
+ |
"tet_param", 'Q', |
1071 |
+ |
additional_error)) |
1072 |
+ |
goto failure; |
1073 |
+ |
|
1074 |
+ |
break; |
1075 |
|
|
1076 |
|
case 0: /* Long option with no short option */ |
1077 |
+ |
/* number of bins in z axis. */ |
1078 |
+ |
if (strcmp (long_options[option_index].name, "nbins_z") == 0) |
1079 |
+ |
{ |
1080 |
+ |
|
1081 |
+ |
|
1082 |
+ |
if (update_arg( (void *)&(args_info->nbins_z_arg), |
1083 |
+ |
&(args_info->nbins_z_orig), &(args_info->nbins_z_given), |
1084 |
+ |
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
1085 |
+ |
check_ambiguity, override, 0, 0, |
1086 |
+ |
"nbins_z", '-', |
1087 |
+ |
additional_error)) |
1088 |
+ |
goto failure; |
1089 |
+ |
|
1090 |
+ |
} |
1091 |
+ |
/* slab width (dz). */ |
1092 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
1093 |
+ |
{ |
1094 |
+ |
|
1095 |
+ |
|
1096 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
1097 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
1098 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
1099 |
+ |
check_ambiguity, override, 0, 0, |
1100 |
+ |
"dz", '-', |
1101 |
+ |
additional_error)) |
1102 |
+ |
goto failure; |
1103 |
+ |
|
1104 |
+ |
} |
1105 |
|
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1106 |
< |
if (strcmp (long_options[option_index].name, "length") == 0) |
1106 |
> |
else if (strcmp (long_options[option_index].name, "length") == 0) |
1107 |
|
{ |
1108 |
|
|
1109 |
|
|
1116 |
|
goto failure; |
1117 |
|
|
1118 |
|
} |
1119 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1120 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1121 |
+ |
{ |
1122 |
+ |
|
1123 |
+ |
|
1124 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1125 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1126 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1127 |
+ |
check_ambiguity, override, 0, 0, |
1128 |
+ |
"zlength", '-', |
1129 |
+ |
additional_error)) |
1130 |
+ |
goto failure; |
1131 |
+ |
|
1132 |
+ |
} |
1133 |
|
/* select the first stuntdouble set. */ |
1134 |
|
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1135 |
|
{ |
1307 |
|
goto failure; |
1308 |
|
|
1309 |
|
} |
1310 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
1311 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
1312 |
+ |
{ |
1313 |
+ |
|
1314 |
+ |
if (args_info->staticProps_group_counter && override) |
1315 |
+ |
reset_group_staticProps (args_info); |
1316 |
+ |
args_info->staticProps_group_counter += 1; |
1317 |
+ |
|
1318 |
+ |
if (update_arg( 0 , |
1319 |
+ |
0 , &(args_info->count_given), |
1320 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
1321 |
+ |
check_ambiguity, override, 0, 0, |
1322 |
+ |
"count", '-', |
1323 |
+ |
additional_error)) |
1324 |
+ |
goto failure; |
1325 |
+ |
|
1326 |
+ |
} |
1327 |
|
/* g(z). */ |
1328 |
|
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
1329 |
|
{ |
1371 |
|
&(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO, |
1372 |
|
check_ambiguity, override, 0, 0, |
1373 |
|
"r_omega", '-', |
1374 |
+ |
additional_error)) |
1375 |
+ |
goto failure; |
1376 |
+ |
|
1377 |
+ |
} |
1378 |
+ |
/* g(r, z). */ |
1379 |
+ |
else if (strcmp (long_options[option_index].name, "r_z") == 0) |
1380 |
+ |
{ |
1381 |
+ |
|
1382 |
+ |
if (args_info->staticProps_group_counter && override) |
1383 |
+ |
reset_group_staticProps (args_info); |
1384 |
+ |
args_info->staticProps_group_counter += 1; |
1385 |
+ |
|
1386 |
+ |
if (update_arg( 0 , |
1387 |
+ |
0 , &(args_info->r_z_given), |
1388 |
+ |
&(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, |
1389 |
+ |
check_ambiguity, override, 0, 0, |
1390 |
+ |
"r_z", '-', |
1391 |
|
additional_error)) |
1392 |
|
goto failure; |
1393 |
|
|
1426 |
|
goto failure; |
1427 |
|
|
1428 |
|
} |
1429 |
+ |
/* 2D g(r) (Slab width --dz must be specified). */ |
1430 |
+ |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
1431 |
+ |
{ |
1432 |
+ |
|
1433 |
+ |
if (args_info->staticProps_group_counter && override) |
1434 |
+ |
reset_group_staticProps (args_info); |
1435 |
+ |
args_info->staticProps_group_counter += 1; |
1436 |
+ |
|
1437 |
+ |
if (update_arg( 0 , |
1438 |
+ |
0 , &(args_info->twodgofr_given), |
1439 |
+ |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
1440 |
+ |
check_ambiguity, override, 0, 0, |
1441 |
+ |
"twodgofr", '-', |
1442 |
+ |
additional_error)) |
1443 |
+ |
goto failure; |
1444 |
+ |
|
1445 |
+ |
} |
1446 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1447 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1448 |
|
{ |
1477 |
|
goto failure; |
1478 |
|
|
1479 |
|
} |
1480 |
+ |
/* p(cos(theta)). */ |
1481 |
+ |
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
1482 |
+ |
{ |
1483 |
+ |
|
1484 |
+ |
if (args_info->staticProps_group_counter && override) |
1485 |
+ |
reset_group_staticProps (args_info); |
1486 |
+ |
args_info->staticProps_group_counter += 1; |
1487 |
+ |
|
1488 |
+ |
if (update_arg( 0 , |
1489 |
+ |
0 , &(args_info->p_angle_given), |
1490 |
+ |
&(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, |
1491 |
+ |
check_ambiguity, override, 0, 0, |
1492 |
+ |
"p_angle", '-', |
1493 |
+ |
additional_error)) |
1494 |
+ |
goto failure; |
1495 |
+ |
|
1496 |
+ |
} |
1497 |
|
/* hxy. */ |
1498 |
|
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1499 |
|
{ |
1528 |
|
goto failure; |
1529 |
|
|
1530 |
|
} |
1531 |
+ |
/* angle of R. */ |
1532 |
+ |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
1533 |
+ |
{ |
1534 |
+ |
|
1535 |
+ |
if (args_info->staticProps_group_counter && override) |
1536 |
+ |
reset_group_staticProps (args_info); |
1537 |
+ |
args_info->staticProps_group_counter += 1; |
1538 |
+ |
|
1539 |
+ |
if (update_arg( 0 , |
1540 |
+ |
0 , &(args_info->angle_r_given), |
1541 |
+ |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
1542 |
+ |
check_ambiguity, override, 0, 0, |
1543 |
+ |
"angle_r", '-', |
1544 |
+ |
additional_error)) |
1545 |
+ |
goto failure; |
1546 |
+ |
|
1547 |
+ |
} |
1548 |
|
/* hull volume of nanoparticle. */ |
1549 |
|
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
1550 |
|
{ |
1562 |
|
goto failure; |
1563 |
|
|
1564 |
|
} |
1565 |
+ |
/* length of nanorod. */ |
1566 |
+ |
else if (strcmp (long_options[option_index].name, "rodlength") == 0) |
1567 |
+ |
{ |
1568 |
|
|
1569 |
+ |
if (args_info->staticProps_group_counter && override) |
1570 |
+ |
reset_group_staticProps (args_info); |
1571 |
+ |
args_info->staticProps_group_counter += 1; |
1572 |
+ |
|
1573 |
+ |
if (update_arg( 0 , |
1574 |
+ |
0 , &(args_info->rodlength_given), |
1575 |
+ |
&(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, |
1576 |
+ |
check_ambiguity, override, 0, 0, |
1577 |
+ |
"rodlength", '-', |
1578 |
+ |
additional_error)) |
1579 |
+ |
goto failure; |
1580 |
+ |
|
1581 |
+ |
} |
1582 |
+ |
|
1583 |
|
break; |
1584 |
|
case '?': /* Invalid option. */ |
1585 |
|
/* `getopt_long' already printed an error message. */ |
1593 |
|
|
1594 |
|
if (args_info->staticProps_group_counter > 1) |
1595 |
|
{ |
1596 |
< |
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 : "")); |
1596 |
> |
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 : "")); |
1597 |
|
error = 1; |
1598 |
|
} |
1599 |
|
|
1609 |
|
if ( error ) |
1610 |
|
return (EXIT_FAILURE); |
1611 |
|
|
1612 |
+ |
if (optind < argc) |
1613 |
+ |
{ |
1614 |
+ |
int i = 0 ; |
1615 |
+ |
int found_prog_name = 0; |
1616 |
+ |
/* whether program name, i.e., argv[0], is in the remaining args |
1617 |
+ |
(this may happen with some implementations of getopt, |
1618 |
+ |
but surely not with the one included by gengetopt) */ |
1619 |
+ |
|
1620 |
+ |
i = optind; |
1621 |
+ |
while (i < argc) |
1622 |
+ |
if (argv[i++] == argv[0]) { |
1623 |
+ |
found_prog_name = 1; |
1624 |
+ |
break; |
1625 |
+ |
} |
1626 |
+ |
i = 0; |
1627 |
+ |
|
1628 |
+ |
args_info->inputs_num = argc - optind - found_prog_name; |
1629 |
+ |
args_info->inputs = |
1630 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1631 |
+ |
while (optind < argc) |
1632 |
+ |
if (argv[optind++] != argv[0]) |
1633 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1634 |
+ |
} |
1635 |
+ |
|
1636 |
|
return 0; |
1637 |
|
|
1638 |
|
failure: |