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

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (file contents):
Revision 1128 by chuckv, Wed Apr 11 23:27:20 2007 UTC vs.
Revision 1522 by kstocke1, Fri Nov 19 20:26:36 2010 UTC

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

Comparing trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords):
Revision 1128 by chuckv, Wed Apr 11 23:27:20 2007 UTC vs.
Revision 1522 by kstocke1, Fri Nov 19 20:26:36 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines