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

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords):
Revision 980 by xsun, Thu Jun 1 18:06:33 2006 UTC vs.
Revision 1442 by gezelter, Mon May 10 17:28:26 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines