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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1994 by gezelter, Wed Apr 30 18:50:45 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines