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