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

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1180 by chuckv, Mon Sep 17 20:05:51 2007 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 2049 by gezelter, Tue Jan 6 21:44:10 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines