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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (file contents), Revision 1041 by gezelter, Wed Sep 20 20:13:40 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1762 by plouden, Thu Jun 28 20:17:33 2012 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1041 by gezelter, Wed Sep 20 20:13:40 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1762 by plouden, Thu Jun 28 20:17:33 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines