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

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 1041 by gezelter, Wed Sep 20 20:13:40 2006 UTC vs.
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.16
2 >  File autogenerated by gengetopt version 2.22
3    generated with the following command:
4    gengetopt -F StaticPropsCmd
5  
# Line 21 | Line 21
21  
22   #include "StaticPropsCmd.h"
23  
24 + const char *gengetopt_args_info_purpose = "";
25 +
26 + const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]...";
27 +
28 + const char *gengetopt_args_info_description = "";
29 +
30 + const char *gengetopt_args_info_help[] = {
31 +  "  -h, --help                    Print help and exit",
32 +  "  -V, --version                 Print version and exit",
33 +  "  -i, --input=filename          input dump file",
34 +  "  -o, --output=filename         output file name",
35 +  "  -n, --step=INT                process every n frame  (default=`1')",
36 +  "  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')",
37 +  "  -x, --nbins_x=INT             number of bins in x axis  (default=`100')",
38 +  "  -y, --nbins_y=INT             number of bins in y axis  (default=`100')",
39 +  "  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')",
40 +  "      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)",
41 +  "  -c, --rcut=DOUBLE             cutoff radius (rcut)",
42 +  "  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')",
43 +  "      --sele1=selection script  select the first stuntdouble set",
44 +  "      --sele2=selection script  select the second stuntdouble set",
45 +  "      --sele3=selection script  select the third stuntdouble set",
46 +  "      --refsele=selection script\n                                select reference (use and only use with --gxyz)",
47 +  "      --comsele=selection script\n                                select stunt doubles for center-of-mass \n                                  reference point",
48 +  "      --molname=STRING          molecule name",
49 +  "      --begin=INT               begin internal index",
50 +  "      --end=INT                 end internal index",
51 +  "      --radius=DOUBLE           nanoparticle radius",
52 +  "\n Group: staticProps\n   an option of this group is required",
53 +  "      --bo                      bond order parameter (--rcut must be specified)",
54 +  "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
55 +  "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
56 +  "  -g, --gofr                    g(r)",
57 +  "      --gofz                    g(z)",
58 +  "      --r_theta                 g(r, cos(theta))",
59 +  "      --r_omega                 g(r, cos(omega))",
60 +  "      --theta_omega             g(cos(theta), cos(omega))",
61 +  "      --gxyz                    g(x, y, z)",
62 +  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
63 +  "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
64 +  "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
65 +  "  -d, --density                 density plot",
66 +  "      --slab_density            slab density",
67 +  "      --hxy                     hxy",
68 +  "      --rho_r                   rho of R",
69 +  "      --hullvol                 hull volume of nanoparticle",
70 +    0
71 + };
72 +
73 + typedef enum {ARG_NO
74 +  , ARG_STRING
75 +  , ARG_INT
76 +  , ARG_DOUBLE
77 + } cmdline_parser_arg_type;
78 +
79   static
80   void clear_given (struct gengetopt_args_info *args_info);
81   static
82   void clear_args (struct gengetopt_args_info *args_info);
83  
84   static int
85 < 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);
85 > cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
86 >                        struct cmdline_parser_params *params, const char *additional_error);
87  
88   static int
89   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
# Line 48 | Line 104 | void clear_given (struct gengetopt_args_info *args_inf
104    args_info->nbins_y_given = 0 ;
105    args_info->nanglebins_given = 0 ;
106    args_info->length_given = 0 ;
51  args_info->LegendreL_given = 0 ;
107    args_info->rcut_given = 0 ;
108    args_info->zoffset_given = 0 ;
109    args_info->sele1_given = 0 ;
110    args_info->sele2_given = 0 ;
111    args_info->sele3_given = 0 ;
112    args_info->refsele_given = 0 ;
113 +  args_info->comsele_given = 0 ;
114    args_info->molname_given = 0 ;
115    args_info->begin_given = 0 ;
116    args_info->end_given = 0 ;
117 +  args_info->radius_given = 0 ;
118    args_info->bo_given = 0 ;
119 +  args_info->bor_given = 0 ;
120 +  args_info->bad_given = 0 ;
121    args_info->gofr_given = 0 ;
122 +  args_info->gofz_given = 0 ;
123    args_info->r_theta_given = 0 ;
124    args_info->r_omega_given = 0 ;
125    args_info->theta_omega_given = 0 ;
# Line 70 | Line 130 | void clear_given (struct gengetopt_args_info *args_inf
130    args_info->density_given = 0 ;
131    args_info->slab_density_given = 0 ;
132    args_info->hxy_given = 0 ;
133 +  args_info->rho_r_given = 0 ;
134 +  args_info->hullvol_given = 0 ;
135    args_info->staticProps_group_counter = 0 ;
136   }
137  
# Line 91 | Line 153 | void clear_args (struct gengetopt_args_info *args_info
153    args_info->nanglebins_arg = 50;
154    args_info->nanglebins_orig = NULL;
155    args_info->length_orig = NULL;
94  args_info->LegendreL_orig = NULL;
156    args_info->rcut_orig = NULL;
157    args_info->zoffset_arg = 0;
158    args_info->zoffset_orig = NULL;
# Line 103 | Line 164 | void clear_args (struct gengetopt_args_info *args_info
164    args_info->sele3_orig = NULL;
165    args_info->refsele_arg = NULL;
166    args_info->refsele_orig = NULL;
167 +  args_info->comsele_arg = NULL;
168 +  args_info->comsele_orig = NULL;
169    args_info->molname_arg = NULL;
170    args_info->molname_orig = NULL;
171    args_info->begin_orig = NULL;
172    args_info->end_orig = NULL;
173 +  args_info->radius_orig = NULL;
174    
175   }
176  
177 + static
178 + void init_args_info(struct gengetopt_args_info *args_info)
179 + {
180 +
181 +
182 +  args_info->help_help = gengetopt_args_info_help[0] ;
183 +  args_info->version_help = gengetopt_args_info_help[1] ;
184 +  args_info->input_help = gengetopt_args_info_help[2] ;
185 +  args_info->output_help = gengetopt_args_info_help[3] ;
186 +  args_info->step_help = gengetopt_args_info_help[4] ;
187 +  args_info->nbins_help = gengetopt_args_info_help[5] ;
188 +  args_info->nbins_x_help = gengetopt_args_info_help[6] ;
189 +  args_info->nbins_y_help = gengetopt_args_info_help[7] ;
190 +  args_info->nanglebins_help = gengetopt_args_info_help[8] ;
191 +  args_info->length_help = gengetopt_args_info_help[9] ;
192 +  args_info->rcut_help = gengetopt_args_info_help[10] ;
193 +  args_info->zoffset_help = gengetopt_args_info_help[11] ;
194 +  args_info->sele1_help = gengetopt_args_info_help[12] ;
195 +  args_info->sele2_help = gengetopt_args_info_help[13] ;
196 +  args_info->sele3_help = gengetopt_args_info_help[14] ;
197 +  args_info->refsele_help = gengetopt_args_info_help[15] ;
198 +  args_info->comsele_help = gengetopt_args_info_help[16] ;
199 +  args_info->molname_help = gengetopt_args_info_help[17] ;
200 +  args_info->begin_help = gengetopt_args_info_help[18] ;
201 +  args_info->end_help = gengetopt_args_info_help[19] ;
202 +  args_info->radius_help = gengetopt_args_info_help[20] ;
203 +  args_info->bo_help = gengetopt_args_info_help[22] ;
204 +  args_info->bor_help = gengetopt_args_info_help[23] ;
205 +  args_info->bad_help = gengetopt_args_info_help[24] ;
206 +  args_info->gofr_help = gengetopt_args_info_help[25] ;
207 +  args_info->gofz_help = gengetopt_args_info_help[26] ;
208 +  args_info->r_theta_help = gengetopt_args_info_help[27] ;
209 +  args_info->r_omega_help = gengetopt_args_info_help[28] ;
210 +  args_info->theta_omega_help = gengetopt_args_info_help[29] ;
211 +  args_info->gxyz_help = gengetopt_args_info_help[30] ;
212 +  args_info->p2_help = gengetopt_args_info_help[31] ;
213 +  args_info->rp2_help = gengetopt_args_info_help[32] ;
214 +  args_info->scd_help = gengetopt_args_info_help[33] ;
215 +  args_info->density_help = gengetopt_args_info_help[34] ;
216 +  args_info->slab_density_help = gengetopt_args_info_help[35] ;
217 +  args_info->hxy_help = gengetopt_args_info_help[36] ;
218 +  args_info->rho_r_help = gengetopt_args_info_help[37] ;
219 +  args_info->hullvol_help = gengetopt_args_info_help[38] ;
220 +  
221 + }
222 +
223   void
224   cmdline_parser_print_version (void)
225   {
226    printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
227   }
228  
229 + static void print_help_common(void) {
230 +  cmdline_parser_print_version ();
231 +
232 +  if (strlen(gengetopt_args_info_purpose) > 0)
233 +    printf("\n%s\n", gengetopt_args_info_purpose);
234 +
235 +  if (strlen(gengetopt_args_info_usage) > 0)
236 +    printf("\n%s\n", gengetopt_args_info_usage);
237 +
238 +  printf("\n");
239 +
240 +  if (strlen(gengetopt_args_info_description) > 0)
241 +    printf("%s\n", gengetopt_args_info_description);
242 + }
243 +
244   void
245   cmdline_parser_print_help (void)
246   {
247 <  cmdline_parser_print_version ();
248 <  printf("\nUsage: StaticProps [OPTIONS]...\n\n");
249 <  printf("%s\n","  -h, --help                    Print help and exit");
250 <  printf("%s\n","  -V, --version                 Print version and exit");
126 <  printf("%s\n","  -i, --input=filename          input dump file");
127 <  printf("%s\n","  -o, --output=filename         output file name");
128 <  printf("%s\n","  -n, --step=INT                process every n frame  (default=`1')");
129 <  printf("%s\n","  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')");
130 <  printf("%s\n","  -x, --nbins_x=INT             number of bins in x axis  (default=`100')");
131 <  printf("%s\n","  -y, --nbins_y=INT             number of bins in y axis  (default=`100')");
132 <  printf("%s\n","  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')");
133 <  printf("%s\n","      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)");
134 <  printf("%s\n","  -l, --LegendreL=INT           Order of Legendre Polynomial (used for Bond \n                                  Order calculations)");
135 <  printf("%s\n","  -c, --rcut=DOUBLE             cutoff radius (rcut)");
136 <  printf("%s\n","  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')");
137 <  printf("%s\n","      --sele1=selection script  select the first stuntdouble set");
138 <  printf("%s\n","      --sele2=selection script  select the second stuntdouble set");
139 <  printf("%s\n","      --sele3=selection script  select the third stuntdouble set");
140 <  printf("%s\n","      --refsele=selection script\n                                select reference (use and only use with --gxyz)");
141 <  printf("%s\n","      --molname=STRING          molecule name");
142 <  printf("%s\n","      --begin=INT               begin internal index");
143 <  printf("%s\n","      --end=INT                 end internal index");
144 <  printf("%s\n","\n Group: staticProps\n   an option of this group is required");
145 <  printf("%s\n","      --bo                      bond order parameter (--rcut and --LegendreL \n                                  must be specified");
146 <  printf("%s\n","  -g, --gofr                    g(r)");
147 <  printf("%s\n","      --r_theta                 g(r, cos(theta))");
148 <  printf("%s\n","      --r_omega                 g(r, cos(omega))");
149 <  printf("%s\n","      --theta_omega             g(cos(theta), cos(omega))");
150 <  printf("%s\n","      --gxyz                    g(x, y, z)");
151 <  printf("%s\n","  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)");
152 <  printf("%s\n","      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)");
153 <  printf("%s\n","  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)");
154 <  printf("%s\n","  -d, --density                 density plot");
155 <  printf("%s\n","      --slab_density            slab density");
156 <  printf("%s\n","      --hxy                     hxy");
157 <  
247 >  int i = 0;
248 >  print_help_common();
249 >  while (gengetopt_args_info_help[i])
250 >    printf("%s\n", gengetopt_args_info_help[i++]);
251   }
252  
253   void
# Line 162 | Line 255 | cmdline_parser_init (struct gengetopt_args_info *args_
255   {
256    clear_given (args_info);
257    clear_args (args_info);
258 +  init_args_info (args_info);
259   }
260  
261 + void
262 + cmdline_parser_params_init(struct cmdline_parser_params *params)
263 + {
264 +  if (params)
265 +    {
266 +      params->override = 0;
267 +      params->initialize = 1;
268 +      params->check_required = 1;
269 +      params->check_ambiguity = 0;
270 +      params->print_errors = 1;
271 +    }
272 + }
273 +
274 + struct cmdline_parser_params *
275 + cmdline_parser_params_create(void)
276 + {
277 +  struct cmdline_parser_params *params =
278 +    (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
279 +  cmdline_parser_params_init(params);  
280 +  return params;
281 + }
282 +
283   static void
284 < cmdline_parser_release (struct gengetopt_args_info *args_info)
284 > free_string_field (char **s)
285   {
286 <  
171 <  if (args_info->input_arg)
286 >  if (*s)
287      {
288 <      free (args_info->input_arg); /* free previous argument */
289 <      args_info->input_arg = 0;
288 >      free (*s);
289 >      *s = 0;
290      }
291 <  if (args_info->input_orig)
292 <    {
293 <      free (args_info->input_orig); /* free previous argument */
294 <      args_info->input_orig = 0;
295 <    }
296 <  if (args_info->output_arg)
291 > }
292 >
293 >
294 > static void
295 > cmdline_parser_release (struct gengetopt_args_info *args_info)
296 > {
297 >
298 >  free_string_field (&(args_info->input_arg));
299 >  free_string_field (&(args_info->input_orig));
300 >  free_string_field (&(args_info->output_arg));
301 >  free_string_field (&(args_info->output_orig));
302 >  free_string_field (&(args_info->step_orig));
303 >  free_string_field (&(args_info->nbins_orig));
304 >  free_string_field (&(args_info->nbins_x_orig));
305 >  free_string_field (&(args_info->nbins_y_orig));
306 >  free_string_field (&(args_info->nanglebins_orig));
307 >  free_string_field (&(args_info->length_orig));
308 >  free_string_field (&(args_info->rcut_orig));
309 >  free_string_field (&(args_info->zoffset_orig));
310 >  free_string_field (&(args_info->sele1_arg));
311 >  free_string_field (&(args_info->sele1_orig));
312 >  free_string_field (&(args_info->sele2_arg));
313 >  free_string_field (&(args_info->sele2_orig));
314 >  free_string_field (&(args_info->sele3_arg));
315 >  free_string_field (&(args_info->sele3_orig));
316 >  free_string_field (&(args_info->refsele_arg));
317 >  free_string_field (&(args_info->refsele_orig));
318 >  free_string_field (&(args_info->comsele_arg));
319 >  free_string_field (&(args_info->comsele_orig));
320 >  free_string_field (&(args_info->molname_arg));
321 >  free_string_field (&(args_info->molname_orig));
322 >  free_string_field (&(args_info->begin_orig));
323 >  free_string_field (&(args_info->end_orig));
324 >  free_string_field (&(args_info->radius_orig));
325 >  
326 >  
327 >
328 >  clear_given (args_info);
329 > }
330 >
331 >
332 > static void
333 > write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
334 > {
335 >  if (arg) {
336 >    fprintf(outfile, "%s=\"%s\"\n", opt, arg);
337 >  } else {
338 >    fprintf(outfile, "%s\n", opt);
339 >  }
340 > }
341 >
342 >
343 > int
344 > cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
345 > {
346 >  int i = 0;
347 >
348 >  if (!outfile)
349      {
350 <      free (args_info->output_arg); /* free previous argument */
351 <      args_info->output_arg = 0;
350 >      fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
351 >      return EXIT_FAILURE;
352      }
353 <  if (args_info->output_orig)
354 <    {
355 <      free (args_info->output_orig); /* free previous argument */
356 <      args_info->output_orig = 0;
357 <    }
358 <  if (args_info->step_orig)
359 <    {
360 <      free (args_info->step_orig); /* free previous argument */
361 <      args_info->step_orig = 0;
362 <    }
363 <  if (args_info->nbins_orig)
364 <    {
365 <      free (args_info->nbins_orig); /* free previous argument */
366 <      args_info->nbins_orig = 0;
367 <    }
368 <  if (args_info->nbins_x_orig)
369 <    {
370 <      free (args_info->nbins_x_orig); /* free previous argument */
371 <      args_info->nbins_x_orig = 0;
372 <    }
373 <  if (args_info->nbins_y_orig)
374 <    {
375 <      free (args_info->nbins_y_orig); /* free previous argument */
376 <      args_info->nbins_y_orig = 0;
377 <    }
378 <  if (args_info->nanglebins_orig)
379 <    {
380 <      free (args_info->nanglebins_orig); /* free previous argument */
381 <      args_info->nanglebins_orig = 0;
382 <    }
383 <  if (args_info->length_orig)
384 <    {
385 <      free (args_info->length_orig); /* free previous argument */
386 <      args_info->length_orig = 0;
387 <    }
388 <  if (args_info->LegendreL_orig)
389 <    {
390 <      free (args_info->LegendreL_orig); /* free previous argument */
391 <      args_info->LegendreL_orig = 0;
392 <    }
393 <  if (args_info->rcut_orig)
394 <    {
395 <      free (args_info->rcut_orig); /* free previous argument */
396 <      args_info->rcut_orig = 0;
397 <    }
398 <  if (args_info->zoffset_orig)
399 <    {
400 <      free (args_info->zoffset_orig); /* free previous argument */
401 <      args_info->zoffset_orig = 0;
402 <    }
403 <  if (args_info->sele1_arg)
404 <    {
405 <      free (args_info->sele1_arg); /* free previous argument */
406 <      args_info->sele1_arg = 0;
407 <    }
408 <  if (args_info->sele1_orig)
409 <    {
410 <      free (args_info->sele1_orig); /* free previous argument */
411 <      args_info->sele1_orig = 0;
412 <    }
413 <  if (args_info->sele2_arg)
414 <    {
415 <      free (args_info->sele2_arg); /* free previous argument */
416 <      args_info->sele2_arg = 0;
417 <    }
418 <  if (args_info->sele2_orig)
419 <    {
420 <      free (args_info->sele2_orig); /* free previous argument */
421 <      args_info->sele2_orig = 0;
422 <    }
423 <  if (args_info->sele3_arg)
424 <    {
425 <      free (args_info->sele3_arg); /* free previous argument */
426 <      args_info->sele3_arg = 0;
427 <    }
428 <  if (args_info->sele3_orig)
429 <    {
263 <      free (args_info->sele3_orig); /* free previous argument */
264 <      args_info->sele3_orig = 0;
265 <    }
266 <  if (args_info->refsele_arg)
267 <    {
268 <      free (args_info->refsele_arg); /* free previous argument */
269 <      args_info->refsele_arg = 0;
270 <    }
271 <  if (args_info->refsele_orig)
272 <    {
273 <      free (args_info->refsele_orig); /* free previous argument */
274 <      args_info->refsele_orig = 0;
275 <    }
276 <  if (args_info->molname_arg)
277 <    {
278 <      free (args_info->molname_arg); /* free previous argument */
279 <      args_info->molname_arg = 0;
280 <    }
281 <  if (args_info->molname_orig)
282 <    {
283 <      free (args_info->molname_orig); /* free previous argument */
284 <      args_info->molname_orig = 0;
285 <    }
286 <  if (args_info->begin_orig)
287 <    {
288 <      free (args_info->begin_orig); /* free previous argument */
289 <      args_info->begin_orig = 0;
290 <    }
291 <  if (args_info->end_orig)
292 <    {
293 <      free (args_info->end_orig); /* free previous argument */
294 <      args_info->end_orig = 0;
295 <    }
353 >
354 >  if (args_info->help_given)
355 >    write_into_file(outfile, "help", 0, 0 );
356 >  if (args_info->version_given)
357 >    write_into_file(outfile, "version", 0, 0 );
358 >  if (args_info->input_given)
359 >    write_into_file(outfile, "input", args_info->input_orig, 0);
360 >  if (args_info->output_given)
361 >    write_into_file(outfile, "output", args_info->output_orig, 0);
362 >  if (args_info->step_given)
363 >    write_into_file(outfile, "step", args_info->step_orig, 0);
364 >  if (args_info->nbins_given)
365 >    write_into_file(outfile, "nbins", args_info->nbins_orig, 0);
366 >  if (args_info->nbins_x_given)
367 >    write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0);
368 >  if (args_info->nbins_y_given)
369 >    write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0);
370 >  if (args_info->nanglebins_given)
371 >    write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0);
372 >  if (args_info->length_given)
373 >    write_into_file(outfile, "length", args_info->length_orig, 0);
374 >  if (args_info->rcut_given)
375 >    write_into_file(outfile, "rcut", args_info->rcut_orig, 0);
376 >  if (args_info->zoffset_given)
377 >    write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0);
378 >  if (args_info->sele1_given)
379 >    write_into_file(outfile, "sele1", args_info->sele1_orig, 0);
380 >  if (args_info->sele2_given)
381 >    write_into_file(outfile, "sele2", args_info->sele2_orig, 0);
382 >  if (args_info->sele3_given)
383 >    write_into_file(outfile, "sele3", args_info->sele3_orig, 0);
384 >  if (args_info->refsele_given)
385 >    write_into_file(outfile, "refsele", args_info->refsele_orig, 0);
386 >  if (args_info->comsele_given)
387 >    write_into_file(outfile, "comsele", args_info->comsele_orig, 0);
388 >  if (args_info->molname_given)
389 >    write_into_file(outfile, "molname", args_info->molname_orig, 0);
390 >  if (args_info->begin_given)
391 >    write_into_file(outfile, "begin", args_info->begin_orig, 0);
392 >  if (args_info->end_given)
393 >    write_into_file(outfile, "end", args_info->end_orig, 0);
394 >  if (args_info->radius_given)
395 >    write_into_file(outfile, "radius", args_info->radius_orig, 0);
396 >  if (args_info->bo_given)
397 >    write_into_file(outfile, "bo", 0, 0 );
398 >  if (args_info->bor_given)
399 >    write_into_file(outfile, "bor", 0, 0 );
400 >  if (args_info->bad_given)
401 >    write_into_file(outfile, "bad", 0, 0 );
402 >  if (args_info->gofr_given)
403 >    write_into_file(outfile, "gofr", 0, 0 );
404 >  if (args_info->gofz_given)
405 >    write_into_file(outfile, "gofz", 0, 0 );
406 >  if (args_info->r_theta_given)
407 >    write_into_file(outfile, "r_theta", 0, 0 );
408 >  if (args_info->r_omega_given)
409 >    write_into_file(outfile, "r_omega", 0, 0 );
410 >  if (args_info->theta_omega_given)
411 >    write_into_file(outfile, "theta_omega", 0, 0 );
412 >  if (args_info->gxyz_given)
413 >    write_into_file(outfile, "gxyz", 0, 0 );
414 >  if (args_info->p2_given)
415 >    write_into_file(outfile, "p2", 0, 0 );
416 >  if (args_info->rp2_given)
417 >    write_into_file(outfile, "rp2", 0, 0 );
418 >  if (args_info->scd_given)
419 >    write_into_file(outfile, "scd", 0, 0 );
420 >  if (args_info->density_given)
421 >    write_into_file(outfile, "density", 0, 0 );
422 >  if (args_info->slab_density_given)
423 >    write_into_file(outfile, "slab_density", 0, 0 );
424 >  if (args_info->hxy_given)
425 >    write_into_file(outfile, "hxy", 0, 0 );
426 >  if (args_info->rho_r_given)
427 >    write_into_file(outfile, "rho_r", 0, 0 );
428 >  if (args_info->hullvol_given)
429 >    write_into_file(outfile, "hullvol", 0, 0 );
430    
431 <  clear_given (args_info);
431 >
432 >  i = EXIT_SUCCESS;
433 >  return i;
434   }
435  
436   int
# Line 311 | Line 447 | cmdline_parser_file_save(const char *filename, struct
447        return EXIT_FAILURE;
448      }
449  
450 <  if (args_info->help_given) {
315 <    fprintf(outfile, "%s\n", "help");
316 <  }
317 <  if (args_info->version_given) {
318 <    fprintf(outfile, "%s\n", "version");
319 <  }
320 <  if (args_info->input_given) {
321 <    if (args_info->input_orig) {
322 <      fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig);
323 <    } else {
324 <      fprintf(outfile, "%s\n", "input");
325 <    }
326 <  }
327 <  if (args_info->output_given) {
328 <    if (args_info->output_orig) {
329 <      fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig);
330 <    } else {
331 <      fprintf(outfile, "%s\n", "output");
332 <    }
333 <  }
334 <  if (args_info->step_given) {
335 <    if (args_info->step_orig) {
336 <      fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig);
337 <    } else {
338 <      fprintf(outfile, "%s\n", "step");
339 <    }
340 <  }
341 <  if (args_info->nbins_given) {
342 <    if (args_info->nbins_orig) {
343 <      fprintf(outfile, "%s=\"%s\"\n", "nbins", args_info->nbins_orig);
344 <    } else {
345 <      fprintf(outfile, "%s\n", "nbins");
346 <    }
347 <  }
348 <  if (args_info->nbins_x_given) {
349 <    if (args_info->nbins_x_orig) {
350 <      fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig);
351 <    } else {
352 <      fprintf(outfile, "%s\n", "nbins_x");
353 <    }
354 <  }
355 <  if (args_info->nbins_y_given) {
356 <    if (args_info->nbins_y_orig) {
357 <      fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig);
358 <    } else {
359 <      fprintf(outfile, "%s\n", "nbins_y");
360 <    }
361 <  }
362 <  if (args_info->nanglebins_given) {
363 <    if (args_info->nanglebins_orig) {
364 <      fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig);
365 <    } else {
366 <      fprintf(outfile, "%s\n", "nanglebins");
367 <    }
368 <  }
369 <  if (args_info->length_given) {
370 <    if (args_info->length_orig) {
371 <      fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig);
372 <    } else {
373 <      fprintf(outfile, "%s\n", "length");
374 <    }
375 <  }
376 <  if (args_info->LegendreL_given) {
377 <    if (args_info->LegendreL_orig) {
378 <      fprintf(outfile, "%s=\"%s\"\n", "LegendreL", args_info->LegendreL_orig);
379 <    } else {
380 <      fprintf(outfile, "%s\n", "LegendreL");
381 <    }
382 <  }
383 <  if (args_info->rcut_given) {
384 <    if (args_info->rcut_orig) {
385 <      fprintf(outfile, "%s=\"%s\"\n", "rcut", args_info->rcut_orig);
386 <    } else {
387 <      fprintf(outfile, "%s\n", "rcut");
388 <    }
389 <  }
390 <  if (args_info->zoffset_given) {
391 <    if (args_info->zoffset_orig) {
392 <      fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig);
393 <    } else {
394 <      fprintf(outfile, "%s\n", "zoffset");
395 <    }
396 <  }
397 <  if (args_info->sele1_given) {
398 <    if (args_info->sele1_orig) {
399 <      fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig);
400 <    } else {
401 <      fprintf(outfile, "%s\n", "sele1");
402 <    }
403 <  }
404 <  if (args_info->sele2_given) {
405 <    if (args_info->sele2_orig) {
406 <      fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig);
407 <    } else {
408 <      fprintf(outfile, "%s\n", "sele2");
409 <    }
410 <  }
411 <  if (args_info->sele3_given) {
412 <    if (args_info->sele3_orig) {
413 <      fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig);
414 <    } else {
415 <      fprintf(outfile, "%s\n", "sele3");
416 <    }
417 <  }
418 <  if (args_info->refsele_given) {
419 <    if (args_info->refsele_orig) {
420 <      fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig);
421 <    } else {
422 <      fprintf(outfile, "%s\n", "refsele");
423 <    }
424 <  }
425 <  if (args_info->molname_given) {
426 <    if (args_info->molname_orig) {
427 <      fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig);
428 <    } else {
429 <      fprintf(outfile, "%s\n", "molname");
430 <    }
431 <  }
432 <  if (args_info->begin_given) {
433 <    if (args_info->begin_orig) {
434 <      fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig);
435 <    } else {
436 <      fprintf(outfile, "%s\n", "begin");
437 <    }
438 <  }
439 <  if (args_info->end_given) {
440 <    if (args_info->end_orig) {
441 <      fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig);
442 <    } else {
443 <      fprintf(outfile, "%s\n", "end");
444 <    }
445 <  }
446 <  if (args_info->bo_given) {
447 <    fprintf(outfile, "%s\n", "bo");
448 <  }
449 <  if (args_info->gofr_given) {
450 <    fprintf(outfile, "%s\n", "gofr");
451 <  }
452 <  if (args_info->r_theta_given) {
453 <    fprintf(outfile, "%s\n", "r_theta");
454 <  }
455 <  if (args_info->r_omega_given) {
456 <    fprintf(outfile, "%s\n", "r_omega");
457 <  }
458 <  if (args_info->theta_omega_given) {
459 <    fprintf(outfile, "%s\n", "theta_omega");
460 <  }
461 <  if (args_info->gxyz_given) {
462 <    fprintf(outfile, "%s\n", "gxyz");
463 <  }
464 <  if (args_info->p2_given) {
465 <    fprintf(outfile, "%s\n", "p2");
466 <  }
467 <  if (args_info->rp2_given) {
468 <    fprintf(outfile, "%s\n", "rp2");
469 <  }
470 <  if (args_info->scd_given) {
471 <    fprintf(outfile, "%s\n", "scd");
472 <  }
473 <  if (args_info->density_given) {
474 <    fprintf(outfile, "%s\n", "density");
475 <  }
476 <  if (args_info->slab_density_given) {
477 <    fprintf(outfile, "%s\n", "slab_density");
478 <  }
479 <  if (args_info->hxy_given) {
480 <    fprintf(outfile, "%s\n", "hxy");
481 <  }
482 <  
450 >  i = cmdline_parser_dump(outfile, args_info);
451    fclose (outfile);
452  
485  i = EXIT_SUCCESS;
453    return i;
454   }
455  
# Line 492 | Line 459 | cmdline_parser_free (struct gengetopt_args_info *args_
459    cmdline_parser_release (args_info);
460   }
461  
462 <
496 < /* gengetopt_strdup() */
497 < /* strdup.c replacement of strdup, which is not standard */
462 > /** @brief replacement of strdup, which is not standard */
463   char *
464   gengetopt_strdup (const char *s)
465   {
# Line 510 | Line 475 | static void
475   }
476  
477   static void
513 reset_group_staticProps(struct gengetopt_args_info *args_info);
514
515 static void
478   reset_group_staticProps(struct gengetopt_args_info *args_info)
479   {
480    if (! args_info->staticProps_group_counter)
481      return;
482    
483    args_info->bo_given = 0 ;
484 +  args_info->bor_given = 0 ;
485 +  args_info->bad_given = 0 ;
486    args_info->gofr_given = 0 ;
487 +  args_info->gofz_given = 0 ;
488    args_info->r_theta_given = 0 ;
489    args_info->r_omega_given = 0 ;
490    args_info->theta_omega_given = 0 ;
# Line 530 | Line 495 | reset_group_staticProps(struct gengetopt_args_info *ar
495    args_info->density_given = 0 ;
496    args_info->slab_density_given = 0 ;
497    args_info->hxy_given = 0 ;
498 +  args_info->rho_r_given = 0 ;
499 +  args_info->hullvol_given = 0 ;
500  
501    args_info->staticProps_group_counter = 0;
502   }
# Line 541 | Line 508 | int
508   }
509  
510   int
511 + cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
512 +                   struct cmdline_parser_params *params)
513 + {
514 +  int result;
515 +  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
516 +
517 +  if (result == EXIT_FAILURE)
518 +    {
519 +      cmdline_parser_free (args_info);
520 +      exit (EXIT_FAILURE);
521 +    }
522 +  
523 +  return result;
524 + }
525 +
526 + int
527   cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
528   {
529    int result;
530 +  struct cmdline_parser_params params;
531 +  
532 +  params.override = override;
533 +  params.initialize = initialize;
534 +  params.check_required = check_required;
535 +  params.check_ambiguity = 0;
536 +  params.print_errors = 1;
537  
538 <  result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL);
538 >  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
539  
540    if (result == EXIT_FAILURE)
541      {
# Line 578 | Line 568 | cmdline_parser_required2 (struct gengetopt_args_info *
568   {
569    int error = 0;
570  
571 +  /* checks for required options */
572    if (! args_info->input_given)
573      {
574        fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
575        error = 1;
576      }
577 +  
578    if (args_info->staticProps_group_counter == 0)
579      {
580        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 : ""));
# Line 590 | Line 582 | cmdline_parser_required2 (struct gengetopt_args_info *
582      }
583    
584  
585 +  /* checks for dependences among options */
586 +
587    return error;
588   }
589  
590 +
591 + static char *package_name = 0;
592 +
593 + /**
594 + * @brief updates an option
595 + * @param field the generic pointer to the field to update
596 + * @param orig_field the pointer to the orig field
597 + * @param field_given the pointer to the number of occurrence of this option
598 + * @param prev_given the pointer to the number of occurrence already seen
599 + * @param value the argument for this option (if null no arg was specified)
600 + * @param possible_values the possible values for this option (if specified)
601 + * @param default_value the default value (in case the option only accepts fixed values)
602 + * @param arg_type the type of this option
603 + * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
604 + * @param override @see cmdline_parser_params.override
605 + * @param no_free whether to free a possible previous value
606 + * @param multiple_option whether this is a multiple option
607 + * @param long_opt the corresponding long option
608 + * @param short_opt the corresponding short option (or '-' if none)
609 + * @param additional_error possible further error specification
610 + */
611 + static
612 + int update_arg(void *field, char **orig_field,
613 +               unsigned int *field_given, unsigned int *prev_given,
614 +               char *value, char *possible_values[], const char *default_value,
615 +               cmdline_parser_arg_type arg_type,
616 +               int check_ambiguity, int override,
617 +               int no_free, int multiple_option,
618 +               const char *long_opt, char short_opt,
619 +               const char *additional_error)
620 + {
621 +  char *stop_char = 0;
622 +  const char *val = value;
623 +  int found;
624 +  char **string_field;
625 +
626 +  stop_char = 0;
627 +  found = 0;
628 +
629 +  if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
630 +    {
631 +      if (short_opt != '-')
632 +        fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
633 +               package_name, long_opt, short_opt,
634 +               (additional_error ? additional_error : ""));
635 +      else
636 +        fprintf (stderr, "%s: `--%s' option given more than once%s\n",
637 +               package_name, long_opt,
638 +               (additional_error ? additional_error : ""));
639 +      return 1; /* failure */
640 +    }
641 +
642 +    
643 +  if (field_given && *field_given && ! override)
644 +    return 0;
645 +  if (prev_given)
646 +    (*prev_given)++;
647 +  if (field_given)
648 +    (*field_given)++;
649 +  if (possible_values)
650 +    val = possible_values[found];
651 +
652 +  switch(arg_type) {
653 +  case ARG_INT:
654 +    if (val) *((int *)field) = strtol (val, &stop_char, 0);
655 +    break;
656 +  case ARG_DOUBLE:
657 +    if (val) *((double *)field) = strtod (val, &stop_char);
658 +    break;
659 +  case ARG_STRING:
660 +    if (val) {
661 +      string_field = (char **)field;
662 +      if (!no_free && *string_field)
663 +        free (*string_field); /* free previous string */
664 +      *string_field = gengetopt_strdup (val);
665 +    }
666 +    break;
667 +  default:
668 +    break;
669 +  };
670 +
671 +  /* check numeric conversion */
672 +  switch(arg_type) {
673 +  case ARG_INT:
674 +  case ARG_DOUBLE:
675 +    if (val && !(stop_char && *stop_char == '\0')) {
676 +      fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
677 +      return 1; /* failure */
678 +    }
679 +    break;
680 +  default:
681 +    ;
682 +  };
683 +
684 +  /* store the original value */
685 +  switch(arg_type) {
686 +  case ARG_NO:
687 +    break;
688 +  default:
689 +    if (value && orig_field) {
690 +      if (no_free) {
691 +        *orig_field = value;
692 +      } else {
693 +        if (*orig_field)
694 +          free (*orig_field); /* free previous string */
695 +        *orig_field = gengetopt_strdup (value);
696 +      }
697 +    }
698 +  };
699 +
700 +  return 0; /* OK */
701 + }
702 +
703 +
704   int
705 < 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)
705 > cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
706 >                        struct cmdline_parser_params *params, const char *additional_error)
707   {
708    int c;        /* Character of the parsed option.  */
709  
710    int error = 0;
711    struct gengetopt_args_info local_args_info;
712 +  
713 +  int override;
714 +  int initialize;
715 +  int check_required;
716 +  int check_ambiguity;
717 +  
718 +  package_name = argv[0];
719 +  
720 +  override = params->override;
721 +  initialize = params->initialize;
722 +  check_required = params->check_required;
723 +  check_ambiguity = params->check_ambiguity;
724  
725    if (initialize)
726      cmdline_parser_init (args_info);
# Line 608 | Line 729 | cmdline_parser_internal (int argc, char * const *argv,
729  
730    optarg = 0;
731    optind = 0;
732 <  opterr = 1;
732 >  opterr = params->print_errors;
733    optopt = '?';
734  
735    while (1)
736      {
737        int option_index = 0;
617      char *stop_char;
738  
739        static struct option long_options[] = {
740          { "help",       0, NULL, 'h' },
# Line 627 | Line 747 | cmdline_parser_internal (int argc, char * const *argv,
747          { "nbins_y",    1, NULL, 'y' },
748          { "nanglebins", 1, NULL, 'a' },
749          { "length",     1, NULL, 0 },
630        { "LegendreL",  1, NULL, 'l' },
750          { "rcut",       1, NULL, 'c' },
751          { "zoffset",    1, NULL, 'z' },
752          { "sele1",      1, NULL, 0 },
753          { "sele2",      1, NULL, 0 },
754          { "sele3",      1, NULL, 0 },
755          { "refsele",    1, NULL, 0 },
756 +        { "comsele",    1, NULL, 0 },
757          { "molname",    1, NULL, 0 },
758          { "begin",      1, NULL, 0 },
759          { "end",        1, NULL, 0 },
760 +        { "radius",     1, NULL, 0 },
761          { "bo", 0, NULL, 0 },
762 +        { "bor",        0, NULL, 0 },
763 +        { "bad",        0, NULL, 0 },
764          { "gofr",       0, NULL, 'g' },
765 +        { "gofz",       0, NULL, 0 },
766          { "r_theta",    0, NULL, 0 },
767          { "r_omega",    0, NULL, 0 },
768          { "theta_omega",        0, NULL, 0 },
# Line 649 | Line 773 | cmdline_parser_internal (int argc, char * const *argv,
773          { "density",    0, NULL, 'd' },
774          { "slab_density",       0, NULL, 0 },
775          { "hxy",        0, NULL, 0 },
776 +        { "rho_r",      0, NULL, 0 },
777 +        { "hullvol",    0, NULL, 0 },
778          { NULL, 0, NULL, 0 }
779        };
780  
781 <      stop_char = 0;
656 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:l:c:z:gpsd", long_options, &option_index);
781 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
782  
783        if (c == -1) break;       /* Exit from `while (1)' loop.  */
784  
# Line 670 | Line 795 | cmdline_parser_internal (int argc, char * const *argv,
795            exit (EXIT_SUCCESS);
796  
797          case 'i':       /* input dump file.  */
798 <          if (local_args_info.input_given)
799 <            {
800 <              fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
801 <              goto failure;
802 <            }
803 <          if (args_info->input_given && ! override)
804 <            continue;
805 <          local_args_info.input_given = 1;
806 <          args_info->input_given = 1;
807 <          if (args_info->input_arg)
683 <            free (args_info->input_arg); /* free previous string */
684 <          args_info->input_arg = gengetopt_strdup (optarg);
685 <          if (args_info->input_orig)
686 <            free (args_info->input_orig); /* free previous string */
687 <          args_info->input_orig = gengetopt_strdup (optarg);
798 >        
799 >        
800 >          if (update_arg( (void *)&(args_info->input_arg),
801 >               &(args_info->input_orig), &(args_info->input_given),
802 >              &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
803 >              check_ambiguity, override, 0, 0,
804 >              "input", 'i',
805 >              additional_error))
806 >            goto failure;
807 >        
808            break;
689
809          case 'o':       /* output file name.  */
810 <          if (local_args_info.output_given)
811 <            {
812 <              fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
813 <              goto failure;
814 <            }
815 <          if (args_info->output_given && ! override)
816 <            continue;
817 <          local_args_info.output_given = 1;
818 <          args_info->output_given = 1;
819 <          if (args_info->output_arg)
701 <            free (args_info->output_arg); /* free previous string */
702 <          args_info->output_arg = gengetopt_strdup (optarg);
703 <          if (args_info->output_orig)
704 <            free (args_info->output_orig); /* free previous string */
705 <          args_info->output_orig = gengetopt_strdup (optarg);
810 >        
811 >        
812 >          if (update_arg( (void *)&(args_info->output_arg),
813 >               &(args_info->output_orig), &(args_info->output_given),
814 >              &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
815 >              check_ambiguity, override, 0, 0,
816 >              "output", 'o',
817 >              additional_error))
818 >            goto failure;
819 >        
820            break;
707
821          case 'n':       /* process every n frame.  */
822 <          if (local_args_info.step_given)
823 <            {
824 <              fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
825 <              goto failure;
826 <            }
827 <          if (args_info->step_given && ! override)
828 <            continue;
829 <          local_args_info.step_given = 1;
717 <          args_info->step_given = 1;
718 <          args_info->step_arg = strtol (optarg, &stop_char, 0);
719 <          if (!(stop_char && *stop_char == '\0')) {
720 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
822 >        
823 >        
824 >          if (update_arg( (void *)&(args_info->step_arg),
825 >               &(args_info->step_orig), &(args_info->step_given),
826 >              &(local_args_info.step_given), optarg, 0, "1", ARG_INT,
827 >              check_ambiguity, override, 0, 0,
828 >              "step", 'n',
829 >              additional_error))
830              goto failure;
831 <          }
723 <          if (args_info->step_orig)
724 <            free (args_info->step_orig); /* free previous string */
725 <          args_info->step_orig = gengetopt_strdup (optarg);
831 >        
832            break;
727
833          case 'b':       /* number of bins (general purpose).  */
834 <          if (local_args_info.nbins_given)
835 <            {
836 <              fprintf (stderr, "%s: `--nbins' (`-b') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
837 <              goto failure;
838 <            }
839 <          if (args_info->nbins_given && ! override)
840 <            continue;
841 <          local_args_info.nbins_given = 1;
737 <          args_info->nbins_given = 1;
738 <          args_info->nbins_arg = strtol (optarg, &stop_char, 0);
739 <          if (!(stop_char && *stop_char == '\0')) {
740 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
834 >        
835 >        
836 >          if (update_arg( (void *)&(args_info->nbins_arg),
837 >               &(args_info->nbins_orig), &(args_info->nbins_given),
838 >              &(local_args_info.nbins_given), optarg, 0, "100", ARG_INT,
839 >              check_ambiguity, override, 0, 0,
840 >              "nbins", 'b',
841 >              additional_error))
842              goto failure;
843 <          }
743 <          if (args_info->nbins_orig)
744 <            free (args_info->nbins_orig); /* free previous string */
745 <          args_info->nbins_orig = gengetopt_strdup (optarg);
843 >        
844            break;
747
845          case 'x':       /* number of bins in x axis.  */
846 <          if (local_args_info.nbins_x_given)
847 <            {
848 <              fprintf (stderr, "%s: `--nbins_x' (`-x') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
849 <              goto failure;
850 <            }
851 <          if (args_info->nbins_x_given && ! override)
852 <            continue;
853 <          local_args_info.nbins_x_given = 1;
757 <          args_info->nbins_x_given = 1;
758 <          args_info->nbins_x_arg = strtol (optarg, &stop_char, 0);
759 <          if (!(stop_char && *stop_char == '\0')) {
760 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
846 >        
847 >        
848 >          if (update_arg( (void *)&(args_info->nbins_x_arg),
849 >               &(args_info->nbins_x_orig), &(args_info->nbins_x_given),
850 >              &(local_args_info.nbins_x_given), optarg, 0, "100", ARG_INT,
851 >              check_ambiguity, override, 0, 0,
852 >              "nbins_x", 'x',
853 >              additional_error))
854              goto failure;
855 <          }
763 <          if (args_info->nbins_x_orig)
764 <            free (args_info->nbins_x_orig); /* free previous string */
765 <          args_info->nbins_x_orig = gengetopt_strdup (optarg);
855 >        
856            break;
767
857          case 'y':       /* number of bins in y axis.  */
858 <          if (local_args_info.nbins_y_given)
859 <            {
860 <              fprintf (stderr, "%s: `--nbins_y' (`-y') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
861 <              goto failure;
862 <            }
863 <          if (args_info->nbins_y_given && ! override)
864 <            continue;
865 <          local_args_info.nbins_y_given = 1;
777 <          args_info->nbins_y_given = 1;
778 <          args_info->nbins_y_arg = strtol (optarg, &stop_char, 0);
779 <          if (!(stop_char && *stop_char == '\0')) {
780 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
858 >        
859 >        
860 >          if (update_arg( (void *)&(args_info->nbins_y_arg),
861 >               &(args_info->nbins_y_orig), &(args_info->nbins_y_given),
862 >              &(local_args_info.nbins_y_given), optarg, 0, "100", ARG_INT,
863 >              check_ambiguity, override, 0, 0,
864 >              "nbins_y", 'y',
865 >              additional_error))
866              goto failure;
867 <          }
783 <          if (args_info->nbins_y_orig)
784 <            free (args_info->nbins_y_orig); /* free previous string */
785 <          args_info->nbins_y_orig = gengetopt_strdup (optarg);
867 >        
868            break;
787
869          case 'a':       /* number of bins for cos(angle).  */
870 <          if (local_args_info.nanglebins_given)
871 <            {
872 <              fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
873 <              goto failure;
874 <            }
875 <          if (args_info->nanglebins_given && ! override)
876 <            continue;
877 <          local_args_info.nanglebins_given = 1;
797 <          args_info->nanglebins_given = 1;
798 <          args_info->nanglebins_arg = strtol (optarg, &stop_char, 0);
799 <          if (!(stop_char && *stop_char == '\0')) {
800 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
870 >        
871 >        
872 >          if (update_arg( (void *)&(args_info->nanglebins_arg),
873 >               &(args_info->nanglebins_orig), &(args_info->nanglebins_given),
874 >              &(local_args_info.nanglebins_given), optarg, 0, "50", ARG_INT,
875 >              check_ambiguity, override, 0, 0,
876 >              "nanglebins", 'a',
877 >              additional_error))
878              goto failure;
879 <          }
803 <          if (args_info->nanglebins_orig)
804 <            free (args_info->nanglebins_orig); /* free previous string */
805 <          args_info->nanglebins_orig = gengetopt_strdup (optarg);
879 >        
880            break;
807
808        case 'l':       /* Order of Legendre Polynomial (used for Bond Order calculations).  */
809          if (local_args_info.LegendreL_given)
810            {
811              fprintf (stderr, "%s: `--LegendreL' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
812              goto failure;
813            }
814          if (args_info->LegendreL_given && ! override)
815            continue;
816          local_args_info.LegendreL_given = 1;
817          args_info->LegendreL_given = 1;
818          args_info->LegendreL_arg = strtol (optarg, &stop_char, 0);
819          if (!(stop_char && *stop_char == '\0')) {
820            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
821            goto failure;
822          }
823          if (args_info->LegendreL_orig)
824            free (args_info->LegendreL_orig); /* free previous string */
825          args_info->LegendreL_orig = gengetopt_strdup (optarg);
826          break;
827
881          case 'c':       /* cutoff radius (rcut).  */
882 <          if (local_args_info.rcut_given)
883 <            {
884 <              fprintf (stderr, "%s: `--rcut' (`-c') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
885 <              goto failure;
886 <            }
887 <          if (args_info->rcut_given && ! override)
888 <            continue;
889 <          local_args_info.rcut_given = 1;
837 <          args_info->rcut_given = 1;
838 <          args_info->rcut_arg = strtod (optarg, &stop_char);
839 <          if (!(stop_char && *stop_char == '\0')) {
840 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
882 >        
883 >        
884 >          if (update_arg( (void *)&(args_info->rcut_arg),
885 >               &(args_info->rcut_orig), &(args_info->rcut_given),
886 >              &(local_args_info.rcut_given), optarg, 0, 0, ARG_DOUBLE,
887 >              check_ambiguity, override, 0, 0,
888 >              "rcut", 'c',
889 >              additional_error))
890              goto failure;
891 <          }
843 <          if (args_info->rcut_orig)
844 <            free (args_info->rcut_orig); /* free previous string */
845 <          args_info->rcut_orig = gengetopt_strdup (optarg);
891 >        
892            break;
847
893          case 'z':       /* Where to set the zero for the slab_density calculation.  */
894 <          if (local_args_info.zoffset_given)
895 <            {
896 <              fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
897 <              goto failure;
898 <            }
899 <          if (args_info->zoffset_given && ! override)
900 <            continue;
901 <          local_args_info.zoffset_given = 1;
857 <          args_info->zoffset_given = 1;
858 <          args_info->zoffset_arg = strtod (optarg, &stop_char);
859 <          if (!(stop_char && *stop_char == '\0')) {
860 <            fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
894 >        
895 >        
896 >          if (update_arg( (void *)&(args_info->zoffset_arg),
897 >               &(args_info->zoffset_orig), &(args_info->zoffset_given),
898 >              &(local_args_info.zoffset_given), optarg, 0, "0", ARG_DOUBLE,
899 >              check_ambiguity, override, 0, 0,
900 >              "zoffset", 'z',
901 >              additional_error))
902              goto failure;
903 <          }
863 <          if (args_info->zoffset_orig)
864 <            free (args_info->zoffset_orig); /* free previous string */
865 <          args_info->zoffset_orig = gengetopt_strdup (optarg);
903 >        
904            break;
867
905          case 'g':       /* g(r).  */
906 <          if (local_args_info.gofr_given)
870 <            {
871 <              fprintf (stderr, "%s: `--gofr' (`-g') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
872 <              goto failure;
873 <            }
874 <          if (args_info->gofr_given && ! override)
875 <            continue;
876 <          local_args_info.gofr_given = 1;
877 <          args_info->gofr_given = 1;
906 >        
907            if (args_info->staticProps_group_counter && override)
908              reset_group_staticProps (args_info);
909            args_info->staticProps_group_counter += 1;
910 +        
911 +          if (update_arg( 0 ,
912 +               0 , &(args_info->gofr_given),
913 +              &(local_args_info.gofr_given), optarg, 0, 0, ARG_NO,
914 +              check_ambiguity, override, 0, 0,
915 +              "gofr", 'g',
916 +              additional_error))
917 +            goto failure;
918 +        
919            break;
882
920          case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
921 <          if (local_args_info.p2_given)
885 <            {
886 <              fprintf (stderr, "%s: `--p2' (`-p') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
887 <              goto failure;
888 <            }
889 <          if (args_info->p2_given && ! override)
890 <            continue;
891 <          local_args_info.p2_given = 1;
892 <          args_info->p2_given = 1;
921 >        
922            if (args_info->staticProps_group_counter && override)
923              reset_group_staticProps (args_info);
924            args_info->staticProps_group_counter += 1;
925 +        
926 +          if (update_arg( 0 ,
927 +               0 , &(args_info->p2_given),
928 +              &(local_args_info.p2_given), optarg, 0, 0, ARG_NO,
929 +              check_ambiguity, override, 0, 0,
930 +              "p2", 'p',
931 +              additional_error))
932 +            goto failure;
933 +        
934            break;
897
935          case 's':       /* scd order parameter (either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified).  */
936 <          if (local_args_info.scd_given)
900 <            {
901 <              fprintf (stderr, "%s: `--scd' (`-s') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
902 <              goto failure;
903 <            }
904 <          if (args_info->scd_given && ! override)
905 <            continue;
906 <          local_args_info.scd_given = 1;
907 <          args_info->scd_given = 1;
936 >        
937            if (args_info->staticProps_group_counter && override)
938              reset_group_staticProps (args_info);
939            args_info->staticProps_group_counter += 1;
940 +        
941 +          if (update_arg( 0 ,
942 +               0 , &(args_info->scd_given),
943 +              &(local_args_info.scd_given), optarg, 0, 0, ARG_NO,
944 +              check_ambiguity, override, 0, 0,
945 +              "scd", 's',
946 +              additional_error))
947 +            goto failure;
948 +        
949            break;
912
950          case 'd':       /* density plot.  */
951 <          if (local_args_info.density_given)
915 <            {
916 <              fprintf (stderr, "%s: `--density' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
917 <              goto failure;
918 <            }
919 <          if (args_info->density_given && ! override)
920 <            continue;
921 <          local_args_info.density_given = 1;
922 <          args_info->density_given = 1;
951 >        
952            if (args_info->staticProps_group_counter && override)
953              reset_group_staticProps (args_info);
954            args_info->staticProps_group_counter += 1;
955 +        
956 +          if (update_arg( 0 ,
957 +               0 , &(args_info->density_given),
958 +              &(local_args_info.density_given), optarg, 0, 0, ARG_NO,
959 +              check_ambiguity, override, 0, 0,
960 +              "density", 'd',
961 +              additional_error))
962 +            goto failure;
963 +        
964            break;
965  
928
966          case 0: /* Long option with no short option */
967            /* maximum length (Defaults to 1/2 smallest length of first frame).  */
968            if (strcmp (long_options[option_index].name, "length") == 0)
969            {
970 <            if (local_args_info.length_given)
971 <              {
972 <                fprintf (stderr, "%s: `--length' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
973 <                goto failure;
974 <              }
975 <            if (args_info->length_given && ! override)
976 <              continue;
977 <            local_args_info.length_given = 1;
941 <            args_info->length_given = 1;
942 <            args_info->length_arg = strtod (optarg, &stop_char);
943 <            if (!(stop_char && *stop_char == '\0')) {
944 <              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
970 >          
971 >          
972 >            if (update_arg( (void *)&(args_info->length_arg),
973 >                 &(args_info->length_orig), &(args_info->length_given),
974 >                &(local_args_info.length_given), optarg, 0, 0, ARG_DOUBLE,
975 >                check_ambiguity, override, 0, 0,
976 >                "length", '-',
977 >                additional_error))
978                goto failure;
979 <            }
947 <            if (args_info->length_orig)
948 <              free (args_info->length_orig); /* free previous string */
949 <            args_info->length_orig = gengetopt_strdup (optarg);
979 >          
980            }
981            /* select the first stuntdouble set.  */
982            else if (strcmp (long_options[option_index].name, "sele1") == 0)
983            {
984 <            if (local_args_info.sele1_given)
985 <              {
986 <                fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
987 <                goto failure;
988 <              }
989 <            if (args_info->sele1_given && ! override)
990 <              continue;
991 <            local_args_info.sele1_given = 1;
992 <            args_info->sele1_given = 1;
993 <            if (args_info->sele1_arg)
964 <              free (args_info->sele1_arg); /* free previous string */
965 <            args_info->sele1_arg = gengetopt_strdup (optarg);
966 <            if (args_info->sele1_orig)
967 <              free (args_info->sele1_orig); /* free previous string */
968 <            args_info->sele1_orig = gengetopt_strdup (optarg);
984 >          
985 >          
986 >            if (update_arg( (void *)&(args_info->sele1_arg),
987 >                 &(args_info->sele1_orig), &(args_info->sele1_given),
988 >                &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING,
989 >                check_ambiguity, override, 0, 0,
990 >                "sele1", '-',
991 >                additional_error))
992 >              goto failure;
993 >          
994            }
995            /* select the second stuntdouble set.  */
996            else if (strcmp (long_options[option_index].name, "sele2") == 0)
997            {
998 <            if (local_args_info.sele2_given)
999 <              {
1000 <                fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1001 <                goto failure;
1002 <              }
1003 <            if (args_info->sele2_given && ! override)
1004 <              continue;
1005 <            local_args_info.sele2_given = 1;
1006 <            args_info->sele2_given = 1;
1007 <            if (args_info->sele2_arg)
983 <              free (args_info->sele2_arg); /* free previous string */
984 <            args_info->sele2_arg = gengetopt_strdup (optarg);
985 <            if (args_info->sele2_orig)
986 <              free (args_info->sele2_orig); /* free previous string */
987 <            args_info->sele2_orig = gengetopt_strdup (optarg);
998 >          
999 >          
1000 >            if (update_arg( (void *)&(args_info->sele2_arg),
1001 >                 &(args_info->sele2_orig), &(args_info->sele2_given),
1002 >                &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING,
1003 >                check_ambiguity, override, 0, 0,
1004 >                "sele2", '-',
1005 >                additional_error))
1006 >              goto failure;
1007 >          
1008            }
1009            /* select the third stuntdouble set.  */
1010            else if (strcmp (long_options[option_index].name, "sele3") == 0)
1011            {
1012 <            if (local_args_info.sele3_given)
1013 <              {
1014 <                fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1015 <                goto failure;
1016 <              }
1017 <            if (args_info->sele3_given && ! override)
1018 <              continue;
1019 <            local_args_info.sele3_given = 1;
1020 <            args_info->sele3_given = 1;
1021 <            if (args_info->sele3_arg)
1002 <              free (args_info->sele3_arg); /* free previous string */
1003 <            args_info->sele3_arg = gengetopt_strdup (optarg);
1004 <            if (args_info->sele3_orig)
1005 <              free (args_info->sele3_orig); /* free previous string */
1006 <            args_info->sele3_orig = gengetopt_strdup (optarg);
1012 >          
1013 >          
1014 >            if (update_arg( (void *)&(args_info->sele3_arg),
1015 >                 &(args_info->sele3_orig), &(args_info->sele3_given),
1016 >                &(local_args_info.sele3_given), optarg, 0, 0, ARG_STRING,
1017 >                check_ambiguity, override, 0, 0,
1018 >                "sele3", '-',
1019 >                additional_error))
1020 >              goto failure;
1021 >          
1022            }
1023            /* select reference (use and only use with --gxyz).  */
1024            else if (strcmp (long_options[option_index].name, "refsele") == 0)
1025            {
1026 <            if (local_args_info.refsele_given)
1027 <              {
1028 <                fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1029 <                goto failure;
1030 <              }
1031 <            if (args_info->refsele_given && ! override)
1032 <              continue;
1033 <            local_args_info.refsele_given = 1;
1034 <            args_info->refsele_given = 1;
1035 <            if (args_info->refsele_arg)
1021 <              free (args_info->refsele_arg); /* free previous string */
1022 <            args_info->refsele_arg = gengetopt_strdup (optarg);
1023 <            if (args_info->refsele_orig)
1024 <              free (args_info->refsele_orig); /* free previous string */
1025 <            args_info->refsele_orig = gengetopt_strdup (optarg);
1026 >          
1027 >          
1028 >            if (update_arg( (void *)&(args_info->refsele_arg),
1029 >                 &(args_info->refsele_orig), &(args_info->refsele_given),
1030 >                &(local_args_info.refsele_given), optarg, 0, 0, ARG_STRING,
1031 >                check_ambiguity, override, 0, 0,
1032 >                "refsele", '-',
1033 >                additional_error))
1034 >              goto failure;
1035 >          
1036            }
1037 +          /* select stunt doubles for center-of-mass reference point.  */
1038 +          else if (strcmp (long_options[option_index].name, "comsele") == 0)
1039 +          {
1040 +          
1041 +          
1042 +            if (update_arg( (void *)&(args_info->comsele_arg),
1043 +                 &(args_info->comsele_orig), &(args_info->comsele_given),
1044 +                &(local_args_info.comsele_given), optarg, 0, 0, ARG_STRING,
1045 +                check_ambiguity, override, 0, 0,
1046 +                "comsele", '-',
1047 +                additional_error))
1048 +              goto failure;
1049 +          
1050 +          }
1051            /* molecule name.  */
1052            else if (strcmp (long_options[option_index].name, "molname") == 0)
1053            {
1054 <            if (local_args_info.molname_given)
1055 <              {
1056 <                fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1057 <                goto failure;
1058 <              }
1059 <            if (args_info->molname_given && ! override)
1060 <              continue;
1061 <            local_args_info.molname_given = 1;
1062 <            args_info->molname_given = 1;
1063 <            if (args_info->molname_arg)
1040 <              free (args_info->molname_arg); /* free previous string */
1041 <            args_info->molname_arg = gengetopt_strdup (optarg);
1042 <            if (args_info->molname_orig)
1043 <              free (args_info->molname_orig); /* free previous string */
1044 <            args_info->molname_orig = gengetopt_strdup (optarg);
1054 >          
1055 >          
1056 >            if (update_arg( (void *)&(args_info->molname_arg),
1057 >                 &(args_info->molname_orig), &(args_info->molname_given),
1058 >                &(local_args_info.molname_given), optarg, 0, 0, ARG_STRING,
1059 >                check_ambiguity, override, 0, 0,
1060 >                "molname", '-',
1061 >                additional_error))
1062 >              goto failure;
1063 >          
1064            }
1065            /* begin internal index.  */
1066            else if (strcmp (long_options[option_index].name, "begin") == 0)
1067            {
1068 <            if (local_args_info.begin_given)
1069 <              {
1070 <                fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1071 <                goto failure;
1072 <              }
1073 <            if (args_info->begin_given && ! override)
1074 <              continue;
1075 <            local_args_info.begin_given = 1;
1057 <            args_info->begin_given = 1;
1058 <            args_info->begin_arg = strtol (optarg, &stop_char, 0);
1059 <            if (!(stop_char && *stop_char == '\0')) {
1060 <              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
1068 >          
1069 >          
1070 >            if (update_arg( (void *)&(args_info->begin_arg),
1071 >                 &(args_info->begin_orig), &(args_info->begin_given),
1072 >                &(local_args_info.begin_given), optarg, 0, 0, ARG_INT,
1073 >                check_ambiguity, override, 0, 0,
1074 >                "begin", '-',
1075 >                additional_error))
1076                goto failure;
1077 <            }
1063 <            if (args_info->begin_orig)
1064 <              free (args_info->begin_orig); /* free previous string */
1065 <            args_info->begin_orig = gengetopt_strdup (optarg);
1077 >          
1078            }
1079            /* end internal index.  */
1080            else if (strcmp (long_options[option_index].name, "end") == 0)
1081            {
1082 <            if (local_args_info.end_given)
1083 <              {
1084 <                fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1085 <                goto failure;
1086 <              }
1087 <            if (args_info->end_given && ! override)
1088 <              continue;
1089 <            local_args_info.end_given = 1;
1078 <            args_info->end_given = 1;
1079 <            args_info->end_arg = strtol (optarg, &stop_char, 0);
1080 <            if (!(stop_char && *stop_char == '\0')) {
1081 <              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
1082 >          
1083 >          
1084 >            if (update_arg( (void *)&(args_info->end_arg),
1085 >                 &(args_info->end_orig), &(args_info->end_given),
1086 >                &(local_args_info.end_given), optarg, 0, 0, ARG_INT,
1087 >                check_ambiguity, override, 0, 0,
1088 >                "end", '-',
1089 >                additional_error))
1090                goto failure;
1091 <            }
1084 <            if (args_info->end_orig)
1085 <              free (args_info->end_orig); /* free previous string */
1086 <            args_info->end_orig = gengetopt_strdup (optarg);
1091 >          
1092            }
1093 <          /* bond order parameter (--rcut and --LegendreL must be specified.  */
1093 >          /* nanoparticle radius.  */
1094 >          else if (strcmp (long_options[option_index].name, "radius") == 0)
1095 >          {
1096 >          
1097 >          
1098 >            if (update_arg( (void *)&(args_info->radius_arg),
1099 >                 &(args_info->radius_orig), &(args_info->radius_given),
1100 >                &(local_args_info.radius_given), optarg, 0, 0, ARG_DOUBLE,
1101 >                check_ambiguity, override, 0, 0,
1102 >                "radius", '-',
1103 >                additional_error))
1104 >              goto failure;
1105 >          
1106 >          }
1107 >          /* bond order parameter (--rcut must be specified).  */
1108            else if (strcmp (long_options[option_index].name, "bo") == 0)
1109            {
1110 <            if (local_args_info.bo_given)
1092 <              {
1093 <                fprintf (stderr, "%s: `--bo' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1094 <                goto failure;
1095 <              }
1096 <            if (args_info->bo_given && ! override)
1097 <              continue;
1098 <            local_args_info.bo_given = 1;
1099 <            args_info->bo_given = 1;
1110 >          
1111              if (args_info->staticProps_group_counter && override)
1112                reset_group_staticProps (args_info);
1113              args_info->staticProps_group_counter += 1;
1114 <            break;
1114 >          
1115 >            if (update_arg( 0 ,
1116 >                 0 , &(args_info->bo_given),
1117 >                &(local_args_info.bo_given), optarg, 0, 0, ARG_NO,
1118 >                check_ambiguity, override, 0, 0,
1119 >                "bo", '-',
1120 >                additional_error))
1121 >              goto failure;
1122 >          
1123            }
1124 +          /* bond order parameter as a function of radius (--rcut must be specified).  */
1125 +          else if (strcmp (long_options[option_index].name, "bor") == 0)
1126 +          {
1127 +          
1128 +            if (args_info->staticProps_group_counter && override)
1129 +              reset_group_staticProps (args_info);
1130 +            args_info->staticProps_group_counter += 1;
1131 +          
1132 +            if (update_arg( 0 ,
1133 +                 0 , &(args_info->bor_given),
1134 +                &(local_args_info.bor_given), optarg, 0, 0, ARG_NO,
1135 +                check_ambiguity, override, 0, 0,
1136 +                "bor", '-',
1137 +                additional_error))
1138 +              goto failure;
1139 +          
1140 +          }
1141 +          /* N(theta) bond angle density within (--rcut must be specified).  */
1142 +          else if (strcmp (long_options[option_index].name, "bad") == 0)
1143 +          {
1144 +          
1145 +            if (args_info->staticProps_group_counter && override)
1146 +              reset_group_staticProps (args_info);
1147 +            args_info->staticProps_group_counter += 1;
1148 +          
1149 +            if (update_arg( 0 ,
1150 +                 0 , &(args_info->bad_given),
1151 +                &(local_args_info.bad_given), optarg, 0, 0, ARG_NO,
1152 +                check_ambiguity, override, 0, 0,
1153 +                "bad", '-',
1154 +                additional_error))
1155 +              goto failure;
1156 +          
1157 +          }
1158 +          /* g(z).  */
1159 +          else if (strcmp (long_options[option_index].name, "gofz") == 0)
1160 +          {
1161 +          
1162 +            if (args_info->staticProps_group_counter && override)
1163 +              reset_group_staticProps (args_info);
1164 +            args_info->staticProps_group_counter += 1;
1165 +          
1166 +            if (update_arg( 0 ,
1167 +                 0 , &(args_info->gofz_given),
1168 +                &(local_args_info.gofz_given), optarg, 0, 0, ARG_NO,
1169 +                check_ambiguity, override, 0, 0,
1170 +                "gofz", '-',
1171 +                additional_error))
1172 +              goto failure;
1173 +          
1174 +          }
1175            /* g(r, cos(theta)).  */
1176            else if (strcmp (long_options[option_index].name, "r_theta") == 0)
1177            {
1178 <            if (local_args_info.r_theta_given)
1109 <              {
1110 <                fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1111 <                goto failure;
1112 <              }
1113 <            if (args_info->r_theta_given && ! override)
1114 <              continue;
1115 <            local_args_info.r_theta_given = 1;
1116 <            args_info->r_theta_given = 1;
1178 >          
1179              if (args_info->staticProps_group_counter && override)
1180                reset_group_staticProps (args_info);
1181              args_info->staticProps_group_counter += 1;
1182 <            break;
1182 >          
1183 >            if (update_arg( 0 ,
1184 >                 0 , &(args_info->r_theta_given),
1185 >                &(local_args_info.r_theta_given), optarg, 0, 0, ARG_NO,
1186 >                check_ambiguity, override, 0, 0,
1187 >                "r_theta", '-',
1188 >                additional_error))
1189 >              goto failure;
1190 >          
1191            }
1192            /* g(r, cos(omega)).  */
1193            else if (strcmp (long_options[option_index].name, "r_omega") == 0)
1194            {
1195 <            if (local_args_info.r_omega_given)
1126 <              {
1127 <                fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1128 <                goto failure;
1129 <              }
1130 <            if (args_info->r_omega_given && ! override)
1131 <              continue;
1132 <            local_args_info.r_omega_given = 1;
1133 <            args_info->r_omega_given = 1;
1195 >          
1196              if (args_info->staticProps_group_counter && override)
1197                reset_group_staticProps (args_info);
1198              args_info->staticProps_group_counter += 1;
1199 <            break;
1199 >          
1200 >            if (update_arg( 0 ,
1201 >                 0 , &(args_info->r_omega_given),
1202 >                &(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO,
1203 >                check_ambiguity, override, 0, 0,
1204 >                "r_omega", '-',
1205 >                additional_error))
1206 >              goto failure;
1207 >          
1208            }
1209            /* g(cos(theta), cos(omega)).  */
1210            else if (strcmp (long_options[option_index].name, "theta_omega") == 0)
1211            {
1212 <            if (local_args_info.theta_omega_given)
1143 <              {
1144 <                fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1145 <                goto failure;
1146 <              }
1147 <            if (args_info->theta_omega_given && ! override)
1148 <              continue;
1149 <            local_args_info.theta_omega_given = 1;
1150 <            args_info->theta_omega_given = 1;
1212 >          
1213              if (args_info->staticProps_group_counter && override)
1214                reset_group_staticProps (args_info);
1215              args_info->staticProps_group_counter += 1;
1216 <            break;
1216 >          
1217 >            if (update_arg( 0 ,
1218 >                 0 , &(args_info->theta_omega_given),
1219 >                &(local_args_info.theta_omega_given), optarg, 0, 0, ARG_NO,
1220 >                check_ambiguity, override, 0, 0,
1221 >                "theta_omega", '-',
1222 >                additional_error))
1223 >              goto failure;
1224 >          
1225            }
1226            /* g(x, y, z).  */
1227            else if (strcmp (long_options[option_index].name, "gxyz") == 0)
1228            {
1229 <            if (local_args_info.gxyz_given)
1160 <              {
1161 <                fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1162 <                goto failure;
1163 <              }
1164 <            if (args_info->gxyz_given && ! override)
1165 <              continue;
1166 <            local_args_info.gxyz_given = 1;
1167 <            args_info->gxyz_given = 1;
1229 >          
1230              if (args_info->staticProps_group_counter && override)
1231                reset_group_staticProps (args_info);
1232              args_info->staticProps_group_counter += 1;
1233 <            break;
1233 >          
1234 >            if (update_arg( 0 ,
1235 >                 0 , &(args_info->gxyz_given),
1236 >                &(local_args_info.gxyz_given), optarg, 0, 0, ARG_NO,
1237 >                check_ambiguity, override, 0, 0,
1238 >                "gxyz", '-',
1239 >                additional_error))
1240 >              goto failure;
1241 >          
1242            }
1243            /* rp2 order parameter (--sele1 and --sele2 must be specified).  */
1244            else if (strcmp (long_options[option_index].name, "rp2") == 0)
1245            {
1246 <            if (local_args_info.rp2_given)
1177 <              {
1178 <                fprintf (stderr, "%s: `--rp2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1179 <                goto failure;
1180 <              }
1181 <            if (args_info->rp2_given && ! override)
1182 <              continue;
1183 <            local_args_info.rp2_given = 1;
1184 <            args_info->rp2_given = 1;
1246 >          
1247              if (args_info->staticProps_group_counter && override)
1248                reset_group_staticProps (args_info);
1249              args_info->staticProps_group_counter += 1;
1250 <            break;
1250 >          
1251 >            if (update_arg( 0 ,
1252 >                 0 , &(args_info->rp2_given),
1253 >                &(local_args_info.rp2_given), optarg, 0, 0, ARG_NO,
1254 >                check_ambiguity, override, 0, 0,
1255 >                "rp2", '-',
1256 >                additional_error))
1257 >              goto failure;
1258 >          
1259            }
1260            /* slab density.  */
1261            else if (strcmp (long_options[option_index].name, "slab_density") == 0)
1262            {
1263 <            if (local_args_info.slab_density_given)
1194 <              {
1195 <                fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1196 <                goto failure;
1197 <              }
1198 <            if (args_info->slab_density_given && ! override)
1199 <              continue;
1200 <            local_args_info.slab_density_given = 1;
1201 <            args_info->slab_density_given = 1;
1263 >          
1264              if (args_info->staticProps_group_counter && override)
1265                reset_group_staticProps (args_info);
1266              args_info->staticProps_group_counter += 1;
1267 <            break;
1267 >          
1268 >            if (update_arg( 0 ,
1269 >                 0 , &(args_info->slab_density_given),
1270 >                &(local_args_info.slab_density_given), optarg, 0, 0, ARG_NO,
1271 >                check_ambiguity, override, 0, 0,
1272 >                "slab_density", '-',
1273 >                additional_error))
1274 >              goto failure;
1275 >          
1276            }
1277            /* hxy.  */
1278            else if (strcmp (long_options[option_index].name, "hxy") == 0)
1279            {
1280 <            if (local_args_info.hxy_given)
1211 <              {
1212 <                fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
1213 <                goto failure;
1214 <              }
1215 <            if (args_info->hxy_given && ! override)
1216 <              continue;
1217 <            local_args_info.hxy_given = 1;
1218 <            args_info->hxy_given = 1;
1280 >          
1281              if (args_info->staticProps_group_counter && override)
1282                reset_group_staticProps (args_info);
1283              args_info->staticProps_group_counter += 1;
1284 <            break;
1284 >          
1285 >            if (update_arg( 0 ,
1286 >                 0 , &(args_info->hxy_given),
1287 >                &(local_args_info.hxy_given), optarg, 0, 0, ARG_NO,
1288 >                check_ambiguity, override, 0, 0,
1289 >                "hxy", '-',
1290 >                additional_error))
1291 >              goto failure;
1292 >          
1293            }
1294 +          /* rho of R.  */
1295 +          else if (strcmp (long_options[option_index].name, "rho_r") == 0)
1296 +          {
1297            
1298 +            if (args_info->staticProps_group_counter && override)
1299 +              reset_group_staticProps (args_info);
1300 +            args_info->staticProps_group_counter += 1;
1301 +          
1302 +            if (update_arg( 0 ,
1303 +                 0 , &(args_info->rho_r_given),
1304 +                &(local_args_info.rho_r_given), optarg, 0, 0, ARG_NO,
1305 +                check_ambiguity, override, 0, 0,
1306 +                "rho_r", '-',
1307 +                additional_error))
1308 +              goto failure;
1309 +          
1310 +          }
1311 +          /* hull volume of nanoparticle.  */
1312 +          else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1313 +          {
1314 +          
1315 +            if (args_info->staticProps_group_counter && override)
1316 +              reset_group_staticProps (args_info);
1317 +            args_info->staticProps_group_counter += 1;
1318 +          
1319 +            if (update_arg( 0 ,
1320 +                 0 , &(args_info->hullvol_given),
1321 +                &(local_args_info.hullvol_given), optarg, 0, 0, ARG_NO,
1322 +                check_ambiguity, override, 0, 0,
1323 +                "hullvol", '-',
1324 +                additional_error))
1325 +              goto failure;
1326 +          
1327 +          }
1328 +          
1329            break;
1330          case '?':       /* Invalid option.  */
1331            /* `getopt_long' already printed an error message.  */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines