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 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1795 by gezelter, Fri Sep 7 18:13:55 2012 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1795 by gezelter, Fri Sep 7 18:13:55 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines