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 955 by xsun, Fri May 12 21:34:43 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 2031 by jmichalk, Fri Oct 31 18:40:40 2014 UTC

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

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 955 by xsun, Fri May 12 21:34:43 2006 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 2031 by jmichalk, Fri Oct 31 18:40:40 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines