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 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (file contents), Revision 1843 by gezelter, Tue Jan 29 20:58:08 2013 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.22
2 >  File autogenerated by gengetopt version 2.22.4
3    generated with the following command:
4 <  gengetopt -F StaticPropsCmd
4 >  gengetopt --file-name=StaticPropsCmd --unamed-opts
5  
6    The developers of gengetopt consider the fixed text that goes in all
7    gengetopt output files to be in the public domain:
# Line 17 | Line 17
17   #include <stdlib.h>
18   #include <string.h>
19  
20 < #include "getopt.h"
20 > #ifndef FIX_UNUSED
21 > #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 > #endif
23  
24 + #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]...";
30 > const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]...";
31  
32   const char *gengetopt_args_info_description = "";
33  
# Line 36 | Line 40 | const char *gengetopt_args_info_help[] = {
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')",
40  "      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)",
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    "      --molname=STRING          molecule name",
57    "      --begin=INT               begin internal index",
58    "      --end=INT                 end internal index",
# Line 53 | Line 61 | const char *gengetopt_args_info_help[] = {
61    "      --bo                      bond order parameter (--rcut must be specified)",
62    "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
63    "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
64 +  "      --count                   count of molecules matching selection criteria \n                                  (and associated statistics)",
65    "  -g, --gofr                    g(r)",
66    "      --gofz                    g(z)",
67    "      --r_theta                 g(r, cos(theta))",
68    "      --r_omega                 g(r, cos(omega))",
69 +  "      --r_z                     g(r, z)",
70    "      --theta_omega             g(cos(theta), cos(omega))",
71    "      --gxyz                    g(x, y, z)",
72 <  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
72 >  "      --twodgofr                2D g(r) (Slab width --dz must be specified)",
73 >  "  -p, --p2                      p2 order parameter (--sele1 must be specified, \n                                  --sele2 is optional)",
74    "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
75    "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
76    "  -d, --density                 density plot",
77    "      --slab_density            slab density",
78 +  "      --p_angle                 p(cos(theta))",
79    "      --hxy                     hxy",
80    "      --rho_r                   rho of R",
81 +  "      --angle_r                 angle of R",
82    "      --hullvol                 hull volume of nanoparticle",
83 +  "      --rodlength               length of nanorod",
84 +  "  -Q, --tet_param               tetrahedrality order parameter (Qk)",
85 +  "      --tet_param_z             spatially-resolved tetrahedrality order \n                                  parameter Qk(z)",
86      0
87   };
88  
# Line 82 | Line 98 | static int
98   void clear_args (struct gengetopt_args_info *args_info);
99  
100   static int
101 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
101 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
102                          struct cmdline_parser_params *params, const char *additional_error);
103  
104   static int
# Line 102 | Line 118 | void clear_given (struct gengetopt_args_info *args_inf
118    args_info->nbins_given = 0 ;
119    args_info->nbins_x_given = 0 ;
120    args_info->nbins_y_given = 0 ;
121 +  args_info->nbins_z_given = 0 ;
122    args_info->nanglebins_given = 0 ;
106  args_info->length_given = 0 ;
123    args_info->rcut_given = 0 ;
124 +  args_info->dz_given = 0 ;
125 +  args_info->length_given = 0 ;
126 +  args_info->zlength_given = 0 ;
127    args_info->zoffset_given = 0 ;
128    args_info->sele1_given = 0 ;
129    args_info->sele2_given = 0 ;
130    args_info->sele3_given = 0 ;
131    args_info->refsele_given = 0 ;
132    args_info->comsele_given = 0 ;
133 +  args_info->seleoffset_given = 0 ;
134    args_info->molname_given = 0 ;
135    args_info->begin_given = 0 ;
136    args_info->end_given = 0 ;
# Line 118 | Line 138 | void clear_given (struct gengetopt_args_info *args_inf
138    args_info->bo_given = 0 ;
139    args_info->bor_given = 0 ;
140    args_info->bad_given = 0 ;
141 +  args_info->count_given = 0 ;
142    args_info->gofr_given = 0 ;
143    args_info->gofz_given = 0 ;
144    args_info->r_theta_given = 0 ;
145    args_info->r_omega_given = 0 ;
146 +  args_info->r_z_given = 0 ;
147    args_info->theta_omega_given = 0 ;
148    args_info->gxyz_given = 0 ;
149 +  args_info->twodgofr_given = 0 ;
150    args_info->p2_given = 0 ;
151    args_info->rp2_given = 0 ;
152    args_info->scd_given = 0 ;
153    args_info->density_given = 0 ;
154    args_info->slab_density_given = 0 ;
155 +  args_info->p_angle_given = 0 ;
156    args_info->hxy_given = 0 ;
157    args_info->rho_r_given = 0 ;
158 +  args_info->angle_r_given = 0 ;
159    args_info->hullvol_given = 0 ;
160 +  args_info->rodlength_given = 0 ;
161 +  args_info->tet_param_given = 0 ;
162 +  args_info->tet_param_z_given = 0 ;
163    args_info->staticProps_group_counter = 0 ;
164   }
165  
166   static
167   void clear_args (struct gengetopt_args_info *args_info)
168   {
169 +  FIX_UNUSED (args_info);
170    args_info->input_arg = NULL;
171    args_info->input_orig = NULL;
172    args_info->output_arg = NULL;
# Line 150 | Line 179 | void clear_args (struct gengetopt_args_info *args_info
179    args_info->nbins_x_orig = NULL;
180    args_info->nbins_y_arg = 100;
181    args_info->nbins_y_orig = NULL;
182 +  args_info->nbins_z_arg = 100;
183 +  args_info->nbins_z_orig = NULL;
184    args_info->nanglebins_arg = 50;
185    args_info->nanglebins_orig = NULL;
155  args_info->length_orig = NULL;
186    args_info->rcut_orig = NULL;
187 +  args_info->dz_orig = NULL;
188 +  args_info->length_orig = NULL;
189 +  args_info->zlength_orig = NULL;
190    args_info->zoffset_arg = 0;
191    args_info->zoffset_orig = NULL;
192    args_info->sele1_arg = NULL;
# Line 166 | Line 199 | void clear_args (struct gengetopt_args_info *args_info
199    args_info->refsele_orig = NULL;
200    args_info->comsele_arg = NULL;
201    args_info->comsele_orig = NULL;
202 +  args_info->seleoffset_orig = NULL;
203    args_info->molname_arg = NULL;
204    args_info->molname_orig = NULL;
205    args_info->begin_orig = NULL;
# Line 187 | Line 221 | void init_args_info(struct gengetopt_args_info *args_i
221    args_info->nbins_help = gengetopt_args_info_help[5] ;
222    args_info->nbins_x_help = gengetopt_args_info_help[6] ;
223    args_info->nbins_y_help = gengetopt_args_info_help[7] ;
224 <  args_info->nanglebins_help = gengetopt_args_info_help[8] ;
225 <  args_info->length_help = gengetopt_args_info_help[9] ;
224 >  args_info->nbins_z_help = gengetopt_args_info_help[8] ;
225 >  args_info->nanglebins_help = gengetopt_args_info_help[9] ;
226    args_info->rcut_help = gengetopt_args_info_help[10] ;
227 <  args_info->zoffset_help = gengetopt_args_info_help[11] ;
228 <  args_info->sele1_help = gengetopt_args_info_help[12] ;
229 <  args_info->sele2_help = gengetopt_args_info_help[13] ;
230 <  args_info->sele3_help = gengetopt_args_info_help[14] ;
231 <  args_info->refsele_help = gengetopt_args_info_help[15] ;
232 <  args_info->comsele_help = gengetopt_args_info_help[16] ;
233 <  args_info->molname_help = gengetopt_args_info_help[17] ;
234 <  args_info->begin_help = gengetopt_args_info_help[18] ;
235 <  args_info->end_help = gengetopt_args_info_help[19] ;
236 <  args_info->radius_help = gengetopt_args_info_help[20] ;
237 <  args_info->bo_help = gengetopt_args_info_help[22] ;
238 <  args_info->bor_help = gengetopt_args_info_help[23] ;
239 <  args_info->bad_help = gengetopt_args_info_help[24] ;
240 <  args_info->gofr_help = gengetopt_args_info_help[25] ;
241 <  args_info->gofz_help = gengetopt_args_info_help[26] ;
242 <  args_info->r_theta_help = gengetopt_args_info_help[27] ;
243 <  args_info->r_omega_help = gengetopt_args_info_help[28] ;
244 <  args_info->theta_omega_help = gengetopt_args_info_help[29] ;
245 <  args_info->gxyz_help = gengetopt_args_info_help[30] ;
246 <  args_info->p2_help = gengetopt_args_info_help[31] ;
247 <  args_info->rp2_help = gengetopt_args_info_help[32] ;
248 <  args_info->scd_help = gengetopt_args_info_help[33] ;
249 <  args_info->density_help = gengetopt_args_info_help[34] ;
250 <  args_info->slab_density_help = gengetopt_args_info_help[35] ;
251 <  args_info->hxy_help = gengetopt_args_info_help[36] ;
252 <  args_info->rho_r_help = gengetopt_args_info_help[37] ;
253 <  args_info->hullvol_help = gengetopt_args_info_help[38] ;
227 >  args_info->dz_help = gengetopt_args_info_help[11] ;
228 >  args_info->length_help = gengetopt_args_info_help[12] ;
229 >  args_info->zlength_help = gengetopt_args_info_help[13] ;
230 >  args_info->zoffset_help = gengetopt_args_info_help[14] ;
231 >  args_info->sele1_help = gengetopt_args_info_help[15] ;
232 >  args_info->sele2_help = gengetopt_args_info_help[16] ;
233 >  args_info->sele3_help = gengetopt_args_info_help[17] ;
234 >  args_info->refsele_help = gengetopt_args_info_help[18] ;
235 >  args_info->comsele_help = gengetopt_args_info_help[19] ;
236 >  args_info->seleoffset_help = gengetopt_args_info_help[20] ;
237 >  args_info->molname_help = gengetopt_args_info_help[21] ;
238 >  args_info->begin_help = gengetopt_args_info_help[22] ;
239 >  args_info->end_help = gengetopt_args_info_help[23] ;
240 >  args_info->radius_help = gengetopt_args_info_help[24] ;
241 >  args_info->bo_help = gengetopt_args_info_help[26] ;
242 >  args_info->bor_help = gengetopt_args_info_help[27] ;
243 >  args_info->bad_help = gengetopt_args_info_help[28] ;
244 >  args_info->count_help = gengetopt_args_info_help[29] ;
245 >  args_info->gofr_help = gengetopt_args_info_help[30] ;
246 >  args_info->gofz_help = gengetopt_args_info_help[31] ;
247 >  args_info->r_theta_help = gengetopt_args_info_help[32] ;
248 >  args_info->r_omega_help = gengetopt_args_info_help[33] ;
249 >  args_info->r_z_help = gengetopt_args_info_help[34] ;
250 >  args_info->theta_omega_help = gengetopt_args_info_help[35] ;
251 >  args_info->gxyz_help = gengetopt_args_info_help[36] ;
252 >  args_info->twodgofr_help = gengetopt_args_info_help[37] ;
253 >  args_info->p2_help = gengetopt_args_info_help[38] ;
254 >  args_info->rp2_help = gengetopt_args_info_help[39] ;
255 >  args_info->scd_help = gengetopt_args_info_help[40] ;
256 >  args_info->density_help = gengetopt_args_info_help[41] ;
257 >  args_info->slab_density_help = gengetopt_args_info_help[42] ;
258 >  args_info->p_angle_help = gengetopt_args_info_help[43] ;
259 >  args_info->hxy_help = gengetopt_args_info_help[44] ;
260 >  args_info->rho_r_help = gengetopt_args_info_help[45] ;
261 >  args_info->angle_r_help = gengetopt_args_info_help[46] ;
262 >  args_info->hullvol_help = gengetopt_args_info_help[47] ;
263 >  args_info->rodlength_help = gengetopt_args_info_help[48] ;
264 >  args_info->tet_param_help = gengetopt_args_info_help[49] ;
265 >  args_info->tet_param_z_help = gengetopt_args_info_help[50] ;
266    
267   }
268  
269   void
270   cmdline_parser_print_version (void)
271   {
272 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
272 >  printf ("%s %s\n",
273 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
274 >     CMDLINE_PARSER_VERSION);
275   }
276  
277   static void print_help_common(void) {
# Line 238 | Line 286 | static void print_help_common(void) {
286    printf("\n");
287  
288    if (strlen(gengetopt_args_info_description) > 0)
289 <    printf("%s\n", gengetopt_args_info_description);
289 >    printf("%s\n\n", gengetopt_args_info_description);
290   }
291  
292   void
# Line 256 | Line 304 | cmdline_parser_init (struct gengetopt_args_info *args_
304    clear_given (args_info);
305    clear_args (args_info);
306    init_args_info (args_info);
307 +
308 +  args_info->inputs = 0;
309 +  args_info->inputs_num = 0;
310   }
311  
312   void
# Line 294 | Line 345 | cmdline_parser_release (struct gengetopt_args_info *ar
345   static void
346   cmdline_parser_release (struct gengetopt_args_info *args_info)
347   {
348 <
348 >  unsigned int i;
349    free_string_field (&(args_info->input_arg));
350    free_string_field (&(args_info->input_orig));
351    free_string_field (&(args_info->output_arg));
# Line 303 | Line 354 | cmdline_parser_release (struct gengetopt_args_info *ar
354    free_string_field (&(args_info->nbins_orig));
355    free_string_field (&(args_info->nbins_x_orig));
356    free_string_field (&(args_info->nbins_y_orig));
357 +  free_string_field (&(args_info->nbins_z_orig));
358    free_string_field (&(args_info->nanglebins_orig));
307  free_string_field (&(args_info->length_orig));
359    free_string_field (&(args_info->rcut_orig));
360 +  free_string_field (&(args_info->dz_orig));
361 +  free_string_field (&(args_info->length_orig));
362 +  free_string_field (&(args_info->zlength_orig));
363    free_string_field (&(args_info->zoffset_orig));
364    free_string_field (&(args_info->sele1_arg));
365    free_string_field (&(args_info->sele1_orig));
# Line 317 | Line 371 | cmdline_parser_release (struct gengetopt_args_info *ar
371    free_string_field (&(args_info->refsele_orig));
372    free_string_field (&(args_info->comsele_arg));
373    free_string_field (&(args_info->comsele_orig));
374 +  free_string_field (&(args_info->seleoffset_orig));
375    free_string_field (&(args_info->molname_arg));
376    free_string_field (&(args_info->molname_orig));
377    free_string_field (&(args_info->begin_orig));
# Line 324 | Line 379 | cmdline_parser_release (struct gengetopt_args_info *ar
379    free_string_field (&(args_info->radius_orig));
380    
381    
382 +  for (i = 0; i < args_info->inputs_num; ++i)
383 +    free (args_info->inputs [i]);
384  
385 +  if (args_info->inputs_num)
386 +    free (args_info->inputs);
387 +
388    clear_given (args_info);
389   }
390  
391  
392   static void
393 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
393 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
394   {
395 +  FIX_UNUSED (values);
396    if (arg) {
397      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
398    } else {
# Line 367 | Line 428 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
428      write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0);
429    if (args_info->nbins_y_given)
430      write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0);
431 +  if (args_info->nbins_z_given)
432 +    write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0);
433    if (args_info->nanglebins_given)
434      write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0);
372  if (args_info->length_given)
373    write_into_file(outfile, "length", args_info->length_orig, 0);
435    if (args_info->rcut_given)
436      write_into_file(outfile, "rcut", args_info->rcut_orig, 0);
437 +  if (args_info->dz_given)
438 +    write_into_file(outfile, "dz", args_info->dz_orig, 0);
439 +  if (args_info->length_given)
440 +    write_into_file(outfile, "length", args_info->length_orig, 0);
441 +  if (args_info->zlength_given)
442 +    write_into_file(outfile, "zlength", args_info->zlength_orig, 0);
443    if (args_info->zoffset_given)
444      write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0);
445    if (args_info->sele1_given)
# Line 385 | Line 452 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
452      write_into_file(outfile, "refsele", args_info->refsele_orig, 0);
453    if (args_info->comsele_given)
454      write_into_file(outfile, "comsele", args_info->comsele_orig, 0);
455 +  if (args_info->seleoffset_given)
456 +    write_into_file(outfile, "seleoffset", args_info->seleoffset_orig, 0);
457    if (args_info->molname_given)
458      write_into_file(outfile, "molname", args_info->molname_orig, 0);
459    if (args_info->begin_given)
# Line 399 | Line 468 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
468      write_into_file(outfile, "bor", 0, 0 );
469    if (args_info->bad_given)
470      write_into_file(outfile, "bad", 0, 0 );
471 +  if (args_info->count_given)
472 +    write_into_file(outfile, "count", 0, 0 );
473    if (args_info->gofr_given)
474      write_into_file(outfile, "gofr", 0, 0 );
475    if (args_info->gofz_given)
# Line 407 | Line 478 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
478      write_into_file(outfile, "r_theta", 0, 0 );
479    if (args_info->r_omega_given)
480      write_into_file(outfile, "r_omega", 0, 0 );
481 +  if (args_info->r_z_given)
482 +    write_into_file(outfile, "r_z", 0, 0 );
483    if (args_info->theta_omega_given)
484      write_into_file(outfile, "theta_omega", 0, 0 );
485    if (args_info->gxyz_given)
486      write_into_file(outfile, "gxyz", 0, 0 );
487 +  if (args_info->twodgofr_given)
488 +    write_into_file(outfile, "twodgofr", 0, 0 );
489    if (args_info->p2_given)
490      write_into_file(outfile, "p2", 0, 0 );
491    if (args_info->rp2_given)
# Line 421 | Line 496 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
496      write_into_file(outfile, "density", 0, 0 );
497    if (args_info->slab_density_given)
498      write_into_file(outfile, "slab_density", 0, 0 );
499 +  if (args_info->p_angle_given)
500 +    write_into_file(outfile, "p_angle", 0, 0 );
501    if (args_info->hxy_given)
502      write_into_file(outfile, "hxy", 0, 0 );
503    if (args_info->rho_r_given)
504      write_into_file(outfile, "rho_r", 0, 0 );
505 +  if (args_info->angle_r_given)
506 +    write_into_file(outfile, "angle_r", 0, 0 );
507    if (args_info->hullvol_given)
508      write_into_file(outfile, "hullvol", 0, 0 );
509 +  if (args_info->rodlength_given)
510 +    write_into_file(outfile, "rodlength", 0, 0 );
511 +  if (args_info->tet_param_given)
512 +    write_into_file(outfile, "tet_param", 0, 0 );
513 +  if (args_info->tet_param_z_given)
514 +    write_into_file(outfile, "tet_param_z", 0, 0 );
515    
516  
517    i = EXIT_SUCCESS;
# Line 463 | Line 548 | gengetopt_strdup (const char *s)
548   char *
549   gengetopt_strdup (const char *s)
550   {
551 <  char *result = NULL;
551 >  char *result = 0;
552    if (!s)
553      return result;
554  
# Line 483 | Line 568 | reset_group_staticProps(struct gengetopt_args_info *ar
568    args_info->bo_given = 0 ;
569    args_info->bor_given = 0 ;
570    args_info->bad_given = 0 ;
571 +  args_info->count_given = 0 ;
572    args_info->gofr_given = 0 ;
573    args_info->gofz_given = 0 ;
574    args_info->r_theta_given = 0 ;
575    args_info->r_omega_given = 0 ;
576 +  args_info->r_z_given = 0 ;
577    args_info->theta_omega_given = 0 ;
578    args_info->gxyz_given = 0 ;
579 +  args_info->twodgofr_given = 0 ;
580    args_info->p2_given = 0 ;
581    args_info->rp2_given = 0 ;
582    args_info->scd_given = 0 ;
583    args_info->density_given = 0 ;
584    args_info->slab_density_given = 0 ;
585 +  args_info->p_angle_given = 0 ;
586    args_info->hxy_given = 0 ;
587    args_info->rho_r_given = 0 ;
588 +  args_info->angle_r_given = 0 ;
589    args_info->hullvol_given = 0 ;
590 +  args_info->rodlength_given = 0 ;
591 +  args_info->tet_param_given = 0 ;
592 +  args_info->tet_param_z_given = 0 ;
593  
594    args_info->staticProps_group_counter = 0;
595   }
596  
597   int
598 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
598 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
599   {
600    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
601   }
602  
603   int
604 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
604 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
605                     struct cmdline_parser_params *params)
606   {
607    int result;
608 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
608 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
609  
610    if (result == EXIT_FAILURE)
611      {
# Line 524 | Line 617 | int
617   }
618  
619   int
620 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
620 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
621   {
622    int result;
623    struct cmdline_parser_params params;
# Line 535 | Line 628 | cmdline_parser2 (int argc, char * const *argv, struct
628    params.check_ambiguity = 0;
629    params.print_errors = 1;
630  
631 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
631 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
632  
633    if (result == EXIT_FAILURE)
634      {
# Line 551 | Line 644 | cmdline_parser_required (struct gengetopt_args_info *a
644   {
645    int result = EXIT_SUCCESS;
646  
647 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
647 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
648      result = EXIT_FAILURE;
649  
650    if (result == EXIT_FAILURE)
# Line 567 | Line 660 | cmdline_parser_required2 (struct gengetopt_args_info *
660   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
661   {
662    int error = 0;
663 +  FIX_UNUSED (additional_error);
664  
665    /* checks for required options */
666    if (! args_info->input_given)
# Line 577 | Line 671 | cmdline_parser_required2 (struct gengetopt_args_info *
671    
672    if (args_info->staticProps_group_counter == 0)
673      {
674 <      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 : ""));
674 >      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 : ""));
675        error = 1;
676      }
677    
# Line 611 | Line 705 | int update_arg(void *field, char **orig_field,
705   static
706   int update_arg(void *field, char **orig_field,
707                 unsigned int *field_given, unsigned int *prev_given,
708 <               char *value, char *possible_values[], const char *default_value,
708 >               char *value, const char *possible_values[],
709 >               const char *default_value,
710                 cmdline_parser_arg_type arg_type,
711                 int check_ambiguity, int override,
712                 int no_free, int multiple_option,
# Line 622 | Line 717 | int update_arg(void *field, char **orig_field,
717    const char *val = value;
718    int found;
719    char **string_field;
720 +  FIX_UNUSED (field);
721  
722    stop_char = 0;
723    found = 0;
# Line 639 | Line 735 | int update_arg(void *field, char **orig_field,
735        return 1; /* failure */
736      }
737  
738 +  FIX_UNUSED (default_value);
739      
740    if (field_given && *field_given && ! override)
741      return 0;
# Line 702 | Line 799 | int
799  
800  
801   int
802 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
802 > cmdline_parser_internal (
803 >  int argc, char **argv, struct gengetopt_args_info *args_info,
804                          struct cmdline_parser_params *params, const char *additional_error)
805   {
806    int c;        /* Character of the parsed option.  */
# Line 745 | Line 843 | cmdline_parser_internal (int argc, char * const *argv,
843          { "nbins",      1, NULL, 'b' },
844          { "nbins_x",    1, NULL, 'x' },
845          { "nbins_y",    1, NULL, 'y' },
846 +        { "nbins_z",    1, NULL, 0 },
847          { "nanglebins", 1, NULL, 'a' },
749        { "length",     1, NULL, 0 },
848          { "rcut",       1, NULL, 'c' },
849 +        { "dz", 1, NULL, 0 },
850 +        { "length",     1, NULL, 0 },
851 +        { "zlength",    1, NULL, 0 },
852          { "zoffset",    1, NULL, 'z' },
853          { "sele1",      1, NULL, 0 },
854          { "sele2",      1, NULL, 0 },
855          { "sele3",      1, NULL, 0 },
856          { "refsele",    1, NULL, 0 },
857          { "comsele",    1, NULL, 0 },
858 +        { "seleoffset", 1, NULL, 0 },
859          { "molname",    1, NULL, 0 },
860          { "begin",      1, NULL, 0 },
861          { "end",        1, NULL, 0 },
# Line 761 | Line 863 | cmdline_parser_internal (int argc, char * const *argv,
863          { "bo", 0, NULL, 0 },
864          { "bor",        0, NULL, 0 },
865          { "bad",        0, NULL, 0 },
866 +        { "count",      0, NULL, 0 },
867          { "gofr",       0, NULL, 'g' },
868          { "gofz",       0, NULL, 0 },
869          { "r_theta",    0, NULL, 0 },
870          { "r_omega",    0, NULL, 0 },
871 +        { "r_z",        0, NULL, 0 },
872          { "theta_omega",        0, NULL, 0 },
873          { "gxyz",       0, NULL, 0 },
874 +        { "twodgofr",   0, NULL, 0 },
875          { "p2", 0, NULL, 'p' },
876          { "rp2",        0, NULL, 0 },
877          { "scd",        0, NULL, 's' },
878          { "density",    0, NULL, 'd' },
879          { "slab_density",       0, NULL, 0 },
880 +        { "p_angle",    0, NULL, 0 },
881          { "hxy",        0, NULL, 0 },
882          { "rho_r",      0, NULL, 0 },
883 +        { "angle_r",    0, NULL, 0 },
884          { "hullvol",    0, NULL, 0 },
885 <        { NULL, 0, NULL, 0 }
885 >        { "rodlength",  0, NULL, 0 },
886 >        { "tet_param",  0, NULL, 'Q' },
887 >        { "tet_param_z",        0, NULL, 0 },
888 >        { 0,  0, 0, 0 }
889        };
890  
891 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
891 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
892  
893        if (c == -1) break;       /* Exit from `while (1)' loop.  */
894  
# Line 917 | Line 1027 | cmdline_parser_internal (int argc, char * const *argv,
1027              goto failure;
1028          
1029            break;
1030 <        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1030 >        case 'p':       /* p2 order parameter (--sele1 must be specified, --sele2 is optional).  */
1031          
1032            if (args_info->staticProps_group_counter && override)
1033              reset_group_staticProps (args_info);
# Line 962 | Line 1072 | cmdline_parser_internal (int argc, char * const *argv,
1072              goto failure;
1073          
1074            break;
1075 +        case 'Q':       /* tetrahedrality order parameter (Qk).  */
1076 +        
1077 +          if (args_info->staticProps_group_counter && override)
1078 +            reset_group_staticProps (args_info);
1079 +          args_info->staticProps_group_counter += 1;
1080 +        
1081 +          if (update_arg( 0 ,
1082 +               0 , &(args_info->tet_param_given),
1083 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1084 +              check_ambiguity, override, 0, 0,
1085 +              "tet_param", 'Q',
1086 +              additional_error))
1087 +            goto failure;
1088 +        
1089 +          break;
1090  
1091          case 0: /* Long option with no short option */
1092 +          /* number of bins in z axis.  */
1093 +          if (strcmp (long_options[option_index].name, "nbins_z") == 0)
1094 +          {
1095 +          
1096 +          
1097 +            if (update_arg( (void *)&(args_info->nbins_z_arg),
1098 +                 &(args_info->nbins_z_orig), &(args_info->nbins_z_given),
1099 +                &(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT,
1100 +                check_ambiguity, override, 0, 0,
1101 +                "nbins_z", '-',
1102 +                additional_error))
1103 +              goto failure;
1104 +          
1105 +          }
1106 +          /* slab width (dz).  */
1107 +          else if (strcmp (long_options[option_index].name, "dz") == 0)
1108 +          {
1109 +          
1110 +          
1111 +            if (update_arg( (void *)&(args_info->dz_arg),
1112 +                 &(args_info->dz_orig), &(args_info->dz_given),
1113 +                &(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE,
1114 +                check_ambiguity, override, 0, 0,
1115 +                "dz", '-',
1116 +                additional_error))
1117 +              goto failure;
1118 +          
1119 +          }
1120            /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1121 <          if (strcmp (long_options[option_index].name, "length") == 0)
1121 >          else if (strcmp (long_options[option_index].name, "length") == 0)
1122            {
1123            
1124            
# Line 978 | Line 1131 | cmdline_parser_internal (int argc, char * const *argv,
1131                goto failure;
1132            
1133            }
1134 +          /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1135 +          else if (strcmp (long_options[option_index].name, "zlength") == 0)
1136 +          {
1137 +          
1138 +          
1139 +            if (update_arg( (void *)&(args_info->zlength_arg),
1140 +                 &(args_info->zlength_orig), &(args_info->zlength_given),
1141 +                &(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE,
1142 +                check_ambiguity, override, 0, 0,
1143 +                "zlength", '-',
1144 +                additional_error))
1145 +              goto failure;
1146 +          
1147 +          }
1148            /* select the first stuntdouble set.  */
1149            else if (strcmp (long_options[option_index].name, "sele1") == 0)
1150            {
# Line 1048 | Line 1215 | cmdline_parser_internal (int argc, char * const *argv,
1215                goto failure;
1216            
1217            }
1218 +          /* global index offset for a second object (used to define a vector between sites in molecule).  */
1219 +          else if (strcmp (long_options[option_index].name, "seleoffset") == 0)
1220 +          {
1221 +          
1222 +          
1223 +            if (update_arg( (void *)&(args_info->seleoffset_arg),
1224 +                 &(args_info->seleoffset_orig), &(args_info->seleoffset_given),
1225 +                &(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT,
1226 +                check_ambiguity, override, 0, 0,
1227 +                "seleoffset", '-',
1228 +                additional_error))
1229 +              goto failure;
1230 +          
1231 +          }
1232            /* molecule name.  */
1233            else if (strcmp (long_options[option_index].name, "molname") == 0)
1234            {
# Line 1155 | Line 1336 | cmdline_parser_internal (int argc, char * const *argv,
1336                goto failure;
1337            
1338            }
1339 +          /* count of molecules matching selection criteria (and associated statistics).  */
1340 +          else if (strcmp (long_options[option_index].name, "count") == 0)
1341 +          {
1342 +          
1343 +            if (args_info->staticProps_group_counter && override)
1344 +              reset_group_staticProps (args_info);
1345 +            args_info->staticProps_group_counter += 1;
1346 +          
1347 +            if (update_arg( 0 ,
1348 +                 0 , &(args_info->count_given),
1349 +                &(local_args_info.count_given), optarg, 0, 0, ARG_NO,
1350 +                check_ambiguity, override, 0, 0,
1351 +                "count", '-',
1352 +                additional_error))
1353 +              goto failure;
1354 +          
1355 +          }
1356            /* g(z).  */
1357            else if (strcmp (long_options[option_index].name, "gofz") == 0)
1358            {
# Line 1202 | Line 1400 | cmdline_parser_internal (int argc, char * const *argv,
1400                  &(local_args_info.r_omega_given), optarg, 0, 0, ARG_NO,
1401                  check_ambiguity, override, 0, 0,
1402                  "r_omega", '-',
1403 +                additional_error))
1404 +              goto failure;
1405 +          
1406 +          }
1407 +          /* g(r, z).  */
1408 +          else if (strcmp (long_options[option_index].name, "r_z") == 0)
1409 +          {
1410 +          
1411 +            if (args_info->staticProps_group_counter && override)
1412 +              reset_group_staticProps (args_info);
1413 +            args_info->staticProps_group_counter += 1;
1414 +          
1415 +            if (update_arg( 0 ,
1416 +                 0 , &(args_info->r_z_given),
1417 +                &(local_args_info.r_z_given), optarg, 0, 0, ARG_NO,
1418 +                check_ambiguity, override, 0, 0,
1419 +                "r_z", '-',
1420                  additional_error))
1421                goto failure;
1422            
# Line 1240 | Line 1455 | cmdline_parser_internal (int argc, char * const *argv,
1455                goto failure;
1456            
1457            }
1458 +          /* 2D g(r) (Slab width --dz must be specified).  */
1459 +          else if (strcmp (long_options[option_index].name, "twodgofr") == 0)
1460 +          {
1461 +          
1462 +            if (args_info->staticProps_group_counter && override)
1463 +              reset_group_staticProps (args_info);
1464 +            args_info->staticProps_group_counter += 1;
1465 +          
1466 +            if (update_arg( 0 ,
1467 +                 0 , &(args_info->twodgofr_given),
1468 +                &(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO,
1469 +                check_ambiguity, override, 0, 0,
1470 +                "twodgofr", '-',
1471 +                additional_error))
1472 +              goto failure;
1473 +          
1474 +          }
1475            /* rp2 order parameter (--sele1 and --sele2 must be specified).  */
1476            else if (strcmp (long_options[option_index].name, "rp2") == 0)
1477            {
# Line 1274 | Line 1506 | cmdline_parser_internal (int argc, char * const *argv,
1506                goto failure;
1507            
1508            }
1509 +          /* p(cos(theta)).  */
1510 +          else if (strcmp (long_options[option_index].name, "p_angle") == 0)
1511 +          {
1512 +          
1513 +            if (args_info->staticProps_group_counter && override)
1514 +              reset_group_staticProps (args_info);
1515 +            args_info->staticProps_group_counter += 1;
1516 +          
1517 +            if (update_arg( 0 ,
1518 +                 0 , &(args_info->p_angle_given),
1519 +                &(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO,
1520 +                check_ambiguity, override, 0, 0,
1521 +                "p_angle", '-',
1522 +                additional_error))
1523 +              goto failure;
1524 +          
1525 +          }
1526            /* hxy.  */
1527            else if (strcmp (long_options[option_index].name, "hxy") == 0)
1528            {
# Line 1308 | Line 1557 | cmdline_parser_internal (int argc, char * const *argv,
1557                goto failure;
1558            
1559            }
1560 +          /* angle of R.  */
1561 +          else if (strcmp (long_options[option_index].name, "angle_r") == 0)
1562 +          {
1563 +          
1564 +            if (args_info->staticProps_group_counter && override)
1565 +              reset_group_staticProps (args_info);
1566 +            args_info->staticProps_group_counter += 1;
1567 +          
1568 +            if (update_arg( 0 ,
1569 +                 0 , &(args_info->angle_r_given),
1570 +                &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO,
1571 +                check_ambiguity, override, 0, 0,
1572 +                "angle_r", '-',
1573 +                additional_error))
1574 +              goto failure;
1575 +          
1576 +          }
1577            /* hull volume of nanoparticle.  */
1578            else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1579            {
# Line 1325 | Line 1591 | cmdline_parser_internal (int argc, char * const *argv,
1591                goto failure;
1592            
1593            }
1594 +          /* length of nanorod.  */
1595 +          else if (strcmp (long_options[option_index].name, "rodlength") == 0)
1596 +          {
1597            
1598 +            if (args_info->staticProps_group_counter && override)
1599 +              reset_group_staticProps (args_info);
1600 +            args_info->staticProps_group_counter += 1;
1601 +          
1602 +            if (update_arg( 0 ,
1603 +                 0 , &(args_info->rodlength_given),
1604 +                &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO,
1605 +                check_ambiguity, override, 0, 0,
1606 +                "rodlength", '-',
1607 +                additional_error))
1608 +              goto failure;
1609 +          
1610 +          }
1611 +          /* spatially-resolved tetrahedrality order parameter Qk(z).  */
1612 +          else if (strcmp (long_options[option_index].name, "tet_param_z") == 0)
1613 +          {
1614 +          
1615 +            if (args_info->staticProps_group_counter && override)
1616 +              reset_group_staticProps (args_info);
1617 +            args_info->staticProps_group_counter += 1;
1618 +          
1619 +            if (update_arg( 0 ,
1620 +                 0 , &(args_info->tet_param_z_given),
1621 +                &(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO,
1622 +                check_ambiguity, override, 0, 0,
1623 +                "tet_param_z", '-',
1624 +                additional_error))
1625 +              goto failure;
1626 +          
1627 +          }
1628 +          
1629            break;
1630          case '?':       /* Invalid option.  */
1631            /* `getopt_long' already printed an error message.  */
# Line 1339 | Line 1639 | cmdline_parser_internal (int argc, char * const *argv,
1639  
1640    if (args_info->staticProps_group_counter > 1)
1641      {
1642 <      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 : ""));
1642 >      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 : ""));
1643        error = 1;
1644      }
1645    
# Line 1355 | Line 1655 | cmdline_parser_internal (int argc, char * const *argv,
1655    if ( error )
1656      return (EXIT_FAILURE);
1657  
1658 +  if (optind < argc)
1659 +    {
1660 +      int i = 0 ;
1661 +      int found_prog_name = 0;
1662 +      /* whether program name, i.e., argv[0], is in the remaining args
1663 +         (this may happen with some implementations of getopt,
1664 +          but surely not with the one included by gengetopt) */
1665 +
1666 +      i = optind;
1667 +      while (i < argc)
1668 +        if (argv[i++] == argv[0]) {
1669 +          found_prog_name = 1;
1670 +          break;
1671 +        }
1672 +      i = 0;
1673 +
1674 +      args_info->inputs_num = argc - optind - found_prog_name;
1675 +      args_info->inputs =
1676 +        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1677 +      while (optind < argc)
1678 +        if (argv[optind++] != argv[0])
1679 +          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1680 +    }
1681 +
1682    return 0;
1683  
1684   failure:

Comparing:
trunk/src/applications/staticProps/StaticPropsCmd.c (property svn:keywords), Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
trunk/src/applications/staticProps/StaticPropsCmd.cpp (property svn:keywords), Revision 1843 by gezelter, Tue Jan 29 20:58:08 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines