1 |
|
/* |
2 |
< |
File autogenerated by gengetopt version 2.19.1 |
2 |
> |
File autogenerated by gengetopt version 2.22 |
3 |
|
generated with the following command: |
4 |
< |
gengetopt --file-name=StaticPropsCmd -u |
4 |
> |
gengetopt -F StaticPropsCmd |
5 |
|
|
6 |
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
gengetopt output files to be in the public domain: |
23 |
|
|
24 |
|
const char *gengetopt_args_info_purpose = ""; |
25 |
|
|
26 |
< |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; |
26 |
> |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]..."; |
27 |
|
|
28 |
|
const char *gengetopt_args_info_description = ""; |
29 |
|
|
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 |
+ |
" --nbins_z=INT number of bins in z axis (default=`100')", |
40 |
|
" -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 |
+ |
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
43 |
+ |
" --zlength=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
44 |
|
" -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", |
45 |
|
" --sele1=selection script select the first stuntdouble set", |
46 |
|
" --sele2=selection script select the second stuntdouble set", |
47 |
|
" --sele3=selection script select the third stuntdouble set", |
48 |
|
" --refsele=selection script\n select reference (use and only use with --gxyz)", |
49 |
+ |
" --comsele=selection script\n select stunt doubles for center-of-mass \n reference point", |
50 |
|
" --molname=STRING molecule name", |
51 |
|
" --begin=INT begin internal index", |
52 |
|
" --end=INT end internal index", |
56 |
|
" --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
57 |
|
" --bad N(theta) bond angle density within (--rcut must \n be specified)", |
58 |
|
" -g, --gofr g(r)", |
59 |
+ |
" --gofz g(z)", |
60 |
|
" --r_theta g(r, cos(theta))", |
61 |
|
" --r_omega g(r, cos(omega))", |
62 |
+ |
" --r_z g(r, z)", |
63 |
|
" --theta_omega g(cos(theta), cos(omega))", |
64 |
|
" --gxyz g(x, y, z)", |
65 |
|
" -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
67 |
|
" -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
68 |
|
" -d, --density density plot", |
69 |
|
" --slab_density slab density", |
70 |
+ |
" --p_angle p(cos(theta))", |
71 |
|
" --hxy hxy", |
72 |
|
" --rho_r rho of R", |
73 |
|
" --hullvol hull volume of nanoparticle", |
74 |
|
0 |
75 |
|
}; |
76 |
|
|
77 |
+ |
typedef enum {ARG_NO |
78 |
+ |
, ARG_STRING |
79 |
+ |
, ARG_INT |
80 |
+ |
, ARG_DOUBLE |
81 |
+ |
} cmdline_parser_arg_type; |
82 |
+ |
|
83 |
|
static |
84 |
|
void clear_given (struct gengetopt_args_info *args_info); |
85 |
|
static |
86 |
|
void clear_args (struct gengetopt_args_info *args_info); |
87 |
|
|
88 |
|
static int |
89 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); |
89 |
> |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
90 |
> |
struct cmdline_parser_params *params, const char *additional_error); |
91 |
|
|
92 |
|
static int |
93 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
106 |
|
args_info->nbins_given = 0 ; |
107 |
|
args_info->nbins_x_given = 0 ; |
108 |
|
args_info->nbins_y_given = 0 ; |
109 |
+ |
args_info->nbins_z_given = 0 ; |
110 |
|
args_info->nanglebins_given = 0 ; |
97 |
– |
args_info->length_given = 0 ; |
111 |
|
args_info->rcut_given = 0 ; |
112 |
+ |
args_info->length_given = 0 ; |
113 |
+ |
args_info->zlength_given = 0 ; |
114 |
|
args_info->zoffset_given = 0 ; |
115 |
|
args_info->sele1_given = 0 ; |
116 |
|
args_info->sele2_given = 0 ; |
117 |
|
args_info->sele3_given = 0 ; |
118 |
|
args_info->refsele_given = 0 ; |
119 |
+ |
args_info->comsele_given = 0 ; |
120 |
|
args_info->molname_given = 0 ; |
121 |
|
args_info->begin_given = 0 ; |
122 |
|
args_info->end_given = 0 ; |
125 |
|
args_info->bor_given = 0 ; |
126 |
|
args_info->bad_given = 0 ; |
127 |
|
args_info->gofr_given = 0 ; |
128 |
+ |
args_info->gofz_given = 0 ; |
129 |
|
args_info->r_theta_given = 0 ; |
130 |
|
args_info->r_omega_given = 0 ; |
131 |
+ |
args_info->r_z_given = 0 ; |
132 |
|
args_info->theta_omega_given = 0 ; |
133 |
|
args_info->gxyz_given = 0 ; |
134 |
|
args_info->p2_given = 0 ; |
136 |
|
args_info->scd_given = 0 ; |
137 |
|
args_info->density_given = 0 ; |
138 |
|
args_info->slab_density_given = 0 ; |
139 |
+ |
args_info->p_angle_given = 0 ; |
140 |
|
args_info->hxy_given = 0 ; |
141 |
|
args_info->rho_r_given = 0 ; |
142 |
|
args_info->hullvol_given = 0 ; |
158 |
|
args_info->nbins_x_orig = NULL; |
159 |
|
args_info->nbins_y_arg = 100; |
160 |
|
args_info->nbins_y_orig = NULL; |
161 |
+ |
args_info->nbins_z_arg = 100; |
162 |
+ |
args_info->nbins_z_orig = NULL; |
163 |
|
args_info->nanglebins_arg = 50; |
164 |
|
args_info->nanglebins_orig = NULL; |
144 |
– |
args_info->length_orig = NULL; |
165 |
|
args_info->rcut_orig = NULL; |
166 |
+ |
args_info->length_orig = NULL; |
167 |
+ |
args_info->zlength_orig = NULL; |
168 |
|
args_info->zoffset_arg = 0; |
169 |
|
args_info->zoffset_orig = NULL; |
170 |
|
args_info->sele1_arg = NULL; |
175 |
|
args_info->sele3_orig = NULL; |
176 |
|
args_info->refsele_arg = NULL; |
177 |
|
args_info->refsele_orig = NULL; |
178 |
+ |
args_info->comsele_arg = NULL; |
179 |
+ |
args_info->comsele_orig = NULL; |
180 |
|
args_info->molname_arg = NULL; |
181 |
|
args_info->molname_orig = NULL; |
182 |
|
args_info->begin_orig = NULL; |
188 |
|
static |
189 |
|
void init_args_info(struct gengetopt_args_info *args_info) |
190 |
|
{ |
191 |
+ |
|
192 |
+ |
|
193 |
|
args_info->help_help = gengetopt_args_info_help[0] ; |
194 |
|
args_info->version_help = gengetopt_args_info_help[1] ; |
195 |
|
args_info->input_help = gengetopt_args_info_help[2] ; |
198 |
|
args_info->nbins_help = gengetopt_args_info_help[5] ; |
199 |
|
args_info->nbins_x_help = gengetopt_args_info_help[6] ; |
200 |
|
args_info->nbins_y_help = gengetopt_args_info_help[7] ; |
201 |
< |
args_info->nanglebins_help = gengetopt_args_info_help[8] ; |
202 |
< |
args_info->length_help = gengetopt_args_info_help[9] ; |
201 |
> |
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
202 |
> |
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
203 |
|
args_info->rcut_help = gengetopt_args_info_help[10] ; |
204 |
< |
args_info->zoffset_help = gengetopt_args_info_help[11] ; |
205 |
< |
args_info->sele1_help = gengetopt_args_info_help[12] ; |
206 |
< |
args_info->sele2_help = gengetopt_args_info_help[13] ; |
207 |
< |
args_info->sele3_help = gengetopt_args_info_help[14] ; |
208 |
< |
args_info->refsele_help = gengetopt_args_info_help[15] ; |
209 |
< |
args_info->molname_help = gengetopt_args_info_help[16] ; |
210 |
< |
args_info->begin_help = gengetopt_args_info_help[17] ; |
211 |
< |
args_info->end_help = gengetopt_args_info_help[18] ; |
212 |
< |
args_info->radius_help = gengetopt_args_info_help[19] ; |
213 |
< |
args_info->bo_help = gengetopt_args_info_help[20] ; |
214 |
< |
args_info->bor_help = gengetopt_args_info_help[21] ; |
215 |
< |
args_info->bad_help = gengetopt_args_info_help[22] ; |
216 |
< |
args_info->gofr_help = gengetopt_args_info_help[23] ; |
217 |
< |
args_info->r_theta_help = gengetopt_args_info_help[24] ; |
218 |
< |
args_info->r_omega_help = gengetopt_args_info_help[25] ; |
219 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[26] ; |
220 |
< |
args_info->gxyz_help = gengetopt_args_info_help[27] ; |
221 |
< |
args_info->p2_help = gengetopt_args_info_help[28] ; |
222 |
< |
args_info->rp2_help = gengetopt_args_info_help[29] ; |
223 |
< |
args_info->scd_help = gengetopt_args_info_help[30] ; |
224 |
< |
args_info->density_help = gengetopt_args_info_help[31] ; |
225 |
< |
args_info->slab_density_help = gengetopt_args_info_help[32] ; |
226 |
< |
args_info->hxy_help = gengetopt_args_info_help[33] ; |
227 |
< |
args_info->rho_r_help = gengetopt_args_info_help[34] ; |
228 |
< |
args_info->hullvol_help = gengetopt_args_info_help[35] ; |
204 |
> |
args_info->length_help = gengetopt_args_info_help[11] ; |
205 |
> |
args_info->zlength_help = gengetopt_args_info_help[12] ; |
206 |
> |
args_info->zoffset_help = gengetopt_args_info_help[13] ; |
207 |
> |
args_info->sele1_help = gengetopt_args_info_help[14] ; |
208 |
> |
args_info->sele2_help = gengetopt_args_info_help[15] ; |
209 |
> |
args_info->sele3_help = gengetopt_args_info_help[16] ; |
210 |
> |
args_info->refsele_help = gengetopt_args_info_help[17] ; |
211 |
> |
args_info->comsele_help = gengetopt_args_info_help[18] ; |
212 |
> |
args_info->molname_help = gengetopt_args_info_help[19] ; |
213 |
> |
args_info->begin_help = gengetopt_args_info_help[20] ; |
214 |
> |
args_info->end_help = gengetopt_args_info_help[21] ; |
215 |
> |
args_info->radius_help = gengetopt_args_info_help[22] ; |
216 |
> |
args_info->bo_help = gengetopt_args_info_help[24] ; |
217 |
> |
args_info->bor_help = gengetopt_args_info_help[25] ; |
218 |
> |
args_info->bad_help = gengetopt_args_info_help[26] ; |
219 |
> |
args_info->gofr_help = gengetopt_args_info_help[27] ; |
220 |
> |
args_info->gofz_help = gengetopt_args_info_help[28] ; |
221 |
> |
args_info->r_theta_help = gengetopt_args_info_help[29] ; |
222 |
> |
args_info->r_omega_help = gengetopt_args_info_help[30] ; |
223 |
> |
args_info->r_z_help = gengetopt_args_info_help[31] ; |
224 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[32] ; |
225 |
> |
args_info->gxyz_help = gengetopt_args_info_help[33] ; |
226 |
> |
args_info->p2_help = gengetopt_args_info_help[34] ; |
227 |
> |
args_info->rp2_help = gengetopt_args_info_help[35] ; |
228 |
> |
args_info->scd_help = gengetopt_args_info_help[36] ; |
229 |
> |
args_info->density_help = gengetopt_args_info_help[37] ; |
230 |
> |
args_info->slab_density_help = gengetopt_args_info_help[38] ; |
231 |
> |
args_info->p_angle_help = gengetopt_args_info_help[39] ; |
232 |
> |
args_info->hxy_help = gengetopt_args_info_help[40] ; |
233 |
> |
args_info->rho_r_help = gengetopt_args_info_help[41] ; |
234 |
> |
args_info->hullvol_help = gengetopt_args_info_help[42] ; |
235 |
|
|
236 |
|
} |
237 |
|
|
241 |
|
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
242 |
|
} |
243 |
|
|
244 |
< |
void |
213 |
< |
cmdline_parser_print_help (void) |
214 |
< |
{ |
215 |
< |
int i = 0; |
244 |
> |
static void print_help_common(void) { |
245 |
|
cmdline_parser_print_version (); |
246 |
|
|
247 |
|
if (strlen(gengetopt_args_info_purpose) > 0) |
248 |
|
printf("\n%s\n", gengetopt_args_info_purpose); |
249 |
|
|
250 |
< |
printf("\n%s\n\n", gengetopt_args_info_usage); |
250 |
> |
if (strlen(gengetopt_args_info_usage) > 0) |
251 |
> |
printf("\n%s\n", gengetopt_args_info_usage); |
252 |
|
|
253 |
+ |
printf("\n"); |
254 |
+ |
|
255 |
|
if (strlen(gengetopt_args_info_description) > 0) |
256 |
|
printf("%s\n", gengetopt_args_info_description); |
257 |
+ |
} |
258 |
|
|
259 |
+ |
void |
260 |
+ |
cmdline_parser_print_help (void) |
261 |
+ |
{ |
262 |
+ |
int i = 0; |
263 |
+ |
print_help_common(); |
264 |
|
while (gengetopt_args_info_help[i]) |
265 |
|
printf("%s\n", gengetopt_args_info_help[i++]); |
266 |
|
} |
271 |
|
clear_given (args_info); |
272 |
|
clear_args (args_info); |
273 |
|
init_args_info (args_info); |
274 |
+ |
} |
275 |
|
|
276 |
< |
args_info->inputs = NULL; |
277 |
< |
args_info->inputs_num = 0; |
276 |
> |
void |
277 |
> |
cmdline_parser_params_init(struct cmdline_parser_params *params) |
278 |
> |
{ |
279 |
> |
if (params) |
280 |
> |
{ |
281 |
> |
params->override = 0; |
282 |
> |
params->initialize = 1; |
283 |
> |
params->check_required = 1; |
284 |
> |
params->check_ambiguity = 0; |
285 |
> |
params->print_errors = 1; |
286 |
> |
} |
287 |
|
} |
288 |
|
|
289 |
+ |
struct cmdline_parser_params * |
290 |
+ |
cmdline_parser_params_create(void) |
291 |
+ |
{ |
292 |
+ |
struct cmdline_parser_params *params = |
293 |
+ |
(struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); |
294 |
+ |
cmdline_parser_params_init(params); |
295 |
+ |
return params; |
296 |
+ |
} |
297 |
+ |
|
298 |
|
static void |
299 |
< |
cmdline_parser_release (struct gengetopt_args_info *args_info) |
299 |
> |
free_string_field (char **s) |
300 |
|
{ |
301 |
< |
|
245 |
< |
unsigned int i; |
246 |
< |
if (args_info->input_arg) |
301 |
> |
if (*s) |
302 |
|
{ |
303 |
< |
free (args_info->input_arg); /* free previous argument */ |
304 |
< |
args_info->input_arg = 0; |
303 |
> |
free (*s); |
304 |
> |
*s = 0; |
305 |
|
} |
306 |
< |
if (args_info->input_orig) |
307 |
< |
{ |
308 |
< |
free (args_info->input_orig); /* free previous argument */ |
309 |
< |
args_info->input_orig = 0; |
310 |
< |
} |
311 |
< |
if (args_info->output_arg) |
312 |
< |
{ |
313 |
< |
free (args_info->output_arg); /* free previous argument */ |
314 |
< |
args_info->output_arg = 0; |
315 |
< |
} |
316 |
< |
if (args_info->output_orig) |
317 |
< |
{ |
318 |
< |
free (args_info->output_orig); /* free previous argument */ |
319 |
< |
args_info->output_orig = 0; |
320 |
< |
} |
321 |
< |
if (args_info->step_orig) |
322 |
< |
{ |
323 |
< |
free (args_info->step_orig); /* free previous argument */ |
324 |
< |
args_info->step_orig = 0; |
325 |
< |
} |
326 |
< |
if (args_info->nbins_orig) |
327 |
< |
{ |
328 |
< |
free (args_info->nbins_orig); /* free previous argument */ |
329 |
< |
args_info->nbins_orig = 0; |
330 |
< |
} |
331 |
< |
if (args_info->nbins_x_orig) |
332 |
< |
{ |
333 |
< |
free (args_info->nbins_x_orig); /* free previous argument */ |
334 |
< |
args_info->nbins_x_orig = 0; |
335 |
< |
} |
336 |
< |
if (args_info->nbins_y_orig) |
337 |
< |
{ |
338 |
< |
free (args_info->nbins_y_orig); /* free previous argument */ |
339 |
< |
args_info->nbins_y_orig = 0; |
340 |
< |
} |
341 |
< |
if (args_info->nanglebins_orig) |
287 |
< |
{ |
288 |
< |
free (args_info->nanglebins_orig); /* free previous argument */ |
289 |
< |
args_info->nanglebins_orig = 0; |
290 |
< |
} |
291 |
< |
if (args_info->length_orig) |
292 |
< |
{ |
293 |
< |
free (args_info->length_orig); /* free previous argument */ |
294 |
< |
args_info->length_orig = 0; |
295 |
< |
} |
296 |
< |
if (args_info->rcut_orig) |
297 |
< |
{ |
298 |
< |
free (args_info->rcut_orig); /* free previous argument */ |
299 |
< |
args_info->rcut_orig = 0; |
300 |
< |
} |
301 |
< |
if (args_info->zoffset_orig) |
302 |
< |
{ |
303 |
< |
free (args_info->zoffset_orig); /* free previous argument */ |
304 |
< |
args_info->zoffset_orig = 0; |
305 |
< |
} |
306 |
< |
if (args_info->sele1_arg) |
307 |
< |
{ |
308 |
< |
free (args_info->sele1_arg); /* free previous argument */ |
309 |
< |
args_info->sele1_arg = 0; |
310 |
< |
} |
311 |
< |
if (args_info->sele1_orig) |
312 |
< |
{ |
313 |
< |
free (args_info->sele1_orig); /* free previous argument */ |
314 |
< |
args_info->sele1_orig = 0; |
315 |
< |
} |
316 |
< |
if (args_info->sele2_arg) |
317 |
< |
{ |
318 |
< |
free (args_info->sele2_arg); /* free previous argument */ |
319 |
< |
args_info->sele2_arg = 0; |
320 |
< |
} |
321 |
< |
if (args_info->sele2_orig) |
322 |
< |
{ |
323 |
< |
free (args_info->sele2_orig); /* free previous argument */ |
324 |
< |
args_info->sele2_orig = 0; |
325 |
< |
} |
326 |
< |
if (args_info->sele3_arg) |
327 |
< |
{ |
328 |
< |
free (args_info->sele3_arg); /* free previous argument */ |
329 |
< |
args_info->sele3_arg = 0; |
330 |
< |
} |
331 |
< |
if (args_info->sele3_orig) |
332 |
< |
{ |
333 |
< |
free (args_info->sele3_orig); /* free previous argument */ |
334 |
< |
args_info->sele3_orig = 0; |
335 |
< |
} |
336 |
< |
if (args_info->refsele_arg) |
337 |
< |
{ |
338 |
< |
free (args_info->refsele_arg); /* free previous argument */ |
339 |
< |
args_info->refsele_arg = 0; |
340 |
< |
} |
341 |
< |
if (args_info->refsele_orig) |
342 |
< |
{ |
343 |
< |
free (args_info->refsele_orig); /* free previous argument */ |
344 |
< |
args_info->refsele_orig = 0; |
345 |
< |
} |
346 |
< |
if (args_info->molname_arg) |
347 |
< |
{ |
348 |
< |
free (args_info->molname_arg); /* free previous argument */ |
349 |
< |
args_info->molname_arg = 0; |
350 |
< |
} |
351 |
< |
if (args_info->molname_orig) |
352 |
< |
{ |
353 |
< |
free (args_info->molname_orig); /* free previous argument */ |
354 |
< |
args_info->molname_orig = 0; |
355 |
< |
} |
356 |
< |
if (args_info->begin_orig) |
357 |
< |
{ |
358 |
< |
free (args_info->begin_orig); /* free previous argument */ |
359 |
< |
args_info->begin_orig = 0; |
360 |
< |
} |
361 |
< |
if (args_info->end_orig) |
362 |
< |
{ |
363 |
< |
free (args_info->end_orig); /* free previous argument */ |
364 |
< |
args_info->end_orig = 0; |
365 |
< |
} |
366 |
< |
if (args_info->radius_orig) |
367 |
< |
{ |
368 |
< |
free (args_info->radius_orig); /* free previous argument */ |
369 |
< |
args_info->radius_orig = 0; |
370 |
< |
} |
306 |
> |
} |
307 |
> |
|
308 |
> |
|
309 |
> |
static void |
310 |
> |
cmdline_parser_release (struct gengetopt_args_info *args_info) |
311 |
> |
{ |
312 |
> |
|
313 |
> |
free_string_field (&(args_info->input_arg)); |
314 |
> |
free_string_field (&(args_info->input_orig)); |
315 |
> |
free_string_field (&(args_info->output_arg)); |
316 |
> |
free_string_field (&(args_info->output_orig)); |
317 |
> |
free_string_field (&(args_info->step_orig)); |
318 |
> |
free_string_field (&(args_info->nbins_orig)); |
319 |
> |
free_string_field (&(args_info->nbins_x_orig)); |
320 |
> |
free_string_field (&(args_info->nbins_y_orig)); |
321 |
> |
free_string_field (&(args_info->nbins_z_orig)); |
322 |
> |
free_string_field (&(args_info->nanglebins_orig)); |
323 |
> |
free_string_field (&(args_info->rcut_orig)); |
324 |
> |
free_string_field (&(args_info->length_orig)); |
325 |
> |
free_string_field (&(args_info->zlength_orig)); |
326 |
> |
free_string_field (&(args_info->zoffset_orig)); |
327 |
> |
free_string_field (&(args_info->sele1_arg)); |
328 |
> |
free_string_field (&(args_info->sele1_orig)); |
329 |
> |
free_string_field (&(args_info->sele2_arg)); |
330 |
> |
free_string_field (&(args_info->sele2_orig)); |
331 |
> |
free_string_field (&(args_info->sele3_arg)); |
332 |
> |
free_string_field (&(args_info->sele3_orig)); |
333 |
> |
free_string_field (&(args_info->refsele_arg)); |
334 |
> |
free_string_field (&(args_info->refsele_orig)); |
335 |
> |
free_string_field (&(args_info->comsele_arg)); |
336 |
> |
free_string_field (&(args_info->comsele_orig)); |
337 |
> |
free_string_field (&(args_info->molname_arg)); |
338 |
> |
free_string_field (&(args_info->molname_orig)); |
339 |
> |
free_string_field (&(args_info->begin_orig)); |
340 |
> |
free_string_field (&(args_info->end_orig)); |
341 |
> |
free_string_field (&(args_info->radius_orig)); |
342 |
|
|
372 |
– |
for (i = 0; i < args_info->inputs_num; ++i) |
373 |
– |
free (args_info->inputs [i]); |
343 |
|
|
344 |
< |
if (args_info->inputs_num) |
376 |
< |
free (args_info->inputs); |
377 |
< |
|
344 |
> |
|
345 |
|
clear_given (args_info); |
346 |
|
} |
347 |
|
|
348 |
+ |
|
349 |
+ |
static void |
350 |
+ |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
351 |
+ |
{ |
352 |
+ |
if (arg) { |
353 |
+ |
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
354 |
+ |
} else { |
355 |
+ |
fprintf(outfile, "%s\n", opt); |
356 |
+ |
} |
357 |
+ |
} |
358 |
+ |
|
359 |
+ |
|
360 |
|
int |
361 |
+ |
cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) |
362 |
+ |
{ |
363 |
+ |
int i = 0; |
364 |
+ |
|
365 |
+ |
if (!outfile) |
366 |
+ |
{ |
367 |
+ |
fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); |
368 |
+ |
return EXIT_FAILURE; |
369 |
+ |
} |
370 |
+ |
|
371 |
+ |
if (args_info->help_given) |
372 |
+ |
write_into_file(outfile, "help", 0, 0 ); |
373 |
+ |
if (args_info->version_given) |
374 |
+ |
write_into_file(outfile, "version", 0, 0 ); |
375 |
+ |
if (args_info->input_given) |
376 |
+ |
write_into_file(outfile, "input", args_info->input_orig, 0); |
377 |
+ |
if (args_info->output_given) |
378 |
+ |
write_into_file(outfile, "output", args_info->output_orig, 0); |
379 |
+ |
if (args_info->step_given) |
380 |
+ |
write_into_file(outfile, "step", args_info->step_orig, 0); |
381 |
+ |
if (args_info->nbins_given) |
382 |
+ |
write_into_file(outfile, "nbins", args_info->nbins_orig, 0); |
383 |
+ |
if (args_info->nbins_x_given) |
384 |
+ |
write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0); |
385 |
+ |
if (args_info->nbins_y_given) |
386 |
+ |
write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0); |
387 |
+ |
if (args_info->nbins_z_given) |
388 |
+ |
write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0); |
389 |
+ |
if (args_info->nanglebins_given) |
390 |
+ |
write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); |
391 |
+ |
if (args_info->rcut_given) |
392 |
+ |
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
393 |
+ |
if (args_info->length_given) |
394 |
+ |
write_into_file(outfile, "length", args_info->length_orig, 0); |
395 |
+ |
if (args_info->zlength_given) |
396 |
+ |
write_into_file(outfile, "zlength", args_info->zlength_orig, 0); |
397 |
+ |
if (args_info->zoffset_given) |
398 |
+ |
write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0); |
399 |
+ |
if (args_info->sele1_given) |
400 |
+ |
write_into_file(outfile, "sele1", args_info->sele1_orig, 0); |
401 |
+ |
if (args_info->sele2_given) |
402 |
+ |
write_into_file(outfile, "sele2", args_info->sele2_orig, 0); |
403 |
+ |
if (args_info->sele3_given) |
404 |
+ |
write_into_file(outfile, "sele3", args_info->sele3_orig, 0); |
405 |
+ |
if (args_info->refsele_given) |
406 |
+ |
write_into_file(outfile, "refsele", args_info->refsele_orig, 0); |
407 |
+ |
if (args_info->comsele_given) |
408 |
+ |
write_into_file(outfile, "comsele", args_info->comsele_orig, 0); |
409 |
+ |
if (args_info->molname_given) |
410 |
+ |
write_into_file(outfile, "molname", args_info->molname_orig, 0); |
411 |
+ |
if (args_info->begin_given) |
412 |
+ |
write_into_file(outfile, "begin", args_info->begin_orig, 0); |
413 |
+ |
if (args_info->end_given) |
414 |
+ |
write_into_file(outfile, "end", args_info->end_orig, 0); |
415 |
+ |
if (args_info->radius_given) |
416 |
+ |
write_into_file(outfile, "radius", args_info->radius_orig, 0); |
417 |
+ |
if (args_info->bo_given) |
418 |
+ |
write_into_file(outfile, "bo", 0, 0 ); |
419 |
+ |
if (args_info->bor_given) |
420 |
+ |
write_into_file(outfile, "bor", 0, 0 ); |
421 |
+ |
if (args_info->bad_given) |
422 |
+ |
write_into_file(outfile, "bad", 0, 0 ); |
423 |
+ |
if (args_info->gofr_given) |
424 |
+ |
write_into_file(outfile, "gofr", 0, 0 ); |
425 |
+ |
if (args_info->gofz_given) |
426 |
+ |
write_into_file(outfile, "gofz", 0, 0 ); |
427 |
+ |
if (args_info->r_theta_given) |
428 |
+ |
write_into_file(outfile, "r_theta", 0, 0 ); |
429 |
+ |
if (args_info->r_omega_given) |
430 |
+ |
write_into_file(outfile, "r_omega", 0, 0 ); |
431 |
+ |
if (args_info->r_z_given) |
432 |
+ |
write_into_file(outfile, "r_z", 0, 0 ); |
433 |
+ |
if (args_info->theta_omega_given) |
434 |
+ |
write_into_file(outfile, "theta_omega", 0, 0 ); |
435 |
+ |
if (args_info->gxyz_given) |
436 |
+ |
write_into_file(outfile, "gxyz", 0, 0 ); |
437 |
+ |
if (args_info->p2_given) |
438 |
+ |
write_into_file(outfile, "p2", 0, 0 ); |
439 |
+ |
if (args_info->rp2_given) |
440 |
+ |
write_into_file(outfile, "rp2", 0, 0 ); |
441 |
+ |
if (args_info->scd_given) |
442 |
+ |
write_into_file(outfile, "scd", 0, 0 ); |
443 |
+ |
if (args_info->density_given) |
444 |
+ |
write_into_file(outfile, "density", 0, 0 ); |
445 |
+ |
if (args_info->slab_density_given) |
446 |
+ |
write_into_file(outfile, "slab_density", 0, 0 ); |
447 |
+ |
if (args_info->p_angle_given) |
448 |
+ |
write_into_file(outfile, "p_angle", 0, 0 ); |
449 |
+ |
if (args_info->hxy_given) |
450 |
+ |
write_into_file(outfile, "hxy", 0, 0 ); |
451 |
+ |
if (args_info->rho_r_given) |
452 |
+ |
write_into_file(outfile, "rho_r", 0, 0 ); |
453 |
+ |
if (args_info->hullvol_given) |
454 |
+ |
write_into_file(outfile, "hullvol", 0, 0 ); |
455 |
+ |
|
456 |
+ |
|
457 |
+ |
i = EXIT_SUCCESS; |
458 |
+ |
return i; |
459 |
+ |
} |
460 |
+ |
|
461 |
+ |
int |
462 |
|
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
463 |
|
{ |
464 |
|
FILE *outfile; |
472 |
|
return EXIT_FAILURE; |
473 |
|
} |
474 |
|
|
475 |
< |
if (args_info->help_given) { |
396 |
< |
fprintf(outfile, "%s\n", "help"); |
397 |
< |
} |
398 |
< |
if (args_info->version_given) { |
399 |
< |
fprintf(outfile, "%s\n", "version"); |
400 |
< |
} |
401 |
< |
if (args_info->input_given) { |
402 |
< |
if (args_info->input_orig) { |
403 |
< |
fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); |
404 |
< |
} else { |
405 |
< |
fprintf(outfile, "%s\n", "input"); |
406 |
< |
} |
407 |
< |
} |
408 |
< |
if (args_info->output_given) { |
409 |
< |
if (args_info->output_orig) { |
410 |
< |
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
411 |
< |
} else { |
412 |
< |
fprintf(outfile, "%s\n", "output"); |
413 |
< |
} |
414 |
< |
} |
415 |
< |
if (args_info->step_given) { |
416 |
< |
if (args_info->step_orig) { |
417 |
< |
fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig); |
418 |
< |
} else { |
419 |
< |
fprintf(outfile, "%s\n", "step"); |
420 |
< |
} |
421 |
< |
} |
422 |
< |
if (args_info->nbins_given) { |
423 |
< |
if (args_info->nbins_orig) { |
424 |
< |
fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig); |
425 |
< |
} else { |
426 |
< |
fprintf(outfile, "%s\n", "nbins"); |
427 |
< |
} |
428 |
< |
} |
429 |
< |
if (args_info->nbins_x_given) { |
430 |
< |
if (args_info->nbins_x_orig) { |
431 |
< |
fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig); |
432 |
< |
} else { |
433 |
< |
fprintf(outfile, "%s\n", "nbins_x"); |
434 |
< |
} |
435 |
< |
} |
436 |
< |
if (args_info->nbins_y_given) { |
437 |
< |
if (args_info->nbins_y_orig) { |
438 |
< |
fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig); |
439 |
< |
} else { |
440 |
< |
fprintf(outfile, "%s\n", "nbins_y"); |
441 |
< |
} |
442 |
< |
} |
443 |
< |
if (args_info->nanglebins_given) { |
444 |
< |
if (args_info->nanglebins_orig) { |
445 |
< |
fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig); |
446 |
< |
} else { |
447 |
< |
fprintf(outfile, "%s\n", "nanglebins"); |
448 |
< |
} |
449 |
< |
} |
450 |
< |
if (args_info->length_given) { |
451 |
< |
if (args_info->length_orig) { |
452 |
< |
fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig); |
453 |
< |
} else { |
454 |
< |
fprintf(outfile, "%s\n", "length"); |
455 |
< |
} |
456 |
< |
} |
457 |
< |
if (args_info->rcut_given) { |
458 |
< |
if (args_info->rcut_orig) { |
459 |
< |
fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig); |
460 |
< |
} else { |
461 |
< |
fprintf(outfile, "%s\n", "rcut"); |
462 |
< |
} |
463 |
< |
} |
464 |
< |
if (args_info->zoffset_given) { |
465 |
< |
if (args_info->zoffset_orig) { |
466 |
< |
fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig); |
467 |
< |
} else { |
468 |
< |
fprintf(outfile, "%s\n", "zoffset"); |
469 |
< |
} |
470 |
< |
} |
471 |
< |
if (args_info->sele1_given) { |
472 |
< |
if (args_info->sele1_orig) { |
473 |
< |
fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); |
474 |
< |
} else { |
475 |
< |
fprintf(outfile, "%s\n", "sele1"); |
476 |
< |
} |
477 |
< |
} |
478 |
< |
if (args_info->sele2_given) { |
479 |
< |
if (args_info->sele2_orig) { |
480 |
< |
fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); |
481 |
< |
} else { |
482 |
< |
fprintf(outfile, "%s\n", "sele2"); |
483 |
< |
} |
484 |
< |
} |
485 |
< |
if (args_info->sele3_given) { |
486 |
< |
if (args_info->sele3_orig) { |
487 |
< |
fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig); |
488 |
< |
} else { |
489 |
< |
fprintf(outfile, "%s\n", "sele3"); |
490 |
< |
} |
491 |
< |
} |
492 |
< |
if (args_info->refsele_given) { |
493 |
< |
if (args_info->refsele_orig) { |
494 |
< |
fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig); |
495 |
< |
} else { |
496 |
< |
fprintf(outfile, "%s\n", "refsele"); |
497 |
< |
} |
498 |
< |
} |
499 |
< |
if (args_info->molname_given) { |
500 |
< |
if (args_info->molname_orig) { |
501 |
< |
fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig); |
502 |
< |
} else { |
503 |
< |
fprintf(outfile, "%s\n", "molname"); |
504 |
< |
} |
505 |
< |
} |
506 |
< |
if (args_info->begin_given) { |
507 |
< |
if (args_info->begin_orig) { |
508 |
< |
fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig); |
509 |
< |
} else { |
510 |
< |
fprintf(outfile, "%s\n", "begin"); |
511 |
< |
} |
512 |
< |
} |
513 |
< |
if (args_info->end_given) { |
514 |
< |
if (args_info->end_orig) { |
515 |
< |
fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig); |
516 |
< |
} else { |
517 |
< |
fprintf(outfile, "%s\n", "end"); |
518 |
< |
} |
519 |
< |
} |
520 |
< |
if (args_info->radius_given) { |
521 |
< |
if (args_info->radius_orig) { |
522 |
< |
fprintf(outfile, "%s=\"%s\"\n", "radius", args_info->radius_orig); |
523 |
< |
} else { |
524 |
< |
fprintf(outfile, "%s\n", "radius"); |
525 |
< |
} |
526 |
< |
} |
527 |
< |
if (args_info->bo_given) { |
528 |
< |
fprintf(outfile, "%s\n", "bo"); |
529 |
< |
} |
530 |
< |
if (args_info->bor_given) { |
531 |
< |
fprintf(outfile, "%s\n", "bor"); |
532 |
< |
} |
533 |
< |
if (args_info->bad_given) { |
534 |
< |
fprintf(outfile, "%s\n", "bad"); |
535 |
< |
} |
536 |
< |
if (args_info->gofr_given) { |
537 |
< |
fprintf(outfile, "%s\n", "gofr"); |
538 |
< |
} |
539 |
< |
if (args_info->r_theta_given) { |
540 |
< |
fprintf(outfile, "%s\n", "r_theta"); |
541 |
< |
} |
542 |
< |
if (args_info->r_omega_given) { |
543 |
< |
fprintf(outfile, "%s\n", "r_omega"); |
544 |
< |
} |
545 |
< |
if (args_info->theta_omega_given) { |
546 |
< |
fprintf(outfile, "%s\n", "theta_omega"); |
547 |
< |
} |
548 |
< |
if (args_info->gxyz_given) { |
549 |
< |
fprintf(outfile, "%s\n", "gxyz"); |
550 |
< |
} |
551 |
< |
if (args_info->p2_given) { |
552 |
< |
fprintf(outfile, "%s\n", "p2"); |
553 |
< |
} |
554 |
< |
if (args_info->rp2_given) { |
555 |
< |
fprintf(outfile, "%s\n", "rp2"); |
556 |
< |
} |
557 |
< |
if (args_info->scd_given) { |
558 |
< |
fprintf(outfile, "%s\n", "scd"); |
559 |
< |
} |
560 |
< |
if (args_info->density_given) { |
561 |
< |
fprintf(outfile, "%s\n", "density"); |
562 |
< |
} |
563 |
< |
if (args_info->slab_density_given) { |
564 |
< |
fprintf(outfile, "%s\n", "slab_density"); |
565 |
< |
} |
566 |
< |
if (args_info->hxy_given) { |
567 |
< |
fprintf(outfile, "%s\n", "hxy"); |
568 |
< |
} |
569 |
< |
if (args_info->rho_r_given) { |
570 |
< |
fprintf(outfile, "%s\n", "rho_r"); |
571 |
< |
} |
572 |
< |
if (args_info->hullvol_given) { |
573 |
< |
fprintf(outfile, "%s\n", "hullvol"); |
574 |
< |
} |
575 |
< |
|
475 |
> |
i = cmdline_parser_dump(outfile, args_info); |
476 |
|
fclose (outfile); |
477 |
|
|
578 |
– |
i = EXIT_SUCCESS; |
478 |
|
return i; |
479 |
|
} |
480 |
|
|
484 |
|
cmdline_parser_release (args_info); |
485 |
|
} |
486 |
|
|
487 |
< |
|
589 |
< |
/* gengetopt_strdup() */ |
590 |
< |
/* strdup.c replacement of strdup, which is not standard */ |
487 |
> |
/** @brief replacement of strdup, which is not standard */ |
488 |
|
char * |
489 |
|
gengetopt_strdup (const char *s) |
490 |
|
{ |
500 |
|
} |
501 |
|
|
502 |
|
static void |
606 |
– |
reset_group_staticProps(struct gengetopt_args_info *args_info); |
607 |
– |
|
608 |
– |
static void |
503 |
|
reset_group_staticProps(struct gengetopt_args_info *args_info) |
504 |
|
{ |
505 |
|
if (! args_info->staticProps_group_counter) |
509 |
|
args_info->bor_given = 0 ; |
510 |
|
args_info->bad_given = 0 ; |
511 |
|
args_info->gofr_given = 0 ; |
512 |
+ |
args_info->gofz_given = 0 ; |
513 |
|
args_info->r_theta_given = 0 ; |
514 |
|
args_info->r_omega_given = 0 ; |
515 |
+ |
args_info->r_z_given = 0 ; |
516 |
|
args_info->theta_omega_given = 0 ; |
517 |
|
args_info->gxyz_given = 0 ; |
518 |
|
args_info->p2_given = 0 ; |
520 |
|
args_info->scd_given = 0 ; |
521 |
|
args_info->density_given = 0 ; |
522 |
|
args_info->slab_density_given = 0 ; |
523 |
+ |
args_info->p_angle_given = 0 ; |
524 |
|
args_info->hxy_given = 0 ; |
525 |
|
args_info->rho_r_given = 0 ; |
526 |
|
args_info->hullvol_given = 0 ; |
535 |
|
} |
536 |
|
|
537 |
|
int |
538 |
+ |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
539 |
+ |
struct cmdline_parser_params *params) |
540 |
+ |
{ |
541 |
+ |
int result; |
542 |
+ |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
543 |
+ |
|
544 |
+ |
if (result == EXIT_FAILURE) |
545 |
+ |
{ |
546 |
+ |
cmdline_parser_free (args_info); |
547 |
+ |
exit (EXIT_FAILURE); |
548 |
+ |
} |
549 |
+ |
|
550 |
+ |
return result; |
551 |
+ |
} |
552 |
+ |
|
553 |
+ |
int |
554 |
|
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
555 |
|
{ |
556 |
|
int result; |
557 |
+ |
struct cmdline_parser_params params; |
558 |
+ |
|
559 |
+ |
params.override = override; |
560 |
+ |
params.initialize = initialize; |
561 |
+ |
params.check_required = check_required; |
562 |
+ |
params.check_ambiguity = 0; |
563 |
+ |
params.print_errors = 1; |
564 |
|
|
565 |
< |
result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); |
565 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
566 |
|
|
567 |
|
if (result == EXIT_FAILURE) |
568 |
|
{ |
614 |
|
return error; |
615 |
|
} |
616 |
|
|
617 |
+ |
|
618 |
+ |
static char *package_name = 0; |
619 |
+ |
|
620 |
+ |
/** |
621 |
+ |
* @brief updates an option |
622 |
+ |
* @param field the generic pointer to the field to update |
623 |
+ |
* @param orig_field the pointer to the orig field |
624 |
+ |
* @param field_given the pointer to the number of occurrence of this option |
625 |
+ |
* @param prev_given the pointer to the number of occurrence already seen |
626 |
+ |
* @param value the argument for this option (if null no arg was specified) |
627 |
+ |
* @param possible_values the possible values for this option (if specified) |
628 |
+ |
* @param default_value the default value (in case the option only accepts fixed values) |
629 |
+ |
* @param arg_type the type of this option |
630 |
+ |
* @param check_ambiguity @see cmdline_parser_params.check_ambiguity |
631 |
+ |
* @param override @see cmdline_parser_params.override |
632 |
+ |
* @param no_free whether to free a possible previous value |
633 |
+ |
* @param multiple_option whether this is a multiple option |
634 |
+ |
* @param long_opt the corresponding long option |
635 |
+ |
* @param short_opt the corresponding short option (or '-' if none) |
636 |
+ |
* @param additional_error possible further error specification |
637 |
+ |
*/ |
638 |
+ |
static |
639 |
+ |
int update_arg(void *field, char **orig_field, |
640 |
+ |
unsigned int *field_given, unsigned int *prev_given, |
641 |
+ |
char *value, char *possible_values[], const char *default_value, |
642 |
+ |
cmdline_parser_arg_type arg_type, |
643 |
+ |
int check_ambiguity, int override, |
644 |
+ |
int no_free, int multiple_option, |
645 |
+ |
const char *long_opt, char short_opt, |
646 |
+ |
const char *additional_error) |
647 |
+ |
{ |
648 |
+ |
char *stop_char = 0; |
649 |
+ |
const char *val = value; |
650 |
+ |
int found; |
651 |
+ |
char **string_field; |
652 |
+ |
|
653 |
+ |
stop_char = 0; |
654 |
+ |
found = 0; |
655 |
+ |
|
656 |
+ |
if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) |
657 |
+ |
{ |
658 |
+ |
if (short_opt != '-') |
659 |
+ |
fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", |
660 |
+ |
package_name, long_opt, short_opt, |
661 |
+ |
(additional_error ? additional_error : "")); |
662 |
+ |
else |
663 |
+ |
fprintf (stderr, "%s: `--%s' option given more than once%s\n", |
664 |
+ |
package_name, long_opt, |
665 |
+ |
(additional_error ? additional_error : "")); |
666 |
+ |
return 1; /* failure */ |
667 |
+ |
} |
668 |
+ |
|
669 |
+ |
|
670 |
+ |
if (field_given && *field_given && ! override) |
671 |
+ |
return 0; |
672 |
+ |
if (prev_given) |
673 |
+ |
(*prev_given)++; |
674 |
+ |
if (field_given) |
675 |
+ |
(*field_given)++; |
676 |
+ |
if (possible_values) |
677 |
+ |
val = possible_values[found]; |
678 |
+ |
|
679 |
+ |
switch(arg_type) { |
680 |
+ |
case ARG_INT: |
681 |
+ |
if (val) *((int *)field) = strtol (val, &stop_char, 0); |
682 |
+ |
break; |
683 |
+ |
case ARG_DOUBLE: |
684 |
+ |
if (val) *((double *)field) = strtod (val, &stop_char); |
685 |
+ |
break; |
686 |
+ |
case ARG_STRING: |
687 |
+ |
if (val) { |
688 |
+ |
string_field = (char **)field; |
689 |
+ |
if (!no_free && *string_field) |
690 |
+ |
free (*string_field); /* free previous string */ |
691 |
+ |
*string_field = gengetopt_strdup (val); |
692 |
+ |
} |
693 |
+ |
break; |
694 |
+ |
default: |
695 |
+ |
break; |
696 |
+ |
}; |
697 |
+ |
|
698 |
+ |
/* check numeric conversion */ |
699 |
+ |
switch(arg_type) { |
700 |
+ |
case ARG_INT: |
701 |
+ |
case ARG_DOUBLE: |
702 |
+ |
if (val && !(stop_char && *stop_char == '\0')) { |
703 |
+ |
fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val); |
704 |
+ |
return 1; /* failure */ |
705 |
+ |
} |
706 |
+ |
break; |
707 |
+ |
default: |
708 |
+ |
; |
709 |
+ |
}; |
710 |
+ |
|
711 |
+ |
/* store the original value */ |
712 |
+ |
switch(arg_type) { |
713 |
+ |
case ARG_NO: |
714 |
+ |
break; |
715 |
+ |
default: |
716 |
+ |
if (value && orig_field) { |
717 |
+ |
if (no_free) { |
718 |
+ |
*orig_field = value; |
719 |
+ |
} else { |
720 |
+ |
if (*orig_field) |
721 |
+ |
free (*orig_field); /* free previous string */ |
722 |
+ |
*orig_field = gengetopt_strdup (value); |
723 |
+ |
} |
724 |
+ |
} |
725 |
+ |
}; |
726 |
+ |
|
727 |
+ |
return 0; /* OK */ |
728 |
+ |
} |
729 |
+ |
|
730 |
+ |
|
731 |
|
int |
732 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) |
732 |
> |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
733 |
> |
struct cmdline_parser_params *params, const char *additional_error) |
734 |
|
{ |
735 |
|
int c; /* Character of the parsed option. */ |
736 |
|
|
737 |
|
int error = 0; |
738 |
|
struct gengetopt_args_info local_args_info; |
739 |
+ |
|
740 |
+ |
int override; |
741 |
+ |
int initialize; |
742 |
+ |
int check_required; |
743 |
+ |
int check_ambiguity; |
744 |
+ |
|
745 |
+ |
package_name = argv[0]; |
746 |
+ |
|
747 |
+ |
override = params->override; |
748 |
+ |
initialize = params->initialize; |
749 |
+ |
check_required = params->check_required; |
750 |
+ |
check_ambiguity = params->check_ambiguity; |
751 |
|
|
752 |
|
if (initialize) |
753 |
|
cmdline_parser_init (args_info); |
756 |
|
|
757 |
|
optarg = 0; |
758 |
|
optind = 0; |
759 |
< |
opterr = 1; |
759 |
> |
opterr = params->print_errors; |
760 |
|
optopt = '?'; |
761 |
|
|
762 |
|
while (1) |
763 |
|
{ |
764 |
|
int option_index = 0; |
718 |
– |
char *stop_char; |
765 |
|
|
766 |
|
static struct option long_options[] = { |
767 |
|
{ "help", 0, NULL, 'h' }, |
772 |
|
{ "nbins", 1, NULL, 'b' }, |
773 |
|
{ "nbins_x", 1, NULL, 'x' }, |
774 |
|
{ "nbins_y", 1, NULL, 'y' }, |
775 |
+ |
{ "nbins_z", 1, NULL, 0 }, |
776 |
|
{ "nanglebins", 1, NULL, 'a' }, |
730 |
– |
{ "length", 1, NULL, 0 }, |
777 |
|
{ "rcut", 1, NULL, 'c' }, |
778 |
+ |
{ "length", 1, NULL, 0 }, |
779 |
+ |
{ "zlength", 1, NULL, 0 }, |
780 |
|
{ "zoffset", 1, NULL, 'z' }, |
781 |
|
{ "sele1", 1, NULL, 0 }, |
782 |
|
{ "sele2", 1, NULL, 0 }, |
783 |
|
{ "sele3", 1, NULL, 0 }, |
784 |
|
{ "refsele", 1, NULL, 0 }, |
785 |
+ |
{ "comsele", 1, NULL, 0 }, |
786 |
|
{ "molname", 1, NULL, 0 }, |
787 |
|
{ "begin", 1, NULL, 0 }, |
788 |
|
{ "end", 1, NULL, 0 }, |
791 |
|
{ "bor", 0, NULL, 0 }, |
792 |
|
{ "bad", 0, NULL, 0 }, |
793 |
|
{ "gofr", 0, NULL, 'g' }, |
794 |
+ |
{ "gofz", 0, NULL, 0 }, |
795 |
|
{ "r_theta", 0, NULL, 0 }, |
796 |
|
{ "r_omega", 0, NULL, 0 }, |
797 |
+ |
{ "r_z", 0, NULL, 0 }, |
798 |
|
{ "theta_omega", 0, NULL, 0 }, |
799 |
|
{ "gxyz", 0, NULL, 0 }, |
800 |
|
{ "p2", 0, NULL, 'p' }, |
802 |
|
{ "scd", 0, NULL, 's' }, |
803 |
|
{ "density", 0, NULL, 'd' }, |
804 |
|
{ "slab_density", 0, NULL, 0 }, |
805 |
+ |
{ "p_angle", 0, NULL, 0 }, |
806 |
|
{ "hxy", 0, NULL, 0 }, |
807 |
|
{ "rho_r", 0, NULL, 0 }, |
808 |
|
{ "hullvol", 0, NULL, 0 }, |
809 |
|
{ NULL, 0, NULL, 0 } |
810 |
|
}; |
811 |
|
|
760 |
– |
stop_char = 0; |
812 |
|
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
813 |
|
|
814 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
826 |
|
exit (EXIT_SUCCESS); |
827 |
|
|
828 |
|
case 'i': /* input dump file. */ |
829 |
< |
if (local_args_info.input_given) |
830 |
< |
{ |
831 |
< |
fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
832 |
< |
goto failure; |
833 |
< |
} |
834 |
< |
if (args_info->input_given && ! override) |
835 |
< |
continue; |
836 |
< |
local_args_info.input_given = 1; |
837 |
< |
args_info->input_given = 1; |
838 |
< |
if (args_info->input_arg) |
788 |
< |
free (args_info->input_arg); /* free previous string */ |
789 |
< |
args_info->input_arg = gengetopt_strdup (optarg); |
790 |
< |
if (args_info->input_orig) |
791 |
< |
free (args_info->input_orig); /* free previous string */ |
792 |
< |
args_info->input_orig = gengetopt_strdup (optarg); |
829 |
> |
|
830 |
> |
|
831 |
> |
if (update_arg( (void *)&(args_info->input_arg), |
832 |
> |
&(args_info->input_orig), &(args_info->input_given), |
833 |
> |
&(local_args_info.input_given), optarg, 0, 0, ARG_STRING, |
834 |
> |
check_ambiguity, override, 0, 0, |
835 |
> |
"input", 'i', |
836 |
> |
additional_error)) |
837 |
> |
goto failure; |
838 |
> |
|
839 |
|
break; |
794 |
– |
|
840 |
|
case 'o': /* output file name. */ |
841 |
< |
if (local_args_info.output_given) |
842 |
< |
{ |
843 |
< |
fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
844 |
< |
goto failure; |
845 |
< |
} |
846 |
< |
if (args_info->output_given && ! override) |
847 |
< |
continue; |
848 |
< |
local_args_info.output_given = 1; |
849 |
< |
args_info->output_given = 1; |
850 |
< |
if (args_info->output_arg) |
806 |
< |
free (args_info->output_arg); /* free previous string */ |
807 |
< |
args_info->output_arg = gengetopt_strdup (optarg); |
808 |
< |
if (args_info->output_orig) |
809 |
< |
free (args_info->output_orig); /* free previous string */ |
810 |
< |
args_info->output_orig = gengetopt_strdup (optarg); |
841 |
> |
|
842 |
> |
|
843 |
> |
if (update_arg( (void *)&(args_info->output_arg), |
844 |
> |
&(args_info->output_orig), &(args_info->output_given), |
845 |
> |
&(local_args_info.output_given), optarg, 0, 0, ARG_STRING, |
846 |
> |
check_ambiguity, override, 0, 0, |
847 |
> |
"output", 'o', |
848 |
> |
additional_error)) |
849 |
> |
goto failure; |
850 |
> |
|
851 |
|
break; |
812 |
– |
|
852 |
|
case 'n': /* process every n frame. */ |
853 |
< |
if (local_args_info.step_given) |
854 |
< |
{ |
855 |
< |
fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
856 |
< |
goto failure; |
857 |
< |
} |
858 |
< |
if (args_info->step_given && ! override) |
859 |
< |
continue; |
860 |
< |
local_args_info.step_given = 1; |
822 |
< |
args_info->step_given = 1; |
823 |
< |
args_info->step_arg = strtol (optarg, &stop_char, 0); |
824 |
< |
if (!(stop_char && *stop_char == '\0')) { |
825 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
853 |
> |
|
854 |
> |
|
855 |
> |
if (update_arg( (void *)&(args_info->step_arg), |
856 |
> |
&(args_info->step_orig), &(args_info->step_given), |
857 |
> |
&(local_args_info.step_given), optarg, 0, "1", ARG_INT, |
858 |
> |
check_ambiguity, override, 0, 0, |
859 |
> |
"step", 'n', |
860 |
> |
additional_error)) |
861 |
|
goto failure; |
862 |
< |
} |
828 |
< |
if (args_info->step_orig) |
829 |
< |
free (args_info->step_orig); /* free previous string */ |
830 |
< |
args_info->step_orig = gengetopt_strdup (optarg); |
862 |
> |
|
863 |
|
break; |
832 |
– |
|
864 |
|
case 'b': /* number of bins (general purpose). */ |
865 |
< |
if (local_args_info.nbins_given) |
866 |
< |
{ |
867 |
< |
fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
868 |
< |
goto failure; |
869 |
< |
} |
870 |
< |
if (args_info->nbins_given && ! override) |
871 |
< |
continue; |
872 |
< |
local_args_info.nbins_given = 1; |
842 |
< |
args_info->nbins_given = 1; |
843 |
< |
args_info->nbins_arg = strtol (optarg, &stop_char, 0); |
844 |
< |
if (!(stop_char && *stop_char == '\0')) { |
845 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
865 |
> |
|
866 |
> |
|
867 |
> |
if (update_arg( (void *)&(args_info->nbins_arg), |
868 |
> |
&(args_info->nbins_orig), &(args_info->nbins_given), |
869 |
> |
&(local_args_info.nbins_given), optarg, 0, "100", ARG_INT, |
870 |
> |
check_ambiguity, override, 0, 0, |
871 |
> |
"nbins", 'b', |
872 |
> |
additional_error)) |
873 |
|
goto failure; |
874 |
< |
} |
848 |
< |
if (args_info->nbins_orig) |
849 |
< |
free (args_info->nbins_orig); /* free previous string */ |
850 |
< |
args_info->nbins_orig = gengetopt_strdup (optarg); |
874 |
> |
|
875 |
|
break; |
852 |
– |
|
876 |
|
case 'x': /* number of bins in x axis. */ |
877 |
< |
if (local_args_info.nbins_x_given) |
878 |
< |
{ |
879 |
< |
fprintf (stderr, "%s: `--nbins_x' (`-x') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
880 |
< |
goto failure; |
881 |
< |
} |
882 |
< |
if (args_info->nbins_x_given && ! override) |
883 |
< |
continue; |
884 |
< |
local_args_info.nbins_x_given = 1; |
862 |
< |
args_info->nbins_x_given = 1; |
863 |
< |
args_info->nbins_x_arg = strtol (optarg, &stop_char, 0); |
864 |
< |
if (!(stop_char && *stop_char == '\0')) { |
865 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
877 |
> |
|
878 |
> |
|
879 |
> |
if (update_arg( (void *)&(args_info->nbins_x_arg), |
880 |
> |
&(args_info->nbins_x_orig), &(args_info->nbins_x_given), |
881 |
> |
&(local_args_info.nbins_x_given), optarg, 0, "100", ARG_INT, |
882 |
> |
check_ambiguity, override, 0, 0, |
883 |
> |
"nbins_x", 'x', |
884 |
> |
additional_error)) |
885 |
|
goto failure; |
886 |
< |
} |
868 |
< |
if (args_info->nbins_x_orig) |
869 |
< |
free (args_info->nbins_x_orig); /* free previous string */ |
870 |
< |
args_info->nbins_x_orig = gengetopt_strdup (optarg); |
886 |
> |
|
887 |
|
break; |
872 |
– |
|
888 |
|
case 'y': /* number of bins in y axis. */ |
889 |
< |
if (local_args_info.nbins_y_given) |
890 |
< |
{ |
891 |
< |
fprintf (stderr, "%s: `--nbins_y' (`-y') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
892 |
< |
goto failure; |
893 |
< |
} |
894 |
< |
if (args_info->nbins_y_given && ! override) |
895 |
< |
continue; |
896 |
< |
local_args_info.nbins_y_given = 1; |
882 |
< |
args_info->nbins_y_given = 1; |
883 |
< |
args_info->nbins_y_arg = strtol (optarg, &stop_char, 0); |
884 |
< |
if (!(stop_char && *stop_char == '\0')) { |
885 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
889 |
> |
|
890 |
> |
|
891 |
> |
if (update_arg( (void *)&(args_info->nbins_y_arg), |
892 |
> |
&(args_info->nbins_y_orig), &(args_info->nbins_y_given), |
893 |
> |
&(local_args_info.nbins_y_given), optarg, 0, "100", ARG_INT, |
894 |
> |
check_ambiguity, override, 0, 0, |
895 |
> |
"nbins_y", 'y', |
896 |
> |
additional_error)) |
897 |
|
goto failure; |
898 |
< |
} |
888 |
< |
if (args_info->nbins_y_orig) |
889 |
< |
free (args_info->nbins_y_orig); /* free previous string */ |
890 |
< |
args_info->nbins_y_orig = gengetopt_strdup (optarg); |
898 |
> |
|
899 |
|
break; |
892 |
– |
|
900 |
|
case 'a': /* number of bins for cos(angle). */ |
901 |
< |
if (local_args_info.nanglebins_given) |
902 |
< |
{ |
903 |
< |
fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
904 |
< |
goto failure; |
905 |
< |
} |
906 |
< |
if (args_info->nanglebins_given && ! override) |
907 |
< |
continue; |
908 |
< |
local_args_info.nanglebins_given = 1; |
902 |
< |
args_info->nanglebins_given = 1; |
903 |
< |
args_info->nanglebins_arg = strtol (optarg, &stop_char, 0); |
904 |
< |
if (!(stop_char && *stop_char == '\0')) { |
905 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
901 |
> |
|
902 |
> |
|
903 |
> |
if (update_arg( (void *)&(args_info->nanglebins_arg), |
904 |
> |
&(args_info->nanglebins_orig), &(args_info->nanglebins_given), |
905 |
> |
&(local_args_info.nanglebins_given), optarg, 0, "50", ARG_INT, |
906 |
> |
check_ambiguity, override, 0, 0, |
907 |
> |
"nanglebins", 'a', |
908 |
> |
additional_error)) |
909 |
|
goto failure; |
910 |
< |
} |
908 |
< |
if (args_info->nanglebins_orig) |
909 |
< |
free (args_info->nanglebins_orig); /* free previous string */ |
910 |
< |
args_info->nanglebins_orig = gengetopt_strdup (optarg); |
910 |
> |
|
911 |
|
break; |
912 |
– |
|
912 |
|
case 'c': /* cutoff radius (rcut). */ |
913 |
< |
if (local_args_info.rcut_given) |
914 |
< |
{ |
915 |
< |
fprintf (stderr, "%s: `--rcut' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
916 |
< |
goto failure; |
917 |
< |
} |
918 |
< |
if (args_info->rcut_given && ! override) |
919 |
< |
continue; |
920 |
< |
local_args_info.rcut_given = 1; |
922 |
< |
args_info->rcut_given = 1; |
923 |
< |
args_info->rcut_arg = strtod (optarg, &stop_char); |
924 |
< |
if (!(stop_char && *stop_char == '\0')) { |
925 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
913 |
> |
|
914 |
> |
|
915 |
> |
if (update_arg( (void *)&(args_info->rcut_arg), |
916 |
> |
&(args_info->rcut_orig), &(args_info->rcut_given), |
917 |
> |
&(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE, |
918 |
> |
check_ambiguity, override, 0, 0, |
919 |
> |
"rcut", 'c', |
920 |
> |
additional_error)) |
921 |
|
goto failure; |
922 |
< |
} |
928 |
< |
if (args_info->rcut_orig) |
929 |
< |
free (args_info->rcut_orig); /* free previous string */ |
930 |
< |
args_info->rcut_orig = gengetopt_strdup (optarg); |
922 |
> |
|
923 |
|
break; |
932 |
– |
|
924 |
|
case 'z': /* Where to set the zero for the slab_density calculation. */ |
925 |
< |
if (local_args_info.zoffset_given) |
926 |
< |
{ |
927 |
< |
fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
928 |
< |
goto failure; |
929 |
< |
} |
930 |
< |
if (args_info->zoffset_given && ! override) |
931 |
< |
continue; |
932 |
< |
local_args_info.zoffset_given = 1; |
942 |
< |
args_info->zoffset_given = 1; |
943 |
< |
args_info->zoffset_arg = strtod (optarg, &stop_char); |
944 |
< |
if (!(stop_char && *stop_char == '\0')) { |
945 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
925 |
> |
|
926 |
> |
|
927 |
> |
if (update_arg( (void *)&(args_info->zoffset_arg), |
928 |
> |
&(args_info->zoffset_orig), &(args_info->zoffset_given), |
929 |
> |
&(local_args_info.zoffset_given), optarg, 0, "0", ARG_DOUBLE, |
930 |
> |
check_ambiguity, override, 0, 0, |
931 |
> |
"zoffset", 'z', |
932 |
> |
additional_error)) |
933 |
|
goto failure; |
934 |
< |
} |
948 |
< |
if (args_info->zoffset_orig) |
949 |
< |
free (args_info->zoffset_orig); /* free previous string */ |
950 |
< |
args_info->zoffset_orig = gengetopt_strdup (optarg); |
934 |
> |
|
935 |
|
break; |
952 |
– |
|
936 |
|
case 'g': /* g(r). */ |
937 |
< |
if (local_args_info.gofr_given) |
955 |
< |
{ |
956 |
< |
fprintf (stderr, "%s: `--gofr' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
957 |
< |
goto failure; |
958 |
< |
} |
959 |
< |
if (args_info->gofr_given && ! override) |
960 |
< |
continue; |
961 |
< |
local_args_info.gofr_given = 1; |
962 |
< |
args_info->gofr_given = 1; |
937 |
> |
|
938 |
|
if (args_info->staticProps_group_counter && override) |
939 |
|
reset_group_staticProps (args_info); |
940 |
|
args_info->staticProps_group_counter += 1; |
941 |
+ |
|
942 |
+ |
if (update_arg( 0 , |
943 |
+ |
0 , &(args_info->gofr_given), |
944 |
+ |
&(local_args_info.gofr_given), optarg, 0, 0, ARG_NO, |
945 |
+ |
check_ambiguity, override, 0, 0, |
946 |
+ |
"gofr", 'g', |
947 |
+ |
additional_error)) |
948 |
+ |
goto failure; |
949 |
+ |
|
950 |
|
break; |
967 |
– |
|
951 |
|
case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ |
952 |
< |
if (local_args_info.p2_given) |
970 |
< |
{ |
971 |
< |
fprintf (stderr, "%s: `--p2' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
972 |
< |
goto failure; |
973 |
< |
} |
974 |
< |
if (args_info->p2_given && ! override) |
975 |
< |
continue; |
976 |
< |
local_args_info.p2_given = 1; |
977 |
< |
args_info->p2_given = 1; |
952 |
> |
|
953 |
|
if (args_info->staticProps_group_counter && override) |
954 |
|
reset_group_staticProps (args_info); |
955 |
|
args_info->staticProps_group_counter += 1; |
956 |
+ |
|
957 |
+ |
if (update_arg( 0 , |
958 |
+ |
0 , &(args_info->p2_given), |
959 |
+ |
&(local_args_info.p2_given), optarg, 0, 0, ARG_NO, |
960 |
+ |
check_ambiguity, override, 0, 0, |
961 |
+ |
"p2", 'p', |
962 |
+ |
additional_error)) |
963 |
+ |
goto failure; |
964 |
+ |
|
965 |
|
break; |
982 |
– |
|
966 |
|
case 's': /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */ |
967 |
< |
if (local_args_info.scd_given) |
985 |
< |
{ |
986 |
< |
fprintf (stderr, "%s: `--scd' (`-s') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
987 |
< |
goto failure; |
988 |
< |
} |
989 |
< |
if (args_info->scd_given && ! override) |
990 |
< |
continue; |
991 |
< |
local_args_info.scd_given = 1; |
992 |
< |
args_info->scd_given = 1; |
967 |
> |
|
968 |
|
if (args_info->staticProps_group_counter && override) |
969 |
|
reset_group_staticProps (args_info); |
970 |
|
args_info->staticProps_group_counter += 1; |
971 |
< |
break; |
972 |
< |
|
971 |
> |
|
972 |
> |
if (update_arg( 0 , |
973 |
> |
0 , &(args_info->scd_given), |
974 |
> |
&(local_args_info.scd_given), optarg, 0, 0, ARG_NO, |
975 |
> |
check_ambiguity, override, 0, 0, |
976 |
> |
"scd", 's', |
977 |
> |
additional_error)) |
978 |
> |
goto failure; |
979 |
> |
|
980 |
> |
break; |
981 |
|
case 'd': /* density plot. */ |
982 |
< |
if (local_args_info.density_given) |
1000 |
< |
{ |
1001 |
< |
fprintf (stderr, "%s: `--density' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1002 |
< |
goto failure; |
1003 |
< |
} |
1004 |
< |
if (args_info->density_given && ! override) |
1005 |
< |
continue; |
1006 |
< |
local_args_info.density_given = 1; |
1007 |
< |
args_info->density_given = 1; |
982 |
> |
|
983 |
|
if (args_info->staticProps_group_counter && override) |
984 |
|
reset_group_staticProps (args_info); |
985 |
|
args_info->staticProps_group_counter += 1; |
986 |
+ |
|
987 |
+ |
if (update_arg( 0 , |
988 |
+ |
0 , &(args_info->density_given), |
989 |
+ |
&(local_args_info.density_given), optarg, 0, 0, ARG_NO, |
990 |
+ |
check_ambiguity, override, 0, 0, |
991 |
+ |
"density", 'd', |
992 |
+ |
additional_error)) |
993 |
+ |
goto failure; |
994 |
+ |
|
995 |
|
break; |
996 |
|
|
1013 |
– |
|
997 |
|
case 0: /* Long option with no short option */ |
998 |
+ |
/* number of bins in z axis. */ |
999 |
+ |
if (strcmp (long_options[option_index].name, "nbins_z") == 0) |
1000 |
+ |
{ |
1001 |
+ |
|
1002 |
+ |
|
1003 |
+ |
if (update_arg( (void *)&(args_info->nbins_z_arg), |
1004 |
+ |
&(args_info->nbins_z_orig), &(args_info->nbins_z_given), |
1005 |
+ |
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
1006 |
+ |
check_ambiguity, override, 0, 0, |
1007 |
+ |
"nbins_z", '-', |
1008 |
+ |
additional_error)) |
1009 |
+ |
goto failure; |
1010 |
+ |
|
1011 |
+ |
} |
1012 |
|
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1013 |
< |
if (strcmp (long_options[option_index].name, "length") == 0) |
1013 |
> |
else if (strcmp (long_options[option_index].name, "length") == 0) |
1014 |
|
{ |
1015 |
< |
if (local_args_info.length_given) |
1016 |
< |
{ |
1017 |
< |
fprintf (stderr, "%s: `--length' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1018 |
< |
goto failure; |
1019 |
< |
} |
1020 |
< |
if (args_info->length_given && ! override) |
1021 |
< |
continue; |
1022 |
< |
local_args_info.length_given = 1; |
1026 |
< |
args_info->length_given = 1; |
1027 |
< |
args_info->length_arg = strtod (optarg, &stop_char); |
1028 |
< |
if (!(stop_char && *stop_char == '\0')) { |
1029 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
1015 |
> |
|
1016 |
> |
|
1017 |
> |
if (update_arg( (void *)&(args_info->length_arg), |
1018 |
> |
&(args_info->length_orig), &(args_info->length_given), |
1019 |
> |
&(local_args_info.length_given), optarg, 0, 0, ARG_DOUBLE, |
1020 |
> |
check_ambiguity, override, 0, 0, |
1021 |
> |
"length", '-', |
1022 |
> |
additional_error)) |
1023 |
|
goto failure; |
1024 |
< |
} |
1032 |
< |
if (args_info->length_orig) |
1033 |
< |
free (args_info->length_orig); /* free previous string */ |
1034 |
< |
args_info->length_orig = gengetopt_strdup (optarg); |
1024 |
> |
|
1025 |
|
} |
1026 |
+ |
/* maximum length (Defaults to 1/2 smallest length of first frame). */ |
1027 |
+ |
else if (strcmp (long_options[option_index].name, "zlength") == 0) |
1028 |
+ |
{ |
1029 |
+ |
|
1030 |
+ |
|
1031 |
+ |
if (update_arg( (void *)&(args_info->zlength_arg), |
1032 |
+ |
&(args_info->zlength_orig), &(args_info->zlength_given), |
1033 |
+ |
&(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE, |
1034 |
+ |
check_ambiguity, override, 0, 0, |
1035 |
+ |
"zlength", '-', |
1036 |
+ |
additional_error)) |
1037 |
+ |
goto failure; |
1038 |
+ |
|
1039 |
+ |
} |
1040 |
|
/* select the first stuntdouble set. */ |
1041 |
|
else if (strcmp (long_options[option_index].name, "sele1") == 0) |
1042 |
|
{ |
1043 |
< |
if (local_args_info.sele1_given) |
1044 |
< |
{ |
1045 |
< |
fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1046 |
< |
goto failure; |
1047 |
< |
} |
1048 |
< |
if (args_info->sele1_given && ! override) |
1049 |
< |
continue; |
1050 |
< |
local_args_info.sele1_given = 1; |
1051 |
< |
args_info->sele1_given = 1; |
1052 |
< |
if (args_info->sele1_arg) |
1049 |
< |
free (args_info->sele1_arg); /* free previous string */ |
1050 |
< |
args_info->sele1_arg = gengetopt_strdup (optarg); |
1051 |
< |
if (args_info->sele1_orig) |
1052 |
< |
free (args_info->sele1_orig); /* free previous string */ |
1053 |
< |
args_info->sele1_orig = gengetopt_strdup (optarg); |
1043 |
> |
|
1044 |
> |
|
1045 |
> |
if (update_arg( (void *)&(args_info->sele1_arg), |
1046 |
> |
&(args_info->sele1_orig), &(args_info->sele1_given), |
1047 |
> |
&(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING, |
1048 |
> |
check_ambiguity, override, 0, 0, |
1049 |
> |
"sele1", '-', |
1050 |
> |
additional_error)) |
1051 |
> |
goto failure; |
1052 |
> |
|
1053 |
|
} |
1054 |
|
/* select the second stuntdouble set. */ |
1055 |
|
else if (strcmp (long_options[option_index].name, "sele2") == 0) |
1056 |
|
{ |
1057 |
< |
if (local_args_info.sele2_given) |
1058 |
< |
{ |
1059 |
< |
fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1060 |
< |
goto failure; |
1061 |
< |
} |
1062 |
< |
if (args_info->sele2_given && ! override) |
1063 |
< |
continue; |
1064 |
< |
local_args_info.sele2_given = 1; |
1065 |
< |
args_info->sele2_given = 1; |
1066 |
< |
if (args_info->sele2_arg) |
1068 |
< |
free (args_info->sele2_arg); /* free previous string */ |
1069 |
< |
args_info->sele2_arg = gengetopt_strdup (optarg); |
1070 |
< |
if (args_info->sele2_orig) |
1071 |
< |
free (args_info->sele2_orig); /* free previous string */ |
1072 |
< |
args_info->sele2_orig = gengetopt_strdup (optarg); |
1057 |
> |
|
1058 |
> |
|
1059 |
> |
if (update_arg( (void *)&(args_info->sele2_arg), |
1060 |
> |
&(args_info->sele2_orig), &(args_info->sele2_given), |
1061 |
> |
&(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING, |
1062 |
> |
check_ambiguity, override, 0, 0, |
1063 |
> |
"sele2", '-', |
1064 |
> |
additional_error)) |
1065 |
> |
goto failure; |
1066 |
> |
|
1067 |
|
} |
1068 |
|
/* select the third stuntdouble set. */ |
1069 |
|
else if (strcmp (long_options[option_index].name, "sele3") == 0) |
1070 |
|
{ |
1071 |
< |
if (local_args_info.sele3_given) |
1072 |
< |
{ |
1073 |
< |
fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1074 |
< |
goto failure; |
1075 |
< |
} |
1076 |
< |
if (args_info->sele3_given && ! override) |
1077 |
< |
continue; |
1078 |
< |
local_args_info.sele3_given = 1; |
1079 |
< |
args_info->sele3_given = 1; |
1080 |
< |
if (args_info->sele3_arg) |
1087 |
< |
free (args_info->sele3_arg); /* free previous string */ |
1088 |
< |
args_info->sele3_arg = gengetopt_strdup (optarg); |
1089 |
< |
if (args_info->sele3_orig) |
1090 |
< |
free (args_info->sele3_orig); /* free previous string */ |
1091 |
< |
args_info->sele3_orig = gengetopt_strdup (optarg); |
1071 |
> |
|
1072 |
> |
|
1073 |
> |
if (update_arg( (void *)&(args_info->sele3_arg), |
1074 |
> |
&(args_info->sele3_orig), &(args_info->sele3_given), |
1075 |
> |
&(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING, |
1076 |
> |
check_ambiguity, override, 0, 0, |
1077 |
> |
"sele3", '-', |
1078 |
> |
additional_error)) |
1079 |
> |
goto failure; |
1080 |
> |
|
1081 |
|
} |
1082 |
|
/* select reference (use and only use with --gxyz). */ |
1083 |
|
else if (strcmp (long_options[option_index].name, "refsele") == 0) |
1084 |
|
{ |
1085 |
< |
if (local_args_info.refsele_given) |
1086 |
< |
{ |
1087 |
< |
fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1088 |
< |
goto failure; |
1089 |
< |
} |
1090 |
< |
if (args_info->refsele_given && ! override) |
1091 |
< |
continue; |
1092 |
< |
local_args_info.refsele_given = 1; |
1093 |
< |
args_info->refsele_given = 1; |
1094 |
< |
if (args_info->refsele_arg) |
1106 |
< |
free (args_info->refsele_arg); /* free previous string */ |
1107 |
< |
args_info->refsele_arg = gengetopt_strdup (optarg); |
1108 |
< |
if (args_info->refsele_orig) |
1109 |
< |
free (args_info->refsele_orig); /* free previous string */ |
1110 |
< |
args_info->refsele_orig = gengetopt_strdup (optarg); |
1085 |
> |
|
1086 |
> |
|
1087 |
> |
if (update_arg( (void *)&(args_info->refsele_arg), |
1088 |
> |
&(args_info->refsele_orig), &(args_info->refsele_given), |
1089 |
> |
&(local_args_info.refsele_given), optarg, 0, 0, ARG_STRING, |
1090 |
> |
check_ambiguity, override, 0, 0, |
1091 |
> |
"refsele", '-', |
1092 |
> |
additional_error)) |
1093 |
> |
goto failure; |
1094 |
> |
|
1095 |
|
} |
1096 |
+ |
/* select stunt doubles for center-of-mass reference point. */ |
1097 |
+ |
else if (strcmp (long_options[option_index].name, "comsele") == 0) |
1098 |
+ |
{ |
1099 |
+ |
|
1100 |
+ |
|
1101 |
+ |
if (update_arg( (void *)&(args_info->comsele_arg), |
1102 |
+ |
&(args_info->comsele_orig), &(args_info->comsele_given), |
1103 |
+ |
&(local_args_info.comsele_given), optarg, 0, 0, ARG_STRING, |
1104 |
+ |
check_ambiguity, override, 0, 0, |
1105 |
+ |
"comsele", '-', |
1106 |
+ |
additional_error)) |
1107 |
+ |
goto failure; |
1108 |
+ |
|
1109 |
+ |
} |
1110 |
|
/* molecule name. */ |
1111 |
|
else if (strcmp (long_options[option_index].name, "molname") == 0) |
1112 |
|
{ |
1113 |
< |
if (local_args_info.molname_given) |
1114 |
< |
{ |
1115 |
< |
fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1116 |
< |
goto failure; |
1117 |
< |
} |
1118 |
< |
if (args_info->molname_given && ! override) |
1119 |
< |
continue; |
1120 |
< |
local_args_info.molname_given = 1; |
1121 |
< |
args_info->molname_given = 1; |
1122 |
< |
if (args_info->molname_arg) |
1125 |
< |
free (args_info->molname_arg); /* free previous string */ |
1126 |
< |
args_info->molname_arg = gengetopt_strdup (optarg); |
1127 |
< |
if (args_info->molname_orig) |
1128 |
< |
free (args_info->molname_orig); /* free previous string */ |
1129 |
< |
args_info->molname_orig = gengetopt_strdup (optarg); |
1113 |
> |
|
1114 |
> |
|
1115 |
> |
if (update_arg( (void *)&(args_info->molname_arg), |
1116 |
> |
&(args_info->molname_orig), &(args_info->molname_given), |
1117 |
> |
&(local_args_info.molname_given), optarg, 0, 0, ARG_STRING, |
1118 |
> |
check_ambiguity, override, 0, 0, |
1119 |
> |
"molname", '-', |
1120 |
> |
additional_error)) |
1121 |
> |
goto failure; |
1122 |
> |
|
1123 |
|
} |
1124 |
|
/* begin internal index. */ |
1125 |
|
else if (strcmp (long_options[option_index].name, "begin") == 0) |
1126 |
|
{ |
1127 |
< |
if (local_args_info.begin_given) |
1128 |
< |
{ |
1129 |
< |
fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1130 |
< |
goto failure; |
1131 |
< |
} |
1132 |
< |
if (args_info->begin_given && ! override) |
1133 |
< |
continue; |
1134 |
< |
local_args_info.begin_given = 1; |
1142 |
< |
args_info->begin_given = 1; |
1143 |
< |
args_info->begin_arg = strtol (optarg, &stop_char, 0); |
1144 |
< |
if (!(stop_char && *stop_char == '\0')) { |
1145 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
1127 |
> |
|
1128 |
> |
|
1129 |
> |
if (update_arg( (void *)&(args_info->begin_arg), |
1130 |
> |
&(args_info->begin_orig), &(args_info->begin_given), |
1131 |
> |
&(local_args_info.begin_given), optarg, 0, 0, ARG_INT, |
1132 |
> |
check_ambiguity, override, 0, 0, |
1133 |
> |
"begin", '-', |
1134 |
> |
additional_error)) |
1135 |
|
goto failure; |
1136 |
< |
} |
1148 |
< |
if (args_info->begin_orig) |
1149 |
< |
free (args_info->begin_orig); /* free previous string */ |
1150 |
< |
args_info->begin_orig = gengetopt_strdup (optarg); |
1136 |
> |
|
1137 |
|
} |
1138 |
|
/* end internal index. */ |
1139 |
|
else if (strcmp (long_options[option_index].name, "end") == 0) |
1140 |
|
{ |
1141 |
< |
if (local_args_info.end_given) |
1142 |
< |
{ |
1143 |
< |
fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1144 |
< |
goto failure; |
1145 |
< |
} |
1146 |
< |
if (args_info->end_given && ! override) |
1147 |
< |
continue; |
1148 |
< |
local_args_info.end_given = 1; |
1163 |
< |
args_info->end_given = 1; |
1164 |
< |
args_info->end_arg = strtol (optarg, &stop_char, 0); |
1165 |
< |
if (!(stop_char && *stop_char == '\0')) { |
1166 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
1141 |
> |
|
1142 |
> |
|
1143 |
> |
if (update_arg( (void *)&(args_info->end_arg), |
1144 |
> |
&(args_info->end_orig), &(args_info->end_given), |
1145 |
> |
&(local_args_info.end_given), optarg, 0, 0, ARG_INT, |
1146 |
> |
check_ambiguity, override, 0, 0, |
1147 |
> |
"end", '-', |
1148 |
> |
additional_error)) |
1149 |
|
goto failure; |
1150 |
< |
} |
1169 |
< |
if (args_info->end_orig) |
1170 |
< |
free (args_info->end_orig); /* free previous string */ |
1171 |
< |
args_info->end_orig = gengetopt_strdup (optarg); |
1150 |
> |
|
1151 |
|
} |
1152 |
|
/* nanoparticle radius. */ |
1153 |
|
else if (strcmp (long_options[option_index].name, "radius") == 0) |
1154 |
|
{ |
1155 |
< |
if (local_args_info.radius_given) |
1156 |
< |
{ |
1157 |
< |
fprintf (stderr, "%s: `--radius' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1158 |
< |
goto failure; |
1159 |
< |
} |
1160 |
< |
if (args_info->radius_given && ! override) |
1161 |
< |
continue; |
1162 |
< |
local_args_info.radius_given = 1; |
1184 |
< |
args_info->radius_given = 1; |
1185 |
< |
args_info->radius_arg = strtod (optarg, &stop_char); |
1186 |
< |
if (!(stop_char && *stop_char == '\0')) { |
1187 |
< |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
1155 |
> |
|
1156 |
> |
|
1157 |
> |
if (update_arg( (void *)&(args_info->radius_arg), |
1158 |
> |
&(args_info->radius_orig), &(args_info->radius_given), |
1159 |
> |
&(local_args_info.radius_given), optarg, 0, 0, ARG_DOUBLE, |
1160 |
> |
check_ambiguity, override, 0, 0, |
1161 |
> |
"radius", '-', |
1162 |
> |
additional_error)) |
1163 |
|
goto failure; |
1164 |
< |
} |
1190 |
< |
if (args_info->radius_orig) |
1191 |
< |
free (args_info->radius_orig); /* free previous string */ |
1192 |
< |
args_info->radius_orig = gengetopt_strdup (optarg); |
1164 |
> |
|
1165 |
|
} |
1166 |
|
/* bond order parameter (--rcut must be specified). */ |
1167 |
|
else if (strcmp (long_options[option_index].name, "bo") == 0) |
1168 |
|
{ |
1169 |
< |
if (local_args_info.bo_given) |
1198 |
< |
{ |
1199 |
< |
fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1200 |
< |
goto failure; |
1201 |
< |
} |
1202 |
< |
if (args_info->bo_given && ! override) |
1203 |
< |
continue; |
1204 |
< |
local_args_info.bo_given = 1; |
1205 |
< |
args_info->bo_given = 1; |
1169 |
> |
|
1170 |
|
if (args_info->staticProps_group_counter && override) |
1171 |
|
reset_group_staticProps (args_info); |
1172 |
|
args_info->staticProps_group_counter += 1; |
1173 |
< |
break; |
1173 |
> |
|
1174 |
> |
if (update_arg( 0 , |
1175 |
> |
0 , &(args_info->bo_given), |
1176 |
> |
&(local_args_info.bo_given), optarg, 0, 0, ARG_NO, |
1177 |
> |
check_ambiguity, override, 0, 0, |
1178 |
> |
"bo", '-', |
1179 |
> |
additional_error)) |
1180 |
> |
goto failure; |
1181 |
> |
|
1182 |
|
} |
1183 |
|
/* bond order parameter as a function of radius (--rcut must be specified). */ |
1184 |
|
else if (strcmp (long_options[option_index].name, "bor") == 0) |
1185 |
|
{ |
1186 |
< |
if (local_args_info.bor_given) |
1215 |
< |
{ |
1216 |
< |
fprintf (stderr, "%s: `--bor' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1217 |
< |
goto failure; |
1218 |
< |
} |
1219 |
< |
if (args_info->bor_given && ! override) |
1220 |
< |
continue; |
1221 |
< |
local_args_info.bor_given = 1; |
1222 |
< |
args_info->bor_given = 1; |
1186 |
> |
|
1187 |
|
if (args_info->staticProps_group_counter && override) |
1188 |
|
reset_group_staticProps (args_info); |
1189 |
|
args_info->staticProps_group_counter += 1; |
1190 |
< |
break; |
1190 |
> |
|
1191 |
> |
if (update_arg( 0 , |
1192 |
> |
0 , &(args_info->bor_given), |
1193 |
> |
&(local_args_info.bor_given), optarg, 0, 0, ARG_NO, |
1194 |
> |
check_ambiguity, override, 0, 0, |
1195 |
> |
"bor", '-', |
1196 |
> |
additional_error)) |
1197 |
> |
goto failure; |
1198 |
> |
|
1199 |
|
} |
1200 |
|
/* N(theta) bond angle density within (--rcut must be specified). */ |
1201 |
|
else if (strcmp (long_options[option_index].name, "bad") == 0) |
1202 |
|
{ |
1203 |
< |
if (local_args_info.bad_given) |
1232 |
< |
{ |
1233 |
< |
fprintf (stderr, "%s: `--bad' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1234 |
< |
goto failure; |
1235 |
< |
} |
1236 |
< |
if (args_info->bad_given && ! override) |
1237 |
< |
continue; |
1238 |
< |
local_args_info.bad_given = 1; |
1239 |
< |
args_info->bad_given = 1; |
1203 |
> |
|
1204 |
|
if (args_info->staticProps_group_counter && override) |
1205 |
|
reset_group_staticProps (args_info); |
1206 |
|
args_info->staticProps_group_counter += 1; |
1207 |
< |
break; |
1207 |
> |
|
1208 |
> |
if (update_arg( 0 , |
1209 |
> |
0 , &(args_info->bad_given), |
1210 |
> |
&(local_args_info.bad_given), optarg, 0, 0, ARG_NO, |
1211 |
> |
check_ambiguity, override, 0, 0, |
1212 |
> |
"bad", '-', |
1213 |
> |
additional_error)) |
1214 |
> |
goto failure; |
1215 |
> |
|
1216 |
|
} |
1217 |
+ |
/* g(z). */ |
1218 |
+ |
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
1219 |
+ |
{ |
1220 |
+ |
|
1221 |
+ |
if (args_info->staticProps_group_counter && override) |
1222 |
+ |
reset_group_staticProps (args_info); |
1223 |
+ |
args_info->staticProps_group_counter += 1; |
1224 |
+ |
|
1225 |
+ |
if (update_arg( 0 , |
1226 |
+ |
0 , &(args_info->gofz_given), |
1227 |
+ |
&(local_args_info.gofz_given), optarg, 0, 0, ARG_NO, |
1228 |
+ |
check_ambiguity, override, 0, 0, |
1229 |
+ |
"gofz", '-', |
1230 |
+ |
additional_error)) |
1231 |
+ |
goto failure; |
1232 |
+ |
|
1233 |
+ |
} |
1234 |
|
/* g(r, cos(theta)). */ |
1235 |
|
else if (strcmp (long_options[option_index].name, "r_theta") == 0) |
1236 |
|
{ |
1237 |
< |
if (local_args_info.r_theta_given) |
1249 |
< |
{ |
1250 |
< |
fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1251 |
< |
goto failure; |
1252 |
< |
} |
1253 |
< |
if (args_info->r_theta_given && ! override) |
1254 |
< |
continue; |
1255 |
< |
local_args_info.r_theta_given = 1; |
1256 |
< |
args_info->r_theta_given = 1; |
1237 |
> |
|
1238 |
|
if (args_info->staticProps_group_counter && override) |
1239 |
|
reset_group_staticProps (args_info); |
1240 |
|
args_info->staticProps_group_counter += 1; |
1241 |
< |
break; |
1241 |
> |
|
1242 |
> |
if (update_arg( 0 , |
1243 |
> |
0 , &(args_info->r_theta_given), |
1244 |
> |
&(local_args_info.r_theta_given), optarg, 0, 0, ARG_NO, |
1245 |
> |
check_ambiguity, override, 0, 0, |
1246 |
> |
"r_theta", '-', |
1247 |
> |
additional_error)) |
1248 |
> |
goto failure; |
1249 |
> |
|
1250 |
|
} |
1251 |
|
/* g(r, cos(omega)). */ |
1252 |
|
else if (strcmp (long_options[option_index].name, "r_omega") == 0) |
1253 |
|
{ |
1254 |
< |
if (local_args_info.r_omega_given) |
1266 |
< |
{ |
1267 |
< |
fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1268 |
< |
goto failure; |
1269 |
< |
} |
1270 |
< |
if (args_info->r_omega_given && ! override) |
1271 |
< |
continue; |
1272 |
< |
local_args_info.r_omega_given = 1; |
1273 |
< |
args_info->r_omega_given = 1; |
1254 |
> |
|
1255 |
|
if (args_info->staticProps_group_counter && override) |
1256 |
|
reset_group_staticProps (args_info); |
1257 |
|
args_info->staticProps_group_counter += 1; |
1258 |
< |
break; |
1258 |
> |
|
1259 |
> |
if (update_arg( 0 , |
1260 |
> |
0 , &(args_info->r_omega_given), |
1261 |
> |
&(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO, |
1262 |
> |
check_ambiguity, override, 0, 0, |
1263 |
> |
"r_omega", '-', |
1264 |
> |
additional_error)) |
1265 |
> |
goto failure; |
1266 |
> |
|
1267 |
|
} |
1268 |
+ |
/* g(r, z). */ |
1269 |
+ |
else if (strcmp (long_options[option_index].name, "r_z") == 0) |
1270 |
+ |
{ |
1271 |
+ |
|
1272 |
+ |
if (args_info->staticProps_group_counter && override) |
1273 |
+ |
reset_group_staticProps (args_info); |
1274 |
+ |
args_info->staticProps_group_counter += 1; |
1275 |
+ |
|
1276 |
+ |
if (update_arg( 0 , |
1277 |
+ |
0 , &(args_info->r_z_given), |
1278 |
+ |
&(local_args_info.r_z_given), optarg, 0, 0, ARG_NO, |
1279 |
+ |
check_ambiguity, override, 0, 0, |
1280 |
+ |
"r_z", '-', |
1281 |
+ |
additional_error)) |
1282 |
+ |
goto failure; |
1283 |
+ |
|
1284 |
+ |
} |
1285 |
|
/* g(cos(theta), cos(omega)). */ |
1286 |
|
else if (strcmp (long_options[option_index].name, "theta_omega") == 0) |
1287 |
|
{ |
1288 |
< |
if (local_args_info.theta_omega_given) |
1283 |
< |
{ |
1284 |
< |
fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1285 |
< |
goto failure; |
1286 |
< |
} |
1287 |
< |
if (args_info->theta_omega_given && ! override) |
1288 |
< |
continue; |
1289 |
< |
local_args_info.theta_omega_given = 1; |
1290 |
< |
args_info->theta_omega_given = 1; |
1288 |
> |
|
1289 |
|
if (args_info->staticProps_group_counter && override) |
1290 |
|
reset_group_staticProps (args_info); |
1291 |
|
args_info->staticProps_group_counter += 1; |
1292 |
< |
break; |
1292 |
> |
|
1293 |
> |
if (update_arg( 0 , |
1294 |
> |
0 , &(args_info->theta_omega_given), |
1295 |
> |
&(local_args_info.theta_omega_given), optarg, 0, 0, ARG_NO, |
1296 |
> |
check_ambiguity, override, 0, 0, |
1297 |
> |
"theta_omega", '-', |
1298 |
> |
additional_error)) |
1299 |
> |
goto failure; |
1300 |
> |
|
1301 |
|
} |
1302 |
|
/* g(x, y, z). */ |
1303 |
|
else if (strcmp (long_options[option_index].name, "gxyz") == 0) |
1304 |
|
{ |
1305 |
< |
if (local_args_info.gxyz_given) |
1300 |
< |
{ |
1301 |
< |
fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1302 |
< |
goto failure; |
1303 |
< |
} |
1304 |
< |
if (args_info->gxyz_given && ! override) |
1305 |
< |
continue; |
1306 |
< |
local_args_info.gxyz_given = 1; |
1307 |
< |
args_info->gxyz_given = 1; |
1305 |
> |
|
1306 |
|
if (args_info->staticProps_group_counter && override) |
1307 |
|
reset_group_staticProps (args_info); |
1308 |
|
args_info->staticProps_group_counter += 1; |
1309 |
< |
break; |
1309 |
> |
|
1310 |
> |
if (update_arg( 0 , |
1311 |
> |
0 , &(args_info->gxyz_given), |
1312 |
> |
&(local_args_info.gxyz_given), optarg, 0, 0, ARG_NO, |
1313 |
> |
check_ambiguity, override, 0, 0, |
1314 |
> |
"gxyz", '-', |
1315 |
> |
additional_error)) |
1316 |
> |
goto failure; |
1317 |
> |
|
1318 |
|
} |
1319 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
1320 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
1321 |
|
{ |
1322 |
< |
if (local_args_info.rp2_given) |
1317 |
< |
{ |
1318 |
< |
fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1319 |
< |
goto failure; |
1320 |
< |
} |
1321 |
< |
if (args_info->rp2_given && ! override) |
1322 |
< |
continue; |
1323 |
< |
local_args_info.rp2_given = 1; |
1324 |
< |
args_info->rp2_given = 1; |
1322 |
> |
|
1323 |
|
if (args_info->staticProps_group_counter && override) |
1324 |
|
reset_group_staticProps (args_info); |
1325 |
|
args_info->staticProps_group_counter += 1; |
1326 |
< |
break; |
1326 |
> |
|
1327 |
> |
if (update_arg( 0 , |
1328 |
> |
0 , &(args_info->rp2_given), |
1329 |
> |
&(local_args_info.rp2_given), optarg, 0, 0, ARG_NO, |
1330 |
> |
check_ambiguity, override, 0, 0, |
1331 |
> |
"rp2", '-', |
1332 |
> |
additional_error)) |
1333 |
> |
goto failure; |
1334 |
> |
|
1335 |
|
} |
1336 |
|
/* slab density. */ |
1337 |
|
else if (strcmp (long_options[option_index].name, "slab_density") == 0) |
1338 |
|
{ |
1339 |
< |
if (local_args_info.slab_density_given) |
1334 |
< |
{ |
1335 |
< |
fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1336 |
< |
goto failure; |
1337 |
< |
} |
1338 |
< |
if (args_info->slab_density_given && ! override) |
1339 |
< |
continue; |
1340 |
< |
local_args_info.slab_density_given = 1; |
1341 |
< |
args_info->slab_density_given = 1; |
1339 |
> |
|
1340 |
|
if (args_info->staticProps_group_counter && override) |
1341 |
|
reset_group_staticProps (args_info); |
1342 |
|
args_info->staticProps_group_counter += 1; |
1343 |
< |
break; |
1343 |
> |
|
1344 |
> |
if (update_arg( 0 , |
1345 |
> |
0 , &(args_info->slab_density_given), |
1346 |
> |
&(local_args_info.slab_density_given), optarg, 0, 0, ARG_NO, |
1347 |
> |
check_ambiguity, override, 0, 0, |
1348 |
> |
"slab_density", '-', |
1349 |
> |
additional_error)) |
1350 |
> |
goto failure; |
1351 |
> |
|
1352 |
|
} |
1353 |
+ |
/* p(cos(theta)). */ |
1354 |
+ |
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
1355 |
+ |
{ |
1356 |
+ |
|
1357 |
+ |
if (args_info->staticProps_group_counter && override) |
1358 |
+ |
reset_group_staticProps (args_info); |
1359 |
+ |
args_info->staticProps_group_counter += 1; |
1360 |
+ |
|
1361 |
+ |
if (update_arg( 0 , |
1362 |
+ |
0 , &(args_info->p_angle_given), |
1363 |
+ |
&(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO, |
1364 |
+ |
check_ambiguity, override, 0, 0, |
1365 |
+ |
"p_angle", '-', |
1366 |
+ |
additional_error)) |
1367 |
+ |
goto failure; |
1368 |
+ |
|
1369 |
+ |
} |
1370 |
|
/* hxy. */ |
1371 |
|
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1372 |
|
{ |
1373 |
< |
if (local_args_info.hxy_given) |
1351 |
< |
{ |
1352 |
< |
fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1353 |
< |
goto failure; |
1354 |
< |
} |
1355 |
< |
if (args_info->hxy_given && ! override) |
1356 |
< |
continue; |
1357 |
< |
local_args_info.hxy_given = 1; |
1358 |
< |
args_info->hxy_given = 1; |
1373 |
> |
|
1374 |
|
if (args_info->staticProps_group_counter && override) |
1375 |
|
reset_group_staticProps (args_info); |
1376 |
|
args_info->staticProps_group_counter += 1; |
1377 |
< |
break; |
1377 |
> |
|
1378 |
> |
if (update_arg( 0 , |
1379 |
> |
0 , &(args_info->hxy_given), |
1380 |
> |
&(local_args_info.hxy_given), optarg, 0, 0, ARG_NO, |
1381 |
> |
check_ambiguity, override, 0, 0, |
1382 |
> |
"hxy", '-', |
1383 |
> |
additional_error)) |
1384 |
> |
goto failure; |
1385 |
> |
|
1386 |
|
} |
1387 |
|
/* rho of R. */ |
1388 |
|
else if (strcmp (long_options[option_index].name, "rho_r") == 0) |
1389 |
|
{ |
1390 |
< |
if (local_args_info.rho_r_given) |
1368 |
< |
{ |
1369 |
< |
fprintf (stderr, "%s: `--rho_r' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1370 |
< |
goto failure; |
1371 |
< |
} |
1372 |
< |
if (args_info->rho_r_given && ! override) |
1373 |
< |
continue; |
1374 |
< |
local_args_info.rho_r_given = 1; |
1375 |
< |
args_info->rho_r_given = 1; |
1390 |
> |
|
1391 |
|
if (args_info->staticProps_group_counter && override) |
1392 |
|
reset_group_staticProps (args_info); |
1393 |
|
args_info->staticProps_group_counter += 1; |
1394 |
< |
break; |
1394 |
> |
|
1395 |
> |
if (update_arg( 0 , |
1396 |
> |
0 , &(args_info->rho_r_given), |
1397 |
> |
&(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO, |
1398 |
> |
check_ambiguity, override, 0, 0, |
1399 |
> |
"rho_r", '-', |
1400 |
> |
additional_error)) |
1401 |
> |
goto failure; |
1402 |
> |
|
1403 |
|
} |
1404 |
|
/* hull volume of nanoparticle. */ |
1405 |
|
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
1406 |
|
{ |
1407 |
< |
if (local_args_info.hullvol_given) |
1385 |
< |
{ |
1386 |
< |
fprintf (stderr, "%s: `--hullvol' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1387 |
< |
goto failure; |
1388 |
< |
} |
1389 |
< |
if (args_info->hullvol_given && ! override) |
1390 |
< |
continue; |
1391 |
< |
local_args_info.hullvol_given = 1; |
1392 |
< |
args_info->hullvol_given = 1; |
1407 |
> |
|
1408 |
|
if (args_info->staticProps_group_counter && override) |
1409 |
|
reset_group_staticProps (args_info); |
1410 |
|
args_info->staticProps_group_counter += 1; |
1411 |
< |
break; |
1411 |
> |
|
1412 |
> |
if (update_arg( 0 , |
1413 |
> |
0 , &(args_info->hullvol_given), |
1414 |
> |
&(local_args_info.hullvol_given), optarg, 0, 0, ARG_NO, |
1415 |
> |
check_ambiguity, override, 0, 0, |
1416 |
> |
"hullvol", '-', |
1417 |
> |
additional_error)) |
1418 |
> |
goto failure; |
1419 |
> |
|
1420 |
|
} |
1421 |
|
|
1422 |
|
break; |
1448 |
|
if ( error ) |
1449 |
|
return (EXIT_FAILURE); |
1450 |
|
|
1428 |
– |
if (optind < argc) |
1429 |
– |
{ |
1430 |
– |
int i = 0 ; |
1431 |
– |
int found_prog_name = 0; |
1432 |
– |
/* whether program name, i.e., argv[0], is in the remaining args |
1433 |
– |
(this may happen with some implementations of getopt, |
1434 |
– |
but surely not with the one included by gengetopt) */ |
1435 |
– |
|
1436 |
– |
i = optind; |
1437 |
– |
while (i < argc) |
1438 |
– |
if (argv[i++] == argv[0]) { |
1439 |
– |
found_prog_name = 1; |
1440 |
– |
break; |
1441 |
– |
} |
1442 |
– |
i = 0; |
1443 |
– |
|
1444 |
– |
args_info->inputs_num = argc - optind - found_prog_name; |
1445 |
– |
args_info->inputs = |
1446 |
– |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
1447 |
– |
while (optind < argc) |
1448 |
– |
if (argv[optind++] != argv[0]) |
1449 |
– |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
1450 |
– |
} |
1451 |
– |
|
1451 |
|
return 0; |
1452 |
|
|
1453 |
|
failure: |