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 -u |
4 |
> |
gengetopt --file-name=StaticPropsCmd --unamed-opts |
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 |
+ |
#ifdef WIN32 |
25 |
+ |
#include "utils/wingetopt.h" |
26 |
+ |
#else |
27 |
+ |
#include <getopt.h> |
28 |
+ |
#endif |
29 |
+ |
|
30 |
|
#include "StaticPropsCmd.h" |
31 |
|
|
32 |
|
const char *gengetopt_args_info_purpose = ""; |
46 |
|
" -y, --nbins_y=INT number of bins in y axis (default=`100')", |
47 |
|
" --nbins_z=INT number of bins in z axis (default=`100')", |
48 |
|
" -a, --nanglebins=INT number of bins for cos(angle) (default=`50')", |
41 |
– |
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
49 |
|
" -c, --rcut=DOUBLE cutoff radius (rcut)", |
50 |
+ |
" --dz=DOUBLE slab width (dz)", |
51 |
+ |
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
52 |
+ |
" --zlength=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
53 |
|
" -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", |
54 |
|
" --sele1=selection script select the first stuntdouble set", |
55 |
|
" --sele2=selection script select the second stuntdouble set", |
56 |
|
" --sele3=selection script select the third stuntdouble set", |
57 |
|
" --refsele=selection script\n select reference (use and only use with --gxyz)", |
58 |
|
" --comsele=selection script\n select stunt doubles for center-of-mass \n reference point", |
59 |
+ |
" --seleoffset=INT global index offset for a second object (used \n to define a vector between sites in molecule)", |
60 |
|
" --molname=STRING molecule name", |
61 |
|
" --begin=INT begin internal index", |
62 |
|
" --end=INT end internal index", |
65 |
|
" --bo bond order parameter (--rcut must be specified)", |
66 |
|
" --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
67 |
|
" --bad N(theta) bond angle density within (--rcut must \n be specified)", |
68 |
+ |
" --count count of molecules matching selection criteria \n (and associated statistics)", |
69 |
|
" -g, --gofr g(r)", |
70 |
|
" --gofz g(z)", |
71 |
|
" --r_theta g(r, cos(theta))", |
73 |
|
" --r_z g(r, z)", |
74 |
|
" --theta_omega g(cos(theta), cos(omega))", |
75 |
|
" --gxyz g(x, y, z)", |
76 |
< |
" -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
76 |
> |
" --twodgofr 2D g(r) (Slab width --dz must be specified)", |
77 |
> |
" -p, --p2 p2 order parameter (--sele1 must be specified, \n --sele2 is optional)", |
78 |
|
" --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", |
79 |
|
" -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
80 |
|
" -d, --density density plot", |
82 |
|
" --p_angle p(cos(theta))", |
83 |
|
" --hxy hxy", |
84 |
|
" --rho_r rho of R", |
85 |
+ |
" --angle_r angle of R", |
86 |
|
" --hullvol hull volume of nanoparticle", |
87 |
+ |
" --rodlength length of nanorod", |
88 |
+ |
" -Q, --tet_param tetrahedrality order parameter", |
89 |
+ |
" --tet_param_z tetrahedrality order parameter by zbin(--sele1 \n must be specified)", |
90 |
|
0 |
91 |
|
}; |
92 |
|
|
102 |
|
void clear_args (struct gengetopt_args_info *args_info); |
103 |
|
|
104 |
|
static int |
105 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
105 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
106 |
|
struct cmdline_parser_params *params, const char *additional_error); |
107 |
|
|
108 |
|
static int |
124 |
|
args_info->nbins_y_given = 0 ; |
125 |
|
args_info->nbins_z_given = 0 ; |
126 |
|
args_info->nanglebins_given = 0 ; |
110 |
– |
args_info->length_given = 0 ; |
127 |
|
args_info->rcut_given = 0 ; |
128 |
+ |
args_info->dz_given = 0 ; |
129 |
+ |
args_info->length_given = 0 ; |
130 |
+ |
args_info->zlength_given = 0 ; |
131 |
|
args_info->zoffset_given = 0 ; |
132 |
|
args_info->sele1_given = 0 ; |
133 |
|
args_info->sele2_given = 0 ; |
134 |
|
args_info->sele3_given = 0 ; |
135 |
|
args_info->refsele_given = 0 ; |
136 |
|
args_info->comsele_given = 0 ; |
137 |
+ |
args_info->seleoffset_given = 0 ; |
138 |
|
args_info->molname_given = 0 ; |
139 |
|
args_info->begin_given = 0 ; |
140 |
|
args_info->end_given = 0 ; |
142 |
|
args_info->bo_given = 0 ; |
143 |
|
args_info->bor_given = 0 ; |
144 |
|
args_info->bad_given = 0 ; |
145 |
+ |
args_info->count_given = 0 ; |
146 |
|
args_info->gofr_given = 0 ; |
147 |
|
args_info->gofz_given = 0 ; |
148 |
|
args_info->r_theta_given = 0 ; |
150 |
|
args_info->r_z_given = 0 ; |
151 |
|
args_info->theta_omega_given = 0 ; |
152 |
|
args_info->gxyz_given = 0 ; |
153 |
+ |
args_info->twodgofr_given = 0 ; |
154 |
|
args_info->p2_given = 0 ; |
155 |
|
args_info->rp2_given = 0 ; |
156 |
|
args_info->scd_given = 0 ; |
159 |
|
args_info->p_angle_given = 0 ; |
160 |
|
args_info->hxy_given = 0 ; |
161 |
|
args_info->rho_r_given = 0 ; |
162 |
+ |
args_info->angle_r_given = 0 ; |
163 |
|
args_info->hullvol_given = 0 ; |
164 |
+ |
args_info->rodlength_given = 0 ; |
165 |
+ |
args_info->tet_param_given = 0 ; |
166 |
+ |
args_info->tet_param_z_given = 0 ; |
167 |
|
args_info->staticProps_group_counter = 0 ; |
168 |
|
} |
169 |
|
|
170 |
|
static |
171 |
|
void clear_args (struct gengetopt_args_info *args_info) |
172 |
|
{ |
173 |
+ |
FIX_UNUSED (args_info); |
174 |
|
args_info->input_arg = NULL; |
175 |
|
args_info->input_orig = NULL; |
176 |
|
args_info->output_arg = NULL; |
187 |
|
args_info->nbins_z_orig = NULL; |
188 |
|
args_info->nanglebins_arg = 50; |
189 |
|
args_info->nanglebins_orig = NULL; |
163 |
– |
args_info->length_orig = NULL; |
190 |
|
args_info->rcut_orig = NULL; |
191 |
+ |
args_info->dz_orig = NULL; |
192 |
+ |
args_info->length_orig = NULL; |
193 |
+ |
args_info->zlength_orig = NULL; |
194 |
|
args_info->zoffset_arg = 0; |
195 |
|
args_info->zoffset_orig = NULL; |
196 |
|
args_info->sele1_arg = NULL; |
203 |
|
args_info->refsele_orig = NULL; |
204 |
|
args_info->comsele_arg = NULL; |
205 |
|
args_info->comsele_orig = NULL; |
206 |
+ |
args_info->seleoffset_orig = NULL; |
207 |
|
args_info->molname_arg = NULL; |
208 |
|
args_info->molname_orig = NULL; |
209 |
|
args_info->begin_orig = NULL; |
227 |
|
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
228 |
|
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
229 |
|
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
230 |
< |
args_info->length_help = gengetopt_args_info_help[10] ; |
231 |
< |
args_info->rcut_help = gengetopt_args_info_help[11] ; |
232 |
< |
args_info->zoffset_help = gengetopt_args_info_help[12] ; |
233 |
< |
args_info->sele1_help = gengetopt_args_info_help[13] ; |
234 |
< |
args_info->sele2_help = gengetopt_args_info_help[14] ; |
235 |
< |
args_info->sele3_help = gengetopt_args_info_help[15] ; |
236 |
< |
args_info->refsele_help = gengetopt_args_info_help[16] ; |
237 |
< |
args_info->comsele_help = gengetopt_args_info_help[17] ; |
238 |
< |
args_info->molname_help = gengetopt_args_info_help[18] ; |
239 |
< |
args_info->begin_help = gengetopt_args_info_help[19] ; |
240 |
< |
args_info->end_help = gengetopt_args_info_help[20] ; |
241 |
< |
args_info->radius_help = gengetopt_args_info_help[21] ; |
242 |
< |
args_info->bo_help = gengetopt_args_info_help[23] ; |
243 |
< |
args_info->bor_help = gengetopt_args_info_help[24] ; |
244 |
< |
args_info->bad_help = gengetopt_args_info_help[25] ; |
245 |
< |
args_info->gofr_help = gengetopt_args_info_help[26] ; |
246 |
< |
args_info->gofz_help = gengetopt_args_info_help[27] ; |
247 |
< |
args_info->r_theta_help = gengetopt_args_info_help[28] ; |
248 |
< |
args_info->r_omega_help = gengetopt_args_info_help[29] ; |
249 |
< |
args_info->r_z_help = gengetopt_args_info_help[30] ; |
250 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[31] ; |
251 |
< |
args_info->gxyz_help = gengetopt_args_info_help[32] ; |
252 |
< |
args_info->p2_help = gengetopt_args_info_help[33] ; |
253 |
< |
args_info->rp2_help = gengetopt_args_info_help[34] ; |
254 |
< |
args_info->scd_help = gengetopt_args_info_help[35] ; |
255 |
< |
args_info->density_help = gengetopt_args_info_help[36] ; |
256 |
< |
args_info->slab_density_help = gengetopt_args_info_help[37] ; |
257 |
< |
args_info->p_angle_help = gengetopt_args_info_help[38] ; |
258 |
< |
args_info->hxy_help = gengetopt_args_info_help[39] ; |
259 |
< |
args_info->rho_r_help = gengetopt_args_info_help[40] ; |
260 |
< |
args_info->hullvol_help = gengetopt_args_info_help[41] ; |
230 |
> |
args_info->rcut_help = gengetopt_args_info_help[10] ; |
231 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
232 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
233 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
234 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
235 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
236 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
237 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
238 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
239 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
240 |
> |
args_info->seleoffset_help = gengetopt_args_info_help[20] ; |
241 |
> |
args_info->molname_help = gengetopt_args_info_help[21] ; |
242 |
> |
args_info->begin_help = gengetopt_args_info_help[22] ; |
243 |
> |
args_info->end_help = gengetopt_args_info_help[23] ; |
244 |
> |
args_info->radius_help = gengetopt_args_info_help[24] ; |
245 |
> |
args_info->bo_help = gengetopt_args_info_help[26] ; |
246 |
> |
args_info->bor_help = gengetopt_args_info_help[27] ; |
247 |
> |
args_info->bad_help = gengetopt_args_info_help[28] ; |
248 |
> |
args_info->count_help = gengetopt_args_info_help[29] ; |
249 |
> |
args_info->gofr_help = gengetopt_args_info_help[30] ; |
250 |
> |
args_info->gofz_help = gengetopt_args_info_help[31] ; |
251 |
> |
args_info->r_theta_help = gengetopt_args_info_help[32] ; |
252 |
> |
args_info->r_omega_help = gengetopt_args_info_help[33] ; |
253 |
> |
args_info->r_z_help = gengetopt_args_info_help[34] ; |
254 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[35] ; |
255 |
> |
args_info->gxyz_help = gengetopt_args_info_help[36] ; |
256 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[37] ; |
257 |
> |
args_info->p2_help = gengetopt_args_info_help[38] ; |
258 |
> |
args_info->rp2_help = gengetopt_args_info_help[39] ; |
259 |
> |
args_info->scd_help = gengetopt_args_info_help[40] ; |
260 |
> |
args_info->density_help = gengetopt_args_info_help[41] ; |
261 |
> |
args_info->slab_density_help = gengetopt_args_info_help[42] ; |
262 |
> |
args_info->p_angle_help = gengetopt_args_info_help[43] ; |
263 |
> |
args_info->hxy_help = gengetopt_args_info_help[44] ; |
264 |
> |
args_info->rho_r_help = gengetopt_args_info_help[45] ; |
265 |
> |
args_info->angle_r_help = gengetopt_args_info_help[46] ; |
266 |
> |
args_info->hullvol_help = gengetopt_args_info_help[47] ; |
267 |
> |
args_info->rodlength_help = gengetopt_args_info_help[48] ; |
268 |
> |
args_info->tet_param_help = gengetopt_args_info_help[49] ; |
269 |
> |
args_info->tet_param_z_help = gengetopt_args_info_help[50] ; |
270 |
|
|
271 |
|
} |
272 |
|
|
273 |
|
void |
274 |
|
cmdline_parser_print_version (void) |
275 |
|
{ |
276 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
276 |
> |
printf ("%s %s\n", |
277 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
278 |
> |
CMDLINE_PARSER_VERSION); |
279 |
|
} |
280 |
|
|
281 |
|
static void print_help_common(void) { |
290 |
|
printf("\n"); |
291 |
|
|
292 |
|
if (strlen(gengetopt_args_info_description) > 0) |
293 |
< |
printf("%s\n", gengetopt_args_info_description); |
293 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
294 |
|
} |
295 |
|
|
296 |
|
void |
309 |
|
clear_args (args_info); |
310 |
|
init_args_info (args_info); |
311 |
|
|
312 |
< |
args_info->inputs = NULL; |
312 |
> |
args_info->inputs = 0; |
313 |
|
args_info->inputs_num = 0; |
314 |
|
} |
315 |
|
|
360 |
|
free_string_field (&(args_info->nbins_y_orig)); |
361 |
|
free_string_field (&(args_info->nbins_z_orig)); |
362 |
|
free_string_field (&(args_info->nanglebins_orig)); |
322 |
– |
free_string_field (&(args_info->length_orig)); |
363 |
|
free_string_field (&(args_info->rcut_orig)); |
364 |
+ |
free_string_field (&(args_info->dz_orig)); |
365 |
+ |
free_string_field (&(args_info->length_orig)); |
366 |
+ |
free_string_field (&(args_info->zlength_orig)); |
367 |
|
free_string_field (&(args_info->zoffset_orig)); |
368 |
|
free_string_field (&(args_info->sele1_arg)); |
369 |
|
free_string_field (&(args_info->sele1_orig)); |
375 |
|
free_string_field (&(args_info->refsele_orig)); |
376 |
|
free_string_field (&(args_info->comsele_arg)); |
377 |
|
free_string_field (&(args_info->comsele_orig)); |
378 |
+ |
free_string_field (&(args_info->seleoffset_orig)); |
379 |
|
free_string_field (&(args_info->molname_arg)); |
380 |
|
free_string_field (&(args_info->molname_orig)); |
381 |
|
free_string_field (&(args_info->begin_orig)); |
394 |
|
|
395 |
|
|
396 |
|
static void |
397 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
397 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
398 |
|
{ |
399 |
+ |
FIX_UNUSED (values); |
400 |
|
if (arg) { |
401 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
402 |
|
} else { |
436 |
|
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
437 |
|
if (args_info->nanglebins_given) |
438 |
|
write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); |
394 |
– |
if (args_info->length_given) |
395 |
– |
write_into_file(outfile, "length", args_info->length_orig, 0); |
439 |
|
if (args_info->rcut_given) |
440 |
|
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
441 |
+ |
if (args_info->dz_given) |
442 |
+ |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
443 |
+ |
if (args_info->length_given) |
444 |
+ |
write_into_file(outfile, "length", args_info->length_orig, 0); |
445 |
+ |
if (args_info->zlength_given) |
446 |
+ |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
447 |
|
if (args_info->zoffset_given) |
448 |
|
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
449 |
|
if (args_info->sele1_given) |
456 |
|
write_into_file(outfile, "refsele", args_info->refsele_orig, 0); |
457 |
|
if (args_info->comsele_given) |
458 |
|
write_into_file(outfile, "comsele", args_info->comsele_orig, 0); |
459 |
+ |
if (args_info->seleoffset_given) |
460 |
+ |
write_into_file(outfile, "seleoffset", args_info->seleoffset_orig, 0); |
461 |
|
if (args_info->molname_given) |
462 |
|
write_into_file(outfile, "molname", args_info->molname_orig, 0); |
463 |
|
if (args_info->begin_given) |
472 |
|
write_into_file(outfile, "bor", 0, 0 ); |
473 |
|
if (args_info->bad_given) |
474 |
|
write_into_file(outfile, "bad", 0, 0 ); |
475 |
+ |
if (args_info->count_given) |
476 |
+ |
write_into_file(outfile, "count", 0, 0 ); |
477 |
|
if (args_info->gofr_given) |
478 |
|
write_into_file(outfile, "gofr", 0, 0 ); |
479 |
|
if (args_info->gofz_given) |
488 |
|
write_into_file(outfile, "theta_omega", 0, 0 ); |
489 |
|
if (args_info->gxyz_given) |
490 |
|
write_into_file(outfile, "gxyz", 0, 0 ); |
491 |
+ |
if (args_info->twodgofr_given) |
492 |
+ |
write_into_file(outfile, "twodgofr", 0, 0 ); |
493 |
|
if (args_info->p2_given) |
494 |
|
write_into_file(outfile, "p2", 0, 0 ); |
495 |
|
if (args_info->rp2_given) |
506 |
|
write_into_file(outfile, "hxy", 0, 0 ); |
507 |
|
if (args_info->rho_r_given) |
508 |
|
write_into_file(outfile, "rho_r", 0, 0 ); |
509 |
+ |
if (args_info->angle_r_given) |
510 |
+ |
write_into_file(outfile, "angle_r", 0, 0 ); |
511 |
|
if (args_info->hullvol_given) |
512 |
|
write_into_file(outfile, "hullvol", 0, 0 ); |
513 |
+ |
if (args_info->rodlength_given) |
514 |
+ |
write_into_file(outfile, "rodlength", 0, 0 ); |
515 |
+ |
if (args_info->tet_param_given) |
516 |
+ |
write_into_file(outfile, "tet_param", 0, 0 ); |
517 |
+ |
if (args_info->tet_param_z_given) |
518 |
+ |
write_into_file(outfile, "tet_param_z", 0, 0 ); |
519 |
|
|
520 |
|
|
521 |
|
i = EXIT_SUCCESS; |
552 |
|
char * |
553 |
|
gengetopt_strdup (const char *s) |
554 |
|
{ |
555 |
< |
char *result = NULL; |
555 |
> |
char *result = 0; |
556 |
|
if (!s) |
557 |
|
return result; |
558 |
|
|
572 |
|
args_info->bo_given = 0 ; |
573 |
|
args_info->bor_given = 0 ; |
574 |
|
args_info->bad_given = 0 ; |
575 |
+ |
args_info->count_given = 0 ; |
576 |
|
args_info->gofr_given = 0 ; |
577 |
|
args_info->gofz_given = 0 ; |
578 |
|
args_info->r_theta_given = 0 ; |
580 |
|
args_info->r_z_given = 0 ; |
581 |
|
args_info->theta_omega_given = 0 ; |
582 |
|
args_info->gxyz_given = 0 ; |
583 |
+ |
args_info->twodgofr_given = 0 ; |
584 |
|
args_info->p2_given = 0 ; |
585 |
|
args_info->rp2_given = 0 ; |
586 |
|
args_info->scd_given = 0 ; |
589 |
|
args_info->p_angle_given = 0 ; |
590 |
|
args_info->hxy_given = 0 ; |
591 |
|
args_info->rho_r_given = 0 ; |
592 |
+ |
args_info->angle_r_given = 0 ; |
593 |
|
args_info->hullvol_given = 0 ; |
594 |
+ |
args_info->rodlength_given = 0 ; |
595 |
+ |
args_info->tet_param_given = 0 ; |
596 |
+ |
args_info->tet_param_z_given = 0 ; |
597 |
|
|
598 |
|
args_info->staticProps_group_counter = 0; |
599 |
|
} |
600 |
|
|
601 |
|
int |
602 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
602 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
603 |
|
{ |
604 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
605 |
|
} |
606 |
|
|
607 |
|
int |
608 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
608 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
609 |
|
struct cmdline_parser_params *params) |
610 |
|
{ |
611 |
|
int result; |
612 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
612 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
613 |
|
|
614 |
|
if (result == EXIT_FAILURE) |
615 |
|
{ |
621 |
|
} |
622 |
|
|
623 |
|
int |
624 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
624 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
625 |
|
{ |
626 |
|
int result; |
627 |
|
struct cmdline_parser_params params; |
632 |
|
params.check_ambiguity = 0; |
633 |
|
params.print_errors = 1; |
634 |
|
|
635 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
635 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
636 |
|
|
637 |
|
if (result == EXIT_FAILURE) |
638 |
|
{ |
648 |
|
{ |
649 |
|
int result = EXIT_SUCCESS; |
650 |
|
|
651 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
651 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
652 |
|
result = EXIT_FAILURE; |
653 |
|
|
654 |
|
if (result == EXIT_FAILURE) |
664 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
665 |
|
{ |
666 |
|
int error = 0; |
667 |
+ |
FIX_UNUSED (additional_error); |
668 |
|
|
669 |
|
/* checks for required options */ |
670 |
|
if (! args_info->input_given) |
675 |
|
|
676 |
|
if (args_info->staticProps_group_counter == 0) |
677 |
|
{ |
678 |
< |
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 : "")); |
678 |
> |
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 : "")); |
679 |
|
error = 1; |
680 |
|
} |
681 |
|
|
709 |
|
static |
710 |
|
int update_arg(void *field, char **orig_field, |
711 |
|
unsigned int *field_given, unsigned int *prev_given, |
712 |
< |
char *value, char *possible_values[], const char *default_value, |
712 |
> |
char *value, const char *possible_values[], |
713 |
> |
const char *default_value, |
714 |
|
cmdline_parser_arg_type arg_type, |
715 |
|
int check_ambiguity, int override, |
716 |
|
int no_free, int multiple_option, |
721 |
|
const char *val = value; |
722 |
|
int found; |
723 |
|
char **string_field; |
724 |
+ |
FIX_UNUSED (field); |
725 |
|
|
726 |
|
stop_char = 0; |
727 |
|
found = 0; |
739 |
|
return 1; /* failure */ |
740 |
|
} |
741 |
|
|
742 |
+ |
FIX_UNUSED (default_value); |
743 |
|
|
744 |
|
if (field_given && *field_given && ! override) |
745 |
|
return 0; |
803 |
|
|
804 |
|
|
805 |
|
int |
806 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
806 |
> |
cmdline_parser_internal ( |
807 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
808 |
|
struct cmdline_parser_params *params, const char *additional_error) |
809 |
|
{ |
810 |
|
int c; /* Character of the parsed option. */ |
849 |
|
{ "nbins_y", 1, NULL, 'y' }, |
850 |
|
{ "nbins_z", 1, NULL, 0 }, |
851 |
|
{ "nanglebins", 1, NULL, 'a' }, |
778 |
– |
{ "length", 1, NULL, 0 }, |
852 |
|
{ "rcut", 1, NULL, 'c' }, |
853 |
+ |
{ "dz", 1, NULL, 0 }, |
854 |
+ |
{ "length", 1, NULL, 0 }, |
855 |
+ |
{ "zlength", 1, NULL, 0 }, |
856 |
|
{ "zoffset", 1, NULL, 'z' }, |
857 |
|
{ "sele1", 1, NULL, 0 }, |
858 |
|
{ "sele2", 1, NULL, 0 }, |
859 |
|
{ "sele3", 1, NULL, 0 }, |
860 |
|
{ "refsele", 1, NULL, 0 }, |
861 |
|
{ "comsele", 1, NULL, 0 }, |
862 |
+ |
{ "seleoffset", 1, NULL, 0 }, |
863 |
|
{ "molname", 1, NULL, 0 }, |
864 |
|
{ "begin", 1, NULL, 0 }, |
865 |
|
{ "end", 1, NULL, 0 }, |
867 |
|
{ "bo", 0, NULL, 0 }, |
868 |
|
{ "bor", 0, NULL, 0 }, |
869 |
|
{ "bad", 0, NULL, 0 }, |
870 |
+ |
{ "count", 0, NULL, 0 }, |
871 |
|
{ "gofr", 0, NULL, 'g' }, |
872 |
|
{ "gofz", 0, NULL, 0 }, |
873 |
|
{ "r_theta", 0, NULL, 0 }, |
875 |
|
{ "r_z", 0, NULL, 0 }, |
876 |
|
{ "theta_omega", 0, NULL, 0 }, |
877 |
|
{ "gxyz", 0, NULL, 0 }, |
878 |
+ |
{ "twodgofr", 0, NULL, 0 }, |
879 |
|
{ "p2", 0, NULL, 'p' }, |
880 |
|
{ "rp2", 0, NULL, 0 }, |
881 |
|
{ "scd", 0, NULL, 's' }, |
884 |
|
{ "p_angle", 0, NULL, 0 }, |
885 |
|
{ "hxy", 0, NULL, 0 }, |
886 |
|
{ "rho_r", 0, NULL, 0 }, |
887 |
+ |
{ "angle_r", 0, NULL, 0 }, |
888 |
|
{ "hullvol", 0, NULL, 0 }, |
889 |
< |
{ NULL, 0, NULL, 0 } |
889 |
> |
{ "rodlength", 0, NULL, 0 }, |
890 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
891 |
> |
{ "tet_param_z", 0, NULL, 0 }, |
892 |
> |
{ 0, 0, 0, 0 } |
893 |
|
}; |
894 |
|
|
895 |
< |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
895 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
896 |
|
|
897 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
898 |
|
|
1031 |
|
goto failure; |
1032 |
|
|
1033 |
|
break; |
1034 |
< |
case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ |
1034 |
> |
case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ |
1035 |
|
|
1036 |
|
if (args_info->staticProps_group_counter && override) |
1037 |
|
reset_group_staticProps (args_info); |
1072 |
|
&(local_args_info.density_given), optarg, 0, 0, ARG_NO, |
1073 |
|
check_ambiguity, override, 0, 0, |
1074 |
|
"density", 'd', |
1075 |
+ |
additional_error)) |
1076 |
+ |
goto failure; |
1077 |
+ |
|
1078 |
+ |
break; |
1079 |
+ |
case 'Q': /* tetrahedrality order parameter. */ |
1080 |
+ |
|
1081 |
+ |
if (args_info->staticProps_group_counter && override) |
1082 |
+ |
reset_group_staticProps (args_info); |
1083 |
+ |
args_info->staticProps_group_counter += 1; |
1084 |
+ |
|
1085 |
+ |
if (update_arg( 0 , |
1086 |
+ |
0 , &(args_info->tet_param_given), |
1087 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
1088 |
+ |
check_ambiguity, override, 0, 0, |
1089 |
+ |
"tet_param", 'Q', |
1090 |
|
additional_error)) |
1091 |
|
goto failure; |
1092 |
|
|
1107 |
|
goto failure; |
1108 |
|
|
1109 |
|
} |
1110 |
+ |
/* slab width (dz). */ |
1111 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
1112 |
+ |
{ |
1113 |
+ |
|
1114 |
+ |
|
1115 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
1116 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
1117 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
1118 |
+ |
check_ambiguity, override, 0, 0, |
1119 |
+ |
"dz", '-', |
1120 |
+ |
additional_error)) |
1121 |
+ |
goto failure; |
1122 |
+ |
|
1123 |
+ |
} |
1124 |
|
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1125 |
|
else if (strcmp (long_options[option_index].name, "length") == 0) |
1126 |
|
{ |
1135 |
|
goto failure; |
1136 |
|
|
1137 |
|
} |
1138 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1139 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1140 |
+ |
{ |
1141 |
+ |
|
1142 |
+ |
|
1143 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1144 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1145 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1146 |
+ |
check_ambiguity, override, 0, 0, |
1147 |
+ |
"zlength", '-', |
1148 |
+ |
additional_error)) |
1149 |
+ |
goto failure; |
1150 |
+ |
|
1151 |
+ |
} |
1152 |
|
/* select the first stuntdouble set. */ |
1153 |
|
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1154 |
|
{ |
1219 |
|
goto failure; |
1220 |
|
|
1221 |
|
} |
1222 |
+ |
/* global index offset for a second object (used to define a vector between sites in molecule). */ |
1223 |
+ |
else if (strcmp (long_options[option_index].name, "seleoffset") == 0) |
1224 |
+ |
{ |
1225 |
+ |
|
1226 |
+ |
|
1227 |
+ |
if (update_arg( (void *)&(args_info->seleoffset_arg), |
1228 |
+ |
&(args_info->seleoffset_orig), &(args_info->seleoffset_given), |
1229 |
+ |
&(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT, |
1230 |
+ |
check_ambiguity, override, 0, 0, |
1231 |
+ |
"seleoffset", '-', |
1232 |
+ |
additional_error)) |
1233 |
+ |
goto failure; |
1234 |
+ |
|
1235 |
+ |
} |
1236 |
|
/* molecule name. */ |
1237 |
|
else if (strcmp (long_options[option_index].name, "molname") == 0) |
1238 |
|
{ |
1340 |
|
goto failure; |
1341 |
|
|
1342 |
|
} |
1343 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
1344 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
1345 |
+ |
{ |
1346 |
+ |
|
1347 |
+ |
if (args_info->staticProps_group_counter && override) |
1348 |
+ |
reset_group_staticProps (args_info); |
1349 |
+ |
args_info->staticProps_group_counter += 1; |
1350 |
+ |
|
1351 |
+ |
if (update_arg( 0 , |
1352 |
+ |
0 , &(args_info->count_given), |
1353 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
1354 |
+ |
check_ambiguity, override, 0, 0, |
1355 |
+ |
"count", '-', |
1356 |
+ |
additional_error)) |
1357 |
+ |
goto failure; |
1358 |
+ |
|
1359 |
+ |
} |
1360 |
|
/* g(z). */ |
1361 |
|
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
1362 |
|
{ |
1459 |
|
goto failure; |
1460 |
|
|
1461 |
|
} |
1462 |
+ |
/* 2D g(r) (Slab width --dz must be specified). */ |
1463 |
+ |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
1464 |
+ |
{ |
1465 |
+ |
|
1466 |
+ |
if (args_info->staticProps_group_counter && override) |
1467 |
+ |
reset_group_staticProps (args_info); |
1468 |
+ |
args_info->staticProps_group_counter += 1; |
1469 |
+ |
|
1470 |
+ |
if (update_arg( 0 , |
1471 |
+ |
0 , &(args_info->twodgofr_given), |
1472 |
+ |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
1473 |
+ |
check_ambiguity, override, 0, 0, |
1474 |
+ |
"twodgofr", '-', |
1475 |
+ |
additional_error)) |
1476 |
+ |
goto failure; |
1477 |
+ |
|
1478 |
+ |
} |
1479 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1480 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1481 |
|
{ |
1557 |
|
&(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO, |
1558 |
|
check_ambiguity, override, 0, 0, |
1559 |
|
"rho_r", '-', |
1560 |
+ |
additional_error)) |
1561 |
+ |
goto failure; |
1562 |
+ |
|
1563 |
+ |
} |
1564 |
+ |
/* angle of R. */ |
1565 |
+ |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
1566 |
+ |
{ |
1567 |
+ |
|
1568 |
+ |
if (args_info->staticProps_group_counter && override) |
1569 |
+ |
reset_group_staticProps (args_info); |
1570 |
+ |
args_info->staticProps_group_counter += 1; |
1571 |
+ |
|
1572 |
+ |
if (update_arg( 0 , |
1573 |
+ |
0 , &(args_info->angle_r_given), |
1574 |
+ |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
1575 |
+ |
check_ambiguity, override, 0, 0, |
1576 |
+ |
"angle_r", '-', |
1577 |
|
additional_error)) |
1578 |
|
goto failure; |
1579 |
|
|
1595 |
|
goto failure; |
1596 |
|
|
1597 |
|
} |
1598 |
+ |
/* length of nanorod. */ |
1599 |
+ |
else if (strcmp (long_options[option_index].name, "rodlength") == 0) |
1600 |
+ |
{ |
1601 |
|
|
1602 |
+ |
if (args_info->staticProps_group_counter && override) |
1603 |
+ |
reset_group_staticProps (args_info); |
1604 |
+ |
args_info->staticProps_group_counter += 1; |
1605 |
+ |
|
1606 |
+ |
if (update_arg( 0 , |
1607 |
+ |
0 , &(args_info->rodlength_given), |
1608 |
+ |
&(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, |
1609 |
+ |
check_ambiguity, override, 0, 0, |
1610 |
+ |
"rodlength", '-', |
1611 |
+ |
additional_error)) |
1612 |
+ |
goto failure; |
1613 |
+ |
|
1614 |
+ |
} |
1615 |
+ |
/* tetrahedrality order parameter by zbin(--sele1 must be specified). */ |
1616 |
+ |
else if (strcmp (long_options[option_index].name, "tet_param_z") == 0) |
1617 |
+ |
{ |
1618 |
+ |
|
1619 |
+ |
if (args_info->staticProps_group_counter && override) |
1620 |
+ |
reset_group_staticProps (args_info); |
1621 |
+ |
args_info->staticProps_group_counter += 1; |
1622 |
+ |
|
1623 |
+ |
if (update_arg( 0 , |
1624 |
+ |
0 , &(args_info->tet_param_z_given), |
1625 |
+ |
&(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO, |
1626 |
+ |
check_ambiguity, override, 0, 0, |
1627 |
+ |
"tet_param_z", '-', |
1628 |
+ |
additional_error)) |
1629 |
+ |
goto failure; |
1630 |
+ |
|
1631 |
+ |
} |
1632 |
+ |
|
1633 |
|
break; |
1634 |
|
case '?': /* Invalid option. */ |
1635 |
|
/* `getopt_long' already printed an error message. */ |
1643 |
|
|
1644 |
|
if (args_info->staticProps_group_counter > 1) |
1645 |
|
{ |
1646 |
< |
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 : "")); |
1646 |
> |
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 : "")); |
1647 |
|
error = 1; |
1648 |
|
} |
1649 |
|
|