# | Line 1 | Line 1 | |
---|---|---|
1 | /* | |
2 | < | File autogenerated by gengetopt version 2.16 |
2 | > | File autogenerated by gengetopt version 2.19.1 |
3 | generated with the following command: | |
4 | < | gengetopt -F StaticPropsCmd |
4 | > | gengetopt -i StaticProps.ggo -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: | |
# | Line 21 | Line 21 | |
21 | ||
22 | #include "StaticPropsCmd.h" | |
23 | ||
24 | + | const char *gengetopt_args_info_purpose = ""; |
25 | + | |
26 | + | const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; |
27 | + | |
28 | + | const char *gengetopt_args_info_description = ""; |
29 | + | |
30 | + | const char *gengetopt_args_info_help[] = { |
31 | + | " -h, --help Print help and exit", |
32 | + | " -V, --version Print version and exit", |
33 | + | " -i, --input=filename input dump file", |
34 | + | " -o, --output=filename output file name", |
35 | + | " -n, --step=INT process every n frame (default=`1')", |
36 | + | " -b, --nbins=INT number of bins (general purpose) \n (default=`100')", |
37 | + | " -x, --nbins_x=INT number of bins in x axis (default=`100')", |
38 | + | " -y, --nbins_y=INT number of bins in y axis (default=`100')", |
39 | + | " -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)", |
41 | + | " -c, --rcut=DOUBLE cutoff radius (rcut)", |
42 | + | " -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", |
43 | + | " --sele1=selection script select the first stuntdouble set", |
44 | + | " --sele2=selection script select the second stuntdouble set", |
45 | + | " --sele3=selection script select the third stuntdouble set", |
46 | + | " --refsele=selection script\n select reference (use and only use with --gxyz)", |
47 | + | " --molname=STRING molecule name", |
48 | + | " --begin=INT begin internal index", |
49 | + | " --end=INT end internal index", |
50 | + | " --radius=DOUBLE nanoparticle radius", |
51 | + | "\n Group: staticProps\n an option of this group is required", |
52 | + | " --bo bond order parameter (--rcut must be specified)", |
53 | + | " --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
54 | + | " -g, --gofr g(r)", |
55 | + | " --r_theta g(r, cos(theta))", |
56 | + | " --r_omega g(r, cos(omega))", |
57 | + | " --theta_omega g(cos(theta), cos(omega))", |
58 | + | " --gxyz g(x, y, z)", |
59 | + | " -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
60 | + | " --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", |
61 | + | " -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
62 | + | " -d, --density density plot", |
63 | + | " --slab_density slab density", |
64 | + | " --hxy hxy", |
65 | + | " --rho_r rho of R", |
66 | + | 0 |
67 | + | }; |
68 | + | |
69 | static | |
70 | void clear_given (struct gengetopt_args_info *args_info); | |
71 | static | |
# | Line 43 | Line 88 | void clear_given (struct gengetopt_args_info *args_inf | |
88 | args_info->input_given = 0 ; | |
89 | args_info->output_given = 0 ; | |
90 | args_info->step_given = 0 ; | |
91 | < | args_info->nrbins_given = 0 ; |
91 | > | args_info->nbins_given = 0 ; |
92 | args_info->nbins_x_given = 0 ; | |
93 | args_info->nbins_y_given = 0 ; | |
94 | args_info->nanglebins_given = 0 ; | |
95 | args_info->length_given = 0 ; | |
51 | – | args_info->LegendreL_given = 0 ; |
96 | args_info->rcut_given = 0 ; | |
97 | args_info->zoffset_given = 0 ; | |
98 | args_info->sele1_given = 0 ; | |
# | Line 58 | Line 102 | void clear_given (struct gengetopt_args_info *args_inf | |
102 | args_info->molname_given = 0 ; | |
103 | args_info->begin_given = 0 ; | |
104 | args_info->end_given = 0 ; | |
105 | + | args_info->radius_given = 0 ; |
106 | args_info->bo_given = 0 ; | |
107 | + | args_info->bor_given = 0 ; |
108 | args_info->gofr_given = 0 ; | |
109 | args_info->r_theta_given = 0 ; | |
110 | args_info->r_omega_given = 0 ; | |
# | Line 70 | Line 116 | void clear_given (struct gengetopt_args_info *args_inf | |
116 | args_info->density_given = 0 ; | |
117 | args_info->slab_density_given = 0 ; | |
118 | args_info->hxy_given = 0 ; | |
119 | + | args_info->rho_r_given = 0 ; |
120 | args_info->staticProps_group_counter = 0 ; | |
121 | } | |
122 | ||
# | Line 82 | Line 129 | void clear_args (struct gengetopt_args_info *args_info | |
129 | args_info->output_orig = NULL; | |
130 | args_info->step_arg = 1; | |
131 | args_info->step_orig = NULL; | |
132 | < | args_info->nrbins_arg = 100; |
133 | < | args_info->nrbins_orig = NULL; |
132 | > | args_info->nbins_arg = 100; |
133 | > | args_info->nbins_orig = NULL; |
134 | args_info->nbins_x_arg = 100; | |
135 | args_info->nbins_x_orig = NULL; | |
136 | args_info->nbins_y_arg = 100; | |
# | Line 91 | Line 138 | void clear_args (struct gengetopt_args_info *args_info | |
138 | args_info->nanglebins_arg = 50; | |
139 | args_info->nanglebins_orig = NULL; | |
140 | args_info->length_orig = NULL; | |
94 | – | args_info->LegendreL_orig = NULL; |
141 | args_info->rcut_orig = NULL; | |
142 | args_info->zoffset_arg = 0; | |
143 | args_info->zoffset_orig = NULL; | |
# | Line 107 | Line 153 | void clear_args (struct gengetopt_args_info *args_info | |
153 | args_info->molname_orig = NULL; | |
154 | args_info->begin_orig = NULL; | |
155 | args_info->end_orig = NULL; | |
156 | + | args_info->radius_orig = NULL; |
157 | ||
158 | } | |
159 | ||
160 | + | static |
161 | + | void init_args_info(struct gengetopt_args_info *args_info) |
162 | + | { |
163 | + | args_info->help_help = gengetopt_args_info_help[0] ; |
164 | + | args_info->version_help = gengetopt_args_info_help[1] ; |
165 | + | args_info->input_help = gengetopt_args_info_help[2] ; |
166 | + | args_info->output_help = gengetopt_args_info_help[3] ; |
167 | + | args_info->step_help = gengetopt_args_info_help[4] ; |
168 | + | args_info->nbins_help = gengetopt_args_info_help[5] ; |
169 | + | args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
170 | + | args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
171 | + | args_info->nanglebins_help = gengetopt_args_info_help[8] ; |
172 | + | args_info->length_help = gengetopt_args_info_help[9] ; |
173 | + | args_info->rcut_help = gengetopt_args_info_help[10] ; |
174 | + | args_info->zoffset_help = gengetopt_args_info_help[11] ; |
175 | + | args_info->sele1_help = gengetopt_args_info_help[12] ; |
176 | + | args_info->sele2_help = gengetopt_args_info_help[13] ; |
177 | + | args_info->sele3_help = gengetopt_args_info_help[14] ; |
178 | + | args_info->refsele_help = gengetopt_args_info_help[15] ; |
179 | + | args_info->molname_help = gengetopt_args_info_help[16] ; |
180 | + | args_info->begin_help = gengetopt_args_info_help[17] ; |
181 | + | args_info->end_help = gengetopt_args_info_help[18] ; |
182 | + | args_info->radius_help = gengetopt_args_info_help[19] ; |
183 | + | args_info->bo_help = gengetopt_args_info_help[20] ; |
184 | + | args_info->bor_help = gengetopt_args_info_help[21] ; |
185 | + | args_info->gofr_help = gengetopt_args_info_help[22] ; |
186 | + | args_info->r_theta_help = gengetopt_args_info_help[23] ; |
187 | + | args_info->r_omega_help = gengetopt_args_info_help[24] ; |
188 | + | args_info->theta_omega_help = gengetopt_args_info_help[25] ; |
189 | + | args_info->gxyz_help = gengetopt_args_info_help[26] ; |
190 | + | args_info->p2_help = gengetopt_args_info_help[27] ; |
191 | + | args_info->rp2_help = gengetopt_args_info_help[28] ; |
192 | + | args_info->scd_help = gengetopt_args_info_help[29] ; |
193 | + | args_info->density_help = gengetopt_args_info_help[30] ; |
194 | + | args_info->slab_density_help = gengetopt_args_info_help[31] ; |
195 | + | args_info->hxy_help = gengetopt_args_info_help[32] ; |
196 | + | args_info->rho_r_help = gengetopt_args_info_help[33] ; |
197 | + | |
198 | + | } |
199 | + | |
200 | void | |
201 | cmdline_parser_print_version (void) | |
202 | { | |
# | Line 119 | Line 206 | cmdline_parser_print_help (void) | |
206 | void | |
207 | cmdline_parser_print_help (void) | |
208 | { | |
209 | + | int i = 0; |
210 | cmdline_parser_print_version (); | |
211 | < | printf("\nUsage: StaticProps [OPTIONS]...\n\n"); |
212 | < | printf("%s\n"," -h, --help Print help and exit"); |
213 | < | printf("%s\n"," -V, --version Print version and exit"); |
214 | < | printf("%s\n"," -i, --input=filename input dump file"); |
215 | < | printf("%s\n"," -o, --output=filename output file name"); |
216 | < | printf("%s\n"," -n, --step=INT process every n frame (default=`1')"); |
217 | < | printf("%s\n"," -r, --nrbins=INT number of bins for distance (default=`100')"); |
218 | < | printf("%s\n"," -x, --nbins_x=INT number of bins in x axis (default=`100')"); |
219 | < | printf("%s\n"," -y, --nbins_y=INT number of bins in y axis (default=`100')"); |
220 | < | printf("%s\n"," -a, --nanglebins=INT number of bins for cos(angle) (default=`50')"); |
221 | < | printf("%s\n"," --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)"); |
134 | < | printf("%s\n"," -l, --LegendreL=INT Order of Legendre Polynomial (used for Bond \n Order calculations)"); |
135 | < | printf("%s\n"," -c, --rcut=DOUBLE cutoff radius (rcut)"); |
136 | < | printf("%s\n"," -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')"); |
137 | < | printf("%s\n"," --sele1=selection script select the first stuntdouble set"); |
138 | < | printf("%s\n"," --sele2=selection script select the second stuntdouble set"); |
139 | < | printf("%s\n"," --sele3=selection script select the third stuntdouble set"); |
140 | < | printf("%s\n"," --refsele=selection script\n select reference (use and only use with --gxyz)"); |
141 | < | printf("%s\n"," --molname=STRING molecule name"); |
142 | < | printf("%s\n"," --begin=INT begin internal index"); |
143 | < | printf("%s\n"," --end=INT end internal index"); |
144 | < | printf("%s\n","\n Group: staticProps\n an option of this group is required"); |
145 | < | printf("%s\n"," -b, --bo bond order parameter (--rcut and --LegendreL \n must be specified"); |
146 | < | printf("%s\n"," -g, --gofr g(r)"); |
147 | < | printf("%s\n"," --r_theta g(r, cos(theta))"); |
148 | < | printf("%s\n"," --r_omega g(r, cos(omega))"); |
149 | < | printf("%s\n"," --theta_omega g(cos(theta), cos(omega))"); |
150 | < | printf("%s\n"," --gxyz g(x, y, z)"); |
151 | < | printf("%s\n"," -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)"); |
152 | < | printf("%s\n"," --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)"); |
153 | < | printf("%s\n"," -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)"); |
154 | < | printf("%s\n"," -d, --density density plot"); |
155 | < | printf("%s\n"," --slab_density slab density"); |
156 | < | printf("%s\n"," --hxy hxy"); |
157 | < | |
211 | > | |
212 | > | if (strlen(gengetopt_args_info_purpose) > 0) |
213 | > | printf("\n%s\n", gengetopt_args_info_purpose); |
214 | > | |
215 | > | printf("\n%s\n\n", gengetopt_args_info_usage); |
216 | > | |
217 | > | if (strlen(gengetopt_args_info_description) > 0) |
218 | > | printf("%s\n", gengetopt_args_info_description); |
219 | > | |
220 | > | while (gengetopt_args_info_help[i]) |
221 | > | printf("%s\n", gengetopt_args_info_help[i++]); |
222 | } | |
223 | ||
224 | void | |
# | Line 162 | Line 226 | cmdline_parser_init (struct gengetopt_args_info *args_ | |
226 | { | |
227 | clear_given (args_info); | |
228 | clear_args (args_info); | |
229 | + | init_args_info (args_info); |
230 | + | |
231 | + | args_info->inputs = NULL; |
232 | + | args_info->inputs_num = 0; |
233 | } | |
234 | ||
235 | static void | |
236 | cmdline_parser_release (struct gengetopt_args_info *args_info) | |
237 | { | |
238 | ||
239 | + | unsigned int i; |
240 | if (args_info->input_arg) | |
241 | { | |
242 | free (args_info->input_arg); /* free previous argument */ | |
# | Line 193 | Line 262 | cmdline_parser_release (struct gengetopt_args_info *ar | |
262 | free (args_info->step_orig); /* free previous argument */ | |
263 | args_info->step_orig = 0; | |
264 | } | |
265 | < | if (args_info->nrbins_orig) |
265 | > | if (args_info->nbins_orig) |
266 | { | |
267 | < | free (args_info->nrbins_orig); /* free previous argument */ |
268 | < | args_info->nrbins_orig = 0; |
267 | > | free (args_info->nbins_orig); /* free previous argument */ |
268 | > | args_info->nbins_orig = 0; |
269 | } | |
270 | if (args_info->nbins_x_orig) | |
271 | { | |
# | Line 218 | Line 287 | cmdline_parser_release (struct gengetopt_args_info *ar | |
287 | free (args_info->length_orig); /* free previous argument */ | |
288 | args_info->length_orig = 0; | |
289 | } | |
221 | – | if (args_info->LegendreL_orig) |
222 | – | { |
223 | – | free (args_info->LegendreL_orig); /* free previous argument */ |
224 | – | args_info->LegendreL_orig = 0; |
225 | – | } |
290 | if (args_info->rcut_orig) | |
291 | { | |
292 | free (args_info->rcut_orig); /* free previous argument */ | |
# | Line 293 | Line 357 | cmdline_parser_release (struct gengetopt_args_info *ar | |
357 | free (args_info->end_orig); /* free previous argument */ | |
358 | args_info->end_orig = 0; | |
359 | } | |
360 | + | if (args_info->radius_orig) |
361 | + | { |
362 | + | free (args_info->radius_orig); /* free previous argument */ |
363 | + | args_info->radius_orig = 0; |
364 | + | } |
365 | ||
366 | + | for (i = 0; i < args_info->inputs_num; ++i) |
367 | + | free (args_info->inputs [i]); |
368 | + | |
369 | + | if (args_info->inputs_num) |
370 | + | free (args_info->inputs); |
371 | + | |
372 | clear_given (args_info); | |
373 | } | |
374 | ||
# | Line 338 | Line 413 | cmdline_parser_file_save(const char *filename, struct | |
413 | fprintf(outfile, "%s\n", "step"); | |
414 | } | |
415 | } | |
416 | < | if (args_info->nrbins_given) { |
417 | < | if (args_info->nrbins_orig) { |
418 | < | fprintf(outfile, "%s=\"%s\"\n", "nrbins", args_info->nrbins_orig); |
416 | > | if (args_info->nbins_given) { |
417 | > | if (args_info->nbins_orig) { |
418 | > | fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig); |
419 | } else { | |
420 | < | fprintf(outfile, "%s\n", "nrbins"); |
420 | > | fprintf(outfile, "%s\n", "nbins"); |
421 | } | |
422 | } | |
423 | if (args_info->nbins_x_given) { | |
# | Line 371 | Line 446 | cmdline_parser_file_save(const char *filename, struct | |
446 | fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig); | |
447 | } else { | |
448 | fprintf(outfile, "%s\n", "length"); | |
374 | – | } |
375 | – | } |
376 | – | if (args_info->LegendreL_given) { |
377 | – | if (args_info->LegendreL_orig) { |
378 | – | fprintf(outfile, "%s=\"%s\"\n", "LegendreL", args_info->LegendreL_orig); |
379 | – | } else { |
380 | – | fprintf(outfile, "%s\n", "LegendreL"); |
449 | } | |
450 | } | |
451 | if (args_info->rcut_given) { | |
# | Line 443 | Line 511 | cmdline_parser_file_save(const char *filename, struct | |
511 | fprintf(outfile, "%s\n", "end"); | |
512 | } | |
513 | } | |
514 | + | if (args_info->radius_given) { |
515 | + | if (args_info->radius_orig) { |
516 | + | fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig); |
517 | + | } else { |
518 | + | fprintf(outfile, "%s\n", "radius"); |
519 | + | } |
520 | + | } |
521 | if (args_info->bo_given) { | |
522 | fprintf(outfile, "%s\n", "bo"); | |
523 | + | } |
524 | + | if (args_info->bor_given) { |
525 | + | fprintf(outfile, "%s\n", "bor"); |
526 | } | |
527 | if (args_info->gofr_given) { | |
528 | fprintf(outfile, "%s\n", "gofr"); | |
# | Line 479 | Line 557 | cmdline_parser_file_save(const char *filename, struct | |
557 | if (args_info->hxy_given) { | |
558 | fprintf(outfile, "%s\n", "hxy"); | |
559 | } | |
560 | + | if (args_info->rho_r_given) { |
561 | + | fprintf(outfile, "%s\n", "rho_r"); |
562 | + | } |
563 | ||
564 | fclose (outfile); | |
565 | ||
# | Line 519 | Line 600 | reset_group_staticProps(struct gengetopt_args_info *ar | |
600 | return; | |
601 | ||
602 | args_info->bo_given = 0 ; | |
603 | + | args_info->bor_given = 0 ; |
604 | args_info->gofr_given = 0 ; | |
605 | args_info->r_theta_given = 0 ; | |
606 | args_info->r_omega_given = 0 ; | |
# | Line 530 | Line 612 | reset_group_staticProps(struct gengetopt_args_info *ar | |
612 | args_info->density_given = 0 ; | |
613 | args_info->slab_density_given = 0 ; | |
614 | args_info->hxy_given = 0 ; | |
615 | + | args_info->rho_r_given = 0 ; |
616 | ||
617 | args_info->staticProps_group_counter = 0; | |
618 | } | |
# | Line 578 | Line 661 | cmdline_parser_required2 (struct gengetopt_args_info * | |
661 | { | |
662 | int error = 0; | |
663 | ||
664 | + | /* checks for required options */ |
665 | if (! args_info->input_given) | |
666 | { | |
667 | fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); | |
668 | error = 1; | |
669 | } | |
670 | + | |
671 | if (args_info->staticProps_group_counter == 0) | |
672 | { | |
673 | 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 : "")); | |
# | Line 590 | Line 675 | cmdline_parser_required2 (struct gengetopt_args_info * | |
675 | } | |
676 | ||
677 | ||
678 | + | /* checks for dependences among options */ |
679 | + | |
680 | return error; | |
681 | } | |
682 | ||
# | Line 622 | Line 709 | cmdline_parser_internal (int argc, char * const *argv, | |
709 | { "input", 1, NULL, 'i' }, | |
710 | { "output", 1, NULL, 'o' }, | |
711 | { "step", 1, NULL, 'n' }, | |
712 | < | { "nrbins", 1, NULL, 'r' }, |
712 | > | { "nbins", 1, NULL, 'b' }, |
713 | { "nbins_x", 1, NULL, 'x' }, | |
714 | { "nbins_y", 1, NULL, 'y' }, | |
715 | { "nanglebins", 1, NULL, 'a' }, | |
716 | { "length", 1, NULL, 0 }, | |
630 | – | { "LegendreL", 1, NULL, 'l' }, |
717 | { "rcut", 1, NULL, 'c' }, | |
718 | { "zoffset", 1, NULL, 'z' }, | |
719 | { "sele1", 1, NULL, 0 }, | |
# | Line 637 | Line 723 | cmdline_parser_internal (int argc, char * const *argv, | |
723 | { "molname", 1, NULL, 0 }, | |
724 | { "begin", 1, NULL, 0 }, | |
725 | { "end", 1, NULL, 0 }, | |
726 | < | { "bo", 0, NULL, 'b' }, |
726 | > | { "radius", 1, NULL, 0 }, |
727 | > | { "bo", 0, NULL, 0 }, |
728 | > | { "bor", 0, NULL, 0 }, |
729 | { "gofr", 0, NULL, 'g' }, | |
730 | { "r_theta", 0, NULL, 0 }, | |
731 | { "r_omega", 0, NULL, 0 }, | |
# | Line 649 | Line 737 | cmdline_parser_internal (int argc, char * const *argv, | |
737 | { "density", 0, NULL, 'd' }, | |
738 | { "slab_density", 0, NULL, 0 }, | |
739 | { "hxy", 0, NULL, 0 }, | |
740 | + | { "rho_r", 0, NULL, 0 }, |
741 | { NULL, 0, NULL, 0 } | |
742 | }; | |
743 | ||
744 | stop_char = 0; | |
745 | < | c = getopt_long (argc, argv, "hVi:o:n:r:x:y:a:l:c:z:bgpsd", long_options, &option_index); |
745 | > | c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
746 | ||
747 | if (c == -1) break; /* Exit from `while (1)' loop. */ | |
748 | ||
# | Line 725 | Line 814 | cmdline_parser_internal (int argc, char * const *argv, | |
814 | args_info->step_orig = gengetopt_strdup (optarg); | |
815 | break; | |
816 | ||
817 | < | case 'r': /* number of bins for distance. */ |
818 | < | if (local_args_info.nrbins_given) |
817 | > | case 'b': /* number of bins (general purpose). */ |
818 | > | if (local_args_info.nbins_given) |
819 | { | |
820 | < | fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
820 | > | fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
821 | goto failure; | |
822 | } | |
823 | < | if (args_info->nrbins_given && ! override) |
823 | > | if (args_info->nbins_given && ! override) |
824 | continue; | |
825 | < | local_args_info.nrbins_given = 1; |
826 | < | args_info->nrbins_given = 1; |
827 | < | args_info->nrbins_arg = strtol (optarg, &stop_char, 0); |
825 | > | local_args_info.nbins_given = 1; |
826 | > | args_info->nbins_given = 1; |
827 | > | args_info->nbins_arg = strtol (optarg, &stop_char, 0); |
828 | if (!(stop_char && *stop_char == '\0')) { | |
829 | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | |
830 | goto failure; | |
831 | } | |
832 | < | if (args_info->nrbins_orig) |
833 | < | free (args_info->nrbins_orig); /* free previous string */ |
834 | < | args_info->nrbins_orig = gengetopt_strdup (optarg); |
832 | > | if (args_info->nbins_orig) |
833 | > | free (args_info->nbins_orig); /* free previous string */ |
834 | > | args_info->nbins_orig = gengetopt_strdup (optarg); |
835 | break; | |
836 | ||
837 | case 'x': /* number of bins in x axis. */ | |
# | Line 805 | Line 894 | cmdline_parser_internal (int argc, char * const *argv, | |
894 | args_info->nanglebins_orig = gengetopt_strdup (optarg); | |
895 | break; | |
896 | ||
808 | – | case 'l': /* Order of Legendre Polynomial (used for Bond Order calculations). */ |
809 | – | if (local_args_info.LegendreL_given) |
810 | – | { |
811 | – | fprintf (stderr, "%s: `--LegendreL' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
812 | – | goto failure; |
813 | – | } |
814 | – | if (args_info->LegendreL_given && ! override) |
815 | – | continue; |
816 | – | local_args_info.LegendreL_given = 1; |
817 | – | args_info->LegendreL_given = 1; |
818 | – | args_info->LegendreL_arg = strtol (optarg, &stop_char, 0); |
819 | – | if (!(stop_char && *stop_char == '\0')) { |
820 | – | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
821 | – | goto failure; |
822 | – | } |
823 | – | if (args_info->LegendreL_orig) |
824 | – | free (args_info->LegendreL_orig); /* free previous string */ |
825 | – | args_info->LegendreL_orig = gengetopt_strdup (optarg); |
826 | – | break; |
827 | – | |
897 | case 'c': /* cutoff radius (rcut). */ | |
898 | if (local_args_info.rcut_given) | |
899 | { | |
# | Line 863 | Line 932 | cmdline_parser_internal (int argc, char * const *argv, | |
932 | if (args_info->zoffset_orig) | |
933 | free (args_info->zoffset_orig); /* free previous string */ | |
934 | args_info->zoffset_orig = gengetopt_strdup (optarg); | |
866 | – | break; |
867 | – | |
868 | – | case 'b': /* bond order parameter (--rcut and --LegendreL must be specified. */ |
869 | – | if (local_args_info.bo_given) |
870 | – | { |
871 | – | fprintf (stderr, "%s: `--bo' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
872 | – | goto failure; |
873 | – | } |
874 | – | if (args_info->bo_given && ! override) |
875 | – | continue; |
876 | – | local_args_info.bo_given = 1; |
877 | – | args_info->bo_given = 1; |
878 | – | if (args_info->staticProps_group_counter && override) |
879 | – | reset_group_staticProps (args_info); |
880 | – | args_info->staticProps_group_counter += 1; |
935 | break; | |
936 | ||
937 | case 'g': /* g(r). */ | |
# | Line 1099 | Line 1153 | cmdline_parser_internal (int argc, char * const *argv, | |
1153 | if (args_info->end_orig) | |
1154 | free (args_info->end_orig); /* free previous string */ | |
1155 | args_info->end_orig = gengetopt_strdup (optarg); | |
1156 | + | } |
1157 | + | /* nanoparticle radius. */ |
1158 | + | else if (strcmp (long_options[option_index].name, "radius") == 0) |
1159 | + | { |
1160 | + | if (local_args_info.radius_given) |
1161 | + | { |
1162 | + | fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1163 | + | goto failure; |
1164 | + | } |
1165 | + | if (args_info->radius_given && ! override) |
1166 | + | continue; |
1167 | + | local_args_info.radius_given = 1; |
1168 | + | args_info->radius_given = 1; |
1169 | + | args_info->radius_arg = strtod (optarg, &stop_char); |
1170 | + | if (!(stop_char && *stop_char == '\0')) { |
1171 | + | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
1172 | + | goto failure; |
1173 | + | } |
1174 | + | if (args_info->radius_orig) |
1175 | + | free (args_info->radius_orig); /* free previous string */ |
1176 | + | args_info->radius_orig = gengetopt_strdup (optarg); |
1177 | } | |
1178 | + | /* bond order parameter (--rcut must be specified). */ |
1179 | + | else if (strcmp (long_options[option_index].name, "bo") == 0) |
1180 | + | { |
1181 | + | if (local_args_info.bo_given) |
1182 | + | { |
1183 | + | fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1184 | + | goto failure; |
1185 | + | } |
1186 | + | if (args_info->bo_given && ! override) |
1187 | + | continue; |
1188 | + | local_args_info.bo_given = 1; |
1189 | + | args_info->bo_given = 1; |
1190 | + | if (args_info->staticProps_group_counter && override) |
1191 | + | reset_group_staticProps (args_info); |
1192 | + | args_info->staticProps_group_counter += 1; |
1193 | + | break; |
1194 | + | } |
1195 | + | /* bond order parameter as a function of radius (--rcut must be specified). */ |
1196 | + | else if (strcmp (long_options[option_index].name, "bor") == 0) |
1197 | + | { |
1198 | + | if (local_args_info.bor_given) |
1199 | + | { |
1200 | + | fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1201 | + | goto failure; |
1202 | + | } |
1203 | + | if (args_info->bor_given && ! override) |
1204 | + | continue; |
1205 | + | local_args_info.bor_given = 1; |
1206 | + | args_info->bor_given = 1; |
1207 | + | if (args_info->staticProps_group_counter && override) |
1208 | + | reset_group_staticProps (args_info); |
1209 | + | args_info->staticProps_group_counter += 1; |
1210 | + | break; |
1211 | + | } |
1212 | /* g(r, cos(theta)). */ | |
1213 | else if (strcmp (long_options[option_index].name, "r_theta") == 0) | |
1214 | { | |
# | Line 1219 | Line 1328 | cmdline_parser_internal (int argc, char * const *argv, | |
1328 | args_info->staticProps_group_counter += 1; | |
1329 | break; | |
1330 | } | |
1331 | + | /* rho of R. */ |
1332 | + | else if (strcmp (long_options[option_index].name, "rho_r") == 0) |
1333 | + | { |
1334 | + | if (local_args_info.rho_r_given) |
1335 | + | { |
1336 | + | fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1337 | + | goto failure; |
1338 | + | } |
1339 | + | if (args_info->rho_r_given && ! override) |
1340 | + | continue; |
1341 | + | local_args_info.rho_r_given = 1; |
1342 | + | args_info->rho_r_given = 1; |
1343 | + | if (args_info->staticProps_group_counter && override) |
1344 | + | reset_group_staticProps (args_info); |
1345 | + | args_info->staticProps_group_counter += 1; |
1346 | + | break; |
1347 | + | } |
1348 | ||
1349 | break; | |
1350 | case '?': /* Invalid option. */ | |
# | Line 1249 | Line 1375 | cmdline_parser_internal (int argc, char * const *argv, | |
1375 | if ( error ) | |
1376 | return (EXIT_FAILURE); | |
1377 | ||
1378 | + | if (optind < argc) |
1379 | + | { |
1380 | + | int i = 0 ; |
1381 | + | int found_prog_name = 0; |
1382 | + | /* whether program name, i.e., argv[0], is in the remaining args |
1383 | + | (this may happen with some implementations of getopt, |
1384 | + | but surely not with the one included by gengetopt) */ |
1385 | + | |
1386 | + | i = optind; |
1387 | + | while (i < argc) |
1388 | + | if (argv[i++] == argv[0]) { |
1389 | + | found_prog_name = 1; |
1390 | + | break; |
1391 | + | } |
1392 | + | i = 0; |
1393 | + | |
1394 | + | args_info->inputs_num = argc - optind - found_prog_name; |
1395 | + | args_info->inputs = |
1396 | + | (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1397 | + | while (optind < argc) |
1398 | + | if (argv[optind++] != argv[0]) |
1399 | + | args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1400 | + | } |
1401 | + | |
1402 | return 0; | |
1403 | ||
1404 | failure: |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |