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

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines