1 |
|
/* |
2 |
< |
File autogenerated by gengetopt version 2.11 |
2 |
> |
File autogenerated by gengetopt version 2.22.4 |
3 |
|
generated with the following command: |
4 |
< |
/home/maul/gezelter/tim/bin/gengetopt -i StaticProps.ggo -F StaticPropsCmd |
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: |
8 |
|
we make no copyright claims on it. |
9 |
|
*/ |
10 |
|
|
11 |
+ |
/* If we use autoconf. */ |
12 |
+ |
#ifdef HAVE_CONFIG_H |
13 |
+ |
#include "config.h" |
14 |
+ |
#endif |
15 |
|
|
16 |
|
#include <stdio.h> |
17 |
|
#include <stdlib.h> |
18 |
|
#include <string.h> |
19 |
|
|
20 |
< |
/* If we use autoconf. */ |
21 |
< |
#ifdef HAVE_CONFIG_H |
18 |
< |
#include "config.h" |
20 |
> |
#ifndef FIX_UNUSED |
21 |
> |
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ |
22 |
|
#endif |
23 |
|
|
24 |
< |
#include "getopt.h" |
24 |
> |
#include <getopt.h> |
25 |
|
|
26 |
|
#include "StaticPropsCmd.h" |
27 |
|
|
28 |
< |
void |
26 |
< |
cmdline_parser_print_version (void) |
27 |
< |
{ |
28 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
29 |
< |
} |
28 |
> |
const char *gengetopt_args_info_purpose = ""; |
29 |
|
|
30 |
< |
void |
32 |
< |
cmdline_parser_print_help (void) |
33 |
< |
{ |
34 |
< |
cmdline_parser_print_version (); |
35 |
< |
printf("\n" |
36 |
< |
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); |
37 |
< |
printf("\n"); |
38 |
< |
printf(" -h, --help Print help and exit\n"); |
39 |
< |
printf(" -V, --version Print version and exit\n"); |
40 |
< |
printf(" -i, --input=filename input dump file\n"); |
41 |
< |
printf(" -o, --output=filename output file name\n"); |
42 |
< |
printf(" -n, --step=INT process every n frame (default=`1')\n"); |
43 |
< |
printf(" -r, --nrbins=INT number of bins for distance (default=`100')\n"); |
44 |
< |
printf(" -a, --nanglebins=INT number of bins for cos(angle) (default=\n `50')\n"); |
45 |
< |
printf(" -l, --length=DOUBLE maximum length (Defaults to 1/2 smallest \n length of first frame)\n"); |
46 |
< |
printf(" --sele1=selection script select the first stuntdouble set\n"); |
47 |
< |
printf(" --sele2=selection script select the second stuntdouble set\n"); |
48 |
< |
printf(" --sele3=selection script select the third stuntdouble set\n"); |
49 |
< |
printf(" --refsele=selection script select reference (use and only use with \n --gxyz)\n"); |
50 |
< |
printf(" --molname=STRING molecule name\n"); |
51 |
< |
printf(" --begin=INT begin interanl index\n"); |
52 |
< |
printf(" --end=INT end internal index\n"); |
53 |
< |
printf("\n"); |
54 |
< |
printf(" Group: staticProps an option of this group is required\n"); |
55 |
< |
printf(" --gofr g(r)\n"); |
56 |
< |
printf(" --r_theta g(r, cos(theta))\n"); |
57 |
< |
printf(" --r_omega g(r, cos(omega))\n"); |
58 |
< |
printf(" --theta_omega g(cos(theta), cos(omega))\n"); |
59 |
< |
printf(" --gxyz g(x, y, z)\n"); |
60 |
< |
printf(" --p2 p2 order parameter (--sele1 and --sele2 must \n be specified)\n"); |
61 |
< |
printf(" --scd scd order parameter(either --sele1, --sele2, \n --sele3 are specified or --molname, \n --begin, --end are specified)\n"); |
62 |
< |
printf(" --density density plot (--sele1 must be specified)\n"); |
63 |
< |
} |
30 |
> |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; |
31 |
|
|
32 |
+ |
const char *gengetopt_args_info_description = ""; |
33 |
|
|
34 |
< |
static char *gengetopt_strdup (const char *s); |
34 |
> |
const char *gengetopt_args_info_help[] = { |
35 |
> |
" -h, --help Print help and exit", |
36 |
> |
" -V, --version Print version and exit", |
37 |
> |
" -i, --input=filename input dump file", |
38 |
> |
" -o, --output=filename output file name", |
39 |
> |
" -n, --step=INT process every n frame (default=`1')", |
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')", |
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", |
52 |
> |
" --sele3=selection script select the third stuntdouble set", |
53 |
> |
" --refsele=selection script\n select reference (use and only use with --gxyz)", |
54 |
> |
" --comsele=selection script\n select stunt doubles for center-of-mass \n reference point", |
55 |
> |
" --seleoffset=INT global index offset for a second object (used \n to define a vector between sites in molecule)", |
56 |
> |
" --molname=STRING molecule name", |
57 |
> |
" --begin=INT begin internal index", |
58 |
> |
" --end=INT end internal index", |
59 |
> |
" --radius=DOUBLE nanoparticle radius", |
60 |
> |
"\n Group: staticProps\n an option of this group is required", |
61 |
> |
" --bo bond order parameter (--rcut must be specified)", |
62 |
> |
" --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
63 |
> |
" --bad N(theta) bond angle density within (--rcut must \n be specified)", |
64 |
> |
" --count count of molecules matching selection criteria \n (and associated statistics)", |
65 |
> |
" -g, --gofr g(r)", |
66 |
> |
" --gofz g(z)", |
67 |
> |
" --r_theta g(r, cos(theta))", |
68 |
> |
" --r_omega g(r, cos(omega))", |
69 |
> |
" --r_z g(r, z)", |
70 |
> |
" --theta_omega g(cos(theta), cos(omega))", |
71 |
> |
" --gxyz g(x, y, z)", |
72 |
> |
" --twodgofr 2D g(r) (Slab width --dz must be specified)", |
73 |
> |
" -p, --p2 p2 order parameter (--sele1 must be specified, \n --sele2 is optional)", |
74 |
> |
" --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", |
75 |
> |
" -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
76 |
> |
" -d, --density density plot", |
77 |
> |
" --slab_density slab density", |
78 |
> |
" --p_angle p(cos(theta))", |
79 |
> |
" --hxy hxy", |
80 |
> |
" --rho_r rho of R", |
81 |
> |
" --angle_r angle of R", |
82 |
> |
" --hullvol hull volume of nanoparticle", |
83 |
> |
" --rodlength length of nanorod", |
84 |
> |
" -Q, --tet_param tetrahedrality order parameter", |
85 |
> |
" --tet_param_z tetrahedrality order parameter by zbin(--sele1 \n must be specified)", |
86 |
> |
0 |
87 |
> |
}; |
88 |
|
|
89 |
< |
/* gengetopt_strdup() */ |
90 |
< |
/* strdup.c replacement of strdup, which is not standard */ |
91 |
< |
char * |
92 |
< |
gengetopt_strdup (const char *s) |
93 |
< |
{ |
73 |
< |
char *result = (char*)malloc(strlen(s) + 1); |
74 |
< |
if (result == (char*)0) |
75 |
< |
return (char*)0; |
76 |
< |
strcpy(result, s); |
77 |
< |
return result; |
78 |
< |
} |
89 |
> |
typedef enum {ARG_NO |
90 |
> |
, ARG_STRING |
91 |
> |
, ARG_INT |
92 |
> |
, ARG_DOUBLE |
93 |
> |
} cmdline_parser_arg_type; |
94 |
|
|
95 |
< |
int |
96 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
97 |
< |
{ |
98 |
< |
int c; /* Character of the parsed option. */ |
84 |
< |
int missing_required_options = 0; |
85 |
< |
int staticProps_group_counter = 0; |
86 |
< |
|
95 |
> |
static |
96 |
> |
void clear_given (struct gengetopt_args_info *args_info); |
97 |
> |
static |
98 |
> |
void clear_args (struct gengetopt_args_info *args_info); |
99 |
|
|
100 |
+ |
static int |
101 |
+ |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
102 |
+ |
struct cmdline_parser_params *params, const char *additional_error); |
103 |
+ |
|
104 |
+ |
static int |
105 |
+ |
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
106 |
+ |
|
107 |
+ |
static char * |
108 |
+ |
gengetopt_strdup (const char *s); |
109 |
+ |
|
110 |
+ |
static |
111 |
+ |
void clear_given (struct gengetopt_args_info *args_info) |
112 |
+ |
{ |
113 |
|
args_info->help_given = 0 ; |
114 |
|
args_info->version_given = 0 ; |
115 |
|
args_info->input_given = 0 ; |
116 |
|
args_info->output_given = 0 ; |
117 |
|
args_info->step_given = 0 ; |
118 |
< |
args_info->nrbins_given = 0 ; |
118 |
> |
args_info->nbins_given = 0 ; |
119 |
> |
args_info->nbins_x_given = 0 ; |
120 |
> |
args_info->nbins_y_given = 0 ; |
121 |
> |
args_info->nbins_z_given = 0 ; |
122 |
|
args_info->nanglebins_given = 0 ; |
123 |
+ |
args_info->rcut_given = 0 ; |
124 |
+ |
args_info->dz_given = 0 ; |
125 |
|
args_info->length_given = 0 ; |
126 |
+ |
args_info->zlength_given = 0 ; |
127 |
+ |
args_info->zoffset_given = 0 ; |
128 |
|
args_info->sele1_given = 0 ; |
129 |
|
args_info->sele2_given = 0 ; |
130 |
|
args_info->sele3_given = 0 ; |
131 |
|
args_info->refsele_given = 0 ; |
132 |
+ |
args_info->comsele_given = 0 ; |
133 |
+ |
args_info->seleoffset_given = 0 ; |
134 |
|
args_info->molname_given = 0 ; |
135 |
|
args_info->begin_given = 0 ; |
136 |
|
args_info->end_given = 0 ; |
137 |
+ |
args_info->radius_given = 0 ; |
138 |
+ |
args_info->bo_given = 0 ; |
139 |
+ |
args_info->bor_given = 0 ; |
140 |
+ |
args_info->bad_given = 0 ; |
141 |
+ |
args_info->count_given = 0 ; |
142 |
|
args_info->gofr_given = 0 ; |
143 |
+ |
args_info->gofz_given = 0 ; |
144 |
|
args_info->r_theta_given = 0 ; |
145 |
|
args_info->r_omega_given = 0 ; |
146 |
+ |
args_info->r_z_given = 0 ; |
147 |
|
args_info->theta_omega_given = 0 ; |
148 |
|
args_info->gxyz_given = 0 ; |
149 |
+ |
args_info->twodgofr_given = 0 ; |
150 |
|
args_info->p2_given = 0 ; |
151 |
+ |
args_info->rp2_given = 0 ; |
152 |
|
args_info->scd_given = 0 ; |
153 |
|
args_info->density_given = 0 ; |
154 |
< |
#define clear_args() { \ |
155 |
< |
args_info->input_arg = NULL; \ |
156 |
< |
args_info->output_arg = NULL; \ |
157 |
< |
args_info->step_arg = 1 ;\ |
158 |
< |
args_info->nrbins_arg = 100 ;\ |
159 |
< |
args_info->nanglebins_arg = 50 ;\ |
160 |
< |
args_info->sele1_arg = NULL; \ |
161 |
< |
args_info->sele2_arg = NULL; \ |
162 |
< |
args_info->sele3_arg = NULL; \ |
163 |
< |
args_info->refsele_arg = NULL; \ |
121 |
< |
args_info->molname_arg = NULL; \ |
154 |
> |
args_info->slab_density_given = 0 ; |
155 |
> |
args_info->p_angle_given = 0 ; |
156 |
> |
args_info->hxy_given = 0 ; |
157 |
> |
args_info->rho_r_given = 0 ; |
158 |
> |
args_info->angle_r_given = 0 ; |
159 |
> |
args_info->hullvol_given = 0 ; |
160 |
> |
args_info->rodlength_given = 0 ; |
161 |
> |
args_info->tet_param_given = 0 ; |
162 |
> |
args_info->tet_param_z_given = 0 ; |
163 |
> |
args_info->staticProps_group_counter = 0 ; |
164 |
|
} |
165 |
|
|
166 |
< |
clear_args(); |
166 |
> |
static |
167 |
> |
void clear_args (struct gengetopt_args_info *args_info) |
168 |
> |
{ |
169 |
> |
FIX_UNUSED (args_info); |
170 |
> |
args_info->input_arg = NULL; |
171 |
> |
args_info->input_orig = NULL; |
172 |
> |
args_info->output_arg = NULL; |
173 |
> |
args_info->output_orig = NULL; |
174 |
> |
args_info->step_arg = 1; |
175 |
> |
args_info->step_orig = NULL; |
176 |
> |
args_info->nbins_arg = 100; |
177 |
> |
args_info->nbins_orig = NULL; |
178 |
> |
args_info->nbins_x_arg = 100; |
179 |
> |
args_info->nbins_x_orig = NULL; |
180 |
> |
args_info->nbins_y_arg = 100; |
181 |
> |
args_info->nbins_y_orig = NULL; |
182 |
> |
args_info->nbins_z_arg = 100; |
183 |
> |
args_info->nbins_z_orig = NULL; |
184 |
> |
args_info->nanglebins_arg = 50; |
185 |
> |
args_info->nanglebins_orig = NULL; |
186 |
> |
args_info->rcut_orig = NULL; |
187 |
> |
args_info->dz_orig = NULL; |
188 |
> |
args_info->length_orig = NULL; |
189 |
> |
args_info->zlength_orig = NULL; |
190 |
> |
args_info->zoffset_arg = 0; |
191 |
> |
args_info->zoffset_orig = NULL; |
192 |
> |
args_info->sele1_arg = NULL; |
193 |
> |
args_info->sele1_orig = NULL; |
194 |
> |
args_info->sele2_arg = NULL; |
195 |
> |
args_info->sele2_orig = NULL; |
196 |
> |
args_info->sele3_arg = NULL; |
197 |
> |
args_info->sele3_orig = NULL; |
198 |
> |
args_info->refsele_arg = NULL; |
199 |
> |
args_info->refsele_orig = NULL; |
200 |
> |
args_info->comsele_arg = NULL; |
201 |
> |
args_info->comsele_orig = NULL; |
202 |
> |
args_info->seleoffset_orig = NULL; |
203 |
> |
args_info->molname_arg = NULL; |
204 |
> |
args_info->molname_orig = NULL; |
205 |
> |
args_info->begin_orig = NULL; |
206 |
> |
args_info->end_orig = NULL; |
207 |
> |
args_info->radius_orig = NULL; |
208 |
> |
|
209 |
> |
} |
210 |
> |
|
211 |
> |
static |
212 |
> |
void init_args_info(struct gengetopt_args_info *args_info) |
213 |
> |
{ |
214 |
> |
|
215 |
> |
|
216 |
> |
args_info->help_help = gengetopt_args_info_help[0] ; |
217 |
> |
args_info->version_help = gengetopt_args_info_help[1] ; |
218 |
> |
args_info->input_help = gengetopt_args_info_help[2] ; |
219 |
> |
args_info->output_help = gengetopt_args_info_help[3] ; |
220 |
> |
args_info->step_help = gengetopt_args_info_help[4] ; |
221 |
> |
args_info->nbins_help = gengetopt_args_info_help[5] ; |
222 |
> |
args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
223 |
> |
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
224 |
> |
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
225 |
> |
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
226 |
> |
args_info->rcut_help = gengetopt_args_info_help[10] ; |
227 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
228 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
229 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
230 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
231 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
232 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
233 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
234 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
235 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
236 |
> |
args_info->seleoffset_help = gengetopt_args_info_help[20] ; |
237 |
> |
args_info->molname_help = gengetopt_args_info_help[21] ; |
238 |
> |
args_info->begin_help = gengetopt_args_info_help[22] ; |
239 |
> |
args_info->end_help = gengetopt_args_info_help[23] ; |
240 |
> |
args_info->radius_help = gengetopt_args_info_help[24] ; |
241 |
> |
args_info->bo_help = gengetopt_args_info_help[26] ; |
242 |
> |
args_info->bor_help = gengetopt_args_info_help[27] ; |
243 |
> |
args_info->bad_help = gengetopt_args_info_help[28] ; |
244 |
> |
args_info->count_help = gengetopt_args_info_help[29] ; |
245 |
> |
args_info->gofr_help = gengetopt_args_info_help[30] ; |
246 |
> |
args_info->gofz_help = gengetopt_args_info_help[31] ; |
247 |
> |
args_info->r_theta_help = gengetopt_args_info_help[32] ; |
248 |
> |
args_info->r_omega_help = gengetopt_args_info_help[33] ; |
249 |
> |
args_info->r_z_help = gengetopt_args_info_help[34] ; |
250 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[35] ; |
251 |
> |
args_info->gxyz_help = gengetopt_args_info_help[36] ; |
252 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[37] ; |
253 |
> |
args_info->p2_help = gengetopt_args_info_help[38] ; |
254 |
> |
args_info->rp2_help = gengetopt_args_info_help[39] ; |
255 |
> |
args_info->scd_help = gengetopt_args_info_help[40] ; |
256 |
> |
args_info->density_help = gengetopt_args_info_help[41] ; |
257 |
> |
args_info->slab_density_help = gengetopt_args_info_help[42] ; |
258 |
> |
args_info->p_angle_help = gengetopt_args_info_help[43] ; |
259 |
> |
args_info->hxy_help = gengetopt_args_info_help[44] ; |
260 |
> |
args_info->rho_r_help = gengetopt_args_info_help[45] ; |
261 |
> |
args_info->angle_r_help = gengetopt_args_info_help[46] ; |
262 |
> |
args_info->hullvol_help = gengetopt_args_info_help[47] ; |
263 |
> |
args_info->rodlength_help = gengetopt_args_info_help[48] ; |
264 |
> |
args_info->tet_param_help = gengetopt_args_info_help[49] ; |
265 |
> |
args_info->tet_param_z_help = gengetopt_args_info_help[50] ; |
266 |
> |
|
267 |
> |
} |
268 |
> |
|
269 |
> |
void |
270 |
> |
cmdline_parser_print_version (void) |
271 |
> |
{ |
272 |
> |
printf ("%s %s\n", |
273 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
274 |
> |
CMDLINE_PARSER_VERSION); |
275 |
> |
} |
276 |
> |
|
277 |
> |
static void print_help_common(void) { |
278 |
> |
cmdline_parser_print_version (); |
279 |
> |
|
280 |
> |
if (strlen(gengetopt_args_info_purpose) > 0) |
281 |
> |
printf("\n%s\n", gengetopt_args_info_purpose); |
282 |
> |
|
283 |
> |
if (strlen(gengetopt_args_info_usage) > 0) |
284 |
> |
printf("\n%s\n", gengetopt_args_info_usage); |
285 |
> |
|
286 |
> |
printf("\n"); |
287 |
> |
|
288 |
> |
if (strlen(gengetopt_args_info_description) > 0) |
289 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
290 |
> |
} |
291 |
> |
|
292 |
> |
void |
293 |
> |
cmdline_parser_print_help (void) |
294 |
> |
{ |
295 |
> |
int i = 0; |
296 |
> |
print_help_common(); |
297 |
> |
while (gengetopt_args_info_help[i]) |
298 |
> |
printf("%s\n", gengetopt_args_info_help[i++]); |
299 |
> |
} |
300 |
> |
|
301 |
> |
void |
302 |
> |
cmdline_parser_init (struct gengetopt_args_info *args_info) |
303 |
> |
{ |
304 |
> |
clear_given (args_info); |
305 |
> |
clear_args (args_info); |
306 |
> |
init_args_info (args_info); |
307 |
> |
|
308 |
> |
args_info->inputs = 0; |
309 |
> |
args_info->inputs_num = 0; |
310 |
> |
} |
311 |
> |
|
312 |
> |
void |
313 |
> |
cmdline_parser_params_init(struct cmdline_parser_params *params) |
314 |
> |
{ |
315 |
> |
if (params) |
316 |
> |
{ |
317 |
> |
params->override = 0; |
318 |
> |
params->initialize = 1; |
319 |
> |
params->check_required = 1; |
320 |
> |
params->check_ambiguity = 0; |
321 |
> |
params->print_errors = 1; |
322 |
> |
} |
323 |
> |
} |
324 |
> |
|
325 |
> |
struct cmdline_parser_params * |
326 |
> |
cmdline_parser_params_create(void) |
327 |
> |
{ |
328 |
> |
struct cmdline_parser_params *params = |
329 |
> |
(struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); |
330 |
> |
cmdline_parser_params_init(params); |
331 |
> |
return params; |
332 |
> |
} |
333 |
> |
|
334 |
> |
static void |
335 |
> |
free_string_field (char **s) |
336 |
> |
{ |
337 |
> |
if (*s) |
338 |
> |
{ |
339 |
> |
free (*s); |
340 |
> |
*s = 0; |
341 |
> |
} |
342 |
> |
} |
343 |
> |
|
344 |
> |
|
345 |
> |
static void |
346 |
> |
cmdline_parser_release (struct gengetopt_args_info *args_info) |
347 |
> |
{ |
348 |
> |
unsigned int i; |
349 |
> |
free_string_field (&(args_info->input_arg)); |
350 |
> |
free_string_field (&(args_info->input_orig)); |
351 |
> |
free_string_field (&(args_info->output_arg)); |
352 |
> |
free_string_field (&(args_info->output_orig)); |
353 |
> |
free_string_field (&(args_info->step_orig)); |
354 |
> |
free_string_field (&(args_info->nbins_orig)); |
355 |
> |
free_string_field (&(args_info->nbins_x_orig)); |
356 |
> |
free_string_field (&(args_info->nbins_y_orig)); |
357 |
> |
free_string_field (&(args_info->nbins_z_orig)); |
358 |
> |
free_string_field (&(args_info->nanglebins_orig)); |
359 |
> |
free_string_field (&(args_info->rcut_orig)); |
360 |
> |
free_string_field (&(args_info->dz_orig)); |
361 |
> |
free_string_field (&(args_info->length_orig)); |
362 |
> |
free_string_field (&(args_info->zlength_orig)); |
363 |
> |
free_string_field (&(args_info->zoffset_orig)); |
364 |
> |
free_string_field (&(args_info->sele1_arg)); |
365 |
> |
free_string_field (&(args_info->sele1_orig)); |
366 |
> |
free_string_field (&(args_info->sele2_arg)); |
367 |
> |
free_string_field (&(args_info->sele2_orig)); |
368 |
> |
free_string_field (&(args_info->sele3_arg)); |
369 |
> |
free_string_field (&(args_info->sele3_orig)); |
370 |
> |
free_string_field (&(args_info->refsele_arg)); |
371 |
> |
free_string_field (&(args_info->refsele_orig)); |
372 |
> |
free_string_field (&(args_info->comsele_arg)); |
373 |
> |
free_string_field (&(args_info->comsele_orig)); |
374 |
> |
free_string_field (&(args_info->seleoffset_orig)); |
375 |
> |
free_string_field (&(args_info->molname_arg)); |
376 |
> |
free_string_field (&(args_info->molname_orig)); |
377 |
> |
free_string_field (&(args_info->begin_orig)); |
378 |
> |
free_string_field (&(args_info->end_orig)); |
379 |
> |
free_string_field (&(args_info->radius_orig)); |
380 |
> |
|
381 |
> |
|
382 |
> |
for (i = 0; i < args_info->inputs_num; ++i) |
383 |
> |
free (args_info->inputs [i]); |
384 |
> |
|
385 |
> |
if (args_info->inputs_num) |
386 |
> |
free (args_info->inputs); |
387 |
> |
|
388 |
> |
clear_given (args_info); |
389 |
> |
} |
390 |
> |
|
391 |
> |
|
392 |
> |
static void |
393 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
394 |
> |
{ |
395 |
> |
FIX_UNUSED (values); |
396 |
> |
if (arg) { |
397 |
> |
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
398 |
> |
} else { |
399 |
> |
fprintf(outfile, "%s\n", opt); |
400 |
> |
} |
401 |
> |
} |
402 |
> |
|
403 |
> |
|
404 |
> |
int |
405 |
> |
cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) |
406 |
> |
{ |
407 |
> |
int i = 0; |
408 |
> |
|
409 |
> |
if (!outfile) |
410 |
> |
{ |
411 |
> |
fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); |
412 |
> |
return EXIT_FAILURE; |
413 |
> |
} |
414 |
> |
|
415 |
> |
if (args_info->help_given) |
416 |
> |
write_into_file(outfile, "help", 0, 0 ); |
417 |
> |
if (args_info->version_given) |
418 |
> |
write_into_file(outfile, "version", 0, 0 ); |
419 |
> |
if (args_info->input_given) |
420 |
> |
write_into_file(outfile, "input", args_info->input_orig, 0); |
421 |
> |
if (args_info->output_given) |
422 |
> |
write_into_file(outfile, "output", args_info->output_orig, 0); |
423 |
> |
if (args_info->step_given) |
424 |
> |
write_into_file(outfile, "step", args_info->step_orig, 0); |
425 |
> |
if (args_info->nbins_given) |
426 |
> |
write_into_file(outfile, "nbins", args_info->nbins_orig, 0); |
427 |
> |
if (args_info->nbins_x_given) |
428 |
> |
write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); |
429 |
> |
if (args_info->nbins_y_given) |
430 |
> |
write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); |
431 |
> |
if (args_info->nbins_z_given) |
432 |
> |
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
433 |
> |
if (args_info->nanglebins_given) |
434 |
> |
write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); |
435 |
> |
if (args_info->rcut_given) |
436 |
> |
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
437 |
> |
if (args_info->dz_given) |
438 |
> |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
439 |
> |
if (args_info->length_given) |
440 |
> |
write_into_file(outfile, "length", args_info->length_orig, 0); |
441 |
> |
if (args_info->zlength_given) |
442 |
> |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
443 |
> |
if (args_info->zoffset_given) |
444 |
> |
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
445 |
> |
if (args_info->sele1_given) |
446 |
> |
write_into_file(outfile, "sele1", args_info->sele1_orig, 0); |
447 |
> |
if (args_info->sele2_given) |
448 |
> |
write_into_file(outfile, "sele2", args_info->sele2_orig, 0); |
449 |
> |
if (args_info->sele3_given) |
450 |
> |
write_into_file(outfile, "sele3", args_info->sele3_orig, 0); |
451 |
> |
if (args_info->refsele_given) |
452 |
> |
write_into_file(outfile, "refsele", args_info->refsele_orig, 0); |
453 |
> |
if (args_info->comsele_given) |
454 |
> |
write_into_file(outfile, "comsele", args_info->comsele_orig, 0); |
455 |
> |
if (args_info->seleoffset_given) |
456 |
> |
write_into_file(outfile, "seleoffset", args_info->seleoffset_orig, 0); |
457 |
> |
if (args_info->molname_given) |
458 |
> |
write_into_file(outfile, "molname", args_info->molname_orig, 0); |
459 |
> |
if (args_info->begin_given) |
460 |
> |
write_into_file(outfile, "begin", args_info->begin_orig, 0); |
461 |
> |
if (args_info->end_given) |
462 |
> |
write_into_file(outfile, "end", args_info->end_orig, 0); |
463 |
> |
if (args_info->radius_given) |
464 |
> |
write_into_file(outfile, "radius", args_info->radius_orig, 0); |
465 |
> |
if (args_info->bo_given) |
466 |
> |
write_into_file(outfile, "bo", 0, 0 ); |
467 |
> |
if (args_info->bor_given) |
468 |
> |
write_into_file(outfile, "bor", 0, 0 ); |
469 |
> |
if (args_info->bad_given) |
470 |
> |
write_into_file(outfile, "bad", 0, 0 ); |
471 |
> |
if (args_info->count_given) |
472 |
> |
write_into_file(outfile, "count", 0, 0 ); |
473 |
> |
if (args_info->gofr_given) |
474 |
> |
write_into_file(outfile, "gofr", 0, 0 ); |
475 |
> |
if (args_info->gofz_given) |
476 |
> |
write_into_file(outfile, "gofz", 0, 0 ); |
477 |
> |
if (args_info->r_theta_given) |
478 |
> |
write_into_file(outfile, "r_theta", 0, 0 ); |
479 |
> |
if (args_info->r_omega_given) |
480 |
> |
write_into_file(outfile, "r_omega", 0, 0 ); |
481 |
> |
if (args_info->r_z_given) |
482 |
> |
write_into_file(outfile, "r_z", 0, 0 ); |
483 |
> |
if (args_info->theta_omega_given) |
484 |
> |
write_into_file(outfile, "theta_omega", 0, 0 ); |
485 |
> |
if (args_info->gxyz_given) |
486 |
> |
write_into_file(outfile, "gxyz", 0, 0 ); |
487 |
> |
if (args_info->twodgofr_given) |
488 |
> |
write_into_file(outfile, "twodgofr", 0, 0 ); |
489 |
> |
if (args_info->p2_given) |
490 |
> |
write_into_file(outfile, "p2", 0, 0 ); |
491 |
> |
if (args_info->rp2_given) |
492 |
> |
write_into_file(outfile, "rp2", 0, 0 ); |
493 |
> |
if (args_info->scd_given) |
494 |
> |
write_into_file(outfile, "scd", 0, 0 ); |
495 |
> |
if (args_info->density_given) |
496 |
> |
write_into_file(outfile, "density", 0, 0 ); |
497 |
> |
if (args_info->slab_density_given) |
498 |
> |
write_into_file(outfile, "slab_density", 0, 0 ); |
499 |
> |
if (args_info->p_angle_given) |
500 |
> |
write_into_file(outfile, "p_angle", 0, 0 ); |
501 |
> |
if (args_info->hxy_given) |
502 |
> |
write_into_file(outfile, "hxy", 0, 0 ); |
503 |
> |
if (args_info->rho_r_given) |
504 |
> |
write_into_file(outfile, "rho_r", 0, 0 ); |
505 |
> |
if (args_info->angle_r_given) |
506 |
> |
write_into_file(outfile, "angle_r", 0, 0 ); |
507 |
> |
if (args_info->hullvol_given) |
508 |
> |
write_into_file(outfile, "hullvol", 0, 0 ); |
509 |
> |
if (args_info->rodlength_given) |
510 |
> |
write_into_file(outfile, "rodlength", 0, 0 ); |
511 |
> |
if (args_info->tet_param_given) |
512 |
> |
write_into_file(outfile, "tet_param", 0, 0 ); |
513 |
> |
if (args_info->tet_param_z_given) |
514 |
> |
write_into_file(outfile, "tet_param_z", 0, 0 ); |
515 |
> |
|
516 |
|
|
517 |
+ |
i = EXIT_SUCCESS; |
518 |
+ |
return i; |
519 |
+ |
} |
520 |
+ |
|
521 |
+ |
int |
522 |
+ |
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
523 |
+ |
{ |
524 |
+ |
FILE *outfile; |
525 |
+ |
int i = 0; |
526 |
+ |
|
527 |
+ |
outfile = fopen(filename, "w"); |
528 |
+ |
|
529 |
+ |
if (!outfile) |
530 |
+ |
{ |
531 |
+ |
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); |
532 |
+ |
return EXIT_FAILURE; |
533 |
+ |
} |
534 |
+ |
|
535 |
+ |
i = cmdline_parser_dump(outfile, args_info); |
536 |
+ |
fclose (outfile); |
537 |
+ |
|
538 |
+ |
return i; |
539 |
+ |
} |
540 |
+ |
|
541 |
+ |
void |
542 |
+ |
cmdline_parser_free (struct gengetopt_args_info *args_info) |
543 |
+ |
{ |
544 |
+ |
cmdline_parser_release (args_info); |
545 |
+ |
} |
546 |
+ |
|
547 |
+ |
/** @brief replacement of strdup, which is not standard */ |
548 |
+ |
char * |
549 |
+ |
gengetopt_strdup (const char *s) |
550 |
+ |
{ |
551 |
+ |
char *result = 0; |
552 |
+ |
if (!s) |
553 |
+ |
return result; |
554 |
+ |
|
555 |
+ |
result = (char*)malloc(strlen(s) + 1); |
556 |
+ |
if (result == (char*)0) |
557 |
+ |
return (char*)0; |
558 |
+ |
strcpy(result, s); |
559 |
+ |
return result; |
560 |
+ |
} |
561 |
+ |
|
562 |
+ |
static void |
563 |
+ |
reset_group_staticProps(struct gengetopt_args_info *args_info) |
564 |
+ |
{ |
565 |
+ |
if (! args_info->staticProps_group_counter) |
566 |
+ |
return; |
567 |
+ |
|
568 |
+ |
args_info->bo_given = 0 ; |
569 |
+ |
args_info->bor_given = 0 ; |
570 |
+ |
args_info->bad_given = 0 ; |
571 |
+ |
args_info->count_given = 0 ; |
572 |
+ |
args_info->gofr_given = 0 ; |
573 |
+ |
args_info->gofz_given = 0 ; |
574 |
+ |
args_info->r_theta_given = 0 ; |
575 |
+ |
args_info->r_omega_given = 0 ; |
576 |
+ |
args_info->r_z_given = 0 ; |
577 |
+ |
args_info->theta_omega_given = 0 ; |
578 |
+ |
args_info->gxyz_given = 0 ; |
579 |
+ |
args_info->twodgofr_given = 0 ; |
580 |
+ |
args_info->p2_given = 0 ; |
581 |
+ |
args_info->rp2_given = 0 ; |
582 |
+ |
args_info->scd_given = 0 ; |
583 |
+ |
args_info->density_given = 0 ; |
584 |
+ |
args_info->slab_density_given = 0 ; |
585 |
+ |
args_info->p_angle_given = 0 ; |
586 |
+ |
args_info->hxy_given = 0 ; |
587 |
+ |
args_info->rho_r_given = 0 ; |
588 |
+ |
args_info->angle_r_given = 0 ; |
589 |
+ |
args_info->hullvol_given = 0 ; |
590 |
+ |
args_info->rodlength_given = 0 ; |
591 |
+ |
args_info->tet_param_given = 0 ; |
592 |
+ |
args_info->tet_param_z_given = 0 ; |
593 |
+ |
|
594 |
+ |
args_info->staticProps_group_counter = 0; |
595 |
+ |
} |
596 |
+ |
|
597 |
+ |
int |
598 |
+ |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
599 |
+ |
{ |
600 |
+ |
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
601 |
+ |
} |
602 |
+ |
|
603 |
+ |
int |
604 |
+ |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
605 |
+ |
struct cmdline_parser_params *params) |
606 |
+ |
{ |
607 |
+ |
int result; |
608 |
+ |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
609 |
+ |
|
610 |
+ |
if (result == EXIT_FAILURE) |
611 |
+ |
{ |
612 |
+ |
cmdline_parser_free (args_info); |
613 |
+ |
exit (EXIT_FAILURE); |
614 |
+ |
} |
615 |
+ |
|
616 |
+ |
return result; |
617 |
+ |
} |
618 |
+ |
|
619 |
+ |
int |
620 |
+ |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
621 |
+ |
{ |
622 |
+ |
int result; |
623 |
+ |
struct cmdline_parser_params params; |
624 |
+ |
|
625 |
+ |
params.override = override; |
626 |
+ |
params.initialize = initialize; |
627 |
+ |
params.check_required = check_required; |
628 |
+ |
params.check_ambiguity = 0; |
629 |
+ |
params.print_errors = 1; |
630 |
+ |
|
631 |
+ |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
632 |
+ |
|
633 |
+ |
if (result == EXIT_FAILURE) |
634 |
+ |
{ |
635 |
+ |
cmdline_parser_free (args_info); |
636 |
+ |
exit (EXIT_FAILURE); |
637 |
+ |
} |
638 |
+ |
|
639 |
+ |
return result; |
640 |
+ |
} |
641 |
+ |
|
642 |
+ |
int |
643 |
+ |
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) |
644 |
+ |
{ |
645 |
+ |
int result = EXIT_SUCCESS; |
646 |
+ |
|
647 |
+ |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
648 |
+ |
result = EXIT_FAILURE; |
649 |
+ |
|
650 |
+ |
if (result == EXIT_FAILURE) |
651 |
+ |
{ |
652 |
+ |
cmdline_parser_free (args_info); |
653 |
+ |
exit (EXIT_FAILURE); |
654 |
+ |
} |
655 |
+ |
|
656 |
+ |
return result; |
657 |
+ |
} |
658 |
+ |
|
659 |
+ |
int |
660 |
+ |
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
661 |
+ |
{ |
662 |
+ |
int error = 0; |
663 |
+ |
FIX_UNUSED (additional_error); |
664 |
+ |
|
665 |
+ |
/* checks for required options */ |
666 |
+ |
if (! args_info->input_given) |
667 |
+ |
{ |
668 |
+ |
fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
669 |
+ |
error = 1; |
670 |
+ |
} |
671 |
+ |
|
672 |
+ |
if (args_info->staticProps_group_counter == 0) |
673 |
+ |
{ |
674 |
+ |
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 : "")); |
675 |
+ |
error = 1; |
676 |
+ |
} |
677 |
+ |
|
678 |
+ |
|
679 |
+ |
/* checks for dependences among options */ |
680 |
+ |
|
681 |
+ |
return error; |
682 |
+ |
} |
683 |
+ |
|
684 |
+ |
|
685 |
+ |
static char *package_name = 0; |
686 |
+ |
|
687 |
+ |
/** |
688 |
+ |
* @brief updates an option |
689 |
+ |
* @param field the generic pointer to the field to update |
690 |
+ |
* @param orig_field the pointer to the orig field |
691 |
+ |
* @param field_given the pointer to the number of occurrence of this option |
692 |
+ |
* @param prev_given the pointer to the number of occurrence already seen |
693 |
+ |
* @param value the argument for this option (if null no arg was specified) |
694 |
+ |
* @param possible_values the possible values for this option (if specified) |
695 |
+ |
* @param default_value the default value (in case the option only accepts fixed values) |
696 |
+ |
* @param arg_type the type of this option |
697 |
+ |
* @param check_ambiguity @see cmdline_parser_params.check_ambiguity |
698 |
+ |
* @param override @see cmdline_parser_params.override |
699 |
+ |
* @param no_free whether to free a possible previous value |
700 |
+ |
* @param multiple_option whether this is a multiple option |
701 |
+ |
* @param long_opt the corresponding long option |
702 |
+ |
* @param short_opt the corresponding short option (or '-' if none) |
703 |
+ |
* @param additional_error possible further error specification |
704 |
+ |
*/ |
705 |
+ |
static |
706 |
+ |
int update_arg(void *field, char **orig_field, |
707 |
+ |
unsigned int *field_given, unsigned int *prev_given, |
708 |
+ |
char *value, const char *possible_values[], |
709 |
+ |
const char *default_value, |
710 |
+ |
cmdline_parser_arg_type arg_type, |
711 |
+ |
int check_ambiguity, int override, |
712 |
+ |
int no_free, int multiple_option, |
713 |
+ |
const char *long_opt, char short_opt, |
714 |
+ |
const char *additional_error) |
715 |
+ |
{ |
716 |
+ |
char *stop_char = 0; |
717 |
+ |
const char *val = value; |
718 |
+ |
int found; |
719 |
+ |
char **string_field; |
720 |
+ |
FIX_UNUSED (field); |
721 |
+ |
|
722 |
+ |
stop_char = 0; |
723 |
+ |
found = 0; |
724 |
+ |
|
725 |
+ |
if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) |
726 |
+ |
{ |
727 |
+ |
if (short_opt != '-') |
728 |
+ |
fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", |
729 |
+ |
package_name, long_opt, short_opt, |
730 |
+ |
(additional_error ? additional_error : "")); |
731 |
+ |
else |
732 |
+ |
fprintf (stderr, "%s: `--%s' option given more than once%s\n", |
733 |
+ |
package_name, long_opt, |
734 |
+ |
(additional_error ? additional_error : "")); |
735 |
+ |
return 1; /* failure */ |
736 |
+ |
} |
737 |
+ |
|
738 |
+ |
FIX_UNUSED (default_value); |
739 |
+ |
|
740 |
+ |
if (field_given && *field_given && ! override) |
741 |
+ |
return 0; |
742 |
+ |
if (prev_given) |
743 |
+ |
(*prev_given)++; |
744 |
+ |
if (field_given) |
745 |
+ |
(*field_given)++; |
746 |
+ |
if (possible_values) |
747 |
+ |
val = possible_values[found]; |
748 |
+ |
|
749 |
+ |
switch(arg_type) { |
750 |
+ |
case ARG_INT: |
751 |
+ |
if (val) *((int *)field) = strtol (val, &stop_char, 0); |
752 |
+ |
break; |
753 |
+ |
case ARG_DOUBLE: |
754 |
+ |
if (val) *((double *)field) = strtod (val, &stop_char); |
755 |
+ |
break; |
756 |
+ |
case ARG_STRING: |
757 |
+ |
if (val) { |
758 |
+ |
string_field = (char **)field; |
759 |
+ |
if (!no_free && *string_field) |
760 |
+ |
free (*string_field); /* free previous string */ |
761 |
+ |
*string_field = gengetopt_strdup (val); |
762 |
+ |
} |
763 |
+ |
break; |
764 |
+ |
default: |
765 |
+ |
break; |
766 |
+ |
}; |
767 |
+ |
|
768 |
+ |
/* check numeric conversion */ |
769 |
+ |
switch(arg_type) { |
770 |
+ |
case ARG_INT: |
771 |
+ |
case ARG_DOUBLE: |
772 |
+ |
if (val && !(stop_char && *stop_char == '\0')) { |
773 |
+ |
fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); |
774 |
+ |
return 1; /* failure */ |
775 |
+ |
} |
776 |
+ |
break; |
777 |
+ |
default: |
778 |
+ |
; |
779 |
+ |
}; |
780 |
+ |
|
781 |
+ |
/* store the original value */ |
782 |
+ |
switch(arg_type) { |
783 |
+ |
case ARG_NO: |
784 |
+ |
break; |
785 |
+ |
default: |
786 |
+ |
if (value && orig_field) { |
787 |
+ |
if (no_free) { |
788 |
+ |
*orig_field = value; |
789 |
+ |
} else { |
790 |
+ |
if (*orig_field) |
791 |
+ |
free (*orig_field); /* free previous string */ |
792 |
+ |
*orig_field = gengetopt_strdup (value); |
793 |
+ |
} |
794 |
+ |
} |
795 |
+ |
}; |
796 |
+ |
|
797 |
+ |
return 0; /* OK */ |
798 |
+ |
} |
799 |
+ |
|
800 |
+ |
|
801 |
+ |
int |
802 |
+ |
cmdline_parser_internal ( |
803 |
+ |
int argc, char **argv, struct gengetopt_args_info *args_info, |
804 |
+ |
struct cmdline_parser_params *params, const char *additional_error) |
805 |
+ |
{ |
806 |
+ |
int c; /* Character of the parsed option. */ |
807 |
+ |
|
808 |
+ |
int error = 0; |
809 |
+ |
struct gengetopt_args_info local_args_info; |
810 |
+ |
|
811 |
+ |
int override; |
812 |
+ |
int initialize; |
813 |
+ |
int check_required; |
814 |
+ |
int check_ambiguity; |
815 |
+ |
|
816 |
+ |
package_name = argv[0]; |
817 |
+ |
|
818 |
+ |
override = params->override; |
819 |
+ |
initialize = params->initialize; |
820 |
+ |
check_required = params->check_required; |
821 |
+ |
check_ambiguity = params->check_ambiguity; |
822 |
+ |
|
823 |
+ |
if (initialize) |
824 |
+ |
cmdline_parser_init (args_info); |
825 |
+ |
|
826 |
+ |
cmdline_parser_init (&local_args_info); |
827 |
+ |
|
828 |
|
optarg = 0; |
829 |
< |
optind = 1; |
830 |
< |
opterr = 1; |
829 |
> |
optind = 0; |
830 |
> |
opterr = params->print_errors; |
831 |
|
optopt = '?'; |
832 |
|
|
833 |
|
while (1) |
834 |
|
{ |
835 |
|
int option_index = 0; |
134 |
– |
char *stop_char; |
836 |
|
|
837 |
|
static struct option long_options[] = { |
838 |
|
{ "help", 0, NULL, 'h' }, |
840 |
|
{ "input", 1, NULL, 'i' }, |
841 |
|
{ "output", 1, NULL, 'o' }, |
842 |
|
{ "step", 1, NULL, 'n' }, |
843 |
< |
{ "nrbins", 1, NULL, 'r' }, |
843 |
> |
{ "nbins", 1, NULL, 'b' }, |
844 |
> |
{ "nbins_x", 1, NULL, 'x' }, |
845 |
> |
{ "nbins_y", 1, NULL, 'y' }, |
846 |
> |
{ "nbins_z", 1, NULL, 0 }, |
847 |
|
{ "nanglebins", 1, NULL, 'a' }, |
848 |
< |
{ "length", 1, NULL, 'l' }, |
848 |
> |
{ "rcut", 1, NULL, 'c' }, |
849 |
> |
{ "dz", 1, NULL, 0 }, |
850 |
> |
{ "length", 1, NULL, 0 }, |
851 |
> |
{ "zlength", 1, NULL, 0 }, |
852 |
> |
{ "zoffset", 1, NULL, 'z' }, |
853 |
|
{ "sele1", 1, NULL, 0 }, |
854 |
|
{ "sele2", 1, NULL, 0 }, |
855 |
|
{ "sele3", 1, NULL, 0 }, |
856 |
|
{ "refsele", 1, NULL, 0 }, |
857 |
+ |
{ "comsele", 1, NULL, 0 }, |
858 |
+ |
{ "seleoffset", 1, NULL, 0 }, |
859 |
|
{ "molname", 1, NULL, 0 }, |
860 |
|
{ "begin", 1, NULL, 0 }, |
861 |
|
{ "end", 1, NULL, 0 }, |
862 |
< |
{ "gofr", 0, NULL, 0 }, |
862 |
> |
{ "radius", 1, NULL, 0 }, |
863 |
> |
{ "bo", 0, NULL, 0 }, |
864 |
> |
{ "bor", 0, NULL, 0 }, |
865 |
> |
{ "bad", 0, NULL, 0 }, |
866 |
> |
{ "count", 0, NULL, 0 }, |
867 |
> |
{ "gofr", 0, NULL, 'g' }, |
868 |
> |
{ "gofz", 0, NULL, 0 }, |
869 |
|
{ "r_theta", 0, NULL, 0 }, |
870 |
|
{ "r_omega", 0, NULL, 0 }, |
871 |
+ |
{ "r_z", 0, NULL, 0 }, |
872 |
|
{ "theta_omega", 0, NULL, 0 }, |
873 |
|
{ "gxyz", 0, NULL, 0 }, |
874 |
< |
{ "p2", 0, NULL, 0 }, |
875 |
< |
{ "scd", 0, NULL, 0 }, |
876 |
< |
{ "density", 0, NULL, 0 }, |
877 |
< |
{ NULL, 0, NULL, 0 } |
874 |
> |
{ "twodgofr", 0, NULL, 0 }, |
875 |
> |
{ "p2", 0, NULL, 'p' }, |
876 |
> |
{ "rp2", 0, NULL, 0 }, |
877 |
> |
{ "scd", 0, NULL, 's' }, |
878 |
> |
{ "density", 0, NULL, 'd' }, |
879 |
> |
{ "slab_density", 0, NULL, 0 }, |
880 |
> |
{ "p_angle", 0, NULL, 0 }, |
881 |
> |
{ "hxy", 0, NULL, 0 }, |
882 |
> |
{ "rho_r", 0, NULL, 0 }, |
883 |
> |
{ "angle_r", 0, NULL, 0 }, |
884 |
> |
{ "hullvol", 0, NULL, 0 }, |
885 |
> |
{ "rodlength", 0, NULL, 0 }, |
886 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
887 |
> |
{ "tet_param_z", 0, NULL, 0 }, |
888 |
> |
{ 0, 0, 0, 0 } |
889 |
|
}; |
890 |
|
|
891 |
< |
stop_char = 0; |
164 |
< |
c = getopt_long (argc, argv, "hVi:o:n:r:a:l:", long_options, &option_index); |
891 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
892 |
|
|
893 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
894 |
|
|
895 |
|
switch (c) |
896 |
|
{ |
897 |
|
case 'h': /* Print help and exit. */ |
171 |
– |
clear_args (); |
898 |
|
cmdline_parser_print_help (); |
899 |
+ |
cmdline_parser_free (&local_args_info); |
900 |
|
exit (EXIT_SUCCESS); |
901 |
|
|
902 |
|
case 'V': /* Print version and exit. */ |
176 |
– |
clear_args (); |
903 |
|
cmdline_parser_print_version (); |
904 |
+ |
cmdline_parser_free (&local_args_info); |
905 |
|
exit (EXIT_SUCCESS); |
906 |
|
|
907 |
|
case 'i': /* input dump file. */ |
908 |
< |
if (args_info->input_given) |
909 |
< |
{ |
910 |
< |
fprintf (stderr, "%s: `--input' (`-i') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
911 |
< |
clear_args (); |
912 |
< |
exit (EXIT_FAILURE); |
913 |
< |
} |
914 |
< |
args_info->input_given = 1; |
915 |
< |
args_info->input_arg = gengetopt_strdup (optarg); |
908 |
> |
|
909 |
> |
|
910 |
> |
if (update_arg( (void *)&(args_info->input_arg), |
911 |
> |
&(args_info->input_orig), &(args_info->input_given), |
912 |
> |
&(local_args_info.input_given), optarg, 0, 0, ARG_STRING, |
913 |
> |
check_ambiguity, override, 0, 0, |
914 |
> |
"input", 'i', |
915 |
> |
additional_error)) |
916 |
> |
goto failure; |
917 |
> |
|
918 |
|
break; |
190 |
– |
|
919 |
|
case 'o': /* output file name. */ |
920 |
< |
if (args_info->output_given) |
921 |
< |
{ |
922 |
< |
fprintf (stderr, "%s: `--output' (`-o') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
923 |
< |
clear_args (); |
924 |
< |
exit (EXIT_FAILURE); |
925 |
< |
} |
926 |
< |
args_info->output_given = 1; |
927 |
< |
args_info->output_arg = gengetopt_strdup (optarg); |
920 |
> |
|
921 |
> |
|
922 |
> |
if (update_arg( (void *)&(args_info->output_arg), |
923 |
> |
&(args_info->output_orig), &(args_info->output_given), |
924 |
> |
&(local_args_info.output_given), optarg, 0, 0, ARG_STRING, |
925 |
> |
check_ambiguity, override, 0, 0, |
926 |
> |
"output", 'o', |
927 |
> |
additional_error)) |
928 |
> |
goto failure; |
929 |
> |
|
930 |
|
break; |
201 |
– |
|
931 |
|
case 'n': /* process every n frame. */ |
932 |
< |
if (args_info->step_given) |
933 |
< |
{ |
934 |
< |
fprintf (stderr, "%s: `--step' (`-n') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
935 |
< |
clear_args (); |
936 |
< |
exit (EXIT_FAILURE); |
937 |
< |
} |
938 |
< |
args_info->step_given = 1; |
939 |
< |
args_info->step_arg = strtol (optarg,&stop_char,0); |
932 |
> |
|
933 |
> |
|
934 |
> |
if (update_arg( (void *)&(args_info->step_arg), |
935 |
> |
&(args_info->step_orig), &(args_info->step_given), |
936 |
> |
&(local_args_info.step_given), optarg, 0, "1", ARG_INT, |
937 |
> |
check_ambiguity, override, 0, 0, |
938 |
> |
"step", 'n', |
939 |
> |
additional_error)) |
940 |
> |
goto failure; |
941 |
> |
|
942 |
|
break; |
943 |
< |
|
944 |
< |
case 'r': /* number of bins for distance. */ |
945 |
< |
if (args_info->nrbins_given) |
946 |
< |
{ |
947 |
< |
fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
948 |
< |
clear_args (); |
949 |
< |
exit (EXIT_FAILURE); |
950 |
< |
} |
951 |
< |
args_info->nrbins_given = 1; |
952 |
< |
args_info->nrbins_arg = strtol (optarg,&stop_char,0); |
943 |
> |
case 'b': /* number of bins (general purpose). */ |
944 |
> |
|
945 |
> |
|
946 |
> |
if (update_arg( (void *)&(args_info->nbins_arg), |
947 |
> |
&(args_info->nbins_orig), &(args_info->nbins_given), |
948 |
> |
&(local_args_info.nbins_given), optarg, 0, "100", ARG_INT, |
949 |
> |
check_ambiguity, override, 0, 0, |
950 |
> |
"nbins", 'b', |
951 |
> |
additional_error)) |
952 |
> |
goto failure; |
953 |
> |
|
954 |
|
break; |
955 |
< |
|
955 |
> |
case 'x': /* number of bins in x axis. */ |
956 |
> |
|
957 |
> |
|
958 |
> |
if (update_arg( (void *)&(args_info->nbins_x_arg), |
959 |
> |
&(args_info->nbins_x_orig), &(args_info->nbins_x_given), |
960 |
> |
&(local_args_info.nbins_x_given), optarg, 0, "100", ARG_INT, |
961 |
> |
check_ambiguity, override, 0, 0, |
962 |
> |
"nbins_x", 'x', |
963 |
> |
additional_error)) |
964 |
> |
goto failure; |
965 |
> |
|
966 |
> |
break; |
967 |
> |
case 'y': /* number of bins in y axis. */ |
968 |
> |
|
969 |
> |
|
970 |
> |
if (update_arg( (void *)&(args_info->nbins_y_arg), |
971 |
> |
&(args_info->nbins_y_orig), &(args_info->nbins_y_given), |
972 |
> |
&(local_args_info.nbins_y_given), optarg, 0, "100", ARG_INT, |
973 |
> |
check_ambiguity, override, 0, 0, |
974 |
> |
"nbins_y", 'y', |
975 |
> |
additional_error)) |
976 |
> |
goto failure; |
977 |
> |
|
978 |
> |
break; |
979 |
|
case 'a': /* number of bins for cos(angle). */ |
980 |
< |
if (args_info->nanglebins_given) |
981 |
< |
{ |
982 |
< |
fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
983 |
< |
clear_args (); |
984 |
< |
exit (EXIT_FAILURE); |
985 |
< |
} |
986 |
< |
args_info->nanglebins_given = 1; |
987 |
< |
args_info->nanglebins_arg = strtol (optarg,&stop_char,0); |
980 |
> |
|
981 |
> |
|
982 |
> |
if (update_arg( (void *)&(args_info->nanglebins_arg), |
983 |
> |
&(args_info->nanglebins_orig), &(args_info->nanglebins_given), |
984 |
> |
&(local_args_info.nanglebins_given), optarg, 0, "50", ARG_INT, |
985 |
> |
check_ambiguity, override, 0, 0, |
986 |
> |
"nanglebins", 'a', |
987 |
> |
additional_error)) |
988 |
> |
goto failure; |
989 |
> |
|
990 |
|
break; |
991 |
< |
|
992 |
< |
case 'l': /* maximum length (Defaults to 1/2 smallest length of first frame). */ |
993 |
< |
if (args_info->length_given) |
994 |
< |
{ |
995 |
< |
fprintf (stderr, "%s: `--length' (`-l') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
996 |
< |
clear_args (); |
997 |
< |
exit (EXIT_FAILURE); |
998 |
< |
} |
999 |
< |
args_info->length_given = 1; |
1000 |
< |
args_info->length_arg = strtod (optarg, NULL); |
991 |
> |
case 'c': /* cutoff radius (rcut). */ |
992 |
> |
|
993 |
> |
|
994 |
> |
if (update_arg( (void *)&(args_info->rcut_arg), |
995 |
> |
&(args_info->rcut_orig), &(args_info->rcut_given), |
996 |
> |
&(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE, |
997 |
> |
check_ambiguity, override, 0, 0, |
998 |
> |
"rcut", 'c', |
999 |
> |
additional_error)) |
1000 |
> |
goto failure; |
1001 |
> |
|
1002 |
|
break; |
1003 |
+ |
case 'z': /* Where to set the zero for the slab_density calculation. */ |
1004 |
+ |
|
1005 |
+ |
|
1006 |
+ |
if (update_arg( (void *)&(args_info->zoffset_arg), |
1007 |
+ |
&(args_info->zoffset_orig), &(args_info->zoffset_given), |
1008 |
+ |
&(local_args_info.zoffset_given), optarg, 0, "0", ARG_DOUBLE, |
1009 |
+ |
check_ambiguity, override, 0, 0, |
1010 |
+ |
"zoffset", 'z', |
1011 |
+ |
additional_error)) |
1012 |
+ |
goto failure; |
1013 |
+ |
|
1014 |
+ |
break; |
1015 |
+ |
case 'g': /* g(r). */ |
1016 |
+ |
|
1017 |
+ |
if (args_info->staticProps_group_counter && override) |
1018 |
+ |
reset_group_staticProps (args_info); |
1019 |
+ |
args_info->staticProps_group_counter += 1; |
1020 |
+ |
|
1021 |
+ |
if (update_arg( 0 , |
1022 |
+ |
0 , &(args_info->gofr_given), |
1023 |
+ |
&(local_args_info.gofr_given), optarg, 0, 0, ARG_NO, |
1024 |
+ |
check_ambiguity, override, 0, 0, |
1025 |
+ |
"gofr", 'g', |
1026 |
+ |
additional_error)) |
1027 |
+ |
goto failure; |
1028 |
+ |
|
1029 |
+ |
break; |
1030 |
+ |
case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ |
1031 |
+ |
|
1032 |
+ |
if (args_info->staticProps_group_counter && override) |
1033 |
+ |
reset_group_staticProps (args_info); |
1034 |
+ |
args_info->staticProps_group_counter += 1; |
1035 |
+ |
|
1036 |
+ |
if (update_arg( 0 , |
1037 |
+ |
0 , &(args_info->p2_given), |
1038 |
+ |
&(local_args_info.p2_given), optarg, 0, 0, ARG_NO, |
1039 |
+ |
check_ambiguity, override, 0, 0, |
1040 |
+ |
"p2", 'p', |
1041 |
+ |
additional_error)) |
1042 |
+ |
goto failure; |
1043 |
+ |
|
1044 |
+ |
break; |
1045 |
+ |
case 's': /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */ |
1046 |
+ |
|
1047 |
+ |
if (args_info->staticProps_group_counter && override) |
1048 |
+ |
reset_group_staticProps (args_info); |
1049 |
+ |
args_info->staticProps_group_counter += 1; |
1050 |
+ |
|
1051 |
+ |
if (update_arg( 0 , |
1052 |
+ |
0 , &(args_info->scd_given), |
1053 |
+ |
&(local_args_info.scd_given), optarg, 0, 0, ARG_NO, |
1054 |
+ |
check_ambiguity, override, 0, 0, |
1055 |
+ |
"scd", 's', |
1056 |
+ |
additional_error)) |
1057 |
+ |
goto failure; |
1058 |
+ |
|
1059 |
+ |
break; |
1060 |
+ |
case 'd': /* density plot. */ |
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->density_given), |
1068 |
+ |
&(local_args_info.density_given), optarg, 0, 0, ARG_NO, |
1069 |
+ |
check_ambiguity, override, 0, 0, |
1070 |
+ |
"density", 'd', |
1071 |
+ |
additional_error)) |
1072 |
+ |
goto failure; |
1073 |
+ |
|
1074 |
+ |
break; |
1075 |
+ |
case 'Q': /* tetrahedrality order parameter. */ |
1076 |
+ |
|
1077 |
+ |
if (args_info->staticProps_group_counter && override) |
1078 |
+ |
reset_group_staticProps (args_info); |
1079 |
+ |
args_info->staticProps_group_counter += 1; |
1080 |
+ |
|
1081 |
+ |
if (update_arg( 0 , |
1082 |
+ |
0 , &(args_info->tet_param_given), |
1083 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
1084 |
+ |
check_ambiguity, override, 0, 0, |
1085 |
+ |
"tet_param", 'Q', |
1086 |
+ |
additional_error)) |
1087 |
+ |
goto failure; |
1088 |
+ |
|
1089 |
+ |
break; |
1090 |
|
|
246 |
– |
|
1091 |
|
case 0: /* Long option with no short option */ |
1092 |
< |
/* select the first stuntdouble set. */ |
1093 |
< |
if (strcmp (long_options[option_index].name, "sele1") == 0) |
1092 |
> |
/* number of bins in z axis. */ |
1093 |
> |
if (strcmp (long_options[option_index].name, "nbins_z") == 0) |
1094 |
|
{ |
1095 |
< |
if (args_info->sele1_given) |
1096 |
< |
{ |
1097 |
< |
fprintf (stderr, "%s: `--sele1' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
1098 |
< |
clear_args (); |
1099 |
< |
exit (EXIT_FAILURE); |
1100 |
< |
} |
1101 |
< |
args_info->sele1_given = 1; |
1102 |
< |
args_info->sele1_arg = gengetopt_strdup (optarg); |
1103 |
< |
break; |
1095 |
> |
|
1096 |
> |
|
1097 |
> |
if (update_arg( (void *)&(args_info->nbins_z_arg), |
1098 |
> |
&(args_info->nbins_z_orig), &(args_info->nbins_z_given), |
1099 |
> |
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
1100 |
> |
check_ambiguity, override, 0, 0, |
1101 |
> |
"nbins_z", '-', |
1102 |
> |
additional_error)) |
1103 |
> |
goto failure; |
1104 |
> |
|
1105 |
|
} |
1106 |
+ |
/* slab width (dz). */ |
1107 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
1108 |
+ |
{ |
1109 |
|
|
1110 |
+ |
|
1111 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
1112 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
1113 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
1114 |
+ |
check_ambiguity, override, 0, 0, |
1115 |
+ |
"dz", '-', |
1116 |
+ |
additional_error)) |
1117 |
+ |
goto failure; |
1118 |
+ |
|
1119 |
+ |
} |
1120 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1121 |
+ |
else if (strcmp (long_options[option_index].name, "length") == 0) |
1122 |
+ |
{ |
1123 |
+ |
|
1124 |
+ |
|
1125 |
+ |
if (update_arg( (void *)&(args_info->length_arg), |
1126 |
+ |
&(args_info->length_orig), &(args_info->length_given), |
1127 |
+ |
&(local_args_info.length_given), optarg, 0, 0, ARG_DOUBLE, |
1128 |
+ |
check_ambiguity, override, 0, 0, |
1129 |
+ |
"length", '-', |
1130 |
+ |
additional_error)) |
1131 |
+ |
goto failure; |
1132 |
+ |
|
1133 |
+ |
} |
1134 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1135 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1136 |
+ |
{ |
1137 |
+ |
|
1138 |
+ |
|
1139 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1140 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1141 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1142 |
+ |
check_ambiguity, override, 0, 0, |
1143 |
+ |
"zlength", '-', |
1144 |
+ |
additional_error)) |
1145 |
+ |
goto failure; |
1146 |
+ |
|
1147 |
+ |
} |
1148 |
+ |
/* select the first stuntdouble set. */ |
1149 |
+ |
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1150 |
+ |
{ |
1151 |
+ |
|
1152 |
+ |
|
1153 |
+ |
if (update_arg( (void *)&(args_info->sele1_arg), |
1154 |
+ |
&(args_info->sele1_orig), &(args_info->sele1_given), |
1155 |
+ |
&(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING, |
1156 |
+ |
check_ambiguity, override, 0, 0, |
1157 |
+ |
"sele1", '-', |
1158 |
+ |
additional_error)) |
1159 |
+ |
goto failure; |
1160 |
+ |
|
1161 |
+ |
} |
1162 |
|
/* select the second stuntdouble set. */ |
1163 |
|
else if (strcmp (long_options[option_index].name, "sele2") == 0) |
1164 |
|
{ |
265 |
– |
if (args_info->sele2_given) |
266 |
– |
{ |
267 |
– |
fprintf (stderr, "%s: `--sele2' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
268 |
– |
clear_args (); |
269 |
– |
exit (EXIT_FAILURE); |
270 |
– |
} |
271 |
– |
args_info->sele2_given = 1; |
272 |
– |
args_info->sele2_arg = gengetopt_strdup (optarg); |
273 |
– |
break; |
274 |
– |
} |
1165 |
|
|
1166 |
+ |
|
1167 |
+ |
if (update_arg( (void *)&(args_info->sele2_arg), |
1168 |
+ |
&(args_info->sele2_orig), &(args_info->sele2_given), |
1169 |
+ |
&(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING, |
1170 |
+ |
check_ambiguity, override, 0, 0, |
1171 |
+ |
"sele2", '-', |
1172 |
+ |
additional_error)) |
1173 |
+ |
goto failure; |
1174 |
+ |
|
1175 |
+ |
} |
1176 |
|
/* select the third stuntdouble set. */ |
1177 |
|
else if (strcmp (long_options[option_index].name, "sele3") == 0) |
1178 |
|
{ |
279 |
– |
if (args_info->sele3_given) |
280 |
– |
{ |
281 |
– |
fprintf (stderr, "%s: `--sele3' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
282 |
– |
clear_args (); |
283 |
– |
exit (EXIT_FAILURE); |
284 |
– |
} |
285 |
– |
args_info->sele3_given = 1; |
286 |
– |
args_info->sele3_arg = gengetopt_strdup (optarg); |
287 |
– |
break; |
288 |
– |
} |
1179 |
|
|
1180 |
+ |
|
1181 |
+ |
if (update_arg( (void *)&(args_info->sele3_arg), |
1182 |
+ |
&(args_info->sele3_orig), &(args_info->sele3_given), |
1183 |
+ |
&(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING, |
1184 |
+ |
check_ambiguity, override, 0, 0, |
1185 |
+ |
"sele3", '-', |
1186 |
+ |
additional_error)) |
1187 |
+ |
goto failure; |
1188 |
+ |
|
1189 |
+ |
} |
1190 |
|
/* select reference (use and only use with --gxyz). */ |
1191 |
|
else if (strcmp (long_options[option_index].name, "refsele") == 0) |
1192 |
|
{ |
1193 |
< |
if (args_info->refsele_given) |
1194 |
< |
{ |
1195 |
< |
fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
1196 |
< |
clear_args (); |
1197 |
< |
exit (EXIT_FAILURE); |
1198 |
< |
} |
1199 |
< |
args_info->refsele_given = 1; |
1200 |
< |
args_info->refsele_arg = gengetopt_strdup (optarg); |
1201 |
< |
break; |
1193 |
> |
|
1194 |
> |
|
1195 |
> |
if (update_arg( (void *)&(args_info->refsele_arg), |
1196 |
> |
&(args_info->refsele_orig), &(args_info->refsele_given), |
1197 |
> |
&(local_args_info.refsele_given), optarg, 0, 0, ARG_STRING, |
1198 |
> |
check_ambiguity, override, 0, 0, |
1199 |
> |
"refsele", '-', |
1200 |
> |
additional_error)) |
1201 |
> |
goto failure; |
1202 |
> |
|
1203 |
|
} |
1204 |
+ |
/* select stunt doubles for center-of-mass reference point. */ |
1205 |
+ |
else if (strcmp (long_options[option_index].name, "comsele") == 0) |
1206 |
+ |
{ |
1207 |
|
|
1208 |
+ |
|
1209 |
+ |
if (update_arg( (void *)&(args_info->comsele_arg), |
1210 |
+ |
&(args_info->comsele_orig), &(args_info->comsele_given), |
1211 |
+ |
&(local_args_info.comsele_given), optarg, 0, 0, ARG_STRING, |
1212 |
+ |
check_ambiguity, override, 0, 0, |
1213 |
+ |
"comsele", '-', |
1214 |
+ |
additional_error)) |
1215 |
+ |
goto failure; |
1216 |
+ |
|
1217 |
+ |
} |
1218 |
+ |
/* global index offset for a second object (used to define a vector between sites in molecule). */ |
1219 |
+ |
else if (strcmp (long_options[option_index].name, "seleoffset") == 0) |
1220 |
+ |
{ |
1221 |
+ |
|
1222 |
+ |
|
1223 |
+ |
if (update_arg( (void *)&(args_info->seleoffset_arg), |
1224 |
+ |
&(args_info->seleoffset_orig), &(args_info->seleoffset_given), |
1225 |
+ |
&(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT, |
1226 |
+ |
check_ambiguity, override, 0, 0, |
1227 |
+ |
"seleoffset", '-', |
1228 |
+ |
additional_error)) |
1229 |
+ |
goto failure; |
1230 |
+ |
|
1231 |
+ |
} |
1232 |
|
/* molecule name. */ |
1233 |
|
else if (strcmp (long_options[option_index].name, "molname") == 0) |
1234 |
|
{ |
307 |
– |
if (args_info->molname_given) |
308 |
– |
{ |
309 |
– |
fprintf (stderr, "%s: `--molname' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
310 |
– |
clear_args (); |
311 |
– |
exit (EXIT_FAILURE); |
312 |
– |
} |
313 |
– |
args_info->molname_given = 1; |
314 |
– |
args_info->molname_arg = gengetopt_strdup (optarg); |
315 |
– |
break; |
316 |
– |
} |
1235 |
|
|
1236 |
< |
/* begin interanl index. */ |
1236 |
> |
|
1237 |
> |
if (update_arg( (void *)&(args_info->molname_arg), |
1238 |
> |
&(args_info->molname_orig), &(args_info->molname_given), |
1239 |
> |
&(local_args_info.molname_given), optarg, 0, 0, ARG_STRING, |
1240 |
> |
check_ambiguity, override, 0, 0, |
1241 |
> |
"molname", '-', |
1242 |
> |
additional_error)) |
1243 |
> |
goto failure; |
1244 |
> |
|
1245 |
> |
} |
1246 |
> |
/* begin internal index. */ |
1247 |
|
else if (strcmp (long_options[option_index].name, "begin") == 0) |
1248 |
|
{ |
321 |
– |
if (args_info->begin_given) |
322 |
– |
{ |
323 |
– |
fprintf (stderr, "%s: `--begin' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
324 |
– |
clear_args (); |
325 |
– |
exit (EXIT_FAILURE); |
326 |
– |
} |
327 |
– |
args_info->begin_given = 1; |
328 |
– |
args_info->begin_arg = strtol (optarg,&stop_char,0); |
329 |
– |
break; |
330 |
– |
} |
1249 |
|
|
1250 |
+ |
|
1251 |
+ |
if (update_arg( (void *)&(args_info->begin_arg), |
1252 |
+ |
&(args_info->begin_orig), &(args_info->begin_given), |
1253 |
+ |
&(local_args_info.begin_given), optarg, 0, 0, ARG_INT, |
1254 |
+ |
check_ambiguity, override, 0, 0, |
1255 |
+ |
"begin", '-', |
1256 |
+ |
additional_error)) |
1257 |
+ |
goto failure; |
1258 |
+ |
|
1259 |
+ |
} |
1260 |
|
/* end internal index. */ |
1261 |
|
else if (strcmp (long_options[option_index].name, "end") == 0) |
1262 |
|
{ |
335 |
– |
if (args_info->end_given) |
336 |
– |
{ |
337 |
– |
fprintf (stderr, "%s: `--end' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
338 |
– |
clear_args (); |
339 |
– |
exit (EXIT_FAILURE); |
340 |
– |
} |
341 |
– |
args_info->end_given = 1; |
342 |
– |
args_info->end_arg = strtol (optarg,&stop_char,0); |
343 |
– |
break; |
344 |
– |
} |
1263 |
|
|
1264 |
< |
/* g(r). */ |
1265 |
< |
else if (strcmp (long_options[option_index].name, "gofr") == 0) |
1264 |
> |
|
1265 |
> |
if (update_arg( (void *)&(args_info->end_arg), |
1266 |
> |
&(args_info->end_orig), &(args_info->end_given), |
1267 |
> |
&(local_args_info.end_given), optarg, 0, 0, ARG_INT, |
1268 |
> |
check_ambiguity, override, 0, 0, |
1269 |
> |
"end", '-', |
1270 |
> |
additional_error)) |
1271 |
> |
goto failure; |
1272 |
> |
|
1273 |
> |
} |
1274 |
> |
/* nanoparticle radius. */ |
1275 |
> |
else if (strcmp (long_options[option_index].name, "radius") == 0) |
1276 |
|
{ |
349 |
– |
if (args_info->gofr_given) |
350 |
– |
{ |
351 |
– |
fprintf (stderr, "%s: `--gofr' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
352 |
– |
clear_args (); |
353 |
– |
exit (EXIT_FAILURE); |
354 |
– |
} |
355 |
– |
args_info->gofr_given = 1; staticProps_group_counter += 1; |
1277 |
|
|
1278 |
< |
break; |
1278 |
> |
|
1279 |
> |
if (update_arg( (void *)&(args_info->radius_arg), |
1280 |
> |
&(args_info->radius_orig), &(args_info->radius_given), |
1281 |
> |
&(local_args_info.radius_given), optarg, 0, 0, ARG_DOUBLE, |
1282 |
> |
check_ambiguity, override, 0, 0, |
1283 |
> |
"radius", '-', |
1284 |
> |
additional_error)) |
1285 |
> |
goto failure; |
1286 |
> |
|
1287 |
|
} |
1288 |
+ |
/* bond order parameter (--rcut must be specified). */ |
1289 |
+ |
else if (strcmp (long_options[option_index].name, "bo") == 0) |
1290 |
+ |
{ |
1291 |
|
|
1292 |
+ |
if (args_info->staticProps_group_counter && override) |
1293 |
+ |
reset_group_staticProps (args_info); |
1294 |
+ |
args_info->staticProps_group_counter += 1; |
1295 |
+ |
|
1296 |
+ |
if (update_arg( 0 , |
1297 |
+ |
0 , &(args_info->bo_given), |
1298 |
+ |
&(local_args_info.bo_given), optarg, 0, 0, ARG_NO, |
1299 |
+ |
check_ambiguity, override, 0, 0, |
1300 |
+ |
"bo", '-', |
1301 |
+ |
additional_error)) |
1302 |
+ |
goto failure; |
1303 |
+ |
|
1304 |
+ |
} |
1305 |
+ |
/* bond order parameter as a function of radius (--rcut must be specified). */ |
1306 |
+ |
else if (strcmp (long_options[option_index].name, "bor") == 0) |
1307 |
+ |
{ |
1308 |
+ |
|
1309 |
+ |
if (args_info->staticProps_group_counter && override) |
1310 |
+ |
reset_group_staticProps (args_info); |
1311 |
+ |
args_info->staticProps_group_counter += 1; |
1312 |
+ |
|
1313 |
+ |
if (update_arg( 0 , |
1314 |
+ |
0 , &(args_info->bor_given), |
1315 |
+ |
&(local_args_info.bor_given), optarg, 0, 0, ARG_NO, |
1316 |
+ |
check_ambiguity, override, 0, 0, |
1317 |
+ |
"bor", '-', |
1318 |
+ |
additional_error)) |
1319 |
+ |
goto failure; |
1320 |
+ |
|
1321 |
+ |
} |
1322 |
+ |
/* N(theta) bond angle density within (--rcut must be specified). */ |
1323 |
+ |
else if (strcmp (long_options[option_index].name, "bad") == 0) |
1324 |
+ |
{ |
1325 |
+ |
|
1326 |
+ |
if (args_info->staticProps_group_counter && override) |
1327 |
+ |
reset_group_staticProps (args_info); |
1328 |
+ |
args_info->staticProps_group_counter += 1; |
1329 |
+ |
|
1330 |
+ |
if (update_arg( 0 , |
1331 |
+ |
0 , &(args_info->bad_given), |
1332 |
+ |
&(local_args_info.bad_given), optarg, 0, 0, ARG_NO, |
1333 |
+ |
check_ambiguity, override, 0, 0, |
1334 |
+ |
"bad", '-', |
1335 |
+ |
additional_error)) |
1336 |
+ |
goto failure; |
1337 |
+ |
|
1338 |
+ |
} |
1339 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
1340 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
1341 |
+ |
{ |
1342 |
+ |
|
1343 |
+ |
if (args_info->staticProps_group_counter && override) |
1344 |
+ |
reset_group_staticProps (args_info); |
1345 |
+ |
args_info->staticProps_group_counter += 1; |
1346 |
+ |
|
1347 |
+ |
if (update_arg( 0 , |
1348 |
+ |
0 , &(args_info->count_given), |
1349 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
1350 |
+ |
check_ambiguity, override, 0, 0, |
1351 |
+ |
"count", '-', |
1352 |
+ |
additional_error)) |
1353 |
+ |
goto failure; |
1354 |
+ |
|
1355 |
+ |
} |
1356 |
+ |
/* g(z). */ |
1357 |
+ |
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
1358 |
+ |
{ |
1359 |
+ |
|
1360 |
+ |
if (args_info->staticProps_group_counter && override) |
1361 |
+ |
reset_group_staticProps (args_info); |
1362 |
+ |
args_info->staticProps_group_counter += 1; |
1363 |
+ |
|
1364 |
+ |
if (update_arg( 0 , |
1365 |
+ |
0 , &(args_info->gofz_given), |
1366 |
+ |
&(local_args_info.gofz_given), optarg, 0, 0, ARG_NO, |
1367 |
+ |
check_ambiguity, override, 0, 0, |
1368 |
+ |
"gofz", '-', |
1369 |
+ |
additional_error)) |
1370 |
+ |
goto failure; |
1371 |
+ |
|
1372 |
+ |
} |
1373 |
|
/* g(r, cos(theta)). */ |
1374 |
|
else if (strcmp (long_options[option_index].name, "r_theta") == 0) |
1375 |
|
{ |
363 |
– |
if (args_info->r_theta_given) |
364 |
– |
{ |
365 |
– |
fprintf (stderr, "%s: `--r_theta' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
366 |
– |
clear_args (); |
367 |
– |
exit (EXIT_FAILURE); |
368 |
– |
} |
369 |
– |
args_info->r_theta_given = 1; staticProps_group_counter += 1; |
1376 |
|
|
1377 |
< |
break; |
1378 |
< |
} |
1377 |
> |
if (args_info->staticProps_group_counter && override) |
1378 |
> |
reset_group_staticProps (args_info); |
1379 |
> |
args_info->staticProps_group_counter += 1; |
1380 |
|
|
1381 |
+ |
if (update_arg( 0 , |
1382 |
+ |
0 , &(args_info->r_theta_given), |
1383 |
+ |
&(local_args_info.r_theta_given), optarg, 0, 0, ARG_NO, |
1384 |
+ |
check_ambiguity, override, 0, 0, |
1385 |
+ |
"r_theta", '-', |
1386 |
+ |
additional_error)) |
1387 |
+ |
goto failure; |
1388 |
+ |
|
1389 |
+ |
} |
1390 |
|
/* g(r, cos(omega)). */ |
1391 |
|
else if (strcmp (long_options[option_index].name, "r_omega") == 0) |
1392 |
|
{ |
377 |
– |
if (args_info->r_omega_given) |
378 |
– |
{ |
379 |
– |
fprintf (stderr, "%s: `--r_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
380 |
– |
clear_args (); |
381 |
– |
exit (EXIT_FAILURE); |
382 |
– |
} |
383 |
– |
args_info->r_omega_given = 1; staticProps_group_counter += 1; |
1393 |
|
|
1394 |
< |
break; |
1394 |
> |
if (args_info->staticProps_group_counter && override) |
1395 |
> |
reset_group_staticProps (args_info); |
1396 |
> |
args_info->staticProps_group_counter += 1; |
1397 |
> |
|
1398 |
> |
if (update_arg( 0 , |
1399 |
> |
0 , &(args_info->r_omega_given), |
1400 |
> |
&(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO, |
1401 |
> |
check_ambiguity, override, 0, 0, |
1402 |
> |
"r_omega", '-', |
1403 |
> |
additional_error)) |
1404 |
> |
goto failure; |
1405 |
> |
|
1406 |
|
} |
1407 |
+ |
/* g(r, z). */ |
1408 |
+ |
else if (strcmp (long_options[option_index].name, "r_z") == 0) |
1409 |
+ |
{ |
1410 |
|
|
1411 |
+ |
if (args_info->staticProps_group_counter && override) |
1412 |
+ |
reset_group_staticProps (args_info); |
1413 |
+ |
args_info->staticProps_group_counter += 1; |
1414 |
+ |
|
1415 |
+ |
if (update_arg( 0 , |
1416 |
+ |
0 , &(args_info->r_z_given), |
1417 |
+ |
&(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, |
1418 |
+ |
check_ambiguity, override, 0, 0, |
1419 |
+ |
"r_z", '-', |
1420 |
+ |
additional_error)) |
1421 |
+ |
goto failure; |
1422 |
+ |
|
1423 |
+ |
} |
1424 |
|
/* g(cos(theta), cos(omega)). */ |
1425 |
|
else if (strcmp (long_options[option_index].name, "theta_omega") == 0) |
1426 |
|
{ |
391 |
– |
if (args_info->theta_omega_given) |
392 |
– |
{ |
393 |
– |
fprintf (stderr, "%s: `--theta_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
394 |
– |
clear_args (); |
395 |
– |
exit (EXIT_FAILURE); |
396 |
– |
} |
397 |
– |
args_info->theta_omega_given = 1; staticProps_group_counter += 1; |
1427 |
|
|
1428 |
< |
break; |
1429 |
< |
} |
1428 |
> |
if (args_info->staticProps_group_counter && override) |
1429 |
> |
reset_group_staticProps (args_info); |
1430 |
> |
args_info->staticProps_group_counter += 1; |
1431 |
|
|
1432 |
+ |
if (update_arg( 0 , |
1433 |
+ |
0 , &(args_info->theta_omega_given), |
1434 |
+ |
&(local_args_info.theta_omega_given), optarg, 0, 0, ARG_NO, |
1435 |
+ |
check_ambiguity, override, 0, 0, |
1436 |
+ |
"theta_omega", '-', |
1437 |
+ |
additional_error)) |
1438 |
+ |
goto failure; |
1439 |
+ |
|
1440 |
+ |
} |
1441 |
|
/* g(x, y, z). */ |
1442 |
|
else if (strcmp (long_options[option_index].name, "gxyz") == 0) |
1443 |
|
{ |
405 |
– |
if (args_info->gxyz_given) |
406 |
– |
{ |
407 |
– |
fprintf (stderr, "%s: `--gxyz' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
408 |
– |
clear_args (); |
409 |
– |
exit (EXIT_FAILURE); |
410 |
– |
} |
411 |
– |
args_info->gxyz_given = 1; staticProps_group_counter += 1; |
1444 |
|
|
1445 |
< |
break; |
1446 |
< |
} |
1445 |
> |
if (args_info->staticProps_group_counter && override) |
1446 |
> |
reset_group_staticProps (args_info); |
1447 |
> |
args_info->staticProps_group_counter += 1; |
1448 |
|
|
1449 |
< |
/* p2 order parameter (--sele1 and --sele2 must be specified). */ |
1450 |
< |
else if (strcmp (long_options[option_index].name, "p2") == 0) |
1449 |
> |
if (update_arg( 0 , |
1450 |
> |
0 , &(args_info->gxyz_given), |
1451 |
> |
&(local_args_info.gxyz_given), optarg, 0, 0, ARG_NO, |
1452 |
> |
check_ambiguity, override, 0, 0, |
1453 |
> |
"gxyz", '-', |
1454 |
> |
additional_error)) |
1455 |
> |
goto failure; |
1456 |
> |
|
1457 |
> |
} |
1458 |
> |
/* 2D g(r) (Slab width --dz must be specified). */ |
1459 |
> |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
1460 |
|
{ |
419 |
– |
if (args_info->p2_given) |
420 |
– |
{ |
421 |
– |
fprintf (stderr, "%s: `--p2' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
422 |
– |
clear_args (); |
423 |
– |
exit (EXIT_FAILURE); |
424 |
– |
} |
425 |
– |
args_info->p2_given = 1; staticProps_group_counter += 1; |
1461 |
|
|
1462 |
< |
break; |
1462 |
> |
if (args_info->staticProps_group_counter && override) |
1463 |
> |
reset_group_staticProps (args_info); |
1464 |
> |
args_info->staticProps_group_counter += 1; |
1465 |
> |
|
1466 |
> |
if (update_arg( 0 , |
1467 |
> |
0 , &(args_info->twodgofr_given), |
1468 |
> |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
1469 |
> |
check_ambiguity, override, 0, 0, |
1470 |
> |
"twodgofr", '-', |
1471 |
> |
additional_error)) |
1472 |
> |
goto failure; |
1473 |
> |
|
1474 |
|
} |
1475 |
+ |
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1476 |
+ |
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1477 |
+ |
{ |
1478 |
|
|
1479 |
< |
/* scd order parameter(either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */ |
1480 |
< |
else if (strcmp (long_options[option_index].name, "scd") == 0) |
1479 |
> |
if (args_info->staticProps_group_counter && override) |
1480 |
> |
reset_group_staticProps (args_info); |
1481 |
> |
args_info->staticProps_group_counter += 1; |
1482 |
> |
|
1483 |
> |
if (update_arg( 0 , |
1484 |
> |
0 , &(args_info->rp2_given), |
1485 |
> |
&(local_args_info.rp2_given), optarg, 0, 0, ARG_NO, |
1486 |
> |
check_ambiguity, override, 0, 0, |
1487 |
> |
"rp2", '-', |
1488 |
> |
additional_error)) |
1489 |
> |
goto failure; |
1490 |
> |
|
1491 |
> |
} |
1492 |
> |
/* slab density. */ |
1493 |
> |
else if (strcmp (long_options[option_index].name, "slab_density") == 0) |
1494 |
|
{ |
433 |
– |
if (args_info->scd_given) |
434 |
– |
{ |
435 |
– |
fprintf (stderr, "%s: `--scd' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
436 |
– |
clear_args (); |
437 |
– |
exit (EXIT_FAILURE); |
438 |
– |
} |
439 |
– |
args_info->scd_given = 1; staticProps_group_counter += 1; |
1495 |
|
|
1496 |
< |
break; |
1496 |
> |
if (args_info->staticProps_group_counter && override) |
1497 |
> |
reset_group_staticProps (args_info); |
1498 |
> |
args_info->staticProps_group_counter += 1; |
1499 |
> |
|
1500 |
> |
if (update_arg( 0 , |
1501 |
> |
0 , &(args_info->slab_density_given), |
1502 |
> |
&(local_args_info.slab_density_given), optarg, 0, 0, ARG_NO, |
1503 |
> |
check_ambiguity, override, 0, 0, |
1504 |
> |
"slab_density", '-', |
1505 |
> |
additional_error)) |
1506 |
> |
goto failure; |
1507 |
> |
|
1508 |
|
} |
1509 |
+ |
/* p(cos(theta)). */ |
1510 |
+ |
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
1511 |
+ |
{ |
1512 |
|
|
1513 |
< |
/* density plot (--sele1 must be specified). */ |
1514 |
< |
else if (strcmp (long_options[option_index].name, "density") == 0) |
1513 |
> |
if (args_info->staticProps_group_counter && override) |
1514 |
> |
reset_group_staticProps (args_info); |
1515 |
> |
args_info->staticProps_group_counter += 1; |
1516 |
> |
|
1517 |
> |
if (update_arg( 0 , |
1518 |
> |
0 , &(args_info->p_angle_given), |
1519 |
> |
&(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, |
1520 |
> |
check_ambiguity, override, 0, 0, |
1521 |
> |
"p_angle", '-', |
1522 |
> |
additional_error)) |
1523 |
> |
goto failure; |
1524 |
> |
|
1525 |
> |
} |
1526 |
> |
/* hxy. */ |
1527 |
> |
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1528 |
|
{ |
447 |
– |
if (args_info->density_given) |
448 |
– |
{ |
449 |
– |
fprintf (stderr, "%s: `--density' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
450 |
– |
clear_args (); |
451 |
– |
exit (EXIT_FAILURE); |
452 |
– |
} |
453 |
– |
args_info->density_given = 1; staticProps_group_counter += 1; |
1529 |
|
|
1530 |
< |
break; |
1530 |
> |
if (args_info->staticProps_group_counter && override) |
1531 |
> |
reset_group_staticProps (args_info); |
1532 |
> |
args_info->staticProps_group_counter += 1; |
1533 |
> |
|
1534 |
> |
if (update_arg( 0 , |
1535 |
> |
0 , &(args_info->hxy_given), |
1536 |
> |
&(local_args_info.hxy_given), optarg, 0, 0, ARG_NO, |
1537 |
> |
check_ambiguity, override, 0, 0, |
1538 |
> |
"hxy", '-', |
1539 |
> |
additional_error)) |
1540 |
> |
goto failure; |
1541 |
> |
|
1542 |
|
} |
1543 |
+ |
/* rho of R. */ |
1544 |
+ |
else if (strcmp (long_options[option_index].name, "rho_r") == 0) |
1545 |
+ |
{ |
1546 |
|
|
1547 |
< |
|
1547 |
> |
if (args_info->staticProps_group_counter && override) |
1548 |
> |
reset_group_staticProps (args_info); |
1549 |
> |
args_info->staticProps_group_counter += 1; |
1550 |
> |
|
1551 |
> |
if (update_arg( 0 , |
1552 |
> |
0 , &(args_info->rho_r_given), |
1553 |
> |
&(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO, |
1554 |
> |
check_ambiguity, override, 0, 0, |
1555 |
> |
"rho_r", '-', |
1556 |
> |
additional_error)) |
1557 |
> |
goto failure; |
1558 |
> |
|
1559 |
> |
} |
1560 |
> |
/* angle of R. */ |
1561 |
> |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
1562 |
> |
{ |
1563 |
> |
|
1564 |
> |
if (args_info->staticProps_group_counter && override) |
1565 |
> |
reset_group_staticProps (args_info); |
1566 |
> |
args_info->staticProps_group_counter += 1; |
1567 |
> |
|
1568 |
> |
if (update_arg( 0 , |
1569 |
> |
0 , &(args_info->angle_r_given), |
1570 |
> |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
1571 |
> |
check_ambiguity, override, 0, 0, |
1572 |
> |
"angle_r", '-', |
1573 |
> |
additional_error)) |
1574 |
> |
goto failure; |
1575 |
> |
|
1576 |
> |
} |
1577 |
> |
/* hull volume of nanoparticle. */ |
1578 |
> |
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
1579 |
> |
{ |
1580 |
> |
|
1581 |
> |
if (args_info->staticProps_group_counter && override) |
1582 |
> |
reset_group_staticProps (args_info); |
1583 |
> |
args_info->staticProps_group_counter += 1; |
1584 |
> |
|
1585 |
> |
if (update_arg( 0 , |
1586 |
> |
0 , &(args_info->hullvol_given), |
1587 |
> |
&(local_args_info.hullvol_given), optarg, 0, 0, ARG_NO, |
1588 |
> |
check_ambiguity, override, 0, 0, |
1589 |
> |
"hullvol", '-', |
1590 |
> |
additional_error)) |
1591 |
> |
goto failure; |
1592 |
> |
|
1593 |
> |
} |
1594 |
> |
/* length of nanorod. */ |
1595 |
> |
else if (strcmp (long_options[option_index].name, "rodlength") == 0) |
1596 |
> |
{ |
1597 |
> |
|
1598 |
> |
if (args_info->staticProps_group_counter && override) |
1599 |
> |
reset_group_staticProps (args_info); |
1600 |
> |
args_info->staticProps_group_counter += 1; |
1601 |
> |
|
1602 |
> |
if (update_arg( 0 , |
1603 |
> |
0 , &(args_info->rodlength_given), |
1604 |
> |
&(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, |
1605 |
> |
check_ambiguity, override, 0, 0, |
1606 |
> |
"rodlength", '-', |
1607 |
> |
additional_error)) |
1608 |
> |
goto failure; |
1609 |
> |
|
1610 |
> |
} |
1611 |
> |
/* tetrahedrality order parameter by zbin(--sele1 must be specified). */ |
1612 |
> |
else if (strcmp (long_options[option_index].name, "tet_param_z") == 0) |
1613 |
> |
{ |
1614 |
> |
|
1615 |
> |
if (args_info->staticProps_group_counter && override) |
1616 |
> |
reset_group_staticProps (args_info); |
1617 |
> |
args_info->staticProps_group_counter += 1; |
1618 |
> |
|
1619 |
> |
if (update_arg( 0 , |
1620 |
> |
0 , &(args_info->tet_param_z_given), |
1621 |
> |
&(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO, |
1622 |
> |
check_ambiguity, override, 0, 0, |
1623 |
> |
"tet_param_z", '-', |
1624 |
> |
additional_error)) |
1625 |
> |
goto failure; |
1626 |
> |
|
1627 |
> |
} |
1628 |
> |
|
1629 |
> |
break; |
1630 |
|
case '?': /* Invalid option. */ |
1631 |
|
/* `getopt_long' already printed an error message. */ |
1632 |
< |
exit (EXIT_FAILURE); |
1632 |
> |
goto failure; |
1633 |
|
|
1634 |
|
default: /* bug: option not considered. */ |
1635 |
< |
fprintf (stderr, "%s: option unknown: %c\n", CMDLINE_PARSER_PACKAGE, c); |
1635 |
> |
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); |
1636 |
|
abort (); |
1637 |
|
} /* switch */ |
1638 |
|
} /* while */ |
1639 |
|
|
1640 |
< |
if ( staticProps_group_counter != 1) |
1640 |
> |
if (args_info->staticProps_group_counter > 1) |
1641 |
|
{ |
1642 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required\n", CMDLINE_PARSER_PACKAGE, staticProps_group_counter); |
1643 |
< |
missing_required_options = 1; |
1642 |
> |
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 : "")); |
1643 |
> |
error = 1; |
1644 |
|
} |
1645 |
|
|
1646 |
|
|
1647 |
< |
if (! args_info->input_given) |
1647 |
> |
|
1648 |
> |
if (check_required) |
1649 |
|
{ |
1650 |
< |
fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE); |
479 |
< |
missing_required_options = 1; |
1650 |
> |
error += cmdline_parser_required2 (args_info, argv[0], additional_error); |
1651 |
|
} |
481 |
– |
if ( missing_required_options ) |
482 |
– |
exit (EXIT_FAILURE); |
1652 |
|
|
1653 |
+ |
cmdline_parser_release (&local_args_info); |
1654 |
+ |
|
1655 |
+ |
if ( error ) |
1656 |
+ |
return (EXIT_FAILURE); |
1657 |
+ |
|
1658 |
+ |
if (optind < argc) |
1659 |
+ |
{ |
1660 |
+ |
int i = 0 ; |
1661 |
+ |
int found_prog_name = 0; |
1662 |
+ |
/* whether program name, i.e., argv[0], is in the remaining args |
1663 |
+ |
(this may happen with some implementations of getopt, |
1664 |
+ |
but surely not with the one included by gengetopt) */ |
1665 |
+ |
|
1666 |
+ |
i = optind; |
1667 |
+ |
while (i < argc) |
1668 |
+ |
if (argv[i++] == argv[0]) { |
1669 |
+ |
found_prog_name = 1; |
1670 |
+ |
break; |
1671 |
+ |
} |
1672 |
+ |
i = 0; |
1673 |
+ |
|
1674 |
+ |
args_info->inputs_num = argc - optind - found_prog_name; |
1675 |
+ |
args_info->inputs = |
1676 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1677 |
+ |
while (optind < argc) |
1678 |
+ |
if (argv[optind++] != argv[0]) |
1679 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1680 |
+ |
} |
1681 |
+ |
|
1682 |
|
return 0; |
1683 |
+ |
|
1684 |
+ |
failure: |
1685 |
+ |
|
1686 |
+ |
cmdline_parser_release (&local_args_info); |
1687 |
+ |
return (EXIT_FAILURE); |
1688 |
|
} |