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