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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (file contents), Revision 1091 by chuckv, Fri Nov 10 18:45:29 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1865 by gezelter, Wed Apr 17 18:24:08 2013 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1091 by chuckv, Fri Nov 10 18:45:29 2006 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1865 by gezelter, Wed Apr 17 18:24:08 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines