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 |
+ |
" --twodgofr 2D g(r) (Slab width --dz must be specified)", |
72 |
|
" -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
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 |
+ |
" -Q, --tet_param tetrahedrality order parameter", |
83 |
|
0 |
84 |
|
}; |
85 |
|
|
95 |
|
void clear_args (struct gengetopt_args_info *args_info); |
96 |
|
|
97 |
|
static int |
98 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
98 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
99 |
|
struct cmdline_parser_params *params, const char *additional_error); |
100 |
|
|
101 |
|
static int |
115 |
|
args_info->nbins_given = 0 ; |
116 |
|
args_info->nbins_x_given = 0 ; |
117 |
|
args_info->nbins_y_given = 0 ; |
118 |
+ |
args_info->nbins_z_given = 0 ; |
119 |
|
args_info->nanglebins_given = 0 ; |
106 |
– |
args_info->length_given = 0 ; |
120 |
|
args_info->rcut_given = 0 ; |
121 |
+ |
args_info->dz_given = 0 ; |
122 |
+ |
args_info->length_given = 0 ; |
123 |
+ |
args_info->zlength_given = 0 ; |
124 |
|
args_info->zoffset_given = 0 ; |
125 |
|
args_info->sele1_given = 0 ; |
126 |
|
args_info->sele2_given = 0 ; |
134 |
|
args_info->bo_given = 0 ; |
135 |
|
args_info->bor_given = 0 ; |
136 |
|
args_info->bad_given = 0 ; |
137 |
+ |
args_info->count_given = 0 ; |
138 |
|
args_info->gofr_given = 0 ; |
139 |
|
args_info->gofz_given = 0 ; |
140 |
|
args_info->r_theta_given = 0 ; |
141 |
|
args_info->r_omega_given = 0 ; |
142 |
+ |
args_info->r_z_given = 0 ; |
143 |
|
args_info->theta_omega_given = 0 ; |
144 |
|
args_info->gxyz_given = 0 ; |
145 |
+ |
args_info->twodgofr_given = 0 ; |
146 |
|
args_info->p2_given = 0 ; |
147 |
|
args_info->rp2_given = 0 ; |
148 |
|
args_info->scd_given = 0 ; |
149 |
|
args_info->density_given = 0 ; |
150 |
|
args_info->slab_density_given = 0 ; |
151 |
+ |
args_info->p_angle_given = 0 ; |
152 |
|
args_info->hxy_given = 0 ; |
153 |
|
args_info->rho_r_given = 0 ; |
154 |
+ |
args_info->angle_r_given = 0 ; |
155 |
|
args_info->hullvol_given = 0 ; |
156 |
+ |
args_info->tet_param_given = 0 ; |
157 |
|
args_info->staticProps_group_counter = 0 ; |
158 |
|
} |
159 |
|
|
160 |
|
static |
161 |
|
void clear_args (struct gengetopt_args_info *args_info) |
162 |
|
{ |
163 |
+ |
FIX_UNUSED (args_info); |
164 |
|
args_info->input_arg = NULL; |
165 |
|
args_info->input_orig = NULL; |
166 |
|
args_info->output_arg = NULL; |
173 |
|
args_info->nbins_x_orig = NULL; |
174 |
|
args_info->nbins_y_arg = 100; |
175 |
|
args_info->nbins_y_orig = NULL; |
176 |
+ |
args_info->nbins_z_arg = 100; |
177 |
+ |
args_info->nbins_z_orig = NULL; |
178 |
|
args_info->nanglebins_arg = 50; |
179 |
|
args_info->nanglebins_orig = NULL; |
155 |
– |
args_info->length_orig = NULL; |
180 |
|
args_info->rcut_orig = NULL; |
181 |
+ |
args_info->dz_orig = NULL; |
182 |
+ |
args_info->length_orig = NULL; |
183 |
+ |
args_info->zlength_orig = NULL; |
184 |
|
args_info->zoffset_arg = 0; |
185 |
|
args_info->zoffset_orig = NULL; |
186 |
|
args_info->sele1_arg = NULL; |
214 |
|
args_info->nbins_help = gengetopt_args_info_help[5] ; |
215 |
|
args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
216 |
|
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
217 |
< |
args_info->nanglebins_help = gengetopt_args_info_help[8] ; |
218 |
< |
args_info->length_help = gengetopt_args_info_help[9] ; |
217 |
> |
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
218 |
> |
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
219 |
|
args_info->rcut_help = gengetopt_args_info_help[10] ; |
220 |
< |
args_info->zoffset_help = gengetopt_args_info_help[11] ; |
221 |
< |
args_info->sele1_help = gengetopt_args_info_help[12] ; |
222 |
< |
args_info->sele2_help = gengetopt_args_info_help[13] ; |
223 |
< |
args_info->sele3_help = gengetopt_args_info_help[14] ; |
224 |
< |
args_info->refsele_help = gengetopt_args_info_help[15] ; |
225 |
< |
args_info->comsele_help = gengetopt_args_info_help[16] ; |
226 |
< |
args_info->molname_help = gengetopt_args_info_help[17] ; |
227 |
< |
args_info->begin_help = gengetopt_args_info_help[18] ; |
228 |
< |
args_info->end_help = gengetopt_args_info_help[19] ; |
229 |
< |
args_info->radius_help = gengetopt_args_info_help[20] ; |
230 |
< |
args_info->bo_help = gengetopt_args_info_help[22] ; |
231 |
< |
args_info->bor_help = gengetopt_args_info_help[23] ; |
232 |
< |
args_info->bad_help = gengetopt_args_info_help[24] ; |
233 |
< |
args_info->gofr_help = gengetopt_args_info_help[25] ; |
234 |
< |
args_info->gofz_help = gengetopt_args_info_help[26] ; |
235 |
< |
args_info->r_theta_help = gengetopt_args_info_help[27] ; |
236 |
< |
args_info->r_omega_help = gengetopt_args_info_help[28] ; |
237 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[29] ; |
238 |
< |
args_info->gxyz_help = gengetopt_args_info_help[30] ; |
239 |
< |
args_info->p2_help = gengetopt_args_info_help[31] ; |
240 |
< |
args_info->rp2_help = gengetopt_args_info_help[32] ; |
241 |
< |
args_info->scd_help = gengetopt_args_info_help[33] ; |
242 |
< |
args_info->density_help = gengetopt_args_info_help[34] ; |
243 |
< |
args_info->slab_density_help = gengetopt_args_info_help[35] ; |
244 |
< |
args_info->hxy_help = gengetopt_args_info_help[36] ; |
245 |
< |
args_info->rho_r_help = gengetopt_args_info_help[37] ; |
246 |
< |
args_info->hullvol_help = gengetopt_args_info_help[38] ; |
220 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
221 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
222 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
223 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
224 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
225 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
226 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
227 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
228 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
229 |
> |
args_info->molname_help = gengetopt_args_info_help[20] ; |
230 |
> |
args_info->begin_help = gengetopt_args_info_help[21] ; |
231 |
> |
args_info->end_help = gengetopt_args_info_help[22] ; |
232 |
> |
args_info->radius_help = gengetopt_args_info_help[23] ; |
233 |
> |
args_info->bo_help = gengetopt_args_info_help[25] ; |
234 |
> |
args_info->bor_help = gengetopt_args_info_help[26] ; |
235 |
> |
args_info->bad_help = gengetopt_args_info_help[27] ; |
236 |
> |
args_info->count_help = gengetopt_args_info_help[28] ; |
237 |
> |
args_info->gofr_help = gengetopt_args_info_help[29] ; |
238 |
> |
args_info->gofz_help = gengetopt_args_info_help[30] ; |
239 |
> |
args_info->r_theta_help = gengetopt_args_info_help[31] ; |
240 |
> |
args_info->r_omega_help = gengetopt_args_info_help[32] ; |
241 |
> |
args_info->r_z_help = gengetopt_args_info_help[33] ; |
242 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[34] ; |
243 |
> |
args_info->gxyz_help = gengetopt_args_info_help[35] ; |
244 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[36] ; |
245 |
> |
args_info->p2_help = gengetopt_args_info_help[37] ; |
246 |
> |
args_info->rp2_help = gengetopt_args_info_help[38] ; |
247 |
> |
args_info->scd_help = gengetopt_args_info_help[39] ; |
248 |
> |
args_info->density_help = gengetopt_args_info_help[40] ; |
249 |
> |
args_info->slab_density_help = gengetopt_args_info_help[41] ; |
250 |
> |
args_info->p_angle_help = gengetopt_args_info_help[42] ; |
251 |
> |
args_info->hxy_help = gengetopt_args_info_help[43] ; |
252 |
> |
args_info->rho_r_help = gengetopt_args_info_help[44] ; |
253 |
> |
args_info->angle_r_help = gengetopt_args_info_help[45] ; |
254 |
> |
args_info->hullvol_help = gengetopt_args_info_help[46] ; |
255 |
> |
args_info->tet_param_help = gengetopt_args_info_help[47] ; |
256 |
|
|
257 |
|
} |
258 |
|
|
259 |
|
void |
260 |
|
cmdline_parser_print_version (void) |
261 |
|
{ |
262 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
262 |
> |
printf ("%s %s\n", |
263 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
264 |
> |
CMDLINE_PARSER_VERSION); |
265 |
|
} |
266 |
|
|
267 |
|
static void print_help_common(void) { |
276 |
|
printf("\n"); |
277 |
|
|
278 |
|
if (strlen(gengetopt_args_info_description) > 0) |
279 |
< |
printf("%s\n", gengetopt_args_info_description); |
279 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
280 |
|
} |
281 |
|
|
282 |
|
void |
294 |
|
clear_given (args_info); |
295 |
|
clear_args (args_info); |
296 |
|
init_args_info (args_info); |
297 |
+ |
|
298 |
+ |
args_info->inputs = 0; |
299 |
+ |
args_info->inputs_num = 0; |
300 |
|
} |
301 |
|
|
302 |
|
void |
335 |
|
static void |
336 |
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
337 |
|
{ |
338 |
< |
|
338 |
> |
unsigned int i; |
339 |
|
free_string_field (&(args_info->input_arg)); |
340 |
|
free_string_field (&(args_info->input_orig)); |
341 |
|
free_string_field (&(args_info->output_arg)); |
344 |
|
free_string_field (&(args_info->nbins_orig)); |
345 |
|
free_string_field (&(args_info->nbins_x_orig)); |
346 |
|
free_string_field (&(args_info->nbins_y_orig)); |
347 |
+ |
free_string_field (&(args_info->nbins_z_orig)); |
348 |
|
free_string_field (&(args_info->nanglebins_orig)); |
307 |
– |
free_string_field (&(args_info->length_orig)); |
349 |
|
free_string_field (&(args_info->rcut_orig)); |
350 |
+ |
free_string_field (&(args_info->dz_orig)); |
351 |
+ |
free_string_field (&(args_info->length_orig)); |
352 |
+ |
free_string_field (&(args_info->zlength_orig)); |
353 |
|
free_string_field (&(args_info->zoffset_orig)); |
354 |
|
free_string_field (&(args_info->sele1_arg)); |
355 |
|
free_string_field (&(args_info->sele1_orig)); |
368 |
|
free_string_field (&(args_info->radius_orig)); |
369 |
|
|
370 |
|
|
371 |
+ |
for (i = 0; i < args_info->inputs_num; ++i) |
372 |
+ |
free (args_info->inputs [i]); |
373 |
|
|
374 |
+ |
if (args_info->inputs_num) |
375 |
+ |
free (args_info->inputs); |
376 |
+ |
|
377 |
|
clear_given (args_info); |
378 |
|
} |
379 |
|
|
380 |
|
|
381 |
|
static void |
382 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
382 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
383 |
|
{ |
384 |
+ |
FIX_UNUSED (values); |
385 |
|
if (arg) { |
386 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
387 |
|
} else { |
417 |
|
write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); |
418 |
|
if (args_info->nbins_y_given) |
419 |
|
write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); |
420 |
+ |
if (args_info->nbins_z_given) |
421 |
+ |
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
422 |
|
if (args_info->nanglebins_given) |
423 |
|
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); |
424 |
|
if (args_info->rcut_given) |
425 |
|
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
426 |
+ |
if (args_info->dz_given) |
427 |
+ |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
428 |
+ |
if (args_info->length_given) |
429 |
+ |
write_into_file(outfile, "length", args_info->length_orig, 0); |
430 |
+ |
if (args_info->zlength_given) |
431 |
+ |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
432 |
|
if (args_info->zoffset_given) |
433 |
|
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
434 |
|
if (args_info->sele1_given) |
455 |
|
write_into_file(outfile, "bor", 0, 0 ); |
456 |
|
if (args_info->bad_given) |
457 |
|
write_into_file(outfile, "bad", 0, 0 ); |
458 |
+ |
if (args_info->count_given) |
459 |
+ |
write_into_file(outfile, "count", 0, 0 ); |
460 |
|
if (args_info->gofr_given) |
461 |
|
write_into_file(outfile, "gofr", 0, 0 ); |
462 |
|
if (args_info->gofz_given) |
465 |
|
write_into_file(outfile, "r_theta", 0, 0 ); |
466 |
|
if (args_info->r_omega_given) |
467 |
|
write_into_file(outfile, "r_omega", 0, 0 ); |
468 |
+ |
if (args_info->r_z_given) |
469 |
+ |
write_into_file(outfile, "r_z", 0, 0 ); |
470 |
|
if (args_info->theta_omega_given) |
471 |
|
write_into_file(outfile, "theta_omega", 0, 0 ); |
472 |
|
if (args_info->gxyz_given) |
473 |
|
write_into_file(outfile, "gxyz", 0, 0 ); |
474 |
+ |
if (args_info->twodgofr_given) |
475 |
+ |
write_into_file(outfile, "twodgofr", 0, 0 ); |
476 |
|
if (args_info->p2_given) |
477 |
|
write_into_file(outfile, "p2", 0, 0 ); |
478 |
|
if (args_info->rp2_given) |
483 |
|
write_into_file(outfile, "density", 0, 0 ); |
484 |
|
if (args_info->slab_density_given) |
485 |
|
write_into_file(outfile, "slab_density", 0, 0 ); |
486 |
+ |
if (args_info->p_angle_given) |
487 |
+ |
write_into_file(outfile, "p_angle", 0, 0 ); |
488 |
|
if (args_info->hxy_given) |
489 |
|
write_into_file(outfile, "hxy", 0, 0 ); |
490 |
|
if (args_info->rho_r_given) |
491 |
|
write_into_file(outfile, "rho_r", 0, 0 ); |
492 |
+ |
if (args_info->angle_r_given) |
493 |
+ |
write_into_file(outfile, "angle_r", 0, 0 ); |
494 |
|
if (args_info->hullvol_given) |
495 |
|
write_into_file(outfile, "hullvol", 0, 0 ); |
496 |
+ |
if (args_info->tet_param_given) |
497 |
+ |
write_into_file(outfile, "tet_param", 0, 0 ); |
498 |
|
|
499 |
|
|
500 |
|
i = EXIT_SUCCESS; |
531 |
|
char * |
532 |
|
gengetopt_strdup (const char *s) |
533 |
|
{ |
534 |
< |
char *result = NULL; |
534 |
> |
char *result = 0; |
535 |
|
if (!s) |
536 |
|
return result; |
537 |
|
|
551 |
|
args_info->bo_given = 0 ; |
552 |
|
args_info->bor_given = 0 ; |
553 |
|
args_info->bad_given = 0 ; |
554 |
+ |
args_info->count_given = 0 ; |
555 |
|
args_info->gofr_given = 0 ; |
556 |
|
args_info->gofz_given = 0 ; |
557 |
|
args_info->r_theta_given = 0 ; |
558 |
|
args_info->r_omega_given = 0 ; |
559 |
+ |
args_info->r_z_given = 0 ; |
560 |
|
args_info->theta_omega_given = 0 ; |
561 |
|
args_info->gxyz_given = 0 ; |
562 |
+ |
args_info->twodgofr_given = 0 ; |
563 |
|
args_info->p2_given = 0 ; |
564 |
|
args_info->rp2_given = 0 ; |
565 |
|
args_info->scd_given = 0 ; |
566 |
|
args_info->density_given = 0 ; |
567 |
|
args_info->slab_density_given = 0 ; |
568 |
+ |
args_info->p_angle_given = 0 ; |
569 |
|
args_info->hxy_given = 0 ; |
570 |
|
args_info->rho_r_given = 0 ; |
571 |
+ |
args_info->angle_r_given = 0 ; |
572 |
|
args_info->hullvol_given = 0 ; |
573 |
+ |
args_info->tet_param_given = 0 ; |
574 |
|
|
575 |
|
args_info->staticProps_group_counter = 0; |
576 |
|
} |
577 |
|
|
578 |
|
int |
579 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
579 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
580 |
|
{ |
581 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
582 |
|
} |
583 |
|
|
584 |
|
int |
585 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
585 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
586 |
|
struct cmdline_parser_params *params) |
587 |
|
{ |
588 |
|
int result; |
589 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
589 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
590 |
|
|
591 |
|
if (result == EXIT_FAILURE) |
592 |
|
{ |
598 |
|
} |
599 |
|
|
600 |
|
int |
601 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
601 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
602 |
|
{ |
603 |
|
int result; |
604 |
|
struct cmdline_parser_params params; |
609 |
|
params.check_ambiguity = 0; |
610 |
|
params.print_errors = 1; |
611 |
|
|
612 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
612 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
613 |
|
|
614 |
|
if (result == EXIT_FAILURE) |
615 |
|
{ |
625 |
|
{ |
626 |
|
int result = EXIT_SUCCESS; |
627 |
|
|
628 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
628 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
629 |
|
result = EXIT_FAILURE; |
630 |
|
|
631 |
|
if (result == EXIT_FAILURE) |
641 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
642 |
|
{ |
643 |
|
int error = 0; |
644 |
+ |
FIX_UNUSED (additional_error); |
645 |
|
|
646 |
|
/* checks for required options */ |
647 |
|
if (! args_info->input_given) |
652 |
|
|
653 |
|
if (args_info->staticProps_group_counter == 0) |
654 |
|
{ |
655 |
< |
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 : "")); |
655 |
> |
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 : "")); |
656 |
|
error = 1; |
657 |
|
} |
658 |
|
|
686 |
|
static |
687 |
|
int update_arg(void *field, char **orig_field, |
688 |
|
unsigned int *field_given, unsigned int *prev_given, |
689 |
< |
char *value, char *possible_values[], const char *default_value, |
689 |
> |
char *value, const char *possible_values[], |
690 |
> |
const char *default_value, |
691 |
|
cmdline_parser_arg_type arg_type, |
692 |
|
int check_ambiguity, int override, |
693 |
|
int no_free, int multiple_option, |
698 |
|
const char *val = value; |
699 |
|
int found; |
700 |
|
char **string_field; |
701 |
+ |
FIX_UNUSED (field); |
702 |
|
|
703 |
|
stop_char = 0; |
704 |
|
found = 0; |
716 |
|
return 1; /* failure */ |
717 |
|
} |
718 |
|
|
719 |
+ |
FIX_UNUSED (default_value); |
720 |
|
|
721 |
|
if (field_given && *field_given && ! override) |
722 |
|
return 0; |
780 |
|
|
781 |
|
|
782 |
|
int |
783 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
783 |
> |
cmdline_parser_internal ( |
784 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
785 |
|
struct cmdline_parser_params *params, const char *additional_error) |
786 |
|
{ |
787 |
|
int c; /* Character of the parsed option. */ |
824 |
|
{ "nbins", 1, NULL, 'b' }, |
825 |
|
{ "nbins_x", 1, NULL, 'x' }, |
826 |
|
{ "nbins_y", 1, NULL, 'y' }, |
827 |
+ |
{ "nbins_z", 1, NULL, 0 }, |
828 |
|
{ "nanglebins", 1, NULL, 'a' }, |
749 |
– |
{ "length", 1, NULL, 0 }, |
829 |
|
{ "rcut", 1, NULL, 'c' }, |
830 |
+ |
{ "dz", 1, NULL, 0 }, |
831 |
+ |
{ "length", 1, NULL, 0 }, |
832 |
+ |
{ "zlength", 1, NULL, 0 }, |
833 |
|
{ "zoffset", 1, NULL, 'z' }, |
834 |
|
{ "sele1", 1, NULL, 0 }, |
835 |
|
{ "sele2", 1, NULL, 0 }, |
843 |
|
{ "bo", 0, NULL, 0 }, |
844 |
|
{ "bor", 0, NULL, 0 }, |
845 |
|
{ "bad", 0, NULL, 0 }, |
846 |
+ |
{ "count", 0, NULL, 0 }, |
847 |
|
{ "gofr", 0, NULL, 'g' }, |
848 |
|
{ "gofz", 0, NULL, 0 }, |
849 |
|
{ "r_theta", 0, NULL, 0 }, |
850 |
|
{ "r_omega", 0, NULL, 0 }, |
851 |
+ |
{ "r_z", 0, NULL, 0 }, |
852 |
|
{ "theta_omega", 0, NULL, 0 }, |
853 |
|
{ "gxyz", 0, NULL, 0 }, |
854 |
+ |
{ "twodgofr", 0, NULL, 0 }, |
855 |
|
{ "p2", 0, NULL, 'p' }, |
856 |
|
{ "rp2", 0, NULL, 0 }, |
857 |
|
{ "scd", 0, NULL, 's' }, |
858 |
|
{ "density", 0, NULL, 'd' }, |
859 |
|
{ "slab_density", 0, NULL, 0 }, |
860 |
+ |
{ "p_angle", 0, NULL, 0 }, |
861 |
|
{ "hxy", 0, NULL, 0 }, |
862 |
|
{ "rho_r", 0, NULL, 0 }, |
863 |
+ |
{ "angle_r", 0, NULL, 0 }, |
864 |
|
{ "hullvol", 0, NULL, 0 }, |
865 |
< |
{ NULL, 0, NULL, 0 } |
865 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
866 |
> |
{ 0, 0, 0, 0 } |
867 |
|
}; |
868 |
|
|
869 |
< |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
869 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
870 |
|
|
871 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
872 |
|
|
1046 |
|
&(local_args_info.density_given), optarg, 0, 0, ARG_NO, |
1047 |
|
check_ambiguity, override, 0, 0, |
1048 |
|
"density", 'd', |
1049 |
+ |
additional_error)) |
1050 |
+ |
goto failure; |
1051 |
+ |
|
1052 |
+ |
break; |
1053 |
+ |
case 'Q': /* tetrahedrality order parameter. */ |
1054 |
+ |
|
1055 |
+ |
if (args_info->staticProps_group_counter && override) |
1056 |
+ |
reset_group_staticProps (args_info); |
1057 |
+ |
args_info->staticProps_group_counter += 1; |
1058 |
+ |
|
1059 |
+ |
if (update_arg( 0 , |
1060 |
+ |
0 , &(args_info->tet_param_given), |
1061 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
1062 |
+ |
check_ambiguity, override, 0, 0, |
1063 |
+ |
"tet_param", 'Q', |
1064 |
|
additional_error)) |
1065 |
|
goto failure; |
1066 |
|
|
1067 |
|
break; |
1068 |
|
|
1069 |
|
case 0: /* Long option with no short option */ |
1070 |
+ |
/* number of bins in z axis. */ |
1071 |
+ |
if (strcmp (long_options[option_index].name, "nbins_z") == 0) |
1072 |
+ |
{ |
1073 |
+ |
|
1074 |
+ |
|
1075 |
+ |
if (update_arg( (void *)&(args_info->nbins_z_arg), |
1076 |
+ |
&(args_info->nbins_z_orig), &(args_info->nbins_z_given), |
1077 |
+ |
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
1078 |
+ |
check_ambiguity, override, 0, 0, |
1079 |
+ |
"nbins_z", '-', |
1080 |
+ |
additional_error)) |
1081 |
+ |
goto failure; |
1082 |
+ |
|
1083 |
+ |
} |
1084 |
+ |
/* slab width (dz). */ |
1085 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
1086 |
+ |
{ |
1087 |
+ |
|
1088 |
+ |
|
1089 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
1090 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
1091 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
1092 |
+ |
check_ambiguity, override, 0, 0, |
1093 |
+ |
"dz", '-', |
1094 |
+ |
additional_error)) |
1095 |
+ |
goto failure; |
1096 |
+ |
|
1097 |
+ |
} |
1098 |
|
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1099 |
< |
if (strcmp (long_options[option_index].name, "length") == 0) |
1099 |
> |
else if (strcmp (long_options[option_index].name, "length") == 0) |
1100 |
|
{ |
1101 |
|
|
1102 |
|
|
1109 |
|
goto failure; |
1110 |
|
|
1111 |
|
} |
1112 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1113 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1114 |
+ |
{ |
1115 |
+ |
|
1116 |
+ |
|
1117 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1118 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1119 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1120 |
+ |
check_ambiguity, override, 0, 0, |
1121 |
+ |
"zlength", '-', |
1122 |
+ |
additional_error)) |
1123 |
+ |
goto failure; |
1124 |
+ |
|
1125 |
+ |
} |
1126 |
|
/* select the first stuntdouble set. */ |
1127 |
|
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1128 |
|
{ |
1300 |
|
goto failure; |
1301 |
|
|
1302 |
|
} |
1303 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
1304 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
1305 |
+ |
{ |
1306 |
+ |
|
1307 |
+ |
if (args_info->staticProps_group_counter && override) |
1308 |
+ |
reset_group_staticProps (args_info); |
1309 |
+ |
args_info->staticProps_group_counter += 1; |
1310 |
+ |
|
1311 |
+ |
if (update_arg( 0 , |
1312 |
+ |
0 , &(args_info->count_given), |
1313 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
1314 |
+ |
check_ambiguity, override, 0, 0, |
1315 |
+ |
"count", '-', |
1316 |
+ |
additional_error)) |
1317 |
+ |
goto failure; |
1318 |
+ |
|
1319 |
+ |
} |
1320 |
|
/* g(z). */ |
1321 |
|
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
1322 |
|
{ |
1368 |
|
goto failure; |
1369 |
|
|
1370 |
|
} |
1371 |
+ |
/* g(r, z). */ |
1372 |
+ |
else if (strcmp (long_options[option_index].name, "r_z") == 0) |
1373 |
+ |
{ |
1374 |
+ |
|
1375 |
+ |
if (args_info->staticProps_group_counter && override) |
1376 |
+ |
reset_group_staticProps (args_info); |
1377 |
+ |
args_info->staticProps_group_counter += 1; |
1378 |
+ |
|
1379 |
+ |
if (update_arg( 0 , |
1380 |
+ |
0 , &(args_info->r_z_given), |
1381 |
+ |
&(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, |
1382 |
+ |
check_ambiguity, override, 0, 0, |
1383 |
+ |
"r_z", '-', |
1384 |
+ |
additional_error)) |
1385 |
+ |
goto failure; |
1386 |
+ |
|
1387 |
+ |
} |
1388 |
|
/* g(cos(theta), cos(omega)). */ |
1389 |
|
else if (strcmp (long_options[option_index].name, "theta_omega") == 0) |
1390 |
|
{ |
1419 |
|
goto failure; |
1420 |
|
|
1421 |
|
} |
1422 |
+ |
/* 2D g(r) (Slab width --dz must be specified). */ |
1423 |
+ |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
1424 |
+ |
{ |
1425 |
+ |
|
1426 |
+ |
if (args_info->staticProps_group_counter && override) |
1427 |
+ |
reset_group_staticProps (args_info); |
1428 |
+ |
args_info->staticProps_group_counter += 1; |
1429 |
+ |
|
1430 |
+ |
if (update_arg( 0 , |
1431 |
+ |
0 , &(args_info->twodgofr_given), |
1432 |
+ |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
1433 |
+ |
check_ambiguity, override, 0, 0, |
1434 |
+ |
"twodgofr", '-', |
1435 |
+ |
additional_error)) |
1436 |
+ |
goto failure; |
1437 |
+ |
|
1438 |
+ |
} |
1439 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1440 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1441 |
|
{ |
1470 |
|
goto failure; |
1471 |
|
|
1472 |
|
} |
1473 |
+ |
/* p(cos(theta)). */ |
1474 |
+ |
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
1475 |
+ |
{ |
1476 |
+ |
|
1477 |
+ |
if (args_info->staticProps_group_counter && override) |
1478 |
+ |
reset_group_staticProps (args_info); |
1479 |
+ |
args_info->staticProps_group_counter += 1; |
1480 |
+ |
|
1481 |
+ |
if (update_arg( 0 , |
1482 |
+ |
0 , &(args_info->p_angle_given), |
1483 |
+ |
&(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, |
1484 |
+ |
check_ambiguity, override, 0, 0, |
1485 |
+ |
"p_angle", '-', |
1486 |
+ |
additional_error)) |
1487 |
+ |
goto failure; |
1488 |
+ |
|
1489 |
+ |
} |
1490 |
|
/* hxy. */ |
1491 |
|
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1492 |
|
{ |
1521 |
|
goto failure; |
1522 |
|
|
1523 |
|
} |
1524 |
+ |
/* angle of R. */ |
1525 |
+ |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
1526 |
+ |
{ |
1527 |
+ |
|
1528 |
+ |
if (args_info->staticProps_group_counter && override) |
1529 |
+ |
reset_group_staticProps (args_info); |
1530 |
+ |
args_info->staticProps_group_counter += 1; |
1531 |
+ |
|
1532 |
+ |
if (update_arg( 0 , |
1533 |
+ |
0 , &(args_info->angle_r_given), |
1534 |
+ |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
1535 |
+ |
check_ambiguity, override, 0, 0, |
1536 |
+ |
"angle_r", '-', |
1537 |
+ |
additional_error)) |
1538 |
+ |
goto failure; |
1539 |
+ |
|
1540 |
+ |
} |
1541 |
|
/* hull volume of nanoparticle. */ |
1542 |
|
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
1543 |
|
{ |
1569 |
|
|
1570 |
|
if (args_info->staticProps_group_counter > 1) |
1571 |
|
{ |
1572 |
< |
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 : "")); |
1572 |
> |
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 : "")); |
1573 |
|
error = 1; |
1574 |
|
} |
1575 |
|
|
1585 |
|
if ( error ) |
1586 |
|
return (EXIT_FAILURE); |
1587 |
|
|
1588 |
+ |
if (optind < argc) |
1589 |
+ |
{ |
1590 |
+ |
int i = 0 ; |
1591 |
+ |
int found_prog_name = 0; |
1592 |
+ |
/* whether program name, i.e., argv[0], is in the remaining args |
1593 |
+ |
(this may happen with some implementations of getopt, |
1594 |
+ |
but surely not with the one included by gengetopt) */ |
1595 |
+ |
|
1596 |
+ |
i = optind; |
1597 |
+ |
while (i < argc) |
1598 |
+ |
if (argv[i++] == argv[0]) { |
1599 |
+ |
found_prog_name = 1; |
1600 |
+ |
break; |
1601 |
+ |
} |
1602 |
+ |
i = 0; |
1603 |
+ |
|
1604 |
+ |
args_info->inputs_num = argc - optind - found_prog_name; |
1605 |
+ |
args_info->inputs = |
1606 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1607 |
+ |
while (optind < argc) |
1608 |
+ |
if (argv[optind++] != argv[0]) |
1609 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1610 |
+ |
} |
1611 |
+ |
|
1612 |
|
return 0; |
1613 |
|
|
1614 |
|
failure: |