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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (file contents), Revision 1039 by gezelter, Tue Sep 19 21:14:11 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1795 by gezelter, Fri Sep 7 18:13:55 2012 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1039 by gezelter, Tue Sep 19 21:14:11 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1795 by gezelter, Fri Sep 7 18:13:55 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines