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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1052 by gezelter, Tue Sep 26 01:30:32 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1819 by gezelter, Thu Dec 13 16:57:39 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines