ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/applications/staticProps/StaticPropsCmd.cpp
(Generate patch)

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (file contents), Revision 840 by tim, Mon Jan 9 22:14:32 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1848 by gezelter, Mon Feb 4 21:13:46 2013 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 840 by tim, Mon Jan 9 22:14:32 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1848 by gezelter, Mon Feb 4 21:13:46 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines