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 1180 by chuckv, Mon Sep 17 20:05:51 2007 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1992 by gezelter, Thu Apr 24 17:30:00 2014 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1180 by chuckv, Mon Sep 17 20:05:51 2007 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1992 by gezelter, Thu Apr 24 17:30:00 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines