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 1091 by chuckv, Fri Nov 10 18:45:29 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1991 by gezelter, Wed Apr 23 20:34:17 2014 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1091 by chuckv, Fri Nov 10 18:45:29 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1991 by gezelter, Wed Apr 23 20:34:17 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines