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 1795 by gezelter, Fri Sep 7 18:13:55 2012 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 -i StaticProps.ggo -c cpp -F StaticPropsCmd -u
5  
6    The developers of gengetopt consider the fixed text that goes in all
7    gengetopt output files to be in the public domain:
# Line 17 | Line 17
17   #include <stdlib.h>
18   #include <string.h>
19  
20 < #include "getopt.h"
20 > #ifndef FIX_UNUSED
21 > #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 > #endif
23  
24 + #ifdef WIN32
25 + #include "utils/wingetopt.h"
26 + #else
27 + #include <getopt.h>
28 + #endif
29 +
30   #include "StaticPropsCmd.h"
31  
32   const char *gengetopt_args_info_purpose = "";
33  
34 < const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]...";
34 > const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]...";
35  
36   const char *gengetopt_args_info_description = "";
37  
# Line 36 | Line 44 | const char *gengetopt_args_info_help[] = {
44    "  -b, --nbins=INT               number of bins (general purpose)  \n                                  (default=`100')",
45    "  -x, --nbins_x=INT             number of bins in x axis  (default=`100')",
46    "  -y, --nbins_y=INT             number of bins in y axis  (default=`100')",
47 +  "      --nbins_z=INT             number of bins in z axis  (default=`100')",
48    "  -a, --nanglebins=INT          number of bins for cos(angle)  (default=`50')",
40  "      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)",
49    "  -c, --rcut=DOUBLE             cutoff radius (rcut)",
50 +  "      --dz=DOUBLE               slab width (dz)",
51 +  "      --length=DOUBLE           maximum length (Defaults to 1/2 smallest length \n                                  of first frame)",
52 +  "      --zlength=DOUBLE          maximum length (Defaults to 1/2 smallest length \n                                  of first frame)",
53    "  -z, --zoffset=DOUBLE          Where to set the zero for the slab_density \n                                  calculation  (default=`0')",
54    "      --sele1=selection script  select the first stuntdouble set",
55    "      --sele2=selection script  select the second stuntdouble set",
# Line 53 | Line 64 | const char *gengetopt_args_info_help[] = {
64    "      --bo                      bond order parameter (--rcut must be specified)",
65    "      --bor                     bond order parameter as a function of radius \n                                  (--rcut must be specified)",
66    "      --bad                     N(theta) bond angle density within (--rcut must \n                                  be specified)",
67 +  "      --count                   count of molecules matching selection criteria \n                                  (and associated statistics)",
68    "  -g, --gofr                    g(r)",
69    "      --gofz                    g(z)",
70    "      --r_theta                 g(r, cos(theta))",
71    "      --r_omega                 g(r, cos(omega))",
72 +  "      --r_z                     g(r, z)",
73    "      --theta_omega             g(cos(theta), cos(omega))",
74    "      --gxyz                    g(x, y, z)",
75 <  "  -p, --p2                      p2 order parameter (--sele1 and --sele2 must be \n                                  specified)",
75 >  "      --twodgofr                2D g(r) (Slab width --dz must be specified)",
76 >  "  -p, --p2                      p2 order parameter (--sele1 must be specified, \n                                  --sele2 is optional)",
77    "      --rp2                     rp2 order parameter (--sele1 and --sele2 must \n                                  be specified)",
78    "  -s, --scd                     scd order parameter (either --sele1, --sele2, \n                                  --sele3 are specified or --molname, --begin, \n                                  --end are specified)",
79    "  -d, --density                 density plot",
80    "      --slab_density            slab density",
81 +  "      --p_angle                 p(cos(theta))",
82    "      --hxy                     hxy",
83    "      --rho_r                   rho of R",
84 +  "      --angle_r                 angle of R",
85    "      --hullvol                 hull volume of nanoparticle",
86 +  "      --rodlength               length of nanorod",
87 +  "  -Q, --tet_param               tetrahedrality order parameter",
88 +  "      --tet_param_z             tetrahedrality order parameter by zbin(--sele1 \n                                  must be specified)",
89      0
90   };
91  
# Line 82 | Line 101 | static int
101   void clear_args (struct gengetopt_args_info *args_info);
102  
103   static int
104 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
104 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
105                          struct cmdline_parser_params *params, const char *additional_error);
106  
107   static int
# Line 102 | Line 121 | void clear_given (struct gengetopt_args_info *args_inf
121    args_info->nbins_given = 0 ;
122    args_info->nbins_x_given = 0 ;
123    args_info->nbins_y_given = 0 ;
124 +  args_info->nbins_z_given = 0 ;
125    args_info->nanglebins_given = 0 ;
106  args_info->length_given = 0 ;
126    args_info->rcut_given = 0 ;
127 +  args_info->dz_given = 0 ;
128 +  args_info->length_given = 0 ;
129 +  args_info->zlength_given = 0 ;
130    args_info->zoffset_given = 0 ;
131    args_info->sele1_given = 0 ;
132    args_info->sele2_given = 0 ;
# Line 118 | Line 140 | void clear_given (struct gengetopt_args_info *args_inf
140    args_info->bo_given = 0 ;
141    args_info->bor_given = 0 ;
142    args_info->bad_given = 0 ;
143 +  args_info->count_given = 0 ;
144    args_info->gofr_given = 0 ;
145    args_info->gofz_given = 0 ;
146    args_info->r_theta_given = 0 ;
147    args_info->r_omega_given = 0 ;
148 +  args_info->r_z_given = 0 ;
149    args_info->theta_omega_given = 0 ;
150    args_info->gxyz_given = 0 ;
151 +  args_info->twodgofr_given = 0 ;
152    args_info->p2_given = 0 ;
153    args_info->rp2_given = 0 ;
154    args_info->scd_given = 0 ;
155    args_info->density_given = 0 ;
156    args_info->slab_density_given = 0 ;
157 +  args_info->p_angle_given = 0 ;
158    args_info->hxy_given = 0 ;
159    args_info->rho_r_given = 0 ;
160 +  args_info->angle_r_given = 0 ;
161    args_info->hullvol_given = 0 ;
162 +  args_info->rodlength_given = 0 ;
163 +  args_info->tet_param_given = 0 ;
164 +  args_info->tet_param_z_given = 0 ;
165    args_info->staticProps_group_counter = 0 ;
166   }
167  
168   static
169   void clear_args (struct gengetopt_args_info *args_info)
170   {
171 +  FIX_UNUSED (args_info);
172    args_info->input_arg = NULL;
173    args_info->input_orig = NULL;
174    args_info->output_arg = NULL;
# Line 150 | Line 181 | void clear_args (struct gengetopt_args_info *args_info
181    args_info->nbins_x_orig = NULL;
182    args_info->nbins_y_arg = 100;
183    args_info->nbins_y_orig = NULL;
184 +  args_info->nbins_z_arg = 100;
185 +  args_info->nbins_z_orig = NULL;
186    args_info->nanglebins_arg = 50;
187    args_info->nanglebins_orig = NULL;
155  args_info->length_orig = NULL;
188    args_info->rcut_orig = NULL;
189 +  args_info->dz_orig = NULL;
190 +  args_info->length_orig = NULL;
191 +  args_info->zlength_orig = NULL;
192    args_info->zoffset_arg = 0;
193    args_info->zoffset_orig = NULL;
194    args_info->sele1_arg = NULL;
# Line 187 | Line 222 | void init_args_info(struct gengetopt_args_info *args_i
222    args_info->nbins_help = gengetopt_args_info_help[5] ;
223    args_info->nbins_x_help = gengetopt_args_info_help[6] ;
224    args_info->nbins_y_help = gengetopt_args_info_help[7] ;
225 <  args_info->nanglebins_help = gengetopt_args_info_help[8] ;
226 <  args_info->length_help = gengetopt_args_info_help[9] ;
225 >  args_info->nbins_z_help = gengetopt_args_info_help[8] ;
226 >  args_info->nanglebins_help = gengetopt_args_info_help[9] ;
227    args_info->rcut_help = gengetopt_args_info_help[10] ;
228 <  args_info->zoffset_help = gengetopt_args_info_help[11] ;
229 <  args_info->sele1_help = gengetopt_args_info_help[12] ;
230 <  args_info->sele2_help = gengetopt_args_info_help[13] ;
231 <  args_info->sele3_help = gengetopt_args_info_help[14] ;
232 <  args_info->refsele_help = gengetopt_args_info_help[15] ;
233 <  args_info->comsele_help = gengetopt_args_info_help[16] ;
234 <  args_info->molname_help = gengetopt_args_info_help[17] ;
235 <  args_info->begin_help = gengetopt_args_info_help[18] ;
236 <  args_info->end_help = gengetopt_args_info_help[19] ;
237 <  args_info->radius_help = gengetopt_args_info_help[20] ;
238 <  args_info->bo_help = gengetopt_args_info_help[22] ;
239 <  args_info->bor_help = gengetopt_args_info_help[23] ;
240 <  args_info->bad_help = gengetopt_args_info_help[24] ;
241 <  args_info->gofr_help = gengetopt_args_info_help[25] ;
242 <  args_info->gofz_help = gengetopt_args_info_help[26] ;
243 <  args_info->r_theta_help = gengetopt_args_info_help[27] ;
244 <  args_info->r_omega_help = gengetopt_args_info_help[28] ;
245 <  args_info->theta_omega_help = gengetopt_args_info_help[29] ;
246 <  args_info->gxyz_help = gengetopt_args_info_help[30] ;
247 <  args_info->p2_help = gengetopt_args_info_help[31] ;
248 <  args_info->rp2_help = gengetopt_args_info_help[32] ;
249 <  args_info->scd_help = gengetopt_args_info_help[33] ;
250 <  args_info->density_help = gengetopt_args_info_help[34] ;
251 <  args_info->slab_density_help = gengetopt_args_info_help[35] ;
252 <  args_info->hxy_help = gengetopt_args_info_help[36] ;
253 <  args_info->rho_r_help = gengetopt_args_info_help[37] ;
254 <  args_info->hullvol_help = gengetopt_args_info_help[38] ;
228 >  args_info->dz_help = gengetopt_args_info_help[11] ;
229 >  args_info->length_help = gengetopt_args_info_help[12] ;
230 >  args_info->zlength_help = gengetopt_args_info_help[13] ;
231 >  args_info->zoffset_help = gengetopt_args_info_help[14] ;
232 >  args_info->sele1_help = gengetopt_args_info_help[15] ;
233 >  args_info->sele2_help = gengetopt_args_info_help[16] ;
234 >  args_info->sele3_help = gengetopt_args_info_help[17] ;
235 >  args_info->refsele_help = gengetopt_args_info_help[18] ;
236 >  args_info->comsele_help = gengetopt_args_info_help[19] ;
237 >  args_info->molname_help = gengetopt_args_info_help[20] ;
238 >  args_info->begin_help = gengetopt_args_info_help[21] ;
239 >  args_info->end_help = gengetopt_args_info_help[22] ;
240 >  args_info->radius_help = gengetopt_args_info_help[23] ;
241 >  args_info->bo_help = gengetopt_args_info_help[25] ;
242 >  args_info->bor_help = gengetopt_args_info_help[26] ;
243 >  args_info->bad_help = gengetopt_args_info_help[27] ;
244 >  args_info->count_help = gengetopt_args_info_help[28] ;
245 >  args_info->gofr_help = gengetopt_args_info_help[29] ;
246 >  args_info->gofz_help = gengetopt_args_info_help[30] ;
247 >  args_info->r_theta_help = gengetopt_args_info_help[31] ;
248 >  args_info->r_omega_help = gengetopt_args_info_help[32] ;
249 >  args_info->r_z_help = gengetopt_args_info_help[33] ;
250 >  args_info->theta_omega_help = gengetopt_args_info_help[34] ;
251 >  args_info->gxyz_help = gengetopt_args_info_help[35] ;
252 >  args_info->twodgofr_help = gengetopt_args_info_help[36] ;
253 >  args_info->p2_help = gengetopt_args_info_help[37] ;
254 >  args_info->rp2_help = gengetopt_args_info_help[38] ;
255 >  args_info->scd_help = gengetopt_args_info_help[39] ;
256 >  args_info->density_help = gengetopt_args_info_help[40] ;
257 >  args_info->slab_density_help = gengetopt_args_info_help[41] ;
258 >  args_info->p_angle_help = gengetopt_args_info_help[42] ;
259 >  args_info->hxy_help = gengetopt_args_info_help[43] ;
260 >  args_info->rho_r_help = gengetopt_args_info_help[44] ;
261 >  args_info->angle_r_help = gengetopt_args_info_help[45] ;
262 >  args_info->hullvol_help = gengetopt_args_info_help[46] ;
263 >  args_info->rodlength_help = gengetopt_args_info_help[47] ;
264 >  args_info->tet_param_help = gengetopt_args_info_help[48] ;
265 >  args_info->tet_param_z_help = gengetopt_args_info_help[49] ;
266    
267   }
268  
269   void
270   cmdline_parser_print_version (void)
271   {
272 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
272 >  printf ("%s %s\n",
273 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
274 >     CMDLINE_PARSER_VERSION);
275   }
276  
277   static void print_help_common(void) {
# 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 324 | Line 378 | cmdline_parser_release (struct gengetopt_args_info *ar
378    free_string_field (&(args_info->radius_orig));
379    
380    
381 +  for (i = 0; i < args_info->inputs_num; ++i)
382 +    free (args_info->inputs [i]);
383  
384 +  if (args_info->inputs_num)
385 +    free (args_info->inputs);
386 +
387    clear_given (args_info);
388   }
389  
390  
391   static void
392 < write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
392 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
393   {
394 +  FIX_UNUSED (values);
395    if (arg) {
396      fprintf(outfile, "%s=\"%s\"\n", opt, arg);
397    } else {
# Line 367 | Line 427 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
427      write_into_file(outfile, "nbins_x", args_info->nbins_x_orig, 0);
428    if (args_info->nbins_y_given)
429      write_into_file(outfile, "nbins_y", args_info->nbins_y_orig, 0);
430 +  if (args_info->nbins_z_given)
431 +    write_into_file(outfile, "nbins_z", args_info->nbins_z_orig, 0);
432    if (args_info->nanglebins_given)
433      write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0);
372  if (args_info->length_given)
373    write_into_file(outfile, "length", args_info->length_orig, 0);
434    if (args_info->rcut_given)
435      write_into_file(outfile, "rcut", args_info->rcut_orig, 0);
436 +  if (args_info->dz_given)
437 +    write_into_file(outfile, "dz", args_info->dz_orig, 0);
438 +  if (args_info->length_given)
439 +    write_into_file(outfile, "length", args_info->length_orig, 0);
440 +  if (args_info->zlength_given)
441 +    write_into_file(outfile, "zlength", args_info->zlength_orig, 0);
442    if (args_info->zoffset_given)
443      write_into_file(outfile, "zoffset", args_info->zoffset_orig, 0);
444    if (args_info->sele1_given)
# Line 399 | Line 465 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
465      write_into_file(outfile, "bor", 0, 0 );
466    if (args_info->bad_given)
467      write_into_file(outfile, "bad", 0, 0 );
468 +  if (args_info->count_given)
469 +    write_into_file(outfile, "count", 0, 0 );
470    if (args_info->gofr_given)
471      write_into_file(outfile, "gofr", 0, 0 );
472    if (args_info->gofz_given)
# Line 407 | Line 475 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
475      write_into_file(outfile, "r_theta", 0, 0 );
476    if (args_info->r_omega_given)
477      write_into_file(outfile, "r_omega", 0, 0 );
478 +  if (args_info->r_z_given)
479 +    write_into_file(outfile, "r_z", 0, 0 );
480    if (args_info->theta_omega_given)
481      write_into_file(outfile, "theta_omega", 0, 0 );
482    if (args_info->gxyz_given)
483      write_into_file(outfile, "gxyz", 0, 0 );
484 +  if (args_info->twodgofr_given)
485 +    write_into_file(outfile, "twodgofr", 0, 0 );
486    if (args_info->p2_given)
487      write_into_file(outfile, "p2", 0, 0 );
488    if (args_info->rp2_given)
# Line 421 | Line 493 | cmdline_parser_dump(FILE *outfile, struct gengetopt_ar
493      write_into_file(outfile, "density", 0, 0 );
494    if (args_info->slab_density_given)
495      write_into_file(outfile, "slab_density", 0, 0 );
496 +  if (args_info->p_angle_given)
497 +    write_into_file(outfile, "p_angle", 0, 0 );
498    if (args_info->hxy_given)
499      write_into_file(outfile, "hxy", 0, 0 );
500    if (args_info->rho_r_given)
501      write_into_file(outfile, "rho_r", 0, 0 );
502 +  if (args_info->angle_r_given)
503 +    write_into_file(outfile, "angle_r", 0, 0 );
504    if (args_info->hullvol_given)
505      write_into_file(outfile, "hullvol", 0, 0 );
506 +  if (args_info->rodlength_given)
507 +    write_into_file(outfile, "rodlength", 0, 0 );
508 +  if (args_info->tet_param_given)
509 +    write_into_file(outfile, "tet_param", 0, 0 );
510 +  if (args_info->tet_param_z_given)
511 +    write_into_file(outfile, "tet_param_z", 0, 0 );
512    
513  
514    i = EXIT_SUCCESS;
# Line 463 | Line 545 | gengetopt_strdup (const char *s)
545   char *
546   gengetopt_strdup (const char *s)
547   {
548 <  char *result = NULL;
548 >  char *result = 0;
549    if (!s)
550      return result;
551  
# Line 483 | Line 565 | reset_group_staticProps(struct gengetopt_args_info *ar
565    args_info->bo_given = 0 ;
566    args_info->bor_given = 0 ;
567    args_info->bad_given = 0 ;
568 +  args_info->count_given = 0 ;
569    args_info->gofr_given = 0 ;
570    args_info->gofz_given = 0 ;
571    args_info->r_theta_given = 0 ;
572    args_info->r_omega_given = 0 ;
573 +  args_info->r_z_given = 0 ;
574    args_info->theta_omega_given = 0 ;
575    args_info->gxyz_given = 0 ;
576 +  args_info->twodgofr_given = 0 ;
577    args_info->p2_given = 0 ;
578    args_info->rp2_given = 0 ;
579    args_info->scd_given = 0 ;
580    args_info->density_given = 0 ;
581    args_info->slab_density_given = 0 ;
582 +  args_info->p_angle_given = 0 ;
583    args_info->hxy_given = 0 ;
584    args_info->rho_r_given = 0 ;
585 +  args_info->angle_r_given = 0 ;
586    args_info->hullvol_given = 0 ;
587 +  args_info->rodlength_given = 0 ;
588 +  args_info->tet_param_given = 0 ;
589 +  args_info->tet_param_z_given = 0 ;
590  
591    args_info->staticProps_group_counter = 0;
592   }
593  
594   int
595 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
595 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
596   {
597    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
598   }
599  
600   int
601 < cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
601 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
602                     struct cmdline_parser_params *params)
603   {
604    int result;
605 <  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
605 >  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
606  
607    if (result == EXIT_FAILURE)
608      {
# Line 524 | Line 614 | int
614   }
615  
616   int
617 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
617 > cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
618   {
619    int result;
620    struct cmdline_parser_params params;
# Line 535 | Line 625 | cmdline_parser2 (int argc, char * const *argv, struct
625    params.check_ambiguity = 0;
626    params.print_errors = 1;
627  
628 <  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
628 >  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
629  
630    if (result == EXIT_FAILURE)
631      {
# Line 551 | Line 641 | cmdline_parser_required (struct gengetopt_args_info *a
641   {
642    int result = EXIT_SUCCESS;
643  
644 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
644 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
645      result = EXIT_FAILURE;
646  
647    if (result == EXIT_FAILURE)
# Line 567 | Line 657 | cmdline_parser_required2 (struct gengetopt_args_info *
657   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
658   {
659    int error = 0;
660 +  FIX_UNUSED (additional_error);
661  
662    /* checks for required options */
663    if (! args_info->input_given)
# Line 577 | Line 668 | cmdline_parser_required2 (struct gengetopt_args_info *
668    
669    if (args_info->staticProps_group_counter == 0)
670      {
671 <      fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
671 >      fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
672        error = 1;
673      }
674    
# Line 611 | Line 702 | int update_arg(void *field, char **orig_field,
702   static
703   int update_arg(void *field, char **orig_field,
704                 unsigned int *field_given, unsigned int *prev_given,
705 <               char *value, char *possible_values[], const char *default_value,
705 >               char *value, const char *possible_values[],
706 >               const char *default_value,
707                 cmdline_parser_arg_type arg_type,
708                 int check_ambiguity, int override,
709                 int no_free, int multiple_option,
# Line 622 | Line 714 | int update_arg(void *field, char **orig_field,
714    const char *val = value;
715    int found;
716    char **string_field;
717 +  FIX_UNUSED (field);
718  
719    stop_char = 0;
720    found = 0;
# Line 639 | Line 732 | int update_arg(void *field, char **orig_field,
732        return 1; /* failure */
733      }
734  
735 +  FIX_UNUSED (default_value);
736      
737    if (field_given && *field_given && ! override)
738      return 0;
# Line 702 | Line 796 | int
796  
797  
798   int
799 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
799 > cmdline_parser_internal (
800 >  int argc, char **argv, struct gengetopt_args_info *args_info,
801                          struct cmdline_parser_params *params, const char *additional_error)
802   {
803    int c;        /* Character of the parsed option.  */
# Line 745 | Line 840 | cmdline_parser_internal (int argc, char * const *argv,
840          { "nbins",      1, NULL, 'b' },
841          { "nbins_x",    1, NULL, 'x' },
842          { "nbins_y",    1, NULL, 'y' },
843 +        { "nbins_z",    1, NULL, 0 },
844          { "nanglebins", 1, NULL, 'a' },
749        { "length",     1, NULL, 0 },
845          { "rcut",       1, NULL, 'c' },
846 +        { "dz", 1, NULL, 0 },
847 +        { "length",     1, NULL, 0 },
848 +        { "zlength",    1, NULL, 0 },
849          { "zoffset",    1, NULL, 'z' },
850          { "sele1",      1, NULL, 0 },
851          { "sele2",      1, NULL, 0 },
# Line 761 | Line 859 | cmdline_parser_internal (int argc, char * const *argv,
859          { "bo", 0, NULL, 0 },
860          { "bor",        0, NULL, 0 },
861          { "bad",        0, NULL, 0 },
862 +        { "count",      0, NULL, 0 },
863          { "gofr",       0, NULL, 'g' },
864          { "gofz",       0, NULL, 0 },
865          { "r_theta",    0, NULL, 0 },
866          { "r_omega",    0, NULL, 0 },
867 +        { "r_z",        0, NULL, 0 },
868          { "theta_omega",        0, NULL, 0 },
869          { "gxyz",       0, NULL, 0 },
870 +        { "twodgofr",   0, NULL, 0 },
871          { "p2", 0, NULL, 'p' },
872          { "rp2",        0, NULL, 0 },
873          { "scd",        0, NULL, 's' },
874          { "density",    0, NULL, 'd' },
875          { "slab_density",       0, NULL, 0 },
876 +        { "p_angle",    0, NULL, 0 },
877          { "hxy",        0, NULL, 0 },
878          { "rho_r",      0, NULL, 0 },
879 +        { "angle_r",    0, NULL, 0 },
880          { "hullvol",    0, NULL, 0 },
881 <        { NULL, 0, NULL, 0 }
881 >        { "rodlength",  0, NULL, 0 },
882 >        { "tet_param",  0, NULL, 'Q' },
883 >        { "tet_param_z",        0, NULL, 0 },
884 >        { 0,  0, 0, 0 }
885        };
886  
887 <      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index);
887 >      c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index);
888  
889        if (c == -1) break;       /* Exit from `while (1)' loop.  */
890  
# Line 917 | Line 1023 | cmdline_parser_internal (int argc, char * const *argv,
1023              goto failure;
1024          
1025            break;
1026 <        case 'p':       /* p2 order parameter (--sele1 and --sele2 must be specified).  */
1026 >        case 'p':       /* p2 order parameter (--sele1 must be specified, --sele2 is optional).  */
1027          
1028            if (args_info->staticProps_group_counter && override)
1029              reset_group_staticProps (args_info);
# Line 962 | Line 1068 | cmdline_parser_internal (int argc, char * const *argv,
1068              goto failure;
1069          
1070            break;
1071 +        case 'Q':       /* tetrahedrality order parameter.  */
1072 +        
1073 +          if (args_info->staticProps_group_counter && override)
1074 +            reset_group_staticProps (args_info);
1075 +          args_info->staticProps_group_counter += 1;
1076 +        
1077 +          if (update_arg( 0 ,
1078 +               0 , &(args_info->tet_param_given),
1079 +              &(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO,
1080 +              check_ambiguity, override, 0, 0,
1081 +              "tet_param", 'Q',
1082 +              additional_error))
1083 +            goto failure;
1084 +        
1085 +          break;
1086  
1087          case 0: /* Long option with no short option */
1088 +          /* number of bins in z axis.  */
1089 +          if (strcmp (long_options[option_index].name, "nbins_z") == 0)
1090 +          {
1091 +          
1092 +          
1093 +            if (update_arg( (void *)&(args_info->nbins_z_arg),
1094 +                 &(args_info->nbins_z_orig), &(args_info->nbins_z_given),
1095 +                &(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT,
1096 +                check_ambiguity, override, 0, 0,
1097 +                "nbins_z", '-',
1098 +                additional_error))
1099 +              goto failure;
1100 +          
1101 +          }
1102 +          /* slab width (dz).  */
1103 +          else if (strcmp (long_options[option_index].name, "dz") == 0)
1104 +          {
1105 +          
1106 +          
1107 +            if (update_arg( (void *)&(args_info->dz_arg),
1108 +                 &(args_info->dz_orig), &(args_info->dz_given),
1109 +                &(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE,
1110 +                check_ambiguity, override, 0, 0,
1111 +                "dz", '-',
1112 +                additional_error))
1113 +              goto failure;
1114 +          
1115 +          }
1116            /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1117 <          if (strcmp (long_options[option_index].name, "length") == 0)
1117 >          else if (strcmp (long_options[option_index].name, "length") == 0)
1118            {
1119            
1120            
# Line 978 | Line 1127 | cmdline_parser_internal (int argc, char * const *argv,
1127                goto failure;
1128            
1129            }
1130 +          /* maximum length (Defaults to 1/2 smallest length of first frame).  */
1131 +          else if (strcmp (long_options[option_index].name, "zlength") == 0)
1132 +          {
1133 +          
1134 +          
1135 +            if (update_arg( (void *)&(args_info->zlength_arg),
1136 +                 &(args_info->zlength_orig), &(args_info->zlength_given),
1137 +                &(local_args_info.zlength_given), optarg, 0, 0, ARG_DOUBLE,
1138 +                check_ambiguity, override, 0, 0,
1139 +                "zlength", '-',
1140 +                additional_error))
1141 +              goto failure;
1142 +          
1143 +          }
1144            /* select the first stuntdouble set.  */
1145            else if (strcmp (long_options[option_index].name, "sele1") == 0)
1146            {
# Line 1155 | Line 1318 | cmdline_parser_internal (int argc, char * const *argv,
1318                goto failure;
1319            
1320            }
1321 +          /* count of molecules matching selection criteria (and associated statistics).  */
1322 +          else if (strcmp (long_options[option_index].name, "count") == 0)
1323 +          {
1324 +          
1325 +            if (args_info->staticProps_group_counter && override)
1326 +              reset_group_staticProps (args_info);
1327 +            args_info->staticProps_group_counter += 1;
1328 +          
1329 +            if (update_arg( 0 ,
1330 +                 0 , &(args_info->count_given),
1331 +                &(local_args_info.count_given), optarg, 0, 0, ARG_NO,
1332 +                check_ambiguity, override, 0, 0,
1333 +                "count", '-',
1334 +                additional_error))
1335 +              goto failure;
1336 +          
1337 +          }
1338            /* g(z).  */
1339            else if (strcmp (long_options[option_index].name, "gofz") == 0)
1340            {
# Line 1206 | Line 1386 | cmdline_parser_internal (int argc, char * const *argv,
1386                goto failure;
1387            
1388            }
1389 +          /* g(r, z).  */
1390 +          else if (strcmp (long_options[option_index].name, "r_z") == 0)
1391 +          {
1392 +          
1393 +            if (args_info->staticProps_group_counter && override)
1394 +              reset_group_staticProps (args_info);
1395 +            args_info->staticProps_group_counter += 1;
1396 +          
1397 +            if (update_arg( 0 ,
1398 +                 0 , &(args_info->r_z_given),
1399 +                &(local_args_info.r_z_given), optarg, 0, 0, ARG_NO,
1400 +                check_ambiguity, override, 0, 0,
1401 +                "r_z", '-',
1402 +                additional_error))
1403 +              goto failure;
1404 +          
1405 +          }
1406            /* g(cos(theta), cos(omega)).  */
1407            else if (strcmp (long_options[option_index].name, "theta_omega") == 0)
1408            {
# Line 1236 | Line 1433 | cmdline_parser_internal (int argc, char * const *argv,
1433                  &(local_args_info.gxyz_given), optarg, 0, 0, ARG_NO,
1434                  check_ambiguity, override, 0, 0,
1435                  "gxyz", '-',
1436 +                additional_error))
1437 +              goto failure;
1438 +          
1439 +          }
1440 +          /* 2D g(r) (Slab width --dz must be specified).  */
1441 +          else if (strcmp (long_options[option_index].name, "twodgofr") == 0)
1442 +          {
1443 +          
1444 +            if (args_info->staticProps_group_counter && override)
1445 +              reset_group_staticProps (args_info);
1446 +            args_info->staticProps_group_counter += 1;
1447 +          
1448 +            if (update_arg( 0 ,
1449 +                 0 , &(args_info->twodgofr_given),
1450 +                &(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO,
1451 +                check_ambiguity, override, 0, 0,
1452 +                "twodgofr", '-',
1453                  additional_error))
1454                goto failure;
1455            
# Line 1274 | Line 1488 | cmdline_parser_internal (int argc, char * const *argv,
1488                goto failure;
1489            
1490            }
1491 +          /* p(cos(theta)).  */
1492 +          else if (strcmp (long_options[option_index].name, "p_angle") == 0)
1493 +          {
1494 +          
1495 +            if (args_info->staticProps_group_counter && override)
1496 +              reset_group_staticProps (args_info);
1497 +            args_info->staticProps_group_counter += 1;
1498 +          
1499 +            if (update_arg( 0 ,
1500 +                 0 , &(args_info->p_angle_given),
1501 +                &(local_args_info.p_angle_given), optarg, 0, 0, ARG_NO,
1502 +                check_ambiguity, override, 0, 0,
1503 +                "p_angle", '-',
1504 +                additional_error))
1505 +              goto failure;
1506 +          
1507 +          }
1508            /* hxy.  */
1509            else if (strcmp (long_options[option_index].name, "hxy") == 0)
1510            {
# Line 1308 | Line 1539 | cmdline_parser_internal (int argc, char * const *argv,
1539                goto failure;
1540            
1541            }
1542 +          /* angle of R.  */
1543 +          else if (strcmp (long_options[option_index].name, "angle_r") == 0)
1544 +          {
1545 +          
1546 +            if (args_info->staticProps_group_counter && override)
1547 +              reset_group_staticProps (args_info);
1548 +            args_info->staticProps_group_counter += 1;
1549 +          
1550 +            if (update_arg( 0 ,
1551 +                 0 , &(args_info->angle_r_given),
1552 +                &(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO,
1553 +                check_ambiguity, override, 0, 0,
1554 +                "angle_r", '-',
1555 +                additional_error))
1556 +              goto failure;
1557 +          
1558 +          }
1559            /* hull volume of nanoparticle.  */
1560            else if (strcmp (long_options[option_index].name, "hullvol") == 0)
1561            {
# Line 1325 | Line 1573 | cmdline_parser_internal (int argc, char * const *argv,
1573                goto failure;
1574            
1575            }
1576 +          /* length of nanorod.  */
1577 +          else if (strcmp (long_options[option_index].name, "rodlength") == 0)
1578 +          {
1579            
1580 +            if (args_info->staticProps_group_counter && override)
1581 +              reset_group_staticProps (args_info);
1582 +            args_info->staticProps_group_counter += 1;
1583 +          
1584 +            if (update_arg( 0 ,
1585 +                 0 , &(args_info->rodlength_given),
1586 +                &(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO,
1587 +                check_ambiguity, override, 0, 0,
1588 +                "rodlength", '-',
1589 +                additional_error))
1590 +              goto failure;
1591 +          
1592 +          }
1593 +          /* tetrahedrality order parameter by zbin(--sele1 must be specified).  */
1594 +          else if (strcmp (long_options[option_index].name, "tet_param_z") == 0)
1595 +          {
1596 +          
1597 +            if (args_info->staticProps_group_counter && override)
1598 +              reset_group_staticProps (args_info);
1599 +            args_info->staticProps_group_counter += 1;
1600 +          
1601 +            if (update_arg( 0 ,
1602 +                 0 , &(args_info->tet_param_z_given),
1603 +                &(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO,
1604 +                check_ambiguity, override, 0, 0,
1605 +                "tet_param_z", '-',
1606 +                additional_error))
1607 +              goto failure;
1608 +          
1609 +          }
1610 +          
1611            break;
1612          case '?':       /* Invalid option.  */
1613            /* `getopt_long' already printed an error message.  */
# Line 1339 | Line 1621 | cmdline_parser_internal (int argc, char * const *argv,
1621  
1622    if (args_info->staticProps_group_counter > 1)
1623      {
1624 <      fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
1624 >      fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : ""));
1625        error = 1;
1626      }
1627    
# Line 1355 | Line 1637 | cmdline_parser_internal (int argc, char * const *argv,
1637    if ( error )
1638      return (EXIT_FAILURE);
1639  
1640 +  if (optind < argc)
1641 +    {
1642 +      int i = 0 ;
1643 +      int found_prog_name = 0;
1644 +      /* whether program name, i.e., argv[0], is in the remaining args
1645 +         (this may happen with some implementations of getopt,
1646 +          but surely not with the one included by gengetopt) */
1647 +
1648 +      i = optind;
1649 +      while (i < argc)
1650 +        if (argv[i++] == argv[0]) {
1651 +          found_prog_name = 1;
1652 +          break;
1653 +        }
1654 +      i = 0;
1655 +
1656 +      args_info->inputs_num = argc - optind - found_prog_name;
1657 +      args_info->inputs =
1658 +        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1659 +      while (optind < argc)
1660 +        if (argv[optind++] != argv[0])
1661 +          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1662 +    }
1663 +
1664    return 0;
1665  
1666   failure:

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 1795 by gezelter, Fri Sep 7 18:13:55 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines