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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC vs.
branches/development/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1865 by gezelter, Wed Apr 17 18:24:08 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines